]> git.ozlabs.org Git - ppp.git/commitdiff
syslog -> notice/error/etc.
authorPaul Mackerras <paulus@samba.org>
Tue, 16 Mar 1999 03:15:15 +0000 (03:15 +0000)
committerPaul Mackerras <paulus@samba.org>
Tue, 16 Mar 1999 03:15:15 +0000 (03:15 +0000)
use slprintf instead of sprintf
trimmed debug

pppd/auth.c
pppd/ccp.c
pppd/chap.c
pppd/chap_ms.c
pppd/demand.c
pppd/fsm.c
pppd/ipxcp.c
pppd/upap.c

index 0fbc9b92941293c0da3fc1434c8a8156b13d4346..3b0e24341292050657c63d99d37d70aab0989c9b 100644 (file)
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: auth.c,v 1.45 1999/03/12 06:07:14 paulus Exp $";
+static char rcsid[] = "$Id: auth.c,v 1.46 1999/03/16 03:15:12 paulus Exp $";
 #endif
 
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <syslog.h>
 #include <pwd.h>
 #include <grp.h>
 #include <string.h>
@@ -298,7 +297,7 @@ link_terminated(unit)
     if (logged_in)
        plogout();
     phase = PHASE_DEAD;
-    syslog(LOG_NOTICE, "Connection terminated.");
+    notice("Connection terminated.");
 }
 
 /*
@@ -359,7 +358,7 @@ link_established(unit)
         * of "" and a password of "".  If that's not OK, boot it out.
         */
        if (!wo->neg_upap || !null_login(unit)) {
-           syslog(LOG_WARNING, "peer refused to authenticate");
+           warn("peer refused to authenticate: terminating link");
            lcp_close(unit, "peer refused to authenticate");
            return;
        }
@@ -381,7 +380,7 @@ link_established(unit)
        if (passwd[0] == 0) {
            passwd_from_file = 1;
            if (!get_pap_passwd(passwd))
-               syslog(LOG_ERR, "No secret found for PAP login");
+               error("No secret found for PAP login");
        }
        upap_authwithpeer(unit, user, passwd);
        auth |= PAP_WITHPEER;
@@ -472,8 +471,7 @@ auth_peer_success(unit, protocol, name, namelen)
        bit = PAP_PEER;
        break;
     default:
-       syslog(LOG_WARNING, "auth_peer_success: unknown protocol %x",
-              protocol);
+       warn("auth_peer_success: unknown protocol %x", protocol);
        return;
     }
 
@@ -529,8 +527,7 @@ auth_withpeer_success(unit, protocol)
        bit = PAP_WITHPEER;
        break;
     default:
-       syslog(LOG_WARNING, "auth_peer_success: unknown protocol %x",
-              protocol);
+       warn("auth_withpeer_success: unknown protocol %x", protocol);
        bit = 0;
     }
 
@@ -616,7 +613,7 @@ check_idle(arg)
     itime = MIN(idle.xmit_idle, idle.recv_idle);
     if (itime >= idle_time_limit) {
        /* link is idle: shut it down. */
-       syslog(LOG_INFO, "Terminating connection due to lack of activity.");
+       info("Terminating connection due to lack of activity.");
        lcp_close(0, "Link inactive");
     } else {
        TIMEOUT(check_idle, NULL, idle_time_limit - itime);
@@ -630,7 +627,7 @@ static void
 connect_time_expired(arg)
     void *arg;
 {
-    syslog(LOG_INFO, "Connect time expired");
+    info("Connect time expired");
     lcp_close(0, "Connect time expired");      /* Close connection */
 }
 
@@ -766,7 +763,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen)
     ret = UPAP_AUTHACK;
     f = fopen(filename, "r");
     if (f == NULL) {
-       syslog(LOG_ERR, "Can't open PAP password file %s: %m", filename);
+       error("Can't open PAP password file %s: %m", filename);
        ret = UPAP_AUTHNAK;
 
     } else {
@@ -776,7 +773,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen)
                          secret, &addrs, filename) < 0
            || (secret[0] != 0 && (cryptpap || strcmp(passwd, secret) != 0)
                && strcmp(crypt(passwd, secret), secret) != 0)) {
-           syslog(LOG_WARNING, "PAP authentication failure for %s", user);
+           warn("PAP authentication failure for %s", user);
            ret = UPAP_AUTHNAK;
        }
        fclose(f);
@@ -785,7 +782,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen)
     if (uselogin && ret == UPAP_AUTHACK) {
        ret = plogin(user, passwd, msg, msglen);
        if (ret == UPAP_AUTHNAK) {
-           syslog(LOG_WARNING, "PAP login failure for %s", user);
+           warn("PAP login failure for %s", user);
        }
     }
 
@@ -799,8 +796,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg, msglen)
         * On 10'th, drop the connection.
         */
        if (attempts++ >= 10) {
-           syslog(LOG_WARNING, "%d LOGIN FAILURES ON %s, %s",
-                  attempts, devnam, user);
+           warn("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user);
            quit();
        }
        if (attempts > 3)
@@ -979,7 +975,7 @@ plogin(user, passwd, msg, msglen)
            || ((spwd->sp_max >= 0 && spwd->sp_max < 10000)
                && spwd->sp_lstchg >= 0
                && now >= spwd->sp_lstchg + spwd->sp_max)) {
-           syslog(LOG_WARNING, "Password for %s has expired", user);
+           warn("Password for %s has expired", user);
            return (UPAP_AUTHNAK);
        }
        pw->pw_passwd = spwd->sp_pwdp;
@@ -1026,7 +1022,7 @@ plogin(user, passwd, msg, msglen)
 
 #endif /* #ifdef USE_PAM */
 
-    syslog(LOG_INFO, "user %s logged in", user);
+    info("user %s logged in", user);
     logged_in = TRUE;
 
     return (UPAP_AUTHACK);
@@ -1234,7 +1230,7 @@ get_secret(unit, client, server, secret, secret_len, save_addrs)
 
     f = fopen(filename, "r");
     if (f == NULL) {
-       syslog(LOG_ERR, "Can't open chap secret file %s: %m", filename);
+       error("Can't open chap secret file %s: %m", filename);
        return 0;
     }
     check_access(f, filename);
