src/contrib/ntp/libntp/authkeys.c
/*
 * authhavekey - return TRUE and cache the key, if zero or both known
 *		 and trusted.
 */
return TRUE and cache the key, if zero or both known
and trusted.
return TRUE and cache the key if zero or both known and trusted .
int
authhavekey(
	keyid_t		id
	)
{
	symkey *	sk;
	authkeylookups++;
	if (0 == id || cache_keyid == id)
		return !!(KEY_TRUSTED & cache_flags);
	authkeyuncached++;
	sk = auth_findkey(id);
	if ((sk == NULL) || (sk->type == 0)) {
		authkeynotfound++;
		return FALSE;
	}
	if ( ! (KEY_TRUSTED & sk->flags)) {
		authnokey++;
		return FALSE;
	}
	cache_keyid = sk->keyid;
	cache_type = sk->type;
	cache_flags = sk->flags;
	cache_secret = sk->secret;
	cache_secretsize = sk->secretsize;
	cache_keyacclist = sk->keyacclist;
	return TRUE;
}
int authhavekey ( keyid_t id ) { symkey * sk ; authkeylookups ++ ; if ( 0 == id || cache_keyid == id ) return ! ! ( KEY_TRUSTED & cache_flags ) ; authkeyuncached ++ ; sk = auth_findkey ( id ) ; if ( ( sk == NULL ) || ( sk -> type == 0 ) ) { authkeynotfound ++ ; return FALSE ; } if ( ! ( KEY_TRUSTED & sk -> flags ) ) { authnokey ++ ; return FALSE ; } cache_keyid = sk -> keyid ; cache_type = sk -> type ; cache_flags = sk -> flags ; cache_secret = sk -> secret ; cache_secretsize = sk -> secretsize ; cache_keyacclist = sk -> keyacclist ; return TRUE ; }
authhavekey - return TRUE and cache the key, if zero or both known
               and trusted.
authhavekey - return TRUE and cache the key if zero or both known and trusted .
/*
	 * Search the bin for the key. If not found, or found but the key
	 * type is zero, somebody marked it trusted without specifying a
	 * key or key type. In this case consider the key missing.
	 */ /*
	 * If the key is not trusted, the key is not considered found.
	 */ /*
	 * The key is found and trusted. Initialize the key cache.
	 */