summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pwupd.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-07-06 23:24:06 +0000
committerbapt <bapt@FreeBSD.org>2014-07-06 23:24:06 +0000
commit6763aa7bd25f654b3dc700a96e9e409f4c692dcd (patch)
tree8ef5220b4aba4f0144e7c56dcf8dc37bcac68890 /usr.sbin/pw/pwupd.c
parent302b3764d6b807bf0f5ea610145ac630d9621afd (diff)
downloadFreeBSD-src-6763aa7bd25f654b3dc700a96e9e409f4c692dcd.zip
FreeBSD-src-6763aa7bd25f654b3dc700a96e9e409f4c692dcd.tar.gz
MFH: r264781, r267669, r267670
Simplify reading pw.conf(5) by using getline(3) Removed compatibility with pre FreeBSD 2.2 pw_mkdb command [1] Fix some broken indentattion [1] Fix changing the username [2] PR: 189172 [1], 189173 [2] Submitted by: fullermd@over-yonder.net [1][2]
Diffstat (limited to 'usr.sbin/pw/pwupd.c')
-rw-r--r--usr.sbin/pw/pwupd.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c
index 22662db..c2a9a53 100644
--- a/usr.sbin/pw/pwupd.c
+++ b/usr.sbin/pw/pwupd.c
@@ -45,9 +45,6 @@ static const char rcsid[] =
#include "pwupd.h"
-#define HAVE_PWDB_C 1
-#define HAVE_PWDB_U 1
-
static char pathpwd[] = _PATH_PWD;
static char * pwpath = pathpwd;
@@ -112,22 +109,14 @@ pw_update(struct passwd * pwd, char const * user)
{
int rc = 0;
- /*
- * First, let's check the see if the database is alright
- * Note: -C is only available in FreeBSD 2.2 and above
- */
-#ifdef HAVE_PWDB_C
rc = pwdb("-C", (char *)NULL); /* Check only */
if (rc == 0) {
-#else
- { /* No -C */
-#endif
int pfd, tfd;
struct passwd *pw = NULL;
struct passwd *old_pw = NULL;
- if (pwd != NULL)
- pw = pw_dup(pwd);
+ if (pwd != NULL)
+ pw = pw_dup(pwd);
if (user != NULL)
old_pw = GETPWNAM(user);
@@ -150,7 +139,7 @@ pw_update(struct passwd * pwd, char const * user)
* in case of deletion of a user, the whole database
* needs to be regenerated
*/
- if (pw_mkdb(pw != NULL ? user : NULL) == -1) {
+ if (pw_mkdb(pw != NULL ? pw->pw_name : NULL) == -1) {
pw_fini();
err(1, "pw_mkdb()");
}
OpenPOWER on IntegriCloud