@@ -1250,7 +1246,7 @@ get_secret(unit, client, server, secret, secret_len, save_addrs)
 
     len = strlen(secbuf);
     if (len > MAXSECRETLEN) {
-       syslog(LOG_ERR, "Secret for %s on %s is too long", client, server);
+       error("Secret for %s on %s is too long", client, server);
        len = MAXSECRETLEN;
     }
     BCOPY(secbuf, secret, len);
@@ -1351,9 +1347,8 @@ ip_addr_check(addr, addrs)
 
            bit_count = (int) strtol (ptr_mask+1, (char **) 0, 10);
            if (bit_count <= 0 || bit_count > 32) {
-               syslog (LOG_WARNING,
-                       "invalid address length %s in auth. address list",
-                       ptr_mask);
+               warn("invalid address length %v in auth. address list",
+                    ptr_mask);
                continue;
            }
            *ptr_mask = '\0';
@@ -1386,9 +1381,7 @@ ip_addr_check(addr, addrs)
            *ptr_mask = '/';
 
        if (a == (u_int32_t)-1L)
-           syslog (LOG_WARNING,
-                   "unknown host %s in auth. address list",
-                   addrs->word);
+           warn("unknown host %s in auth. address list", addrs->word);
        else
            /* Here a and addr are in network byte order,
               and mask is in host order. */
@@ -1423,9 +1416,10 @@ check_access(f, filename)
     struct stat sbuf;
 
     if (fstat(fileno(f), &sbuf) < 0) {
-       syslog(LOG_WARNING, "cannot stat secret file %s: %m", filename);
+       warn("cannot stat secret file %s: %m", filename);
     } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
-       syslog(LOG_WARNING, "Warning - secret file %s has world and/or group access", filename);
+       warn("Warning - secret file %s has world and/or group access",
+            filename);
     }
 }
 
@@ -1618,10 +1612,10 @@ auth_script(script)
     if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL)
        user_name = pw->pw_name;
     else {
-       sprintf(struid, "%d", getuid());
+       slprintf(struid, sizeof(struid), "%d", getuid());
        user_name = struid;
     }
-    sprintf(strspeed, "%d", baud_rate);
+    slprintf(strspeed, sizeof(strspeed), "%d", baud_rate);
 
     argv[0] = script;
     argv[1] = ifname;
index c93e963c4d2709e1c43e18b6a0cd6869113780f2..7c6b8c7824b14ac4f4e9fb38782ebbdbf50a994a 100644 (file)
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: ccp.c,v 1.24 1999/03/12 06:07:14 paulus Exp $";
+static char rcsid[] = "$Id: ccp.c,v 1.25 1999/03/16 03:15:12 paulus Exp $";
 #endif
 
 #include <stdlib.h>
 #include <string.h>
-#include <syslog.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
 
 #include "pppd.h"
 #include "fsm.h"
@@ -359,7 +356,7 @@ ccp_input(unit, p, len)
     oldstate = f->state;
     fsm_input(f, p, len);
     if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED)
-       syslog(LOG_NOTICE, "Compression disabled by peer.");
+       notice("Compression disabled by peer.");
 
     /*
      * If we get a terminate-ack and we're not asking for compression,
@@ -993,27 +990,28 @@ method_name(opt, opt2)
     case CI_DEFLATE:
     case CI_DEFLATE_DRAFT:
        if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
-           sprintf(result, "Deflate%s (%d/%d)",
-                   (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
-                   opt->deflate_size, opt2->deflate_size);
+           slprintf(result, sizeof(result), "Deflate%s (%d/%d)",
+                    (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+                    opt->deflate_size, opt2->deflate_size);
        else
-           sprintf(result, "Deflate%s (%d)",
-                   (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
-                   opt->deflate_size);
+           slprintf(result, sizeof(result), "Deflate%s (%d)",
+                    (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+                    opt->deflate_size);
        break;
     case CI_BSD_COMPRESS:
        if (opt2 != NULL && opt2->bsd_bits != opt->bsd_bits)
-           sprintf(result, "BSD-Compress (%d/%d)", opt->bsd_bits,
-                   opt2->bsd_bits);
+           slprintf(result, sizeof(result), "BSD-Compress (%d/%d)",
+                    opt->bsd_bits, opt2->bsd_bits);
        else
-           sprintf(result, "BSD-Compress (%d)", opt->bsd_bits);
+           slprintf(result, sizeof(result), "BSD-Compress (%d)",
+                    opt->bsd_bits);
        break;
     case CI_PREDICTOR_1:
        return "Predictor 1";
     case CI_PREDICTOR_2:
        return "Predictor 2";
     default:
-       sprintf(result, "Method %d", opt->method);
+       slprintf(result, sizeof(result), "Method %d", opt->method);
     }
     return result;
 }
@@ -1033,19 +1031,16 @@ ccp_up(f)
     if (ANY_COMPRESS(*go)) {
        if (ANY_COMPRESS(*ho)) {
            if (go->method == ho->method) {
-               syslog(LOG_NOTICE, "%s compression enabled",
-                      method_name(go, ho));
+               notice("%s compression enabled", method_name(go, ho));
            } else {
                strlcpy(method1, sizeof(method1), method_name(go, NULL));
-               syslog(LOG_NOTICE, "%s / %s compression enabled",
+               notice("%s / %s compression enabled",
                       method1, method_name(ho, NULL));
            }
        } else
-           syslog(LOG_NOTICE, "%s receive compression enabled",
-                  method_name(go, NULL));
+           notice("%s receive compression enabled", method_name(go, NULL));
     } else if (ANY_COMPRESS(*ho))
-       syslog(LOG_NOTICE, "%s transmit compression enabled",
-              method_name(ho, NULL));
+       notice("%s transmit compression enabled", method_name(ho, NULL));
 }
 
 /*
@@ -1197,7 +1192,7 @@ ccp_datainput(unit, pkt, len)
            /*
             * Disable compression by taking CCP down.
             */
