From: Günther Deschner Date: Tue, 11 May 2021 13:22:12 +0000 (+0200) Subject: s3-libnet_join: add libnet_odj_find_joinprov3() X-Git-Tag: talloc-2.3.3~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=793277c0dddba567f25c56f1982cb0c3d0888eba;p=thirdparty%2Fsamba.git s3-libnet_join: add libnet_odj_find_joinprov3() Guenther Signed-off-by: Guenther Deschner Reviewed-by: Alexander Bokovoy --- diff --git a/source3/libnet/libnet_join_offline.c b/source3/libnet/libnet_join_offline.c index 5e08ba46deb..bb119ec8fd3 100644 --- a/source3/libnet/libnet_join_offline.c +++ b/source3/libnet/libnet_join_offline.c @@ -373,3 +373,54 @@ WERROR libnet_odj_find_win7blob(const struct ODJ_PROVISION_DATA *r, return WERR_BAD_FORMAT; } + + +WERROR libnet_odj_find_joinprov3(const struct ODJ_PROVISION_DATA *r, + struct OP_JOINPROV3_PART *joinprov3) +{ + int i; + + if (r == NULL) { + return WERR_INVALID_PARAMETER; + } + + for (i = 0; i < r->ulcBlobs; i++) { + + struct ODJ_BLOB b = r->pBlobs[i]; + + switch (b.ulODJFormat) { + case ODJ_WIN7_FORMAT: + continue; + + case ODJ_WIN8_FORMAT: { + NTSTATUS status; + struct OP_PACKAGE_PART_COLLECTION *col; + struct GUID guid; + int k; + + if (b.pBlob->op_package.p->WrappedPartCollection.w == NULL) { + return WERR_BAD_FORMAT; + } + + col = b.pBlob->op_package.p->WrappedPartCollection.w->s.p; + + status = GUID_from_string(ODJ_GUID_JOIN_PROVIDER3, &guid); + if (!NT_STATUS_IS_OK(status)) { + return WERR_NOT_ENOUGH_MEMORY; + } + + for (k = 0; k < col->cParts; k++) { + if (GUID_equal(&guid, &col->pParts[k].PartType)) { + *joinprov3 = *col->pParts[k].Part->join_prov3.p; + return WERR_OK; + } + } + break; + } + default: + return WERR_BAD_FORMAT; + } + } + + return WERR_BAD_FORMAT; +} diff --git a/source3/libnet/libnet_join_offline.h b/source3/libnet/libnet_join_offline.h index 5abebcf6372..7507c583755 100644 --- a/source3/libnet/libnet_join_offline.h +++ b/source3/libnet/libnet_join_offline.h @@ -22,3 +22,5 @@ WERROR libnet_odj_compose_ODJ_PROVISION_DATA(TALLOC_CTX *mem_ctx, struct ODJ_PROVISION_DATA **b_p); WERROR libnet_odj_find_win7blob(const struct ODJ_PROVISION_DATA *r, struct ODJ_WIN7BLOB *win7blob); +WERROR libnet_odj_find_joinprov3(const struct ODJ_PROVISION_DATA *r, + struct OP_JOINPROV3_PART *joinprov3);