r16687: Fix bugs #3901, #3902, #3903 reported by jason@ncac.gwu.edu.
authorJeremy Allison <jra@samba.org>
Thu, 29 Jun 2006 18:01:25 +0000 (18:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:19:08 +0000 (11:19 -0500)
Jeremy
(This used to be commit c4896b17faa6802f18cc1cec7fcc6168bde2eef0)

source3/lib/smbldap.c
source3/nsswitch/winbindd_misc.c
source3/nsswitch/winbindd_user.c

index 5b18f4e31137990075edde832b98f8bba7ab1e5f..a63e1c1bcc33db849fd43ce1fd89eaaa2990a4c9 100644 (file)
@@ -325,7 +325,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
                return NULL;
        }
 
-       if (pull_utf8_talloc(mem_ctx, &result, values[0]) < 0) {
+       if (pull_utf8_talloc(mem_ctx, &result, values[0]) == (size_t)-1) {
                DEBUG(10, ("pull_utf8_talloc failed\n"));
                ldap_value_free(values);
                return NULL;
index 6c6dc5b7651cc60bfc8fbb13128f09c1950b0e26..d43617f7789630793ee76c1805e9087dc6970ae7 100644 (file)
@@ -124,6 +124,12 @@ enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *
                                                  &num_domains, &names,
                                                  &alt_names, &sids);
 
+       if (!NT_STATUS_IS_OK(result)) {
+               DEBUG(3, ("winbindd_dual_list_trusted_domains: trusted_domains returned %s\n",
+                       nt_errstr(result) ));
+               num_domains = 0;
+       }
+
        extra_data = talloc_strdup(state->mem_ctx, "");
 
        if (num_domains > 0)
index 07bd2a30bf721b386c6de89dd31a22b862d7cfec..a73b5c394cd4524340bae37a9871d97b07c22fde 100644 (file)
@@ -524,7 +524,6 @@ static BOOL get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
        uint32 num_entries;
        WINBIND_USERINFO *info;
        struct getpwent_user *name_list = NULL;
-       BOOL result = False;
        struct winbindd_domain *domain;
        struct winbindd_methods *methods;
        unsigned int i;
@@ -552,12 +551,18 @@ static BOOL get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
        status = methods->query_user_list(domain, mem_ctx, &num_entries, 
                                          &info);
                
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(10,("get_sam_user_entries: query_user_list failed with %s\n",
+                       nt_errstr(status) ));
+               return False;
+       }
+
        if (num_entries) {
                name_list = SMB_REALLOC_ARRAY(name_list, struct getpwent_user, ent->num_sam_entries + num_entries);
                
                if (!name_list) {
                        DEBUG(0,("get_sam_user_entries realloc failed.\n"));
-                       goto done;
+                       return False;
                }
        }
 
@@ -602,11 +607,7 @@ static BOOL get_sam_user_entries(struct getent_state *ent, TALLOC_CTX *mem_ctx)
        
        ent->sam_entries = name_list;
        ent->sam_entry_index = 0;
-       result = ent->num_sam_entries > 0;
-
- done:
-
-       return result;
+       return ent->num_sam_entries > 0;
 }
 
 /* Fetch next passwd entry from ntdom database */
@@ -757,6 +758,10 @@ void winbindd_list_users(struct winbindd_cli_state *state)
                status = methods->query_user_list(domain, state->mem_ctx, 
                                                  &num_entries, &info);
 
+               if (!NT_STATUS_IS_OK(status)) {
+                       continue;
+               }
+
                if (num_entries == 0)
                        continue;