Lines Matching refs:u

137     upap_state *u = &upap[unit];  local
139 u->us_unit = unit;
140 u->us_user = NULL;
141 u->us_userlen = 0;
142 u->us_passwd = NULL;
143 u->us_clientstate = UPAPCS_INITIAL;
144 u->us_serverstate = UPAPSS_INITIAL;
145 u->us_id = 0;
146 u->us_timeouttime = UPAP_DEFTIMEOUT;
147 u->us_maxtransmits = 10;
148 u->us_reqtimeout = UPAP_DEFREQTIME;
149 u->us_maxreceives = 3;
150 u->us_msg = "";
151 u->us_msglen = 0;
165 upap_state *u = &upap[unit]; local
168 u->us_user = user;
169 u->us_userlen = strlen(user);
170 u->us_passwd = password;
171 u->us_transmits = 0;
174 if (u->us_clientstate == UPAPCS_INITIAL ||
175 u->us_clientstate == UPAPCS_PENDING) {
176 u->us_clientstate = UPAPCS_PENDING;
180 upap_sauthreq(u); /* Start protocol */
193 upap_state *u = &upap[unit]; local
196 if (u->us_serverstate == UPAPSS_INITIAL ||
197 u->us_serverstate == UPAPSS_PENDING) {
198 u->us_serverstate = UPAPSS_PENDING;
202 u->us_serverstate = UPAPSS_LISTEN;
203 u->us_receives = 0;
204 if (u->us_reqtimeout > 0)
205 TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
216 upap_state *u = (upap_state *) arg; local
218 if (u->us_clientstate != UPAPCS_AUTHREQ)
221 if (u->us_transmits >= u->us_maxtransmits) {
223 error("No response to %d PAP Authenticate-Requests", u->us_transmits);
224 u->us_clientstate = UPAPCS_BADAUTH;
225 auth_withpeer_fail(u->us_unit, PPP_PAP);
229 upap_sauthreq(u); /* Send Authenticate-Request */
240 upap_state *u = (upap_state *) arg; local
242 if (u->us_serverstate != UPAPSS_LISTEN)
245 auth_peer_fail(u->us_unit, PPP_PAP);
246 u->us_serverstate = UPAPSS_BADAUTH;
259 upap_state *u = &upap[unit]; local
261 if (u->us_clientstate == UPAPCS_INITIAL)
262 u->us_clientstate = UPAPCS_CLOSED;
263 else if (u->us_clientstate == UPAPCS_PENDING) {
264 upap_sauthreq(u); /* send an auth-request */
267 if (u->us_serverstate == UPAPSS_INITIAL)
268 u->us_serverstate = UPAPSS_CLOSED;
269 else if (u->us_serverstate == UPAPSS_PENDING) {
270 u->us_serverstate = UPAPSS_LISTEN;
271 if (u->us_reqtimeout > 0)
272 TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
286 upap_state *u = &upap[unit]; local
289 if (u->us_clientstate == UPAPCS_AUTHREQ && u->us_timeouttime > 0)
290 UNTIMEOUT(upap_timeout, u);
291 if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0)
292 UNTIMEOUT(upap_reqtimeout, u);
294 u->us_clientstate = UPAPCS_INITIAL;
295 u->us_serverstate = UPAPSS_INITIAL;
308 upap_state *u = &upap[unit]; local
310 if (u->us_clientstate == UPAPCS_AUTHREQ) {
314 if (u->us_serverstate == UPAPSS_LISTEN) {
331 upap_state *u = &upap[unit]; local
360 upap_rauthreq(u, inp, id, len);
364 upap_rauthack(u, inp, id, len);
368 upap_rauthnak(u, inp, id, len);
382 upap_rauthreq(u, inp, id, len) in upap_rauthreq() argument
383 upap_state *u; in upap_rauthreq()
394 if (u->us_serverstate < UPAPSS_LISTEN) {
396 pap_sstate(u->us_serverstate));
404 if (u->us_serverstate == UPAPSS_OPEN) {
406 upap_sresp(u, UPAP_AUTHACK, id, u->us_msg, u->us_msglen);
409 if (u->us_serverstate == UPAPSS_BADAUTH) {
411 upap_sresp(u, UPAP_AUTHNAK, id, u->us_msg, u->us_msglen);
440 retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd,
447 u->us_msg = msg;
448 u->us_msglen = msglen;
449 upap_sresp(u, retcode, id, u->us_msg, u->us_msglen);
452 u->us_serverstate = UPAPSS_OPEN;
453 auth_peer_success(u->us_unit, PPP_PAP, ruser, ruserlen);
454 } else if (++u->us_receives >= u->us_maxreceives) {
455 u->us_serverstate = UPAPSS_BADAUTH;
456 auth_peer_fail(u->us_unit, PPP_PAP);
462 if (u->us_reqtimeout > 0)
463 UNTIMEOUT(upap_reqtimeout, u);
472 upap_rauthack(u, inp, id, len) in upap_rauthack() argument
473 upap_state *u; in upap_rauthack()
481 if (u->us_clientstate != UPAPCS_AUTHREQ) {
483 pap_cstate(u->us_clientstate));
487 if (id != u->us_id) {
489 id, u->us_id);
493 if (u->us_timeouttime > 0)
494 UNTIMEOUT(upap_timeout, u);
514 u->us_clientstate = UPAPCS_OPEN;
516 auth_withpeer_success(u->us_unit, PPP_PAP);
525 upap_rauthnak(u, inp, id, len) in upap_rauthnak() argument
526 upap_state *u; in upap_rauthnak()
534 if (u->us_clientstate != UPAPCS_AUTHREQ) {
536 pap_cstate(u->us_clientstate));
540 if (id != u->us_id) {
542 id, u->us_id);
546 if (u->us_timeouttime > 0)
547 UNTIMEOUT(upap_timeout, u);
569 if (u->us_transmits < u->us_maxtransmits) {
571 upap_sauthreq(u);
580 u->us_clientstate = UPAPCS_BADAUTH;
583 auth_withpeer_fail(u->us_unit, PPP_PAP);
591 upap_sauthreq(u) in upap_sauthreq() argument
592 upap_state *u; in upap_sauthreq()
601 outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) + u->us_userlen + pwlen;
607 PUTCHAR(++u->us_id, outp);
609 PUTCHAR(u->us_userlen, outp);
610 BCOPY(u->us_user, outp, u->us_userlen);
611 INCPTR(u->us_userlen, outp);
613 BCOPY(u->us_passwd, outp, pwlen);
615 output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
617 if (u->us_timeouttime > 0)
618 TIMEOUT(upap_timeout, u, u->us_timeouttime);
619 ++u->us_transmits;
620 u->us_clientstate = UPAPCS_AUTHREQ;
628 upap_sresp(u, code, id, msg, msglen) in upap_sresp() argument
629 upap_state *u; in upap_sresp()
646 output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);