s3:libsmb: add function cli_qpathinfo_standard()
authorGregor Beck <gbeck@sernet.de>
Fri, 11 Oct 2013 08:52:21 +0000 (10:52 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 30 Oct 2013 22:23:51 +0000 (15:23 -0700)
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/clirap.c
source3/libsmb/clirap.h

index e01e1399be4a0e7d8ba9659d5d1723074e046dd1..1ca45c0a4bd17339b06a730e612733ac84179e63 100644 (file)
@@ -1363,3 +1363,52 @@ NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstrin
 
        return NT_STATUS_OK;
 }
+
+/****************************************************************************
+ Send a qpathinfo SMB_QUERY_FILE_STADNDARD_INFO call.
+****************************************************************************/
+
+NTSTATUS cli_qpathinfo_standard(struct cli_state *cli, const char *fname,
+                               uint64_t *allocated, uint64_t *size,
+                               uint32_t *nlinks,
+                               bool *is_del_pending, bool *is_dir)
+{
+       uint8_t *rdata;
+       uint32_t num_rdata;
+       NTSTATUS status;
+
+       if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+               return NT_STATUS_NOT_IMPLEMENTED;
+       }
+
+       status = cli_qpathinfo(talloc_tos(), cli, fname,
+                              SMB_QUERY_FILE_STANDARD_INFO,
+                              24, CLI_BUFFER_SIZE, &rdata, &num_rdata);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (allocated) {
+               *allocated = BVAL(rdata, 0);
+       }
+
+       if (size) {
+               *size = BVAL(rdata, 8);
+       }
+
+       if (nlinks) {
+               *nlinks = IVAL(rdata, 16);
+       }
+
+       if (is_del_pending) {
+               *is_del_pending = CVAL(rdata, 20);
+       }
+
+       if (is_dir) {
+               *is_dir = CVAL(rdata, 20);
+       }
+
+       TALLOC_FREE(rdata);
+
+       return NT_STATUS_OK;
+}
index e105182f0959a5c2ebb005e3829711ded11b6b6f..432642068a3bdbe0fcb049dec2b1eba3fc5de84c 100644 (file)
@@ -115,6 +115,10 @@ NTSTATUS cli_qpathinfo_basic_recv(struct tevent_req *req,
                                  SMB_STRUCT_STAT *sbuf, uint32 *attributes);
 NTSTATUS cli_qpathinfo_basic(struct cli_state *cli, const char *name,
                             SMB_STRUCT_STAT *sbuf, uint32 *attributes);
+NTSTATUS cli_qpathinfo_standard(struct cli_state *cli, const char *fname,
+                               uint64_t *allocated, uint64_t *size,
+                               uint32_t *nlinks,
+                               bool *is_del_pending, bool *is_dir);
 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
 struct tevent_req *cli_qpathinfo_send(TALLOC_CTX *mem_ctx,
                                      struct tevent_context *ev,