summaryrefslogtreecommitdiff
path: root/usr.sbin/authpf
diff options
context:
space:
mode:
authorTodd T. Fries <todd@cvs.openbsd.org>2010-01-27 15:36:18 +0000
committerTodd T. Fries <todd@cvs.openbsd.org>2010-01-27 15:36:18 +0000
commitddde5d013891dab89d5768f3f204ad9e1ca607ee (patch)
tree60957583560f3a9908899c5b55f1e10ae3294036 /usr.sbin/authpf
parent0e5bec497098e694d07eadb9f051f4cae7d87f2b (diff)
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)