summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-01-16 12:56:09 +0100
committerVolker Lendecke <vl@samba.org>2011-01-17 08:03:42 +0100
commitcb412d22eba8cdb81878628aa4bce3ca4591770f (patch)
tree079231e6716c96227353e8e4142a2f5deb686c86 /source3
parent21d5485e062e37f112ce82ab3ae4e73c53ce081d (diff)
downloadsamba-cb412d22eba8cdb81878628aa4bce3ca4591770f.tar.gz
samba-cb412d22eba8cdb81878628aa4bce3ca4591770f.tar.bz2
samba-cb412d22eba8cdb81878628aa4bce3ca4591770f.zip
s3: Make cli_setpathinfo_basic use cli_setpathinfo
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h12
-rw-r--r--source3/libsmb/clirap.c73
-rw-r--r--source3/libsmb/libsmb_file.c12
3 files changed, 20 insertions, 77 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index b710d713b0..a029702168 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2301,12 +2301,12 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
time_t *write_time,
SMB_OFF_T *size,
uint16 *mode);
-bool cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
- time_t create_time,
- time_t access_time,
- time_t write_time,
- time_t change_time,
- uint16 mode);
+NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
+ time_t create_time,
+ time_t access_time,
+ time_t write_time,
+ time_t change_time,
+ uint16 mode);
struct tevent_req *cli_qpathinfo2_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct cli_state *cli,
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index 80d93d32d8..0955d1e3bb 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -656,44 +656,16 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
Send a setpathinfo call.
****************************************************************************/
-bool cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
- time_t create_time,
- time_t access_time,
- time_t write_time,
- time_t change_time,
- uint16 mode)
+NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
+ time_t create_time,
+ time_t access_time,
+ time_t write_time,
+ time_t change_time,
+ uint16 mode)
{
unsigned int data_len = 0;
- unsigned int param_len = 0;
- unsigned int rparam_len, rdata_len;
- uint16 setup = TRANSACT2_SETPATHINFO;
- char *param;
char data[40];
- char *rparam=NULL, *rdata=NULL;
- int count=8;
- bool ret;
char *p;
- size_t nlen = 2*(strlen(fname)+1);
-
- param = SMB_MALLOC_ARRAY(char, 6+nlen+2);
- if (!param) {
- return false;
- }
- memset(param, '\0', 6);
- memset(data, 0, sizeof(data));
-
- p = param;
-
- /* Add the information level */
- SSVAL(p, 0, SMB_FILE_BASIC_INFORMATION);
-
- /* Skip reserved */
- p += 6;
-
- /* Add the file name */
- p += clistr_push(cli, p, fname, nlen, STR_TERMINATE);
-
- param_len = PTR_DIFF(p, param);
p = data;
@@ -722,37 +694,8 @@ bool cli_setpathinfo_basic(struct cli_state *cli, const char *fname,
data_len = PTR_DIFF(p, data);
- do {
- ret = (cli_send_trans(cli, SMBtrans2,
- NULL, /* Name */
- -1, 0, /* fid, flags */
- &setup, 1, 0, /* setup, length, max */
- param, param_len, 10, /* param, length, max */
- data, data_len, cli->max_xmit /* data, length, max */
- ) &&
- cli_receive_trans(cli, SMBtrans2,
- &rparam, &rparam_len,
- &rdata, &rdata_len));
- if (!cli_is_dos_error(cli)) break;
- if (!ret) {
- /* we need to work around a Win95 bug - sometimes
- it gives ERRSRV/ERRerror temprarily */
- uint8 eclass;
- uint32 ecode;
- cli_dos_error(cli, &eclass, &ecode);
- if (eclass != ERRSRV || ecode != ERRerror) break;
- smb_msleep(100);
- }
- } while (count-- && ret==False);
-
- SAFE_FREE(param);
- if (!ret) {
- return False;
- }
-
- SAFE_FREE(rdata);
- SAFE_FREE(rparam);
- return True;
+ return cli_setpathinfo(cli, SMB_FILE_BASIC_INFORMATION, fname,
+ (uint8_t *)data, data_len);
}
/****************************************************************************
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 6216c38bb1..58403dfbb3 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -603,12 +603,12 @@ SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path,
* attributes manipulated.
*/
if (srv->no_pathinfo ||
- ! cli_setpathinfo_basic(srv->cli, path,
- create_time,
- access_time,
- write_time,
- change_time,
- mode)) {
+ !NT_STATUS_IS_OK(cli_setpathinfo_basic(srv->cli, path,
+ create_time,
+ access_time,
+ write_time,
+ change_time,
+ mode))) {
/*
* setpathinfo is not supported; go to plan B.