In certain situations the samba server returns an empty ('') directory name (an example of such situation at the end of the report). This causes smbclient to fall into an infinite loop when invoked as: smbclient -N '//some/where' -c 'recurse;ls' It is so because "cd ''" causes it to stay in current directory. It would be nice if smbclient would print a warning and not enter the empty directory. I am aware that this is not a protection against a rouge server, which could just provide an infinite amount of bogus directory data. However the proposed behavior would help diagnose misconfigured servers. An example of such misconfiguration is that when there are filenames with non-utf8, non-ascii characters and "unix charset" not set. When such (non-valid utf8) character is the first character of a directory name, samba server truncates the name before the first character, resulting in an empty filename. Proposed patch: --- client.c.orig 2003-07-14 13:37:52.000000000 +0200 +++ client.c 2003-07-14 13:47:33.000000000 +0200 @@ -481,6 +481,11 @@ pstring mask2; char *p; + if (*f->name == '\0') { + d_printf("Empty dir name returned. Possible server misconfiguration.\n"); + return; + } + pstrcpy(mask2, mask); p = strrchr_m(mask2,'\\'); if (!p) return;
Checked in. Thanks! I made the if statment a bit shorter though.
originally reported against 3.0.0beta2. CLeaning out non-production release versions.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.