]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/auth.c
Repaired handling of multiple mblks on rput side.
[ppp.git] / pppd / auth.c
index a1e9fd26a8ff8e2293a065b329d46482338b44a3..1858a06095c676da8207b53da31ef73e082f21ec 100644 (file)
@@ -32,7 +32,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.78 2002/07/13 06:24:36 kad Exp $"
+#define RCSID  "$Id: auth.c,v 1.83 2002/09/15 12:51:05 paulus Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -228,14 +228,14 @@ option_t auth_options[] = {
     { "auth", o_bool, &auth_required,
       "Require authentication from peer", OPT_PRIO | 1 },
     { "noauth", o_bool, &auth_required,
-      "Don't require peer to authenticate", OPT_PRIOSUB | OPT_PRIV | OPT_A2COPY,
+      "Don't require peer to authenticate", OPT_PRIOSUB | OPT_PRIV,
       &allow_any_ip },
     { "require-pap", o_bool, &lcp_wantoptions[0].neg_upap,
       "Require PAP authentication from peer",
-      OPT_PRIOSUB | OPT_A2COPY | 1, &auth_required },
+      OPT_PRIOSUB | 1, &auth_required },
     { "+pap", o_bool, &lcp_wantoptions[0].neg_upap,
       "Require PAP authentication from peer",
-      OPT_ALIAS | OPT_PRIOSUB | OPT_A2COPY | 1, &auth_required },
+      OPT_ALIAS | OPT_PRIOSUB | 1, &auth_required },
     { "require-chap", o_bool, &lcp_wantoptions[0].neg_chap,
       "Require CHAP authentication from peer",
       OPT_PRIOSUB | OPT_A2COPY | OPT_A3OR | MDTYPE_MD5,
@@ -608,59 +608,62 @@ void
 start_networks(unit)
     int unit;
 {
-    static int started = 0;
     int i;
     struct protent *protp;
     int ecp_required, mppe_required;
 
-    if (!started) {
-       started = 1;
-       new_phase(PHASE_NETWORK);
+    new_phase(PHASE_NETWORK);
 
 #ifdef HAVE_MULTILINK
-       if (multilink) {
-           if (mp_join_bundle()) {
-               if (updetach && !nodetach)
-                   detach();
-               return;
-           }
+    if (multilink) {
+       if (mp_join_bundle()) {
+           if (updetach && !nodetach)
+               detach();
+           return;
        }
+    }
 #endif /* HAVE_MULTILINK */
 
 #ifdef PPP_FILTER
-       if (!demand)
-           set_filters(&pass_filter, &active_filter);
+    if (!demand)
+       set_filters(&pass_filter, &active_filter);
 #endif
-       /* Start CCP and ECP */
-       for (i = 0; (protp = protocols[i]) != NULL; ++i)
-           if ((protp->protocol == PPP_ECP || protp->protocol == PPP_CCP)
-               && protp->enabled_flag && protp->open != NULL)
-               (*protp->open)(0);
-    }
+    /* Start CCP and ECP */
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+       if ((protp->protocol == PPP_ECP || protp->protocol == PPP_CCP)
+           && protp->enabled_flag && protp->open != NULL)
+           (*protp->open)(0);
 
     /*
-     * Bring up other network protocols after encryption has completed.
-     * OPENED here merely means that negotiation has completed.  It is
-     * up to the protocol to correctly terminate or disable LCP/NCP 
-     * based on the result of the negotiation.
+     * Bring up other network protocols iff encryption is not required.
      */
     ecp_required = ecp_gotoptions[unit].required;
     mppe_required = ccp_gotoptions[unit].mppe;
-    if ((!ecp_required && !mppe_required)
-       || (ecp_required && ecp_fsm[unit].state == OPENED)
-       || (mppe_required && ccp_fsm[unit].state == OPENED)) {
-       for (i = 0; (protp = protocols[i]) != NULL; ++i)
-           if (protp->protocol < 0xC000
-               && protp->protocol != PPP_CCP && protp->protocol != PPP_ECP
-               && protp->enabled_flag && protp->open != NULL) {
-               (*protp->open)(0);
-               ++num_np_open;
-           }
+    if (!ecp_required && !mppe_required)
+       continue_networks(unit);
+}
 
-       if (num_np_open == 0)
-           /* nothing to do */
-           lcp_close(0, "No network protocols running");
-    }
+void
+continue_networks(unit)
+    int unit;
+{
+    int i;
+    struct protent *protp;
+
+    /*
+     * Start the "real" network protocols.
+     */
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+       if (protp->protocol < 0xC000
+           && protp->protocol != PPP_CCP && protp->protocol != PPP_ECP
+           && protp->enabled_flag && protp->open != NULL) {
+           (*protp->open)(0);
+           ++num_np_open;
+       }
+
+    if (num_np_open == 0)
+       /* nothing to do */
+       lcp_close(0, "No network protocols running");
 }
 
 /*
@@ -893,7 +896,8 @@ check_maxoctets(arg)
        case PPP_OCTETS_DIRECTION_OUT:
            used = link_stats.bytes_out;
            break;
-       case PPP_OCTETS_DIRECTION_MAX:
+       case PPP_OCTETS_DIRECTION_MAXOVERAL:
+       case PPP_OCTETS_DIRECTION_MAXSESSION:
            used = (link_stats.bytes_in > link_stats.bytes_out) ? link_stats.bytes_in : link_stats.bytes_out;
            break;
        default:
@@ -1354,7 +1358,7 @@ plogin(user, passwd, msg)
     tty = devnam;
     if (strncmp(tty, "/dev/", 5) == 0)
        tty += 5;
-    logwtmp(tty, user, remote_name);           /* Add wtmp login entry */
+    logwtmp(tty, user, ifname);                /* Add wtmp login entry */
 
 #if defined(_PATH_LASTLOG) && !defined(USE_PAM)
     if (pw != (struct passwd *)NULL) {