comparison common-session.c @ 925:bae0b34bc059 pam

Better PAM through recursion
author Matt Johnston <matt@ucc.asn.au>
date Wed, 12 Mar 2014 23:40:02 +0800
parents a1a97e98b0c1
children 73ea0dce9a57
comparison
equal deleted inserted replaced
923:25b7ed9fe854 925:bae0b34bc059
123 ses.allowprivport = 0; 123 ses.allowprivport = 0;
124 124
125 TRACE(("leave session_init")) 125 TRACE(("leave session_init"))
126 } 126 }
127 127
128 void session_loop(void(*loophandler)()) { 128 void session_loop() {
129 129
130 fd_set readfd, writefd; 130 fd_set readfd, writefd;
131 struct timeval timeout; 131 struct timeval timeout;
132 int val; 132 int val;
133 133
134 assert(ses.recursion_count <= 1);
135 ses.recursion_count++;
136
134 /* main loop, select()s for all sockets in use */ 137 /* main loop, select()s for all sockets in use */
135 for(;;) { 138 while (!ses.exit_recursion) {
136 139
137 timeout.tv_sec = select_timeout(); 140 timeout.tv_sec = select_timeout();
138 timeout.tv_usec = 0; 141 timeout.tv_usec = 0;
139 FD_ZERO(&writefd); 142 FD_ZERO(&writefd);
140 FD_ZERO(&readfd); 143 FD_ZERO(&readfd);
216 219
217 /* process pipes etc for the channels, ses.dataallowed == 0 220 /* process pipes etc for the channels, ses.dataallowed == 0
218 * during rekeying ) */ 221 * during rekeying ) */
219 channelio(&readfd, &writefd); 222 channelio(&readfd, &writefd);
220 223
221 if (loophandler) { 224 if (ses.loop_handler) {
222 loophandler(); 225 ses.loop_handler();
223 } 226 }
224 227
225 } /* for(;;) */ 228 } /* for(;;) */
226 229 ses.recursion_count--;
227 /* Not reached */ 230 ses.exit_recursion = 0;
228 } 231 }
229 232
230 /* clean up a session on exit */ 233 /* clean up a session on exit */
231 void session_cleanup() { 234 void session_cleanup() {
232 235