]> git.ozlabs.org Git - ppp.git/commitdiff
Log a message when we succeed or fail in authenticating ourselves
authorPaul Mackerras <paulus@samba.org>
Wed, 13 Jul 2005 10:41:58 +0000 (10:41 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 13 Jul 2005 10:41:58 +0000 (10:41 +0000)
to the peer.  The message in the success case is printed in
auth_withpeer_success, but the message in the failure case is
printed by the caller of auth_withpeer_fail (since there are
many possible reasons for failure).

pppd/auth.c
pppd/chap-new.c
pppd/upap.c

index e435e6c7fea0d540e875f05a6cdf26f051f0f9b2..9f677c2f37330743a216e0f72e91cd19042bdbd7 100644 (file)
@@ -68,7 +68,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.105 2005/07/12 01:07:59 paulus Exp $"
+#define RCSID  "$Id: auth.c,v 1.106 2005/07/13 10:41:58 paulus Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -994,10 +994,12 @@ auth_withpeer_success(unit, protocol, prot_flavor)
     int unit, protocol, prot_flavor;
 {
     int bit;
+    const char *prot = "";
 
     switch (protocol) {
     case PPP_CHAP:
        bit = CHAP_WITHPEER;
+       prot = "CHAP";
        switch (prot_flavor) {
        case CHAP_MD5:
            bit |= CHAP_MD5_WITHPEER;
@@ -1016,15 +1018,19 @@ auth_withpeer_success(unit, protocol, prot_flavor)
        if (passwd_from_file)
            BZERO(passwd, MAXSECRETLEN);
        bit = PAP_WITHPEER;
+       prot = "PAP";
        break;
     case PPP_EAP:
        bit = EAP_WITHPEER;
+       prot = "EAP";
        break;
     default:
        warn("auth_withpeer_success: unknown protocol %x", protocol);
        bit = 0;
     }
 
+    notice("%s authentication succeeded", prot);
+
     /* Save the authentication method for later. */
     auth_done[unit] |= bit;
 
index e5fe16106d85ad80508d5ad070fe4c983dce8856..cf54f57dd8568b8acc07e1bbae1401a29195b927 100644 (file)
@@ -28,7 +28,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: chap-new.c,v 1.7 2005/07/10 07:31:26 paulus Exp $"
+#define RCSID  "$Id: chap-new.c,v 1.8 2005/07/13 10:41:58 paulus Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -501,6 +501,7 @@ chap_handle_status(struct chap_client_state *cs, int code, int id,
                auth_withpeer_success(0, PPP_CHAP, cs->digest->code);
        else {
                cs->flags |= AUTH_FAILED;
+               error("CHAP authentication failed");
                auth_withpeer_fail(0, PPP_CHAP);
        }
 }
@@ -552,6 +553,7 @@ chap_protrej(int unit)
        }
        if ((cs->flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) {
                cs->flags &= ~AUTH_STARTED;
+               error("CHAP authentication failed due to protocol-reject");
                auth_withpeer_fail(0, PPP_CHAP);
        }
 }
index 02fd8f8d9831096a2fb1cca9760c2b4156f56b63..8a736218d93bdd3f8fe3a1fd6965e6cfe0da5600 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: upap.c,v 1.29 2002/12/04 23:03:33 paulus Exp $"
+#define RCSID  "$Id: upap.c,v 1.30 2005/07/13 10:41:58 paulus Exp $"
 
 /*
  * TODO:
@@ -498,7 +498,6 @@ upap_rauthack(u, inp, id, len)
 
     u->us_clientstate = UPAPCS_OPEN;
 
-    notice("PAP authentication succeeded");
     auth_withpeer_success(u->us_unit, PPP_PAP, 0);
 }