The Samba-Bugzilla – Attachment 1180 Details for
Bug 2658
net ads user info <username> does not show primary user group
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
net ads user info primary user group patch
patch.patch (text/plain), 2.33 KB, created by
Pavel V. Rochnyack
on 2005-04-27 00:28:50 UTC
(
hide
)
Description:
net ads user info primary user group patch
Filename:
MIME Type:
Creator:
Pavel V. Rochnyack
Created:
2005-04-27 00:28:50 UTC
Size:
2.33 KB
patch
obsolete
>--- utils/net_ads.c.orig Wed Dec 15 20:33:18 2004 >+++ utils/net_ads.c Sat Apr 16 20:11:25 2005 >@@ -350,11 +350,18 @@ > ADS_STRUCT *ads; > ADS_STATUS rc; > void *res; >- const char *attrs[] = {"memberOf", NULL}; >+ const char *attrs[] = {"memberOf","primaryGroupID", NULL}; > char *searchstring=NULL; > char **grouplist; > char *escaped_user = escape_ldap_string_alloc(argv[0]); > >+ DOM_SID dom_sid; >+ DOM_SID group_sid; >+ TALLOC_CTX *ctx; >+ uint32 groupid; >+ char *primarygroup; >+ enum SID_NAME_USE type; >+ > if (argc < 1) { > return net_ads_user_usage(argc, argv); > } >@@ -379,6 +386,42 @@ > return -1; > } > >+ /* Get Domain SID */ >+ rc = ads_domain_sid(ads,&dom_sid); >+ if (!ADS_ERR_OK(rc)) { >+ d_printf("ads_domain_sid: %s\n", ads_errstr(rc)); >+ ads_destroy(&ads); >+ return -1; >+ } >+ >+ /* Get Primary User Group */ >+ if (!ads_pull_uint32(ads,res,"primaryGroupID",&groupid)) { >+ d_printf("Get user primary group ID failed, no such user."); >+ ads_destroy(&ads); >+ return -1; >+ } >+ >+ sid_copy(&group_sid,&dom_sid); >+ sid_append_rid(&group_sid,groupid); >+ >+ if (!(ctx = talloc_init("ads_user_info")) ) { >+ d_printf("talloc_init() failed!\n"); >+ ads_destroy(&ads); >+ return -1; >+ } >+ >+ rc = ads_sid_to_name(ads,ctx,&group_sid,&primarygroup,&type); >+ if (!ADS_ERR_OK(rc)) { >+ d_printf("ads_sid_to_name failed:%s\n",ads_errstr(rc)); >+ talloc_destroy(ctx); >+ ads_destroy(&ads); >+ return -1; >+ } >+ >+ d_printf("%s\n", primarygroup); >+ talloc_destroy(ctx); >+ >+ /* Get other user groups */ > grouplist = ldap_get_values(ads->ld, res, "memberOf"); > > if (grouplist) { >--- libads/ads_ldap.c.orig Sat Apr 16 17:15:52 2005 >+++ libads/ads_ldap.c Sat Apr 16 19:50:36 2005 >@@ -25,7 +25,7 @@ > #ifdef HAVE_LDAP > > /* convert a single name to a sid in a domain */ >-NTSTATUS ads_name_to_sid(ADS_STRUCT *ads, >+ADS_STATUS ads_name_to_sid(ADS_STRUCT *ads, > const char *name, > DOM_SID *sid, > enum SID_NAME_USE *type) >@@ -87,11 +87,11 @@ > SAFE_FREE(escaped_name); > SAFE_FREE(escaped_realm); > >- return status; >+ return ADS_ERROR_NT(status); > } > > /* convert a sid to a user or group name */ >-NTSTATUS ads_sid_to_name(ADS_STRUCT *ads, >+ADS_STATUS ads_sid_to_name(ADS_STRUCT *ads, > TALLOC_CTX *mem_ctx, > const DOM_SID *sid, > char **name, >@@ -149,7 +149,7 @@ > SAFE_FREE(ldap_exp); > SAFE_FREE(sidstr); > >- return status; >+ return ADS_ERROR_NT(status); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2658
:
1180
|
4476