summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
committerDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
commit4af51306d9a51459a5bef922df1037f876ae51fe (patch)
tree09ecfc215fce82345a3259f8a0f384b9a67906f0 /session.c
parent5d1705ecf9bd3216dc99a84242bcdf2e7297d307 (diff)
- OpenBSD CVS updates.
[ssh.1 ssh.c] - ssh -2 [auth.c channels.c clientloop.c packet.c packet.h serverloop.c] [session.c sshconnect.c] - check payload for (illegal) extra data [ALL] - whitespace cleanup
Diffstat (limited to 'session.c')
-rw-r--r--session.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/session.c b/session.c
index 835a46945..8d8ff223e 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.2 2000/04/06 08:55:22 markus Exp $"); 11RCSID("$OpenBSD: session.c,v 1.4 2000/04/14 10:30:33 markus Exp $");
12 12
13#include "xmalloc.h" 13#include "xmalloc.h"
14#include "ssh.h" 14#include "ssh.h"
@@ -113,7 +113,7 @@ xauthfile_cleanup_proc(void *ignore)
113 * Function to perform cleanup if we get aborted abnormally (e.g., due to a 113 * Function to perform cleanup if we get aborted abnormally (e.g., due to a
114 * dropped connection). 114 * dropped connection).
115 */ 115 */
116void 116void
117pty_cleanup_proc(void *session) 117pty_cleanup_proc(void *session)
118{ 118{
119 Session *s=session; 119 Session *s=session;
@@ -136,7 +136,7 @@ pty_cleanup_proc(void *session)
136 * terminals are allocated, X11, TCP/IP, and authentication agent forwardings 136 * terminals are allocated, X11, TCP/IP, and authentication agent forwardings
137 * are requested, etc. 137 * are requested, etc.
138 */ 138 */
139void 139void
140do_authenticated(struct passwd * pw) 140do_authenticated(struct passwd * pw)
141{ 141{
142 Session *s; 142 Session *s;
@@ -366,7 +366,7 @@ do_authenticated(struct passwd * pw)
366 * will call do_child from the child, and server_loop from the parent after 366 * will call do_child from the child, and server_loop from the parent after
367 * setting up file descriptors and such. 367 * setting up file descriptors and such.
368 */ 368 */
369void 369void
370do_exec_no_pty(Session *s, const char *command, struct passwd * pw) 370do_exec_no_pty(Session *s, const char *command, struct passwd * pw)
371{ 371{
372 int pid; 372 int pid;
@@ -487,7 +487,7 @@ do_exec_no_pty(Session *s, const char *command, struct passwd * pw)
487 * setting up file descriptors, controlling tty, updating wtmp, utmp, 487 * setting up file descriptors, controlling tty, updating wtmp, utmp,
488 * lastlog, and other such operations. 488 * lastlog, and other such operations.
489 */ 489 */
490void 490void
491do_exec_pty(Session *s, const char *command, struct passwd * pw) 491do_exec_pty(Session *s, const char *command, struct passwd * pw)
492{ 492{
493 FILE *f; 493 FILE *f;
@@ -660,7 +660,7 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw)
660 * Sets the value of the given variable in the environment. If the variable 660 * Sets the value of the given variable in the environment. If the variable
661 * already exists, its value is overriden. 661 * already exists, its value is overriden.
662 */ 662 */
663void 663void
664child_set_env(char ***envp, unsigned int *envsizep, const char *name, 664child_set_env(char ***envp, unsigned int *envsizep, const char *name,
665 const char *value) 665 const char *value)
666{ 666{
@@ -701,7 +701,7 @@ child_set_env(char ***envp, unsigned int *envsizep, const char *name,
701 * Otherwise, it must consist of empty lines, comments (line starts with '#') 701 * Otherwise, it must consist of empty lines, comments (line starts with '#')
702 * and assignments of the form name=value. No other forms are allowed. 702 * and assignments of the form name=value. No other forms are allowed.
703 */ 703 */
704void 704void
705read_environment_file(char ***env, unsigned int *envsize, 705read_environment_file(char ***env, unsigned int *envsize,
706 const char *filename) 706 const char *filename)
707{ 707{
@@ -770,7 +770,7 @@ void do_pam_environment(char ***env, int *envsize)
770 * environment, closing extra file descriptors, setting the user and group 770 * environment, closing extra file descriptors, setting the user and group
771 * ids, and executing the command or shell. 771 * ids, and executing the command or shell.
772 */ 772 */
773void 773void
774do_child(const char *command, struct passwd * pw, const char *term, 774do_child(const char *command, struct passwd * pw, const char *term,
775 const char *display, const char *auth_proto, 775 const char *display, const char *auth_proto,
776 const char *auth_data, const char *ttyname) 776 const char *auth_data, const char *ttyname)
@@ -1202,6 +1202,7 @@ session_window_change_req(Session *s)
1202 s->row = packet_get_int(); 1202 s->row = packet_get_int();
1203 s->xpixel = packet_get_int(); 1203 s->xpixel = packet_get_int();
1204 s->ypixel = packet_get_int(); 1204 s->ypixel = packet_get_int();
1205 packet_done();
1205 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); 1206 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);
1206 return 1; 1207 return 1;
1207} 1208}
@@ -1210,14 +1211,17 @@ int
1210session_pty_req(Session *s) 1211session_pty_req(Session *s)
1211{ 1212{
1212 unsigned int len; 1213 unsigned int len;
1214 char *term_modes; /* encoded terminal modes */
1213 1215
1214 if (s->ttyfd != -1) 1216 if (s->ttyfd != -1)
1215 return -1; 1217 return 0;
1216 s->term = packet_get_string(&len); 1218 s->term = packet_get_string(&len);
1217 s->col = packet_get_int(); 1219 s->col = packet_get_int();
1218 s->row = packet_get_int(); 1220 s->row = packet_get_int();
1219 s->xpixel = packet_get_int(); 1221 s->xpixel = packet_get_int();
1220 s->ypixel = packet_get_int(); 1222 s->ypixel = packet_get_int();
1223 term_modes = packet_get_string(&len);
1224 packet_done();
1221 1225
1222 if (strcmp(s->term, "") == 0) { 1226 if (strcmp(s->term, "") == 0) {
1223 xfree(s->term); 1227 xfree(s->term);
@@ -1230,7 +1234,8 @@ session_pty_req(Session *s)
1230 s->ptyfd = -1; 1234 s->ptyfd = -1;
1231 s->ttyfd = -1; 1235 s->ttyfd = -1;
1232 error("session_pty_req: session %d alloc failed", s->self); 1236 error("session_pty_req: session %d alloc failed", s->self);
1233 return -1; 1237 xfree(term_modes);
1238 return 0;
1234 } 1239 }
1235 debug("session_pty_req: session %d alloc %s", s->self, s->tty); 1240 debug("session_pty_req: session %d alloc %s", s->self, s->tty);
1236 /* 1241 /*