|
Lines 127-132
Link Here
|
| 127 |
int mm_answer_sesskey(int, Buffer *); |
127 |
int mm_answer_sesskey(int, Buffer *); |
| 128 |
int mm_answer_sessid(int, Buffer *); |
128 |
int mm_answer_sessid(int, Buffer *); |
|
|
129 |
int mm_answer_writelogin(int, Buffer *); |
| 130 |
int mm_answer_record_logout(int, Buffer *); |
| 131 |
|
| 129 |
#ifdef USE_PAM |
132 |
#ifdef USE_PAM |
| 130 |
int mm_answer_pam_start(int, Buffer *); |
133 |
int mm_answer_pam_start(int, Buffer *); |
| 131 |
int mm_answer_pam_account(int, Buffer *); |
134 |
int mm_answer_pam_account(int, Buffer *); |
|
Lines 219-224
Link Here
|
| 219 |
{MONITOR_REQ_PTY, 0, mm_answer_pty}, |
222 |
{MONITOR_REQ_PTY, 0, mm_answer_pty}, |
| 220 |
{MONITOR_REQ_PTYCLEANUP, 0, mm_answer_pty_cleanup}, |
223 |
{MONITOR_REQ_PTYCLEANUP, 0, mm_answer_pty_cleanup}, |
| 221 |
{MONITOR_REQ_TERM, 0, mm_answer_term}, |
224 |
{MONITOR_REQ_TERM, 0, mm_answer_term}, |
|
|
225 |
{MONITOR_REQ_WRITELOGIN, 0, mm_answer_writelogin}, |
| 226 |
{MONITOR_REQ_LOGOUT, 0, mm_answer_record_logout}, |
| 222 |
#ifdef SSH_AUDIT_EVENTS |
227 |
#ifdef SSH_AUDIT_EVENTS |
| 223 |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
228 |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
| 224 |
{MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, |
229 |
{MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, |
|
Lines 261-266
Link Here
|
| 261 |
{MONITOR_REQ_PTY, MON_ONCE, mm_answer_pty}, |
266 |
{MONITOR_REQ_PTY, MON_ONCE, mm_answer_pty}, |
| 262 |
{MONITOR_REQ_PTYCLEANUP, MON_ONCE, mm_answer_pty_cleanup}, |
267 |
{MONITOR_REQ_PTYCLEANUP, MON_ONCE, mm_answer_pty_cleanup}, |
| 263 |
{MONITOR_REQ_TERM, 0, mm_answer_term}, |
268 |
{MONITOR_REQ_TERM, 0, mm_answer_term}, |
|
|
269 |
{MONITOR_REQ_WRITELOGIN, 0, mm_answer_writelogin}, |
| 270 |
{MONITOR_REQ_LOGOUT, 0, mm_answer_record_logout}, |
| 264 |
#ifdef SSH_AUDIT_EVENTS |
271 |
#ifdef SSH_AUDIT_EVENTS |
| 265 |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
272 |
{MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
| 266 |
{MONITOR_REQ_AUDIT_COMMAND, MON_ONCE, mm_answer_audit_command}, |
273 |
{MONITOR_REQ_AUDIT_COMMAND, MON_ONCE, mm_answer_audit_command}, |
|
Lines 396-401
Link Here
|
| 396 |
if (!no_pty_flag) { |
403 |
if (!no_pty_flag) { |
| 397 |
monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); |
404 |
monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); |
| 398 |
monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); |
405 |
monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); |
|
|
406 |
monitor_permit(mon_dispatch, MONITOR_REQ_WRITELOGIN, 1); |
| 407 |
monitor_permit(mon_dispatch, MONITOR_REQ_LOGOUT, 1); |
| 399 |
} |
408 |
} |
| 400 |
for (;;) |
409 |
for (;;) |
|
Lines 1216-1225
Link Here
|
| 1216 |
cleanup_exit(255); |
1225 |
cleanup_exit(255); |
| 1217 |
} |
1226 |
} |
| 1218 |
} |
1227 |
} |
| 1219 |
/* Record that there was a login on that tty from the remote host. */ |
1228 |
store_lastlog_message(pw->pw_name, pw->pw_uid); |
| 1220 |
record_login(s->pid, s->tty, pw->pw_name, pw->pw_uid, |
|
|
| 1221 |
get_remote_name_or_ip(utmp_len, options.use_dns), |
| 1222 |
(struct sockaddr *)&from, fromlen); |
| 1223 |
} |
1229 |
} |
| 1224 |
static void |
1230 |
static void |
|
Lines 1916-1918
Link Here
|
| 1916 |
return (authenticated); |
1922 |
return (authenticated); |
| 1917 |
} |
1923 |
} |
| 1918 |
#endif /* GSSAPI */ |
1924 |
#endif /* GSSAPI */ |
|
|
1925 |
|
| 1926 |
/* |
| 1927 |
Receive a "write login" request from the unpriviledged |
| 1928 |
process. The priviledged process will receive the pid |
| 1929 |
of the shell process, and the tty name. Record the login. |
| 1930 |
*/ |
| 1931 |
int mm_answer_writelogin(int socket, Buffer *m) |
| 1932 |
{ |
| 1933 |
pid_t pid; |
| 1934 |
char tty[TTYSZ]; |
| 1935 |
socklen_t fromlen; |
| 1936 |
struct sockaddr_storage from; |
| 1937 |
struct passwd *pw; |
| 1938 |
|
| 1939 |
memset(tty, 0, TTYSZ); |
| 1940 |
buffer_get(m, &pid, sizeof(pid_t)); |
| 1941 |
buffer_get(m, tty, TTYSZ); |
| 1942 |
debug("Priviledged process: received pid %d tty %s", pid, tty); |
| 1943 |
/* |
| 1944 |
* Get IP address of client. If the connection is not a socket, let |
| 1945 |
* the address be 0.0.0.0. |
| 1946 |
*/ |
| 1947 |
memset(&from, 0, sizeof(from)); |
| 1948 |
fromlen = sizeof(from); |
| 1949 |
if (packet_connection_is_on_socket()) { |
| 1950 |
if (getpeername(packet_get_connection_in(), |
| 1951 |
(struct sockaddr *) & from, &fromlen) < 0) { |
| 1952 |
debug("getpeername: %.100s", strerror(errno)); |
| 1953 |
cleanup_exit(255); |
| 1954 |
} |
| 1955 |
} |
| 1956 |
pw = authctxt->pw; |
| 1957 |
|
| 1958 |
/* Record that there was a login on that tty from the remote host. */ |
| 1959 |
record_login(pid, tty, pw->pw_name, pw->pw_uid, |
| 1960 |
get_remote_name_or_ip(utmp_len, options.use_dns), |
| 1961 |
(struct sockaddr *)&from, fromlen); |
| 1962 |
|
| 1963 |
} |
| 1964 |
|
| 1965 |
/* LOGOUT FIX |
| 1966 |
Receive a "record logout" request from the unpriviledged |
| 1967 |
process. The priviledged process will receive the pid |
| 1968 |
of the shell process, and the tty name. Record the logout. |
| 1969 |
*/ |
| 1970 |
int mm_answer_record_logout(int socket, Buffer *m) |
| 1971 |
{ |
| 1972 |
pid_t pid; |
| 1973 |
char tty[TTYSZ]; |
| 1974 |
char *pwname; |
| 1975 |
struct passwd *pw; |
| 1976 |
|
| 1977 |
memset(tty, 0, TTYSZ); |
| 1978 |
buffer_get(m, &pid, sizeof(pid_t)); |
| 1979 |
buffer_get(m, tty, TTYSZ); |
| 1980 |
pwname = buffer_get_string(m,NULL); |
| 1981 |
debug("Priviledged process: received pid for logout %d tty %s", pid, tty); |
| 1982 |
pw = authctxt->pw; |
| 1983 |
|
| 1984 |
if (pid != 0) |
| 1985 |
record_logout(pid, tty, pw->pw_name); |
| 1986 |
xfree(pwname); |
| 1987 |
} |
| 1988 |
|
| 1989 |
|