summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2002-05-07 17:22:54 +0000
committerAndrew G. Morgan <morgan@kernel.org>2002-05-07 17:22:54 +0000
commitc22d2db7c31aca9eb332022da3ad8a50387ce3db (patch)
tree6dac6f5390caa3900750fa54531c2f83a8e28bf4 /modules
parent61248874b27d3f004fff2ded43cae24e7f24da20 (diff)
Relevant BUGIDs: 547051, 547521
Purpose of commit: bugfixes Commit summary: --------------- Both of these fixes inspired by use with X based services. The first makes a TTY of the form hostname:0 work (if you specify a different separator with the module argument "fieldsep=". The second treats "" for a RHOST the same way it would treat a NULL value.
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_access/access.conf6
-rw-r--r--modules/pam_access/pam_access.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/modules/pam_access/access.conf b/modules/pam_access/access.conf
index 9ecf2ffd..dbaadf67 100644
--- a/modules/pam_access/access.conf
+++ b/modules/pam_access/access.conf
@@ -8,6 +8,12 @@
#
# Format of the login access control table is three fields separated by a
# ":" character:
+#
+# [Note, if you supply a 'fieldsep=|' argument to the pam_access.so
+# module, you can change the field separation character to be
+# '|'. This is useful for configurations where you are trying to use
+# pam_access with X applications that provide PAM_TTY values that are
+# the display variable like "host:0".]
#
# permission : users : origins
#
diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c
index 33bf767f..68a137ca 100644
--- a/modules/pam_access/pam_access.c
+++ b/modules/pam_access/pam_access.c
@@ -87,7 +87,7 @@ int strcasecmp(const char *s1, const char *s2);
/* Delimiters for fields and for lists of users, ttys or hosts. */
-static const char fs[] = ":"; /* field separator */
+static const char *fs = ":"; /* field separator */
static const char sep[] = ", \t"; /* list-element separator */
/* Constants to be used in assignments only, not in comparisons... */
@@ -126,7 +126,12 @@ static int parse_args(struct login_info *loginfo, int argc, const char **argv)
int i;
for (i=0; i<argc; ++i) {
- if (!strncmp("accessfile=", argv[i], 11)) {
+ if (!strncmp("fieldsep=", argv[i], 9)) {
+
+ /* the admin wants to override the default field separators */
+ fs = argv[i]+9;
+
+ } else if (!strncmp("accessfile=", argv[i], 11)) {
FILE *fp = fopen(11 + argv[i], "r");
if (fp) {
@@ -427,7 +432,7 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh,int flags,int argc
return PAM_ABORT;
}
- if (from==NULL) {
+ if ((from==NULL) || (*from=='\0')) {
/* local login, set tty name */