1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

converted a bunch more fns

This commit is contained in:
Andrew Tridgell 0001-01-01 00:00:00 +00:00
parent c40a1e4ebd
commit f6b8d67304
3 changed files with 55 additions and 39 deletions

View File

@ -224,7 +224,7 @@ int cli_nt_create_uni(struct cli_state *cli, char *fname, uint32 DesiredAccess)
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,24,(strlen(fname) + 1) * 2 + 1,True);
set_message(cli->outbuf,24,0,True);
CVAL(cli->outbuf,smb_com) = SMBntcreateX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -248,8 +248,8 @@ int cli_nt_create_uni(struct cli_state *cli, char *fname, uint32 DesiredAccess)
p++; /* Alignment */
pstrcpy(uni, fname);
unix_to_dos(uni, True);
dos_struni2(p, uni, (strlen(fname) + 1) * 2);
p += dos_struni2(p, uni, (strlen(fname) + 1) * 2);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return -1;
@ -386,7 +386,7 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0', smb_size);
set_message(cli->outbuf,8,10,True);
set_message(cli->outbuf,8,0,True);
CVAL(cli->outbuf,smb_com) = SMBlockingX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -403,6 +403,11 @@ BOOL cli_lock(struct cli_state *cli, int fnum,
SSVAL(p, 0, cli->pid);
SIVAL(p, 2, offset);
SIVAL(p, 6, len);
p += 10;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 2*1000);
@ -431,7 +436,7 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,8,10,True);
set_message(cli->outbuf,8,0,True);
CVAL(cli->outbuf,smb_com) = SMBlockingX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -448,7 +453,8 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
SSVAL(p, 0, cli->pid);
SIVAL(p, 2, offset);
SIVAL(p, 6, len);
p += 10;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return False;
@ -478,7 +484,7 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0', smb_size);
set_message(cli->outbuf,8,20,True);
set_message(cli->outbuf,8,0,True);
CVAL(cli->outbuf,smb_com) = SMBlockingX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -497,6 +503,9 @@ BOOL cli_lock64(struct cli_state *cli, int fnum,
SIVAL(p, 8, (offset&0xffffffff));
SIVAL(p, 12, (len>>32));
SIVAL(p, 16, (len&0xffffffff));
p += 20;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
cli->timeout = (timeout == -1) ? 0x7FFFFFFF : (timeout + 2*1000);
@ -525,7 +534,7 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,8,20,True);
set_message(cli->outbuf,8,0,True);
CVAL(cli->outbuf,smb_com) = SMBlockingX;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -544,7 +553,8 @@ BOOL cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
SIVAL(p, 8, (offset&0xffffffff));
SIVAL(p, 12, (len>>32));
SIVAL(p, 16, (len&0xffffffff));
p += 20;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {
return False;
@ -671,7 +681,7 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t)
memset(cli->outbuf,'\0',smb_size);
memset(cli->inbuf,'\0',smb_size);
set_message(cli->outbuf,8,strlen(fname)+4,True);
set_message(cli->outbuf,8,0,True);
CVAL(cli->outbuf,smb_com) = SMBsetatr;
SSVAL(cli->outbuf,smb_tid,cli->cnum);
@ -681,11 +691,11 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t)
put_dos_date3(cli->outbuf,smb_vwv1, t);
p = smb_buf(cli->outbuf);
*p = 4;
pstrcpy(p+1, fname);
unix_to_dos(p+1,True);
p = skip_string(p,1);
*p = 4;
*p++ = 4;
p += clistr_push(cli, p, fname, -1, CLISTR_TERMINATE | CLISTR_CONVERT);
*p++ = 4;
cli_setup_bcc(cli, p);
cli_send_smb(cli);
if (!cli_receive_smb(cli)) {

View File

@ -41,13 +41,11 @@ BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
p = smb_buf(cli->outbuf);
*p++ = 4;
pstrcpy(p,username);
unix_to_dos(p,True);
p = skip_string(p,1);
p += clistr_push(cli, p, username, -1,
CLISTR_TERMINATE|CLISTR_CONVERT);
*p++ = 4;
pstrcpy(p,host);
unix_to_dos(p,True);
p = skip_string(p,1);
p += clistr_push(cli, p, host, -1,
CLISTR_TERMINATE|CLISTR_CONVERT);
cli_setup_bcc(cli, p);

View File

@ -255,10 +255,9 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
p += 4;
SIVAL(p,0,stype);
p += 4;
pstrcpy(p, workgroup);
unix_to_dos(p, True);
p = skip_string(p,1);
p += clistr_push(cli, p, workgroup, -1,
CLISTR_TERMINATE | CLISTR_CONVERT);
if (cli_api(cli,
param, PTR_DIFF(p,param), 8, /* params, length, max */
@ -275,29 +274,38 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
count=SVAL(rparam,4);
p = rdata;
if (!(stype&0x80000000)) {
for (i = 0;i < count;i++, p += 26) {
char *sname = p;
int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
char *cmnt = comment_offset?(rdata+comment_offset):"";
if (comment_offset < 0 || comment_offset > rdrcnt) continue;
fstring sname, cmnt;
int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
char *cptr = comment_offset?(rdata+comment_offset):NULL;
if (comment_offset < 0 || comment_offset > rdrcnt) continue;
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
dos_to_unix(sname, True);
dos_to_unix(cmnt, True);
fn(sname, stype, cmnt, state);
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
clistr_pull(cli, sname, p,
sizeof(fstring), -1,
CLISTR_TERMINATE |
CLISTR_CONVERT);
fstrcpy(cmnt, "");
if (cptr) {
clistr_pull(cli, cmnt, cptr,
sizeof(fstring), -1,
CLISTR_TERMINATE |
CLISTR_CONVERT);
}
fn(sname, stype, cmnt, state);
}
}
else {
for (i = 0; i < count; i++, p+= 16) {
char *sname = p;
dos_to_unix(sname, True);
fstring sname;
fn(sname, stype, NULL, state);
clistr_pull(cli, sname, p,
sizeof(fstring), -1,
CLISTR_TERMINATE |
CLISTR_CONVERT);
fn(sname, stype, NULL, state);
}
}
}