]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/auth.c
Some tiny fixes (minor castings) to remove annoying compiler warnings
[ppp.git] / pppd / auth.c
index 189e74dd9c9ed772fa86ce801e437976ba326a5d..4ca883ca8b7081d4a1437466bf1f5d2e3a249d24 100644 (file)
@@ -32,7 +32,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.59 1999/11/20 05:11:01 paulus Exp $"
+#define RCSID  "$Id: auth.c,v 1.65 2000/04/15 01:27:10 masputra Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -126,6 +126,9 @@ int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
                          struct wordlist **paddrs,
                          struct wordlist **popts)) = NULL;
 
+/* Hook for a plugin to know about the PAP user logout */
+void (*pap_logout_hook) __P((void)) = NULL;
+
 /* Hook for a plugin to get the PAP password for authenticating us */
 int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL;
 
@@ -226,14 +229,14 @@ option_t auth_options[] = {
       "Use system password database for PAP", 1 },
     { "papcrypt", o_bool, &cryptpap,
       "PAP passwords are encrypted", 1 },
-    { "+ua", o_special, setupapfile,
+    { "+ua", o_special, (void *)setupapfile,
       "Get PAP user and password from file" },
     { "password", o_string, passwd,
       "Password for authenticating us to the peer", OPT_STATIC,
       NULL, MAXSECRETLEN },
-    { "privgroup", o_special, privgroup,
+    { "privgroup", o_special, (void *)privgroup,
       "Allow group members to use privileged options", OPT_PRIV },
-    { "allow-ip", o_special, set_noauth_addr,
+    { "allow-ip", o_special, (void *)set_noauth_addr,
       "Set IP address(es) which can be used without authentication",
       OPT_PRIV },
     { NULL }
@@ -349,8 +352,12 @@ link_terminated(unit)
 {
     if (phase == PHASE_DEAD)
        return;
-    if (logged_in)
-       plogout();
+    if (pap_logout_hook) {
+       pap_logout_hook();
+    } else {
+       if (logged_in)
+           plogout();
+    }
     new_phase(PHASE_DEAD);
     notice("Connection terminated.");
 }
@@ -502,6 +509,17 @@ start_networks()
     struct protent *protp;
 
     new_phase(PHASE_NETWORK);
+
+#ifdef HAVE_MULTILINK
+    if (multilink) {
+       if (mp_join_bundle()) {
+           if (updetach && !nodetach)
+               detach();
+           return;
+       }
+    }
+#endif /* HAVE_MULTILINK */
+
 #if 0
     if (!demand)
        set_filters(&pass_filter, &active_filter);
@@ -563,7 +581,7 @@ auth_peer_success(unit, protocol, name, namelen)
        namelen = sizeof(peer_authname) - 1;
     BCOPY(name, peer_authname, namelen);
     peer_authname[namelen] = 0;
-    script_setenv("PEERNAME", peer_authname);
+    script_setenv("PEERNAME", peer_authname, 0);
 
     /*
      * If there is no more authentication still to be done,
@@ -1563,7 +1581,7 @@ auth_ip_addr(unit, addr)
     }
     if (auth_required)
        return 0;               /* no addresses authorized */
-    return allow_any_ip || !have_route_to(addr);
+    return allow_any_ip || privileged || !have_route_to(addr);
 }
 
 static int