diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-14 11:12:50 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-14 12:20:12 +0100 |
commit | f4cf1c56a20916018c9a6513754b0b08c24c9d04 (patch) | |
tree | 959d0658b45497e77b0a3b9071f5c8761dff5e51 /source3/libsmb/clirap.c | |
parent | 4a777ec4d709d2fce2378b7b4d740aa73c32e73b (diff) | |
download | samba-f4cf1c56a20916018c9a6513754b0b08c24c9d04.tar.gz samba-f4cf1c56a20916018c9a6513754b0b08c24c9d04.tar.bz2 samba-f4cf1c56a20916018c9a6513754b0b08c24c9d04.zip |
s3: Add min_setup, min_param and min_data to cli_trans_recv
Every caller that expects to receive something needs to check if enough was
sent. Make this check mandatory for everyone.
Yes, this makes the parameter list for cli_trans a bit silly, but that's just
the way it is: A silly protocol request :-)
While there, convert some _done functions to tevent_req_simple_finish_ntstatus.
Diffstat (limited to 'source3/libsmb/clirap.c')
-rw-r--r-- | source3/libsmb/clirap.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index c3ec82bd3e..13e16b26df 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -974,19 +974,16 @@ bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum, struct timespec *change_time, SMB_INO_T *ino) { - unsigned int data_len = 0; - unsigned int param_len = 0; + uint32_t data_len = 0; uint16 setup; uint8_t param[4]; - uint8_t *rparam=NULL, *rdata=NULL; + uint8_t *rdata=NULL; NTSTATUS status; /* if its a win95 server then fail this - win95 totally screws it up */ if (cli->win95) return False; - param_len = 4; - SSVAL(param, 0, fnum); SSVAL(param, 2, SMB_QUERY_FILE_ALL_INFO); @@ -995,20 +992,16 @@ bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum, status = cli_trans(talloc_tos(), cli, SMBtrans2, NULL, -1, 0, 0, /* name, fid, function, flags */ &setup, 1, 0, /* setup, length, max */ - param, param_len, 2, /* param, length, max */ + param, 4, 2, /* param, length, max */ NULL, 0, MIN(cli->max_xmit, 0xffff), /* data, length, max */ - NULL, NULL, /* rsetup, length */ - &rparam, ¶m_len, /* rparam, length */ - &rdata, &data_len); + NULL, 0, NULL, /* rsetup, length */ + NULL, 0, NULL, /* rparam, length */ + &rdata, 68, &data_len); if (!NT_STATUS_IS_OK(status)) { return false; } - if (!rdata || data_len < 68) { - return False; - } - if (create_time) { *create_time = interpret_long_date((char *)rdata+0); } @@ -1032,7 +1025,6 @@ bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum, } TALLOC_FREE(rdata); - TALLOC_FREE(rparam); return True; } |