# HG changeset patch # User masneyb # Date 1163726458 0 # Node ID 1c8d6b6b7950f6a8b0b4cf74529c0755780108d5 # Parent 0cf4d8c46b82f6f795f6c186a5cfa60c6e92a554 2006-11-16 Brian Masney * lib/protocols.c - skip over the hidden files when doing a recursive transfer if the shown_hidden_files option is disabled. (closes #321573) diff -r 0cf4d8c46b82 -r 1c8d6b6b7950 ChangeLog --- a/ChangeLog Fri Nov 17 00:44:40 2006 +0000 +++ b/ChangeLog Fri Nov 17 01:20:58 2006 +0000 @@ -1,4 +1,7 @@ 2006-11-16 Brian Masney + * lib/protocols.c - skip over the hidden files when doing a recursive + transfer if the shown_hidden_files option is disabled. (closes #321573) + * lib/sshv2.c (sshv2_initialize_string_with_path) - make sure the endpos variable is pointing to the position after the string. This fixes an issue with the current CVS code where files could not be transferred. @@ -3708,7 +3711,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.498 2006/11/17 00:44:38 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.499 2006/11/17 01:20:57 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 0cf4d8c46b82 -r 1c8d6b6b7950 lib/protocols.c --- a/lib/protocols.c Fri Nov 17 00:44:40 2006 +0000 +++ b/lib/protocols.c Fri Nov 17 01:20:58 2006 +0000 @@ -1861,31 +1861,37 @@ static GHashTable * gftp_gen_dir_hash (gftp_request * request, int *ret) { + intptr_t show_hidden_files; GHashTable * dirhash; gftp_file * fle; off_t *newsize; + *ret = gftp_list_files (request); + if (*ret != 0) + return (NULL); + dirhash = g_hash_table_new (string_hash_function, string_hash_compare); - *ret = gftp_list_files (request); - if (*ret == 0) + gftp_lookup_request_option (request, "show_hidden_files", &show_hidden_files); + + fle = g_malloc0 (sizeof (*fle)); + while (gftp_get_next_file (request, NULL, fle) > 0) { - fle = g_malloc0 (sizeof (*fle)); - while (gftp_get_next_file (request, NULL, fle) > 0) + if (!show_hidden_files && *fle->file == '.' && + strcmp (fle->file, "..") != 0) { - newsize = g_malloc (sizeof (*newsize)); - *newsize = fle->size; - g_hash_table_insert (dirhash, fle->file, newsize); - fle->file = NULL; gftp_file_destroy (fle, 0); + continue; } - gftp_end_transfer (request); - g_free (fle); + + newsize = g_malloc (sizeof (*newsize)); + *newsize = fle->size; + g_hash_table_insert (dirhash, fle->file, newsize); + fle->file = NULL; + gftp_file_destroy (fle, 0); } - else - { - g_hash_table_destroy (dirhash); - dirhash = NULL; - } + + gftp_end_transfer (request); + g_free (fle); return (dirhash); } @@ -1914,12 +1920,16 @@ static GList * gftp_get_dir_listing (gftp_transfer * transfer, int getothdir, int *ret) { + intptr_t show_hidden_files; GHashTable * dirhash; GList * templist; gftp_file * fle; off_t *newsize; char *newname; + gftp_lookup_request_option (transfer->fromreq, "show_hidden_files", + &show_hidden_files); + if (getothdir && transfer->toreq != NULL) { dirhash = gftp_gen_dir_hash (transfer->toreq, ret); @@ -1940,7 +1950,8 @@ templist = NULL; while (gftp_get_next_file (transfer->fromreq, NULL, fle) > 0) { - if (strcmp (fle->file, ".") == 0 || strcmp (fle->file, "..") == 0) + if (strcmp (fle->file, ".") == 0 || strcmp (fle->file, "..") == 0 || + (!show_hidden_files && *fle->file == '.')) { gftp_file_destroy (fle, 0); continue;