Mercurial > dropbear
comparison cli-chansession.c @ 560:52d7301e46bd agent-client
Agent forwarding works
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 30 Jul 2009 15:14:33 +0000 |
parents | c3f2ec71e3d4 |
children | fad3eb63b907 |
comparison
equal
deleted
inserted
replaced
559:7f66b8e40f2d | 560:52d7301e46bd |
---|---|
31 #include "channel.h" | 31 #include "channel.h" |
32 #include "ssh.h" | 32 #include "ssh.h" |
33 #include "runopts.h" | 33 #include "runopts.h" |
34 #include "termcodes.h" | 34 #include "termcodes.h" |
35 #include "chansession.h" | 35 #include "chansession.h" |
36 #include "agentfwd.h" | |
36 | 37 |
37 static void cli_closechansess(struct Channel *channel); | 38 static void cli_closechansess(struct Channel *channel); |
38 static int cli_initchansess(struct Channel *channel); | 39 static int cli_initchansess(struct Channel *channel); |
39 static void cli_chansessreq(struct Channel *channel); | 40 static void cli_chansessreq(struct Channel *channel); |
40 | |
41 static void start_channel_request(struct Channel *channel, unsigned char *type); | |
42 | 41 |
43 static void send_chansess_pty_req(struct Channel *channel); | 42 static void send_chansess_pty_req(struct Channel *channel); |
44 static void send_chansess_shell_req(struct Channel *channel); | 43 static void send_chansess_shell_req(struct Channel *channel); |
45 | 44 |
46 static void cli_tty_setup(); | 45 static void cli_tty_setup(); |
90 | 89 |
91 cli_tty_cleanup(); /* Restore tty modes etc */ | 90 cli_tty_cleanup(); /* Restore tty modes etc */ |
92 | 91 |
93 } | 92 } |
94 | 93 |
95 static void start_channel_request(struct Channel *channel, | 94 void cli_start_send_channel_request(struct Channel *channel, |
96 unsigned char *type) { | 95 unsigned char *type) { |
97 | 96 |
98 CHECKCLEARTOWRITE(); | 97 CHECKCLEARTOWRITE(); |
99 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); | 98 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); |
100 buf_putint(ses.writepayload, channel->remotechan); | 99 buf_putint(ses.writepayload, channel->remotechan); |
285 | 284 |
286 unsigned char* term = NULL; | 285 unsigned char* term = NULL; |
287 | 286 |
288 TRACE(("enter send_chansess_pty_req")) | 287 TRACE(("enter send_chansess_pty_req")) |
289 | 288 |
290 start_channel_request(channel, "pty-req"); | 289 cli_start_send_channel_request(channel, "pty-req"); |
291 | 290 |
292 /* Don't want replies */ | 291 /* Don't want replies */ |
293 buf_putbyte(ses.writepayload, 0); | 292 buf_putbyte(ses.writepayload, 0); |
294 | 293 |
295 /* Get the terminal */ | 294 /* Get the terminal */ |
328 } | 327 } |
329 } else { | 328 } else { |
330 reqtype = "shell"; | 329 reqtype = "shell"; |
331 } | 330 } |
332 | 331 |
333 start_channel_request(channel, reqtype); | 332 cli_start_send_channel_request(channel, reqtype); |
334 | 333 |
335 /* XXX TODO */ | 334 /* XXX TODO */ |
336 buf_putbyte(ses.writepayload, 0); /* Don't want replies */ | 335 buf_putbyte(ses.writepayload, 0); /* Don't want replies */ |
337 if (cli_opts.cmd) { | 336 if (cli_opts.cmd) { |
338 buf_putstring(ses.writepayload, cli_opts.cmd, strlen(cli_opts.cmd)); | 337 buf_putstring(ses.writepayload, cli_opts.cmd, strlen(cli_opts.cmd)); |
358 } | 357 } |
359 | 358 |
360 static int cli_initchansess(struct Channel *channel) { | 359 static int cli_initchansess(struct Channel *channel) { |
361 | 360 |
362 cli_init_stdpipe_sess(channel); | 361 cli_init_stdpipe_sess(channel); |
362 | |
363 #ifdef ENABLE_CLI_AGENTFWD | |
364 if (cli_opts.agent_fwd) { | |
365 cli_setup_agent(channel); | |
366 } | |
367 #endif | |
363 | 368 |
364 if (cli_opts.wantpty) { | 369 if (cli_opts.wantpty) { |
365 send_chansess_pty_req(channel); | 370 send_chansess_pty_req(channel); |
366 } | 371 } |
367 | 372 |