67static bool hide_password = 1;
72static option_t pap_option_list[] = {
73 {
"hide-password", o_bool, &hide_password,
74 "Don't output passwords to log", 1 },
75 {
"show-password", o_bool, &hide_password,
76 "Show password string in debug log messages", 0 },
77 {
"pap-restart", o_int, &upap[0].us_timeouttime,
78 "Set retransmit timeout for PAP" },
79 {
"pap-max-authreq", o_int, &upap[0].us_maxtransmits,
80 "Set max number of transmissions for auth-reqs" },
81 {
"pap-timeout", o_int, &upap[0].us_reqtimeout,
82 "Set time limit for peer PAP authentication" },
90static void upap_init (
int);
91static void upap_lowerup (
int);
92static void upap_lowerdown (
int);
93static void upap_input (
int,
u_char *,
int);
94static void upap_protrej (
int);
95#if PPP_ADDITIONAL_CALLBACKS
96static int upap_printpkt (
u_char *,
int,
void (*)(
void *,
char *, ...),
void *);
99struct protent pap_protent = {
108#if PPP_ADDITIONAL_CALLBACKS
114#if PPP_ADDITIONAL_CALLBACKS
121upap_state upap[NUM_PPP];
123static void upap_timeout (
void *);
124static void upap_reqtimeout(
void *);
125static void upap_rauthreq (upap_state *,
u_char *,
u_char,
int);
126static void upap_rauthack (upap_state *,
u_char *,
int,
int);
127static void upap_rauthnak (upap_state *,
u_char *,
int,
int);
128static void upap_sauthreq (upap_state *);
129static void upap_sresp (upap_state *,
u_char,
u_char,
char *,
int);
138 upap_state *
u = &upap[
unit];
146 u->us_clientstate = UPAPCS_INITIAL;
147 u->us_serverstate = UPAPSS_INITIAL;
149 u->us_timeouttime = UPAP_DEFTIMEOUT;
150 u->us_maxtransmits = 10;
151 u->us_reqtimeout = UPAP_DEFREQTIME;
162 upap_state *
u = &upap[
unit];
176 if (
u->us_clientstate == UPAPCS_INITIAL ||
177 u->us_clientstate == UPAPCS_PENDING) {
178 u->us_clientstate = UPAPCS_PENDING;
192upap_authpeer(
int unit)
194 upap_state *
u = &upap[
unit];
197 if (
u->us_serverstate == UPAPSS_INITIAL ||
198 u->us_serverstate == UPAPSS_PENDING) {
199 u->us_serverstate = UPAPSS_PENDING;
203 u->us_serverstate = UPAPSS_LISTEN;
204 if (
u->us_reqtimeout > 0) {
205 TIMEOUT(upap_reqtimeout,
u,
u->us_reqtimeout);
213upap_timeout(
void *
arg)
215 upap_state *
u = (upap_state *)
arg;
218 u->us_unit,
u->us_timeouttime,
u->us_clientstate));
220 if (
u->us_clientstate != UPAPCS_AUTHREQ) {
225 if (
u->us_transmits >=
u->us_maxtransmits) {
228 u->us_clientstate = UPAPCS_BADAUTH;
241upap_reqtimeout(
void *
arg)
243 upap_state *
u = (upap_state *)
arg;
245 if (
u->us_serverstate != UPAPSS_LISTEN) {
250 u->us_serverstate = UPAPSS_BADAUTH;
260upap_lowerup(
int unit)
262 upap_state *
u = &upap[
unit];
266 if (
u->us_clientstate == UPAPCS_INITIAL) {
267 u->us_clientstate = UPAPCS_CLOSED;
268 }
else if (
u->us_clientstate == UPAPCS_PENDING) {
273 if (
u->us_serverstate == UPAPSS_INITIAL) {
274 u->us_serverstate = UPAPSS_CLOSED;
275 }
else if (
u->us_serverstate == UPAPSS_PENDING) {
276 u->us_serverstate = UPAPSS_LISTEN;
277 if (
u->us_reqtimeout > 0) {
278 TIMEOUT(upap_reqtimeout,
u,
u->us_reqtimeout);
290upap_lowerdown(
int unit)
292 upap_state *
u = &upap[
unit];
296 if (
u->us_clientstate == UPAPCS_AUTHREQ) {
297 UNTIMEOUT(upap_timeout,
u);
299 if (
u->us_serverstate == UPAPSS_LISTEN &&
u->us_reqtimeout > 0) {
300 UNTIMEOUT(upap_reqtimeout,
u);
303 u->us_clientstate = UPAPCS_INITIAL;
304 u->us_serverstate = UPAPSS_INITIAL;
314upap_protrej(
int unit)
316 upap_state *
u = &upap[
unit];
318 if (
u->us_clientstate == UPAPCS_AUTHREQ) {
322 if (
u->us_serverstate == UPAPSS_LISTEN) {
323 UPAPDEBUG(
LOG_ERR, (
"PAP authentication of peer failed (protocol-reject)\n"));
326 upap_lowerdown(
unit);
336 upap_state *
u = &upap[
unit];
346 if (
l < (
int)UPAP_HEADERLEN) {
353 if (
len < (
int)UPAP_HEADERLEN) {
361 len -= UPAP_HEADERLEN;
368 upap_rauthreq(
u, inp,
id,
len);
372 upap_rauthack(
u, inp,
id,
len);
376 upap_rauthnak(
u, inp,
id,
len);
392 u_char ruserlen, rpasswdlen;
393 char *ruser, *rpasswd;
400 if (
u->us_serverstate < UPAPSS_LISTEN) {
408 if (
u->us_serverstate == UPAPSS_OPEN) {
409 upap_sresp(
u, UPAP_AUTHACK,
id,
"", 0);
412 if (
u->us_serverstate == UPAPSS_BADAUTH) {
413 upap_sresp(
u, UPAP_AUTHNAK,
id,
"", 0);
424 GETCHAR(ruserlen, inp);
430 ruser = (
char *) inp;
431 INCPTR(ruserlen, inp);
432 GETCHAR(rpasswdlen, inp);
433 if (
len < rpasswdlen) {
437 rpasswd = (
char *) inp;
442 retcode =
check_passwd(
u->us_unit, ruser, ruserlen, rpasswd, rpasswdlen, &
msg, &msglen);
444 BZERO(rpasswd, rpasswdlen);
446 upap_sresp(
u, retcode,
id,
msg, msglen);
448 if (retcode == UPAP_AUTHACK) {
449 u->us_serverstate = UPAPSS_OPEN;
452 u->us_serverstate = UPAPSS_BADAUTH;
456 if (
u->us_reqtimeout > 0) {
457 UNTIMEOUT(upap_reqtimeout,
u);
466upap_rauthack(upap_state *
u,
u_char *inp,
int id,
int len)
475 if (
u->us_clientstate != UPAPCS_AUTHREQ) {
486 GETCHAR(msglen, inp);
494 PRINTMSG(
msg, msglen);
497 UNTIMEOUT(upap_timeout,
u);
498 u->us_clientstate = UPAPCS_OPEN;
508upap_rauthnak(upap_state *
u,
u_char *inp,
int id,
int len)
517 if (
u->us_clientstate != UPAPCS_AUTHREQ) {
527 GETCHAR(msglen, inp);
535 PRINTMSG(
msg, msglen);
539 u->us_clientstate = UPAPCS_BADAUTH;
550upap_sauthreq(upap_state *
u)
555 outlen = UPAP_HEADERLEN + 2 *
sizeof (
u_char)
556 +
u->us_userlen +
u->us_passwdlen;
557 outp = outpacket_buf[
u->us_unit];
559 MAKEHEADER(outp, PPP_PAP);
561 PUTCHAR(UPAP_AUTHREQ, outp);
562 PUTCHAR(++
u->us_id, outp);
563 PUTSHORT(outlen, outp);
564 PUTCHAR(
u->us_userlen, outp);
565 BCOPY(
u->us_user, outp,
u->us_userlen);
566 INCPTR(
u->us_userlen, outp);
567 PUTCHAR(
u->us_passwdlen, outp);
568 BCOPY(
u->us_passwd, outp,
u->us_passwdlen);
570 pppWrite(
u->us_unit, outpacket_buf[
u->us_unit], outlen + PPP_HDRLEN);
574 TIMEOUT(upap_timeout,
u,
u->us_timeouttime);
576 u->us_clientstate = UPAPCS_AUTHREQ;
589 outlen = UPAP_HEADERLEN +
sizeof (
u_char) + msglen;
590 outp = outpacket_buf[
u->us_unit];
591 MAKEHEADER(outp, PPP_PAP);
595 PUTSHORT(outlen, outp);
596 PUTCHAR(msglen, outp);
597 BCOPY(
msg, outp, msglen);
598 pppWrite(
u->us_unit, outpacket_buf[
u->us_unit], outlen + PPP_HDRLEN);
603#if PPP_ADDITIONAL_CALLBACKS
604static char *upap_codenames[] = {
605 "AuthReq",
"AuthAck",
"AuthNak"
611static int upap_printpkt(
614 void (*printer) (
void *,
char *, ...),
ACPI_SIZE strlen(const char *String)
#define LWIP_UNUSED_ARG(x)
void user(int argc, const char *argv[])
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
void auth_peer_success(int, u16_t, char *, int)
void auth_peer_fail(int, u16_t)
void auth_withpeer_fail(int, u16_t)
u_char check_passwd(int, char *, int, char *, int, char **, int *)
void auth_withpeer_success(int, u16_t)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
png_const_structrp png_const_inforp int * unit