|
Tomáš Mráz |
d63dc6 |
--- openssh-4.3p2/auth-pam.c.pam-session 2006-11-27 17:39:08.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
+++ openssh-4.3p2/auth-pam.c 2006-11-27 19:31:41.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
@@ -563,15 +563,17 @@
|
|
Tomáš Mráz |
d63dc6 |
void
|
|
Tomáš Mráz |
d63dc6 |
sshpam_cleanup(void)
|
|
Tomáš Mráz |
d63dc6 |
{
|
|
Tomáš Mráz |
d63dc6 |
- debug("PAM: cleanup");
|
|
Tomáš Mráz |
d63dc6 |
- if (sshpam_handle == NULL)
|
|
Tomáš Mráz |
d63dc6 |
+ if (sshpam_handle == NULL || (use_privsep && !mm_is_monitor()))
|
|
Tomáš Mráz |
d63dc6 |
return;
|
|
Tomáš Mráz |
d63dc6 |
+ debug("PAM: cleanup");
|
|
Tomáš Mráz |
d63dc6 |
pam_set_item(sshpam_handle, PAM_CONV, (const void *)&null_conv);
|
|
Tomáš Mráz |
d63dc6 |
if (sshpam_cred_established) {
|
|
Tomáš Mráz |
d63dc6 |
+ debug("PAM: deleting credentials");
|
|
Tomáš Mráz |
d63dc6 |
pam_setcred(sshpam_handle, PAM_DELETE_CRED);
|
|
Tomáš Mráz |
d63dc6 |
sshpam_cred_established = 0;
|
|
Tomáš Mráz |
d63dc6 |
}
|
|
Tomáš Mráz |
d63dc6 |
if (sshpam_session_open) {
|
|
Tomáš Mráz |
d63dc6 |
+ debug("PAM: closing session");
|
|
Tomáš Mráz |
d63dc6 |
pam_close_session(sshpam_handle, PAM_SILENT);
|
|
Tomáš Mráz |
d63dc6 |
sshpam_session_open = 0;
|
|
Tomáš Mráz |
d63dc6 |
}
|
|
Tomáš Mráz |
d63dc6 |
--- openssh-4.3p2/sshd.c.pam-session 2006-11-27 17:29:44.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
+++ openssh-4.3p2/sshd.c 2006-11-28 21:21:52.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
@@ -1745,7 +1745,21 @@
|
|
Tomáš Mráz |
d63dc6 |
audit_event(SSH_AUTH_SUCCESS);
|
|
Tomáš Mráz |
d63dc6 |
#endif
|
|
Tomáš Mráz |
d63dc6 |
|
|
Tomáš Mráz |
d63dc6 |
- /*
|
|
Tomáš Mráz |
d63dc6 |
+#ifdef GSSAPI
|
|
Tomáš Mráz |
d63dc6 |
+ if (options.gss_authentication) {
|
|
Tomáš Mráz |
d63dc6 |
+ temporarily_use_uid(authctxt->pw);
|
|
Tomáš Mráz |
d63dc6 |
+ ssh_gssapi_storecreds();
|
|
Tomáš Mráz |
d63dc6 |
+ restore_uid();
|
|
Tomáš Mráz |
d63dc6 |
+ }
|
|
Tomáš Mráz |
d63dc6 |
+#endif
|
|
Tomáš Mráz |
d63dc6 |
+#ifdef USE_PAM
|
|
Tomáš Mráz |
d63dc6 |
+ if (options.use_pam) {
|
|
Tomáš Mráz |
d63dc6 |
+ do_pam_setcred(1);
|
|
Tomáš Mráz |
d63dc6 |
+ do_pam_session();
|
|
Tomáš Mráz |
d63dc6 |
+ }
|
|
Tomáš Mráz |
d63dc6 |
+#endif
|
|
Tomáš Mráz |
d63dc6 |
+
|
|
Tomáš Mráz |
d63dc6 |
+ /*
|
|
Tomáš Mráz |
d63dc6 |
* In privilege separation, we fork another child and prepare
|
|
Tomáš Mráz |
d63dc6 |
* file descriptor passing.
|
|
Tomáš Mráz |
d63dc6 |
*/
|
|
Tomáš Mráz |
d63dc6 |
--- openssh-4.3p2/monitor.c.pam-session 2006-11-27 17:29:44.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
+++ openssh-4.3p2/monitor.c 2006-11-28 14:01:23.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
@@ -1539,6 +1539,11 @@
|
|
Tomáš Mráz |
d63dc6 |
/* The child is terminating */
|
|
Tomáš Mráz |
d63dc6 |
session_destroy_all(&mm_session_close);
|
|
Tomáš Mráz |
d63dc6 |
|
|
Tomáš Mráz |
d63dc6 |
+#ifdef USE_PAM
|
|
Tomáš Mráz |
d63dc6 |
+ if (options.use_pam)
|
|
Tomáš Mráz |
d63dc6 |
+ sshpam_cleanup();
|
|
Tomáš Mráz |
d63dc6 |
+#endif
|
|
Tomáš Mráz |
d63dc6 |
+
|
|
Tomáš Mráz |
d63dc6 |
while (waitpid(pmonitor->m_pid, &status, 0) == -1)
|
|
Tomáš Mráz |
d63dc6 |
if (errno != EINTR)
|
|
Tomáš Mráz |
d63dc6 |
exit(1);
|
|
Tomáš Mráz |
d63dc6 |
--- openssh-4.3p2/session.c.pam-session 2006-11-27 17:29:43.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
+++ openssh-4.3p2/session.c 2006-11-28 21:17:56.000000000 +0100
|
|
Tomáš Mráz |
d63dc6 |
@@ -395,11 +395,6 @@
|
|
Tomáš Mráz |
d63dc6 |
|
|
Tomáš Mráz |
d63dc6 |
session_proctitle(s);
|
|
Tomáš Mráz |
d63dc6 |
|
|
Tomáš Mráz |
d63dc6 |
-#if defined(USE_PAM)
|
|
Tomáš Mráz |
d63dc6 |
- if (options.use_pam && !use_privsep)
|
|
Tomáš Mráz |
d63dc6 |
- do_pam_setcred(1);
|
|
Tomáš Mráz |
d63dc6 |
-#endif /* USE_PAM */
|
|
Tomáš Mráz |
d63dc6 |
-
|
|
Tomáš Mráz |
d63dc6 |
/* Fork the child. */
|
|
Tomáš Mráz |
d63dc6 |
if ((pid = fork()) == 0) {
|
|
Tomáš Mráz |
d63dc6 |
is_child = 1;
|
|
Tomáš Mráz |
d63dc6 |
@@ -530,14 +525,6 @@
|
|
Tomáš Mráz |
d63dc6 |
ptyfd = s->ptyfd;
|
|
Tomáš Mráz |
d63dc6 |
ttyfd = s->ttyfd;
|
|
Tomáš Mráz |
d63dc6 |
|
|
Tomáš Mráz |
d63dc6 |
-#if defined(USE_PAM)
|
|
Tomáš Mráz |
d63dc6 |
- if (options.use_pam) {
|
|
Tomáš Mráz |
d63dc6 |
- do_pam_set_tty(s->tty);
|
|
Tomáš Mráz |
d63dc6 |
- if (!use_privsep)
|
|
Tomáš Mráz |
d63dc6 |
- do_pam_setcred(1);
|
|
Tomáš Mráz |
d63dc6 |
- }
|
|
Tomáš Mráz |
d63dc6 |
-#endif
|
|
Tomáš Mráz |
d63dc6 |
-
|
|
Tomáš Mráz |
d63dc6 |
/* Fork the child. */
|
|
Tomáš Mráz |
d63dc6 |
if ((pid = fork()) == 0) {
|
|
Tomáš Mráz |
d63dc6 |
is_child = 1;
|
|
Tomáš Mráz |
d63dc6 |
@@ -1266,16 +1253,8 @@
|
|
Tomáš Mráz |
d63dc6 |
# ifdef __bsdi__
|
|
Tomáš Mráz |
d63dc6 |
setpgid(0, 0);
|
|
Tomáš Mráz |
d63dc6 |
# endif
|
|
Tomáš Mráz |
d63dc6 |
-#ifdef GSSAPI
|
|
Tomáš Mráz |
d63dc6 |
- if (options.gss_authentication) {
|
|
Tomáš Mráz |
d63dc6 |
- temporarily_use_uid(pw);
|
|
Tomáš Mráz |
d63dc6 |
- ssh_gssapi_storecreds();
|
|
Tomáš Mráz |
d63dc6 |
- restore_uid();
|
|
Tomáš Mráz |
d63dc6 |
- }
|
|
Tomáš Mráz |
d63dc6 |
-#endif
|
|
Tomáš Mráz |
d63dc6 |
# ifdef USE_PAM
|
|
Tomáš Mráz |
d63dc6 |
if (options.use_pam) {
|
|
Tomáš Mráz |
d63dc6 |
- do_pam_session();
|
|
Tomáš Mráz |
d63dc6 |
do_pam_setcred(0);
|
|
Tomáš Mráz |
d63dc6 |
}
|
|
Tomáš Mráz |
d63dc6 |
# endif /* USE_PAM */
|
|
Tomáš Mráz |
d63dc6 |
@@ -1303,13 +1282,6 @@
|
|
Tomáš Mráz |
d63dc6 |
exit(1);
|
|
Tomáš Mráz |
d63dc6 |
}
|
|
Tomáš Mráz |
d63dc6 |
endgrent();
|
|
Tomáš Mráz |
d63dc6 |
-#ifdef GSSAPI
|
|
Tomáš Mráz |
d63dc6 |
- if (options.gss_authentication) {
|
|
Tomáš Mráz |
d63dc6 |
- temporarily_use_uid(pw);
|
|
Tomáš Mráz |
d63dc6 |
- ssh_gssapi_storecreds();
|
|
Tomáš Mráz |
d63dc6 |
- restore_uid();
|
|
Tomáš Mráz |
d63dc6 |
- }
|
|
Tomáš Mráz |
d63dc6 |
-#endif
|
|
Tomáš Mráz |
d63dc6 |
# ifdef USE_PAM
|
|
Tomáš Mráz |
d63dc6 |
/*
|
|
Tomáš Mráz |
d63dc6 |
* PAM credentials may take the form of supplementary groups.
|
|
Tomáš Mráz |
d63dc6 |
@@ -1317,7 +1289,6 @@
|
|
Tomáš Mráz |
d63dc6 |
* Reestablish them here.
|
|
Tomáš Mráz |
d63dc6 |
*/
|
|
Tomáš Mráz |
d63dc6 |
if (options.use_pam) {
|
|
Tomáš Mráz |
d63dc6 |
- do_pam_session();
|
|
Tomáš Mráz |
d63dc6 |
do_pam_setcred(0);
|
|
Tomáš Mráz |
d63dc6 |
}
|
|
Tomáš Mráz |
d63dc6 |
# endif /* USE_PAM */
|