Skip to content

Commit

Permalink
ad: use default user_map when looking of host groups for GPO
Browse files Browse the repository at this point in the history
Use the default AD user attribute map to lookup the group membership of
the AD host object. This should help to avoid issues if user attributes
are overwritten in the user attribute map.

Resolves: #7590

Reviewed-by: Justin Stephenson <[email protected]>
Reviewed-by: Tomáš Halman <[email protected]>
  • Loading branch information
sumit-bose authored and alexey-tikhonov committed Sep 24, 2024
1 parent 69f63f1 commit 5f5077a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/providers/ad/ad_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct ad_access_ctx {
} gpo_map_type;
hash_table_t *gpo_map_options_table;
enum gpo_map_type gpo_default_right;
struct sdap_attr_map *host_attr_map;
};

struct tevent_req *
Expand Down
15 changes: 14 additions & 1 deletion src/providers/ad/ad_gpo.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "providers/ad/ad_common.h"
#include "providers/ad/ad_domain_info.h"
#include "providers/ad/ad_gpo.h"
#include "providers/ad/ad_opts.h"
#include "providers/ldap/sdap_access.h"
#include "providers/ldap/sdap_async.h"
#include "providers/ldap/sdap.h"
Expand Down Expand Up @@ -2241,13 +2242,25 @@ ad_gpo_connect_done(struct tevent_req *subreq)
"trying with user search base.");
}

if (state->access_ctx->host_attr_map == NULL) {
ret = sdap_copy_map(state->access_ctx,
ad_2008r2_user_map, SDAP_OPTS_USER,
&state->access_ctx->host_attr_map);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, "Failed to copy user map.\n");
goto done;
}
}

subreq = groups_by_user_send(state, state->ev,
state->access_ctx->ad_id_ctx->sdap_id_ctx,
sdom, state->conn,
search_bases,
state->host_fqdn,
BE_FILTER_NAME,
NULL, NULL, 0,
NULL,
state->access_ctx->host_attr_map,
SDAP_OPTS_USER,
true,
true);
tevent_req_set_callback(subreq, ad_gpo_target_dn_retrieval_done, req);
Expand Down

0 comments on commit 5f5077a

Please sign in to comment.