Mercurial > dropbear
comparison svr-session.c @ 568:005530560594
Rearrange getaddrstring() etc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 01 Sep 2009 16:38:26 +0000 |
parents | 8711f20b89ab |
children | 8fd0ac8c8cab |
comparison
equal
deleted
inserted
replaced
567:893a9dd0b9dd | 568:005530560594 |
---|---|
72 &svr_chan_tcpdirect, | 72 &svr_chan_tcpdirect, |
73 #endif | 73 #endif |
74 NULL /* Null termination is mandatory. */ | 74 NULL /* Null termination is mandatory. */ |
75 }; | 75 }; |
76 | 76 |
77 void svr_session(int sock, int childpipe, | 77 void svr_session(int sock, int childpipe) { |
78 char* remotehost, char *addrstring) { | 78 char *host, *port; |
79 | 79 size_t len; |
80 reseedrandom(); | 80 reseedrandom(); |
81 | 81 |
82 crypto_init(); | 82 crypto_init(); |
83 common_session_init(sock, sock, remotehost); | 83 common_session_init(sock, sock); |
84 | 84 |
85 /* Initialise server specific parts of the session */ | 85 /* Initialise server specific parts of the session */ |
86 svr_ses.childpipe = childpipe; | 86 svr_ses.childpipe = childpipe; |
87 svr_ses.addrstring = addrstring; | |
88 #ifdef __uClinux__ | 87 #ifdef __uClinux__ |
89 svr_ses.server_pid = getpid(); | 88 svr_ses.server_pid = getpid(); |
90 #endif | 89 #endif |
91 svr_ses.addrstring = addrstring; | |
92 svr_authinitialise(); | 90 svr_authinitialise(); |
93 chaninitialise(svr_chantypes); | 91 chaninitialise(svr_chantypes); |
94 svr_chansessinitialise(); | 92 svr_chansessinitialise(); |
95 | 93 |
96 ses.connect_time = time(NULL); | 94 ses.connect_time = time(NULL); |
95 | |
96 /* for logging the remote address */ | |
97 get_socket_address(ses.sock_in, NULL, NULL, &host, &port, 0); | |
98 len = strlen(host) + strlen(port) + 2; | |
99 svr_ses.addrstring = m_malloc(len); | |
100 snprintf(svr_ses.addrstring, len, "%s:%s", host, port); | |
101 m_free(host); | |
102 m_free(port); | |
97 | 103 |
98 /* set up messages etc */ | 104 /* set up messages etc */ |
99 ses.remoteclosed = svr_remoteclosed; | 105 ses.remoteclosed = svr_remoteclosed; |
100 | 106 |
101 /* packet handlers */ | 107 /* packet handlers */ |