Lines 19-25
Link Here
|
19 |
* |
19 |
* |
20 |
* /var/run/console/<username> is used for reference counting |
20 |
* /var/run/console/<username> is used for reference counting |
21 |
* and to make console authentication easy -- if it exists, then |
21 |
* and to make console authentication easy -- if it exists, then |
22 |
* <username> has console access. |
22 |
* <username> is logged on console. |
23 |
* |
23 |
* |
24 |
* A system startup script should remove /var/run/console/console.lock |
24 |
* A system startup script should remove /var/run/console/console.lock |
25 |
* and everything in /var/run/console/ |
25 |
* and everything in /var/run/console/ |
Lines 560-566
Link Here
|
560 |
*/ |
560 |
*/ |
561 |
int fd; |
561 |
int fd; |
562 |
int count = 0; |
562 |
int count = 0; |
563 |
int err; |
563 |
int err = PAM_SUCCESS; |
564 |
int delete_consolelock = 0; |
564 |
int delete_consolelock = 0; |
565 |
const char *username = NULL, *user_prompt; |
565 |
const char *username = NULL, *user_prompt; |
566 |
char *lockfile = NULL; |
566 |
char *lockfile = NULL; |
Lines 605-611
Link Here
|
605 |
_pam_log(pamh, LOG_ERR, FALSE, |
605 |
_pam_log(pamh, LOG_ERR, FALSE, |
606 |
"\"impossible\" fstat error on %s", consolelock); |
606 |
"\"impossible\" fstat error on %s", consolelock); |
607 |
close(fd); |
607 |
close(fd); |
608 |
err = PAM_SESSION_ERR; goto return_error; |
608 |
err = PAM_SESSION_ERR; |
|
|
609 |
goto decrement; |
609 |
} |
610 |
} |
610 |
consoleuser = _do_malloc(st.st_size+1); |
611 |
consoleuser = _do_malloc(st.st_size+1); |
611 |
if (st.st_size) { |
612 |
if (st.st_size) { |
Lines 614-620
Link Here
|
614 |
"\"impossible\" read error on %s", consolelock); |
615 |
"\"impossible\" read error on %s", consolelock); |
615 |
err = PAM_SESSION_ERR; |
616 |
err = PAM_SESSION_ERR; |
616 |
close(fd); |
617 |
close(fd); |
617 |
goto return_error; |
618 |
goto decrement; |
618 |
} |
619 |
} |
619 |
consoleuser[st.st_size] = '\0'; |
620 |
consoleuser[st.st_size] = '\0'; |
620 |
} |
621 |
} |
Lines 627-649
Link Here
|
627 |
*/ |
628 |
*/ |
628 |
console_run_handlers(pamh, FALSE, username, tty); |
629 |
console_run_handlers(pamh, FALSE, username, tty); |
629 |
} |
630 |
} |
630 |
} else { |
|
|
631 |
/* didn't open file */ |
632 |
err = PAM_SESSION_ERR; |
633 |
goto return_error; |
634 |
} |
631 |
} |
635 |
} |
632 |
} |
636 |
|
633 |
|
|
|
634 |
decrement: |
637 |
count = use_count(pamh, lockfile, -1, 1); |
635 |
count = use_count(pamh, lockfile, -1, 1); |
638 |
if (count < 1 && delete_consolelock) { |
636 |
if (count < 1 && delete_consolelock) { |
639 |
if (unlink(consolelock)) { |
637 |
if (unlink(consolelock)) { |
640 |
_pam_log(pamh, LOG_ERR, FALSE, |
638 |
_pam_log(pamh, LOG_ERR, FALSE, |
641 |
"\"impossible\" unlink error on %s", consolelock); |
639 |
"\"impossible\" unlink error on %s", consolelock); |
642 |
err = PAM_SESSION_ERR; goto return_error; |
640 |
err = PAM_SESSION_ERR; |
643 |
} |
641 |
} |
644 |
} |
642 |
} |
645 |
|
643 |
|
646 |
err = PAM_SUCCESS; |
|
|
647 |
return_error: |
644 |
return_error: |
648 |
if (lockfile) free(lockfile); |
645 |
if (lockfile) free(lockfile); |
649 |
if (consoleuser) free (consoleuser); |
646 |
if (consoleuser) free (consoleuser); |