comparison svr-session.c @ 801:7dcb46da72d9 ecc

merge in HEAD
author Matt Johnston <matt@ucc.asn.au>
date Tue, 21 May 2013 12:09:35 +0800
parents 7f604f9b3756 077bbe1eb220
children 220f55d540ae
comparison
equal deleted inserted replaced
799:c344607b7341 801:7dcb46da72d9
71 &svr_chan_tcpdirect, 71 &svr_chan_tcpdirect,
72 #endif 72 #endif
73 NULL /* Null termination is mandatory. */ 73 NULL /* Null termination is mandatory. */
74 }; 74 };
75 75
76 static void
77 svr_session_cleanup(void)
78 {
79 /* free potential public key options */
80 svr_pubkey_options_cleanup();
81 }
82
76 void svr_session(int sock, int childpipe) { 83 void svr_session(int sock, int childpipe) {
77 char *host, *port; 84 char *host, *port;
78 size_t len; 85 size_t len;
79 86
80 common_session_init(sock, sock); 87 common_session_init(sock, sock);
101 get_socket_address(ses.sock_in, NULL, NULL, 108 get_socket_address(ses.sock_in, NULL, NULL,
102 &svr_ses.remotehost, NULL, 1); 109 &svr_ses.remotehost, NULL, 1);
103 110
104 /* set up messages etc */ 111 /* set up messages etc */
105 ses.remoteclosed = svr_remoteclosed; 112 ses.remoteclosed = svr_remoteclosed;
113 ses.extra_session_cleanup = svr_session_cleanup;
106 114
107 /* packet handlers */ 115 /* packet handlers */
108 ses.packettypes = svr_packettypes; 116 ses.packettypes = svr_packettypes;
109 ses.buf_match_algo = svr_buf_match_algo;
110 117
111 ses.isserver = 1; 118 ses.isserver = 1;
112 119
113 /* We're ready to go now */ 120 /* We're ready to go now */
114 sessinitdone = 1; 121 sessinitdone = 1;
115 122
116 /* exchange identification, version etc */ 123 /* exchange identification, version etc */
117 session_identification(); 124 send_session_identification();
118 125
119 /* start off with key exchange */ 126 /* start off with key exchange */
120 send_msg_kexinit(); 127 send_msg_kexinit();
121 128
122 /* Run the main for loop. NULL is for the dispatcher - only the client 129 /* Run the main for loop. NULL is for the dispatcher - only the client
158 /* For uclinux only the main server process should cleanup - we don't want 165 /* For uclinux only the main server process should cleanup - we don't want
159 * forked children doing that */ 166 * forked children doing that */
160 if (svr_ses.server_pid == getpid()) 167 if (svr_ses.server_pid == getpid())
161 #endif 168 #endif
162 { 169 {
163 /* free potential public key options */
164 svr_pubkey_options_cleanup();
165
166 /* must be after we've done with username etc */ 170 /* must be after we've done with username etc */
167 common_session_cleanup(); 171 session_cleanup();
168 } 172 }
169 173
170 exit(exitcode); 174 exit(exitcode);
171 175
172 } 176 }