s3: In pdb_ads, cope with artificial samu structs
authorVolker Lendecke <vl@samba.org>
Sun, 6 Feb 2011 09:15:50 +0000 (10:15 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 6 Feb 2011 15:44:56 +0000 (16:44 +0100)
source3/passdb/pdb_ads.c

index 7a299e585477ab5531819ad79cc1d03068ed633d..68ce2b469ca5bf1185830bdfd5ffff0041943d59 100644 (file)
@@ -974,8 +974,7 @@ static NTSTATUS pdb_ads_enum_group_memberships(struct pdb_methods *m,
 {
        struct pdb_ads_state *state = talloc_get_type_abort(
                m->private_data, struct pdb_ads_state);
-       struct pdb_ads_samu_private *priv = pdb_ads_get_samu_private(
-               m, user);
+       struct pdb_ads_samu_private *priv;
        const char *attrs[1] = { "objectSid" };
        struct tldap_message **groups;
        int i, rc, count;
@@ -983,6 +982,15 @@ static NTSTATUS pdb_ads_enum_group_memberships(struct pdb_methods *m,
        struct dom_sid *group_sids;
        gid_t *gids;
 
+       priv = pdb_ads_get_samu_private(m, user);
+       if (priv == NULL) {
+               DEBUG(10, ("Could not get pdb_ads_samu_private\n"));
+               *pp_sids = NULL;
+               *pp_gids = NULL;
+               *p_num_groups = 0;
+               return NT_STATUS_OK;
+       }
+
        rc = pdb_ads_search_fmt(
                state, state->domaindn, TLDAP_SCOPE_SUB,
                attrs, ARRAY_SIZE(attrs), 0, talloc_tos(), &groups,