-           syslog(LOG_ERR, "Lost compression sync: disabling compression");
+           error("Lost compression sync: disabling compression");
            ccp_close(unit, "Lost compression sync");
        } else {
            /*
index 6b405f195d409d62734294544ed9707256c1080a..27a60f21d058f76b5695d2e61f468737668ff4c5 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.18 1999/03/12 06:07:15 paulus Exp $";
+static char rcsid[] = "$Id: chap.c,v 1.19 1999/03/16 03:15:13 paulus Exp $";
 #endif
 
 /*
@@ -45,7 +45,6 @@ static char rcsid[] = "$Id: chap.c,v 1.18 1999/03/12 06:07:15 paulus Exp $";
 #include <string.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include <syslog.h>
 
 #include "pppd.h"
 #include "chap.h"
@@ -212,7 +211,7 @@ ChapChallengeTimeout(arg)
 
     if (cstate->chal_transmits >= cstate->max_transmits) {
        /* give up on peer */
-       syslog(LOG_ERR, "Peer failed to respond to CHAP challenge");
+       error("Peer failed to respond to CHAP challenge");
        cstate->serverstate = CHAPSS_BADAUTH;
        auth_peer_fail(cstate->unit, PPP_CHAP);
        return;
@@ -349,18 +348,18 @@ ChapInput(unit, inpacket, packet_len)
      */
     inp = inpacket;
     if (packet_len < CHAP_HEADERLEN) {
-       CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short header."));
+       CHAPDEBUG(("ChapInput: rcvd short header."));
        return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     GETSHORT(len, inp);
     if (len < CHAP_HEADERLEN) {
-       CHAPDEBUG((LOG_INFO, "ChapInput: rcvd illegal length."));
+       CHAPDEBUG(("ChapInput: rcvd illegal length."));
        return;
     }
     if (len > packet_len) {
-       CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short packet."));
+       CHAPDEBUG(("ChapInput: rcvd short packet."));
        return;
     }
     len -= CHAP_HEADERLEN;
@@ -386,7 +385,7 @@ ChapInput(unit, inpacket, packet_len)
        break;
 
     default:                           /* Need code reject? */
-       syslog(LOG_WARNING, "Unknown CHAP code (%d) received.", code);
+       warn("Unknown CHAP code (%d) received.", code);
        break;
     }
 }
@@ -410,23 +409,21 @@ ChapReceiveChallenge(cstate, inp, id, len)
     MD5_CTX mdContext;
     u_char hash[MD5_SIGNATURE_SIZE];
  
-    CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: Rcvd id %d.", id));
     if (cstate->clientstate == CHAPCS_CLOSED ||
        cstate->clientstate == CHAPCS_PENDING) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: in state %d",
-                  cstate->clientstate));
+       CHAPDEBUG(("ChapReceiveChallenge: in state %d", cstate->clientstate));
        return;
     }
 
     if (len < 2) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet."));
+       CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
        return;
     }
 
     GETCHAR(rchallenge_len, inp);
     len -= sizeof (u_char) + rchallenge_len;   /* now name field length */
     if (len < 0) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet."));
+       CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
        return;
     }
     rchallenge = inp;
@@ -437,13 +434,10 @@ ChapReceiveChallenge(cstate, inp, id, len)
     BCOPY(inp, rhostname, len);
     rhostname[len] = '\000';
 
-    CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: received name field '%s'",
-              rhostname));
-
     /* Microsoft doesn't send their name back in the PPP packet */
     if (remote_name[0] != 0 && (explicit_remote || rhostname[0] == 0)) {
        strlcpy(rhostname, sizeof(rhostname), remote_name);
-       CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: using '%s' as remote name",
+       CHAPDEBUG(("ChapReceiveChallenge: using '%q' as remote name",
                   rhostname));
     }
 
@@ -451,8 +445,7 @@ ChapReceiveChallenge(cstate, inp, id, len)
     if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
                    secret, &secret_len, 0)) {
        secret_len = 0;         /* assume null secret if can't find one */
-       syslog(LOG_WARNING, "No CHAP secret found for authenticating us to %s",
-              rhostname);
+       warn("No CHAP secret found for authenticating us to %q", rhostname);
     }
 
     /* cancel response send timeout if necessary */
@@ -482,7 +475,7 @@ ChapReceiveChallenge(cstate, inp, id, len)
 #endif
 
     default:
-       CHAPDEBUG((LOG_INFO, "unknown digest type %d", cstate->resp_type));
+       CHAPDEBUG(("unknown digest type %d", cstate->resp_type));
        return;
     }
 
@@ -509,12 +502,9 @@ ChapReceiveResponse(cstate, inp, id, len)
     char secret[MAXSECRETLEN];
     u_char hash[MD5_SIGNATURE_SIZE];
 
-    CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: Rcvd id %d.", id));
-
     if (cstate->serverstate == CHAPSS_CLOSED ||
        cstate->serverstate == CHAPSS_PENDING) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: in state %d",
-                  cstate->serverstate));
+       CHAPDEBUG(("ChapReceiveResponse: in state %d", cstate->serverstate));
        return;
     }
 
@@ -536,7 +526,7 @@ ChapReceiveResponse(cstate, inp, id, len)
     }
 
     if (len < 2) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: rcvd short packet."));
+       CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
        return;
     }
     GETCHAR(remmd_len, inp);           /* get length of MD */
@@ -545,7 +535,7 @@ ChapReceiveResponse(cstate, inp, id, len)
 
     len -= sizeof (u_char) + remmd_len;
     if (len < 0) {
-       CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: rcvd short packet."));
+       CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
        return;
     }
 
@@ -556,18 +546,14 @@ ChapReceiveResponse(cstate, inp, id, len)
     BCOPY(inp, rhostname, len);
     rhostname[len] = '\000';
 
-    CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: received name field: %s",
-              rhostname));
-
     /*
      * Get secret for authenticating them with us,
      * do the hash ourselves, and compare the result.
      */
     code = CHAP_FAILURE;
     if (!get_secret(cstate->unit, rhostname, cstate->chal_name,
-                  secret, &secret_len, 1)) {
-       syslog(LOG_WARNING, "No CHAP secret found for authenticating %s",
-              rhostname);
+                   secret, &secret_len, 1)) {
+       warn("No CHAP secret found for authenticating %q", rhostname);
     } else {
 
        /*  generate MD based on negotiated type */
@@ -588,7 +574,7 @@ ChapReceiveResponse(cstate, inp, id, len)
            break;
 
        default:
-           CHAPDEBUG((LOG_INFO, "unknown digest type %d", cstate->chal_type));
+           CHAPDEBUG(("unknown digest type %d", cstate->chal_type));
        }
     }
 
@@ -603,12 +589,10 @@ ChapReceiveResponse(cstate, inp, id, len)
        }
        if (cstate->chal_interval != 0)
            TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
