version 1.23, 2015/01/26 03:04:45 |
version 1.24, 2015/02/16 22:08:57 |
|
|
int add_host_to_hostfile(const char *, const char *, |
int add_host_to_hostfile(const char *, const char *, |
const struct sshkey *, int); |
const struct sshkey *, int); |
|
|
int hostfile_replace_entries(const char *filename, const char *host, |
int hostfile_replace_entries(const char *filename, |
struct sshkey **keys, size_t nkeys, int store_hash, int quiet); |
const char *host, const char *ip, struct sshkey **keys, size_t nkeys, |
|
int store_hash, int quiet, int hash_alg); |
|
|
#define HASH_MAGIC "|1|" |
#define HASH_MAGIC "|1|" |
#define HASH_DELIM '|' |
#define HASH_DELIM '|' |
|
|
* hostnames. Allows access to the raw keyfile lines to allow |
* hostnames. Allows access to the raw keyfile lines to allow |
* streaming edits to the file to take place. |
* streaming edits to the file to take place. |
*/ |
*/ |
#define HKF_WANT_MATCH_HOST (1) /* return only matching hosts */ |
#define HKF_WANT_MATCH (1) /* return only matching hosts/addrs */ |
#define HKF_WANT_PARSE_KEY (1<<1) /* need key parsed */ |
#define HKF_WANT_PARSE_KEY (1<<1) /* need key parsed */ |
|
|
#define HKF_STATUS_OK 1 /* Line parsed, didn't match host */ |
#define HKF_STATUS_OK 0 /* Line parsed, didn't match host */ |
#define HKF_STATUS_INVALID 2 /* line had parse error */ |
#define HKF_STATUS_INVALID 1 /* line had parse error */ |
#define HKF_STATUS_COMMENT 3 /* valid line contained no key */ |
#define HKF_STATUS_COMMENT 2 /* valid line contained no key */ |
#define HKF_STATUS_HOST_MATCHED 4 /* hostname matched */ |
#define HKF_STATUS_MATCHED 3 /* hostname or IP matched */ |
|
|
|
#define HKF_MATCH_HOST (1) /* hostname matched */ |
|
#define HKF_MATCH_IP (1<<1) /* address matched */ |
|
#define HKF_MATCH_HOST_HASHED (1<<2) /* hostname was hashed */ |
|
#define HKF_MATCH_IP_HASHED (1<<3) /* address was hashed */ |
|
/* XXX HKF_MATCH_KEY_TYPE? */ |
|
|
/* |
/* |
* The callback function receives this as an argument for each matching |
* The callback function receives this as an argument for each matching |
* hostkey line. The callback may "steal" the 'key' field by setting it to NULL. |
* hostkey line. The callback may "steal" the 'key' field by setting it to NULL. |
|
|
struct hostkey_foreach_line { |
struct hostkey_foreach_line { |
const char *path; /* Path of file */ |
const char *path; /* Path of file */ |
u_long linenum; /* Line number */ |
u_long linenum; /* Line number */ |
int status; /* One of HKF_STATUS_* */ |
u_int status; /* One of HKF_STATUS_* */ |
|
u_int match; /* Zero or more of HKF_MATCH_* OR'd together */ |
char *line; /* Entire key line; mutable by callback */ |
char *line; /* Entire key line; mutable by callback */ |
int marker; /* CA/revocation markers; indicated by MRK_* value */ |
int marker; /* CA/revocation markers; indicated by MRK_* value */ |
const char *hosts; /* Raw hosts text, may be hashed or list multiple */ |
const char *hosts; /* Raw hosts text, may be hashed or list multiple */ |
int was_hashed; /* Non-zero if hostname was hashed */ |
|
const char *rawkey; /* Text of key and any comment following it */ |
const char *rawkey; /* Text of key and any comment following it */ |
|
int keytype; /* Type of key; KEY_UNSPEC for invalid/comment lines */ |
struct sshkey *key; /* Key, if parsed ok and HKF_WANT_MATCH_HOST set */ |
struct sshkey *key; /* Key, if parsed ok and HKF_WANT_MATCH_HOST set */ |
const char *comment; /* Any comment following the key */ |
const char *comment; /* Any comment following the key */ |
}; |
}; |
|
|
*/ |
*/ |
typedef int hostkeys_foreach_fn(struct hostkey_foreach_line *l, void *ctx); |
typedef int hostkeys_foreach_fn(struct hostkey_foreach_line *l, void *ctx); |
|
|
|
/* Iterate over a hostkeys file */ |
int hostkeys_foreach(const char *path, hostkeys_foreach_fn *callback, void *ctx, |
int hostkeys_foreach(const char *path, hostkeys_foreach_fn *callback, void *ctx, |
const char *host, u_int options); |
const char *host, const char *ip, u_int options); |
|
|
#endif |
#endif |