From: Günther Deschner Date: Fri, 11 Mar 2016 15:05:53 +0000 (+0100) Subject: s3:libnet:libnet_join: fill in output enctypes and only modify when necessary. X-Git-Tag: tdb-1.3.9~292 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=5d498d1b4d9b83f179fb7b2841a19ad984eec5f8;p=samba.git s3:libnet:libnet_join: fill in output enctypes and only modify when necessary. Guenther BUG: https://bugzilla.samba.org/show_bug.cgi?id=11755 Signed-off-by: Guenther Deschner Reviewed-by: Stefan Metzmacher --- diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 86191a12783..9e2ed98805f 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -1344,7 +1344,7 @@ char *ads_parent_dn(const char *dn) { ADS_STATUS status; char *expr; - const char *attrs[] = {"*", "nTSecurityDescriptor", NULL}; + const char *attrs[] = {"*", "msDS-SupportedEncryptionTypes", "nTSecurityDescriptor", NULL}; *res = NULL; diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index c72172ad97b..ac7e3efdbde 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -417,6 +417,11 @@ static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx, goto done; } + if (!ads_pull_uint32(r->in.ads, res, "msDS-SupportedEncryptionTypes", + &r->out.set_encryption_types)) { + r->out.set_encryption_types = 0; + } + done: ads_msgfree(r->in.ads, res); TALLOC_FREE(dn); @@ -700,6 +705,10 @@ static ADS_STATUS libnet_join_set_etypes(TALLOC_CTX *mem_ctx, return status; } + if (r->in.desired_encryption_types == r->out.set_encryption_types) { + return ADS_SUCCESS; + } + /* now do the mods */ mods = ads_init_mods(mem_ctx); @@ -713,7 +722,14 @@ static ADS_STATUS libnet_join_set_etypes(TALLOC_CTX *mem_ctx, return status; } - return ads_gen_mod(r->in.ads, r->out.dn, mods); + status = ads_gen_mod(r->in.ads, r->out.dn, mods); + if (!ADS_ERR_OK(status)) { + return status; + } + + r->out.set_encryption_types = r->in.desired_encryption_types; + + return ADS_SUCCESS; } #endif /****************************************************************