-       syslog(LOG_NOTICE, "CHAP peer authentication succeeded for %s",
-              rhostname);
+       notice("CHAP peer authentication succeeded for %q", rhostname);
 
     } else {
-       syslog(LOG_ERR, "CHAP peer authentication failed for remote host %s",
-              rhostname);
+       error("CHAP peer authentication failed for remote host %q", rhostname);
        cstate->serverstate = CHAPSS_BADAUTH;
        auth_peer_fail(cstate->unit, PPP_CHAP);
     }
@@ -625,16 +609,13 @@ ChapReceiveSuccess(cstate, inp, id, len)
     int len;
 {
 
-    CHAPDEBUG((LOG_INFO, "ChapReceiveSuccess: Rcvd id %d.", id));
-
     if (cstate->clientstate == CHAPCS_OPEN)
        /* presumably an answer to a duplicate response */
        return;
 
     if (cstate->clientstate != CHAPCS_RESPONSE) {
        /* don't know what this is */
-       CHAPDEBUG((LOG_INFO, "ChapReceiveSuccess: in state %d\n",
-                  cstate->clientstate));
+       CHAPDEBUG(("ChapReceiveSuccess: in state %d\n", cstate->clientstate));
        return;
     }
 
@@ -662,12 +643,9 @@ ChapReceiveFailure(cstate, inp, id, len)
     u_char id;
     int len;
 {
-    CHAPDEBUG((LOG_INFO, "ChapReceiveFailure: Rcvd id %d.", id));
-
     if (cstate->clientstate != CHAPCS_RESPONSE) {
        /* don't know what this is */
-       CHAPDEBUG((LOG_INFO, "ChapReceiveFailure: in state %d\n",
-                  cstate->clientstate));
+       CHAPDEBUG(("ChapReceiveFailure: in state %d\n", cstate->clientstate));
        return;
     }
 
@@ -679,7 +657,7 @@ ChapReceiveFailure(cstate, inp, id, len)
     if (len > 0)
        PRINTMSG(inp, len);
 
-    syslog(LOG_ERR, "CHAP authentication failed");
+    error("CHAP authentication failed");
     auth_withpeer_fail(cstate->unit, PPP_CHAP);
 }
 
@@ -714,8 +692,6 @@ ChapSendChallenge(cstate)
 
     output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
   
-    CHAPDEBUG((LOG_INFO, "ChapSendChallenge: Sent id %d.", cstate->chal_id));
-
     TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
     ++cstate->chal_transmits;
 }
@@ -734,9 +710,9 @@ ChapSendStatus(cstate, code)
     char msg[256];
 
     if (code == CHAP_SUCCESS)
-       sprintf(msg, "Welcome to %s.", hostname);
+       slprintf(msg, sizeof(msg), "Welcome to %s.", hostname);
     else
-       sprintf(msg, "I don't like you.  Go 'way.");
+       slprintf(msg, sizeof(msg), "I don't like you.  Go 'way.");
     msglen = strlen(msg);
 
     outlen = CHAP_HEADERLEN + msglen;
@@ -749,9 +725,6 @@ ChapSendStatus(cstate, code)
     PUTSHORT(outlen, outp);
     BCOPY(msg, outp, msglen);
     output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
-  
-    CHAPDEBUG((LOG_INFO, "ChapSendStatus: Sent code %d, id %d.", code,
-              cstate->chal_id));
 }
 
 /*
index 0a5c126159b71c304daea125b46558992909104c..b7404638cf30d2485eb32e286d033c2120eee234 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chap_ms.c,v 1.12 1998/11/24 19:38:05 christos Exp $";
+static char rcsid[] = "$Id: chap_ms.c,v 1.13 1999/03/16 03:15:14 paulus Exp $";
 #endif
 
 #ifdef CHAPMS
@@ -43,7 +43,6 @@ static char rcsid[] = "$Id: chap_ms.c,v 1.12 1998/11/24 19:38:05 christos Exp $"
 #include <ctype.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include <syslog.h>
 #include <unistd.h>
 #ifdef HAVE_CRYPT_H
 #include <crypt.h>
@@ -98,7 +97,8 @@ ChallengeResponse(challenge, pwHash, response)
     BCOPY(pwHash, ZPasswordHash, MD4_SIGNATURE_SIZE);
 
 #if 0
-    log_packet(ZPasswordHash, sizeof(ZPasswordHash), "ChallengeResponse - ZPasswordHash", LOG_DEBUG);
+    dbglog("ChallengeResponse - ZPasswordHash %.*B",
+          sizeof(ZPasswordHash), ZPasswordHash);
 #endif
 
     DesEncrypt(challenge, ZPasswordHash +  0, response + 0);
@@ -106,7 +106,7 @@ ChallengeResponse(challenge, pwHash, response)
     DesEncrypt(challenge, ZPasswordHash + 14, response + 16);
 
 #if 0
-    log_packet(response, 24, "ChallengeResponse - response", LOG_DEBUG);
+    dbglog("ChallengeResponse - response %.24B", response);
 #endif
 }
 
@@ -128,8 +128,7 @@ DesEncrypt(clear, key, cipher)
     setkey(crypt_key);
 
 #if 0
-    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X",
-              clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
+    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %.8B", clear));
 #endif
 
     Expand(clear, des_input);
@@ -137,8 +136,7 @@ DesEncrypt(clear, key, cipher)
     Collapse(des_input, cipher);
 
 #if 0
-    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X",
-              cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
+    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %.8B", cipher));
 #endif
 }
 
@@ -158,15 +156,13 @@ DesEncrypt(clear, key, cipher)
     des_set_key(&des_key, key_schedule);
 
 #if 0
-    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X",
-              clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
+    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %.8B", clear));
 #endif
 
     des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
 
 #if 0
-    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X",
-              cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
+    CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %.8B", cipher));
 #endif
 }
 
@@ -245,10 +241,8 @@ static void MakeKey(key, des_key)
 #endif
 
 #if 0
-    CHAPDEBUG((LOG_INFO, "MakeKey: 56-bit input : %02X%02X%02X%02X%02X%02X%02X",
-              key[0], key[1], key[2], key[3], key[4], key[5], key[6]));
-    CHAPDEBUG((LOG_INFO, "MakeKey: 64-bit output: %02X%02X%02X%02X%02X%02X%02X%02X",
-              des_key[0], des_key[1], des_key[2], des_key[3], des_key[4], des_key[5], des_key[6], des_key[7]));
+    CHAPDEBUG((LOG_INFO, "MakeKey: 56-bit input : %.7B", key));
+    CHAPDEBUG((LOG_INFO, "MakeKey: 64-bit output: %.8B", des_key));
 #endif
 }
 
index cbd8980b2288537df7028e3bcd0e5b5c710b5c78..17a35ef3dda004649b8d28dedb8ab506cd38878d 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: demand.c,v 1.7 1997/11/27 06:08:26 paulus Exp $";
+static char rcsid[] = "$Id: demand.c,v 1.8 1999/03/16 03:15:14 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -26,7 +26,6 @@ static char rcsid[] = "$Id: demand.c,v 1.7 1997/11/27 06:08:26 paulus Exp $";
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <syslog.h>
 #include <netdb.h>
 #include <sys/param.h>
 #include <sys/types.h>
@@ -262,7 +261,7 @@ loop_frame(frame, len)
 {
     struct packet *pkt;
 
-    /* log_packet(frame, len, "from loop: ", LOG_DEBUG); */
+    /* dbglog("from loop: %P", frame, len); */
     if (len < PPP_HDRLEN)
        return 0;
     if ((PPP_PROTOCOL(frame) & 0x8000) != 0)
