Mercurial > dropbear
changeset 5:bc6477a6c393
syntactical fixups - it compiles, but channel handling code requires fixing.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 01 Jun 2004 04:20:12 +0000 |
parents | fe6bca95afa7 |
children | ab00ef513e97 |
files | main.c session.h svr-agentfwd.c svr-session.c |
diffstat | 4 files changed, 24 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Tue Jun 01 02:46:09 2004 +0000 +++ b/main.c Tue Jun 01 04:20:12 2004 +0000 @@ -62,8 +62,11 @@ struct sigaction sa_chld; + _dropbear_exit = svr_dropbear_exit; + _dropbear_log = svr_dropbear_log; + /* get commandline options */ - opts = getrunopts(argc, argv); + opts = svr_getopts(argc, argv); /* fork */ if (opts->forkbg) { @@ -239,7 +242,7 @@ dropbear_exit("Couldn't close socket"); } /* start the session */ - child_session(childsock, opts, childpipe[1], &remoteaddr); + svr_session(childsock, opts, childpipe[1], &remoteaddr); /* don't return */ assert(0); }
--- a/session.h Tue Jun 01 02:46:09 2004 +0000 +++ b/session.h Tue Jun 01 04:20:12 2004 +0000 @@ -48,6 +48,9 @@ /* Server */ void svr_session(int sock, runopts *opts, int childpipe, struct sockaddr *remoteaddr); +void svr_dropbear_exit(int exitcode, const char* format, va_list param); +void svr_dropbear_log(int priority, const char* format, va_list param); + struct key_context {
--- a/svr-agentfwd.c Tue Jun 01 02:46:09 2004 +0000 +++ b/svr-agentfwd.c Tue Jun 01 04:20:12 2004 +0000 @@ -141,8 +141,8 @@ * for themselves */ uid = getuid(); gid = getgid(); - if ((setegid(ses.authstate.pw->pw_gid)) < 0 || - (seteuid(ses.authstate.pw->pw_uid)) < 0) { + if ((setegid(svr_ses.authstate.pw->pw_gid)) < 0 || + (seteuid(svr_ses.authstate.pw->pw_uid)) < 0) { dropbear_exit("failed to set euid"); } @@ -194,8 +194,8 @@ /* drop to user privs to make the dir/file */ uid = getuid(); gid = getgid(); - if ((setegid(ses.authstate.pw->pw_gid)) < 0 || - (seteuid(ses.authstate.pw->pw_uid)) < 0) { + if ((setegid(svr_ses.authstate.pw->pw_gid)) < 0 || + (seteuid(svr_ses.authstate.pw->pw_uid)) < 0) { dropbear_exit("failed to set euid"); }
--- a/svr-session.c Tue Jun 01 02:46:09 2004 +0000 +++ b/svr-session.c Tue Jun 01 04:20:12 2004 +0000 @@ -37,8 +37,6 @@ #include "atomicio.h" static void svr_remoteclosed(); -static void svr_dropbear_exit(int exitcode, const char* format, va_list param); -static void svr_dropbear_log(int priority, const char* format, va_list param); struct serversession svr_ses; @@ -68,8 +66,6 @@ /* set up messages etc */ session_remoteclosed = svr_remoteclosed; - _dropbear_exit = svr_dropbear_exit; - _dropbear_log = svr_dropbear_log; /* We're ready to go now */ sessinitdone = 1; @@ -153,19 +149,8 @@ } /* for(;;) */ } - - -/* called when the remote side closes the connection */ -static void svr_remoteclosed() { - - close(ses.sock); - ses.sock = -1; - dropbear_close("Exited normally"); - -} - /* failure exit - format must be <= 100 chars */ -static void svr_dropbear_exit(int exitcode, const char* format, va_list param) { +void svr_dropbear_exit(int exitcode, const char* format, va_list param) { char fmtbuf[300]; @@ -205,7 +190,7 @@ } /* priority is priority as with syslog() */ -static void svr_dropbear_log(int priority, const char* format, va_list param) { +void svr_dropbear_log(int priority, const char* format, va_list param) { char printbuf[1024]; char datestr[20]; @@ -236,3 +221,13 @@ fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf); } } + +/* called when the remote side closes the connection */ +static void svr_remoteclosed() { + + close(ses.sock); + ses.sock = -1; + dropbear_close("Exited normally"); + +} +