Fix bug #6021 - smbclient du command does not recuse properly
authorJeremy Allison <jra@samba.org>
Thu, 8 Jan 2009 23:42:53 +0000 (15:42 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 8 Jan 2009 23:42:53 +0000 (15:42 -0800)
Jeremy.

source/client/client.c
source/libsmb/clidfs.c

index 202a0078af6481e3f2c6e834c5a943b6904402b8..9e1173765ec5160a0844d57a24ee5403bd7b8532 100644 (file)
@@ -728,11 +728,11 @@ static void do_list_helper(const char *mntpoint, file_info *f, const char *mask,
                                return;
                        }
                        p = strrchr_m(mask2,CLI_DIRSEP_CHAR);
-                       if (!p) {
-                               TALLOC_FREE(dir);
-                               return;
+                       if (p) {
+                               p[1] = 0;
+                       } else {
+                               mask2[0] = '\0';
                        }
-                       p[1] = 0;
                        mask2 = talloc_asprintf_append(mask2,
                                        "%s%s*",
                                        f->name,
index 35922b13e9493d942160485a443e4e7a220c4067..9fdc239c3658a5a380b3e9734cac17b7ae36f6cf 100644 (file)
@@ -306,10 +306,11 @@ static void cli_cm_set_mntpoint(struct cli_state *c, const char *mnt)
        }
 
        if (p) {
-               char *name = clean_name(NULL, p->mount);
+               char *name = clean_name(NULL, mnt);
                if (!name) {
                        return;
                }
+               TALLOC_FREE(p->mount);
                p->mount = talloc_strdup(p, name);
                TALLOC_FREE(name);
        }