Bugzilla – Attachment 821 Details for
Bug 980
sshd does not write the session leader pid to utmp when priv-separation is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
pass session pid to monitor for login recording, record session logout too
openssh-session-pid.patch (text/plain), 4.24 KB, created by
Darren Tucker
on 2005-02-12 20:57:48 AEDT
(
hide
)
Description:
pass session pid to monitor for login recording, record session logout too
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2005-02-12 20:57:48 AEDT
Size:
4.24 KB
patch
obsolete
>Index: monitor.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/monitor.c,v >retrieving revision 1.81 >diff -u -p -r1.81 monitor.c >--- monitor.c 8 Feb 2005 22:52:17 -0000 1.81 >+++ monitor.c 12 Feb 2005 09:54:10 -0000 >@@ -1230,26 +1230,29 @@ mm_session_close(Session *s) > debug3("%s: tty %s ptyfd %d", __func__, s->tty, s->ptyfd); > session_pty_cleanup2(s); > } >+ record_logout(s->pid, s->tty, s->authctxt->pw->pw_name); > s->used = 0; > } > > int > mm_answer_pty(int sock, Buffer *m) > { >- extern struct monitor *pmonitor; > Session *s; > int res, fd0; >+ pid_t pid; > > debug3("%s entering", __func__); > >+ pid = (pid_t)buffer_get_int(m); > buffer_clear(m); > s = session_new(); > if (s == NULL) > goto error; > s->authctxt = authctxt; > s->pw = authctxt->pw; >- s->pid = pmonitor->m_pid; >- res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); >+ s->pid = pid; >+ res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty), >+ s->pid); > if (res == 0) > goto error; > pty_setowner(authctxt->pw, s->tty); >Index: monitor_wrap.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/monitor_wrap.c,v >retrieving revision 1.51 >diff -u -p -r1.51 monitor_wrap.c >--- monitor_wrap.c 8 Feb 2005 10:52:48 -0000 1.51 >+++ monitor_wrap.c 12 Feb 2005 09:43:53 -0000 >@@ -641,13 +641,14 @@ mm_send_keystate(struct monitor *monitor > } > > int >-mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) >+mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen, pid_t pid) > { > Buffer m; > char *p, *msg; > int success = 0; > > buffer_init(&m); >+ buffer_put_int(&m, (int)pid); > mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m); > > debug3("%s: waiting for MONITOR_ANS_PTY", __func__); >Index: monitor_wrap.h >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/monitor_wrap.h,v >retrieving revision 1.21 >diff -u -p -r1.21 monitor_wrap.h >--- monitor_wrap.h 8 Feb 2005 10:52:48 -0000 1.21 >+++ monitor_wrap.h 12 Feb 2005 09:43:53 -0000 >@@ -82,7 +82,7 @@ void mm_audit_run_command(const char *); > > struct Session; > void mm_terminate(void); >-int mm_pty_allocate(int *, int *, char *, int); >+int mm_pty_allocate(int *, int *, char *, int, pid_t); > void mm_session_pty_cleanup2(struct Session *); > > /* SSHv1 interfaces */ >Index: session.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/session.c,v >retrieving revision 1.295 >diff -u -p -r1.295 session.c >--- session.c 9 Feb 2005 11:17:28 -0000 1.295 >+++ session.c 12 Feb 2005 09:43:53 -0000 >@@ -1759,7 +1759,8 @@ session_pty_req(Session *s) > > /* Allocate a pty and open it. */ > debug("Allocating pty."); >- if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)))) { >+ if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty), >+ s->pid))) { > if (s->term) > xfree(s->term); > s->term = NULL; >Index: sshpty.c >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/sshpty.c,v >retrieving revision 1.25 >diff -u -p -r1.25 sshpty.c >--- sshpty.c 22 Jun 2004 02:56:02 -0000 1.25 >+++ sshpty.c 12 Feb 2005 09:43:53 -0000 >@@ -38,7 +38,7 @@ RCSID("$OpenBSD: sshpty.c,v 1.12 2004/06 > */ > > int >-pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) >+pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen, pid_t pid) > { > /* openpty(3) exists in OSF/1 and some other os'es */ > char *name; >Index: sshpty.h >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/sshpty.h,v >retrieving revision 1.7 >diff -u -p -r1.7 sshpty.h >--- sshpty.h 13 May 2004 06:06:47 -0000 1.7 >+++ sshpty.h 12 Feb 2005 09:43:53 -0000 >@@ -21,7 +21,7 @@ struct termios get_saved_tio(void); > void leave_raw_mode(void); > void enter_raw_mode(void); > >-int pty_allocate(int *, int *, char *, int); >+int pty_allocate(int *, int *, char *, int, pid_t); > void pty_release(const char *); > void pty_make_controlling_tty(int *, const char *); > void pty_change_window_size(int, int, int, int, int);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 980
:
802
| 821 |
916