]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpc: Add global_sid_Samba_NPA_Flags SID
authorVolker Lendecke <vl@samba.org>
Tue, 18 Apr 2023 10:09:45 +0000 (12:09 +0200)
committerJule Anger <janger@samba.org>
Tue, 23 May 2023 07:13:09 +0000 (07:13 +0000)
This will be used as a flexible way to pass per-RPC-connection flags
over ncalrpc to the RPC server without having to modify
named_pipe_auth_req_info6 every time something new needs to be
passed. It's modeled after global_sid_Samba_SMB3.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15361
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit ebbb93cc7a57a118b82b8f383d25f1eb022397d6)

libcli/security/dom_sid.h
libcli/security/util_sid.c
source3/include/proto.h
source3/lib/util_sid.c

index 568916a159dc5f46d2435e52365a11d0dc74343c..65d8adc71958cf142c6fd150e0127e98052a0e78 100644 (file)
@@ -66,6 +66,9 @@ extern const struct dom_sid global_sid_Unix_NFS_Mode;
 extern const struct dom_sid global_sid_Unix_NFS_Other;
 extern const struct dom_sid global_sid_Samba_SMB3;
 
+extern const struct dom_sid global_sid_Samba_NPA_Flags;
+#define SAMBA_NPA_FLAGS_NEED_IDLE 1
+
 enum lsa_SidType;
 
 NTSTATUS dom_sid_lookup_predefined_name(const char *name,
index 15dc50339d11637d8713d7f8e006d789724de9e8..d7adef31cb74abda148e8340a8ecf62d570252cd 100644 (file)
@@ -162,6 +162,13 @@ const struct dom_sid global_sid_Unix_NFS_Other =           /* Unix other, MS NFS and Appl
 const struct dom_sid global_sid_Samba_SMB3 =
 {1, 1, {0,0,0,0,0,22}, {1397571891, }};
 
+const struct dom_sid global_sid_Samba_NPA_Flags = {1,
+                                                  1,
+                                                  {0, 0, 0, 0, 0, 22},
+                                                  {
+                                                          2041152804,
+                                                  }};
+
 /* Unused, left here for documentary purposes */
 #if 0
 #define SECURITY_NULL_SID_AUTHORITY    0
index f632cf37c087e2e6dc5ba07bdbf67d695e8c0e41..cfc56f1374ee08124a32c143e33748d58c416921 100644 (file)
@@ -445,6 +445,8 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
                              struct dom_sid **user_sids,
                              uint32_t *num_user_sids,
                              bool include_user_group_rid);
+bool security_token_find_npa_flags(const struct security_token *token,
+                                  uint32_t *_flags);
 
 /* The following definitions come from lib/util_sock.c  */
 
index 75918b440a3d440ef77a92e57c367d1e658ac3af..16312d27ee6aab651a5301d12c2143bcae2af369 100644 (file)
@@ -173,3 +173,22 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
 
        return NT_STATUS_OK;
 }
+
+bool security_token_find_npa_flags(const struct security_token *token,
+                                  uint32_t *_flags)
+{
+       const struct dom_sid *npa_flags_sid = NULL;
+       size_t num_npa_sids;
+
+       num_npa_sids =
+               security_token_count_flag_sids(token,
+                                              &global_sid_Samba_NPA_Flags,
+                                              1,
+                                              &npa_flags_sid);
+       if (num_npa_sids != 1) {
+               return false;
+       }
+
+       sid_peek_rid(npa_flags_sid, _flags);
+       return true;
+}