From: Isaac Boukris Date: Thu, 2 Jul 2020 08:59:18 +0000 (+0200) Subject: Fix ads_set_sasl_wrap_flags to only change sasl flags X-Git-Tag: talloc-2.3.2~1120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3af1d334d6159dca75c2a74e7c6f909952c31af;p=thirdparty%2Fsamba.git Fix ads_set_sasl_wrap_flags to only change sasl flags BUG: https://bugzilla.samba.org/show_bug.cgi?id=14439 Signed-off-by: Isaac Boukris Reviewed-by: Andreas Schneider --- diff --git a/source3/libads/ads_proto.h b/source3/libads/ads_proto.h index cd9c1082681..6cdde0cf6eb 100644 --- a/source3/libads/ads_proto.h +++ b/source3/libads/ads_proto.h @@ -47,7 +47,7 @@ ADS_STRUCT *ads_init(const char *realm, const char *workgroup, const char *ldap_server, enum ads_sasl_state_e sasl_state); -bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, int flags); +bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, unsigned flags); void ads_destroy(ADS_STRUCT **ads); /* The following definitions come from libads/disp_sec.c */ diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 043a1b21247..67a9a7cf75e 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -176,13 +176,17 @@ ADS_STRUCT *ads_init(const char *realm, /**************************************************************** ****************************************************************/ -bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, int flags) +bool ads_set_sasl_wrap_flags(ADS_STRUCT *ads, unsigned flags) { + unsigned other_flags; + if (!ads) { return false; } - ads->auth.flags = flags; + other_flags = ads->auth.flags & ~(ADS_AUTH_SASL_SIGN|ADS_AUTH_SASL_SEAL); + + ads->auth.flags = flags | other_flags; return true; }