Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable via PAM #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tacacs-F4.0.4.28/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@
<host_decl> := host = <string> {
key = <string>
prompt = <string>
enable = aceclnt|cleartext|des|
enable = cleartext|des|
file <filename/string>|
#ifdef ACECLNT
aceclnt|
#endif
#ifdef HAVE_PAM
PAM |
#endif
nopassword|skey

}

<user_decl> := user = <string> {
Expand Down Expand Up @@ -1296,6 +1303,11 @@ parse_user(void)
user->enable = tac_strdup(sym_buf);
break;
#endif
#ifdef HAVE_PAM
case S_pam:
user->enable = tac_strdup(sym_buf);
break;
#endif

default:
parse_error("expecting 'file', 'cleartext', 'nopassword', "
Expand All @@ -1304,6 +1316,9 @@ parse_user(void)
#endif
#ifdef ACECLNT
"'aceclnt', "
#endif
#ifdef HAVE_PAM
"'PAM', "
#endif
"or 'des' keyword after 'enable =' on line %d",
sym_line);
Expand Down
12 changes: 12 additions & 0 deletions tacacs-F4.0.4.28/pwlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ verify_pwd(char *username, char *passwd, struct authen_data *data,
{
char *p;

#if HAVE_PAM
if (strcmp(cfg_passwd, "PAM") == 0) {
/* try to verify the password via PAM */
if (!pam_verify(username, passwd, data)) {
data->status = TAC_PLUS_AUTHEN_STATUS_FAIL;
return(0);
} else
data->status = TAC_PLUS_AUTHEN_STATUS_PASS;
return(data->status == TAC_PLUS_AUTHEN_STATUS_PASS);
}
#endif

/* Deal with the cfg_passwd depending on its type */
p = tac_find_substring("cleartext ", cfg_passwd);
if (p) {
Expand Down