index 879a1c107b595666b48884eca3a2de9b6587aa8f..7993a36f28bd7594aa5d2ab4f35b2f90a4dd9963 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: fsm.c,v 1.14 1999/03/12 06:07:16 paulus Exp $";
+static char rcsid[] = "$Id: fsm.c,v 1.15 1999/03/16 03:15:14 paulus Exp $";
 #endif
 
 /*
@@ -30,7 +30,6 @@ static char rcsid[] = "$Id: fsm.c,v 1.14 1999/03/12 06:07:16 paulus Exp $";
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#include <syslog.h>
 
 #include "pppd.h"
 #include "fsm.h"
@@ -92,8 +91,7 @@ fsm_lowerup(f)
        break;
 
     default:
-       FSMDEBUG((LOG_INFO, "%s: Up event in state %d!",
-                 PROTO_NAME(f), f->state));
+       FSMDEBUG(("%s: Up event in state %d!", PROTO_NAME(f), f->state));
     }
 }
 
@@ -138,8 +136,7 @@ fsm_lowerdown(f)
        break;
 
     default:
-       FSMDEBUG((LOG_INFO, "%s: Down event in state %d!",
-                 PROTO_NAME(f), f->state));
+       FSMDEBUG(("%s: Down event in state %d!", PROTO_NAME(f), f->state));
     }
 }
 
@@ -276,8 +273,7 @@ fsm_timeout(arg)
        break;
 
     default:
-       FSMDEBUG((LOG_INFO, "%s: Timeout event in state %d!",
-                 PROTO_NAME(f), f->state));
+       FSMDEBUG(("%s: Timeout event in state %d!", PROTO_NAME(f), f->state));
     }
 }
 
@@ -301,27 +297,24 @@ fsm_input(f, inpacket, l)
      */
     inp = inpacket;
     if (l < HEADERLEN) {
-       FSMDEBUG((LOG_WARNING, "fsm_input(%x): Rcvd short header.",
-                 f->protocol));
+       FSMDEBUG(("fsm_input(%x): Rcvd short header.", f->protocol));
        return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     GETSHORT(len, inp);
     if (len < HEADERLEN) {
-       FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd illegal length.",
-                 f->protocol));
+       FSMDEBUG(("fsm_input(%x): Rcvd illegal length.", f->protocol));
        return;
     }
     if (len > l) {
-       FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd short packet.",
-                 f->protocol));
+       FSMDEBUG(("fsm_input(%x): Rcvd short packet.", f->protocol));
        return;
     }
     len -= HEADERLEN;          /* subtract header length */
 
     if( f->state == INITIAL || f->state == STARTING ){
-       FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd packet in state %d.",
+       FSMDEBUG(("fsm_input(%x): Rcvd packet in state %d.",
                  f->protocol, f->state));
        return;
     }
@@ -376,7 +369,6 @@ fsm_rconfreq(f, id, inp, len)
 {
     int code, reject_if_disagree;
 
-    FSMDEBUG((LOG_INFO, "fsm_rconfreq(%s): Rcvd id %d.", PROTO_NAME(f), id));
     switch( f->state ){
     case CLOSED:
        /* Go away, we're closed */
@@ -445,17 +437,12 @@ fsm_rconfack(f, id, inp, len)
     u_char *inp;
     int len;
 {
-    FSMDEBUG((LOG_INFO, "fsm_rconfack(%s): Rcvd id %d.",
-             PROTO_NAME(f), id));
-
     if (id != f->reqid || f->seen_ack)         /* Expected id? */
        return;                                 /* Nope, toss... */
     if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len):
          (len == 0)) ){
        /* Ack is bad - ignore it */
-       log_packet(inp, len, "Received bad configure-ack: ", LOG_ERR);
-       FSMDEBUG((LOG_INFO, "%s: received bad Ack (length %d)",
-                 PROTO_NAME(f), len));
+       error("Received bad configure-ack: %P", inp, len);
        return;
     }
     f->seen_ack = 1;
@@ -510,17 +497,12 @@ fsm_rconfnakrej(f, code, id, inp, len)
     int (*proc) __P((fsm *, u_char *, int));
     int ret;
 
-    FSMDEBUG((LOG_INFO, "fsm_rconfnakrej(%s): Rcvd id %d.",
-             PROTO_NAME(f), id));
-
     if (id != f->reqid || f->seen_ack) /* Expected id? */
        return;                         /* Nope, toss... */
     proc = (code == CONFNAK)? f->callbacks->nakci: f->callbacks->rejci;
     if (!proc || !(ret = proc(f, inp, len))) {
        /* Nak/reject is bad - ignore it */
-       log_packet(inp, len, "Received bad configure-nak/rej: ", LOG_ERR);
-       FSMDEBUG((LOG_INFO, "%s: received bad %s (length %d)",
-                 PROTO_NAME(f), (code==CONFNAK? "Nak": "reject"), len));
+       error("Received bad configure-nak/rej: %P", inp, len);
        return;
     }
     f->seen_ack = 1;
