]> andersk Git - openssh.git/blame - monitor_wrap.c
- (dtucker) [configure.ac] Bug #1276: avoid linking against libgssapi, which
[openssh.git] / monitor_wrap.c
CommitLineData
c6dca55e 1/* $OpenBSD: monitor_wrap.c,v 1.62 2008/05/08 12:21:16 djm Exp $ */
1853d1ef 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
28#include "includes.h"
1853d1ef 29
b1842393 30#include <sys/types.h>
428f6258 31#include <sys/uio.h>
b1842393 32
028094f4 33#include <errno.h>
b1842393 34#include <pwd.h>
31652869 35#include <signal.h>
24436b92 36#include <stdarg.h>
cf851879 37#include <stdio.h>
00146caa 38#include <string.h>
428f6258 39#include <unistd.h>
b1842393 40
31652869 41#include <openssl/bn.h>
42#include <openssl/dh.h>
43
3593bdc0 44#include "openbsd-compat/sys-queue.h"
31652869 45#include "xmalloc.h"
1853d1ef 46#include "ssh.h"
47#include "dh.h"
31652869 48#include "buffer.h"
49#include "key.h"
50#include "cipher.h"
1853d1ef 51#include "kex.h"
31652869 52#include "hostfile.h"
1853d1ef 53#include "auth.h"
92e15201 54#include "auth-options.h"
1853d1ef 55#include "packet.h"
56#include "mac.h"
57#include "log.h"
a655c012 58#ifdef TARGET_OS_MAC /* XXX Broken krb5 headers on Mac */
59#undef TARGET_OS_MAC
9b08c23f 60#include "zlib.h"
a655c012 61#define TARGET_OS_MAC 1
62#else
63#include "zlib.h"
64#endif
1853d1ef 65#include "monitor.h"
31652869 66#ifdef GSSAPI
67#include "ssh-gss.h"
68#endif
1853d1ef 69#include "monitor_wrap.h"
1853d1ef 70#include "atomicio.h"
71#include "monitor_fdpass.h"
51e7a012 72#include "misc.h"
7fceb20d 73#include "servconf.h"
1853d1ef 74
1853d1ef 75#include "channels.h"
76#include "session.h"
03bcbf84 77#include "servconf.h"
1853d1ef 78
79/* Imports */
80extern int compat20;
81extern Newkeys *newkeys[];
82extern z_stream incoming_stream;
83extern z_stream outgoing_stream;
b5a28cbc 84extern struct monitor *pmonitor;
1853d1ef 85extern Buffer input, output;
be2ca0c9 86extern Buffer loginmsg;
7fceb20d 87extern ServerOptions options;
1853d1ef 88
2362db19 89int
90mm_is_monitor(void)
91{
92 /*
93 * m_pid is only set in the privileged part, and
94 * points to the unprivileged child.
95 */
74677ba3 96 return (pmonitor && pmonitor->m_pid > 0);
2362db19 97}
98
1853d1ef 99void
ca75d7de 100mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
1853d1ef 101{
1853d1ef 102 u_int mlen = buffer_len(m);
405a0d43 103 u_char buf[5];
1853d1ef 104
1588c277 105 debug3("%s entering: type %d", __func__, type);
1853d1ef 106
51e7a012 107 put_u32(buf, mlen + 1);
7203d6bb 108 buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
ca75d7de 109 if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
05624c18 110 fatal("%s: write: %s", __func__, strerror(errno));
ca75d7de 111 if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen)
05624c18 112 fatal("%s: write: %s", __func__, strerror(errno));
1853d1ef 113}
114
115void
ca75d7de 116mm_request_receive(int sock, Buffer *m)
1853d1ef 117{
118 u_char buf[4];
1853d1ef 119 u_int msg_len;
120
1588c277 121 debug3("%s entering", __func__);
1853d1ef 122
05624c18 123 if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) {
124 if (errno == EPIPE)
2362db19 125 cleanup_exit(255);
05624c18 126 fatal("%s: read: %s", __func__, strerror(errno));
1853d1ef 127 }
51e7a012 128 msg_len = get_u32(buf);
1853d1ef 129 if (msg_len > 256 * 1024)
1588c277 130 fatal("%s: read: bad msg_len %d", __func__, msg_len);
1853d1ef 131 buffer_clear(m);
132 buffer_append_space(m, msg_len);
05624c18 133 if (atomicio(read, sock, buffer_ptr(m), msg_len) != msg_len)
134 fatal("%s: read: %s", __func__, strerror(errno));
1853d1ef 135}
136
137void
ca75d7de 138mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m)
1853d1ef 139{
140 u_char rtype;
141
1588c277 142 debug3("%s entering: type %d", __func__, type);
1853d1ef 143
ca75d7de 144 mm_request_receive(sock, m);
1853d1ef 145 rtype = buffer_get_char(m);
146 if (rtype != type)
1588c277 147 fatal("%s: read: rtype %d != type %d", __func__,
1853d1ef 148 rtype, type);
149}
150
151DH *
152mm_choose_dh(int min, int nbits, int max)
153{
154 BIGNUM *p, *g;
155 int success = 0;
156 Buffer m;
157
158 buffer_init(&m);
159 buffer_put_int(&m, min);
160 buffer_put_int(&m, nbits);
161 buffer_put_int(&m, max);
162
b5a28cbc 163 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_MODULI, &m);
1853d1ef 164
1588c277 165 debug3("%s: waiting for MONITOR_ANS_MODULI", __func__);
b5a28cbc 166 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_MODULI, &m);
1853d1ef 167
168 success = buffer_get_char(&m);
169 if (success == 0)
1588c277 170 fatal("%s: MONITOR_ANS_MODULI failed", __func__);
1853d1ef 171
172 if ((p = BN_new()) == NULL)
1588c277 173 fatal("%s: BN_new failed", __func__);
1853d1ef 174 if ((g = BN_new()) == NULL)
1588c277 175 fatal("%s: BN_new failed", __func__);
1853d1ef 176 buffer_get_bignum2(&m, p);
177 buffer_get_bignum2(&m, g);
178
1588c277 179 debug3("%s: remaining %d", __func__, buffer_len(&m));
1853d1ef 180 buffer_free(&m);
181
182 return (dh_new_group(g, p));
183}
184
185int
186mm_key_sign(Key *key, u_char **sigp, u_int *lenp, u_char *data, u_int datalen)
187{
b5a28cbc 188 Kex *kex = *pmonitor->m_pkex;
1853d1ef 189 Buffer m;
190
1588c277 191 debug3("%s entering", __func__);
1853d1ef 192
193 buffer_init(&m);
194 buffer_put_int(&m, kex->host_key_index(key));
195 buffer_put_string(&m, data, datalen);
196
b5a28cbc 197 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, &m);
1853d1ef 198
1588c277 199 debug3("%s: waiting for MONITOR_ANS_SIGN", __func__);
b5a28cbc 200 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, &m);
1853d1ef 201 *sigp = buffer_get_string(&m, lenp);
202 buffer_free(&m);
203
204 return (0);
205}
206
207struct passwd *
18a8f313 208mm_getpwnamallow(const char *username)
1853d1ef 209{
210 Buffer m;
211 struct passwd *pw;
03bcbf84 212 u_int len;
213 ServerOptions *newopts;
1853d1ef 214
1588c277 215 debug3("%s entering", __func__);
1853d1ef 216
217 buffer_init(&m);
18a8f313 218 buffer_put_cstring(&m, username);
1853d1ef 219
b5a28cbc 220 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, &m);
1853d1ef 221
1588c277 222 debug3("%s: waiting for MONITOR_ANS_PWNAM", __func__);
b5a28cbc 223 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, &m);
1853d1ef 224
225 if (buffer_get_char(&m) == 0) {
dc0cae51 226 pw = NULL;
227 goto out;
1853d1ef 228 }
03bcbf84 229 pw = buffer_get_string(&m, &len);
230 if (len != sizeof(struct passwd))
1588c277 231 fatal("%s: struct passwd size mismatch", __func__);
1853d1ef 232 pw->pw_name = buffer_get_string(&m, NULL);
233 pw->pw_passwd = buffer_get_string(&m, NULL);
234 pw->pw_gecos = buffer_get_string(&m, NULL);
7b18c353 235#ifdef HAVE_PW_CLASS_IN_PASSWD
1853d1ef 236 pw->pw_class = buffer_get_string(&m, NULL);
7b18c353 237#endif
1853d1ef 238 pw->pw_dir = buffer_get_string(&m, NULL);
239 pw->pw_shell = buffer_get_string(&m, NULL);
03bcbf84 240
dc0cae51 241out:
03bcbf84 242 /* copy options block as a Match directive may have changed some */
243 newopts = buffer_get_string(&m, &len);
244 if (len != sizeof(*newopts))
245 fatal("%s: option block size mismatch", __func__);
246 if (newopts->banner != NULL)
247 newopts->banner = buffer_get_string(&m, NULL);
248 copy_set_server_options(&options, newopts, 1);
249 xfree(newopts);
250
1853d1ef 251 buffer_free(&m);
252
253 return (pw);
254}
255
02cd6c56 256char *
257mm_auth2_read_banner(void)
94a73cdc 258{
259 Buffer m;
260 char *banner;
261
1588c277 262 debug3("%s entering", __func__);
94a73cdc 263
264 buffer_init(&m);
b5a28cbc 265 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, &m);
94a73cdc 266 buffer_clear(&m);
267
02cd6c56 268 mm_request_receive_expect(pmonitor->m_recvfd,
269 MONITOR_ANS_AUTH2_READ_BANNER, &m);
94a73cdc 270 banner = buffer_get_string(&m, NULL);
271 buffer_free(&m);
7203d6bb 272
02cd6c56 273 /* treat empty banner as missing banner */
274 if (strlen(banner) == 0) {
275 xfree(banner);
276 banner = NULL;
277 }
94a73cdc 278 return (banner);
279}
280
1853d1ef 281/* Inform the privileged process about service and style */
282
283void
284mm_inform_authserv(char *service, char *style)
285{
286 Buffer m;
287
1588c277 288 debug3("%s entering", __func__);
1853d1ef 289
290 buffer_init(&m);
291 buffer_put_cstring(&m, service);
292 buffer_put_cstring(&m, style ? style : "");
293
b5a28cbc 294 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m);
1853d1ef 295
296 buffer_free(&m);
297}
298
299/* Do the password authentication */
300int
301mm_auth_password(Authctxt *authctxt, char *password)
302{
303 Buffer m;
304 int authenticated = 0;
305
1588c277 306 debug3("%s entering", __func__);
1853d1ef 307
308 buffer_init(&m);
309 buffer_put_cstring(&m, password);
b5a28cbc 310 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHPASSWORD, &m);
1853d1ef 311
1588c277 312 debug3("%s: waiting for MONITOR_ANS_AUTHPASSWORD", __func__);
b5a28cbc 313 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_AUTHPASSWORD, &m);
1853d1ef 314
315 authenticated = buffer_get_int(&m);
316
317 buffer_free(&m);
318
319 debug3("%s: user %sauthenticated",
1588c277 320 __func__, authenticated ? "" : "not ");
1853d1ef 321 return (authenticated);
322}
323
324int
325mm_user_key_allowed(struct passwd *pw, Key *key)
326{
327 return (mm_key_allowed(MM_USERKEY, NULL, NULL, key));
328}
329
330int
331mm_hostbased_key_allowed(struct passwd *pw, char *user, char *host,
332 Key *key)
333{
334 return (mm_key_allowed(MM_HOSTKEY, user, host, key));
335}
336
337int
338mm_auth_rhosts_rsa_key_allowed(struct passwd *pw, char *user,
339 char *host, Key *key)
340{
341 int ret;
342
343 key->type = KEY_RSA; /* XXX hack for key_to_blob */
344 ret = mm_key_allowed(MM_RSAHOSTKEY, user, host, key);
345 key->type = KEY_RSA1;
346 return (ret);
347}
348
349static void
350mm_send_debug(Buffer *m)
351{
352 char *msg;
353
354 while (buffer_len(m)) {
355 msg = buffer_get_string(m, NULL);
1588c277 356 debug3("%s: Sending debug: %s", __func__, msg);
1853d1ef 357 packet_send_debug("%s", msg);
358 xfree(msg);
359 }
360}
361
362int
363mm_key_allowed(enum mm_keytype type, char *user, char *host, Key *key)
364{
365 Buffer m;
366 u_char *blob;
367 u_int len;
92e15201 368 int allowed = 0, have_forced = 0;
1853d1ef 369
1588c277 370 debug3("%s entering", __func__);
1853d1ef 371
372 /* Convert the key to a blob and the pass it over */
373 if (!key_to_blob(key, &blob, &len))
374 return (0);
375
376 buffer_init(&m);
377 buffer_put_int(&m, type);
378 buffer_put_cstring(&m, user ? user : "");
379 buffer_put_cstring(&m, host ? host : "");
380 buffer_put_string(&m, blob, len);
381 xfree(blob);
382
b5a28cbc 383 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYALLOWED, &m);
1853d1ef 384
1588c277 385 debug3("%s: waiting for MONITOR_ANS_KEYALLOWED", __func__);
b5a28cbc 386 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYALLOWED, &m);
1853d1ef 387
388 allowed = buffer_get_int(&m);
389
92e15201 390 /* fake forced command */
391 auth_clear_options();
392 have_forced = buffer_get_int(&m);
393 forced_command = have_forced ? xstrdup("true") : NULL;
394
1853d1ef 395 /* Send potential debug messages */
396 mm_send_debug(&m);
397
398 buffer_free(&m);
399
400 return (allowed);
401}
402
403/*
404 * This key verify needs to send the key type along, because the
405 * privileged parent makes the decision if the key is allowed
406 * for authentication.
407 */
408
409int
410mm_key_verify(Key *key, u_char *sig, u_int siglen, u_char *data, u_int datalen)
411{
412 Buffer m;
413 u_char *blob;
414 u_int len;
415 int verified = 0;
416
1588c277 417 debug3("%s entering", __func__);
1853d1ef 418
419 /* Convert the key to a blob and the pass it over */
420 if (!key_to_blob(key, &blob, &len))
421 return (0);
422
423 buffer_init(&m);
424 buffer_put_string(&m, blob, len);
425 buffer_put_string(&m, sig, siglen);
426 buffer_put_string(&m, data, datalen);
427 xfree(blob);
428
b5a28cbc 429 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYVERIFY, &m);
1853d1ef 430
1588c277 431 debug3("%s: waiting for MONITOR_ANS_KEYVERIFY", __func__);
b5a28cbc 432 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KEYVERIFY, &m);
1853d1ef 433
434 verified = buffer_get_int(&m);
435
436 buffer_free(&m);
437
438 return (verified);
439}
440
441/* Export key state after authentication */
442Newkeys *
443mm_newkeys_from_blob(u_char *blob, int blen)
444{
445 Buffer b;
446 u_int len;
447 Newkeys *newkey = NULL;
448 Enc *enc;
449 Mac *mac;
450 Comp *comp;
451
1588c277 452 debug3("%s: %p(%d)", __func__, blob, blen);
1853d1ef 453#ifdef DEBUG_PK
454 dump_base64(stderr, blob, blen);
455#endif
456 buffer_init(&b);
457 buffer_append(&b, blob, blen);
458
459 newkey = xmalloc(sizeof(*newkey));
460 enc = &newkey->enc;
461 mac = &newkey->mac;
462 comp = &newkey->comp;
463
464 /* Enc structure */
465 enc->name = buffer_get_string(&b, NULL);
466 buffer_get(&b, &enc->cipher, sizeof(enc->cipher));
467 enc->enabled = buffer_get_int(&b);
468 enc->block_size = buffer_get_int(&b);
469 enc->key = buffer_get_string(&b, &enc->key_len);
470 enc->iv = buffer_get_string(&b, &len);
471 if (len != enc->block_size)
bb0640b2 472 fatal("%s: bad ivlen: expected %u != %u", __func__,
1853d1ef 473 enc->block_size, len);
474
475 if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher)
1588c277 476 fatal("%s: bad cipher name %s or pointer %p", __func__,
1853d1ef 477 enc->name, enc->cipher);
478
479 /* Mac structure */
480 mac->name = buffer_get_string(&b, NULL);
a3de8da1 481 if (mac->name == NULL || mac_setup(mac, mac->name) == -1)
f444d0f8 482 fatal("%s: can not setup mac %s", __func__, mac->name);
1853d1ef 483 mac->enabled = buffer_get_int(&b);
484 mac->key = buffer_get_string(&b, &len);
485 if (len > mac->key_len)
bb0640b2 486 fatal("%s: bad mac key length: %u > %d", __func__, len,
1853d1ef 487 mac->key_len);
488 mac->key_len = len;
489
490 /* Comp structure */
491 comp->type = buffer_get_int(&b);
492 comp->enabled = buffer_get_int(&b);
493 comp->name = buffer_get_string(&b, NULL);
494
495 len = buffer_len(&b);
496 if (len != 0)
bb0640b2 497 error("newkeys_from_blob: remaining bytes in blob %u", len);
1853d1ef 498 buffer_free(&b);
499 return (newkey);
500}
501
502int
503mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
504{
505 Buffer b;
506 int len;
1853d1ef 507 Enc *enc;
508 Mac *mac;
509 Comp *comp;
510 Newkeys *newkey = newkeys[mode];
511
1588c277 512 debug3("%s: converting %p", __func__, newkey);
1853d1ef 513
514 if (newkey == NULL) {
1588c277 515 error("%s: newkey == NULL", __func__);
1853d1ef 516 return 0;
517 }
518 enc = &newkey->enc;
519 mac = &newkey->mac;
520 comp = &newkey->comp;
521
522 buffer_init(&b);
523 /* Enc structure */
524 buffer_put_cstring(&b, enc->name);
525 /* The cipher struct is constant and shared, you export pointer */
526 buffer_append(&b, &enc->cipher, sizeof(enc->cipher));
527 buffer_put_int(&b, enc->enabled);
528 buffer_put_int(&b, enc->block_size);
529 buffer_put_string(&b, enc->key, enc->key_len);
530 packet_get_keyiv(mode, enc->iv, enc->block_size);
531 buffer_put_string(&b, enc->iv, enc->block_size);
532
533 /* Mac structure */
534 buffer_put_cstring(&b, mac->name);
535 buffer_put_int(&b, mac->enabled);
536 buffer_put_string(&b, mac->key, mac->key_len);
537
538 /* Comp structure */
539 buffer_put_int(&b, comp->type);
540 buffer_put_int(&b, comp->enabled);
541 buffer_put_cstring(&b, comp->name);
542
543 len = buffer_len(&b);
1853d1ef 544 if (lenp != NULL)
545 *lenp = len;
eb9f2fab 546 if (blobp != NULL) {
547 *blobp = xmalloc(len);
548 memcpy(*blobp, buffer_ptr(&b), len);
549 }
550 memset(buffer_ptr(&b), 0, len);
551 buffer_free(&b);
1853d1ef 552 return len;
553}
554
555static void
556mm_send_kex(Buffer *m, Kex *kex)
557{
558 buffer_put_string(m, kex->session_id, kex->session_id_len);
559 buffer_put_int(m, kex->we_need);
560 buffer_put_int(m, kex->hostkey_type);
561 buffer_put_int(m, kex->kex_type);
562 buffer_put_string(m, buffer_ptr(&kex->my), buffer_len(&kex->my));
563 buffer_put_string(m, buffer_ptr(&kex->peer), buffer_len(&kex->peer));
564 buffer_put_int(m, kex->flags);
565 buffer_put_cstring(m, kex->client_version_string);
566 buffer_put_cstring(m, kex->server_version_string);
567}
568
569void
ca75d7de 570mm_send_keystate(struct monitor *monitor)
1853d1ef 571{
572 Buffer m;
573 u_char *blob, *p;
574 u_int bloblen, plen;
ffd7b36b 575 u_int32_t seqnr, packets;
576 u_int64_t blocks;
1853d1ef 577
578 buffer_init(&m);
579
580 if (!compat20) {
581 u_char iv[24];
9459414c 582 u_char *key;
583 u_int ivlen, keylen;
1853d1ef 584
585 buffer_put_int(&m, packet_get_protocol_flags());
586
587 buffer_put_int(&m, packet_get_ssh1_cipher());
588
9459414c 589 debug3("%s: Sending ssh1 KEY+IV", __func__);
590 keylen = packet_get_encryption_key(NULL);
591 key = xmalloc(keylen+1); /* add 1 if keylen == 0 */
592 keylen = packet_get_encryption_key(key);
593 buffer_put_string(&m, key, keylen);
594 memset(key, 0, keylen);
595 xfree(key);
596
1853d1ef 597 ivlen = packet_get_keyiv_len(MODE_OUT);
598 packet_get_keyiv(MODE_OUT, iv, ivlen);
599 buffer_put_string(&m, iv, ivlen);
600 ivlen = packet_get_keyiv_len(MODE_OUT);
601 packet_get_keyiv(MODE_IN, iv, ivlen);
602 buffer_put_string(&m, iv, ivlen);
603 goto skip;
604 } else {
605 /* Kex for rekeying */
ca75d7de 606 mm_send_kex(&m, *monitor->m_pkex);
1853d1ef 607 }
608
609 debug3("%s: Sending new keys: %p %p",
1588c277 610 __func__, newkeys[MODE_OUT], newkeys[MODE_IN]);
1853d1ef 611
612 /* Keys from Kex */
613 if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen))
1588c277 614 fatal("%s: conversion of newkeys failed", __func__);
1853d1ef 615
616 buffer_put_string(&m, blob, bloblen);
617 xfree(blob);
618
619 if (!mm_newkeys_to_blob(MODE_IN, &blob, &bloblen))
1588c277 620 fatal("%s: conversion of newkeys failed", __func__);
1853d1ef 621
622 buffer_put_string(&m, blob, bloblen);
623 xfree(blob);
624
ffd7b36b 625 packet_get_state(MODE_OUT, &seqnr, &blocks, &packets);
626 buffer_put_int(&m, seqnr);
627 buffer_put_int64(&m, blocks);
628 buffer_put_int(&m, packets);
806e4c11 629 packet_get_state(MODE_IN, &seqnr, &blocks, &packets);
ffd7b36b 630 buffer_put_int(&m, seqnr);
631 buffer_put_int64(&m, blocks);
632 buffer_put_int(&m, packets);
1853d1ef 633
1588c277 634 debug3("%s: New keys have been sent", __func__);
1853d1ef 635 skip:
636 /* More key context */
637 plen = packet_get_keycontext(MODE_OUT, NULL);
638 p = xmalloc(plen+1);
639 packet_get_keycontext(MODE_OUT, p);
640 buffer_put_string(&m, p, plen);
641 xfree(p);
642
643 plen = packet_get_keycontext(MODE_IN, NULL);
644 p = xmalloc(plen+1);
645 packet_get_keycontext(MODE_IN, p);
646 buffer_put_string(&m, p, plen);
647 xfree(p);
648
649 /* Compression state */
1588c277 650 debug3("%s: Sending compression state", __func__);
1853d1ef 651 buffer_put_string(&m, &outgoing_stream, sizeof(outgoing_stream));
652 buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream));
653
654 /* Network I/O buffers */
655 buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
656 buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));
657
ca75d7de 658 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
1588c277 659 debug3("%s: Finished sending state", __func__);
1853d1ef 660
661 buffer_free(&m);
662}
663
664int
148de80c 665mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen)
1853d1ef 666{
667 Buffer m;
be2ca0c9 668 char *p, *msg;
c6dca55e 669 int success = 0, tmp1 = -1, tmp2 = -1;
670
671 /* Kludge: ensure there are fds free to receive the pty/tty */
672 if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 ||
673 (tmp2 = dup(pmonitor->m_recvfd)) == -1) {
674 error("%s: cannot allocate fds for pty", __func__);
675 if (tmp1 > 0)
676 close(tmp1);
677 if (tmp2 > 0)
678 close(tmp2);
679 return 0;
680 }
681 close(tmp1);
682 close(tmp2);
1853d1ef 683
684 buffer_init(&m);
b5a28cbc 685 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, &m);
1853d1ef 686
1588c277 687 debug3("%s: waiting for MONITOR_ANS_PTY", __func__);
b5a28cbc 688 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, &m);
1853d1ef 689
690 success = buffer_get_int(&m);
691 if (success == 0) {
1588c277 692 debug3("%s: pty alloc failed", __func__);
1853d1ef 693 buffer_free(&m);
694 return (0);
695 }
696 p = buffer_get_string(&m, NULL);
be2ca0c9 697 msg = buffer_get_string(&m, NULL);
1853d1ef 698 buffer_free(&m);
699
700 strlcpy(namebuf, p, namebuflen); /* Possible truncation */
701 xfree(p);
702
be2ca0c9 703 buffer_append(&loginmsg, msg, strlen(msg));
704 xfree(msg);
705
8de7aaab 706 if ((*ptyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1 ||
707 (*ttyfd = mm_receive_fd(pmonitor->m_recvfd)) == -1)
708 fatal("%s: receive fds failed", __func__);
1853d1ef 709
710 /* Success */
711 return (1);
712}
713
714void
2362db19 715mm_session_pty_cleanup2(Session *s)
1853d1ef 716{
1853d1ef 717 Buffer m;
718
719 if (s->ttyfd == -1)
720 return;
721 buffer_init(&m);
722 buffer_put_cstring(&m, s->tty);
b5a28cbc 723 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTYCLEANUP, &m);
1853d1ef 724 buffer_free(&m);
725
726 /* closed dup'ed master */
c6dca55e 727 if (s->ptymaster != -1 && close(s->ptymaster) < 0)
728 error("close(s->ptymaster/%d): %s",
729 s->ptymaster, strerror(errno));
1853d1ef 730
731 /* unlink pty from session */
732 s->ttyfd = -1;
733}
734
ad200abb 735#ifdef USE_PAM
736void
529d73ab 737mm_start_pam(Authctxt *authctxt)
ad200abb 738{
739 Buffer m;
740
1588c277 741 debug3("%s entering", __func__);
7fceb20d 742 if (!options.use_pam)
743 fatal("UsePAM=no, but ended up in %s anyway", __func__);
ad200abb 744
745 buffer_init(&m);
b5a28cbc 746 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_START, &m);
ad200abb 747
748 buffer_free(&m);
749}
05114c74 750
5b9e2464 751u_int
752mm_do_pam_account(void)
753{
754 Buffer m;
755 u_int ret;
ba6dd90e 756 char *msg;
5b9e2464 757
758 debug3("%s entering", __func__);
759 if (!options.use_pam)
760 fatal("UsePAM=no, but ended up in %s anyway", __func__);
761
762 buffer_init(&m);
763 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_ACCOUNT, &m);
764
aff51935 765 mm_request_receive_expect(pmonitor->m_recvfd,
5b9e2464 766 MONITOR_ANS_PAM_ACCOUNT, &m);
767 ret = buffer_get_int(&m);
ba6dd90e 768 msg = buffer_get_string(&m, NULL);
769 buffer_append(&loginmsg, msg, strlen(msg));
770 xfree(msg);
5b9e2464 771
772 buffer_free(&m);
b6453d99 773
5b9e2464 774 debug3("%s returning %d", __func__, ret);
775
776 return (ret);
777}
778
05114c74 779void *
780mm_sshpam_init_ctx(Authctxt *authctxt)
781{
782 Buffer m;
783 int success;
784
785 debug3("%s", __func__);
786 buffer_init(&m);
787 buffer_put_cstring(&m, authctxt->user);
788 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, &m);
789 debug3("%s: waiting for MONITOR_ANS_PAM_INIT_CTX", __func__);
790 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_INIT_CTX, &m);
791 success = buffer_get_int(&m);
792 if (success == 0) {
793 debug3("%s: pam_init_ctx failed", __func__);
794 buffer_free(&m);
795 return (NULL);
796 }
797 buffer_free(&m);
798 return (authctxt);
799}
800
801int
802mm_sshpam_query(void *ctx, char **name, char **info,
803 u_int *num, char ***prompts, u_int **echo_on)
804{
805 Buffer m;
a1a073cc 806 u_int i;
807 int ret;
05114c74 808
809 debug3("%s", __func__);
810 buffer_init(&m);
811 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_QUERY, &m);
812 debug3("%s: waiting for MONITOR_ANS_PAM_QUERY", __func__);
813 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_QUERY, &m);
814 ret = buffer_get_int(&m);
815 debug3("%s: pam_query returned %d", __func__, ret);
816 *name = buffer_get_string(&m, NULL);
817 *info = buffer_get_string(&m, NULL);
818 *num = buffer_get_int(&m);
01d35895 819 if (*num > PAM_MAX_NUM_MSG)
820 fatal("%s: recieved %u PAM messages, expected <= %u",
821 __func__, *num, PAM_MAX_NUM_MSG);
822 *prompts = xcalloc((*num + 1), sizeof(char *));
823 *echo_on = xcalloc((*num + 1), sizeof(u_int));
05114c74 824 for (i = 0; i < *num; ++i) {
825 (*prompts)[i] = buffer_get_string(&m, NULL);
826 (*echo_on)[i] = buffer_get_int(&m);
827 }
828 buffer_free(&m);
829 return (ret);
830}
831
832int
833mm_sshpam_respond(void *ctx, u_int num, char **resp)
834{
835 Buffer m;
a1a073cc 836 u_int i;
837 int ret;
05114c74 838
839 debug3("%s", __func__);
840 buffer_init(&m);
841 buffer_put_int(&m, num);
842 for (i = 0; i < num; ++i)
843 buffer_put_cstring(&m, resp[i]);
844 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_RESPOND, &m);
845 debug3("%s: waiting for MONITOR_ANS_PAM_RESPOND", __func__);
846 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_RESPOND, &m);
847 ret = buffer_get_int(&m);
848 debug3("%s: pam_respond returned %d", __func__, ret);
849 buffer_free(&m);
850 return (ret);
851}
852
853void
854mm_sshpam_free_ctx(void *ctxtp)
855{
856 Buffer m;
857
858 debug3("%s", __func__);
859 buffer_init(&m);
860 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_FREE_CTX, &m);
861 debug3("%s: waiting for MONITOR_ANS_PAM_FREE_CTX", __func__);
862 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_FREE_CTX, &m);
863 buffer_free(&m);
864}
ad200abb 865#endif /* USE_PAM */
866
1853d1ef 867/* Request process termination */
868
869void
870mm_terminate(void)
871{
872 Buffer m;
873
874 buffer_init(&m);
b5a28cbc 875 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_TERM, &m);
1853d1ef 876 buffer_free(&m);
877}
878
879int
880mm_ssh1_session_key(BIGNUM *num)
881{
882 int rsafail;
883 Buffer m;
884
885 buffer_init(&m);
886 buffer_put_bignum2(&m, num);
b5a28cbc 887 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSKEY, &m);
1853d1ef 888
b5a28cbc 889 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SESSKEY, &m);
1853d1ef 890
891 rsafail = buffer_get_int(&m);
892 buffer_get_bignum2(&m, num);
893
894 buffer_free(&m);
895
896 return (rsafail);
897}
898
899static void
900mm_chall_setup(char **name, char **infotxt, u_int *numprompts,
901 char ***prompts, u_int **echo_on)
902{
7203d6bb 903 *name = xstrdup("");
904 *infotxt = xstrdup("");
1853d1ef 905 *numprompts = 1;
52e3daed 906 *prompts = xcalloc(*numprompts, sizeof(char *));
907 *echo_on = xcalloc(*numprompts, sizeof(u_int));
1853d1ef 908 (*echo_on)[0] = 0;
909}
910
911int
912mm_bsdauth_query(void *ctx, char **name, char **infotxt,
913 u_int *numprompts, char ***prompts, u_int **echo_on)
914{
915 Buffer m;
6d6c25e3 916 u_int success;
1853d1ef 917 char *challenge;
918
1588c277 919 debug3("%s: entering", __func__);
1853d1ef 920
921 buffer_init(&m);
b5a28cbc 922 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m);
1853d1ef 923
b5a28cbc 924 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY,
1853d1ef 925 &m);
6d6c25e3 926 success = buffer_get_int(&m);
927 if (success == 0) {
1588c277 928 debug3("%s: no challenge", __func__);
1853d1ef 929 buffer_free(&m);
930 return (-1);
931 }
932
933 /* Get the challenge, and format the response */
934 challenge = buffer_get_string(&m, NULL);
935 buffer_free(&m);
936
937 mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
938 (*prompts)[0] = challenge;
939
1588c277 940 debug3("%s: received challenge: %s", __func__, challenge);
1853d1ef 941
942 return (0);
943}
944
945int
946mm_bsdauth_respond(void *ctx, u_int numresponses, char **responses)
947{
948 Buffer m;
949 int authok;
950
1588c277 951 debug3("%s: entering", __func__);
1853d1ef 952 if (numresponses != 1)
953 return (-1);
954
955 buffer_init(&m);
956 buffer_put_cstring(&m, responses[0]);
b5a28cbc 957 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, &m);
1853d1ef 958
b5a28cbc 959 mm_request_receive_expect(pmonitor->m_recvfd,
1853d1ef 960 MONITOR_ANS_BSDAUTHRESPOND, &m);
961
962 authok = buffer_get_int(&m);
963 buffer_free(&m);
964
965 return ((authok == 0) ? -1 : 0);
966}
967
77751377 968#ifdef SKEY
1853d1ef 969int
970mm_skey_query(void *ctx, char **name, char **infotxt,
971 u_int *numprompts, char ***prompts, u_int **echo_on)
972{
973 Buffer m;
6d6c25e3 974 u_int success;
cecc422f 975 char *challenge;
1853d1ef 976
1588c277 977 debug3("%s: entering", __func__);
1853d1ef 978
979 buffer_init(&m);
b5a28cbc 980 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m);
1853d1ef 981
b5a28cbc 982 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYQUERY,
1853d1ef 983 &m);
6d6c25e3 984 success = buffer_get_int(&m);
985 if (success == 0) {
1588c277 986 debug3("%s: no challenge", __func__);
1853d1ef 987 buffer_free(&m);
988 return (-1);
989 }
990
991 /* Get the challenge, and format the response */
992 challenge = buffer_get_string(&m, NULL);
993 buffer_free(&m);
994
1588c277 995 debug3("%s: received challenge: %s", __func__, challenge);
1853d1ef 996
997 mm_chall_setup(name, infotxt, numprompts, prompts, echo_on);
998
52e3daed 999 xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT);
1853d1ef 1000 xfree(challenge);
1001
1002 return (0);
1003}
1004
1005int
1006mm_skey_respond(void *ctx, u_int numresponses, char **responses)
1007{
1008 Buffer m;
1009 int authok;
1010
1588c277 1011 debug3("%s: entering", __func__);
1853d1ef 1012 if (numresponses != 1)
1013 return (-1);
1014
1015 buffer_init(&m);
1016 buffer_put_cstring(&m, responses[0]);
b5a28cbc 1017 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYRESPOND, &m);
1853d1ef 1018
b5a28cbc 1019 mm_request_receive_expect(pmonitor->m_recvfd,
1853d1ef 1020 MONITOR_ANS_SKEYRESPOND, &m);
1021
1022 authok = buffer_get_int(&m);
1023 buffer_free(&m);
1024
1025 return ((authok == 0) ? -1 : 0);
1026}
77751377 1027#endif /* SKEY */
1853d1ef 1028
1029void
1030mm_ssh1_session_id(u_char session_id[16])
1031{
1032 Buffer m;
1033 int i;
1034
1588c277 1035 debug3("%s entering", __func__);
1853d1ef 1036
1037 buffer_init(&m);
1038 for (i = 0; i < 16; i++)
1039 buffer_put_char(&m, session_id[i]);
1040
b5a28cbc 1041 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SESSID, &m);
1853d1ef 1042 buffer_free(&m);
1043}
1044
1045int
1046mm_auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey)
1047{
1048 Buffer m;
1049 Key *key;
1050 u_char *blob;
1051 u_int blen;
92e15201 1052 int allowed = 0, have_forced = 0;
1853d1ef 1053
1588c277 1054 debug3("%s entering", __func__);
1853d1ef 1055
1056 buffer_init(&m);
1057 buffer_put_bignum2(&m, client_n);
1058
b5a28cbc 1059 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSAKEYALLOWED, &m);
1060 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSAKEYALLOWED, &m);
1853d1ef 1061
1062 allowed = buffer_get_int(&m);
1063
92e15201 1064 /* fake forced command */
1065 auth_clear_options();
1066 have_forced = buffer_get_int(&m);
1067 forced_command = have_forced ? xstrdup("true") : NULL;
1068
1853d1ef 1069 if (allowed && rkey != NULL) {
1070 blob = buffer_get_string(&m, &blen);
1071 if ((key = key_from_blob(blob, blen)) == NULL)
1588c277 1072 fatal("%s: key_from_blob failed", __func__);
1853d1ef 1073 *rkey = key;
1074 xfree(blob);
1075 }
1076 mm_send_debug(&m);
1077 buffer_free(&m);
1078
1079 return (allowed);
1080}
1081
1082BIGNUM *
1083mm_auth_rsa_generate_challenge(Key *key)
1084{
1085 Buffer m;
1086 BIGNUM *challenge;
1087 u_char *blob;
1088 u_int blen;
1089
1588c277 1090 debug3("%s entering", __func__);
1853d1ef 1091
1092 if ((challenge = BN_new()) == NULL)
1588c277 1093 fatal("%s: BN_new failed", __func__);
1853d1ef 1094
1095 key->type = KEY_RSA; /* XXX cheat for key_to_blob */
1096 if (key_to_blob(key, &blob, &blen) == 0)
1588c277 1097 fatal("%s: key_to_blob failed", __func__);
1853d1ef 1098 key->type = KEY_RSA1;
1099
1100 buffer_init(&m);
1101 buffer_put_string(&m, blob, blen);
1102 xfree(blob);
1103
b5a28cbc 1104 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSACHALLENGE, &m);
1105 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSACHALLENGE, &m);
1853d1ef 1106
1107 buffer_get_bignum2(&m, challenge);
1108 buffer_free(&m);
1109
1110 return (challenge);
1111}
1112
1113int
1114mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16])
1115{
1116 Buffer m;
1117 u_char *blob;
1118 u_int blen;
1119 int success = 0;
1120
1588c277 1121 debug3("%s entering", __func__);
1853d1ef 1122
1123 key->type = KEY_RSA; /* XXX cheat for key_to_blob */
1124 if (key_to_blob(key, &blob, &blen) == 0)
1588c277 1125 fatal("%s: key_to_blob failed", __func__);
1853d1ef 1126 key->type = KEY_RSA1;
1127
1128 buffer_init(&m);
1129 buffer_put_string(&m, blob, blen);
1130 buffer_put_string(&m, response, 16);
1131 xfree(blob);
1132
b5a28cbc 1133 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_RSARESPONSE, &m);
1134 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_RSARESPONSE, &m);
1853d1ef 1135
1136 success = buffer_get_int(&m);
1137 buffer_free(&m);
1138
1139 return (success);
1140}
696f6bef 1141
6039eeef 1142#ifdef SSH_AUDIT_EVENTS
c00e4d75 1143void
1144mm_audit_event(ssh_audit_event_t event)
1145{
1146 Buffer m;
1147
1148 debug3("%s entering", __func__);
1149
1150 buffer_init(&m);
1151 buffer_put_int(&m, event);
1152
1153 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_EVENT, &m);
1154 buffer_free(&m);
1155}
1156
1157void
1158mm_audit_run_command(const char *command)
1159{
1160 Buffer m;
1161
1162 debug3("%s entering command %s", __func__, command);
1163
1164 buffer_init(&m);
1165 buffer_put_cstring(&m, command);
1166
1167 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_COMMAND, &m);
1168 buffer_free(&m);
1169}
6039eeef 1170#endif /* SSH_AUDIT_EVENTS */
c00e4d75 1171
7364bd04 1172#ifdef GSSAPI
1173OM_uint32
ca75d7de 1174mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid)
7364bd04 1175{
1176 Buffer m;
1177 OM_uint32 major;
1178
1179 /* Client doesn't get to see the context */
1180 *ctx = NULL;
1181
1182 buffer_init(&m);
ca75d7de 1183 buffer_put_string(&m, goid->elements, goid->length);
7364bd04 1184
1185 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m);
1186 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m);
1187
1188 major = buffer_get_int(&m);
1189
1190 buffer_free(&m);
1191 return (major);
1192}
1193
1194OM_uint32
1195mm_ssh_gssapi_accept_ctx(Gssctxt *ctx, gss_buffer_desc *in,
1196 gss_buffer_desc *out, OM_uint32 *flags)
1197{
1198 Buffer m;
1199 OM_uint32 major;
f99e1ca4 1200 u_int len;
7364bd04 1201
1202 buffer_init(&m);
1203 buffer_put_string(&m, in->value, in->length);
1204
1205 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSTEP, &m);
1206 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSTEP, &m);
1207
1208 major = buffer_get_int(&m);
f99e1ca4 1209 out->value = buffer_get_string(&m, &len);
1210 out->length = len;
7364bd04 1211 if (flags)
1212 *flags = buffer_get_int(&m);
1213
1214 buffer_free(&m);
1215
1216 return (major);
1217}
1218
0789992b 1219OM_uint32
1220mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic)
1221{
1222 Buffer m;
1223 OM_uint32 major;
1224
1225 buffer_init(&m);
1226 buffer_put_string(&m, gssbuf->value, gssbuf->length);
1227 buffer_put_string(&m, gssmic->value, gssmic->length);
1228
1229 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSCHECKMIC, &m);
1230 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSCHECKMIC,
1231 &m);
1232
1233 major = buffer_get_int(&m);
1234 buffer_free(&m);
1235 return(major);
1236}
1237
7364bd04 1238int
1239mm_ssh_gssapi_userok(char *user)
1240{
1241 Buffer m;
1242 int authenticated = 0;
1243
1244 buffer_init(&m);
1245
1246 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSUSEROK, &m);
1247 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSUSEROK,
1248 &m);
1249
1250 authenticated = buffer_get_int(&m);
1251
1252 buffer_free(&m);
1253 debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not ");
1254 return (authenticated);
1255}
1256#endif /* GSSAPI */
This page took 0.439267 seconds and 5 git commands to generate.