summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/uinfo.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-04-12 11:10:13 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-04-12 11:10:13 +0000
commit91659b43b9a55d2c0aacb99071eb142eb4012e01 (patch)
treecc0213dc2f495ff60fd33ba8c5382dc6088b736c /winsup/cygwin/uinfo.cc
parent3d6a6ba138eaed9bf9522f87f9895406fc3d2d80 (diff)
downloadcygnal-91659b43b9a55d2c0aacb99071eb142eb4012e01.tar.gz
cygnal-91659b43b9a55d2c0aacb99071eb142eb4012e01.tar.bz2
cygnal-91659b43b9a55d2c0aacb99071eb142eb4012e01.zip
* uinfo.cc (pwdgrp::fetch_account_from_windows): Fix gid evaluation
for local accounts.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc19
1 files changed, 10 insertions, 9 deletions
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