* passwd.cc (pwdgrp::parse_passwd): Fix an off by one computing the

buffer len.  Add comment.
	* uinfo.cc (internal_getlogin): Fix typo in comment.
This commit is contained in:
Corinna Vinschen 2014-05-07 14:49:54 +00:00
parent 951bc34df4
commit 03039d4fc2
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2014-05-07 Corinna Vinschen <corinna@vinschen.de>
* passwd.cc (pwdgrp::parse_passwd): Fix an off by one computing the
buffer len. Add comment.
* uinfo.cc (internal_getlogin): Fix typo in comment.
2014-05-07 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (pwdgrp::fetch_account_from_windows): Tweak SID<->uid

View File

@ -41,7 +41,9 @@ pwdgrp::parse_passwd ()
res.p.pw_dir = next_str (':');
res.p.pw_shell = next_str (':');
res.sid.getfrompw (&res.p);
res.len = lptr - res.p.pw_name;
/* lptr points to the \0 after pw_shell. Increment by one to get the correct
required buffer len in getpw_cp. */
res.len = lptr - res.p.pw_name + 1;
return true;
}

View File

@ -135,7 +135,7 @@ internal_getlogin (cygheap_user &user)
user.set_name (pwd->pw_name);
myself->uid = pwd->pw_uid;
myself->gid = pwd->pw_gid;
/* Is the primary group in the passwd DB is different from the primary
/* If the primary group in the passwd DB is different from the primary
group in the user token, we have to find the SID of that group and
try to override the token primary group. */
if (!pgrp || myself->gid != pgrp->gr_gid)