Use the given name, not the absolute pathname, when printing out ACL info.
[metze/samba/wip.git] / source3 / client / client.c
index b4e1985a837b3a14eb1fed04106ff8469c4102d0..1c05c4035d1ae00dc211b6cf34fbc7e9c7766707 100644 (file)
@@ -40,7 +40,7 @@ static char *desthost;
 static char *calling_name;
 static bool grepable = false;
 static char *cmdstr = NULL;
-static const char *cmd_ptr = NULL;
+const char *cmd_ptr = NULL;
 
 static int io_bufsize = 524288;
 
@@ -521,14 +521,14 @@ static void display_finfo(file_info *finfo, const char *dir)
                /* create absolute filename for cli_nt_create() FIXME */
                afname = talloc_asprintf(ctx,
                                        "%s%s%s",
-                                       client_get_cwd(),
+                                       dir,
                                        CLI_DIRSEP_STR,
                                        finfo->name);
                if (!afname) {
                        return;
                }
                /* print file meta date header */
-               d_printf( "FILENAME:%s\n", afname);
+               d_printf( "FILENAME:%s\n", finfo->name);
                d_printf( "MODE:%s\n", attrib_string(finfo->mode));
                d_printf( "SIZE:%.0f\n", (double)finfo->size);
                d_printf( "MTIME:%s", time_to_asc(t));
@@ -943,6 +943,7 @@ static int cmd_echo(void)
        TALLOC_CTX *ctx = talloc_tos();
        char *num;
        char *data;
+       NTSTATUS status;
 
        if (!next_token_talloc(ctx, &cmd_ptr, &num, NULL)
            || !next_token_talloc(ctx, &cmd_ptr, &data, NULL)) {
@@ -950,9 +951,10 @@ static int cmd_echo(void)
                return 1;
        }
 
-       if (!cli_echo(cli, atoi(num), (uint8 *)data, strlen(data))) {
-               d_printf("echo failed: %s\n",
-                        nt_errstr(cli_get_nt_error(cli)));
+       status = cli_echo(cli, atoi(num), data_blob_const(data, strlen(data)));
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_printf("echo failed: %s\n", nt_errstr(status));
                return 1;
        }
 
@@ -1078,7 +1080,7 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
                get_total_time_ms += this_time;
                get_total_size += nread;
 
-               DEBUG(1,("(%3.1f kb/s) (average %3.1f kb/s)\n",
+               DEBUG(1,("(%3.1f KiloBytes/sec) (average %3.1f KiloBytes/sec)\n",
                         nread / (1.024*this_time + 1.0e-4),
                         get_total_size / (1.024*get_total_time_ms)));
        }
@@ -3634,9 +3636,10 @@ static bool browse_host_rpc(bool sort)
        uint32_t total_entries = 0;
        int i;
 
-       pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status);
+       status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id,
+                                         &pipe_hnd);
 
-       if (pipe_hnd == NULL) {
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("Could not connect to srvsvc pipe: %s\n",
                           nt_errstr(status)));
                TALLOC_FREE(frame);
@@ -4382,7 +4385,7 @@ static void readline_callback(void)
 
                set_smb_read_error(&cli->smb_rw_error, SMB_READ_OK);
 
-               status = receive_smb_raw(cli->fd, cli->inbuf, 0, 0, &len);
+               status = receive_smb_raw(cli->fd, cli->inbuf, cli->bufsize, 0, 0, &len);
 
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0, ("Read from server failed, maybe it closed "
@@ -4416,7 +4419,7 @@ static void readline_callback(void)
        {
                unsigned char garbage[16];
                memset(garbage, 0xf0, sizeof(garbage));
-               cli_echo(cli, 1, garbage, sizeof(garbage));
+               cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
        }
 }
 
@@ -4875,6 +4878,11 @@ static int do_message_op(void)
                        argv[0], get_dyn_CONFIGFILE());
        }
 
+       if (get_cmdline_auth_info_use_machine_account() &&
+           !set_cmdline_auth_info_machine_account_creds()) {
+               exit(-1);
+       }
+
        load_interfaces();
 
        if (service_opt && service) {