summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
committerDamien Miller <djm@mindrot.org>2000-05-07 12:03:14 +1000
commite247cc402bc391650f014316363dbce78ad85dc7 (patch)
tree65d72c3d3514c6119f47017f14b71ed153485a5d /session.c
parent0437b33e54fd72060d17908d6abf96bfabaacad2 (diff)
- Remove references to SSLeay.
- Big OpenBSD CVS update - markus@cvs.openbsd.org [clientloop.c] - typo [session.c] - update proctitle on pty alloc/dealloc, e.g. w/ windows client [session.c] - update proctitle for proto 1, too [channels.h nchan.c serverloop.c session.c sshd.c] - use c-style comments - deraadt@cvs.openbsd.org [scp.c] - more atomicio - markus@cvs.openbsd.org [channels.c] - set O_NONBLOCK [ssh.1] - update AUTHOR [readconf.c ssh-keygen.c ssh.h] - default DSA key file ~/.ssh/id_dsa [clientloop.c] - typo, rm verbose debug - deraadt@cvs.openbsd.org [ssh-keygen.1] - document DSA use of ssh-keygen [sshd.8] - a start at describing what i understand of the DSA side [ssh-keygen.1] - document -X and -x [ssh-keygen.c] - simplify usage - markus@cvs.openbsd.org [sshd.8] - there is no rhosts_dsa [ssh-keygen.1] - document -y, update -X,-x [nchan.c] - fix close for non-open ssh1 channels [servconf.c servconf.h ssh.h sshd.8 sshd.c ] - s/DsaKey/HostDSAKey/, document option [sshconnect2.c] - respect number_of_password_prompts [channels.c channels.h servconf.c servconf.h session.c sshd.8] - GatewayPorts for sshd, ok deraadt@ [ssh-add.1 ssh-agent.1 ssh.1] - more doc on: DSA, id_dsa, known_hosts2, authorized_keys2 [ssh.1] - more info on proto 2 [sshd.8] - sync AUTHOR w/ ssh.1 [key.c key.h sshconnect.c] - print key type when talking about host keys [packet.c] - clear padding in ssh2 [dsa.c key.c radix.c ssh.h sshconnect1.c uuencode.c uuencode.h] - replace broken uuencode w/ libc b64_ntop [auth2.c] - log failure before sending the reply [key.c radix.c uuencode.c] - remote trailing comments before calling __b64_pton [auth2.c readconf.c readconf.h servconf.c servconf.h ssh.1] [sshconnect2.c sshd.8] - add DSAAuthetication option to ssh/sshd, document SSH2 in sshd.8 - Bring in b64_ntop and b64_pton from OpenBSD libc (bsd-base64.[ch])
Diffstat (limited to 'session.c')
-rw-r--r--session.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/session.c b/session.c
index 0679d837c..c490f087e 100644
--- a/session.c
+++ b/session.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10#include "includes.h" 10#include "includes.h"
11RCSID("$OpenBSD: session.c,v 1.8 2000/04/29 16:06:08 markus Exp $"); 11RCSID("$OpenBSD: session.c,v 1.12 2000/05/03 18:03:07 markus Exp $");
12 12
13#include "xmalloc.h" 13#include "xmalloc.h"
14#include "ssh.h" 14#include "ssh.h"
@@ -57,6 +57,7 @@ struct Session {
57Session *session_new(void); 57Session *session_new(void);
58void session_set_fds(Session *s, int fdin, int fdout, int fderr); 58void session_set_fds(Session *s, int fdin, int fdout, int fderr);
59void session_pty_cleanup(Session *s); 59void session_pty_cleanup(Session *s);
60void session_proctitle(Session *s);
60void do_exec_pty(Session *s, const char *command, struct passwd * pw); 61void do_exec_pty(Session *s, const char *command, struct passwd * pw);
61void do_exec_no_pty(Session *s, const char *command, struct passwd * pw); 62void do_exec_no_pty(Session *s, const char *command, struct passwd * pw);
62 63
@@ -240,6 +241,8 @@ do_authenticated(struct passwd * pw)
240 tty_parse_modes(s->ttyfd, &n_bytes); 241 tty_parse_modes(s->ttyfd, &n_bytes);
241 packet_integrity_check(plen, 4 + dlen + 4 * 4 + n_bytes, type); 242 packet_integrity_check(plen, 4 + dlen + 4 * 4 + n_bytes, type);
242 243
244 session_proctitle(s);
245
243 /* Indicate that we now have a pty. */ 246 /* Indicate that we now have a pty. */
244 success = 1; 247 success = 1;
245 have_pty = 1; 248 have_pty = 1;
@@ -312,7 +315,7 @@ do_authenticated(struct passwd * pw)
312 break; 315 break;
313 } 316 }
314 debug("Received TCP/IP port forwarding request."); 317 debug("Received TCP/IP port forwarding request.");
315 channel_input_port_forward_request(pw->pw_uid == 0); 318 channel_input_port_forward_request(pw->pw_uid == 0, options.gateway_ports);
316 success = 1; 319 success = 1;
317 break; 320 break;
318 321
@@ -397,7 +400,7 @@ do_exec_no_pty(Session *s, const char *command, struct passwd * pw)
397 if (s == NULL) 400 if (s == NULL)
398 fatal("do_exec_no_pty: no session"); 401 fatal("do_exec_no_pty: no session");
399 402
400 setproctitle("%s@notty", pw->pw_name); 403 session_proctitle(s);
401 404
402#ifdef USE_PAM 405#ifdef USE_PAM
403 do_pam_setcred(); 406 do_pam_setcred();
@@ -527,7 +530,6 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
527 last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name, 530 last_login_time = get_last_login_time(pw->pw_uid, pw->pw_name,
528 buf, sizeof(buf)); 531 buf, sizeof(buf));
529 } 532 }
530 setproctitle("%s@%s", pw->pw_name, strrchr(s->tty, '/') + 1);
531 533
532#ifdef USE_PAM 534#ifdef USE_PAM
533 do_pam_session(pw->pw_name, s->tty); 535 do_pam_session(pw->pw_name, s->tty);
@@ -563,7 +565,7 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
563 /* Close the extra descriptor for the pseudo tty. */ 565 /* Close the extra descriptor for the pseudo tty. */
564 close(ttyfd); 566 close(ttyfd);
565 567
566///XXXX ? move to do_child() ?? 568/* XXXX ? move to do_child() ??*/
567 /* 569 /*
568 * Get IP address of client. This is needed because we want 570 * Get IP address of client. This is needed because we want
569 * to record where the user logged in from. If the 571 * to record where the user logged in from. If the
@@ -1257,6 +1259,8 @@ session_pty_req(Session *s)
1257 /* Get window size from the packet. */ 1259 /* Get window size from the packet. */
1258 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); 1260 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);
1259 1261
1262 session_proctitle(s);
1263
1260 /* XXX parse and set terminal modes */ 1264 /* XXX parse and set terminal modes */
1261 xfree(term_modes); 1265 xfree(term_modes);
1262 return 1; 1266 return 1;
@@ -1499,6 +1503,7 @@ session_close(Session *s)
1499{ 1503{
1500 session_pty_cleanup(s); 1504 session_pty_cleanup(s);
1501 session_free(s); 1505 session_free(s);
1506 session_proctitle(s);
1502} 1507}
1503 1508
1504void 1509void
@@ -1542,6 +1547,34 @@ session_close_by_channel(int id, void *arg)
1542 } 1547 }
1543} 1548}
1544 1549
1550char *
1551session_tty_list(void)
1552{
1553 static char buf[1024];
1554 int i;
1555 buf[0] = '\0';
1556 for(i = 0; i < MAX_SESSIONS; i++) {
1557 Session *s = &sessions[i];
1558 if (s->used && s->ttyfd != -1) {
1559 if (buf[0] != '\0')
1560 strlcat(buf, ",", sizeof buf);
1561 strlcat(buf, strrchr(s->tty, '/') + 1, sizeof buf);
1562 }
1563 }
1564 if (buf[0] == '\0')
1565 strlcpy(buf, "notty", sizeof buf);
1566 return buf;
1567}
1568
1569void
1570session_proctitle(Session *s)
1571{
1572 if (s->pw == NULL)
1573 error("no user for session %d", s->self);
1574 else
1575 setproctitle("%s@%s", s->pw->pw_name, session_tty_list());
1576}
1577
1545void 1578void
1546do_authenticated2(void) 1579do_authenticated2(void)
1547{ 1580{