Revert user comparison back to user names as some user can share uids (root/toor
for example) get the username information from old_pw structures to still allow renaming of a user. Reported by: Claude Buisson <clbuisson@orange.fr> Approved by: des (mentor) MFC after: 3 weeks
This commit is contained in:
parent
2f49b6b831
commit
2f1b1e91a3
@ -437,14 +437,21 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw)
|
||||
size_t len;
|
||||
int eof, readlen;
|
||||
|
||||
spw = pw;
|
||||
if (old_pw == NULL && pw == NULL)
|
||||
return (-1);
|
||||
|
||||
spw = old_pw;
|
||||
/* deleting a user */
|
||||
if (pw == NULL) {
|
||||
line = NULL;
|
||||
if (old_pw == NULL)
|
||||
} else {
|
||||
if ((line = pw_make(pw)) == NULL)
|
||||
return (-1);
|
||||
spw = old_pw;
|
||||
} else if ((line = pw_make(pw)) == NULL)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* adding a user */
|
||||
if (spw == NULL)
|
||||
spw = pw;
|
||||
|
||||
eof = 0;
|
||||
len = 0;
|
||||
@ -511,7 +518,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw)
|
||||
*/
|
||||
|
||||
*q = t;
|
||||
if (fpw == NULL || fpw->pw_uid != spw->pw_uid) {
|
||||
if (fpw == NULL || strcmp(fpw->pw_name, spw->pw_name) != 0) {
|
||||
/* nope */
|
||||
if (fpw != NULL)
|
||||
free(fpw);
|
||||
|
Loading…
x
Reference in New Issue
Block a user