diff options
Diffstat (limited to 'ftp/IglooFTP/files/patch-FTPcommands.h')
-rw-r--r-- | ftp/IglooFTP/files/patch-FTPcommands.h | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/ftp/IglooFTP/files/patch-FTPcommands.h b/ftp/IglooFTP/files/patch-FTPcommands.h index b18e9aed01cb..d972aaa62b12 100644 --- a/ftp/IglooFTP/files/patch-FTPcommands.h +++ b/ftp/IglooFTP/files/patch-FTPcommands.h @@ -123,122 +123,6 @@ colormap = gtk_widget_get_colormap (window); gdk_color_alloc (colormap, &done_color); ---- ftplist.c.orig Thu Apr 15 17:05:15 1999 -+++ ftplist.c Sat Feb 4 01:15:59 2006 -@@ -1189,6 +1189,15 @@ - IDLE_END; - CHECK_CONNEXION_VOID; - -+ /* Is it worth trying to handle this better? */ -+ -+ char msg_buf[1024]; -+ if ((strchr(filename, '/') != NULL) || (strstr(filename, "..") != NULL)) { -+ snprintf (msg_buf, sizeof(msg_buf), "Skipping non-relative filename: %s", filename); -+ error_message (msg_buf); -+ return; -+ } -+ - if (IGLOO_download (filename, filesize, filedate, NULL)) - { - char that_path[1024]; -@@ -1255,6 +1264,7 @@ - static void - perfom_recursive_command_on_selection (char recursive_command, char *optionnal_arg, char IS_TOP_DIR) - { -+ int fd = -1; - GList *selection = GTK_CLIST (clist)->selection; - gchar *filename; - gchar *fileperm; -@@ -1265,9 +1275,17 @@ - char DIR_FOUND_IN_SELECTION = FALSE; - char *current_remote_dir = strdup (this_session.cwd_dir); - -- tmpnam (tmp_filename); -- tmp = fopen (tmp_filename, "w"); -+ sprintf(tmp_filename, tmpfile_template); - -+ if ((fd = mkstemp (tmp_filename)) == -1 || (tmp = fdopen (fd, "w")) == NULL) -+ { -+ if (fd != -1) { -+ unlink(tmp_filename); -+ close(fd); -+ } -+ DEBUG("Unable to create temporary file."); -+ return; -+ } - - while (selection && (!want_abort)) - { -@@ -1710,6 +1728,7 @@ - static char - download_selection_recursive (void) - { -+ int fd = -1; - GdkColor done_color = GREYCYAN; - GdkColormap *colormap; - GList *selection = GTK_CLIST (clist)->selection; -@@ -1725,10 +1744,19 @@ - char *current_remote_dir = strdup (this_session.cwd_dir); - char current_local_dir[1024]; - -+ sprintf(tmp_filename, tmpfile_template); -+ - getcwd (current_local_dir, sizeof (current_local_dir)); - -- tmpnam (tmp_filename); -- tmp = fopen (tmp_filename, "w"); -+ if ((fd = mkstemp (tmp_filename)) == -1 || (tmp = fdopen (fd, "w")) == NULL) -+ { -+ if (fd != -1) { -+ unlink(tmp_filename); -+ close(fd); -+ } -+ DEBUG("Unable to create temporary file."); -+ return FALSE; -+ } - - colormap = gtk_widget_get_colormap (window); - gdk_color_alloc (colormap, &done_color); -@@ -1748,6 +1776,18 @@ - gtk_clist_get_text (GTK_CLIST (clist), index, 2, &filesize); - gtk_clist_get_text (GTK_CLIST (clist), index, 3, &filedate); - gtk_clist_get_text (GTK_CLIST (clist), index, 4, &fileperm); -+ -+ /* Basic sanity checks */ -+ -+ char msg_buf[1024]; -+ if ((strchr(filename, '/') != NULL) || (strstr(filename, "..") != NULL)) { -+ snprintf (msg_buf, sizeof(msg_buf), "Skipping non-relative filename: %s", filename); -+ error_message (msg_buf); -+ selection = selection->next; -+ gtk_clist_unselect_row (GTK_CLIST (clist), index, 0); -+ gtk_clist_moveto (GTK_CLIST (clist), index, 0, 0.5, 0); -+ continue; -+ } - - if (fileperm[0] != 'd') - { ---- main.c.orig Fri Feb 3 23:52:15 2006 -+++ main.c Sat Feb 4 01:23:16 2006 -@@ -109,6 +109,18 @@ - fpsetmask(0); - #endif - -+ char *td; -+ if ((td = getenv("TMPDIR")) != NULL && strlen(td) != 0) { -+ if (td[strlen(td)-1] == '/') -+ strncpy(tmpfile_template, td, strlen(td)-1); -+ else -+ strncpy(tmpfile_template, td, strlen(td)); -+ } else { -+ strcpy(tmpfile_template, "/tmp"); -+ } -+ strncat(tmpfile_template, "/", sizeof(tmpfile_template)); -+ strncat(tmpfile_template, TMPFILE_FILE, sizeof(tmpfile_template)); -+ - gtk_set_locale (); - gtk_init (&argc, &argv); - --- session.c.orig Thu Apr 15 17:05:15 1999 +++ session.c Fri Feb 3 23:20:24 2006 @@ -32,7 +32,8 @@ |