|
Lines 199-208
Link Here
|
| 199 |
{ |
199 |
{ |
| 200 |
struct pam_ctxt *ctxt = ctxtp; |
200 |
struct pam_ctxt *ctxt = ctxtp; |
| 201 |
Buffer buffer; |
201 |
Buffer buffer; |
| 202 |
struct pam_conv sshpam_conv = { sshpam_thread_conv, ctxt }; |
202 |
struct pam_conv sshpam_conv; |
| 203 |
#ifndef USE_POSIX_THREADS |
203 |
#ifndef USE_POSIX_THREADS |
| 204 |
const char *pam_user; |
204 |
const char *pam_user; |
|
|
205 |
#endif |
| 206 |
|
| 207 |
sshpam_conv.conv = sshpam_thread_conv; |
| 208 |
sshpam_conv.appdata_ptr = ctxt; |
| 205 |
|
209 |
|
|
|
210 |
#ifndef USE_POSIX_THREADS |
| 206 |
pam_get_item(sshpam_handle, PAM_USER, (const void **)&pam_user); |
211 |
pam_get_item(sshpam_handle, PAM_USER, (const void **)&pam_user); |
| 207 |
setproctitle("%s [pam]", pam_user); |
212 |
setproctitle("%s [pam]", pam_user); |
| 208 |
#endif |
213 |
#endif |
|
Lines 531-555
Link Here
|
| 531 |
} |
536 |
} |
| 532 |
|
537 |
|
| 533 |
void |
538 |
void |
| 534 |
do_pam_session(const char *user, const char *tty) |
539 |
do_pam_session(const char *user) |
| 535 |
{ |
540 |
{ |
| 536 |
sshpam_err = pam_set_item(sshpam_handle, PAM_CONV, |
541 |
sshpam_err = pam_set_item(sshpam_handle, PAM_CONV, |
| 537 |
(const void *)&null_conv); |
542 |
(const void *)&null_conv); |
| 538 |
if (sshpam_err != PAM_SUCCESS) |
543 |
if (sshpam_err != PAM_SUCCESS) |
| 539 |
fatal("PAM: failed to set PAM_CONV: %s", |
544 |
fatal("PAM: failed to set PAM_CONV: %s", |
| 540 |
pam_strerror(sshpam_handle, sshpam_err)); |
545 |
pam_strerror(sshpam_handle, sshpam_err)); |
| 541 |
if (tty != NULL) { |
|
|
| 542 |
debug("PAM: setting PAM_TTY to \"%s\"", tty); |
| 543 |
sshpam_err = pam_set_item(sshpam_handle, PAM_TTY, tty); |
| 544 |
if (sshpam_err != PAM_SUCCESS) |
| 545 |
fatal("PAM: failed to set PAM_TTY: %s", |
| 546 |
pam_strerror(sshpam_handle, sshpam_err)); |
| 547 |
} |
| 548 |
sshpam_err = pam_open_session(sshpam_handle, 0); |
546 |
sshpam_err = pam_open_session(sshpam_handle, 0); |
| 549 |
if (sshpam_err != PAM_SUCCESS) |
547 |
if (sshpam_err != PAM_SUCCESS) |
| 550 |
fatal("PAM: pam_open_session(): %s", |
548 |
fatal("PAM: pam_open_session(): %s", |
| 551 |
pam_strerror(sshpam_handle, sshpam_err)); |
549 |
pam_strerror(sshpam_handle, sshpam_err)); |
| 552 |
sshpam_session_open = 1; |
550 |
sshpam_session_open = 1; |
|
|
551 |
} |
| 552 |
|
| 553 |
void |
| 554 |
do_pam_set_tty(const char *ttyname) { |
| 555 |
if (ttyname != NULL) { |
| 556 |
debug("PAM setting tty to \"%.200s\"", ttyname); |
| 557 |
sshpam_err = pam_set_item(sshpam_handle, PAM_TTY, ttyname); |
| 558 |
if (sshpam_err != PAM_SUCCESS) |
| 559 |
fatal("PAM set tty failed[%d]: %.200s", |
| 560 |
sshpam_err, pam_strerror(sshpam_handle, sshpam_err)); |
| 561 |
} |
| 553 |
} |
562 |
} |
| 554 |
|
563 |
|
| 555 |
void |
564 |
void |