Skip to content

Commit

Permalink
ad: use sAMAccountName to lookup hosts
Browse files Browse the repository at this point in the history
To determine which GPOs apply to the host running SSSD the full DN of
the host object in AD is needed. To fine this object we use the NetBIOS
name of the host which is stored in AD in the sAMAccountName attribute.
Using other attributes, e.g. if ldap_user_name is set to a different
attribute, will most probably cause a failure since those attributes are
not managed as expected for host object. As a result sAMAccountName
should be hardcoded here to avoid issues.

Resolves: #6766

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Justin Stephenson <jstephen@redhat.com>
(cherry picked from commit 67c11c2)

Reviewed-by: Tomáš Halman <thalman@redhat.com>
  • Loading branch information
sumit-bose authored and alexey-tikhonov committed Dec 8, 2023
1 parent 918fb32 commit 0fbeaa7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/providers/ad/ad_gpo.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

#define AD_AT_DN "distinguishedName"
#define AD_AT_UAC "userAccountControl"
#define AD_AT_SAMACCOUNTNAME "sAMAccountName"
#define AD_AT_CONFIG_NC "configurationNamingContext"
#define AD_AT_GPLINK "gPLink"
#define AD_AT_GPOPTIONS "gpOptions"
Expand Down Expand Up @@ -1882,7 +1883,7 @@ ad_gpo_connect_done(struct tevent_req *subreq)
filter = talloc_asprintf(state,
"(&(objectclass=%s)(%s=%s))",
state->opts->user_map[SDAP_OC_USER].name,
state->opts->user_map[SDAP_AT_USER_NAME].name,
AD_AT_SAMACCOUNTNAME,
sam_account_name);
if (filter == NULL) {
ret = ENOMEM;
Expand Down

0 comments on commit 0fbeaa7

Please sign in to comment.