X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=4271af687102dc62e3c2e3b47d3fc8ab1d70d0f8;hb=733c00a6ce0244ba5003f4f71a014db8200a30fe;hp=22941af2249e2e829097f751feb9885450825a63;hpb=b5edacdfeec0ff65e9a365324992214f056f46d0;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 22941af..4271af6 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.115 2008/06/15 06:56:12 paulus Exp $" +#define RCSID "$Id: auth.c,v 1.117 2008/07/01 12:27:56 paulus Exp $" #include #include @@ -553,12 +553,11 @@ link_required(unit) void start_link(unit) int unit; { - char *msg; - + status = EXIT_CONNECT_FAILED; new_phase(PHASE_SERIALCONN); + hungup = 0; devfd = the_channel->connect(); - msg = "Connect script failed"; if (devfd < 0) goto fail; @@ -571,7 +570,6 @@ void start_link(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; @@ -668,9 +666,11 @@ link_terminated(unit) (*the_channel->cleanup)(); if (doing_multilink && multilink_master) { - if (!bundle_terminating) + if (!bundle_terminating) { new_phase(PHASE_MASTER); - else + if (master_detach && !detached) + detach(); + } else mp_bundle_terminated(); } else new_phase(PHASE_DEAD); @@ -1140,7 +1140,6 @@ static void check_maxoctets(arg) void *arg; { - int diff; unsigned int used; update_link_stats(ifunit); @@ -1161,8 +1160,7 @@ check_maxoctets(arg) used = link_stats.bytes_in+link_stats.bytes_out; break; } - diff = maxoctets - used; - if(diff < 0) { + if (used > maxoctets) { notice("Traffic limit reached. Limit: %u Used: %u", maxoctets, used); status = EXIT_TRAFFIC_LIMIT; lcp_close(0, "Traffic limit"); @@ -1443,9 +1441,11 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) } if (secret[0] != 0 && !login_secret) { /* password given in pap-secrets - must match */ - if ((cryptpap || strcmp(passwd, secret) != 0) - && strcmp(crypt(passwd, secret), secret) != 0) - ret = UPAP_AUTHNAK; + if (cryptpap || strcmp(passwd, secret) != 0) { + char *cbuf = crypt(passwd, secret); + if (!cbuf || strcmp(cbuf, secret) != 0) + ret = UPAP_AUTHNAK; + } } } fclose(f);