The Samba-Bugzilla – Attachment 18805 Details for
Bug 15972
Winbind group resolution failure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
4.23 patch
flags-4.23.patch (text/plain), 9.09 KB, created by
Pavel Filipenský
on 2026-01-22 09:42:34 UTC
(
hide
)
Description:
4.23 patch
Filename:
MIME Type:
Creator:
Pavel Filipenský
Created:
2026-01-22 09:42:34 UTC
Size:
9.09 KB
patch
obsolete
>From a0e862da0e426a94c7d6205dcd8066dace6f8c5c Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org> >Date: Mon, 19 Jan 2026 14:33:52 +0100 >Subject: [PATCH 1/2] s3:libads: Reset ads->config.flags in ads_disconnect() >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This is doing the same thing in ads_disconnect() as commit >a26f535 Clear previous CLDAP ping flags when reusing the ADS_STRUCT >did in ads_current_time() > >In this case we: > >1) found cached ADS_STRUCT which already has ads->config.flags set: > > lookup_groupmem() > ads_cached_connection() > ads_cached_connection_reuse() > >2) started search which immediately timeouts (the cached conn. was dead) > > ads_do_search_retry_internal() > ldap_search_with_timeout() - IO_TIMEOUT > >3) Retry loop finds a new DC and tries to connect > > ads_do_search_retry_internal() > ads_disconnect() > ads_find_dc() > ads_try_connect() > netlogon_pings() > check_cldap_reply_required_flags() > >4) check_cldap_reply_required_flags() fails since ads->config.flags > (stored possibly long time ago) contain: > > NBT_SERVER_CLOSEST 0x00000080 > which is misinterpreted as: > DS_PDC_REQUIRED 0x00000080 > > the newly found DC is not PDC (we asked for DS_ONLY_LDAP_NEEDED) > and since previous DC had NBT_SERVER_CLOSEST we want DS_PDC_REQUIRED > and fail. > >We should anyway avoid mixing independent namespaces NBT_* and DS_* >in the same flag. >Next commit will do that. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15972 > >Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >(cherry picked from commit 9f3a35991feb01a8d2c2b69fa0b914bbc637a809) >--- > source3/libads/ldap.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c >index 49fa1d47298..8dde09e3551 100644 >--- a/source3/libads/ldap.c >+++ b/source3/libads/ldap.c >@@ -1261,6 +1261,7 @@ void ads_disconnect(ADS_STRUCT *ads) > if (ads->ldap_wrap_data.mem_ctx) { > talloc_free(ads->ldap_wrap_data.mem_ctx); > } >+ ads->config.flags = 0; > ads_zero_ldap(ads); > ZERO_STRUCT(ads->ldap_tls_data); > ZERO_STRUCT(ads->ldap_wrap_data); >-- >2.52.0 > > >From d8a221c308e36646e813b6e2fb0334cfeb306831 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org> >Date: Sun, 18 Jan 2026 01:04:11 +0100 >Subject: [PATCH 2/2] s3:libads: Separate use of ads->config.flags for NBT_* > and DS_* values >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Use of ads->config.flags is overloaded. > >It is used to: > >- pass DS_* flags down to cldap_netlogon() >- store the server_type from NETLOGON_SAM_LOGON_RESPONSE > >Both cases use different values and cannot be combined. >E.g. flags mess up with value 0x00000080 > >NBT_SERVER_CLOSEST 0x00000080 >DS_PDC_REQUIRED 0x00000080 > >Let's create two separate flags > >nbt_server_type server_flags; /* NBT_* cldap flags identifying the services. */ >uint32 required_flags; /* DS_* - Netlogon flags */ > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15972 > >Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> > >Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org> >Autobuild-Date(master): Thu Jan 22 09:14:25 UTC 2026 on atb-devel-224 > >(cherry picked from commit 7483903575eab97773a992149d64511d5ec6f256) >--- > source3/libads/ldap.c | 46 ++++++++++++++++++---------------- > source3/librpc/idl/ads.idl | 4 ++- > source3/libsmb/namequery_dc.c | 4 ++- > source3/winbindd/winbindd_cm.c | 6 ++--- > 4 files changed, 33 insertions(+), 27 deletions(-) > >diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c >index 8dde09e3551..ac57489d1eb 100644 >--- a/source3/libads/ldap.c >+++ b/source3/libads/ldap.c >@@ -237,7 +237,7 @@ bool ads_sitename_match(ADS_STRUCT *ads) > > bool ads_closest_dc(ADS_STRUCT *ads) > { >- if (ads->config.flags & NBT_SERVER_CLOSEST) { >+ if (ads->config.server_flags & NBT_SERVER_CLOSEST) { > DEBUG(10,("ads_closest_dc: NBT_SERVER_CLOSEST flag set\n")); > return True; > } >@@ -344,7 +344,7 @@ static bool ads_fill_cldap_reply(ADS_STRUCT *ads, > sitename_store(cldap_reply->dns_domain, cldap_reply->client_site); > > /* Leave this until last so that the flags are not clobbered */ >- ads->config.flags = cldap_reply->server_type; >+ ads->config.server_flags = cldap_reply->server_type; > > ret = true; > >@@ -379,7 +379,8 @@ static bool ads_try_connect(ADS_STRUCT *ads, bool gc, > ok = ads_cldap_netlogon_5(frame, > ss, > ads->server.realm, >- ads->config.flags | DS_ONLY_LDAP_NEEDED, >+ ads->config.required_flags | >+ DS_ONLY_LDAP_NEEDED, > &cldap_reply); > if (!ok) { > DBG_NOTICE("ads_cldap_netlogon_5(%s, %s) failed.\n", >@@ -490,20 +491,21 @@ again: > return status; > } > >- status = netlogon_pings(frame, /* mem_ctx */ >- lp_client_netlogon_ping_protocol(), /* proto */ >- ts_list, /* servers */ >- num_requests, /* num_servers */ >- (struct netlogon_ping_filter){ >- .ntversion = nt_version, >- .domain = ads->server.realm, >- .acct_ctrl = -1, >- .required_flags = ads->config.flags | >- DS_ONLY_LDAP_NEEDED, >- }, >- 1, /* wanted_servers */ >- endtime, /* timeout */ >- &responses); >+ status = netlogon_pings( >+ frame, /* mem_ctx */ >+ lp_client_netlogon_ping_protocol(), /* proto */ >+ ts_list, /* servers */ >+ num_requests, /* num_servers */ >+ (struct netlogon_ping_filter){ >+ .ntversion = nt_version, >+ .domain = ads->server.realm, >+ .acct_ctrl = -1, >+ .required_flags = ads->config.required_flags | >+ DS_ONLY_LDAP_NEEDED, >+ }, >+ 1, /* wanted_servers */ >+ endtime, /* timeout */ >+ &responses); > if (!NT_STATUS_IS_OK(status)) { > DBG_WARNING("netlogon_pings(realm=%s, num_requests=%zu) " > "for count[%zu] - %s\n", >@@ -1261,7 +1263,7 @@ void ads_disconnect(ADS_STRUCT *ads) > if (ads->ldap_wrap_data.mem_ctx) { > talloc_free(ads->ldap_wrap_data.mem_ctx); > } >- ads->config.flags = 0; >+ ads->config.server_flags = 0; > ads_zero_ldap(ads); > ZERO_STRUCT(ads->ldap_tls_data); > ZERO_STRUCT(ads->ldap_wrap_data); >@@ -3726,10 +3728,10 @@ ADS_STATUS ads_current_time(ADS_STRUCT *ads) > } > > /* >- * Reset ads->config.flags as it can contain the flags >+ * Reset flags as it can contain the flags > * returned by the previous CLDAP ping when reusing the struct. > */ >- ads_s->config.flags = 0; >+ ads_s->config.server_flags = 0; > > status = ads_connect_simple_anon(ads_s); > if ( !ADS_ERR_OK(status)) >@@ -3815,10 +3817,10 @@ ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32_t *val) > } > > /* >- * Reset ads->config.flags as it can contain the flags >+ * Reset flags as it can contain the flags > * returned by the previous CLDAP ping when reusing the struct. > */ >- ads_s->config.flags = 0; >+ ads_s->config.server_flags = 0; > > status = ads_connect_simple_anon(ads_s); > if ( !ADS_ERR_OK(status)) >diff --git a/source3/librpc/idl/ads.idl b/source3/librpc/idl/ads.idl >index 381447a1a29..20941e90346 100644 >--- a/source3/librpc/idl/ads.idl >+++ b/source3/librpc/idl/ads.idl >@@ -6,6 +6,7 @@ > */ > > import "nbt.idl"; >+import "netlogon.idl"; > > cpp_quote("#include <system/network.h>") > >@@ -51,7 +52,8 @@ interface ads > } ads_auth; > > typedef [nopull,nopush] struct { >- nbt_server_type flags; /* cldap flags identifying the services. */ >+ nbt_server_type server_flags; /* NBT_* cldap flags identifying the services. */ >+ netr_DsRGetDCName_flags required_flags; /* DS_* - Netlogon flags */ > string workgroup; > string realm; > string bind_path; >diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c >index 3a2f22129b8..3d771d77b8d 100644 >--- a/source3/libsmb/namequery_dc.c >+++ b/source3/libsmb/namequery_dc.c >@@ -109,7 +109,9 @@ static bool ads_dc_name(const char *domain, > } > > #ifdef HAVE_ADS >- if (is_our_primary_domain(domain) && (ads->config.flags & NBT_SERVER_KDC)) { >+ if (is_our_primary_domain(domain) && >+ (ads->config.server_flags & NBT_SERVER_KDC)) >+ { > if (ads_closest_dc(ads)) { > /* We're going to use this KDC for this realm/domain. > If we are using sites, then force the krb5 libs >diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c >index 3963881ca45..6e11461e07e 100644 >--- a/source3/winbindd/winbindd_cm.c >+++ b/source3/winbindd/winbindd_cm.c >@@ -1051,7 +1051,7 @@ static bool dcip_check_name_ads(const struct winbindd_domain *domain, > ads_status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY); > goto out; > } >- ads->config.flags |= request_flags; >+ ads->config.required_flags |= request_flags; > ads->server.no_fallback = true; > > ads_status = ads_connect_cldap_only(ads); >@@ -1067,9 +1067,9 @@ static bool dcip_check_name_ads(const struct winbindd_domain *domain, > } > namecache_store(name, 0x20, 1, sa); > >- DBG_DEBUG("CLDAP flags = 0x%"PRIx32"\n", ads->config.flags); >+ DBG_DEBUG("CLDAP flags = 0x%" PRIx32 "\n", ads->config.server_flags); > >- if (domain->primary && (ads->config.flags & NBT_SERVER_KDC)) { >+ if (domain->primary && (ads->config.server_flags & NBT_SERVER_KDC)) { > if (ads_closest_dc(ads)) { > char *sitename = sitename_fetch(tmp_ctx, > ads->config.realm); >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
asn
:
review+
Actions:
View
Attachments on
bug 15972
:
18804
| 18805 |
18806