diff options
-rw-r--r-- | source3/libsmb/clientgen.c | 5 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 13 | ||||
-rw-r--r-- | source3/rpc_parse/parse_rpc.c | 8 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 1 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 24 | ||||
-rw-r--r-- | source3/smbwrapper/smbw.c | 2 |
6 files changed, 34 insertions, 19 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 8eb832128c..025ec5e73f 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -614,8 +614,8 @@ prots[] = {PROTOCOL_LANMAN1,"LANMAN1.0"}, {PROTOCOL_LANMAN2,"LM1.2X002"}, {PROTOCOL_LANMAN2,"Samba"}, - {PROTOCOL_NT1,"NT LM 0.12"}, {PROTOCOL_NT1,"NT LANMAN 1.0"}, + {PROTOCOL_NT1,"NT LM 0.12"}, {-1,NULL} }; @@ -1318,7 +1318,8 @@ static void cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1 SIVAL(cli->outbuf,smb_vwv3,offset); SIVAL(cli->outbuf,smb_vwv5,IS_BITS_SET_ALL(mode, 0x0008) ? 0xFFFFFFFF : 0); SSVAL(cli->outbuf,smb_vwv7,mode); - + + SSVAL(cli->outbuf,smb_vwv8,IS_BITS_SET_ALL(mode, 0x0008) ? size : 0); SSVAL(cli->outbuf,smb_vwv10,size); SSVAL(cli->outbuf,smb_vwv11, smb_buf(cli->outbuf) - smb_base(cli->outbuf)); diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 0b9a4e95e5..732161ad82 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -37,12 +37,17 @@ extern pstring global_myname; /******************************************************************** rpc pipe call id ********************************************************************/ +static uint32 call_id = 0; static uint32 get_rpc_call_id(void) { - static uint32 call_id = 1; return ++call_id; } +static uint32 reset_rpc_call_id(void) +{ + call_id = 0; +} + /******************************************************************* uses SMBreadX to get rest of rpc data ********************************************************************/ @@ -451,7 +456,7 @@ static BOOL create_rpc_request(prs_struct *rhdr, uint8 op_num, int data_len, if (auth_len != 0) { - alloc_hint = data_len - 0x18 - auth_len - 10; + alloc_hint = data_len - 0x18 - auth_len - 16; } else { @@ -849,6 +854,8 @@ static BOOL rpc_pipe_bind(struct cli_state *cli, char *pipe_name, prs_mem_free(&rdata ); prs_mem_free(&rparam ); + reset_rpc_call_id(); + return valid_ack; } @@ -862,6 +869,8 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name, BOOL encrypted) RPC_IFACE transfer; int fnum; + reset_rpc_call_id(); + /******************* open the pipe *****************/ if (IS_BITS_SET_ALL(cli->capabilities, CAP_NT_SMBS)) { diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 43cb204681..213d694509 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -532,8 +532,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname+1); + make_str_hdr(&neg->hdr_myname, len_myname+1, len_myname+1, 0x20); + make_str_hdr(&neg->hdr_domain, len_domain+1, len_domain+1, 0x20 + len_myname+1); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -554,8 +554,8 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); + prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len-1, sizeof(neg->domain)); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len-1, sizeof(neg->myname)); } /******************************************************************* diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 1c361f0f5e..783bc128e7 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -61,7 +61,6 @@ void cmd_sam_test(struct client_info *info) fstrcat(srv_name, info->myhostname); strupper(srv_name); - fprintf(out_hnd, "SAM Encryption Test\n"); /* open SAMR session. */ diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 55bc0e15cc..9d657e923d 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -463,6 +463,11 @@ enum client_action myumask = umask(0); umask(myumask); + if (!get_myname(global_myname, NULL)) + { + fprintf(stderr, "Failed to get my hostname.\n"); + } + if (getenv("USER")) { pstrcpy(smb_cli->user_name,getenv("USER")); @@ -540,7 +545,7 @@ enum client_action cli_action = CLIENT_SVC; } - while ((opt = getopt(argc, argv,"s:B:O:M:S:i:N:d:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF) + while ((opt = getopt(argc, argv,"s:B:O:M:S:i:N:n:d:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF) { switch (opt) { @@ -616,6 +621,12 @@ enum client_action break; } + case 'n': + { + fstrcpy(global_myname, optarg); + break; + } + case 'N': { got_pass = True; @@ -679,15 +690,10 @@ enum client_action exit(1); } - DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION)); - - if (!get_myname(cli_info.myhostname, NULL)) - { - fprintf(stderr, "Failed to get my hostname.\n"); - } - - fstrcpy(global_myname, cli_info.myhostname); strupper(global_myname); + fstrcpy(cli_info.myhostname, global_myname); + + DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION)); if (!lp_load(servicesf,True, False, False)) { diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 660e65f421..c0990b62b1 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -737,7 +737,7 @@ ssize_t smbw_pwrite(int fd, void *buf, size_t count, off_t ofs) return -1; } - ret = cli_write(&file->srv->cli, file->f->cli_fd, buf, ofs, count); + ret = cli_write(&file->srv->cli, file->f->cli_fd, 0, buf, ofs, count); if (ret == -1) { errno = smbw_errno(&file->srv->cli); |