From 2d243af6b8ebe579f19ad27d3ab3907ebfe6a77e Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Wed, 9 Nov 2005 10:17:00 +0000 Subject: Relevant BUGIDs: 562730, 435990 Purpose of commit: bugfix Commit summary: --------------- * modules/pam_access/pam_access.c (pam_sm_acct_mgmt): Parse correctly full path tty name. * modules/pam_time/pam_time.c (pam_sm_acct_mgmt): Parse correctly full path tty name. Allow unset tty. (logic_member): Allow matching ':' in tty name. * modules/pam_group/pam_group.c (pam_sm_acct_mgmt): Parse correctly full path tty name. Allow unset tty. (logic_member): Allow matching ':' in tty name. * libpam_misc/misc_conv.c (read_string): Read only up to EOL if stdin is not terminal. --- modules/pam_group/pam_group.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'modules/pam_group/pam_group.c') diff --git a/modules/pam_group/pam_group.c b/modules/pam_group/pam_group.c index 4e6aa915..fbe609c7 100644 --- a/modules/pam_group/pam_group.c +++ b/modules/pam_group/pam_group.c @@ -250,7 +250,7 @@ static int logic_member(const char *string, int *at) default: if (isalpha(c) || c == '*' || isdigit(c) || c == '_' - || c == '-' || c == '.' || c == '/') { + || c == '-' || c == '.' || c == '/' || c == ':') { token = 1; } else if (token) { --to; @@ -809,8 +809,7 @@ pam_sm_setcred (pam_handle_t *pamh, int flags, D(("PAM_TTY not set, probing stdin")); tty = ttyname(STDIN_FILENO); if (tty == NULL) { - pam_syslog(pamh,LOG_ERR,"couldn't get the tty name"); - return PAM_ABORT; + tty = ""; } if (pam_set_item(pamh, PAM_TTY, tty) != PAM_SUCCESS) { pam_syslog(pamh,LOG_ERR,"couldn't set tty name"); @@ -820,8 +819,12 @@ pam_sm_setcred (pam_handle_t *pamh, int flags, else tty = (const char *) void_tty; - if (strncmp("/dev/",tty,5) == 0) { /* strip leading /dev/ */ - tty += 5; + if (tty[0] == '/') { /* full path */ + const char *t; + tty++; + if ((t = strchr(tty, '/')) != NULL) { + tty = t + 1; + } } /* good, now we have the service name, the user and the terminal name */ -- cgit v1.2.3