blob: d84d422ff6ee248ad9640debb0f5c324a78a257e [file] [log] [blame]
Damien Millerd925dcd2010-12-01 12:21:51 +11001/* $OpenBSD: hostfile.h,v 1.19 2010/11/29 23:45:51 djm Exp $ */
Ben Lindstrom36579d32001-01-29 07:39:26 +00002
Damien Millere4340be2000-09-16 13:29:08 +11003/*
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 */
Damien Miller450a7a12000-03-26 13:04:51 +100014#ifndef HOSTFILE_H
15#define HOSTFILE_H
16
Damien Miller450a7a12000-03-26 13:04:51 +100017typedef enum {
Damien Miller1aed65e2010-03-04 21:53:35 +110018 HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND
Damien Miller450a7a12000-03-26 13:04:51 +100019} HostStatus;
Ben Lindstrom46c16222000-12-22 01:43:59 +000020
Damien Millerd925dcd2010-12-01 12:21:51 +110021typedef enum {
22 MRK_ERROR, MRK_NONE, MRK_REVOKE, MRK_CA
23} HostkeyMarker;
24
25struct hostkey_entry {
26 char *host;
27 char *file;
28 u_long line;
29 Key *key;
30 HostkeyMarker marker;
31};
32struct hostkeys;
33
34struct hostkeys *init_hostkeys(void);
35void load_hostkeys(struct hostkeys *, const char *, const char *);
36void free_hostkeys(struct hostkeys *);
37
38HostStatus check_key_in_hostkeys(struct hostkeys *, Key *,
39 const struct hostkey_entry **);
40int lookup_key_in_hostkeys_by_type(struct hostkeys *, int,
41 const struct hostkey_entry **);
42
Damien Miller5b2aea92001-12-21 12:47:09 +110043int hostfile_read_key(char **, u_int *, Key *);
Damien Millerd925dcd2010-12-01 12:21:51 +110044int add_host_to_hostfile(const char *, const char *, const Key *, int);
Damien Miller450a7a12000-03-26 13:04:51 +100045
Damien Millere1776152005-03-01 21:47:37 +110046#define HASH_MAGIC "|1|"
47#define HASH_DELIM '|'
48
Damien Miller0a80ca12010-02-27 07:55:05 +110049#define CA_MARKER "@cert-authority"
Damien Miller1aed65e2010-03-04 21:53:35 +110050#define REVOKE_MARKER "@revoked"
Damien Miller0a80ca12010-02-27 07:55:05 +110051
Damien Millere1776152005-03-01 21:47:37 +110052char *host_hash(const char *, const char *, u_int);
53
Damien Miller450a7a12000-03-26 13:04:51 +100054#endif