]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
make 'authistrustedip()' more flexible
authorJuergen Perlinger <perlinger@ntp.org>
Sun, 31 Dec 2017 10:03:00 +0000 (11:03 +0100)
committerJuergen Perlinger <perlinger@ntp.org>
Sun, 31 Dec 2017 10:03:00 +0000 (11:03 +0100)
bk: 5a48b5d4iisz8C7m0z4QyFaHVcCE8w

libntp/authkeys.c

index e3c1bf0a0371561816bc59aecd2e1ab70eb3b141..7c1cbb0655ae229cb770a0eb56290d8dec08acd7 100644 (file)
@@ -717,20 +717,19 @@ authistrusted(
 {
        symkey *        sk;
 
-       /* That specific key was already used to authenticate the
-        * packet. Therefore, the key *must* exist...  There's a chance
-        * that is not trusted, though.
-        */
        if (keyno == cache_keyid) {
                return (KEY_TRUSTED & cache_flags) &&
                    keyacc_contains(cache_keyacclist, sau, TRUE);
-       } else {
+       }
+
+       if (NULL != (sk = auth_findkey(keyno))) {
                authkeyuncached++;
-               sk = auth_findkey(keyno);
-               INSIST(NULL != sk);
                return (KEY_TRUSTED & sk->flags) &&
                    keyacc_contains(sk->keyacclist, sau, TRUE);
        }
+       
+       authkeynotfound++;
+       return FALSE;    
 }
 
 /* Note: There are two locations below where 'strncpy()' is used. While