[Bug 227541] pw(8): fix 'pw userdel' problem with NIS Master

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Apr 19 04:53:47 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227541

--- Comment #1 from hsakamt at tsnr.com ---
Sorry, my patch was incomplete and failed without '-Y' option. The 'pwd' always
need to be duplicated.

patch:
--- pw_user.c.orig      2018-04-16 14:26:59.461462000 +0900
+++ pw_user.c   2018-04-19 13:16:14.015451000 +0900
@@ -963,7 +963,7 @@
        else
                grname[0] = '\0';

-       rc = delpwent(pwd);
+       rc = delpwent(pw_dup(pwd));
        if (rc == -1)
                err(EX_IOERR, "user '%s' does not exist", pwd->pw_name);
        else if (rc != 0)
@@ -1024,6 +1024,9 @@
                     "completely ");
        }

+       if (nis && nis_update() == 0)
+               pw_log(cnf, M_ADD, W_USER, "NIS maps updated");
+
        return (EXIT_SUCCESS);
 }



# grep passwd /etc/nsswitch.conf 
passwd: compat
passwd_compat: nis

And I add '+:::::::::' line in /etc/master.passwd


original 'pw':
# pw useradd test -Y                          (OK)
NIS Map update started ...
# pw userdel test01 -Y                        (NG)
pw: pw_copy(): No such file or directory
# pw useradd test                             (OK)
# pw userdel test                             (NG)
pw: pw_copy(): No such file or directory

my old patched 'pw':
# ./pw useradd test01 -Y                      (OK)
NIS Map update started ...
# ./pw userdel test01 -Y                      (OK)
NIS Map update started ...
# ./pw useradd test01                         (OK)
# ./pw userdel test01                         (NG)
pw: pw_copy(): No such file or directory

new patched 'pw':
# ./pw.new useradd test01 -Y                  (OK)
NIS Map update started ...
# ./pw.new userdel test01 -Y                  (OK)
NIS Map update started on ...
# ./pw.new useradd test01                     (OK)
# ./pw.new userdel test01                     (OK)

Thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list