Lines Matching refs:u
127 upap_state *u = &upap[unit]; local
129 u->us_unit = unit;
130 u->us_user = NULL;
131 u->us_userlen = 0;
132 u->us_passwd = NULL;
133 u->us_passwdlen = 0;
134 u->us_clientstate = UPAPCS_INITIAL;
135 u->us_serverstate = UPAPSS_INITIAL;
136 u->us_id = 0;
137 u->us_timeouttime = UPAP_DEFTIMEOUT;
138 u->us_maxtransmits = 10;
139 u->us_reqtimeout = UPAP_DEFREQTIME;
153 upap_state *u = &upap[unit]; local
156 u->us_user = user;
157 u->us_userlen = strlen(user);
158 u->us_passwd = password;
159 u->us_passwdlen = strlen(password);
160 u->us_transmits = 0;
163 if (u->us_clientstate == UPAPCS_INITIAL ||
164 u->us_clientstate == UPAPCS_PENDING) {
165 u->us_clientstate = UPAPCS_PENDING;
169 upap_sauthreq(u); /* Start protocol */
182 upap_state *u = &upap[unit]; local
185 if (u->us_serverstate == UPAPSS_INITIAL ||
186 u->us_serverstate == UPAPSS_PENDING) {
187 u->us_serverstate = UPAPSS_PENDING;
191 u->us_serverstate = UPAPSS_LISTEN;
192 if (u->us_reqtimeout > 0)
193 TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
204 upap_state *u = (upap_state *) arg; local
206 if (u->us_clientstate != UPAPCS_AUTHREQ)
209 if (u->us_transmits >= u->us_maxtransmits) {
212 u->us_clientstate = UPAPCS_BADAUTH;
213 auth_withpeer_fail(u->us_unit, PPP_PAP);
217 upap_sauthreq(u); /* Send Authenticate-Request */
228 upap_state *u = (upap_state *) arg; local
230 if (u->us_serverstate != UPAPSS_LISTEN)
233 auth_peer_fail(u->us_unit, PPP_PAP);
234 u->us_serverstate = UPAPSS_BADAUTH;
247 upap_state *u = &upap[unit]; local
249 if (u->us_clientstate == UPAPCS_INITIAL)
250 u->us_clientstate = UPAPCS_CLOSED;
251 else if (u->us_clientstate == UPAPCS_PENDING) {
252 upap_sauthreq(u); /* send an auth-request */
255 if (u->us_serverstate == UPAPSS_INITIAL)
256 u->us_serverstate = UPAPSS_CLOSED;
257 else if (u->us_serverstate == UPAPSS_PENDING) {
258 u->us_serverstate = UPAPSS_LISTEN;
259 if (u->us_reqtimeout > 0)
260 TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
274 upap_state *u = &upap[unit]; local
276 if (u->us_clientstate == UPAPCS_AUTHREQ) /* Timeout pending? */
277 UNTIMEOUT(upap_timeout, u); /* Cancel timeout */
278 if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0)
279 UNTIMEOUT(upap_reqtimeout, u);
281 u->us_clientstate = UPAPCS_INITIAL;
282 u->us_serverstate = UPAPSS_INITIAL;
295 upap_state *u = &upap[unit]; local
297 if (u->us_clientstate == UPAPCS_AUTHREQ) {
301 if (u->us_serverstate == UPAPSS_LISTEN) {
318 upap_state *u = &upap[unit]; local
350 upap_rauthreq(u, inp, id, len);
354 upap_rauthack(u, inp, id, len);
358 upap_rauthnak(u, inp, id, len);
371 upap_rauthreq(u, inp, id, len) in upap_rauthreq() argument
372 upap_state *u; in upap_rauthreq()
384 if (u->us_serverstate < UPAPSS_LISTEN)
391 if (u->us_serverstate == UPAPSS_OPEN) {
392 upap_sresp(u, UPAP_AUTHACK, id, "", 0); /* return auth-ack */
395 if (u->us_serverstate == UPAPSS_BADAUTH) {
396 upap_sresp(u, UPAP_AUTHNAK, id, "", 0); /* return auth-nak */
425 retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd,
445 upap_sresp(u, retcode, id, msg, msglen);
451 u->us_serverstate = UPAPSS_OPEN;
453 auth_peer_success(u->us_unit, PPP_PAP, 0, ruser, ruserlen);
455 u->us_serverstate = UPAPSS_BADAUTH;
457 auth_peer_fail(u->us_unit, PPP_PAP);
460 if (u->us_reqtimeout > 0)
461 UNTIMEOUT(upap_reqtimeout, u);
469 upap_rauthack(u, inp, id, len) in upap_rauthack() argument
470 upap_state *u; in upap_rauthack()
478 if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
499 u->us_clientstate = UPAPCS_OPEN;
502 auth_withpeer_success(u->us_unit, PPP_PAP, 0);
510 upap_rauthnak(u, inp, id, len) in upap_rauthnak() argument
511 upap_state *u; in upap_rauthnak()
519 if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
540 u->us_clientstate = UPAPCS_BADAUTH;
543 auth_withpeer_fail(u->us_unit, PPP_PAP);
551 upap_sauthreq(u) in upap_sauthreq() argument
552 upap_state *u; in upap_sauthreq()
558 u->us_userlen + u->us_passwdlen;
564 PUTCHAR(++u->us_id, outp);
566 PUTCHAR(u->us_userlen, outp);
567 BCOPY(u->us_user, outp, u->us_userlen);
568 INCPTR(u->us_userlen, outp);
569 PUTCHAR(u->us_passwdlen, outp);
570 BCOPY(u->us_passwd, outp, u->us_passwdlen);
572 output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
574 TIMEOUT(upap_timeout, u, u->us_timeouttime);
575 ++u->us_transmits;
576 u->us_clientstate = UPAPCS_AUTHREQ;
584 upap_sresp(u, code, id, msg, msglen) in upap_sresp() argument
585 upap_state *u; in upap_sresp()
602 output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);