summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adduser/adduser.conf.56
-rw-r--r--adduser/adduser.sh20
-rw-r--r--pw/Makefile2
-rw-r--r--pw/cpdir.c3
-rw-r--r--pw/pw.84
-rw-r--r--pw/pw.h1
-rw-r--r--pw/pw_conf.c4
-rw-r--r--pw/pw_user.c15
8 files changed, 23 insertions, 32 deletions
diff --git a/adduser/adduser.conf.5 b/adduser/adduser.conf.5
index a78aeea..d5fcf77 100644
--- a/adduser/adduser.conf.5
+++ b/adduser/adduser.conf.5
@@ -208,6 +208,9 @@ The
.Nm
manual page first appeared in
.Fx 5.3 .
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
.Sh BUGS
The internal variables documented here may change without notice.
Do not rely on them.
@@ -216,6 +219,3 @@ To modify this file invoke
with the
.Fl C
option instead.
-.Sh AUTHORS
-This manual page was written by
-.An Tom Rhodes Aq trhodes@FreeBSD.org .
diff --git a/adduser/adduser.sh b/adduser/adduser.sh
index 3d1d6f8..8e05f33 100644
--- a/adduser/adduser.sh
+++ b/adduser/adduser.sh
@@ -28,20 +28,20 @@
#
# err msg
-# Display $msg on stderr, unless we're being quiet.
-#
+# Display $msg on stderr, unless we're being quiet.
+#
err() {
if [ -z "$quietflag" ]; then
- echo 1>&2 ${THISCMD}: ERROR: $*
+ echo 1>&2 ${THISCMD}: ERROR: $*
fi
}
# info msg
-# Display $msg on stdout, unless we're being quiet.
-#
+# Display $msg on stdout, unless we're being quiet.
+#
info() {
if [ -z "$quietflag" ]; then
- echo ${THISCMD}: INFO: $*
+ echo ${THISCMD}: INFO: $*
fi
}
@@ -50,7 +50,7 @@ info() {
# is not, output the value of the next higher uid that is available.
# If a uid is not specified, output the first available uid, as indicated
# by pw(8).
-#
+#
get_nextuid () {
_uid=$1
_nextuid=
@@ -163,8 +163,7 @@ fullpath_from_shell() {
# the path is invalid or it is not executable it
# will emit an informational message saying so.
#
-shell_exists()
-{
+shell_exists() {
_sh="$1"
_shellchk="${GREPCMD} '^$_sh$' ${ETCSHELLS} > /dev/null 2>&1"
@@ -647,7 +646,6 @@ input_from_file() {
# the user database.
#
input_interactive() {
-
_disable=
_pass=
_passconfirm=
@@ -887,7 +885,7 @@ defaultshell="${DEFAULTSHELL}"
defaultHomePerm=
# Make sure the user running this program is root. This isn't a security
-# measure as much as it is a usefull method of reminding the user to
+# measure as much as it is a useful method of reminding the user to
# 'su -' before he/she wastes time entering data that won't be saved.
#
procowner=${procowner:-`/usr/bin/id -u`}
diff --git a/pw/Makefile b/pw/Makefile
index 8937124..ae0023c 100644
--- a/pw/Makefile
+++ b/pw/Makefile
@@ -6,6 +6,8 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \
grupd.c pwupd.c fileupd.c edgroup.c psdate.c \
bitmap.c cpdir.c rm_r.c
+WARNS?= 1
+
DPADD= ${LIBCRYPT} ${LIBUTIL}
LDADD= -lcrypt -lutil
diff --git a/pw/cpdir.c b/pw/cpdir.c
index f370421..017c200 100644
--- a/pw/cpdir.c
+++ b/pw/cpdir.c
@@ -41,6 +41,7 @@ static const char rcsid[] =
#include <sys/param.h>
#include <dirent.h>
+#include "pw.h"
#include "pwupd.h"
void
@@ -81,7 +82,7 @@ copymkdir(char const * dir, char const * skel, mode_t mode, uid_t uid, gid_t gid
else {
if (S_ISDIR(st.st_mode)) { /* Recurse for this */
if (strcmp(e->d_name, ".") != 0 && strcmp(e->d_name, "..") != 0)
- copymkdir(dst, src, (st.st_mode & 0777), uid, gid);
+ copymkdir(dst, src, st.st_mode & _DEF_DIRMODE, uid, gid);
chflags(dst, st.st_flags); /* propogate flags */
} else if (S_ISLNK(st.st_mode) && (len = readlink(src, lnk, sizeof(lnk))) != -1) {
lnk[len] = '\0';
diff --git a/pw/pw.8 b/pw/pw.8
index 4287055..6e79d56 100644
--- a/pw/pw.8
+++ b/pw/pw.8
@@ -245,7 +245,6 @@ id as an alternative to using the
options.
.Pp
The following flags are common to most or all modes of operation:
-.Pp
.Bl -tag -width "-G grouplist"
.It Fl V Ar etcdir
This flag sets an alternate location for the password, group and configuration files,
@@ -319,7 +318,6 @@ The following options apply to the
and
.Ar usermod
commands:
-.Pp
.Bl -tag -width "-G grouplist"
.It Fl n Ar name
Specify the user/account name.
@@ -353,7 +351,6 @@ or
.Fl u
options.
.El
-.Pp
.Bl -tag -width "-G grouplist"
.It Fl c Ar comment
This field sets the contents of the passwd GECOS field, which normally contains up
@@ -802,7 +799,6 @@ There is rarely any need to duplicate a group id.
The
.Ar groupmod
command adds one additional option:
-.Pp
.Bl -tag -width "-m newmembers"
.It Fl l Ar name
This option allows changing of an existing group name to
diff --git a/pw/pw.h b/pw/pw.h
index 7568c22..6e521d1 100644
--- a/pw/pw.h
+++ b/pw/pw.h
@@ -95,6 +95,7 @@ struct userconf
int numgroups; /* (internal) size of default_group array */
};
+#define _DEF_DIRMODE (S_IRWXU | S_IRWXG | S_IRWXO)
#define _PATH_PW_CONF "/etc/pw.conf"
#define _UC_MAXLINE 1024
#define _UC_MAXSHELLS 32
diff --git a/pw/pw_conf.c b/pw/pw_conf.c
index 51672b9..edeb015 100644
--- a/pw/pw_conf.c
+++ b/pw/pw_conf.c
@@ -91,7 +91,7 @@ static struct userconf config =
NULL, /* Mail to send to new accounts */
"/var/log/userlog", /* Where to log changes */
"/home", /* Where to create home directory */
- 0777, /* Home directory perms, modified by umask */
+ _DEF_DIRMODE, /* Home directory perms, modified by umask */
"/bin", /* Where shells are located */
system_shells, /* List of shells (first is default) */
bourne_shell, /* Default shell */
@@ -302,7 +302,7 @@ read_userconfig(char const * file)
case _UC_HOMEMODE:
modeset = setmode(q);
config.homemode = (q == NULL || !boolean_val(q, 1))
- ? 0777 : getmode(modeset, 0777);
+ ? _DEF_DIRMODE : getmode(modeset, _DEF_DIRMODE);
free(modeset);
break;
case _UC_SHELLPATH:
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 4c62fe8..db33746 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -41,16 +41,11 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
-#include <utmp.h>
#include <login_cap.h>
#include "pw.h"
#include "bitmap.h"
-#if (MAXLOGNAME-1) > UT_NAMESIZE
-#define LOGNAMESIZE UT_NAMESIZE
-#else
#define LOGNAMESIZE (MAXLOGNAME-1)
-#endif
static char locked_str[] = "*LOCKED*";
@@ -112,7 +107,6 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
struct stat st;
char line[_PASSWORD_LEN+1];
FILE *fp;
- mode_t dmode;
char *dmode_c;
void *set = NULL;
@@ -161,9 +155,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
if ((set = setmode(dmode_c)) == NULL)
errx(EX_DATAERR, "invalid directory creation mode '%s'",
dmode_c);
- dmode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO);
+ cnf->homemode = getmode(set, _DEF_DIRMODE);
free(set);
- cnf->homemode = dmode;
}
/*
@@ -191,7 +184,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
if (strchr(cnf->home+1, '/') == NULL) {
strcpy(dbuf, "/usr");
strncat(dbuf, cnf->home, MAXPATHLEN-5);
- if (mkdir(dbuf, cnf->homemode) != -1 || errno == EEXIST) {
+ if (mkdir(dbuf, _DEF_DIRMODE) != -1 || errno == EEXIST) {
chown(dbuf, 0, 0);
/*
* Skip first "/" and create symlink:
@@ -207,7 +200,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
while ((p = strchr(++p, '/')) != NULL) {
*p = '\0';
if (stat(dbuf, &st) == -1) {
- if (mkdir(dbuf, cnf->homemode) == -1)
+ if (mkdir(dbuf, _DEF_DIRMODE) == -1)
goto direrr;
chown(dbuf, 0, 0);
} else if (!S_ISDIR(st.st_mode))
@@ -216,7 +209,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
}
}
if (stat(dbuf, &st) == -1) {
- if (mkdir(dbuf, cnf->homemode) == -1) {
+ if (mkdir(dbuf, _DEF_DIRMODE) == -1) {
direrr: err(EX_OSFILE, "mkdir '%s'", dbuf);
}
chown(dbuf, 0, 0);