Changeset View
Changeset View
Standalone View
Standalone View
pam_kwallet.c
Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Line(s) | 390 | if (drop_privileges(userInfo) < 0) { | |||
---|---|---|---|---|---|
392 | goto cleanup; | 392 | goto cleanup; | ||
393 | } | 393 | } | ||
394 | 394 | | |||
395 | int envSocket; | 395 | int envSocket; | ||
396 | if ((envSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { | 396 | if ((envSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { | ||
397 | pam_syslog(pamh, LOG_ERR, "%s: couldn't create socket", logPrefix); | 397 | pam_syslog(pamh, LOG_ERR, "%s: couldn't create socket", logPrefix); | ||
398 | return; | 398 | return; | ||
399 | } | 399 | } | ||
400 | //Avoid giving an "stderr" to kwallet | ||||
401 | if (envSocket == 2) { | ||||
402 | envSocket = dup(envSocket); | ||||
403 | close(2); | ||||
404 | } | ||||
400 | 405 | | |||
401 | struct sockaddr_un local; | 406 | struct sockaddr_un local; | ||
402 | local.sun_family = AF_UNIX; | 407 | local.sun_family = AF_UNIX; | ||
403 | 408 | | |||
404 | if (strlen(fullSocket) > sizeof(local.sun_path)) { | 409 | if (strlen(fullSocket) > sizeof(local.sun_path)) { | ||
405 | pam_syslog(pamh, LOG_ERR, "%s: socket path %s too long to open", | 410 | pam_syslog(pamh, LOG_ERR, "%s: socket path %s too long to open", | ||
406 | logPrefix, fullSocket); | 411 | logPrefix, fullSocket); | ||
407 | free(fullSocket); | 412 | free(fullSocket); | ||
▲ Show 20 Lines • Show All 356 Lines • Show Last 20 Lines |