|
Lines 115-120
pthread_join(sp_pthread_t thread, void *
Link Here
|
| 115 |
#endif |
115 |
#endif |
| 116 |
|
116 |
|
| 117 |
|
117 |
|
|
|
118 |
#ifdef PAM_SUN_CODEBASE |
| 119 |
# define sshpam_const |
| 120 |
#else |
| 121 |
# define sshpam_const const |
| 122 |
#endif |
| 123 |
|
| 118 |
static pam_handle_t *sshpam_handle = NULL; |
124 |
static pam_handle_t *sshpam_handle = NULL; |
| 119 |
static int sshpam_err = 0; |
125 |
static int sshpam_err = 0; |
| 120 |
static int sshpam_authenticated = 0; |
126 |
static int sshpam_authenticated = 0; |
|
Lines 204-210
import_environments(Buffer *b)
Link Here
|
| 204 |
* Conversation function for authentication thread. |
210 |
* Conversation function for authentication thread. |
| 205 |
*/ |
211 |
*/ |
| 206 |
static int |
212 |
static int |
| 207 |
sshpam_thread_conv(int n, const struct pam_message **msg, |
213 |
sshpam_thread_conv(int n, sshpam_const struct pam_message **msg, |
| 208 |
struct pam_response **resp, void *data) |
214 |
struct pam_response **resp, void *data) |
| 209 |
{ |
215 |
{ |
| 210 |
Buffer buffer; |
216 |
Buffer buffer; |
|
Lines 297-303
sshpam_thread(void *ctxtp)
Link Here
|
| 297 |
u_int i; |
303 |
u_int i; |
| 298 |
const char *pam_user; |
304 |
const char *pam_user; |
| 299 |
|
305 |
|
| 300 |
pam_get_item(sshpam_handle, PAM_USER, (const void **)&pam_user); |
306 |
pam_get_item(sshpam_handle, PAM_USER, (sshpam_const void **)&pam_user); |
| 301 |
setproctitle("%s [pam]", pam_user); |
307 |
setproctitle("%s [pam]", pam_user); |
| 302 |
environ[0] = NULL; |
308 |
environ[0] = NULL; |
| 303 |
#endif |
309 |
#endif |
|
Lines 381-387
sshpam_thread_cleanup(void)
Link Here
|
| 381 |
} |
387 |
} |
| 382 |
|
388 |
|
| 383 |
static int |
389 |
static int |
| 384 |
sshpam_null_conv(int n, const struct pam_message **msg, |
390 |
sshpam_null_conv(int n, sshpam_const struct pam_message **msg, |
| 385 |
struct pam_response **resp, void *data) |
391 |
struct pam_response **resp, void *data) |
| 386 |
{ |
392 |
{ |
| 387 |
return (PAM_CONV_ERR); |
393 |
return (PAM_CONV_ERR); |
|
Lines 395-401
sshpam_cleanup(void)
Link Here
|
| 395 |
debug("PAM: cleanup"); |
401 |
debug("PAM: cleanup"); |
| 396 |
if (sshpam_handle == NULL) |
402 |
if (sshpam_handle == NULL) |
| 397 |
return; |
403 |
return; |
| 398 |
pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv); |
404 |
pam_set_item(sshpam_handle, PAM_CONV, (sshpam_const void *)&null_conv); |
| 399 |
if (sshpam_cred_established) { |
405 |
if (sshpam_cred_established) { |
| 400 |
pam_setcred(sshpam_handle, PAM_DELETE_CRED); |
406 |
pam_setcred(sshpam_handle, PAM_DELETE_CRED); |
| 401 |
sshpam_cred_established = 0; |
407 |
sshpam_cred_established = 0; |
|
Lines 419-425
sshpam_init(const char *user)
Link Here
|
| 419 |
if (sshpam_handle != NULL) { |
425 |
if (sshpam_handle != NULL) { |
| 420 |
/* We already have a PAM context; check if the user matches */ |
426 |
/* We already have a PAM context; check if the user matches */ |
| 421 |
sshpam_err = pam_get_item(sshpam_handle, |
427 |
sshpam_err = pam_get_item(sshpam_handle, |
| 422 |
PAM_USER, (const void **)&pam_user); |
428 |
PAM_USER, (sshpam_const void **)&pam_user); |
| 423 |
if (sshpam_err == PAM_SUCCESS && strcmp(user, pam_user) == 0) |
429 |
if (sshpam_err == PAM_SUCCESS && strcmp(user, pam_user) == 0) |
| 424 |
return (0); |
430 |
return (0); |
| 425 |
pam_end(sshpam_handle, sshpam_err); |
431 |
pam_end(sshpam_handle, sshpam_err); |