X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=7b269b805b2b7eb06ec9792c7e24c222a6c4b3c8;hb=8edb889b753056a691a3e4b217a110a35f9fdedb;hp=424b3e54c1709156ad0812a8540863b2ca7d50c0;hpb=8f09b151a39f156131f85b7d018443d81c7e6308;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 424b3e5..7b269b8 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.114 2008/06/15 06:53:06 paulus Exp $" +#define RCSID "$Id: auth.c,v 1.117 2008/07/01 12:27:56 paulus Exp $" #include #include @@ -190,6 +190,11 @@ int (*null_auth_hook) __P((struct wordlist **paddrs, int (*allowed_address_hook) __P((u_int32_t addr)) = NULL; +#ifdef HAVE_MULTILINK +/* Hook for plugin to hear when an interface joins a multilink bundle */ +void (*multilink_join_hook) __P((void)) = NULL; +#endif + /* A notifier for when the peer has authenticated itself, and we are proceeding to the network phase. */ struct notifier *auth_up_notifier = NULL; @@ -548,12 +553,10 @@ link_required(unit) void start_link(unit) int unit; { - char *msg; - new_phase(PHASE_SERIALCONN); + hungup = 0; devfd = the_channel->connect(); - msg = "Connect script failed"; if (devfd < 0) goto fail; @@ -566,7 +569,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; @@ -855,6 +857,8 @@ start_networks(unit) #ifdef HAVE_MULTILINK if (multilink) { if (mp_join_bundle()) { + if (multilink_join_hook) + (*multilink_join_hook)(); if (updetach && !nodetach) detach(); return; @@ -1133,7 +1137,6 @@ static void check_maxoctets(arg) void *arg; { - int diff; unsigned int used; update_link_stats(ifunit); @@ -1154,8 +1157,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"); @@ -1436,9 +1438,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);