diff --git a/source3/client/client.c b/source3/client/client.c index e979ddf..1b9c1f9 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -539,7 +539,7 @@ static void display_finfo(struct cli_state *cli_state, struct file_info *finfo, t = finfo->mtime_ts.tv_sec; /* the time is assumed to be passed as GMT */ if (!showacls) { - d_printf(" %-30s%7.7s %8.0f %s", + d_printf("%s\t%s\t%8.0f\t%s", finfo->name, attrib_string(finfo->mode), (double)finfo->size, @@ -799,7 +799,7 @@ static void do_list_helper(const char *mntpoint, struct file_info *f, A wrapper around cli_list that adds recursion. ****************************************************************************/ -void do_list(const char *mask, +int do_list(const char *mask, uint16 attribute, void (*fn)(struct cli_state *cli_state, struct file_info *, const char *dir), @@ -810,6 +810,7 @@ void do_list(const char *mask, TALLOC_CTX *ctx = talloc_tos(); struct cli_state *targetcli = NULL; char *targetpath = NULL; + int rc = 0; if (in_do_list && rec) { fprintf(stderr, "INTERNAL ERROR: do_list called recursively when the recursive flag is true\n"); @@ -837,7 +838,7 @@ void do_list(const char *mask, char *head = talloc_strdup(ctx, do_list_queue_head()); if (!head) { - return; + return 1; } /* check for dfs */ @@ -884,15 +885,18 @@ void do_list(const char *mask, if (!NT_STATUS_IS_OK(status)) { d_printf("%s listing %s\n", nt_errstr(status), targetpath); + rc = 1; } TALLOC_FREE(targetpath); } else { d_printf("do_list: [%s] %s\n", mask, cli_errstr(cli)); + rc = 1; } } in_do_list = 0; reset_do_list_queue(); + return rc; } /**************************************************************************** @@ -932,7 +936,9 @@ static int cmd_dir(void) client_set_cwd(client_get_cur_dir()); } - do_list(mask, attribute, display_finfo, recurse, true); + if(do_list(mask, attribute, display_finfo, recurse, true) == 1){ + return 1; + } rc = do_dskattr(); @@ -1513,7 +1519,9 @@ static int cmd_mkdir(void) return 1; } if (!NT_STATUS_IS_OK(cli_chkpath(targetcli, ddir2))) { - do_mkdir(ddir2); + if(!do_mkdir(ddir2)){ + return 1; + } } ddir2 = talloc_asprintf_append(ddir2, "%s", CLI_DIRSEP_STR); if (!ddir2) { @@ -1522,7 +1530,9 @@ static int cmd_mkdir(void) p = strtok_r(NULL, "/\\", &saveptr); } } else { - do_mkdir(mask); + if(!do_mkdir(mask)){ + return 1; + } } return 0; @@ -2218,7 +2228,9 @@ static int cmd_del(void) return 1; } - do_list(mask,attribute,do_del,false,false); + if(do_list(mask,attribute,do_del,false,false) == 1){ + return 1; + } return 0; } @@ -2754,6 +2766,7 @@ static int cmd_rmdir(void) if (!NT_STATUS_IS_OK(cli_rmdir(targetcli, targetname))) { d_printf("%s removing remote directory file %s\n", cli_errstr(targetcli),mask); + return 1; } return 0; diff --git a/source3/client/client_proto.h b/source3/client/client_proto.h index 8623435..03957e8 100644 --- a/source3/client/client_proto.h +++ b/source3/client/client_proto.h @@ -28,7 +28,7 @@ const char *client_get_cur_dir(void); const char *client_set_cur_dir(const char *newdir); -void do_list(const char *mask, +int do_list(const char *mask, uint16 attribute, void (*fn)(struct cli_state *cli_state, struct file_info *, const char *dir),