dummy commit v3-2-winbind
authorStefan Metzmacher <metze@samba.org>
Mon, 8 Oct 2007 09:59:03 +0000 (11:59 +0200)
committerStefan Metzmacher <metze@sernet.de>
Thu, 11 Oct 2007 15:21:49 +0000 (17:21 +0200)
metze

source/winbindd/winbindd_passdb.c

index 5c36c0c3279edb292434bcfc9ae8df29862392e8..aa87693160cb52e7a34758cb259ba46d0cdb6888 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
+static NTSTATUS query_user_list_dom(struct winbindd_domain *domain,
+                              TALLOC_CTX *mem_ctx,
+                              uint32 *num_entries,
+                              WINBIND_USERINFO **info)
+{
+       struct pdb_search *search;
+       struct samr_displayentry *users;
+       int i;
+       NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+       search = pdb_search_users(ACB_NORMAL);
+       if (search == NULL) goto done;
+
+       *num_entries = pdb_search_entries(search, 0, 0xffffffff, &users);
+       if (*num_entries == 0) goto done;
+
+       *info = TALLOC_ARRAY(mem_ctx, WINBIND_USERINFO, *num_entries);
+       if (*info == NULL) {
+               result = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       for (i=0; i<*num_entries; i++) {
+               (*info)[i].acct_name = talloc_strdup(mem_ctx, users[i].account_name);
+               if (!(*info)[i].acct_name) goto nomem;
+               (*info)[i].full_name = talloc_strdup(mem_ctx, users[i].fullname);
+               if (!(*info)[i].full_name) goto nomem;
+               (*info)[i].homedir = NULL;
+               (*info)[i].shell = NULL;
+               (*info)[i].primary_gid = (gid_t)-1;
+
+               sid_compose(&(*info)[i].user_sid, &domain->sid, users[i].rid);
+
+               /* For the moment we set the primary group for
+                  every user to be the Domain Users group.
+                  There are serious problems with determining
+                  the actual primary group for large domains.
+                  This should really be made into a 'winbind
+                  force group' smb.conf parameter or
+                  something like that. */
+
+               sid_compose(&(*info)[i].group_sid, &domain->sid,
+                           DOMAIN_GROUP_RID_USERS);
+       }
+
+       result = NT_STATUS_OK;
+       goto done;
+ nomem:
+       result = NT_STATUS_NO_MEMORY;
+ done:
+       pdb_search_destroy(search);
+       return result;
+}
+
 /* Query display info for a domain.  This returns enough information plus a
    bit extra to give an overview of domain users for the User Manager
    application. */
@@ -35,6 +89,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
                               uint32 *num_entries, 
                               WINBIND_USERINFO **info)
 {
+return query_user_list_dom(domain, mem_ctx, num_entries, info);
        /* We don't have users */
        *num_entries = 0;
        *info = NULL;