Ignore:
Timestamp:
May 26, 2009, 9:44:50 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/winbindd/winbindd_group.c

    r204 r228  
    3636        fstring name;
    3737
    38         fill_domain_username(name, domain, user, True);
     38        if (domain != NULL) {
     39                fill_domain_username(name, domain, user, True);
     40        } else {
     41                fstrcpy(name, user);
     42        }
    3943        safe_strcat(name, ",", sizeof(name)-1);
    4044        string_append(pp_members, name);
     
    135139                }
    136140
    137                 add_member(domain->name, names[i], pp_members, p_num_members);
     141                add_member(NULL, names[i], pp_members, p_num_members);
    138142        }
    139143
     
    332336}
    333337
     338static void sort_unique_list(char ***list, uint32 *n_list)
     339{
     340        uint32_t i;
     341
     342        /* search for duplicates for sorting and looking for matching
     343           neighbors */
     344
     345        qsort(*list, *n_list, sizeof(char*), QSORT_CAST namecmp);
     346
     347        for (i=1; i < *n_list; i++) {
     348                if (strcmp((*list)[i-1], (*list)[i]) == 0) {
     349                        memmove(&((*list)[i-1]), &((*list)[i]),
     350                                 sizeof(char*)*((*n_list)-i));
     351                        (*n_list)--;
     352                }
     353        }
     354}
     355
    334356static NTSTATUS add_names_to_list( TALLOC_CTX *ctx,
    335357                                   char ***list, uint32 *n_list,
     
    361383        for ( i=*n_list, j=0; i<n_new_list; i++, j++ ) {
    362384                new_list[i] = talloc_strdup( new_list, names[j] );
    363         }
    364 
    365         /* search for duplicates for sorting and looking for matching
    366            neighbors */
    367        
    368         qsort( new_list, n_new_list, sizeof(char*), QSORT_CAST namecmp );
    369        
    370         for ( i=1; i<n_new_list; i++ ) {
    371                 if ( strcmp( new_list[i-1], new_list[i] ) == 0 ) {                     
    372                         memmove( &new_list[i-1], &new_list[i],
    373                                  sizeof(char*)*(n_new_list-i) );
    374                         n_new_list--;
    375                 }
    376385        }
    377386
     
    528537
    529538        /* Real work goes here.  Create a list of group names to
    530            expand startign with the initial one.  Pass that to
     539           expand starting with the initial one.  Pass that to
    531540           expand_groups() which returns a list of more group names
    532541           to expand.  Do this up to the max search depth. */
     
    577586        }
    578587        TALLOC_FREE( glist );   
    579          
     588
     589        sort_unique_list(&names, &num_names);
     590
    580591        DEBUG(10, ("looked up %d names\n", num_names));
    581592
     
    697708        /* Get info for the domain */
    698709
    699         if ((domain = find_domain_from_name(name_domain)) == NULL) {
     710        if ((domain = find_domain_from_name_noinit(name_domain)) == NULL) {
    700711                DEBUG(3, ("could not get domain sid for domain %s\n",
    701712                          name_domain));
     
    730741
    731742static void getgrsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
    732         {
     743{
    733744        struct getgrsid_state *s =
    734745                (struct getgrsid_state *)private_data;
     
    780791
    781792        request_ok(s->state);   
    782         }
     793}
    783794
    784795static void getgrsid_lookupsid_recv( void *private_data, bool success,
     
    805816                request_error(s->state);
    806817                return;
    807 }
     818        }
    808819
    809820        if ( (s->group_name = talloc_asprintf( s->state->mem_ctx,
     
    812823                                               *lp_winbind_separator(),
    813824                                               name)) == NULL )
    814 {
     825        {
    815826                DEBUG(1, ("getgrsid_lookupsid_recv: talloc_asprintf() Failed!\n"));
    816827                request_error(s->state);
     
    822833        winbindd_sid2gid_async(s->state->mem_ctx, &s->group_sid,
    823834                               getgrsid_sid2gid_recv, s);
    824         }
     835}
    825836
    826837static void winbindd_getgrsid( struct winbindd_cli_state *state, const DOM_SID group_sid )
    827         {
     838{
    828839        struct getgrsid_state *s;
    829840
Note: See TracChangeset for help on using the changeset viewer.