summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-10-04 11:23:58 +0100
committerColin Watson <cjwatson@debian.org>2017-10-04 11:23:58 +0100
commit62f54f20bf351468e0124f63cc2902ee40d9b0e9 (patch)
tree3e090f2711b94ca5029d3fa3e8047b1ed1448b1f /monitor_wrap.c
parent6fabaf6fd9b07cc8bc6a17c9c4a5b76849cfc874 (diff)
parent66bf74a92131b7effe49fb0eefe5225151869dc5 (diff)
Import openssh_7.6p1.orig.tar.gz
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 64ff92885..69212aaf3 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_wrap.c,v 1.89 2016/08/13 17:47:41 markus Exp $ */ 1/* $OpenBSD: monitor_wrap.c,v 1.94 2017/10/02 19:33:20 djm Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -216,7 +216,7 @@ mm_choose_dh(int min, int nbits, int max)
216#endif 216#endif
217 217
218int 218int
219mm_key_sign(Key *key, u_char **sigp, u_int *lenp, 219mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp,
220 const u_char *data, u_int datalen, const char *hostkey_alg) 220 const u_char *data, u_int datalen, const char *hostkey_alg)
221{ 221{
222 struct kex *kex = *pmonitor->m_pkex; 222 struct kex *kex = *pmonitor->m_pkex;
@@ -242,6 +242,7 @@ mm_key_sign(Key *key, u_char **sigp, u_int *lenp,
242struct passwd * 242struct passwd *
243mm_getpwnamallow(const char *username) 243mm_getpwnamallow(const char *username)
244{ 244{
245 struct ssh *ssh = active_state; /* XXX */
245 Buffer m; 246 Buffer m;
246 struct passwd *pw; 247 struct passwd *pw;
247 u_int len, i; 248 u_int len, i;
@@ -289,12 +290,20 @@ out:
289 for (i = 0; i < newopts->nx; i++) \ 290 for (i = 0; i < newopts->nx; i++) \
290 newopts->x[i] = buffer_get_string(&m, NULL); \ 291 newopts->x[i] = buffer_get_string(&m, NULL); \
291 } while (0) 292 } while (0)
293#define M_CP_STRARRAYOPT_ALLOC(x, nx) do { \
294 newopts->x = newopts->nx == 0 ? \
295 NULL : xcalloc(newopts->nx, sizeof(*newopts->x)); \
296 M_CP_STRARRAYOPT(x, nx); \
297 } while (0)
292 /* See comment in servconf.h */ 298 /* See comment in servconf.h */
293 COPY_MATCH_STRING_OPTS(); 299 COPY_MATCH_STRING_OPTS();
294#undef M_CP_STROPT 300#undef M_CP_STROPT
295#undef M_CP_STRARRAYOPT 301#undef M_CP_STRARRAYOPT
302#undef M_CP_STRARRAYOPT_ALLOC
296 303
297 copy_set_server_options(&options, newopts, 1); 304 copy_set_server_options(&options, newopts, 1);
305 log_change_level(options.log_level);
306 process_permitopen(ssh, &options);
298 free(newopts); 307 free(newopts);
299 308
300 buffer_free(&m); 309 buffer_free(&m);
@@ -374,7 +383,8 @@ mm_auth_password(Authctxt *authctxt, char *password)
374} 383}
375 384
376int 385int
377mm_user_key_allowed(struct passwd *pw, Key *key, int pubkey_auth_attempt) 386mm_user_key_allowed(struct passwd *pw, struct sshkey *key,
387 int pubkey_auth_attempt)
378{ 388{
379 return (mm_key_allowed(MM_USERKEY, NULL, NULL, key, 389 return (mm_key_allowed(MM_USERKEY, NULL, NULL, key,
380 pubkey_auth_attempt)); 390 pubkey_auth_attempt));
@@ -382,14 +392,14 @@ mm_user_key_allowed(struct passwd *pw, Key *key, int pubkey_auth_attempt)
382 392
383int 393int
384mm_hostbased_key_allowed(struct passwd *pw, const char *user, const char *host, 394mm_hostbased_key_allowed(struct passwd *pw, const char *user, const char *host,
385 Key *key) 395 struct sshkey *key)
386{ 396{
387 return (mm_key_allowed(MM_HOSTKEY, user, host, key, 0)); 397 return (mm_key_allowed(MM_HOSTKEY, user, host, key, 0));
388} 398}
389 399
390int 400int
391mm_key_allowed(enum mm_keytype type, const char *user, const char *host, 401mm_key_allowed(enum mm_keytype type, const char *user, const char *host,
392 Key *key, int pubkey_auth_attempt) 402 struct sshkey *key, int pubkey_auth_attempt)
393{ 403{
394 Buffer m; 404 Buffer m;
395 u_char *blob; 405 u_char *blob;
@@ -434,12 +444,13 @@ mm_key_allowed(enum mm_keytype type, const char *user, const char *host,
434 */ 444 */
435 445
436int 446int
437mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen) 447mm_sshkey_verify(const struct sshkey *key, const u_char *sig, size_t siglen,
448 const u_char *data, size_t datalen, u_int compat)
438{ 449{
439 Buffer m; 450 Buffer m;
440 u_char *blob; 451 u_char *blob;
441 u_int len; 452 u_int len;
442 int verified = 0; 453 u_int encoded_ret = 0;
443 454
444 debug3("%s entering", __func__); 455 debug3("%s entering", __func__);
445 456
@@ -458,11 +469,13 @@ mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
458 debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __func__); 469 debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __func__);
459 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m); 470 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m);
460 471
461 verified = buffer_get_int(&m); 472 encoded_ret = buffer_get_int(&m);
462 473
463 buffer_free(&m); 474 buffer_free(&m);
464 475
465 return (verified); 476 if (encoded_ret != 0)
477 return SSH_ERR_SIGNATURE_INVALID;
478 return 0;
466} 479}
467 480
468void 481void