@@ -569,9 +551,6 @@ fsm_rtermreq(f, id, p, len)
     u_char *p;
     int len;
 {
-    FSMDEBUG((LOG_INFO, "fsm_rtermreq(%s): Rcvd id %d.",
-             PROTO_NAME(f), id));
-
     switch (f->state) {
     case ACKRCVD:
     case ACKSENT:
@@ -602,8 +581,6 @@ static void
 fsm_rtermack(f)
     fsm *f;
 {
-    FSMDEBUG((LOG_INFO, "fsm_rtermack(%s).", PROTO_NAME(f)));
-
     switch (f->state) {
     case CLOSING:
        UNTIMEOUT(fsm_timeout, f);
@@ -642,10 +619,8 @@ fsm_rcoderej(f, inp, len)
 {
     u_char code, id;
 
-    FSMDEBUG((LOG_INFO, "fsm_rcoderej(%s).", PROTO_NAME(f)));
-
     if (len < HEADERLEN) {
-       FSMDEBUG((LOG_INFO, "fsm_rcoderej: Rcvd short Code-Reject packet!"));
+       FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
        return;
     }
     GETCHAR(code, inp);
@@ -703,7 +678,7 @@ fsm_protreject(f)
        break;
 
     default:
-       FSMDEBUG((LOG_INFO, "%s: Protocol-reject event in state %d!",
+       FSMDEBUG(("%s: Protocol-reject event in state %d!",
                  PROTO_NAME(f), f->state));
     }
 }
@@ -754,9 +729,6 @@ fsm_sconfreq(f, retransmit)
     /* start the retransmit timer */
     --f->retransmits;
     TIMEOUT(fsm_timeout, f, f->timeouttime);
-
-    FSMDEBUG((LOG_INFO, "%s: sending Configure-Request, id %d",
-             PROTO_NAME(f), f->reqid));
 }
 
 
@@ -787,7 +759,4 @@ fsm_sdata(f, code, id, data, datalen)
     PUTCHAR(id, outp);
     PUTSHORT(outlen, outp);
     output(f->unit, outpacket_buf, outlen + PPP_HDRLEN);
-
-    FSMDEBUG((LOG_INFO, "fsm_sdata(%s): Sent code %d, id %d.",
-             PROTO_NAME(f), code, id));
 }
index 760106306d406d2249b6fbc5c950093e76762064..47d7af7f633f8cfa303959a0701d500c8aadf294 100644 (file)
@@ -19,7 +19,7 @@
 
 #ifdef IPX_CHANGE
 #ifndef lint
-static char rcsid[] = "$Id: ipxcp.c,v 1.9 1999/03/12 06:07:17 paulus Exp $";
+static char rcsid[] = "$Id: ipxcp.c,v 1.10 1999/03/16 03:15:15 paulus Exp $";
 #endif
 
 /*
@@ -28,7 +28,6 @@ static char rcsid[] = "$Id: ipxcp.c,v 1.9 1999/03/12 06:07:17 paulus Exp $";
 
 #include <stdio.h>
 #include <string.h>
-#include <syslog.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <sys/types.h>
@@ -211,7 +210,7 @@ ipx_ntoa(ipxaddr)
 u_int32_t ipxaddr;
 {
     static char b[64];
-    sprintf(b, "%x", ipxaddr);
+    slprintf(b, sizeof(b), "%x", ipxaddr);
     return b;
 }
 
@@ -673,7 +672,7 @@ ipxcp_ackci(f, p, len)
 /*
  * The frame is invalid
  */
-    IPXCPDEBUG((LOG_INFO, "ipxcp_ackci: received bad Ack!"));
+    IPXCPDEBUG(("ipxcp_ackci: received bad Ack!"));
     return (0);
 }
 
@@ -717,7 +716,6 @@ ipxcp_nakci(f, p, len)
            no.neg_nn = 1;
 
            GETLONG(l, p);
-           IPXCPDEBUG((LOG_INFO, "local IP address %d", l));
            if (l && ao->accept_network)
                try.our_network = l;
            break;
@@ -727,10 +725,6 @@ ipxcp_nakci(f, p, len)
                goto bad;
            no.neg_node = 1;
 
-           IPXCPDEBUG((LOG_INFO,
-                       "local node number %02X%02X%02X%02X%02X%02X",
-                       NODE(p)));
-
            if (!zero_node (p) && ao->accept_local &&
                ! compare_node (p, ho->his_node))
                copy_node (p, try.our_node);
@@ -758,8 +752,6 @@ ipxcp_nakci(f, p, len)
            no.router      |= s;
            try.router     |= s;
            try.neg_router  = 1;
-
-           IPXCPDEBUG((LOG_INFO, "Router protocol number %d", s));
            break;
 
            /* These, according to the RFC, must never be NAKed. */
@@ -798,7 +790,7 @@ ipxcp_nakci(f, p, len)
     return 1;
 
 bad:
-    IPXCPDEBUG((LOG_INFO, "ipxcp_nakci: received bad Nak!"));
+    IPXCPDEBUG(("ipxcp_nakci: received bad Nak!"));
     return 0;
 }
 
@@ -828,7 +820,6 @@ ipxcp_rejci(f, p, len)
        GETLONG(cilong, p); \
        if (cilong != val) \
            break; \
-       IPXCPDEBUG((LOG_INFO,"ipxcp_rejci rejected long opt %d", opt)); \
        neg = 0; \
     }
 
@@ -850,7 +841,6 @@ ipxcp_rejci(f, p, len)
        }\
        if (indx != count) \
            break; \
-       IPXCPDEBUG((LOG_INFO,"ipxcp_rejci rejected opt %d", opt)); \
        neg = 0; \
     }
 
@@ -865,7 +855,6 @@ ipxcp_rejci(f, p, len)
        GETCHAR(cilen, p); \
        if (cilen != CILEN_VOID || citype != opt) \
            break; \
-       IPXCPDEBUG((LOG_INFO, "ipxcp_rejci rejected void opt %d", opt)); \
        neg = 0; \
     }
 
@@ -882,7 +871,6 @@ ipxcp_rejci(f, p, len)
        GETSHORT(cishort, p); \
        if (cishort != to_external (val) || cishort == RIP_SAP) \
            break; \
