Hi,
About a year ago I've sent a simple patch for authpf, which adds some
nice (as I think) feature to authpf. My patch was reviewed and extended
(and corrected) by couple of people, but since then did not get into
cvs. So now is my second try. I'd really like to get this kind of
functionality in authpf. And now the details:
- authpf can show a message to an user successfully logged in
- this message is read from /etc/authpf/authpf.message
- the message is the same for every user
- i'll want to change it ;-)
Patch (in the form proposed here on list last year) is below. This time
I've added adequate manpage changes.
--
Greetings
Rafal Bisingier
Index: authpf.8
===================================================================
RCS file: /cvs/src/usr.sbin/authpf/authpf.8,v
retrieving revision 1.47
diff -u -r1.47 authpf.8
--- authpf.8 6 Jan 2009 03:11:50 -0000 1.47
+++ authpf.8 6 Sep 2009 22:29:19 -0000
@@ -178,9 +178,13 @@
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
Index: authpf.c
===================================================================
RCS file: /cvs/src/usr.sbin/authpf/authpf.c,v
retrieving revision 1.112
diff -u -r1.112 authpf.c
--- authpf.c 10 Jan 2009 19:08:53 -0000 1.112
+++ authpf.c 6 Sep 2009 22:29:19 -0000
@@ -320,10 +320,20 @@
}
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", 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)