diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-05-06 12:02:48 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-05-06 12:02:48 +0000 |
commit | 439b7db7850cb69d8119308c5b6f16d1e596161f (patch) | |
tree | d84452c8343f1da40e676deac5346d80570ba3eb /winsup/cygwin/sec_helper.cc | |
parent | 67797a9560f77c1061ad5c901400abc7e9a4fcc2 (diff) | |
download | cygnal-439b7db7850cb69d8119308c5b6f16d1e596161f.tar.gz cygnal-439b7db7850cb69d8119308c5b6f16d1e596161f.tar.bz2 cygnal-439b7db7850cb69d8119308c5b6f16d1e596161f.zip |
* grp.cc (internal_getgroups): Drop unused cygsid variable.
* sec_helper.cc (cygpsid::pstring): Use sid_sub_auth_count macro.
(cygsid::get_sid): Use MAX_SUBAUTH_CNT rather than wrong constant 8.
Don't call memcpy to copy subauthorities into SID, use assignment.
(cygsid::getfromstr): Use MAX_SUBAUTH_CNT rather than wrong constant 8.
* security.h (MAX_SUBAUTH_CNT): New definition. Set to 11 to cover
Microsoft Accounts.
(MAX_SID_LEN): Define in terms of SID member sizes and MAX_SUBAUTH_CNT.
(DBGSID): Use MAX_SUBAUTH_CNT to define size of SubAuthority array.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Handle Micosoft
Accounts. Handle them as well known group. Compare domain names
case-insensitive.
* winlean.h (PIPE_REJECT_REMOTE_CLIENTS): Drop temporary definition
since Mingw64 catched up.
(DNLEN): Redefine as 16. Explain why.
Diffstat (limited to 'winsup/cygwin/sec_helper.cc')
-rw-r--r-- | winsup/cygwin/sec_helper.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index 122776f43..6f7921aa5 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -198,7 +198,7 @@ cygpsid::pstring (char *nsidstr) const strcpy (nsidstr, "S-1-"); t = nsidstr + sizeof ("S-1-") - 1; t += __small_sprintf (t, "%u", sid_id_auth (psid)); - for (i = 0; i < *RtlSubAuthorityCountSid (psid); ++i) + for (i = 0; i < sid_sub_auth_count (psid); ++i) t += __small_sprintf (t, "-%lu", sid_sub_auth (psid, i)); return t; } @@ -218,7 +218,7 @@ cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r, bool well_known) SID_IDENTIFIER_AUTHORITY sid_auth = { SECURITY_NULL_SID_AUTHORITY }; # define SECURITY_NT_AUTH 5 - if (s > 255 || cnt < 1 || cnt > 8) + if (s > 255 || cnt < 1 || cnt > MAX_SUBAUTH_CNT) { psid = NO_SID; return NULL; @@ -226,8 +226,9 @@ cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r, bool well_known) sid_auth.Value[5] = s; set (); RtlInitializeSid (psid, &sid_auth, cnt); + PDBGSID dsid = (PDBGSID) psid; for (i = 0; i < cnt; ++i) - memcpy ((char *) psid + 8 + sizeof (DWORD) * i, &r[i], sizeof (DWORD)); + dsid->SubAuthority[i] = r[i]; /* If the well_known flag isn't set explicitely, we check the SID for being a well-known SID ourselves. That's necessary because this cygsid is created from a SID string, usually from /etc/passwd or @@ -247,12 +248,12 @@ cygsid::getfromstr (PCWSTR nsidstr, bool well_known) { PWCHAR lasts; DWORD s, cnt = 0; - DWORD r[8]; + DWORD r[MAX_SUBAUTH_CNT]; if (nsidstr && !wcsncmp (nsidstr, L"S-1-", 4)) { s = wcstoul (nsidstr + 4, &lasts, 10); - while (cnt < 8 && *lasts == '-') + while (cnt < MAX_SUBAUTH_CNT && *lasts == '-') r[cnt++] = wcstoul (lasts + 1, &lasts, 10); if (!*lasts) return get_sid (s, cnt, r, well_known); @@ -265,12 +266,12 @@ cygsid::getfromstr (const char *nsidstr, bool well_known) { char *lasts; DWORD s, cnt = 0; - DWORD r[8]; + DWORD r[MAX_SUBAUTH_CNT]; if (nsidstr && !strncmp (nsidstr, "S-1-", 4)) { s = strtoul (nsidstr + 4, &lasts, 10); - while (cnt < 8 && *lasts == '-') + while (cnt < MAX_SUBAUTH_CNT && *lasts == '-') r[cnt++] = strtoul (lasts + 1, &lasts, 10); if (!*lasts) return get_sid (s, cnt, r, well_known); |