1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

net_ads: fill ads->auth.realm from c->creds

We get the realm we use for authentication needs to
the realm belonging to the username we use.

We derive the username from c->creds, so we need to
do the same for the realm.

Otherwise we try to authenticate as the wrong user.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15323

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0ef53b948e13eb36b536228cccd89aa4c2adbb90)
This commit is contained in:
Stefan Metzmacher 2023-03-02 14:46:25 +01:00 committed by Jule Anger
parent 45a264bf5b
commit fd477e4ff6
2 changed files with 9 additions and 2 deletions

View File

@ -1 +0,0 @@
^samba4.blackbox.net_ads_search_server_P.trust

View File

@ -710,7 +710,15 @@ retry:
TALLOC_FREE(ads);
return ADS_ERROR(LDAP_NO_MEMORY);
}
}
} else if (ads->auth.realm == NULL) {
const char *c_realm = cli_credentials_get_realm(c->creds);
ads->auth.realm = talloc_strdup(ads, c_realm);
if (ads->auth.realm == NULL) {
TALLOC_FREE(ads);
return ADS_ERROR(LDAP_NO_MEMORY);
}
}
status = ads_connect(ads);