From: Corinna Vinschen Date: Sat, 12 Apr 2014 11:10:13 +0000 (+0000) Subject: * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix gid evaluation X-Git-Tag: sid-snapshot-20140601~64 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=91659b43b9a55d2c0aacb99071eb142eb4012e01;p=newlib-cygwin.git * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix gid evaluation for local accounts. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9c2eb98c5..b959d74d3 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2014-04-12 Corinna Vinschen + + * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix gid evaluation + for local accounts. + 2014-04-10 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 30. diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 3b42754ed..a7a0fdfc3 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -1475,13 +1475,13 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) if (uid == ILLEGAL_UID) uid = posix_offset + sid_sub_auth_rid (sid); - if (is_domain_account) - { - /* We only care for the extended user information if we're - creating a passwd entry and the account is, in fact, a user. */ - if (is_group () || acc_type != SidTypeUser) - break; + /* We only care for extended user information if we're creating a + passwd entry and the account is a user or alias. */ + if (is_group () || acc_type == SidTypeGroup) + break; + if (acc_type == SidTypeUser) + { /* Default primary group. If the sid is the current user, fetch the default group from the current user token, otherwise make the educated guess that the user is in group "Domain Users" @@ -1491,7 +1491,10 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) + sid_sub_auth_rid (cygheap->user.groups.pgsid); else gid = posix_offset + DOMAIN_GROUP_RID_USERS; + } + if (is_domain_account) + { /* Use LDAP to fetch domain account infos. */ if (!cldap->open (NULL)) break; @@ -1561,7 +1564,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) /* Set comment variable for below attribute loop. */ comment = ui->usri4_comment; } - else if (acc_type == SidTypeAlias) + else /* acc_type == SidTypeAlias */ { nas = NetLocalGroupGetInfo (NULL, name, 1, (PBYTE *) &gi); if (nas != NERR_Success) @@ -1572,8 +1575,6 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) /* Set comment variable for below attribute loop. */ comment = gi->lgrpi1_comment; } - else /* SidTypeGroup. No way to add a comment to "None" :( */ - break; /* Local SAM accounts have only a handful attributes available to home users. Therefore, fetch additional passwd/group attributes from the "Description" field