Date: Sun, 6 Jul 2008 21:03:23 -0700 (PDT) From: Unga <unga888@yahoo.com> To: freebsd-current@freebsd.org Subject: [PATCH] Fix /usr/src/usr.sbin/pw/pwupd.c - pw_update() return success on failure Message-ID: <232537.6371.qm@web57008.mail.re3.yahoo.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi all
In the present implementation even if the pwdb() fails, pw_update() still return rc=0, therefore, subsequent functions still continue to proceed without passwd and master.passwd been updated. The attached patch fixes this issue. If this patch is acceptable, appreciate if it could be applied to both current and RELENG_7.
Kind regards
Unga
[-- Attachment #2 --]
diff -Naur pw.orig/pwupd.c pw/pwupd.c
--- pw.orig/pwupd.c 2008-07-07 10:28:52.000000000 +0800
+++ pw/pwupd.c 2008-07-07 11:27:37.000000000 +0800
@@ -139,7 +139,7 @@
static int
pw_update(struct passwd * pwd, char const * user, int mode)
{
- int rc = 0;
+ int rc;
ENDPWENT();
@@ -148,7 +148,8 @@
* Note: -C is only available in FreeBSD 2.2 and above
*/
#ifdef HAVE_PWDB_C
- if (pwdb("-C", (char *)NULL) == 0) { /* Check only */
+ rc = pwdb("-C", (char *)NULL); /* Check only */
+ if (rc == 0) {
#else
{ /* No -C */
#endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?232537.6371.qm>
