From f833a0b4e1a755276f3cdc4efa121104286d1ef6 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Mon, 13 Feb 2006 07:45:17 +0000 Subject: Relevant BUGIDs: Purpose of commit: new feature Commit summary: --------------- Convert manual page to xml and add missing sections. 2006-02-13 Thorsten Kukuk * modules/pam_echo/pam_echo.8.xml: New. * modules/pam_echo/pam_echo.8: Regenerated from xml file. * modules/pam_echo/Makefile.am: Include Make.xml.rules. * modules/pam_echo/pam_echo.c: Fix return value. --- modules/pam_echo/Makefile.am | 13 +++- modules/pam_echo/README | 50 ++++++++++++ modules/pam_echo/README.xml | 36 +++++++++ modules/pam_echo/pam_echo.8 | 94 ++++++++++++++-------- modules/pam_echo/pam_echo.8.xml | 168 ++++++++++++++++++++++++++++++++++++++++ modules/pam_echo/pam_echo.c | 17 ++-- 6 files changed, 337 insertions(+), 41 deletions(-) create mode 100644 modules/pam_echo/README create mode 100644 modules/pam_echo/README.xml create mode 100644 modules/pam_echo/pam_echo.8.xml (limited to 'modules/pam_echo') diff --git a/modules/pam_echo/Makefile.am b/modules/pam_echo/Makefile.am index 03818d37..0bd3f2b4 100644 --- a/modules/pam_echo/Makefile.am +++ b/modules/pam_echo/Makefile.am @@ -1,13 +1,15 @@ # -# Copyright (c) 2005 Thorsten Kukuk +# Copyright (c) 2005, 2006 Thorsten Kukuk # CLEANFILES = *~ -EXTRA_DIST = $(MANS) +EXTRA_DIST = README $(MANS) $(XMLS) man_MANS = pam_echo.8 +XMLS = README.xml pam_echo.8.xml + securelibdir = $(SECUREDIR) secureconfdir = $(SCONFIGDIR) @@ -19,3 +21,10 @@ if HAVE_VERSIONING endif securelib_LTLIBRARIES = pam_echo.la + + +if ENABLE_REGENERATE_MAN +noinst_DATA = README +README: pam_echo.8.xml +-include $(top_srcdir)/Make.xml.rules +endif diff --git a/modules/pam_echo/README b/modules/pam_echo/README new file mode 100644 index 00000000..103e0b03 --- /dev/null +++ b/modules/pam_echo/README @@ -0,0 +1,50 @@ +pam_echo — PAM module for printing text messages + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +DESCRIPTION + +The pam_echo PAM module is for printing text messages to inform user about +special things. Sequences starting with the % character are interpreted in the +following way: + +%H + + The name of the remote host (PAM_RHOST). + +%h + + The name of the local host. + +%s + + The service name (PAM_SERVICE). + +%t + + The name of the controlling terminal (PAM_TTY). + +%U + + The remote user name (PAM_RUSER). + +%u + + The local user name (PAM_USER). + +All other sequences beginning with % expands to the characters following the % +character. + +EXAMPLES + +For an example of the use of this module, we show how it may be used to print +informations about good passwords: + +password optional pam_echo.so file=/usr/share/doc/good-password.txt +password required pam_unix.so + + +AUTHOR + +Thorsten Kukuk + diff --git a/modules/pam_echo/README.xml b/modules/pam_echo/README.xml new file mode 100644 index 00000000..b1556e38 --- /dev/null +++ b/modules/pam_echo/README.xml @@ -0,0 +1,36 @@ + + +--> +]> + +
+ + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="pam_echo.8.xml" xpointer='xpointer(//refnamediv[@id = "pam_echo-name"]/*)'/> + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
diff --git a/modules/pam_echo/pam_echo.8 b/modules/pam_echo/pam_echo.8 index 6834ae01..dd19e950 100644 --- a/modules/pam_echo/pam_echo.8 +++ b/modules/pam_echo/pam_echo.8 @@ -1,52 +1,82 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2005 Thorsten Kukuk kukuk@suse.de -.\" -.TH pam_echo 8 "September 2005" "pam_echo" "Reference Manual" -.SH NAME -pam_echo - PAM module for printing text messages -.SH DESCRIPTION +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "PAM_ECHO" "8" "02/13/2006" "Linux\-PAM Manual" "Linux\-PAM Manual" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +pam_echo \- PAM module for printing text messages +.SH "SYNOPSIS" +.HP 12 +\fBpam_echo.so\fR [file=\fI/path/message\fR] +.SH "DESCRIPTION" +.PP The -.B pam_echo -PAM module is for printing text messages to inform user about -special things. Sequences starting with the -.B % +\fIpam_echo\fR +PAM module is for printing text messages to inform user about special things. Sequences starting with the +\fI%\fR character are interpreted in the following way: .TP -.B %H +\fI%H\fR The name of the remote host (PAM_RHOST). .TP -.B %h +\fI%h\fR The name of the local host. .TP -.B %s +\fI%s\fR The service name (PAM_SERVICE). .TP -.B %t +\fI%t\fR The name of the controlling terminal (PAM_TTY). .TP -.B %U +\fI%U\fR The remote user name (PAM_RUSER). .TP -.B %u +\fI%u\fR The local user name (PAM_USER). .PP All other sequences beginning with -.B % +\fI%\fR expands to the characters following the -.B % +\fI%\fR character. -.SH OPTIONS -The following options may be passed to all types of management -groups: -.TP -.BR "file=" "message" -.B pam_echo -will print the content of the file -.B message -with the PAM conversion function as PAM_TEXT_INFO. +.SH "OPTIONS" +.TP +\fBfile=\fR\fB\fI/path/message\fR\fR +The content of the file +\fI/path/message\fR +will be printed with the PAM conversion function as PAM_TEXT_INFO. +.SH "MODULE SERVICES PROVIDED" +.PP +All services are supported. +.SH "RETURN VALUES" +.TP +PAM_BUF_ERR +Memory buffer error. +.TP +PAM_SUCCESS +Message was successful printed. +.TP +PAM_IGNORE +PAM_SILENT flag was given or message file does not exist, no message printed. +.SH "EXAMPLES" +.PP +For an example of the use of this module, we show how it may be used to print informations about good passwords: +.sp +.nf +password optional pam_echo.so file=/usr/share/doc/good\-password.txt +password required pam_unix.so + +.fi +.sp .SH "SEE ALSO" -.BR pam.conf (8), -.BR pam.d (8), -.BR pam (8) -.SH AUTHOR +.PP +\fBpam.conf\fR(8), +\fBpam.d\fR(8), +\fBpam\fR(8) +.SH "AUTHOR" +.PP Thorsten Kukuk diff --git a/modules/pam_echo/pam_echo.8.xml b/modules/pam_echo/pam_echo.8.xml new file mode 100644 index 00000000..3619dd34 --- /dev/null +++ b/modules/pam_echo/pam_echo.8.xml @@ -0,0 +1,168 @@ + + + + + + pam_echo + 8 + Linux-PAM Manual + + + + pam_echo + PAM module for printing text messages + + + + + + + pam_echo.so + + file=/path/message + + + + + + DESCRIPTION + + The pam_echo PAM module is for printing + text messages to inform user about special things. Sequences + starting with the % character are + interpreted in the following way: + + + + %H + + The name of the remote host (PAM_RHOST). + + + + %h + + The name of the local host. + + + + %s + + The service name (PAM_SERVICE). + + + + %t + + The name of the controlling terminal (PAM_TTY). + + + + %U + + The remote user name (PAM_RUSER). + + + + %u + + The local user name (PAM_USER). + + + + + + All other sequences beginning with % + expands to the characters following the % + character. + + + + + OPTIONS + + + + + + + + The content of the file /path/message + will be printed with the PAM conversion function as PAM_TEXT_INFO. + + + + + + + + MODULE SERVICES PROVIDED + + All services are supported. + + + + + + RETURN VALUES + + + PAM_BUF_ERR + + + Memory buffer error. + + + + + PAM_SUCCESS + + + Message was successful printed. + + + + + PAM_IGNORE + + + PAM_SILENT flag was given or message file does not + exist, no message printed. + + + + + + + + EXAMPLES + + For an example of the use of this module, we show how it may be + used to print informations about good passwords: + +password optional pam_echo.so file=/usr/share/doc/good-password.txt +password required pam_unix.so + + + + + + SEE ALSO + + + pam.conf8 + , + + pam.d8 + , + + pam8 + + + + + AUTHOR + Thorsten Kukuk <kukuk@suse.de> + + diff --git a/modules/pam_echo/pam_echo.c b/modules/pam_echo/pam_echo.c index aa5d9285..e138c3df 100644 --- a/modules/pam_echo/pam_echo.c +++ b/modules/pam_echo/pam_echo.c @@ -76,7 +76,7 @@ replace_and_print (pam_handle_t *pamh, const char *mesg) if (output == NULL) { pam_syslog (pamh, LOG_ERR, "running out of memory"); - return PAM_IGNORE; + return PAM_BUF_ERR; } for (p = mesg, len = 0; *p != '\0' && len < length - 1; ++p) @@ -139,6 +139,7 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv) int orig_argc = argc; const char **orig_argv = argv; const char *file = NULL; + int retval; if (flags & PAM_SILENT) return PAM_IGNORE; @@ -166,7 +167,7 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv) } msg[len] = '\0'; - replace_and_print (pamh, msg); + retval = replace_and_print (pamh, msg); } else if ((fd = open (file, O_RDONLY, 0)) >= 0) { @@ -179,7 +180,7 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv) mtmp = malloc (st.st_size + 1); if (!mtmp) - return PAM_IGNORE; + return PAM_BUF_ERR; if (read (fd, mtmp, st.st_size) == -1) { @@ -194,13 +195,15 @@ pam_echo (pam_handle_t *pamh, int flags, int argc, const char **argv) mtmp[st.st_size] = '\0'; close (fd); - replace_and_print (pamh, mtmp); + retval = replace_and_print (pamh, mtmp); free (mtmp); } else - pam_syslog (pamh, LOG_ERR, "Cannot open %s: %m", file); - - return PAM_IGNORE; + { + pam_syslog (pamh, LOG_ERR, "Cannot open %s: %m", file); + retval = PAM_IGNORE; + } + return retval; } int -- cgit v1.2.3