Lines Matching refs:ss
121 static void chap_generate_challenge(struct chap_server_state *ss);
122 static void chap_handle_response(struct chap_server_state *ss, int code,
172 struct chap_server_state *ss = &server;
175 ss->flags |= LOWERUP;
176 if (ss->flags & AUTH_STARTED)
177 chap_timeout(ss);
184 struct chap_server_state *ss = &server;
187 if (ss->flags & TIMEOUT_PENDING)
188 UNTIMEOUT(chap_timeout, ss);
189 ss->flags = 0;
200 struct chap_server_state *ss = &server;
203 if (ss->flags & AUTH_STARTED) {
214 ss->digest = dp;
215 ss->name = our_name;
217 ss->id = (unsigned char)(drand48() * 256);
218 ss->flags |= AUTH_STARTED;
219 if (ss->flags & LOWERUP)
220 chap_timeout(ss);
257 struct chap_server_state *ss = arg;
259 ss->flags &= ~TIMEOUT_PENDING;
260 if ((ss->flags & CHALLENGE_VALID) == 0) {
261 ss->challenge_xmits = 0;
262 chap_generate_challenge(ss);
263 ss->flags |= CHALLENGE_VALID;
264 } else if (ss->challenge_xmits >= chap_max_transmits) {
265 ss->flags &= ~CHALLENGE_VALID;
266 ss->flags |= AUTH_DONE | AUTH_FAILED;
271 output(0, ss->challenge, ss->challenge_pktlen);
272 ++ss->challenge_xmits;
273 ss->flags |= TIMEOUT_PENDING;
279 * the challenge packet in ss->challenge_pkt.
282 chap_generate_challenge(struct chap_server_state *ss)
287 p = ss->challenge;
290 ss->digest->generate_challenge(p);
292 nlen = strlen(ss->name);
293 memcpy(p + 1 + clen, ss->name, nlen);
296 ss->challenge_pktlen = PPP_HDRLEN + len;
298 p = ss->challenge + PPP_HDRLEN;
300 p[1] = ++ss->id;
309 chap_handle_response(struct chap_server_state *ss, int id,
319 if ((ss->flags & LOWERUP) == 0)
321 if (id != ss->challenge[PPP_HDRLEN+1] || len < 2)
323 if (ss->flags & CHALLENGE_VALID) {
331 if (ss->flags & TIMEOUT_PENDING) {
332 ss->flags &= ~TIMEOUT_PENDING;
333 UNTIMEOUT(chap_timeout, ss);
348 ok = (*verifier)(name, ss->name, id, ss->digest,
349 ss->challenge + PPP_HDRLEN + CHAP_HDRLEN,
350 response, ss->message, sizeof(ss->message));
352 ss->flags |= AUTH_FAILED;
355 } else if ((ss->flags & AUTH_DONE) == 0)
361 mlen = strlen(ss->message);
363 p[0] = (ss->flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
368 memcpy(p + CHAP_HDRLEN, ss->message, mlen);
371 if (ss->flags & CHALLENGE_VALID) {
372 ss->flags &= ~CHALLENGE_VALID;
373 if (!(ss->flags & AUTH_DONE) && !(ss->flags & AUTH_FAILED)) {
385 ss->flags |= AUTH_FAILED;
389 if (ss->flags & AUTH_FAILED) {
392 if ((ss->flags & AUTH_DONE) == 0)
394 ss->digest->code,
397 ss->flags |= TIMEOUT_PENDING;
398 TIMEOUT(chap_timeout, ss,
402 ss->flags |= AUTH_DONE;
533 struct chap_server_state *ss = &server;
551 chap_handle_response(ss, id, pkt, len);
564 struct chap_server_state *ss = &server;
566 if (ss->flags & TIMEOUT_PENDING) {
567 ss->flags &= ~TIMEOUT_PENDING;
568 UNTIMEOUT(chap_timeout, ss);
570 if (ss->flags & AUTH_STARTED) {
571 ss->flags = 0;