Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcpcd/dist/src Sync



details:   https://anonhg.NetBSD.org/src/rev/b586b09f8c87
branches:  trunk
changeset: 322425:b586b09f8c87
user:      roy <roy%NetBSD.org@localhost>
date:      Wed May 02 22:08:45 2018 +0000

description:
Sync

diffstat:

 external/bsd/dhcpcd/dist/src/if-options.c |  33 +++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 5270ce6bc0ed -r b586b09f8c87 external/bsd/dhcpcd/dist/src/if-options.c
--- a/external/bsd/dhcpcd/dist/src/if-options.c Wed May 02 22:07:37 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.c Wed May 02 22:08:45 2018 +0000
@@ -1850,6 +1850,7 @@
                        logerrx("invalid code: %s", arg);
                        return -1;
                }
+               fp = strskipwhite(fp);
                if (fp) {
                        s = parse_string(NULL, 0, fp);
                        if (s == -1) {
@@ -1912,12 +1913,32 @@
                }
                if (fp)
                        *fp++ = '\0';
-               if (strcasecmp(arg, "hmacmd5") == 0 ||
-                   strcasecmp(arg, "hmac-md5") == 0)
-                       ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
-               else {
-                       logerrx("%s: unsupported algorithm", arg);
-                       return 1;
+               if (ifo->auth.protocol == AUTH_PROTO_TOKEN) {
+                       np = strchr(arg, '/');
+                       if (np) {
+                               if (fp == NULL || np < fp)
+                                       *np++ = '\0';
+                               else
+                                       np = NULL;
+                       }
+                       if (parse_uint32(&ifo->auth.token_snd_secretid,
+                           arg) == -1)
+                               logerrx("%s: not a number", arg);
+                       else
+                               ifo->auth.token_rcv_secretid =
+                                   ifo->auth.token_snd_secretid;
+                       if (np &&
+                           parse_uint32(&ifo->auth.token_rcv_secretid,
+                           np) == -1)
+                               logerrx("%s: not a number", arg);
+               } else {
+                       if (strcasecmp(arg, "hmacmd5") == 0 ||
+                           strcasecmp(arg, "hmac-md5") == 0)
+                               ifo->auth.algorithm = AUTH_ALG_HMAC_MD5;
+                       else {
+                               logerrx("%s: unsupported algorithm", arg);
+                               return 1;
+                       }
                }
                arg = fp;
                if (arg == NULL) {



Home | Main Index | Thread Index | Old Index