diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-27 20:23:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-27 20:23:03 +0000 |
commit | 920e86330ff2b4b6c3009b8562a9adb0f97c82b1 (patch) | |
tree | 97c4f9852b22b23232fd01e543701775b543ad6f /libexec | |
parent | 342137cefa23d0261c0e217185312d84c858123b (diff) |
superuser may now specify another user's spool to lock.
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/lockspool/lockspool.1 | 4 | ||||
-rw-r--r-- | libexec/lockspool/lockspool.c | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/libexec/lockspool/lockspool.1 b/libexec/lockspool/lockspool.1 index 0eae385e36d..240590e716c 100644 --- a/libexec/lockspool/lockspool.1 +++ b/libexec/lockspool/lockspool.1 @@ -32,6 +32,7 @@ .Nd lock user's system mailbox .Sh SYNOPSIS .Nm lockspool +.Op Ar username .Sh DESCRIPTION .Nm Lockspool is useful for a client mail program to attain proper locking. @@ -39,7 +40,8 @@ is useful for a client mail program to attain proper locking. obtains a .Nm username.lock for the calling user and retains it until stdin is closed or a signal -like SIGINT, SIGTERM, or SIGHUP is received. +like SIGINT, SIGTERM, or SIGHUP is received. Additionally, the superuser +may specify the name of a user in order to lock a different mailbox. .Pp If .Nm lockspool diff --git a/libexec/lockspool/lockspool.c b/libexec/lockspool/lockspool.c index 888971ca2f2..a6be3cef9e6 100644 --- a/libexec/lockspool/lockspool.c +++ b/libexec/lockspool/lockspool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lockspool.c,v 1.1 1998/08/15 21:02:23 millert Exp $ */ +/* $OpenBSD: lockspool.c,v 1.2 1998/09/27 20:23:02 millert Exp $ */ /* * Copyright (c) 1998 Theo de Raadt <deraadt@theos.com> @@ -29,7 +29,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: lockspool.c,v 1.1 1998/08/15 21:02:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: lockspool.c,v 1.2 1998/09/27 20:23:02 millert Exp $"; #endif /* not lint */ #include <sys/signal.h> @@ -56,14 +56,20 @@ main(argc, argv) openlog(__progname, LOG_PERROR, LOG_MAIL); - if (argc != 1) + if (argc != 1 && argc != 2) usage(); + if (argc == 2 && getuid() != 0) + err(1, "you must be root to lock someone else's spool"); signal(SIGTERM, unhold); signal(SIGINT, unhold); signal(SIGHUP, unhold); - from = getlogin(); + if (argc == 2) + from = argv[1]; + else + from = getlogin(); + if (from) { pw = getpwnam(from); if (pw == NULL) @@ -102,5 +108,5 @@ void usage() { - err(FATAL, "usage: %s", __progname); + err(FATAL, "usage: %s [username]", __progname); } |