summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-07-25 17:49:20 +0200
committerVolker Lendecke <vl@samba.org>2010-07-25 22:29:44 +0200
commitd5e285abae34339f6eabc54a17049dcc5b56a6b0 (patch)
tree29b435649ce8cb2a00151ee474763e8263f3221c /source3
parent786e4cd0980f0562b28ac74612a72faa4e2050cc (diff)
downloadsamba-d5e285abae34339f6eabc54a17049dcc5b56a6b0.tar.gz
samba-d5e285abae34339f6eabc54a17049dcc5b56a6b0.tar.bz2
samba-d5e285abae34339f6eabc54a17049dcc5b56a6b0.zip
s3: Convert cli_posix_stat to cli_qpathinfo_send
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clifile.c77
1 files changed, 20 insertions, 57 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index d690f7ec67..e5baa0ee2a 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -704,22 +704,7 @@ struct stat_state {
uint8_t *data;
};
-static void cli_posix_stat_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- struct stat_state *state = tevent_req_data(req, struct stat_state);
- NTSTATUS status;
-
- status = cli_trans_recv(subreq, state, NULL, 0, NULL, NULL, 0, NULL,
- &state->data, 100, &state->num_data);
- TALLOC_FREE(subreq);
- if (!NT_STATUS_IS_OK(status)) {
- tevent_req_nterror(req, status);
- return;
- }
- tevent_req_done(req);
-}
+static void cli_posix_stat_done(struct tevent_req *subreq);
struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
struct event_context *ev,
@@ -733,43 +718,8 @@ struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
-
- /* Setup setup word. */
- SSVAL(&state->setup, 0, TRANSACT2_QPATHINFO);
-
- /* 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_QUERY_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);
- }
-
- 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. */
- NULL, /* data. */
- 0, /* num data. */
- 100); /* max returned data. */
-
+ subreq = cli_qpathinfo_send(state, ev, cli, fname,
+ SMB_QUERY_FILE_UNIX_BASIC, 100, 100);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
@@ -777,6 +727,23 @@ struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
return req;
}
+static void cli_posix_stat_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct stat_state *state = tevent_req_data(req, struct stat_state);
+ NTSTATUS status;
+
+ status = cli_qpathinfo_recv(subreq, state, &state->data,
+ &state->num_data);
+ TALLOC_FREE(subreq);
+ if (!NT_STATUS_IS_OK(status)) {
+ tevent_req_nterror(req, status);
+ return;
+ }
+ tevent_req_done(req);
+}
+
NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
SMB_STRUCT_STAT *sbuf)
{
@@ -787,10 +754,6 @@ NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
return status;
}
- if (state->num_data != 100) {
- return NT_STATUS_DATA_ERROR;
- }
-
sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(state->data,0); /* total size, in bytes */
sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(state->data,8); /* number of blocks allocated */
#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)