hostfile.h (124981e1) hostfile.h (a8f6863a)
1/* $OpenBSD: hostfile.h,v 1.18 2010/03/04 10:36:03 djm Exp $ */
2
3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
5 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6 * All rights reserved
7 *
8 * As far as I am concerned, the code I have written for this software
9 * can be used freely for any purpose. Any derived versions of this
10 * software must be clearly marked as such, and if the derived work is
11 * incompatible with the protocol description in the RFC file, it must be
12 * called by a name other than "ssh" or "Secure Shell".
13 */
14#ifndef HOSTFILE_H
15#define HOSTFILE_H
16
1#ifndef HOSTFILE_H
2#define HOSTFILE_H
3
4/*
5 * Checks whether the given host is already in the list of our known hosts.
6 * Returns HOST_OK if the host is known and has the specified key, HOST_NEW
7 * if the host is not known, and HOST_CHANGED if the host is known but used
8 * to have a different host key. The host must be in all lowercase.
9 */
17typedef enum {
10typedef enum {
18 HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND
11 HOST_OK, HOST_NEW, HOST_CHANGED
19} HostStatus;
12} HostStatus;
13HostStatus
14check_host_in_hostfile(const char *filename, const char *host, Key *key, Key *found);
20
15
21int hostfile_read_key(char **, u_int *, Key *);
22HostStatus check_host_in_hostfile(const char *, const char *,
23 const Key *, Key *, int *);
24int add_host_to_hostfile(const char *, const char *, const Key *, int);
25int lookup_key_in_hostfile_by_type(const char *, const char *,
26 int, Key *, int *);
16/*
17 * Appends an entry to the host file. Returns false if the entry could not
18 * be appended.
19 */
20int add_host_to_hostfile(const char *filename, const char *host, Key *key);
27
21
28#define HASH_MAGIC "|1|"
29#define HASH_DELIM '|'
30
31#define CA_MARKER "@cert-authority"
32#define REVOKE_MARKER "@revoked"
33
34char *host_hash(const char *, const char *, u_int);
35
36#endif
22#endif