diff options
author | Volker Lendecke <vl@samba.org> | 2010-10-24 17:06:47 +0200 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2010-10-24 20:46:28 +0000 |
commit | dedda3e245d9ee2a875494d0f3c42c44e749f4f6 (patch) | |
tree | 786d94be32841ec2f0ba176465460795fa714bb9 /source3/libsmb | |
parent | c0a6b74aa4cb1c3833353b28b22b83df59955cfd (diff) | |
download | samba-dedda3e245d9ee2a875494d0f3c42c44e749f4f6.tar.gz samba-dedda3e245d9ee2a875494d0f3c42c44e749f4f6.tar.bz2 samba-dedda3e245d9ee2a875494d0f3c42c44e749f4f6.zip |
s3: Use cli_setpathinfo in cli_posix_link_internal
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clifile.c | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 04a76f5c9b..a266e2ab22 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -210,18 +210,11 @@ NTSTATUS cli_setpathinfo_recv(struct tevent_req *req) Creates new name (sym)linked to oldname. ****************************************************************************/ -struct link_state { - uint16_t setup; - uint8_t *param; +struct cli_posix_link_internal_state { uint8_t *data; }; -static void cli_posix_link_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_link_internal_done(struct tevent_req *subreq); static struct tevent_req *cli_posix_link_internal_send(TALLOC_CTX *mem_ctx, struct event_context *ev, @@ -231,57 +224,25 @@ static struct tevent_req *cli_posix_link_internal_send(TALLOC_CTX *mem_ctx, const char *newname) { struct tevent_req *req = NULL, *subreq = NULL; - struct link_state *state = NULL; + struct cli_posix_link_internal_state *state = NULL; - req = tevent_req_create(mem_ctx, &state, struct link_state); + req = tevent_req_create(mem_ctx, &state, + struct cli_posix_link_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, level); - - state->param = trans2_bytes_push_str(state->param, cli_ucs2(cli), newname, - strlen(newname)+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, 0); if (tevent_req_nomem(state->data, req)) { return tevent_req_post(req, ev); } - state->data = trans2_bytes_push_str(state->data, cli_ucs2(cli), oldname, - strlen(oldname)+1, NULL); - - 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. */ + state->data = trans2_bytes_push_str( + state->data, cli_ucs2(cli), oldname, strlen(oldname)+1, NULL); + subreq = cli_setpathinfo_send( + state, ev, cli, level, newname, + state->data, talloc_get_size(state->data)); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } @@ -289,6 +250,12 @@ static struct tevent_req *cli_posix_link_internal_send(TALLOC_CTX *mem_ctx, return req; } +static void cli_posix_link_internal_done(struct tevent_req *subreq) +{ + NTSTATUS status = cli_setpathinfo_recv(subreq); + tevent_req_simple_finish_ntstatus(subreq, status); +} + /**************************************************************************** Symlink a file (UNIX extensions). ****************************************************************************/ |