]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_client: Implement dcerpc_lsa_open_policy3()
authorAndreas Schneider <asn@samba.org>
Thu, 31 Aug 2023 08:18:23 +0000 (10:18 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 21 Nov 2023 11:16:37 +0000 (11:16 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/rpc_client/cli_lsarpc.c
source3/rpc_client/cli_lsarpc.h

index 1ea49781a4d8204c63b9a924a60c53c700f64317..f4aeb582a8fad1c998c0e3d33f9ed8eb52133f18 100644 (file)
@@ -152,6 +152,47 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
        return result;
 }
 
+NTSTATUS dcerpc_lsa_open_policy3(struct dcerpc_binding_handle *h,
+                                TALLOC_CTX *mem_ctx,
+                                const char *srv_name_slash,
+                                bool sec_qos,
+                                uint32_t des_access,
+                                uint32_t *out_version,
+                                union lsa_revision_info *out_revision_info,
+                                struct policy_handle *pol,
+                                NTSTATUS *result)
+{
+       struct lsa_ObjectAttribute attr = { .len = 0x18, };
+       struct lsa_QosInfo qos;
+       union lsa_revision_info in_revision_info = {
+               .info1 = {
+                       .revision = 1,
+               },
+       };
+       uint32_t in_version = 1;
+
+       if (sec_qos) {
+               qos.len                 = 0xc;
+               qos.impersonation_level = 2;
+               qos.context_mode        = 1;
+               qos.effective_only      = 0;
+
+               attr.sec_qos            = &qos;
+       }
+
+       return dcerpc_lsa_OpenPolicy3(h,
+                                     mem_ctx,
+                                     srv_name_slash,
+                                     &attr,
+                                     des_access,
+                                     in_version,
+                                     &in_revision_info,
+                                     out_version,
+                                     out_revision_info,
+                                     pol,
+                                     result);
+}
+
 /* Lookup a list of sids
  *
  * internal version withOUT memory allocation of the target arrays.
index 459120a21bf12dc67a55ed86d7f7a0bc3960b069..240fa6804e4174a0bc292ebff12fe58edd5a58bf 100644 (file)
@@ -85,6 +85,38 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
                                 TALLOC_CTX *mem_ctx, bool sec_qos,
                                 uint32_t des_access, struct policy_handle *pol);
 
+/**
+ * @brief Open a LSA policy.
+ *
+ * @param[in]  h        The dcerpc binding handle to use.
+ *
+ * @param[in]  mem_ctx  The memory context to use.
+ *
+ * @param[in]  sec_qos  Enable security quality of services.
+ *
+ * @param[in]  des_access The desired access rights to be granted.
+ *
+ * @param[out]  out_version A pointer to an uin32_t to store the version of the
+ *                          following data structure.
+ *
+ * @param[out]  out_revision info A pointer to store the out_revision_info.
+ *
+ * @param[out]  pol     A pointer to a rpc policy handle.
+ *
+ * @param[out]  result  A pointer for the NDR NTSTATUS error code.
+ *
+ * @return              A corresponding NTSTATUS error code for the connection.
+ */
+NTSTATUS dcerpc_lsa_open_policy3(struct dcerpc_binding_handle *h,
+                                TALLOC_CTX *mem_ctx,
+                                const char *srv_name_slash,
+                                bool sec_qos,
+                                uint32_t des_access,
+                                uint32_t *out_version,
+                                union lsa_revision_info *out_revision_info,
+                                struct policy_handle *pol,
+                                NTSTATUS *result);
+
 /**
  * @brief Look up the names that correspond to an array of sids.
  *