Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/user Pull up revisions 1.31 and 1.33 (requeste...
details: https://anonhg.NetBSD.org/src/rev/ad433efc4920
branches: netbsd-1-4
changeset: 471207:ad433efc4920
user: he <he%NetBSD.org@localhost>
date: Sat Nov 04 19:24:21 2000 +0000
description:
Pull up revisions 1.31 and 1.33 (requested by simonb):
Error out if instructed to create the home directory but it
already exists. Otherwise, recursively make files in new home
directory (i.e. newly copied skel files) writable by the owner.
diffstat:
usr.sbin/user/user.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (56 lines):
diff -r 20d3c438c9eb -r ad433efc4920 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c Sat Nov 04 18:49:23 2000 +0000
+++ b/usr.sbin/user/user.c Sat Nov 04 19:24:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.10.2.9 2000/11/04 18:43:11 he Exp $ */
+/* $NetBSD: user.c,v 1.10.2.10 2000/11/04 19:24:21 he Exp $ */
/*
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
@@ -35,7 +35,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1999 \
The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.10.2.9 2000/11/04 18:43:11 he Exp $");
+__RCSID("$NetBSD: user.c,v 1.10.2.10 2000/11/04 19:24:21 he Exp $");
#endif
#include <sys/types.h>
@@ -166,6 +166,7 @@
};
/* Full paths of programs used here */
+#define CHMOD "/bin/chmod"
#define CHOWN "/usr/sbin/chown"
#define MKDIR "/bin/mkdir"
#define MV "/bin/mv"
@@ -388,6 +389,7 @@
skeldir, PAX, (verbose) ? "-v" : "", dir);
}
(void) asystem("%s -R -h %d:%d %s", CHOWN, uid, gid, dir);
+ (void) asystem("%s -R u+w %s", CHMOD, dir);
return n;
}
@@ -964,12 +966,18 @@
err(EXIT_FAILURE, "can't add `%s'", buf);
}
if (up->u_flags & F_MKDIR) {
- if (lstat(home, &st) < 0 && asystem("%s -p %s", MKDIR, home) != 0) {
+ if (lstat(home, &st) == 0) {
(void) close(ptmpfd);
(void) pw_abort();
- err(EXIT_FAILURE, "can't mkdir `%s'", home);
+ errx(EXIT_FAILURE, "home directory `%s' already exists", home);
+ } else {
+ if (asystem("%s -p %s", MKDIR, home) != 0) {
+ (void) close(ptmpfd);
+ (void) pw_abort();
+ err(EXIT_FAILURE, "can't mkdir `%s'", home);
+ }
+ (void) copydotfiles(up->u_skeldir, up->u_uid, gid, home);
}
- (void) copydotfiles(up->u_skeldir, up->u_uid, gid, home);
}
if (strcmp(up->u_primgrp, "=uid") == 0 &&
getgrnam(login) == NULL &&
Home |
Main Index |
Thread Index |
Old Index