]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Remove #defines used just once
authorVolker Lendecke <vl@samba.org>
Tue, 16 Dec 2025 19:26:15 +0000 (20:26 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 7 Jan 2026 09:57:40 +0000 (09:57 +0000)
For me they were not giving additional insights, they only made me
jump somewhere else to see what's going on.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/include/smb.h
source3/smbd/posix_acls.c

index 10c52ac85b0c1397a6489df28f3df658b80c589c..1d50105617752cbafc022bab2fd933bcf7eb5565 100644 (file)
@@ -307,18 +307,6 @@ struct interface {
 /* the desired access to use when opening a pipe */
 #define DESIRED_ACCESS_PIPE 0x2019f
 
-/* Mapping of access rights to UNIX perms. */
-#define UNIX_ACCESS_RWX                FILE_GENERIC_ALL
-#define UNIX_ACCESS_R          FILE_GENERIC_READ
-#define UNIX_ACCESS_W          FILE_GENERIC_WRITE
-#define UNIX_ACCESS_X          FILE_GENERIC_EXECUTE
-
-/* Mapping of access rights to UNIX perms. for a UNIX directory. */
-#define UNIX_DIRECTORY_ACCESS_RWX              FILE_GENERIC_ALL
-#define UNIX_DIRECTORY_ACCESS_R                FILE_GENERIC_READ
-#define UNIX_DIRECTORY_ACCESS_W                        (FILE_GENERIC_WRITE|FILE_DELETE_CHILD)
-#define UNIX_DIRECTORY_ACCESS_X                        FILE_GENERIC_EXECUTE
-
 #define UNIX_ACCESS_NONE (WRITE_OWNER_ACCESS)
 
 /* Flags field. */
index afcb4154f41282bba0eb96644b3c31331289fe5f..e5b084133aac79c7d97d6b4062fc9a276e1f2e1d 100644 (file)
@@ -995,9 +995,9 @@ uint32_t map_canon_ace_perms(int snum,
 
        if (lp_acl_map_full_control(snum) && ((perms & ALL_ACE_PERMS) == ALL_ACE_PERMS)) {
                if (directory_ace) {
-                       nt_mask = UNIX_DIRECTORY_ACCESS_RWX;
+                       nt_mask = FILE_GENERIC_ALL;
                } else {
-                       nt_mask = (UNIX_ACCESS_RWX & ~DELETE_ACCESS);
+                       nt_mask = (FILE_GENERIC_ALL & ~DELETE_ACCESS);
                }
        } else if ((perms & ALL_ACE_PERMS) == (mode_t)0) {
                /*
@@ -1012,13 +1012,18 @@ uint32_t map_canon_ace_perms(int snum,
                nt_mask = 0;
        } else {
                if (directory_ace) {
-                       nt_mask |= ((perms & S_IRUSR) ? UNIX_DIRECTORY_ACCESS_R : 0 );
-                       nt_mask |= ((perms & S_IWUSR) ? UNIX_DIRECTORY_ACCESS_W : 0 );
-                       nt_mask |= ((perms & S_IXUSR) ? UNIX_DIRECTORY_ACCESS_X : 0 );
+                       nt_mask |= ((perms & S_IRUSR) ? FILE_GENERIC_READ : 0);
+                       nt_mask |= ((perms & S_IWUSR) ? (FILE_GENERIC_WRITE |
+                                                        FILE_DELETE_CHILD)
+                                                     : 0);
+                       nt_mask |= ((perms & S_IXUSR) ? FILE_GENERIC_EXECUTE
+                                                     : 0);
                } else {
-                       nt_mask |= ((perms & S_IRUSR) ? UNIX_ACCESS_R : 0 );
-                       nt_mask |= ((perms & S_IWUSR) ? UNIX_ACCESS_W : 0 );
-                       nt_mask |= ((perms & S_IXUSR) ? UNIX_ACCESS_X : 0 );
+                       nt_mask |= ((perms & S_IRUSR) ? FILE_GENERIC_READ : 0);
+                       nt_mask |= ((perms & S_IWUSR) ? FILE_GENERIC_WRITE
+                                                     : 0);
+                       nt_mask |= ((perms & S_IXUSR) ? FILE_GENERIC_EXECUTE
+                                                     : 0);
                }
        }