summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-09 20:17:11 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-09 20:17:11 +0000
commite0445419b2d50ae6efef36f4f295ebcfdbf1ad82 (patch)
treebeaeeb48062c0e8d1705e63f01f74d2e05352e0b
parentcaeb99201a1471bd709b4e8f07c57e5caabf0795 (diff)
downloadsamba-e0445419b2d50ae6efef36f4f295ebcfdbf1ad82.tar.gz
dce/rpc.
-rw-r--r--source/libsmb/clientgen.c5
-rw-r--r--source/rpc_client/cli_pipe.c13
-rw-r--r--source/rpc_parse/parse_rpc.c8
-rw-r--r--source/rpcclient/cmd_samr.c1
-rw-r--r--source/rpcclient/rpcclient.c24
-rw-r--r--source/smbwrapper/smbw.c2
6 files changed, 34 insertions, 19 deletions
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index 8eb832128cd..025ec5e73f0 100644
--- a/source/libsmb/clientgen.c
+++ b/source/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/source/rpc_client/cli_pipe.c b/source/rpc_client/cli_pipe.c
index 0b9a4e95e5c..732161ad822 100644
--- a/source/rpc_client/cli_pipe.c
+++ b/source/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/source/rpc_parse/parse_rpc.c b/source/rpc_parse/parse_rpc.c
index 43cb2046819..213d6945094 100644
--- a/source/rpc_parse/parse_rpc.c
+++ b/source/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/source/rpcclient/cmd_samr.c b/source/rpcclient/cmd_samr.c
index 1c361f0f5e6..783bc128e7c 100644
--- a/source/rpcclient/cmd_samr.c
+++ b/source/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/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c
index 55bc0e15cc1..9d657e923d8 100644
--- a/source/rpcclient/rpcclient.c
+++ b/source/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/source/smbwrapper/smbw.c b/source/smbwrapper/smbw.c
index 660e65f421e..c0990b62b11 100644
--- a/source/smbwrapper/smbw.c
+++ b/source/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);