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
size_t len;
int eof, readlen;
size_t len;
int eof, readlen;
+ if (old_pw == NULL && pw == NULL)
+ return (-1);
+
+ spw = old_pw;
+ /* deleting a user */
if (pw == NULL) {
line = NULL;
if (pw == NULL) {
line = NULL;
+ } else {
+ if ((line = pw_make(pw)) == NULL)
- spw = old_pw;
- } else if ((line = pw_make(pw)) == NULL)
- return (-1);
+ }
+
+ /* adding a user */
+ if (spw == NULL)
+ spw = pw;
- 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);
/* nope */
if (fpw != NULL)
free(fpw);