version 1.158, 2016/03/07 19:02:43 |
version 1.159, 2016/05/02 08:49:03 |
|
|
|
|
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
|
#include <limits.h> |
#include <paths.h> |
#include <paths.h> |
#include <poll.h> |
#include <poll.h> |
#include <pwd.h> |
#include <pwd.h> |
|
|
u_char *p = NULL, *signature = NULL; |
u_char *p = NULL, *signature = NULL; |
char *alg = NULL; |
char *alg = NULL; |
size_t datlen, siglen, alglen; |
size_t datlen, siglen, alglen; |
int r, keyid, is_proof = 0; |
int r, is_proof = 0; |
|
u_int keyid; |
const char proof_req[] = "hostkeys-prove-00@openssh.com"; |
const char proof_req[] = "hostkeys-prove-00@openssh.com"; |
|
|
debug3("%s", __func__); |
debug3("%s", __func__); |
|
|
(r = sshbuf_get_string(m, &p, &datlen)) != 0 || |
(r = sshbuf_get_string(m, &p, &datlen)) != 0 || |
(r = sshbuf_get_cstring(m, &alg, &alglen)) != 0) |
(r = sshbuf_get_cstring(m, &alg, &alglen)) != 0) |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
|
if (keyid > INT_MAX) |
|
fatal("%s: invalid key ID", __func__); |
|
|
/* |
/* |
* Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), |
* Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), |
|
|
monitor_valid_userblob(u_char *data, u_int datalen) |
monitor_valid_userblob(u_char *data, u_int datalen) |
{ |
{ |
Buffer b; |
Buffer b; |
char *p, *userstyle; |
u_char *p; |
|
char *userstyle, *cp; |
u_int len; |
u_int len; |
int fail = 0; |
int fail = 0; |
|
|
|
|
} |
} |
if (buffer_get_char(&b) != SSH2_MSG_USERAUTH_REQUEST) |
if (buffer_get_char(&b) != SSH2_MSG_USERAUTH_REQUEST) |
fail++; |
fail++; |
p = buffer_get_cstring(&b, NULL); |
cp = buffer_get_cstring(&b, NULL); |
xasprintf(&userstyle, "%s%s%s", authctxt->user, |
xasprintf(&userstyle, "%s%s%s", authctxt->user, |
authctxt->style ? ":" : "", |
authctxt->style ? ":" : "", |
authctxt->style ? authctxt->style : ""); |
authctxt->style ? authctxt->style : ""); |
if (strcmp(userstyle, p) != 0) { |
if (strcmp(userstyle, cp) != 0) { |
logit("wrong user name passed to monitor: expected %s != %.100s", |
logit("wrong user name passed to monitor: " |
userstyle, p); |
"expected %s != %.100s", userstyle, cp); |
fail++; |
fail++; |
} |
} |
free(userstyle); |
free(userstyle); |
free(p); |
free(cp); |
buffer_skip_string(&b); |
buffer_skip_string(&b); |
if (datafellows & SSH_BUG_PKAUTH) { |
if (datafellows & SSH_BUG_PKAUTH) { |
if (!buffer_get_char(&b)) |
if (!buffer_get_char(&b)) |
fail++; |
fail++; |
} else { |
} else { |
p = buffer_get_cstring(&b, NULL); |
cp = buffer_get_cstring(&b, NULL); |
if (strcmp("publickey", p) != 0) |
if (strcmp("publickey", cp) != 0) |
fail++; |
fail++; |
free(p); |
free(cp); |
if (!buffer_get_char(&b)) |
if (!buffer_get_char(&b)) |
fail++; |
fail++; |
buffer_skip_string(&b); |
buffer_skip_string(&b); |