X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=a6f7d1cb09ad1348f504f6eb476c75bd60a6bde3;hb=e227ca9c99af2e3320e1a41be3fd140429c2a995;hp=8a8b2fb83d44a4a74c6b0c5a2778291687340c8a;hpb=637346ba24c289c5a0485651c05baa3f7c22a6b8;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 8a8b2fb..a6f7d1c 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -68,7 +68,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: auth.c,v 1.101 2004/11/12 10:30:51 paulus Exp $" +#define RCSID "$Id: auth.c,v 1.108 2005/08/28 05:22:48 paulus Exp $" #include #include @@ -526,15 +526,25 @@ set_permitted_number(argv) /* * An Open on LCP has requested a change from Dead to Establish phase. - * Do what's necessary to bring the physical layer up. */ void link_required(unit) int unit; { +} + +/* + * Bring the link up to the point of being able to do ppp. + */ +void start_link(unit) + int unit; +{ + char *msg; + new_phase(PHASE_SERIALCONN); devfd = the_channel->connect(); + msg = "Connect script failed"; if (devfd < 0) goto fail; @@ -547,6 +557,7 @@ link_required(unit) * gives us. Thus we don't need the tdb_writelock/tdb_writeunlock. */ fd_ppp = the_channel->establish_ppp(devfd); + msg = "ppp establishment failed"; if (fd_ppp < 0) { status = EXIT_FATAL_ERROR; goto disconnect; @@ -580,7 +591,6 @@ link_required(unit) new_phase(PHASE_DEAD); if (the_channel->cleanup) (*the_channel->cleanup)(); - } /* @@ -642,6 +652,8 @@ link_terminated(unit) the_channel->disconnect(); devfd = -1; } + if (the_channel->cleanup) + (*the_channel->cleanup)(); if (doing_multilink && multilink_master) { if (!bundle_terminating) @@ -984,10 +996,12 @@ auth_withpeer_success(unit, protocol, prot_flavor) int unit, protocol, prot_flavor; { int bit; + const char *prot = ""; switch (protocol) { case PPP_CHAP: bit = CHAP_WITHPEER; + prot = "CHAP"; switch (prot_flavor) { case CHAP_MD5: bit |= CHAP_MD5_WITHPEER; @@ -1006,15 +1020,19 @@ auth_withpeer_success(unit, protocol, prot_flavor) if (passwd_from_file) BZERO(passwd, MAXSECRETLEN); bit = PAP_WITHPEER; + prot = "PAP"; break; case PPP_EAP: bit = EAP_WITHPEER; + prot = "EAP"; break; default: warn("auth_withpeer_success: unknown protocol %x", protocol); bit = 0; } + notice("%s authentication succeeded", prot); + /* Save the authentication method for later. */ auth_done[unit] |= bit; @@ -1648,6 +1666,7 @@ plogin(user, passwd, msg) static void plogout() { + char *tty; #ifdef USE_PAM int pam_error; @@ -1658,14 +1677,12 @@ plogout() } /* Apparently the pam stuff does closelog(). */ reopen_log(); -#else /* ! USE_PAM */ - char *tty; +#endif /* USE_PAM */ tty = devnam; if (strncmp(tty, "/dev/", 5) == 0) tty += 5; logwtmp(tty, "", ""); /* Wipe out utmp logout entry */ -#endif /* ! USE_PAM */ logged_in = 0; } @@ -2543,5 +2560,5 @@ auth_script(script) argv[5] = strspeed; argv[6] = NULL; - auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL); + auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL, 0); }