return status;
}
-struct cli_smb2_qpathinfo2_state {
- struct tevent_context *ev;
- struct cli_state *cli;
- uint16_t fnum;
-
- NTSTATUS queryinfo_status;
- struct timespec create_time;
- struct timespec access_time;
- struct timespec write_time;
- struct timespec change_time;
- off_t size;
- uint32_t attr;
- SMB_INO_T ino;
-};
-
-static void cli_smb2_qpathinfo2_opened(struct tevent_req *subreq);
-static void cli_smb2_qpathinfo2_done(struct tevent_req *subreq);
-static void cli_smb2_qpathinfo2_closed(struct tevent_req *subreq);
-
-struct tevent_req *cli_smb2_qpathinfo2_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct cli_state *cli,
- const char *fname)
-{
- struct tevent_req *req = NULL, *subreq = NULL;
- struct cli_smb2_qpathinfo2_state *state = NULL;
-
- req = tevent_req_create(mem_ctx,
- &state,
- struct cli_smb2_qpathinfo2_state);
- if (req == NULL) {
- return NULL;
- }
- state->ev = ev;
- state->cli = cli;
-
- subreq = get_fnum_from_path_send(mem_ctx,
- ev,
- cli,
- fname,
- FILE_READ_ATTRIBUTES);
- if (tevent_req_nomem(subreq, req)) {
- return tevent_req_post(req, ev);
- }
- tevent_req_set_callback(subreq, cli_smb2_qpathinfo2_opened, req);
- return req;
-}
-
-static void cli_smb2_qpathinfo2_opened(struct tevent_req *subreq)
-{
- struct tevent_req *req =
- tevent_req_callback_data(subreq, struct tevent_req);
- struct cli_smb2_qpathinfo2_state *state =
- tevent_req_data(req, struct cli_smb2_qpathinfo2_state);
- NTSTATUS status;
-
- status = get_fnum_from_path_recv(subreq, &state->fnum);
- TALLOC_FREE(subreq);
- if (tevent_req_nterror(req, status)) {
- return;
- }
-
- subreq = cli_qfileinfo_basic_send(state,
- state->ev,
- state->cli,
- state->fnum);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, cli_smb2_qpathinfo2_done, req);
-}
-
-static void cli_smb2_qpathinfo2_done(struct tevent_req *subreq)
-{
- struct tevent_req *req =
- tevent_req_callback_data(subreq, struct tevent_req);
- struct cli_smb2_qpathinfo2_state *state =
- tevent_req_data(req, struct cli_smb2_qpathinfo2_state);
-
- state->queryinfo_status = cli_qfileinfo_basic_recv(subreq,
- &state->attr,
- &state->size,
- &state->create_time,
- &state->access_time,
- &state->write_time,
- &state->change_time,
- &state->ino);
- TALLOC_FREE(subreq);
-
- subreq = cli_smb2_close_fnum_send(state,
- state->ev,
- state->cli,
- state->fnum);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, cli_smb2_qpathinfo2_closed, req);
-}
-
-static void cli_smb2_qpathinfo2_closed(struct tevent_req *subreq)
-{
- struct tevent_req *req =
- tevent_req_callback_data(subreq, struct tevent_req);
- struct cli_smb2_qpathinfo2_state *state =
- tevent_req_data(req, struct cli_smb2_qpathinfo2_state);
- NTSTATUS status;
-
- status = cli_smb2_close_fnum_recv(subreq);
- TALLOC_FREE(subreq);
- if (tevent_req_nterror(req, status)) {
- return;
- }
- if (tevent_req_nterror(req, state->queryinfo_status)) {
- return;
- }
- tevent_req_done(req);
-}
-
-NTSTATUS cli_smb2_qpathinfo2_recv(struct tevent_req *req,
- struct timespec *create_time,
- struct timespec *access_time,
- struct timespec *write_time,
- struct timespec *change_time,
- off_t *size,
- uint32_t *attr,
- SMB_INO_T *ino)
-{
- struct cli_smb2_qpathinfo2_state *state =
- tevent_req_data(req, struct cli_smb2_qpathinfo2_state);
- NTSTATUS status;
-
- if (tevent_req_is_nterror(req, &status)) {
- return status;
- }
-
- if (create_time != NULL) {
- *create_time = state->create_time;
- }
- if (access_time != NULL) {
- *access_time = state->access_time;
- }
- if (write_time != NULL) {
- *write_time = state->write_time;
- }
- if (change_time != NULL) {
- *change_time = state->change_time;
- }
- if (attr != NULL) {
- *attr = state->attr;
- }
- if (size != NULL) {
- *size = state->size;
- }
- if (ino) {
- *ino = state->ino;
- }
-
- return NT_STATUS_OK;
-}
-
/***************************************************************
Wrapper that allows SMB2 to set SMB_FILE_BASIC_INFORMATION on
a pathname.
return NULL;
}
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
- subreq = cli_smb2_qpathinfo2_send(state, ev, cli, fname);
+ subreq = cli_smb2_qpathinfo_send(state,
+ ev,
+ cli,
+ fname,
+ FSCC_FILE_ALL_INFORMATION,
+ 0x60,
+ UINT16_MAX);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
tevent_req_callback_data(subreq, struct tevent_req);
struct cli_qpathinfo2_state *state =
tevent_req_data(req, struct cli_qpathinfo2_state);
+ uint8_t *rdata = NULL;
+ uint32_t num_rdata;
NTSTATUS status;
- status = cli_smb2_qpathinfo2_recv(subreq,
- &state->create_time,
- &state->access_time,
- &state->write_time,
- &state->change_time,
- &state->size,
- &state->attr,
- &state->ino);
+ status = cli_smb2_qpathinfo_recv(subreq, state, &rdata, &num_rdata);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
}
+ state->create_time = interpret_long_date((const char *)rdata + 0x0);
+ state->access_time = interpret_long_date((const char *)rdata + 0x8);
+ state->write_time = interpret_long_date((const char *)rdata + 0x10);
+ state->change_time = interpret_long_date((const char *)rdata + 0x18);
+ state->attr = PULL_LE_U32(rdata, 0x20);
+ state->size = PULL_LE_U64(rdata, 0x30);
+ state->ino = PULL_LE_U64(rdata, 0x40);
+
tevent_req_done(req);
}