Mercurial > dropbear
comparison svr-chansession.c @ 314:827f87dfbc22 ucc-axis-hack
*hack hack hack*
get rid of a few more bits
author | matt-ucc@ucc.asn.au |
---|---|
date | Mon, 27 Mar 2006 08:36:44 +0000 |
parents | fabcee551349 |
children |
comparison
equal
deleted
inserted
replaced
313:fabcee551349 | 314:827f87dfbc22 |
---|---|
129 sa_chld.sa_flags = SA_NOCLDSTOP; | 129 sa_chld.sa_flags = SA_NOCLDSTOP; |
130 sigaction(SIGCHLD, &sa_chld, NULL); | 130 sigaction(SIGCHLD, &sa_chld, NULL); |
131 TRACE(("leave sigchld handler")) | 131 TRACE(("leave sigchld handler")) |
132 } | 132 } |
133 | 133 |
134 #if 0 | |
134 /* send the exit status or the signal causing termination for a session */ | 135 /* send the exit status or the signal causing termination for a session */ |
135 /* XXX server */ | 136 /* XXX server */ |
136 static void send_exitsignalstatus(struct Channel *channel) { | 137 static void send_exitsignalstatus(struct Channel *channel) { |
137 | 138 |
138 struct ChanSess *chansess = (struct ChanSess*)channel->typedata; | 139 struct ChanSess *chansess = (struct ChanSess*)channel->typedata; |
199 buf_putstring(ses.writepayload, "", 0); /* error msg */ | 200 buf_putstring(ses.writepayload, "", 0); /* error msg */ |
200 buf_putstring(ses.writepayload, "", 0); /* lang */ | 201 buf_putstring(ses.writepayload, "", 0); /* lang */ |
201 | 202 |
202 encrypt_packet(); | 203 encrypt_packet(); |
203 } | 204 } |
205 #endif | |
204 | 206 |
205 /* set up a session channel */ | 207 /* set up a session channel */ |
206 static int newchansess(struct Channel *channel) { | 208 static int newchansess(struct Channel *channel) { |
207 | 209 |
208 struct ChanSess *chansess; | 210 struct ChanSess *chansess; |
246 unsigned int i; | 248 unsigned int i; |
247 struct logininfo *li; | 249 struct logininfo *li; |
248 | 250 |
249 chansess = (struct ChanSess*)channel->typedata; | 251 chansess = (struct ChanSess*)channel->typedata; |
250 | 252 |
253 #if 0 | |
251 send_exitsignalstatus(channel); | 254 send_exitsignalstatus(channel); |
255 #endif | |
252 | 256 |
253 TRACE(("enter closechansess")) | 257 TRACE(("enter closechansess")) |
254 if (chansess == NULL) { | 258 if (chansess == NULL) { |
255 TRACE(("leave closechansess: chansess == NULL")) | 259 TRACE(("leave closechansess: chansess == NULL")) |
256 return; | 260 return; |
257 } | 261 } |
258 | 262 |
259 m_free(chansess->cmd); | 263 m_free(chansess->cmd); |
260 m_free(chansess->term); | 264 m_free(chansess->term); |
261 | 265 |
266 #if 0 | |
262 if (chansess->tty) { | 267 if (chansess->tty) { |
263 /* write the utmp/wtmp login record */ | 268 /* write the utmp/wtmp login record */ |
264 li = login_alloc_entry(chansess->pid, ses.authstate.username, | 269 li = login_alloc_entry(chansess->pid, ses.authstate.username, |
265 ses.remotehost, chansess->tty); | 270 ses.remotehost, chansess->tty); |
266 login_logout(li); | 271 login_logout(li); |
267 login_free_entry(li); | 272 login_free_entry(li); |
268 | 273 |
269 pty_release(chansess->tty); | 274 pty_release(chansess->tty); |
270 m_free(chansess->tty); | 275 m_free(chansess->tty); |
271 } | 276 } |
277 #endif | |
272 | 278 |
273 #ifndef DISABLE_X11FWD | 279 #ifndef DISABLE_X11FWD |
274 x11cleanup(chansess); | 280 x11cleanup(chansess); |
275 #endif | 281 #endif |
276 | 282 |
387 return DROPBEAR_SUCCESS; | 393 return DROPBEAR_SUCCESS; |
388 } | 394 } |
389 | 395 |
390 /* Send a signal to a session's process as requested by the client*/ | 396 /* Send a signal to a session's process as requested by the client*/ |
391 static int sessionsignal(struct ChanSess *chansess) { | 397 static int sessionsignal(struct ChanSess *chansess) { |
398 #if 0 | |
392 | 399 |
393 int sig = 0; | 400 int sig = 0; |
394 unsigned char* signame = NULL; | 401 unsigned char* signame = NULL; |
395 int i; | 402 int i; |
396 | 403 |
418 } | 425 } |
419 | 426 |
420 if (kill(chansess->pid, sig) < 0) { | 427 if (kill(chansess->pid, sig) < 0) { |
421 return DROPBEAR_FAILURE; | 428 return DROPBEAR_FAILURE; |
422 } | 429 } |
430 #endif | |
423 | 431 |
424 return DROPBEAR_SUCCESS; | 432 return DROPBEAR_SUCCESS; |
425 } | 433 } |
426 | 434 |
427 /* Let the process know that the window size has changed, as notified from the | 435 /* Let the process know that the window size has changed, as notified from the |
428 * client. Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ | 436 * client. Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ |
429 static int sessionwinchange(struct ChanSess *chansess) { | 437 static int sessionwinchange(struct ChanSess *chansess) { |
430 | 438 |
439 #if 0 | |
431 int termc, termr, termw, termh; | 440 int termc, termr, termw, termh; |
432 | 441 |
433 if (chansess->master < 0) { | 442 if (chansess->master < 0) { |
434 /* haven't got a pty yet */ | 443 /* haven't got a pty yet */ |
435 return DROPBEAR_FAILURE; | 444 return DROPBEAR_FAILURE; |
440 termw = buf_getint(ses.payload); | 449 termw = buf_getint(ses.payload); |
441 termh = buf_getint(ses.payload); | 450 termh = buf_getint(ses.payload); |
442 | 451 |
443 pty_change_window_size(chansess->master, termr, termc, termw, termh); | 452 pty_change_window_size(chansess->master, termr, termc, termw, termh); |
444 | 453 |
445 return DROPBEAR_FAILURE; | 454 #endif |
446 } | 455 return DROPBEAR_SUCCESS; |
447 | 456 } |
457 | |
458 #if 0 | |
448 static void get_termmodes(struct ChanSess *chansess) { | 459 static void get_termmodes(struct ChanSess *chansess) { |
449 | 460 |
450 struct termios termio; | 461 struct termios termio; |
451 unsigned char opcode; | 462 unsigned char opcode; |
452 unsigned int value; | 463 unsigned int value; |
533 if (tcsetattr(chansess->master, TCSANOW, &termio) < 0) { | 544 if (tcsetattr(chansess->master, TCSANOW, &termio) < 0) { |
534 dropbear_log(LOG_INFO, "error setting terminal attributes"); | 545 dropbear_log(LOG_INFO, "error setting terminal attributes"); |
535 } | 546 } |
536 TRACE(("leave get_termmodes")) | 547 TRACE(("leave get_termmodes")) |
537 } | 548 } |
549 #endif | |
538 | 550 |
539 /* Set up a session pty which will be used to execute the shell or program. | 551 /* Set up a session pty which will be used to execute the shell or program. |
540 * The pty is allocated now, and kept for when the shell/program executes. | 552 * The pty is allocated now, and kept for when the shell/program executes. |
541 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ | 553 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ |
542 static int sessionpty(struct ChanSess * chansess) { | 554 static int sessionpty(struct ChanSess * chansess) { |
633 if (chansess->term == NULL) { | 645 if (chansess->term == NULL) { |
634 /* no pty */ | 646 /* no pty */ |
635 ret = noptycommand(channel, chansess); | 647 ret = noptycommand(channel, chansess); |
636 } else { | 648 } else { |
637 /* want pty */ | 649 /* want pty */ |
638 ret = ptycommand(channel, chansess); | 650 //ret = ptycommand(channel, chansess); |
639 } | 651 } |
640 | 652 |
641 if (ret == DROPBEAR_FAILURE) { | 653 if (ret == DROPBEAR_FAILURE) { |
642 m_free(chansess->cmd); | 654 m_free(chansess->cmd); |
643 } | 655 } |
784 } | 796 } |
785 | 797 |
786 /* Execute a command or shell within a pty environment, and set up | 798 /* Execute a command or shell within a pty environment, and set up |
787 * redirection as appropriate. | 799 * redirection as appropriate. |
788 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ | 800 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ |
801 #if 0 | |
789 static int ptycommand(struct Channel *channel, struct ChanSess *chansess) { | 802 static int ptycommand(struct Channel *channel, struct ChanSess *chansess) { |
790 | 803 |
791 pid_t pid; | 804 pid_t pid; |
792 struct logininfo *li = NULL; | 805 struct logininfo *li = NULL; |
793 #ifdef DO_MOTD | 806 #ifdef DO_MOTD |
830 return DROPBEAR_FAILURE; | 843 return DROPBEAR_FAILURE; |
831 } | 844 } |
832 | 845 |
833 close(chansess->slave); | 846 close(chansess->slave); |
834 | 847 |
848 #if 0 | |
835 /* write the utmp/wtmp login record - must be after changing the | 849 /* write the utmp/wtmp login record - must be after changing the |
836 * terminal used for stdout with the dup2 above */ | 850 * terminal used for stdout with the dup2 above */ |
837 li= login_alloc_entry(getpid(), ses.authstate.username, | 851 li= login_alloc_entry(getpid(), ses.authstate.username, |
838 ses.remotehost, chansess->tty); | 852 ses.remotehost, chansess->tty); |
839 login_login(li); | 853 login_login(li); |
840 login_free_entry(li); | 854 login_free_entry(li); |
855 #endif | |
841 | 856 |
842 m_free(chansess->tty); | 857 m_free(chansess->tty); |
843 | 858 |
844 #ifdef DO_MOTD | 859 #ifdef DO_MOTD |
845 if (svr_opts.domotd) { | 860 if (svr_opts.domotd) { |
891 } | 906 } |
892 | 907 |
893 TRACE(("leave ptycommand")) | 908 TRACE(("leave ptycommand")) |
894 return DROPBEAR_SUCCESS; | 909 return DROPBEAR_SUCCESS; |
895 } | 910 } |
911 #endif | |
896 | 912 |
897 /* Add the pid of a child to the list for exit-handling */ | 913 /* Add the pid of a child to the list for exit-handling */ |
898 static void addchildpid(struct ChanSess *chansess, pid_t pid) { | 914 static void addchildpid(struct ChanSess *chansess, pid_t pid) { |
899 | 915 |
900 unsigned int i; | 916 unsigned int i; |