Mercurial > dropbear
comparison svr-session.c @ 24:469950e86d0f
switching to global vars
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 20 Jul 2004 12:05:00 +0000 |
parents | c1e5d9195402 |
children | 0969767bca0d |
comparison
equal
deleted
inserted
replaced
23:c896a4dd65da | 24:469950e86d0f |
---|---|
37 #include "atomicio.h" | 37 #include "atomicio.h" |
38 #include "tcpfwd-direct.h" | 38 #include "tcpfwd-direct.h" |
39 #include "service.h" | 39 #include "service.h" |
40 #include "auth.h" | 40 #include "auth.h" |
41 #include "tcpfwd-remote.h" | 41 #include "tcpfwd-remote.h" |
42 #include "runopts.h" | |
42 | 43 |
43 static void svr_remoteclosed(); | 44 static void svr_remoteclosed(); |
44 | 45 |
45 struct serversession svr_ses; | 46 struct serversession svr_ses; /* GLOBAL */ |
46 | 47 |
47 static const packettype svr_packettypes[] = { | 48 static const packettype svr_packettypes[] = { |
48 /* TYPE, AUTHREQUIRED, FUNCTION */ | 49 /* TYPE, AUTHREQUIRED, FUNCTION */ |
49 {SSH_MSG_SERVICE_REQUEST, recv_msg_service_request}, // server | 50 {SSH_MSG_SERVICE_REQUEST, recv_msg_service_request}, // server |
50 {SSH_MSG_USERAUTH_REQUEST, recv_msg_userauth_request}, //server | 51 {SSH_MSG_USERAUTH_REQUEST, recv_msg_userauth_request}, //server |
67 &svrchansess, | 68 &svrchansess, |
68 &chan_tcpdirect, | 69 &chan_tcpdirect, |
69 NULL /* Null termination is mandatory. */ | 70 NULL /* Null termination is mandatory. */ |
70 }; | 71 }; |
71 | 72 |
72 void svr_session(int sock, runopts *opts, int childpipe, | 73 void svr_session(int sock, int childpipe, struct sockaddr* remoteaddr) { |
73 struct sockaddr* remoteaddr) { | |
74 | 74 |
75 fd_set readfd, writefd; | 75 fd_set readfd, writefd; |
76 struct timeval timeout; | 76 struct timeval timeout; |
77 int val; | 77 int val; |
78 | 78 |
79 crypto_init(); | 79 crypto_init(); |
80 common_session_init(sock, opts); | 80 common_session_init(sock); |
81 | 81 |
82 ses.remoteaddr = remoteaddr; | 82 ses.remoteaddr = remoteaddr; |
83 ses.remotehost = getaddrhostname(remoteaddr); | 83 ses.remotehost = getaddrhostname(remoteaddr); |
84 | 84 |
85 /* Initialise server specific parts of the session */ | 85 /* Initialise server specific parts of the session */ |
225 int havetrace = 0; | 225 int havetrace = 0; |
226 | 226 |
227 vsnprintf(printbuf, sizeof(printbuf), format, param); | 227 vsnprintf(printbuf, sizeof(printbuf), format, param); |
228 | 228 |
229 #ifndef DISABLE_SYSLOG | 229 #ifndef DISABLE_SYSLOG |
230 if (usingsyslog) { | 230 if (svr_opts.usingsyslog) { |
231 syslog(priority, "%s", printbuf); | 231 syslog(priority, "%s", printbuf); |
232 } | 232 } |
233 #endif | 233 #endif |
234 | 234 |
235 /* if we are using DEBUG_TRACE, we want to print to stderr even if | 235 /* if we are using DEBUG_TRACE, we want to print to stderr even if |
236 * syslog is used, so it is included in error reports */ | 236 * syslog is used, so it is included in error reports */ |
237 #ifdef DEBUG_TRACE | 237 #ifdef DEBUG_TRACE |
238 havetrace = 1; | 238 havetrace = 1; |
239 #endif | 239 #endif |
240 | 240 |
241 if (!usingsyslog || havetrace) | 241 if (!svr_opts.usingsyslog || havetrace) |
242 { | 242 { |
243 timesec = time(NULL); | 243 timesec = time(NULL); |
244 if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S", | 244 if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S", |
245 localtime(×ec)) == 0) { | 245 localtime(×ec)) == 0) { |
246 datestr[0] = '?'; datestr[1] = '\0'; | 246 datestr[0] = '?'; datestr[1] = '\0'; |