Annotation of src/usr.bin/ssh/monitor_wrap.c, Revision 1.66
1.66 ! andreas 1: /* $OpenBSD: monitor_wrap.c,v 1.65 2009/03/05 07:18:19 djm Exp $ */
1.1 provos 2: /*
3: * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4: * Copyright 2002 Markus Friedl <markus@openbsd.org>
5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26: */
27:
1.46 stevesk 28: #include <sys/types.h>
1.51 dtucker 29: #include <sys/uio.h>
1.61 djm 30: #include <sys/queue.h>
1.46 stevesk 31:
1.1 provos 32: #include <openssl/bn.h>
33: #include <openssl/dh.h>
1.64 djm 34: #include <openssl/evp.h>
1.46 stevesk 35:
1.47 stevesk 36: #include <errno.h>
1.46 stevesk 37: #include <pwd.h>
1.50 deraadt 38: #include <signal.h>
1.49 stevesk 39: #include <stdio.h>
1.48 stevesk 40: #include <string.h>
1.51 dtucker 41: #include <unistd.h>
1.1 provos 42:
1.50 deraadt 43: #include "xmalloc.h"
1.1 provos 44: #include "ssh.h"
45: #include "dh.h"
1.50 deraadt 46: #include "buffer.h"
47: #include "key.h"
48: #include "cipher.h"
1.1 provos 49: #include "kex.h"
1.50 deraadt 50: #include "hostfile.h"
1.1 provos 51: #include "auth.h"
1.22 markus 52: #include "auth-options.h"
1.1 provos 53: #include "packet.h"
54: #include "mac.h"
55: #include "log.h"
1.54 miod 56: #include <zlib.h>
1.1 provos 57: #include "monitor.h"
1.50 deraadt 58: #ifdef GSSAPI
59: #include "ssh-gss.h"
60: #endif
1.1 provos 61: #include "monitor_wrap.h"
62: #include "atomicio.h"
63: #include "monitor_fdpass.h"
1.45 djm 64: #include "misc.h"
1.65 djm 65: #include "schnorr.h"
1.64 djm 66: #include "jpake.h"
1.1 provos 67:
68: #include "channels.h"
69: #include "session.h"
1.55 dtucker 70: #include "servconf.h"
1.29 markus 71:
1.1 provos 72: /* Imports */
73: extern int compat20;
74: extern z_stream incoming_stream;
75: extern z_stream outgoing_stream;
1.7 mouring 76: extern struct monitor *pmonitor;
1.39 dtucker 77: extern Buffer loginmsg;
1.55 dtucker 78: extern ServerOptions options;
1.1 provos 79:
1.32 markus 80: int
81: mm_is_monitor(void)
82: {
83: /*
84: * m_pid is only set in the privileged part, and
85: * points to the unprivileged child.
86: */
1.34 markus 87: return (pmonitor && pmonitor->m_pid > 0);
1.32 markus 88: }
89:
1.1 provos 90: void
1.36 avsm 91: mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
1.1 provos 92: {
1.13 deraadt 93: u_int mlen = buffer_len(m);
1.1 provos 94: u_char buf[5];
95:
1.8 markus 96: debug3("%s entering: type %d", __func__, type);
1.1 provos 97:
1.45 djm 98: put_u32(buf, mlen + 1);
1.10 deraadt 99: buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
1.36 avsm 100: if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
1.40 avsm 101: fatal("%s: write: %s", __func__, strerror(errno));
1.36 avsm 102: if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
1.40 avsm 103: fatal("%s: write: %s", __func__, strerror(errno));
1.1 provos 104: }
105:
106: void
1.36 avsm 107: mm_request_receive(int sock, Buffer *m)
1.1 provos 108: {
109: u_char buf[4];
1.13 deraadt 110: u_int msg_len;
1.1 provos 111:
1.8 markus 112: debug3("%s entering", __func__);
1.1 provos 113:
1.40 avsm 114: if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) {
115: if (errno == EPIPE)
1.32 markus 116: cleanup_exit(255);
1.40 avsm 117: fatal("%s: read: %s", __func__, strerror(errno));
1.1 provos 118: }
1.45 djm 119: msg_len = get_u32(buf);
1.1 provos 120: if (msg_len > 256 * 1024)
1.8 markus 121: fatal("%s: read: bad msg_len %d", __func__, msg_len);
1.1 provos 122: buffer_clear(m);
123: buffer_append_space(m, msg_len);
1.40 avsm 124: if (atomicio(read, sock, buffer_ptr(m), msg_len) != msg_len)
125: fatal("%s: read: %s", __func__, strerror(errno));
1.1 provos 126: }
127:
128: void
1.36 avsm 129: mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m)
1.1 provos 130: {
131: u_char rtype;
132:
1.8 markus 133: debug3("%s entering: type %d", __func__, type);
1.1 provos 134:
1.36 avsm 135: mm_request_receive(sock, m);
1.1 provos 136: rtype = buffer_get_char(m);
137: if (rtype != type)
1.8 markus 138: fatal("%s: read: rtype %d != type %d", __func__,
1.1 provos 139: rtype, type);
140: }
141:
142: DH *
143: mm_choose_dh(int min, int nbits, int max)
144: {
145: BIGNUM *p, *g;
146: int success = 0;
147: Buffer m;
148:
149: buffer_init(&m);
150: buffer_put_int(&m, min);
151: buffer_put_int(&m, nbits);
152: buffer_put_int(&m, max);
153:
1.7 mouring 154: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_MODULI, &m);
1.1 provos 155:
1.8 markus 156: debug3("%s: waiting for MONITOR_ANS_MODULI", __func__);
1.7 mouring 157: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_MODULI, &m);
1.1 provos 158:
159: success = buffer_get_char(&m);
160: if (success == 0)
1.8 markus 161: fatal("%s: MONITOR_ANS_MODULI failed", __func__);
1.1 provos 162:
163: if ((p = BN_new()) == NULL)
1.8 markus 164: fatal("%s: BN_new failed", __func__);
1.3 markus 165: if ((g = BN_new()) == NULL)
1.8 markus 166: fatal("%s: BN_new failed", __func__);
1.1 provos 167: buffer_get_bignum2(&m, p);
168: buffer_get_bignum2(&m, g);
169:
1.8 markus 170: debug3("%s: remaining %d", __func__, buffer_len(&m));
1.1 provos 171: buffer_free(&m);
172:
173: return (dh_new_group(g, p));
174: }
175:
176: int
177: mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen)
178: {
1.7 mouring 179: Kex *kex = *pmonitor->m_pkex;
1.1 provos 180: Buffer m;
181:
1.8 markus 182: debug3("%s entering", __func__);
1.1 provos 183:
184: buffer_init(&m);
185: buffer_put_int(&m, kex->host_key_index(key));
186: buffer_put_string(&m, data, datalen);
187:
1.7 mouring 188: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m);
1.1 provos 189:
1.8 markus 190: debug3("%s: waiting for MONITOR_ANS_SIGN", __func__);
1.7 mouring 191: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, &m);
1.1 provos 192: *sigp = buffer_get_string(&m, lenp);
193: buffer_free(&m);
194:
195: return (0);
196: }
197:
198: struct passwd *
1.37 dtucker 199: mm_getpwnamallow(const char *username)
1.1 provos 200: {
201: Buffer m;
202: struct passwd *pw;
1.55 dtucker 203: u_int len;
204: ServerOptions *newopts;
1.1 provos 205:
1.8 markus 206: debug3("%s entering", __func__);
1.1 provos 207:
208: buffer_init(&m);
1.37 dtucker 209: buffer_put_cstring(&m, username);
1.1 provos 210:
1.7 mouring 211: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m);
1.1 provos 212:
1.8 markus 213: debug3("%s: waiting for MONITOR_ANS_PWNAM", __func__);
1.7 mouring 214: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, &m);
1.1 provos 215:
216: if (buffer_get_char(&m) == 0) {
1.60 dtucker 217: pw = NULL;
218: goto out;
1.1 provos 219: }
1.55 dtucker 220: pw = buffer_get_string(&m, &len);
221: if (len != sizeof(struct passwd))
1.8 markus 222: fatal("%s: struct passwd size mismatch", __func__);
1.1 provos 223: pw->pw_name = buffer_get_string(&m, NULL);
224: pw->pw_passwd = buffer_get_string(&m, NULL);
225: pw->pw_gecos = buffer_get_string(&m, NULL);
226: pw->pw_class = buffer_get_string(&m, NULL);
227: pw->pw_dir = buffer_get_string(&m, NULL);
228: pw->pw_shell = buffer_get_string(&m, NULL);
1.55 dtucker 229:
1.60 dtucker 230: out:
1.55 dtucker 231: /* copy options block as a Match directive may have changed some */
232: newopts = buffer_get_string(&m, &len);
233: if (len != sizeof(*newopts))
234: fatal("%s: option block size mismatch", __func__);
235: if (newopts->banner != NULL)
236: newopts->banner = buffer_get_string(&m, NULL);
237: copy_set_server_options(&options, newopts, 1);
238: xfree(newopts);
239:
1.1 provos 240: buffer_free(&m);
241:
242: return (pw);
1.6 djm 243: }
244:
1.33 markus 245: char *
246: mm_auth2_read_banner(void)
1.6 djm 247: {
248: Buffer m;
249: char *banner;
250:
1.8 markus 251: debug3("%s entering", __func__);
1.6 djm 252:
253: buffer_init(&m);
1.7 mouring 254: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m);
1.6 djm 255: buffer_clear(&m);
256:
1.33 markus 257: mm_request_receive_expect(pmonitor->m_recvfd,
258: MONITOR_ANS_AUTH2_READ_BANNER, &m);
1.6 djm 259: banner = buffer_get_string(&m, NULL);
260: buffer_free(&m);
1.10 deraadt 261:
1.33 markus 262: /* treat empty banner as missing banner */
263: if (strlen(banner) == 0) {
264: xfree(banner);
265: banner = NULL;
266: }
1.6 djm 267: return (banner);
1.1 provos 268: }
269:
270: /* Inform the privileged process about service and style */
271:
272: void
273: mm_inform_authserv(char *service, char *style)
274: {
275: Buffer m;
276:
1.8 markus 277: debug3("%s entering", __func__);
1.1 provos 278:
279: buffer_init(&m);
280: buffer_put_cstring(&m, service);
281: buffer_put_cstring(&m, style ? style : "");
282:
1.7 mouring 283: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m);
1.1 provos 284:
285: buffer_free(&m);
286: }
287:
288: /* Do the password authentication */
289: int
290: mm_auth_password(Authctxt *authctxt, char *password)
291: {
292: Buffer m;
293: int authenticated = 0;
294:
1.8 markus 295: debug3("%s entering", __func__);
1.1 provos 296:
297: buffer_init(&m);
298: buffer_put_cstring(&m, password);
1.7 mouring 299: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHPASSWORD, &m);
1.1 provos 300:
1.8 markus 301: debug3("%s: waiting for MONITOR_ANS_AUTHPASSWORD", __func__);
1.7 mouring 302: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUTHPASSWORD, &m);
1.1 provos 303:
304: authenticated = buffer_get_int(&m);
305:
306: buffer_free(&m);
307:
1.3 markus 308: debug3("%s: user %sauthenticated",
1.8 markus 309: __func__, authenticated ? "" : "not ");
1.1 provos 310: return (authenticated);
311: }
312:
313: int
314: mm_user_key_allowed(struct passwd *pw, Key *key)
315: {
316: return (mm_key_allowed(MM_USERKEY, NULL, NULL, key));
317: }
318:
319: int
320: mm_hostbased_key_allowed(struct passwd *pw, char *user, char *host,
321: Key *key)
322: {
323: return (mm_key_allowed(MM_HOSTKEY, user, host, key));
324: }
325:
326: int
327: mm_auth_rhosts_rsa_key_allowed(struct passwd *pw, char *user,
328: char *host, Key *key)
329: {
330: int ret;
331:
332: key->type = KEY_RSA; /* XXX hack for key_to_blob */
333: ret = mm_key_allowed(MM_RSAHOSTKEY, user, host, key);
334: key->type = KEY_RSA1;
335: return (ret);
336: }
337:
1.2 markus 338: static void
1.1 provos 339: mm_send_debug(Buffer *m)
340: {
341: char *msg;
342:
343: while (buffer_len(m)) {
344: msg = buffer_get_string(m, NULL);
1.8 markus 345: debug3("%s: Sending debug: %s", __func__, msg);
1.1 provos 346: packet_send_debug("%s", msg);
347: xfree(msg);
348: }
349: }
350:
351: int
352: mm_key_allowed(enum mm_keytype type, char *user, char *host, Key *key)
353: {
354: Buffer m;
355: u_char *blob;
356: u_int len;
1.22 markus 357: int allowed = 0, have_forced = 0;
1.1 provos 358:
1.8 markus 359: debug3("%s entering", __func__);
1.1 provos 360:
361: /* Convert the key to a blob and the pass it over */
362: if (!key_to_blob(key, &blob, &len))
363: return (0);
364:
365: buffer_init(&m);
366: buffer_put_int(&m, type);
367: buffer_put_cstring(&m, user ? user : "");
368: buffer_put_cstring(&m, host ? host : "");
369: buffer_put_string(&m, blob, len);
370: xfree(blob);
371:
1.7 mouring 372: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYALLOWED, &m);
1.1 provos 373:
1.8 markus 374: debug3("%s: waiting for MONITOR_ANS_KEYALLOWED", __func__);
1.7 mouring 375: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYALLOWED, &m);
1.1 provos 376:
377: allowed = buffer_get_int(&m);
378:
1.22 markus 379: /* fake forced command */
380: auth_clear_options();
381: have_forced = buffer_get_int(&m);
382: forced_command = have_forced ? xstrdup("true") : NULL;
383:
1.1 provos 384: /* Send potential debug messages */
385: mm_send_debug(&m);
386:
387: buffer_free(&m);
388:
389: return (allowed);
390: }
391:
1.3 markus 392: /*
1.1 provos 393: * This key verify needs to send the key type along, because the
394: * privileged parent makes the decision if the key is allowed
395: * for authentication.
396: */
397:
398: int
399: mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
400: {
401: Buffer m;
402: u_char *blob;
403: u_int len;
404: int verified = 0;
405:
1.8 markus 406: debug3("%s entering", __func__);
1.1 provos 407:
408: /* Convert the key to a blob and the pass it over */
409: if (!key_to_blob(key, &blob, &len))
410: return (0);
411:
412: buffer_init(&m);
413: buffer_put_string(&m, blob, len);
414: buffer_put_string(&m, sig, siglen);
415: buffer_put_string(&m, data, datalen);
416: xfree(blob);
417:
1.7 mouring 418: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYVERIFY, &m);
1.1 provos 419:
1.8 markus 420: debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __func__);
1.7 mouring 421: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m);
1.1 provos 422:
423: verified = buffer_get_int(&m);
424:
425: buffer_free(&m);
426:
427: return (verified);
428: }
429:
430: /* Export key state after authentication */
431: Newkeys *
432: mm_newkeys_from_blob(u_char *blob, int blen)
433: {
434: Buffer b;
435: u_int len;
436: Newkeys *newkey = NULL;
437: Enc *enc;
438: Mac *mac;
439: Comp *comp;
440:
1.8 markus 441: debug3("%s: %p(%d)", __func__, blob, blen);
1.1 provos 442: #ifdef DEBUG_PK
443: dump_base64(stderr, blob, blen);
444: #endif
445: buffer_init(&b);
446: buffer_append(&b, blob, blen);
447:
448: newkey = xmalloc(sizeof(*newkey));
449: enc = &newkey->enc;
450: mac = &newkey->mac;
451: comp = &newkey->comp;
452:
453: /* Enc structure */
454: enc->name = buffer_get_string(&b, NULL);
455: buffer_get(&b, &enc->cipher, sizeof(enc->cipher));
456: enc->enabled = buffer_get_int(&b);
457: enc->block_size = buffer_get_int(&b);
458: enc->key = buffer_get_string(&b, &enc->key_len);
459: enc->iv = buffer_get_string(&b, &len);
460: if (len != enc->block_size)
1.12 deraadt 461: fatal("%s: bad ivlen: expected %u != %u", __func__,
1.1 provos 462: enc->block_size, len);
463:
464: if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher)
1.8 markus 465: fatal("%s: bad cipher name %s or pointer %p", __func__,
1.1 provos 466: enc->name, enc->cipher);
467:
468: /* Mac structure */
469: mac->name = buffer_get_string(&b, NULL);
1.56 djm 470: if (mac->name == NULL || mac_setup(mac, mac->name) == -1)
1.57 pvalchev 471: fatal("%s: can not setup mac %s", __func__, mac->name);
1.1 provos 472: mac->enabled = buffer_get_int(&b);
473: mac->key = buffer_get_string(&b, &len);
474: if (len > mac->key_len)
1.12 deraadt 475: fatal("%s: bad mac key length: %u > %d", __func__, len,
1.1 provos 476: mac->key_len);
477: mac->key_len = len;
478:
479: /* Comp structure */
480: comp->type = buffer_get_int(&b);
481: comp->enabled = buffer_get_int(&b);
482: comp->name = buffer_get_string(&b, NULL);
483:
484: len = buffer_len(&b);
485: if (len != 0)
1.12 deraadt 486: error("newkeys_from_blob: remaining bytes in blob %u", len);
1.1 provos 487: buffer_free(&b);
488: return (newkey);
489: }
490:
491: int
492: mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
493: {
494: Buffer b;
495: int len;
496: Enc *enc;
497: Mac *mac;
498: Comp *comp;
1.66 ! andreas 499: Newkeys *newkey = (Newkeys *)packet_get_newkeys(mode);
1.1 provos 500:
1.8 markus 501: debug3("%s: converting %p", __func__, newkey);
1.1 provos 502:
503: if (newkey == NULL) {
1.8 markus 504: error("%s: newkey == NULL", __func__);
1.1 provos 505: return 0;
506: }
507: enc = &newkey->enc;
508: mac = &newkey->mac;
509: comp = &newkey->comp;
510:
511: buffer_init(&b);
512: /* Enc structure */
513: buffer_put_cstring(&b, enc->name);
514: /* The cipher struct is constant and shared, you export pointer */
515: buffer_append(&b, &enc->cipher, sizeof(enc->cipher));
516: buffer_put_int(&b, enc->enabled);
517: buffer_put_int(&b, enc->block_size);
518: buffer_put_string(&b, enc->key, enc->key_len);
519: packet_get_keyiv(mode, enc->iv, enc->block_size);
520: buffer_put_string(&b, enc->iv, enc->block_size);
521:
522: /* Mac structure */
523: buffer_put_cstring(&b, mac->name);
524: buffer_put_int(&b, mac->enabled);
525: buffer_put_string(&b, mac->key, mac->key_len);
526:
527: /* Comp structure */
528: buffer_put_int(&b, comp->type);
529: buffer_put_int(&b, comp->enabled);
530: buffer_put_cstring(&b, comp->name);
531:
532: len = buffer_len(&b);
1.16 markus 533: if (lenp != NULL)
534: *lenp = len;
535: if (blobp != NULL) {
536: *blobp = xmalloc(len);
537: memcpy(*blobp, buffer_ptr(&b), len);
538: }
1.1 provos 539: memset(buffer_ptr(&b), 0, len);
540: buffer_free(&b);
541: return len;
542: }
543:
1.2 markus 544: static void
1.1 provos 545: mm_send_kex(Buffer *m, Kex *kex)
546: {
547: buffer_put_string(m, kex->session_id, kex->session_id_len);
548: buffer_put_int(m, kex->we_need);
549: buffer_put_int(m, kex->hostkey_type);
550: buffer_put_int(m, kex->kex_type);
551: buffer_put_string(m, buffer_ptr(&kex->my), buffer_len(&kex->my));
552: buffer_put_string(m, buffer_ptr(&kex->peer), buffer_len(&kex->peer));
553: buffer_put_int(m, kex->flags);
554: buffer_put_cstring(m, kex->client_version_string);
555: buffer_put_cstring(m, kex->server_version_string);
556: }
557:
558: void
1.36 avsm 559: mm_send_keystate(struct monitor *monitor)
1.1 provos 560: {
1.66 ! andreas 561: Buffer m, *input, *output;
1.1 provos 562: u_char *blob, *p;
563: u_int bloblen, plen;
1.25 markus 564: u_int32_t seqnr, packets;
1.63 markus 565: u_int64_t blocks, bytes;
1.1 provos 566:
567: buffer_init(&m);
568:
569: if (!compat20) {
570: u_char iv[24];
1.11 markus 571: u_char *key;
572: u_int ivlen, keylen;
1.1 provos 573:
574: buffer_put_int(&m, packet_get_protocol_flags());
575:
576: buffer_put_int(&m, packet_get_ssh1_cipher());
577:
1.11 markus 578: debug3("%s: Sending ssh1 KEY+IV", __func__);
579: keylen = packet_get_encryption_key(NULL);
580: key = xmalloc(keylen+1); /* add 1 if keylen == 0 */
581: keylen = packet_get_encryption_key(key);
582: buffer_put_string(&m, key, keylen);
583: memset(key, 0, keylen);
584: xfree(key);
585:
1.1 provos 586: ivlen = packet_get_keyiv_len(MODE_OUT);
587: packet_get_keyiv(MODE_OUT, iv, ivlen);
588: buffer_put_string(&m, iv, ivlen);
589: ivlen = packet_get_keyiv_len(MODE_OUT);
590: packet_get_keyiv(MODE_IN, iv, ivlen);
591: buffer_put_string(&m, iv, ivlen);
592: goto skip;
593: } else {
594: /* Kex for rekeying */
1.36 avsm 595: mm_send_kex(&m, *monitor->m_pkex);
1.1 provos 596: }
597:
598: debug3("%s: Sending new keys: %p %p",
1.66 ! andreas 599: __func__, packet_get_newkeys(MODE_OUT),
! 600: packet_get_newkeys(MODE_IN));
1.1 provos 601:
602: /* Keys from Kex */
603: if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen))
1.8 markus 604: fatal("%s: conversion of newkeys failed", __func__);
1.1 provos 605:
606: buffer_put_string(&m, blob, bloblen);
607: xfree(blob);
608:
609: if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen))
1.8 markus 610: fatal("%s: conversion of newkeys failed", __func__);
1.1 provos 611:
612: buffer_put_string(&m, blob, bloblen);
613: xfree(blob);
614:
1.63 markus 615: packet_get_state(MODE_OUT, &seqnr, &blocks, &packets, &bytes);
1.25 markus 616: buffer_put_int(&m, seqnr);
617: buffer_put_int64(&m, blocks);
618: buffer_put_int(&m, packets);
1.63 markus 619: buffer_put_int64(&m, bytes);
620: packet_get_state(MODE_IN, &seqnr, &blocks, &packets, &bytes);
1.25 markus 621: buffer_put_int(&m, seqnr);
622: buffer_put_int64(&m, blocks);
623: buffer_put_int(&m, packets);
1.63 markus 624: buffer_put_int64(&m, bytes);
1.1 provos 625:
1.8 markus 626: debug3("%s: New keys have been sent", __func__);
1.1 provos 627: skip:
628: /* More key context */
629: plen = packet_get_keycontext(MODE_OUT, NULL);
630: p = xmalloc(plen+1);
631: packet_get_keycontext(MODE_OUT, p);
632: buffer_put_string(&m, p, plen);
633: xfree(p);
634:
635: plen = packet_get_keycontext(MODE_IN, NULL);
636: p = xmalloc(plen+1);
637: packet_get_keycontext(MODE_IN, p);
638: buffer_put_string(&m, p, plen);
639: xfree(p);
640:
641: /* Compression state */
1.8 markus 642: debug3("%s: Sending compression state", __func__);
1.1 provos 643: buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream));
644: buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream));
645:
646: /* Network I/O buffers */
1.66 ! andreas 647: input = (Buffer *)packet_get_input();
! 648: output = (Buffer *)packet_get_output();
! 649: buffer_put_string(&m, buffer_ptr(input), buffer_len(input));
! 650: buffer_put_string(&m, buffer_ptr(output), buffer_len(output));
1.1 provos 651:
1.36 avsm 652: mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
1.8 markus 653: debug3("%s: Finished sending state", __func__);
1.1 provos 654:
655: buffer_free(&m);
656: }
657:
658: int
1.42 deraadt 659: mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen)
1.1 provos 660: {
661: Buffer m;
1.39 dtucker 662: char *p, *msg;
1.62 djm 663: int success = 0, tmp1 = -1, tmp2 = -1;
664:
665: /* Kludge: ensure there are fds free to receive the pty/tty */
666: if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
667: (tmp2 = dup(pmonitor->m_recvfd)) == -1) {
668: error("%s: cannot allocate fds for pty", __func__);
669: if (tmp1 > 0)
670: close(tmp1);
671: if (tmp2 > 0)
672: close(tmp2);
673: return 0;
674: }
675: close(tmp1);
676: close(tmp2);
1.1 provos 677:
678: buffer_init(&m);
1.7 mouring 679: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m);
1.1 provos 680:
1.8 markus 681: debug3("%s: waiting for MONITOR_ANS_PTY", __func__);
1.7 mouring 682: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, &m);
1.1 provos 683:
684: success = buffer_get_int(&m);
685: if (success == 0) {
1.8 markus 686: debug3("%s: pty alloc failed", __func__);
1.1 provos 687: buffer_free(&m);
688: return (0);
689: }
690: p = buffer_get_string(&m, NULL);
1.39 dtucker 691: msg = buffer_get_string(&m, NULL);
1.1 provos 692: buffer_free(&m);
693:
694: strlcpy(namebuf, p, namebuflen); /* Possible truncation */
695: xfree(p);
1.39 dtucker 696:
697: buffer_append(&loginmsg, msg, strlen(msg));
698: xfree(msg);
1.1 provos 699:
1.58 djm 700: if ((*ptyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1 ||
701: (*ttyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1)
702: fatal("%s: receive fds failed", __func__);
1.1 provos 703:
704: /* Success */
705: return (1);
706: }
707:
708: void
1.32 markus 709: mm_session_pty_cleanup2(Session *s)
1.1 provos 710: {
711: Buffer m;
712:
713: if (s->ttyfd == -1)
714: return;
715: buffer_init(&m);
716: buffer_put_cstring(&m, s->tty);
1.7 mouring 717: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTYCLEANUP, &m);
1.1 provos 718: buffer_free(&m);
1.3 markus 719:
1.1 provos 720: /* closed dup'ed master */
1.62 djm 721: if (s->ptymaster != -1 && close(s->ptymaster) < 0)
722: error("close(s->ptymaster/%d): %s",
723: s->ptymaster, strerror(errno));
1.1 provos 724:
725: /* unlink pty from session */
726: s->ttyfd = -1;
727: }
728:
729: /* Request process termination */
730:
731: void
732: mm_terminate(void)
733: {
734: Buffer m;
735:
736: buffer_init(&m);
1.7 mouring 737: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_TERM, &m);
1.1 provos 738: buffer_free(&m);
739: }
740:
741: int
742: mm_ssh1_session_key(BIGNUM *num)
743: {
744: int rsafail;
745: Buffer m;
746:
747: buffer_init(&m);
748: buffer_put_bignum2(&m, num);
1.7 mouring 749: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSKEY, &m);
1.1 provos 750:
1.7 mouring 751: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SESSKEY, &m);
1.1 provos 752:
753: rsafail = buffer_get_int(&m);
754: buffer_get_bignum2(&m, num);
755:
756: buffer_free(&m);
757:
758: return (rsafail);
759: }
760:
1.2 markus 761: static void
1.1 provos 762: mm_chall_setup(char **name, char **infotxt, u_int *numprompts,
763: char ***prompts, u_int **echo_on)
764: {
1.10 deraadt 765: *name = xstrdup("");
766: *infotxt = xstrdup("");
1.1 provos 767: *numprompts = 1;
1.43 djm 768: *prompts = xcalloc(*numprompts, sizeof(char *));
769: *echo_on = xcalloc(*numprompts, sizeof(u_int));
1.1 provos 770: (*echo_on)[0] = 0;
771: }
772:
773: int
774: mm_bsdauth_query(void *ctx, char **name, char **infotxt,
775: u_int *numprompts, char ***prompts, u_int **echo_on)
776: {
777: Buffer m;
1.21 markus 778: u_int success;
1.1 provos 779: char *challenge;
780:
1.8 markus 781: debug3("%s: entering", __func__);
1.1 provos 782:
783: buffer_init(&m);
1.7 mouring 784: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m);
1.1 provos 785:
1.7 mouring 786: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY,
1.1 provos 787: &m);
1.21 markus 788: success = buffer_get_int(&m);
789: if (success == 0) {
1.8 markus 790: debug3("%s: no challenge", __func__);
1.1 provos 791: buffer_free(&m);
792: return (-1);
793: }
794:
795: /* Get the challenge, and format the response */
796: challenge = buffer_get_string(&m, NULL);
797: buffer_free(&m);
798:
799: mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
800: (*prompts)[0] = challenge;
801:
1.8 markus 802: debug3("%s: received challenge: %s", __func__, challenge);
1.1 provos 803:
804: return (0);
805: }
806:
807: int
808: mm_bsdauth_respond(void *ctx, u_int numresponses, char **responses)
809: {
810: Buffer m;
811: int authok;
812:
1.8 markus 813: debug3("%s: entering", __func__);
1.1 provos 814: if (numresponses != 1)
815: return (-1);
816:
817: buffer_init(&m);
818: buffer_put_cstring(&m, responses[0]);
1.7 mouring 819: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, &m);
1.1 provos 820:
1.7 mouring 821: mm_request_receive_expect(pmonitor->m_recvfd,
1.1 provos 822: MONITOR_ANS_BSDAUTHRESPOND, &m);
823:
824: authok = buffer_get_int(&m);
825: buffer_free(&m);
826:
827: return ((authok == 0) ? -1 : 0);
828: }
829:
830:
831: void
832: mm_ssh1_session_id(u_char session_id[16])
833: {
834: Buffer m;
835: int i;
836:
1.8 markus 837: debug3("%s entering", __func__);
1.1 provos 838:
839: buffer_init(&m);
840: for (i = 0; i < 16; i++)
841: buffer_put_char(&m, session_id[i]);
842:
1.7 mouring 843: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSID, &m);
1.1 provos 844: buffer_free(&m);
845: }
846:
847: int
848: mm_auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
849: {
850: Buffer m;
851: Key *key;
852: u_char *blob;
853: u_int blen;
1.22 markus 854: int allowed = 0, have_forced = 0;
1.1 provos 855:
1.8 markus 856: debug3("%s entering", __func__);
1.1 provos 857:
858: buffer_init(&m);
859: buffer_put_bignum2(&m, client_n);
860:
1.7 mouring 861: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSAKEYALLOWED, &m);
862: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSAKEYALLOWED, &m);
1.1 provos 863:
864: allowed = buffer_get_int(&m);
1.22 markus 865:
866: /* fake forced command */
867: auth_clear_options();
868: have_forced = buffer_get_int(&m);
869: forced_command = have_forced ? xstrdup("true") : NULL;
1.1 provos 870:
871: if (allowed && rkey != NULL) {
872: blob = buffer_get_string(&m, &blen);
873: if ((key = key_from_blob(blob, blen)) == NULL)
1.8 markus 874: fatal("%s: key_from_blob failed", __func__);
1.1 provos 875: *rkey = key;
876: xfree(blob);
877: }
878: mm_send_debug(&m);
879: buffer_free(&m);
880:
881: return (allowed);
882: }
883:
884: BIGNUM *
885: mm_auth_rsa_generate_challenge(Key *key)
886: {
887: Buffer m;
888: BIGNUM *challenge;
889: u_char *blob;
890: u_int blen;
891:
1.8 markus 892: debug3("%s entering", __func__);
1.1 provos 893:
894: if ((challenge = BN_new()) == NULL)
1.8 markus 895: fatal("%s: BN_new failed", __func__);
1.1 provos 896:
897: key->type = KEY_RSA; /* XXX cheat for key_to_blob */
898: if (key_to_blob(key, &blob, &blen) == 0)
1.8 markus 899: fatal("%s: key_to_blob failed", __func__);
1.1 provos 900: key->type = KEY_RSA1;
901:
902: buffer_init(&m);
903: buffer_put_string(&m, blob, blen);
904: xfree(blob);
905:
1.7 mouring 906: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSACHALLENGE, &m);
907: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSACHALLENGE, &m);
1.1 provos 908:
909: buffer_get_bignum2(&m, challenge);
910: buffer_free(&m);
911:
912: return (challenge);
913: }
914:
915: int
916: mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16])
917: {
918: Buffer m;
919: u_char *blob;
920: u_int blen;
921: int success = 0;
922:
1.8 markus 923: debug3("%s entering", __func__);
1.1 provos 924:
925: key->type = KEY_RSA; /* XXX cheat for key_to_blob */
926: if (key_to_blob(key, &blob, &blen) == 0)
1.8 markus 927: fatal("%s: key_to_blob failed", __func__);
1.1 provos 928: key->type = KEY_RSA1;
929:
930: buffer_init(&m);
931: buffer_put_string(&m, blob, blen);
932: buffer_put_string(&m, response, 16);
933: xfree(blob);
934:
1.7 mouring 935: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSARESPONSE, &m);
936: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSARESPONSE, &m);
1.1 provos 937:
938: success = buffer_get_int(&m);
939: buffer_free(&m);
940:
941: return (success);
942: }
1.29 markus 943:
944: #ifdef GSSAPI
945: OM_uint32
1.36 avsm 946: mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid)
1.29 markus 947: {
948: Buffer m;
949: OM_uint32 major;
950:
951: /* Client doesn't get to see the context */
952: *ctx = NULL;
953:
954: buffer_init(&m);
1.36 avsm 955: buffer_put_string(&m, goid->elements, goid->length);
1.29 markus 956:
957: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);
958: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);
959:
960: major = buffer_get_int(&m);
961:
962: buffer_free(&m);
963: return (major);
964: }
965:
966: OM_uint32
967: mm_ssh_gssapi_accept_ctx(Gssctxt *ctx, gss_buffer_desc *in,
968: gss_buffer_desc *out, OM_uint32 *flags)
969: {
970: Buffer m;
971: OM_uint32 major;
1.30 deraadt 972: u_int len;
1.29 markus 973:
974: buffer_init(&m);
975: buffer_put_string(&m, in->value, in->length);
976:
977: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSTEP, &m);
978: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSTEP, &m);
979:
980: major = buffer_get_int(&m);
1.30 deraadt 981: out->value = buffer_get_string(&m, &len);
982: out->length = len;
1.29 markus 983: if (flags)
984: *flags = buffer_get_int(&m);
985:
986: buffer_free(&m);
987:
988: return (major);
1.35 markus 989: }
990:
991: OM_uint32
992: mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic)
993: {
994: Buffer m;
995: OM_uint32 major;
996:
997: buffer_init(&m);
998: buffer_put_string(&m, gssbuf->value, gssbuf->length);
999: buffer_put_string(&m, gssmic->value, gssmic->length);
1000:
1001: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSCHECKMIC, &m);
1002: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSCHECKMIC,
1003: &m);
1004:
1005: major = buffer_get_int(&m);
1006: buffer_free(&m);
1007: return(major);
1.29 markus 1008: }
1009:
1010: int
1011: mm_ssh_gssapi_userok(char *user)
1012: {
1013: Buffer m;
1014: int authenticated = 0;
1015:
1016: buffer_init(&m);
1017:
1018: mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSUSEROK, &m);
1019: mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSUSEROK,
1020: &m);
1021:
1022: authenticated = buffer_get_int(&m);
1023:
1024: buffer_free(&m);
1025: debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not ");
1026: return (authenticated);
1027: }
1028: #endif /* GSSAPI */
1.64 djm 1029:
1030: #ifdef JPAKE
1031: void
1032: mm_auth2_jpake_get_pwdata(Authctxt *authctxt, BIGNUM **s,
1033: char **hash_scheme, char **salt)
1034: {
1035: Buffer m;
1036:
1037: debug3("%s entering", __func__);
1038:
1039: buffer_init(&m);
1040: mm_request_send(pmonitor->m_recvfd,
1041: MONITOR_REQ_JPAKE_GET_PWDATA, &m);
1042:
1043: debug3("%s: waiting for MONITOR_ANS_JPAKE_GET_PWDATA", __func__);
1044: mm_request_receive_expect(pmonitor->m_recvfd,
1045: MONITOR_ANS_JPAKE_GET_PWDATA, &m);
1046:
1047: *hash_scheme = buffer_get_string(&m, NULL);
1048: *salt = buffer_get_string(&m, NULL);
1049:
1050: buffer_free(&m);
1051: }
1052:
1053: void
1.65 djm 1054: mm_jpake_step1(struct modp_group *grp,
1.64 djm 1055: u_char **id, u_int *id_len,
1056: BIGNUM **priv1, BIGNUM **priv2, BIGNUM **g_priv1, BIGNUM **g_priv2,
1057: u_char **priv1_proof, u_int *priv1_proof_len,
1058: u_char **priv2_proof, u_int *priv2_proof_len)
1059: {
1060: Buffer m;
1061:
1062: debug3("%s entering", __func__);
1063:
1064: buffer_init(&m);
1065: mm_request_send(pmonitor->m_recvfd,
1066: MONITOR_REQ_JPAKE_STEP1, &m);
1067:
1068: debug3("%s: waiting for MONITOR_ANS_JPAKE_STEP1", __func__);
1069: mm_request_receive_expect(pmonitor->m_recvfd,
1070: MONITOR_ANS_JPAKE_STEP1, &m);
1071:
1072: if ((*priv1 = BN_new()) == NULL ||
1073: (*priv2 = BN_new()) == NULL ||
1074: (*g_priv1 = BN_new()) == NULL ||
1075: (*g_priv2 = BN_new()) == NULL)
1076: fatal("%s: BN_new", __func__);
1077:
1078: *id = buffer_get_string(&m, id_len);
1079: /* priv1 and priv2 are, well, private */
1080: buffer_get_bignum2(&m, *g_priv1);
1081: buffer_get_bignum2(&m, *g_priv2);
1082: *priv1_proof = buffer_get_string(&m, priv1_proof_len);
1083: *priv2_proof = buffer_get_string(&m, priv2_proof_len);
1084:
1085: buffer_free(&m);
1086: }
1087:
1088: void
1.65 djm 1089: mm_jpake_step2(struct modp_group *grp, BIGNUM *s,
1.64 djm 1090: BIGNUM *mypub1, BIGNUM *theirpub1, BIGNUM *theirpub2, BIGNUM *mypriv2,
1091: const u_char *theirid, u_int theirid_len,
1092: const u_char *myid, u_int myid_len,
1093: const u_char *theirpub1_proof, u_int theirpub1_proof_len,
1094: const u_char *theirpub2_proof, u_int theirpub2_proof_len,
1095: BIGNUM **newpub,
1096: u_char **newpub_exponent_proof, u_int *newpub_exponent_proof_len)
1097: {
1098: Buffer m;
1099:
1100: debug3("%s entering", __func__);
1101:
1102: buffer_init(&m);
1103: /* monitor already has all bignums except theirpub1, theirpub2 */
1104: buffer_put_bignum2(&m, theirpub1);
1105: buffer_put_bignum2(&m, theirpub2);
1106: /* monitor already knows our id */
1107: buffer_put_string(&m, theirid, theirid_len);
1108: buffer_put_string(&m, theirpub1_proof, theirpub1_proof_len);
1109: buffer_put_string(&m, theirpub2_proof, theirpub2_proof_len);
1110:
1111: mm_request_send(pmonitor->m_recvfd,
1112: MONITOR_REQ_JPAKE_STEP2, &m);
1113:
1114: debug3("%s: waiting for MONITOR_ANS_JPAKE_STEP2", __func__);
1115: mm_request_receive_expect(pmonitor->m_recvfd,
1116: MONITOR_ANS_JPAKE_STEP2, &m);
1117:
1118: if ((*newpub = BN_new()) == NULL)
1119: fatal("%s: BN_new", __func__);
1120:
1121: buffer_get_bignum2(&m, *newpub);
1122: *newpub_exponent_proof = buffer_get_string(&m,
1123: newpub_exponent_proof_len);
1124:
1125: buffer_free(&m);
1126: }
1127:
1128: void
1.65 djm 1129: mm_jpake_key_confirm(struct modp_group *grp, BIGNUM *s, BIGNUM *step2_val,
1.64 djm 1130: BIGNUM *mypriv2, BIGNUM *mypub1, BIGNUM *mypub2,
1131: BIGNUM *theirpub1, BIGNUM *theirpub2,
1132: const u_char *my_id, u_int my_id_len,
1133: const u_char *their_id, u_int their_id_len,
1134: const u_char *sess_id, u_int sess_id_len,
1135: const u_char *theirpriv2_s_proof, u_int theirpriv2_s_proof_len,
1136: BIGNUM **k,
1137: u_char **confirm_hash, u_int *confirm_hash_len)
1138: {
1139: Buffer m;
1140:
1141: debug3("%s entering", __func__);
1142:
1143: buffer_init(&m);
1144: /* monitor already has all bignums except step2_val */
1145: buffer_put_bignum2(&m, step2_val);
1146: /* monitor already knows all the ids */
1147: buffer_put_string(&m, theirpriv2_s_proof, theirpriv2_s_proof_len);
1148:
1149: mm_request_send(pmonitor->m_recvfd,
1150: MONITOR_REQ_JPAKE_KEY_CONFIRM, &m);
1151:
1152: debug3("%s: waiting for MONITOR_ANS_JPAKE_KEY_CONFIRM", __func__);
1153: mm_request_receive_expect(pmonitor->m_recvfd,
1154: MONITOR_ANS_JPAKE_KEY_CONFIRM, &m);
1155:
1156: /* 'k' is sensitive and stays in the monitor */
1157: *confirm_hash = buffer_get_string(&m, confirm_hash_len);
1158:
1159: buffer_free(&m);
1160: }
1161:
1162: int
1163: mm_jpake_check_confirm(const BIGNUM *k,
1164: const u_char *peer_id, u_int peer_id_len,
1165: const u_char *sess_id, u_int sess_id_len,
1166: const u_char *peer_confirm_hash, u_int peer_confirm_hash_len)
1167: {
1168: Buffer m;
1169: int success = 0;
1170:
1171: debug3("%s entering", __func__);
1172:
1173: buffer_init(&m);
1174: /* k is dummy in slave, ignored */
1175: /* monitor knows all the ids */
1176: buffer_put_string(&m, peer_confirm_hash, peer_confirm_hash_len);
1177: mm_request_send(pmonitor->m_recvfd,
1178: MONITOR_REQ_JPAKE_CHECK_CONFIRM, &m);
1179:
1180: debug3("%s: waiting for MONITOR_ANS_JPAKE_CHECK_CONFIRM", __func__);
1181: mm_request_receive_expect(pmonitor->m_recvfd,
1182: MONITOR_ANS_JPAKE_CHECK_CONFIRM, &m);
1183:
1184: success = buffer_get_int(&m);
1185: buffer_free(&m);
1186:
1187: debug3("%s: success = %d", __func__, success);
1188: return success;
1189: }
1190: #endif /* JPAKE */