2021-01-27 18:15:08 +08:00
|
|
|
/* $OpenBSD: auth2-gss.c,v 1.32 2021/01/27 10:15:08 djm Exp $ */
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
2006-08-05 13:24:59 +08:00
|
|
|
#ifdef GSSAPI
|
|
|
|
|
2006-08-05 10:39:39 +08:00
|
|
|
#include <sys/types.h>
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2006-09-01 13:38:36 +08:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2006-08-05 10:39:39 +08:00
|
|
|
#include "xmalloc.h"
|
2018-07-10 05:37:55 +08:00
|
|
|
#include "sshkey.h"
|
2006-08-05 10:39:39 +08:00
|
|
|
#include "hostfile.h"
|
2003-08-26 09:49:55 +08:00
|
|
|
#include "auth.h"
|
|
|
|
#include "ssh2.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "dispatch.h"
|
2018-07-10 05:37:55 +08:00
|
|
|
#include "sshbuf.h"
|
|
|
|
#include "ssherr.h"
|
2014-07-19 04:23:18 +08:00
|
|
|
#include "misc.h"
|
2003-08-26 09:49:55 +08:00
|
|
|
#include "servconf.h"
|
|
|
|
#include "packet.h"
|
2021-01-27 18:15:08 +08:00
|
|
|
#include "kex.h"
|
2003-08-26 09:49:55 +08:00
|
|
|
#include "ssh-gss.h"
|
2006-08-05 10:39:39 +08:00
|
|
|
#include "monitor_wrap.h"
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
extern ServerOptions options;
|
|
|
|
|
2017-05-30 22:23:52 +08:00
|
|
|
static int input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh);
|
|
|
|
static int input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh);
|
|
|
|
static int input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh);
|
|
|
|
static int input_gssapi_errtok(int, u_int32_t, struct ssh *);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We only support those mechanisms that we know about (ie ones that we know
|
2005-11-05 12:07:05 +08:00
|
|
|
* how to check local user kuserok and the like)
|
2003-08-26 09:49:55 +08:00
|
|
|
*/
|
|
|
|
static int
|
2017-05-30 22:29:59 +08:00
|
|
|
userauth_gssapi(struct ssh *ssh)
|
2003-08-26 09:49:55 +08:00
|
|
|
{
|
2017-05-30 22:29:59 +08:00
|
|
|
Authctxt *authctxt = ssh->authctxt;
|
2004-06-22 10:56:01 +08:00
|
|
|
gss_OID_desc goid = {0, NULL};
|
2003-08-26 09:49:55 +08:00
|
|
|
Gssctxt *ctxt = NULL;
|
2018-07-10 05:37:55 +08:00
|
|
|
int r, present;
|
|
|
|
u_int mechs;
|
2003-08-26 09:49:55 +08:00
|
|
|
OM_uint32 ms;
|
2018-07-10 05:37:55 +08:00
|
|
|
size_t len;
|
2005-06-17 10:59:34 +08:00
|
|
|
u_char *doid = NULL;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_get_u32(ssh, &mechs)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse packet");
|
2018-07-10 05:37:55 +08:00
|
|
|
|
2003-08-26 09:49:55 +08:00
|
|
|
if (mechs == 0) {
|
|
|
|
debug("Mechanism negotiation is not supported");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
mechs--;
|
|
|
|
|
2013-06-02 05:31:17 +08:00
|
|
|
free(doid);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2003-11-03 17:09:03 +08:00
|
|
|
present = 0;
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_get_string(ssh, &doid, &len)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse oid");
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2005-07-17 15:22:45 +08:00
|
|
|
if (len > 2 && doid[0] == SSH_GSS_OIDTYPE &&
|
|
|
|
doid[1] == len - 2) {
|
2004-06-22 10:56:01 +08:00
|
|
|
goid.elements = doid + 2;
|
|
|
|
goid.length = len - 2;
|
2014-02-27 07:17:49 +08:00
|
|
|
ssh_gssapi_test_oid_supported(&ms, &goid, &present);
|
2003-08-26 09:49:55 +08:00
|
|
|
} else {
|
2003-11-03 17:09:03 +08:00
|
|
|
logit("Badly formed OID received");
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
} while (mechs > 0 && !present);
|
|
|
|
|
|
|
|
if (!present) {
|
2013-06-02 05:31:17 +08:00
|
|
|
free(doid);
|
2011-05-05 12:04:11 +08:00
|
|
|
authctxt->server_caused_failure = 1;
|
2003-08-26 09:49:55 +08:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2018-07-31 11:10:27 +08:00
|
|
|
if (!authctxt->valid || authctxt->user == NULL) {
|
2020-10-18 19:32:01 +08:00
|
|
|
debug2_f("disabled because of invalid user");
|
2018-07-31 11:10:27 +08:00
|
|
|
free(doid);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2004-06-22 10:56:01 +08:00
|
|
|
if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) {
|
2006-03-25 21:04:53 +08:00
|
|
|
if (ctxt != NULL)
|
|
|
|
ssh_gssapi_delete_ctx(&ctxt);
|
2013-06-02 05:31:17 +08:00
|
|
|
free(doid);
|
2011-05-05 12:04:11 +08:00
|
|
|
authctxt->server_caused_failure = 1;
|
2003-08-26 09:49:55 +08:00
|
|
|
return (0);
|
2003-09-02 20:59:01 +08:00
|
|
|
}
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2005-11-05 12:07:05 +08:00
|
|
|
authctxt->methoddata = (void *)ctxt;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2003-11-03 17:09:03 +08:00
|
|
|
/* Return the OID that we received */
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_GSSAPI_RESPONSE)) != 0 ||
|
|
|
|
(r = sshpkt_put_string(ssh, doid, len)) != 0 ||
|
|
|
|
(r = sshpkt_send(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "send packet");
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2013-06-02 05:31:17 +08:00
|
|
|
free(doid);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, &input_gssapi_token);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, &input_gssapi_errtok);
|
2003-08-26 09:49:55 +08:00
|
|
|
authctxt->postponed = 1;
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2015-01-20 04:07:45 +08:00
|
|
|
static int
|
2017-05-30 22:23:52 +08:00
|
|
|
input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh)
|
2003-08-26 09:49:55 +08:00
|
|
|
{
|
2017-05-30 22:18:15 +08:00
|
|
|
Authctxt *authctxt = ssh->authctxt;
|
2003-08-26 09:49:55 +08:00
|
|
|
Gssctxt *gssctxt;
|
|
|
|
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
|
|
|
|
gss_buffer_desc recv_tok;
|
2003-11-17 19:18:21 +08:00
|
|
|
OM_uint32 maj_status, min_status, flags;
|
2018-07-10 05:37:55 +08:00
|
|
|
u_char *p;
|
|
|
|
size_t len;
|
|
|
|
int r;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
|
|
|
|
fatal("No authentication or GSSAPI context");
|
|
|
|
|
|
|
|
gssctxt = authctxt->methoddata;
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_get_string(ssh, &p, &len)) != 0 ||
|
|
|
|
(r = sshpkt_get_end(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse packet");
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
recv_tok.value = p;
|
|
|
|
recv_tok.length = len;
|
2003-08-26 09:49:55 +08:00
|
|
|
maj_status = PRIVSEP(ssh_gssapi_accept_ctx(gssctxt, &recv_tok,
|
2003-11-17 19:18:21 +08:00
|
|
|
&send_tok, &flags));
|
2003-08-26 09:49:55 +08:00
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
free(p);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
if (GSS_ERROR(maj_status)) {
|
|
|
|
if (send_tok.length != 0) {
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_start(ssh,
|
|
|
|
SSH2_MSG_USERAUTH_GSSAPI_ERRTOK)) != 0 ||
|
|
|
|
(r = sshpkt_put_string(ssh, send_tok.value,
|
|
|
|
send_tok.length)) != 0 ||
|
|
|
|
(r = sshpkt_send(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "send ERRTOK packet");
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
authctxt->postponed = 0;
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
|
|
|
|
userauth_finish(ssh, 0, "gssapi-with-mic", NULL);
|
2003-08-26 09:49:55 +08:00
|
|
|
} else {
|
|
|
|
if (send_tok.length != 0) {
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_start(ssh,
|
|
|
|
SSH2_MSG_USERAUTH_GSSAPI_TOKEN)) != 0 ||
|
|
|
|
(r = sshpkt_put_string(ssh, send_tok.value,
|
|
|
|
send_tok.length)) != 0 ||
|
|
|
|
(r = sshpkt_send(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "send TOKEN packet");
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
if (maj_status == GSS_S_COMPLETE) {
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
|
2003-11-17 19:18:21 +08:00
|
|
|
if (flags & GSS_C_INTEG_FLAG)
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC,
|
2003-11-17 19:18:21 +08:00
|
|
|
&input_gssapi_mic);
|
|
|
|
else
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh,
|
2003-11-17 19:18:21 +08:00
|
|
|
SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE,
|
|
|
|
&input_gssapi_exchange_complete);
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gss_release_buffer(&min_status, &send_tok);
|
2015-01-20 04:07:45 +08:00
|
|
|
return 0;
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
|
2015-01-20 04:07:45 +08:00
|
|
|
static int
|
2017-05-30 22:23:52 +08:00
|
|
|
input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh)
|
2003-08-26 09:49:55 +08:00
|
|
|
{
|
2017-05-30 22:18:15 +08:00
|
|
|
Authctxt *authctxt = ssh->authctxt;
|
2003-08-26 09:49:55 +08:00
|
|
|
Gssctxt *gssctxt;
|
|
|
|
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
|
|
|
|
gss_buffer_desc recv_tok;
|
|
|
|
OM_uint32 maj_status;
|
2018-07-10 05:37:55 +08:00
|
|
|
int r;
|
2018-07-10 17:13:30 +08:00
|
|
|
u_char *p;
|
|
|
|
size_t len;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
|
|
|
|
fatal("No authentication or GSSAPI context");
|
|
|
|
|
|
|
|
gssctxt = authctxt->methoddata;
|
2018-07-10 17:13:30 +08:00
|
|
|
if ((r = sshpkt_get_string(ssh, &p, &len)) != 0 ||
|
2018-07-10 05:37:55 +08:00
|
|
|
(r = sshpkt_get_end(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse packet");
|
2018-07-10 17:13:30 +08:00
|
|
|
recv_tok.value = p;
|
|
|
|
recv_tok.length = len;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
/* Push the error token into GSSAPI to see what it says */
|
|
|
|
maj_status = PRIVSEP(ssh_gssapi_accept_ctx(gssctxt, &recv_tok,
|
|
|
|
&send_tok, NULL));
|
|
|
|
|
2013-06-02 05:31:17 +08:00
|
|
|
free(recv_tok.value);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
/* We can't return anything to the client, even if we wanted to */
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
/* The client will have already moved on to the next auth */
|
|
|
|
|
|
|
|
gss_release_buffer(&maj_status, &send_tok);
|
2015-01-20 04:07:45 +08:00
|
|
|
return 0;
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is called when the client thinks we've completed authentication.
|
|
|
|
* It should only be enabled in the dispatch handler by the function above,
|
|
|
|
* which only enables it once the GSSAPI exchange is complete.
|
|
|
|
*/
|
|
|
|
|
2015-01-20 04:07:45 +08:00
|
|
|
static int
|
2017-05-30 22:23:52 +08:00
|
|
|
input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh)
|
2003-08-26 09:49:55 +08:00
|
|
|
{
|
2017-05-30 22:18:15 +08:00
|
|
|
Authctxt *authctxt = ssh->authctxt;
|
2018-07-10 17:13:30 +08:00
|
|
|
int r, authenticated;
|
2017-06-24 14:34:38 +08:00
|
|
|
const char *displayname;
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
|
|
|
|
fatal("No authentication or GSSAPI context");
|
|
|
|
|
|
|
|
/*
|
2003-11-17 19:18:21 +08:00
|
|
|
* We don't need to check the status, because we're only enabled in
|
|
|
|
* the dispatcher once the exchange is complete
|
2003-08-26 09:49:55 +08:00
|
|
|
*/
|
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((r = sshpkt_get_end(ssh)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse packet");
|
2003-08-26 09:49:55 +08:00
|
|
|
|
|
|
|
authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
|
|
|
|
|
2017-06-24 14:34:38 +08:00
|
|
|
if ((!use_privsep || mm_is_monitor()) &&
|
|
|
|
(displayname = ssh_gssapi_displayname()) != NULL)
|
|
|
|
auth2_record_info(authctxt, "%s", displayname);
|
|
|
|
|
2003-08-26 09:49:55 +08:00
|
|
|
authctxt->postponed = 0;
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
|
|
|
|
userauth_finish(ssh, authenticated, "gssapi-with-mic", NULL);
|
2015-01-20 04:07:45 +08:00
|
|
|
return 0;
|
2003-11-17 19:18:21 +08:00
|
|
|
}
|
|
|
|
|
2015-01-20 04:07:45 +08:00
|
|
|
static int
|
2017-05-30 22:23:52 +08:00
|
|
|
input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh)
|
2003-11-17 19:18:21 +08:00
|
|
|
{
|
2017-05-30 22:18:15 +08:00
|
|
|
Authctxt *authctxt = ssh->authctxt;
|
2003-11-17 19:18:21 +08:00
|
|
|
Gssctxt *gssctxt;
|
2018-07-10 05:37:55 +08:00
|
|
|
int r, authenticated = 0;
|
|
|
|
struct sshbuf *b;
|
2003-11-17 19:18:21 +08:00
|
|
|
gss_buffer_desc mic, gssbuf;
|
2017-06-24 14:34:38 +08:00
|
|
|
const char *displayname;
|
2018-07-10 17:13:30 +08:00
|
|
|
u_char *p;
|
|
|
|
size_t len;
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2003-11-17 19:18:21 +08:00
|
|
|
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
|
|
|
|
fatal("No authentication or GSSAPI context");
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2003-11-17 19:18:21 +08:00
|
|
|
gssctxt = authctxt->methoddata;
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2018-07-10 17:13:30 +08:00
|
|
|
if ((r = sshpkt_get_string(ssh, &p, &len)) != 0)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_fr(r, "parse packet");
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((b = sshbuf_new()) == NULL)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_f("sshbuf_new failed");
|
2018-07-10 17:13:30 +08:00
|
|
|
mic.value = p;
|
|
|
|
mic.length = len;
|
2018-07-10 05:37:55 +08:00
|
|
|
ssh_gssapi_buildmic(b, authctxt->user, authctxt->service,
|
2021-01-27 18:05:28 +08:00
|
|
|
"gssapi-with-mic", ssh->kex->session_id);
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
if ((gssbuf.value = sshbuf_mutable_ptr(b)) == NULL)
|
2020-10-18 19:32:01 +08:00
|
|
|
fatal_f("sshbuf_mutable_ptr failed");
|
2018-07-10 05:37:55 +08:00
|
|
|
gssbuf.length = sshbuf_len(b);
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2003-11-17 19:18:21 +08:00
|
|
|
if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gssctxt, &gssbuf, &mic))))
|
|
|
|
authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
|
|
|
|
else
|
|
|
|
logit("GSSAPI MIC check failed");
|
|
|
|
|
2018-07-10 05:37:55 +08:00
|
|
|
sshbuf_free(b);
|
2013-06-02 05:31:17 +08:00
|
|
|
free(mic.value);
|
2003-11-21 20:56:47 +08:00
|
|
|
|
2017-06-24 14:34:38 +08:00
|
|
|
if ((!use_privsep || mm_is_monitor()) &&
|
|
|
|
(displayname = ssh_gssapi_displayname()) != NULL)
|
|
|
|
auth2_record_info(authctxt, "%s", displayname);
|
|
|
|
|
2003-11-17 19:18:21 +08:00
|
|
|
authctxt->postponed = 0;
|
2017-05-30 22:29:59 +08:00
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
|
|
|
|
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
|
|
|
|
userauth_finish(ssh, authenticated, "gssapi-with-mic", NULL);
|
2015-01-20 04:07:45 +08:00
|
|
|
return 0;
|
2003-08-26 09:49:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Authmethod method_gssapi = {
|
2003-11-17 19:18:21 +08:00
|
|
|
"gssapi-with-mic",
|
2003-08-26 09:49:55 +08:00
|
|
|
userauth_gssapi,
|
|
|
|
&options.gss_authentication
|
|
|
|
};
|
2006-08-05 13:24:59 +08:00
|
|
|
|
|
|
|
#endif /* GSSAPI */
|