-       IPXCPDEBUG((LOG_INFO, "ipxcp_rejci short opt %d", opt)); \
        neg = 0; \
     }
 /*
@@ -909,7 +897,7 @@ ipxcp_rejci(f, p, len)
 /*
  * The frame is invalid at this point.
  */
-    IPXCPDEBUG((LOG_INFO, "ipxcp_rejci: received bad Reject!"));
+    IPXCPDEBUG(("ipxcp_rejci: received bad Reject!"));
     return 0;
 }
 
@@ -952,7 +940,7 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
        if (l < 2 ||                    /* Not enough data for CI header or */
            p[1] < 2 ||                 /*  CI length too small or */
            p[1] > l) {                 /*  CI length too big? */
-           IPXCPDEBUG((LOG_INFO, "ipxcp_reqci: bad CI length!"));
+           IPXCPDEBUG(("ipxcp_reqci: bad CI length!"));
            orc = CONFREJ;              /* Reject bad CI */
            cilen = l;                  /* Reject till end of packet */
            l = 0;                      /* Don't loop again */
@@ -968,8 +956,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * The network number must match. Choose the larger of the two.
  */
        case IPX_NETWORK_NUMBER:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Network Number request"));
-           
            /* if we wont negotiate the network number or the length is wrong
               then reject the option */
            if ( !ao->neg_nn || cilen != CILEN_NETN ) {
@@ -977,7 +963,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
                break;          
            }
            GETLONG(cinetwork, p);
-           IPXCPDEBUG((LOG_INFO,"Remote proposed IPX network number is %8Lx",tl));
 
            /* If the network numbers match then acknowledge them. */
            if (cinetwork != 0) {
@@ -1014,8 +999,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * The node number is required
  */
        case IPX_NODE_NUMBER:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Node Number request"));
-
            /* if we wont negotiate the node number or the length is wrong
               then reject the option */
            if ( cilen != CILEN_NODEN ) {
@@ -1073,7 +1056,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * Compression is not desired at this time. It is always rejected.
  */
        case IPX_COMPRESSION_PROTOCOL:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Compression Protocol request "));
            orc = CONFREJ;
            break;
 /*
@@ -1088,9 +1070,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
            }
 
            GETSHORT (cishort, p);
-           IPXCPDEBUG((LOG_INFO,
-                       "Remote router protocol number 0x%04x",
-                       cishort));
 
            if (wo->neg_router == 0) {
                wo->neg_router = 1;
@@ -1135,7 +1114,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * The router name is advisorary. Just accept it if it is not too large.
  */
        case IPX_ROUTER_NAME:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Router Name request"));
            if (cilen >= CILEN_NAME) {
                int name_size = cilen - CILEN_NAME;
                if (name_size > sizeof (ho->name))
@@ -1153,7 +1131,6 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * This is advisorary.
  */
        case IPX_COMPLETE:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Complete request"));
            if (cilen != CILEN_COMPLETE)
                orc = CONFREJ;
            else {
@@ -1165,14 +1142,10 @@ ipxcp_reqci(f, inp, len, reject_if_disagree)
  * All other entries are not known at this time.
  */
        default:
-           IPXCPDEBUG((LOG_INFO, "ipxcp: received Complete request"));
            orc = CONFREJ;
            break;
        }
-
 endswitch:
-       IPXCPDEBUG((LOG_INFO, " (%s)\n", CODENAME(orc)));
-
        if (orc == CONFACK &&           /* Good CI */
            rc != CONFACK)              /*  but prior CI wasnt? */
            continue;                   /* Don't send this one */
@@ -1228,7 +1201,7 @@ endswitch:
     }
 
     *len = ucp - inp;                  /* Compute output length */
-    IPXCPDEBUG((LOG_INFO, "ipxcp: returning Configure-%s", CODENAME(rc)));
+    IPXCPDEBUG(("ipxcp: returning Configure-%s", CODENAME(rc)));
     return (rc);                       /* Return final code */
 }
 
@@ -1244,7 +1217,7 @@ ipxcp_up(f)
 {
     int unit = f->unit;
 
-    IPXCPDEBUG((LOG_INFO, "ipxcp: up"));
+    IPXCPDEBUG(("ipxcp: up"));
 
     /* The default router protocol is RIP/SAP. */
     if (ho->router == 0)
@@ -1265,7 +1238,8 @@ ipxcp_up(f)
 
     if (zero_node (go->our_node)) {
         static char errmsg[] = "Could not determine local IPX node address";
-       IPXCPDEBUG((LOG_ERR, errmsg));
+       if (debug)
+           error(errmsg);
        ipxcp_close(f->unit, errmsg);
        return;
     }
@@ -1276,21 +1250,24 @@ ipxcp_up(f)
 
     if (go->network == 0) {
         static char errmsg[] = "Can not determine network number";
-       IPXCPDEBUG((LOG_ERR, errmsg));
+       if (debug)
+           error(errmsg);
        ipxcp_close (unit, errmsg);
        return;
     }
 
     /* bring the interface up */
     if (!sifup(unit)) {
-       IPXCPDEBUG((LOG_WARNING, "sifup failed"));
+       if (debug)
+           warn("sifup failed (IPX)");
        ipxcp_close(unit, "Interface configuration failed");
        return;
     }
 
     /* set the network number for IPX */
     if (!sipxfaddr(unit, go->network, go->our_node)) {
-       IPXCPDEBUG((LOG_WARNING, "sipxfaddr failed"));
+       if (debug)
+           warn("sipxfaddr failed");
        ipxcp_close(unit, "Interface configuration failed");
        return;
     }
@@ -1314,7 +1291,7 @@ static void
 ipxcp_down(f)
     fsm *f;
 {
-    IPXCPDEBUG((LOG_INFO, "ipxcp: down"));
+    IPXCPDEBUG(("ipxcp: down"));
 
     cipxfaddr (f->unit);
     sifdown(f->unit);
@@ -1335,8 +1312,8 @@ ipxcp_script(f, script)
     char strnetwork[32], strpid[32];
     char *argv[14],     strproto_lcl[32], strproto_rmt[32];
 
-    sprintf (strpid,   "%d", getpid());
-    sprintf (strspeed, "%d", baud_rate);
+    slprintf(strpid, sizeof(strpid), "%d", getpid());
+    slprintf(strspeed, sizeof(strspeed),"%d", baud_rate);
 
     strproto_lcl[0] = '\0';
     if (go->neg_router && ((go->router & BIT(IPX_NONE)) == 0)) {
index e84cb93cb8af4397cc82668454ad1edf15aac7f7..b59d13031ad9e6c7f0d5f224bfae23f6c586afb2 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: upap.c,v 1.13 1999/03/02 05:29:39 paulus Exp $";
+static char rcsid[] = "$Id: upap.c,v 1.14 1999/03/16 03:15:15 paulus Exp $";
 #endif
 
 /*
@@ -27,9 +27,6 @@ static char rcsid[] = "$Id: upap.c,v 1.13 1999/03/02 05:29:39 paulus Exp $";
 
 #include <stdio.h>
 #include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <syslog.h>
 
 #include "pppd.h"
 #include "upap.h"
@@ -183,7 +180,7 @@ upap_timeout(arg)
 
     if (u->us_transmits >= u->us_maxtransmits) {
        /* give up in disgust */
-       syslog(LOG_ERR, "No response to PAP authenticate-requests");
+       error("No response to PAP authenticate-requests");
        u->us_clientstate = UPAPCS_BADAUTH;
        auth_withpeer_fail(u->us_unit, PPP_PAP);
        return;
@@ -270,11 +267,11 @@ upap_protrej(unit)
     upap_state *u = &upap[unit];
 
     if (u->us_clientstate == UPAPCS_AUTHREQ) {
-       syslog(LOG_ERR, "PAP authentication failed due to protocol-reject");
+       error("PAP authentication failed due to protocol-reject");
        auth_withpeer_fail(unit, PPP_PAP);
     }
     if (u->us_serverstate == UPAPSS_LISTEN) {
-       syslog(LOG_ERR, "PAP authentication of peer failed (protocol-reject)");
+       error("PAP authentication of peer failed (protocol-reject)");
        auth_peer_fail(unit, PPP_PAP);
     }
     upap_lowerdown(unit);
@@ -301,18 +298,18 @@ upap_input(unit, inpacket, l)
      */
     inp = inpacket;
     if (l < UPAP_HEADERLEN) {
-       UPAPDEBUG((LOG_INFO, "pap_input: rcvd short header."));
+       UPAPDEBUG(("pap_input: rcvd short header."));
        return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     GETSHORT(len, inp);
     if (len < UPAP_HEADERLEN) {
-       UPAPDEBUG((LOG_INFO, "pap_input: rcvd illegal length."));
+       UPAPDEBUG(("pap_input: rcvd illegal length."));
        return;
     }
     if (len > l) {
-       UPAPDEBUG((LOG_INFO, "pap_input: rcvd short packet."));
+       UPAPDEBUG(("pap_input: rcvd short packet."));
        return;
     }
     len -= UPAP_HEADERLEN;
@@ -355,8 +352,6 @@ upap_rauthreq(u, inp, id, len)
     char *msg;
     int msglen;
 
-    UPAPDEBUG((LOG_INFO, "pap_rauth: Rcvd id %d.", id));
-
     if (u->us_serverstate < UPAPSS_LISTEN)
        return;
 
@@ -377,20 +372,20 @@ upap_rauthreq(u, inp, id, len)
      * Parse user/passwd.
      */
     if (len < sizeof (u_char)) {
-       UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet."));
+       UPAPDEBUG(("pap_rauth: rcvd short packet."));
        return;
     }
     GETCHAR(ruserlen, inp);
     len -= sizeof (u_char) + ruserlen + sizeof (u_char);
     if (len < 0) {
-       UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet."));
+       UPAPDEBUG(("pap_rauth: rcvd short packet."));
        return;
     }
     ruser = (char *) inp;
     INCPTR(ruserlen, inp);
     GETCHAR(rpasswdlen, inp);
     if (len < rpasswdlen) {
-       UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet."));
+       UPAPDEBUG(("pap_rauth: rcvd short packet."));
        return;
     }
     rpasswd = (char *) inp;
@@ -430,7 +425,6 @@ upap_rauthack(u, inp, id, len)
     u_char msglen;
     char *msg;
 
-    UPAPDEBUG((LOG_INFO, "pap_rauthack: Rcvd id %d.", id));
     if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
        return;
 
@@ -438,13 +432,13 @@ upap_rauthack(u, inp, id, len)
      * Parse message.
      */
     if (len < sizeof (u_char)) {
-       UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet."));
+       UPAPDEBUG(("pap_rauthack: rcvd short packet."));
        return;
     }
     GETCHAR(msglen, inp);
     len -= sizeof (u_char);
     if (len < msglen) {
-       UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet."));
+       UPAPDEBUG(("pap_rauthack: rcvd short packet."));
        return;
     }
     msg = (char *) inp;
@@ -469,7 +463,6 @@ upap_rauthnak(u, inp, id, len)
     u_char msglen;
     char *msg;
 
-    UPAPDEBUG((LOG_INFO, "pap_rauthnak: Rcvd id %d.", id));
     if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
        return;
 
@@ -477,13 +470,13 @@ upap_rauthnak(u, inp, id, len)
      * Parse message.
      */
     if (len < sizeof (u_char)) {
-       UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet."));
+       UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
        return;
     }
     GETCHAR(msglen, inp);
     len -= sizeof (u_char);
     if (len < msglen) {
-       UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet."));
+       UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
        return;
     }
     msg = (char *) inp;
@@ -491,7 +484,7 @@ upap_rauthnak(u, inp, id, len)
 
     u->us_clientstate = UPAPCS_BADAUTH;
 
-    syslog(LOG_ERR, "PAP authentication failed");
+    error("PAP authentication failed");
     auth_withpeer_fail(u->us_unit, PPP_PAP);
 }
 
@@ -523,8 +516,6 @@ upap_sauthreq(u)
 
     output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
 
-    UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d.", u->us_id));
-
     TIMEOUT(upap_timeout, u, u->us_timeouttime);
     ++u->us_transmits;
     u->us_clientstate = UPAPCS_AUTHREQ;
@@ -554,8 +545,6 @@ upap_sresp(u, code, id, msg, msglen)
     PUTCHAR(msglen, outp);
     BCOPY(msg, outp, msglen);
     output(u->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
-
-    UPAPDEBUG((LOG_INFO, "pap_sresp: Sent code %d, id %d.", code, id));
 }
 
 /*