]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Authentication token support should have an algo of 0.
authorRoy Marples <roy@marples.name>
Fri, 18 Nov 2016 13:49:22 +0000 (13:49 +0000)
committerRoy Marples <roy@marples.name>
Fri, 18 Nov 2016 13:49:22 +0000 (13:49 +0000)
auth.c
auth.h
if-options.c

diff --git a/auth.c b/auth.c
index 4a6d7ea60b1bf37e58c9c9bbbdb712079bc04c01..48bf04aba9ccda688b87bd0bee196692aca4cc09 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -514,6 +514,7 @@ dhcp_auth_encode(struct auth *auth, const struct token *t,
        }
 
        switch(auth->algorithm) {
+       case AUTH_ALG_NONE:
        case AUTH_ALG_HMAC_MD5:
                break;
        default:
diff --git a/auth.h b/auth.h
index cfc17df801fcfe529e1dff182e70c9065fa7e65b..fdd92ad483ad44cf1beed48779bc47825977d9cc 100644 (file)
--- a/auth.h
+++ b/auth.h
@@ -45,6 +45,7 @@
 #define AUTH_PROTO_DELAYEDREALM        2
 #define AUTH_PROTO_RECONFKEY   3
 
+#define AUTH_ALG_NONE          0
 #define AUTH_ALG_HMAC_MD5      1
 
 #define AUTH_RDM_MONOTONIC     0
index f08a7a8749f6c32a953915f3098f795f726ec114..6b88982a4d5274bdb214dfde126e18cd45e16ccf 100644 (file)
@@ -1920,7 +1920,10 @@ err_sla:
                fp = strwhite(arg);
                if (arg == NULL) {
                        ifo->auth.options |= DHCPCD_AUTH_SEND;
-                       ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
+                       if (ifo->auth.protocol == AUTH_PROTO_TOKEN)
+                               ifo->auth.protocol = AUTH_ALG_NONE;
+                       else
+                               ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
                        ifo->auth.rdm = AUTH_RDM_MONOTONIC;
                        break;
                }