libsmb: Rename InfoType from [MS-SMB2] according to the spec
authorVolker Lendecke <vl@samba.org>
Fri, 29 Mar 2019 10:08:12 +0000 (11:08 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 1 Apr 2019 17:58:16 +0000 (17:58 +0000)
This makes it easier to find this via internet search

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/smb/smb2_constants.h
source3/libsmb/cli_smb2_fnum.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_setinfo.c
source3/torture/test_smb2.c
source4/libcli/smb2/getinfo.c
source4/libcli/smb2/setinfo.c
source4/smb_server/smb2/fileinfo.c
source4/torture/smb2/compound.c
source4/torture/smb2/getinfo.c

index f6edf6ba109d9fa5d8591901e6bfd978581e2509..3dd462cdd691b603ebd19d59bac92a50282eb911 100644 (file)
 #define SMB2_CONTINUE_FLAG_INDEX      0x04
 #define SMB2_CONTINUE_FLAG_REOPEN     0x10
 
-/* getinfo classes */
-#define SMB2_GETINFO_FILE               0x01
-#define SMB2_GETINFO_FS                 0x02
-#define SMB2_GETINFO_SECURITY           0x03
-#define SMB2_GETINFO_QUOTA              0x04
+/* get/setinfo classes, see [MS-SMB2] 2.2.37 and 2.2.39 */
+#define SMB2_0_INFO_FILE                0x01
+#define SMB2_0_INFO_FILESYSTEM          0x02
+#define SMB2_0_INFO_SECURITY            0x03
+#define SMB2_0_INFO_QUOTA               0x04
 
 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (0x01)
 
index 33bc31592a4fedb44f2a8ebef41a0bfc68aba30e..6a725cb15370d7362dfb66e5d3c24c8c24ef52e4 100644 (file)
@@ -2675,7 +2675,7 @@ NTSTATUS cli_smb2_get_fs_full_size_info(struct cli_state *cli,
        status = cli_smb2_query_info_fnum(
                cli,
                fnum,
-               SMB2_GETINFO_FS, /* in_info_type */
+               SMB2_0_INFO_FILESYSTEM, /* in_info_type */
                SMB_FS_FULL_SIZE_INFORMATION - 1000, /* in_file_info_class */
                0xFFFF, /* in_max_output_length */
                NULL, /* in_input_buffer */
@@ -2846,7 +2846,7 @@ NTSTATUS cli_smb2_get_fs_volume_info(struct cli_state *cli,
        status = cli_smb2_query_info_fnum(
                cli,
                fnum,
-               SMB2_GETINFO_FS, /* in_info_type */
+               SMB2_0_INFO_FILESYSTEM, /* in_info_type */
                /* in_file_info_class */
                SMB_FS_VOLUME_INFORMATION - 1000,
                0xFFFF, /* in_max_output_length */
index cd92db18619d85c8f247a6e45a397d222486c293..9ec252c172b8df44261baf8429b0f27b45f55903 100644 (file)
@@ -288,7 +288,7 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
        }
 
        switch (in_info_type) {
-       case SMB2_GETINFO_FILE:
+       case SMB2_0_INFO_FILE:
        {
                uint16_t file_info_level;
                char *data = NULL;
@@ -428,7 +428,7 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case SMB2_GETINFO_FS:
+       case SMB2_0_INFO_FILESYSTEM:
        {
                uint16_t file_info_level;
                char *data = NULL;
@@ -481,7 +481,7 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case SMB2_GETINFO_SECURITY:
+       case SMB2_0_INFO_SECURITY:
        {
                uint8_t *p_marshalled_sd = NULL;
                size_t sd_size = 0;
@@ -528,7 +528,7 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case SMB2_GETINFO_QUOTA: {
+       case SMB2_0_INFO_QUOTA: {
 #ifdef HAVE_SYS_QUOTAS
                struct smb2_query_quota_info info;
                enum ndr_err_code err;
index 92e06f8c7d2abf47b98ee62daf9d7818becc67a0..7fdcbd7a8d2b20031a648126481f1ff46847a2c1 100644 (file)
@@ -389,7 +389,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
        }
 
        switch (in_info_type) {
-       case 0x01:/* SMB2_SETINFO_FILE */
+       case SMB2_0_INFO_FILE:
        {
                uint16_t file_info_level;
                char *data;
@@ -530,7 +530,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case 0x02:/* SMB2_SETINFO_FS */
+       case SMB2_0_INFO_FILESYSTEM:
        {
                uint16_t file_info_level = in_file_info_class + 1000;
 
@@ -548,7 +548,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case 0x03:/* SMB2_SETINFO_SECURITY */
+       case SMB2_0_INFO_SECURITY:
        {
                if (!CAN_WRITE(conn)) {
                        tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
@@ -567,7 +567,7 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
                break;
        }
 
-       case 0x04:/* SMB2_SETINFO_QUOTA */
+       case SMB2_0_INFO_QUOTA:
        {
 #ifdef HAVE_SYS_QUOTAS
                struct file_quota_information info = {0};
index 094a9b84d6e56f999d5bb903f33156129e058eac..0cfb68cbbef3836c73feccebafcc8b951372770c 100644 (file)
@@ -1617,7 +1617,7 @@ bool run_smb2_session_reauth(int dummy)
                                    cli->timeout,
                                    cli->smb2.session,
                                    cli->smb2.tcon,
-                                   SMB2_GETINFO_SECURITY,
+                                   SMB2_0_INFO_SECURITY,
                                    0, /* in_file_info_class */
                                    1024, /* in_max_output_length */
                                    NULL, /* in_input_buffer */
@@ -1637,7 +1637,7 @@ bool run_smb2_session_reauth(int dummy)
                                    cli->timeout,
                                    cli->smb2.session,
                                    cli->smb2.tcon,
-                                   SMB2_GETINFO_FILE,
+                                   SMB2_0_INFO_FILE,
                                    in_file_info_class,
                                    1024, /* in_max_output_length */
                                    NULL, /* in_input_buffer */
@@ -1660,7 +1660,7 @@ bool run_smb2_session_reauth(int dummy)
                                  cli->timeout,
                                  cli->smb2.session,
                                  cli->smb2.tcon,
-                                 SMB2_GETINFO_FILE,
+                                 SMB2_0_INFO_FILE,
                                  in_file_info_class,
                                  &in_input_buffer,
                                  0, /* in_additional_info */
@@ -1766,7 +1766,7 @@ bool run_smb2_session_reauth(int dummy)
                                    cli->timeout,
                                    cli->smb2.session,
                                    cli->smb2.tcon,
-                                   SMB2_GETINFO_SECURITY,
+                                   SMB2_0_INFO_SECURITY,
                                    0, /* in_file_info_class */
                                    1024, /* in_max_output_length */
                                    NULL, /* in_input_buffer */
@@ -1786,7 +1786,7 @@ bool run_smb2_session_reauth(int dummy)
                                    cli->timeout,
                                    cli->smb2.session,
                                    cli->smb2.tcon,
-                                   SMB2_GETINFO_FILE,
+                                   SMB2_0_INFO_FILE,
                                    in_file_info_class,
                                    1024, /* in_max_output_length */
                                    NULL, /* in_input_buffer */
@@ -1809,7 +1809,7 @@ bool run_smb2_session_reauth(int dummy)
                                  cli->timeout,
                                  cli->smb2.session,
                                  cli->smb2.tcon,
-                                 SMB2_GETINFO_FILE,
+                                 SMB2_0_INFO_FILE,
                                  in_file_info_class,
                                  &in_input_buffer,
                                  0, /* in_additional_info */
@@ -1825,7 +1825,7 @@ bool run_smb2_session_reauth(int dummy)
                                    cli->timeout,
                                    cli->smb2.session,
                                    cli->smb2.tcon,
-                                   SMB2_GETINFO_FILE,
+                                   SMB2_0_INFO_FILE,
                                    in_file_info_class,
                                    1024, /* in_max_output_length */
                                    NULL, /* in_input_buffer */
index 7a8fd44a8550cd60dfdfd0ac59e266c2e4f4f1e3..fc97620ad24cfba00e48dbed8f05fa2420c96d00 100644 (file)
@@ -112,9 +112,9 @@ NTSTATUS smb2_getinfo(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 */
 uint16_t smb2_getinfo_map_level(uint16_t level, uint8_t info_class)
 {
-       if (info_class == SMB2_GETINFO_FILE &&
+       if (info_class == SMB2_0_INFO_FILE &&
            level == RAW_FILEINFO_SEC_DESC) {
-               return SMB2_GETINFO_SECURITY;
+               return SMB2_0_INFO_SECURITY;
        }
        if ((level & 0xFF) == info_class) {
                return level;
@@ -132,7 +132,8 @@ uint16_t smb2_getinfo_map_level(uint16_t level, uint8_t info_class)
 struct smb2_request *smb2_getinfo_file_send(struct smb2_tree *tree, union smb_fileinfo *io)
 {
        struct smb2_getinfo b;
-       uint16_t smb2_level = smb2_getinfo_map_level(io->generic.level, SMB2_GETINFO_FILE);
+       uint16_t smb2_level = smb2_getinfo_map_level(
+               io->generic.level, SMB2_0_INFO_FILE);
        
        if (smb2_level == 0) {
                return NULL;
@@ -190,7 +191,8 @@ NTSTATUS smb2_getinfo_file(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 struct smb2_request *smb2_getinfo_fs_send(struct smb2_tree *tree, union smb_fsinfo *io)
 {
        struct smb2_getinfo b;
-       uint16_t smb2_level = smb2_getinfo_map_level(io->generic.level, SMB2_GETINFO_FS);
+       uint16_t smb2_level = smb2_getinfo_map_level(
+               io->generic.level, SMB2_0_INFO_FILESYSTEM);
        
        if (smb2_level == 0) {
                return NULL;
index 69c0f45b63a3bc39be09afc1e31bb3fbf8f249d1..f8b50f6c4b6dba860f32669e7e8109bbcc541888 100644 (file)
@@ -83,7 +83,8 @@ NTSTATUS smb2_setinfo(struct smb2_tree *tree, struct smb2_setinfo *io)
 struct smb2_request *smb2_setinfo_file_send(struct smb2_tree *tree, union smb_setfileinfo *io)
 {
        struct smb2_setinfo b;
-       uint16_t smb2_level = smb2_getinfo_map_level(io->generic.level, SMB2_GETINFO_FILE);
+       uint16_t smb2_level = smb2_getinfo_map_level(
+               io->generic.level, SMB2_0_INFO_FILE);
        struct smb2_request *req;
        
        if (smb2_level == 0) {
index 10ea4eb8c5baa2feb183bf381e18a83bb10e0978..a90c41a73ae316818199b2584fd12611e39990b9 100644 (file)
@@ -185,16 +185,16 @@ static NTSTATUS smb2srv_getinfo_security(struct smb2srv_getinfo_op *op, uint8_t
 static NTSTATUS smb2srv_getinfo_backend(struct smb2srv_getinfo_op *op)
 {
        switch (op->info->in.info_type) {
-       case SMB2_GETINFO_FILE:
+       case SMB2_0_INFO_FILE:
                return smb2srv_getinfo_file(op, op->info->in.info_class);
 
-       case SMB2_GETINFO_FS:
+       case SMB2_0_INFO_FILESYSTEM:
                return smb2srv_getinfo_fs(op, op->info->in.info_class);
 
-       case SMB2_GETINFO_SECURITY:
+       case SMB2_0_INFO_SECURITY:
                return smb2srv_getinfo_security(op, op->info->in.info_class);
 
-       case SMB2_GETINFO_QUOTA:
+       case SMB2_0_INFO_QUOTA:
                return NT_STATUS_NOT_SUPPORTED;
        }
 
@@ -338,16 +338,16 @@ static NTSTATUS smb2srv_setinfo_backend(struct smb2srv_setinfo_op *op)
        smb2_level = 0xFF & (op->info->in.level>>8);
 
        switch (smb2_class) {
-       case SMB2_GETINFO_FILE:
+       case SMB2_0_INFO_FILE:
                return smb2srv_setinfo_file(op, smb2_level);
 
-       case SMB2_GETINFO_FS:
+       case SMB2_0_INFO_FILESYSTEM:
                return smb2srv_setinfo_fs(op, smb2_level);
 
-       case SMB2_GETINFO_SECURITY:
+       case SMB2_0_INFO_SECURITY:
                return smb2srv_setinfo_security(op, smb2_level);
 
-       case 0x04:
+       case SMB2_0_INFO_QUOTA:
                return NT_STATUS_NOT_SUPPORTED;
        }
 
index 0257cc27b8db5803691d168b736294871d9a90db..a84efc20186b7d5690a466b838508c8a6cde0fd4 100644 (file)
@@ -184,7 +184,7 @@ static bool test_compound_break(struct torture_context *tctx,
 
        ZERO_STRUCT(gf);
        gf.in.file.handle = h;
-       gf.in.info_type = SMB2_GETINFO_FILE;
+       gf.in.info_type = SMB2_0_INFO_FILE;
        gf.in.info_class = 0x16;
        gf.in.output_buffer_length = 0x1000;
        gf.in.input_buffer = data_blob_null;
@@ -1226,7 +1226,7 @@ static bool test_compound_interim2(struct torture_context *tctx,
 
     ZERO_STRUCT(gf);
     gf.in.file.handle = hd;
-    gf.in.info_type   = SMB2_GETINFO_FILE;
+    gf.in.info_type   = SMB2_0_INFO_FILE;
     gf.in.info_class  = 0x04; /* FILE_BASIC_INFORMATION */
     gf.in.output_buffer_length = 0x1000;
     gf.in.input_buffer = data_blob_null;
index d2307ab20a16033c7de617f27bfbad58e39b901c..2e36082e0677b296a1beae3f84a422cbb8e29777 100644 (file)
@@ -285,7 +285,7 @@ static bool torture_smb2_qfs_buffercheck(struct torture_context *tctx)
                }
 
                ZERO_STRUCT(b);
-               b.in.info_type                  = SMB2_GETINFO_FS;
+               b.in.info_type                  = SMB2_0_INFO_FILESYSTEM;
                b.in.info_class                 = levels[i].level;
                b.in.file.handle                = handle;
                b.in.output_buffer_length       = 65535;
@@ -366,7 +366,7 @@ static bool torture_smb2_qfile_buffercheck(struct torture_context *tctx)
                struct smb2_getinfo b;
 
                ZERO_STRUCT(b);
-               b.in.info_type                  = SMB2_GETINFO_FILE;
+               b.in.info_type                  = SMB2_0_INFO_FILE;
                b.in.info_class                 = levels[i].level;
                b.in.file.handle                = handle;
                b.in.output_buffer_length       = 65535;
@@ -420,7 +420,7 @@ static bool torture_smb2_qsec_buffercheck(struct torture_context *tctx)
        handle = c.out.file.handle;
 
        ZERO_STRUCT(b);
-       b.in.info_type                  = SMB2_GETINFO_SECURITY;
+       b.in.info_type                  = SMB2_0_INFO_SECURITY;
        b.in.info_class                 = 0;
        b.in.file.handle                = handle;
        b.in.output_buffer_length       = 0;