summaryrefslogtreecommitdiffstats
path: root/source3/libsmb/clifile.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-10-24 18:05:03 +0200
committerVolker Lendecke <vlendec@samba.org>2010-10-24 20:46:28 +0000
commit28e243f7ad1a0b645a00bb92b43638af5bfe8b8d (patch)
tree7a5e3f861474adb471e63293e18e0aee0714aa0f /source3/libsmb/clifile.c
parentdedda3e245d9ee2a875494d0f3c42c44e749f4f6 (diff)
downloadsamba-28e243f7ad1a0b645a00bb92b43638af5bfe8b8d.tar.gz
samba-28e243f7ad1a0b645a00bb92b43638af5bfe8b8d.tar.xz
samba-28e243f7ad1a0b645a00bb92b43638af5bfe8b8d.zip
s3: Use cli_setpathinfo in cli_posix_chown_chmod_internal
Diffstat (limited to 'source3/libsmb/clifile.c')
-rw-r--r--source3/libsmb/clifile.c70
1 files changed, 16 insertions, 54 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index a266e2ab22..a0fa7e2870 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -884,18 +884,11 @@ NTSTATUS cli_posix_stat(struct cli_state *cli,
Chmod or chown a file internal (UNIX extensions).
****************************************************************************/
-struct ch_state {
- uint16_t setup;
- uint8_t *param;
- uint8_t *data;
+struct cli_posix_chown_chmod_internal_state {
+ uint8_t data[100];
};
-static void cli_posix_chown_chmod_internal_done(struct tevent_req *subreq)
-{
- NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, NULL, 0, NULL,
- NULL, 0, NULL, NULL, 0, NULL);
- tevent_req_simple_finish_ntstatus(subreq, status);
-}
+static void cli_posix_chown_chmod_internal_done(struct tevent_req *subreq);
static struct tevent_req *cli_posix_chown_chmod_internal_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
@@ -906,67 +899,36 @@ static struct tevent_req *cli_posix_chown_chmod_internal_send(TALLOC_CTX *mem_ct
uint32_t gid)
{
struct tevent_req *req = NULL, *subreq = NULL;
- struct ch_state *state = NULL;
+ struct cli_posix_chown_chmod_internal_state *state = NULL;
- req = tevent_req_create(mem_ctx, &state, struct ch_state);
+ req = tevent_req_create(mem_ctx, &state,
+ struct cli_posix_chown_chmod_internal_state);
if (req == NULL) {
return NULL;
}
- /* Setup setup word. */
- SSVAL(&state->setup, 0, TRANSACT2_SETPATHINFO);
-
- /* Setup param array. */
- state->param = talloc_array(state, uint8_t, 6);
- if (tevent_req_nomem(state->param, req)) {
- return tevent_req_post(req, ev);
- }
- memset(state->param, '\0', 6);
- SSVAL(state->param,0,SMB_SET_FILE_UNIX_BASIC);
-
- state->param = trans2_bytes_push_str(state->param, cli_ucs2(cli), fname,
- strlen(fname)+1, NULL);
-
- if (tevent_req_nomem(state->param, req)) {
- return tevent_req_post(req, ev);
- }
-
- /* Setup data array. */
- state->data = talloc_array(state, uint8_t, 100);
- if (tevent_req_nomem(state->data, req)) {
- return tevent_req_post(req, ev);
- }
memset(state->data, 0xff, 40); /* Set all sizes/times to no change. */
memset(&state->data[40], '\0', 60);
SIVAL(state->data,40,uid);
SIVAL(state->data,48,gid);
SIVAL(state->data,84,mode);
- subreq = cli_trans_send(state, /* mem ctx. */
- ev, /* event ctx. */
- cli, /* cli_state. */
- SMBtrans2, /* cmd. */
- NULL, /* pipe name. */
- -1, /* fid. */
- 0, /* function. */
- 0, /* flags. */
- &state->setup, /* setup. */
- 1, /* num setup uint16_t words. */
- 0, /* max returned setup. */
- state->param, /* param. */
- talloc_get_size(state->param), /* num param. */
- 2, /* max returned param. */
- state->data, /* data. */
- talloc_get_size(state->data), /* num data. */
- 0); /* max returned data. */
-
+ subreq = cli_setpathinfo_send(state, ev, cli, SMB_SET_FILE_UNIX_BASIC,
+ fname, state->data, sizeof(state->data));
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, cli_posix_chown_chmod_internal_done, req);
+ tevent_req_set_callback(subreq, cli_posix_chown_chmod_internal_done,
+ req);
return req;
}
+static void cli_posix_chown_chmod_internal_done(struct tevent_req *subreq)
+{
+ NTSTATUS status = cli_setpathinfo_recv(subreq);
+ tevent_req_simple_finish_ntstatus(subreq, status);
+}
+
/****************************************************************************
chmod a file (UNIX extensions).
****************************************************************************/