Changeset 228 for branches/samba-3.2.x/source/winbindd/winbindd_group.c
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/winbindd/winbindd_group.c
r204 r228 36 36 fstring name; 37 37 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 } 39 43 safe_strcat(name, ",", sizeof(name)-1); 40 44 string_append(pp_members, name); … … 135 139 } 136 140 137 add_member( domain->name, names[i], pp_members, p_num_members);141 add_member(NULL, names[i], pp_members, p_num_members); 138 142 } 139 143 … … 332 336 } 333 337 338 static 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 334 356 static NTSTATUS add_names_to_list( TALLOC_CTX *ctx, 335 357 char ***list, uint32 *n_list, … … 361 383 for ( i=*n_list, j=0; i<n_new_list; i++, j++ ) { 362 384 new_list[i] = talloc_strdup( new_list, names[j] ); 363 }364 365 /* search for duplicates for sorting and looking for matching366 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 }376 385 } 377 386 … … 528 537 529 538 /* Real work goes here. Create a list of group names to 530 expand starti gn with the initial one. Pass that to539 expand starting with the initial one. Pass that to 531 540 expand_groups() which returns a list of more group names 532 541 to expand. Do this up to the max search depth. */ … … 577 586 } 578 587 TALLOC_FREE( glist ); 579 588 589 sort_unique_list(&names, &num_names); 590 580 591 DEBUG(10, ("looked up %d names\n", num_names)); 581 592 … … 697 708 /* Get info for the domain */ 698 709 699 if ((domain = find_domain_from_name (name_domain)) == NULL) {710 if ((domain = find_domain_from_name_noinit(name_domain)) == NULL) { 700 711 DEBUG(3, ("could not get domain sid for domain %s\n", 701 712 name_domain)); … … 730 741 731 742 static void getgrsid_sid2gid_recv(void *private_data, bool success, gid_t gid) 732 743 { 733 744 struct getgrsid_state *s = 734 745 (struct getgrsid_state *)private_data; … … 780 791 781 792 request_ok(s->state); 782 793 } 783 794 784 795 static void getgrsid_lookupsid_recv( void *private_data, bool success, … … 805 816 request_error(s->state); 806 817 return; 807 }818 } 808 819 809 820 if ( (s->group_name = talloc_asprintf( s->state->mem_ctx, … … 812 823 *lp_winbind_separator(), 813 824 name)) == NULL ) 814 {825 { 815 826 DEBUG(1, ("getgrsid_lookupsid_recv: talloc_asprintf() Failed!\n")); 816 827 request_error(s->state); … … 822 833 winbindd_sid2gid_async(s->state->mem_ctx, &s->group_sid, 823 834 getgrsid_sid2gid_recv, s); 824 835 } 825 836 826 837 static void winbindd_getgrsid( struct winbindd_cli_state *state, const DOM_SID group_sid ) 827 838 { 828 839 struct getgrsid_state *s; 829 840
Note:
See TracChangeset
for help on using the changeset viewer.