]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/lsarpc: add trust_forest_info_lsa_{1to2,2to1}()
authorStefan Metzmacher <metze@samba.org>
Tue, 11 Feb 2025 23:49:07 +0000 (00:49 +0100)
committerRalph Boehme <slow@samba.org>
Sat, 22 Feb 2025 16:00:36 +0000 (16:00 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
libcli/lsarpc/util_lsarpc.c
libcli/lsarpc/util_lsarpc.h

index 880b3d9d1d02bdcb4353076e3d11654c68f3aff1..e823b6c1cc9cf5f373b7f277b83f7ab2d6f10b26 100644 (file)
@@ -817,6 +817,62 @@ NTSTATUS trust_forest_info_to_lsa2(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
+NTSTATUS trust_forest_info_lsa_1to2(TALLOC_CTX *mem_ctx,
+                               const struct lsa_ForestTrustInformation *lfti,
+                               struct lsa_ForestTrustInformation2 **_lfti2)
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+       struct ForestTrustInfo *fti = NULL;
+       struct lsa_ForestTrustInformation2 *lfti2 = NULL;
+       NTSTATUS status;
+
+       status = trust_forest_info_from_lsa(frame, lfti, &fti);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(frame);
+               return status;
+       }
+
+       status = trust_forest_info_to_lsa2(mem_ctx,
+                                          fti,
+                                          &lfti2);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(frame);
+               return status;
+       }
+
+       *_lfti2 = lfti2;
+       TALLOC_FREE(frame);
+       return NT_STATUS_OK;
+}
+
+NTSTATUS trust_forest_info_lsa_2to1(TALLOC_CTX *mem_ctx,
+                               const struct lsa_ForestTrustInformation2 *lfti2,
+                               struct lsa_ForestTrustInformation **_lfti)
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+       struct ForestTrustInfo *fti = NULL;
+       struct lsa_ForestTrustInformation *lfti = NULL;
+       NTSTATUS status;
+
+       status = trust_forest_info_from_lsa2(frame, lfti2, &fti);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(frame);
+               return status;
+       }
+
+       status = trust_forest_info_to_lsa(mem_ctx,
+                                         fti,
+                                         &lfti);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(frame);
+               return status;
+       }
+
+       *_lfti = lfti;
+       TALLOC_FREE(frame);
+       return NT_STATUS_OK;
+}
+
 static int trust_forest_info_tln_match_internal(
                const struct lsa_ForestTrustInformation *info,
                enum lsa_ForestTrustRecordType type,
index 97b12ee67e695ec83426c9e5f5808936e0a54176..b894f9ab23f94799df27a7f9782b8dcf8b4e2879 100644 (file)
@@ -52,6 +52,12 @@ NTSTATUS trust_forest_info_from_lsa2(TALLOC_CTX *mem_ctx,
 NTSTATUS trust_forest_info_to_lsa2(TALLOC_CTX *mem_ctx,
                                   const struct ForestTrustInfo *fti,
                                   struct lsa_ForestTrustInformation2 **_lfti);
+NTSTATUS trust_forest_info_lsa_1to2(TALLOC_CTX *mem_ctx,
+                               const struct lsa_ForestTrustInformation *lfti,
+                               struct lsa_ForestTrustInformation2 **_lfti2);
+NTSTATUS trust_forest_info_lsa_2to1(TALLOC_CTX *mem_ctx,
+                               const struct lsa_ForestTrustInformation2 *lfti2,
+                               struct lsa_ForestTrustInformation **_lfti);
 
 bool trust_forest_info_tln_match(
                const struct lsa_ForestTrustInformation *info,