summaryrefslogtreecommitdiffstats
path: root/usr.sbin/authpf
diff options
context:
space:
mode:
authortodd <todd@openbsd.org>2010-01-27 15:36:17 +0000
committertodd <todd@openbsd.org>2010-01-27 15:36:17 +0000
commit33c3bf743f12c8e5dfce3e2f60c9d32f49ea8a46 (patch)
tree4cb9aa6bf45d1875e54e37be288d594b0958ddf1 /usr.sbin/authpf
parentuse arc4random() instead of random() (diff)
downloadwireguard-openbsd-33c3bf743f12c8e5dfce3e2f60c9d32f49ea8a46.tar.xz
wireguard-openbsd-33c3bf743f12c8e5dfce3e2f60c9d32f49ea8a46.zip
search for authpf.message in $USER dirs also
from Rafal Bisingier ravbc at man dot pozman dot pl, ok beck@
Diffstat (limited to 'usr.sbin/authpf')
-rw-r--r--usr.sbin/authpf/authpf.814
-rw-r--r--usr.sbin/authpf/authpf.c14
2 files changed, 21 insertions, 7 deletions
diff --git a/usr.sbin/authpf/authpf.8 b/usr.sbin/authpf/authpf.8
index efba06a17ac..258279d4ea1 100644
--- a/usr.sbin/authpf/authpf.8
+++ b/usr.sbin/authpf/authpf.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: authpf.8,v 1.50 2009/10/26 22:06:13 sthen Exp $
+.\" $OpenBSD: authpf.8,v 1.51 2010/01/27 15:36:17 todd Exp $
.\"
.\" Copyright (c) 1998-2007 Bob Beck (beck@openbsd.org>. All rights reserved.
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 26 2009 $
+.Dd $Mdocdate: January 27 2010 $
.Dt AUTHPF 8
.Os
.Sh NAME
@@ -174,9 +174,13 @@ name instead of "authpf_users".
On successful invocation,
.Nm
displays a message telling the user he or she has been authenticated.
-It will additionally display the contents of the file
-.Pa /etc/authpf/authpf.message
-if the file exists and is readable.
+It will additionally display the contents of the file called
+.Pa authpf.message .
+This file will first be searched for in
+.Pa /etc/authpf/users/$USER/
+and then in
+.Pa /etc/authpf/ .
+Only first of these files will be used if both are present.
.Pp
There exist two methods for providing additional granularity to the control
offered by
diff --git a/usr.sbin/authpf/authpf.c b/usr.sbin/authpf/authpf.c
index a549221152a..2d9792eb3ac 100644
--- a/usr.sbin/authpf/authpf.c
+++ b/usr.sbin/authpf/authpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authpf.c,v 1.113 2009/11/23 00:47:56 claudio Exp $ */
+/* $OpenBSD: authpf.c,v 1.114 2010/01/27 15:36:17 todd Exp $ */
/*
* Copyright (C) 1998 - 2007 Bob Beck (beck@openbsd.org).
@@ -320,10 +320,20 @@ main(int argc, char *argv[])
}
while (1) {
+ struct stat sb;
+ char *path_message;
printf("\r\nHello %s. ", luser);
printf("You are authenticated from host \"%s\"\r\n", ipsrc);
setproctitle("%s@%s", luser, ipsrc);
- print_message(PATH_MESSAGE);
+ if (asprintf(&path_message, "%s/%s/authpf.message",
+ PATH_USER_DIR, luser) == -1)
+ do_death(1);
+ if (stat(path_message, &sb) == -1 || ! S_ISREG(sb.st_mode)) {
+ free(path_message);
+ if ((path_message = strdup(PATH_MESSAGE)) == NULL)
+ do_death(1);
+ }
+ print_message(path_message);
while (1) {
sleep(10);
if (want_death)