version 1.24, 2016/09/12 01:22:38 |
version 1.25, 2018/07/09 21:37:55 |
|
|
#include <limits.h> |
#include <limits.h> |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "buffer.h" |
#include "ssherr.h" |
|
#include "sshbuf.h" |
#include "log.h" |
#include "log.h" |
#include "ssh2.h" |
#include "ssh2.h" |
|
|
|
|
OM_uint32 lmin; |
OM_uint32 lmin; |
gss_buffer_desc msg = GSS_C_EMPTY_BUFFER; |
gss_buffer_desc msg = GSS_C_EMPTY_BUFFER; |
OM_uint32 ctx; |
OM_uint32 ctx; |
Buffer b; |
struct sshbuf *b; |
char *ret; |
char *ret; |
|
int r; |
|
|
buffer_init(&b); |
if ((b = sshbuf_new()) == NULL) |
|
fatal("%s: sshbuf_new failed", __func__); |
|
|
if (major_status != NULL) |
if (major_status != NULL) |
*major_status = ctxt->major; |
*major_status = ctxt->major; |
|
|
gss_display_status(&lmin, ctxt->major, |
gss_display_status(&lmin, ctxt->major, |
GSS_C_GSS_CODE, ctxt->oid, &ctx, &msg); |
GSS_C_GSS_CODE, ctxt->oid, &ctx, &msg); |
|
|
buffer_append(&b, msg.value, msg.length); |
if ((r = sshbuf_put(b, msg.value, msg.length)) != 0 || |
buffer_put_char(&b, '\n'); |
(r = sshbuf_put_u8(b, '\n')) != 0) |
|
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
|
|
gss_release_buffer(&lmin, &msg); |
gss_release_buffer(&lmin, &msg); |
} while (ctx != 0); |
} while (ctx != 0); |
|
|
gss_display_status(&lmin, ctxt->minor, |
gss_display_status(&lmin, ctxt->minor, |
GSS_C_MECH_CODE, ctxt->oid, &ctx, &msg); |
GSS_C_MECH_CODE, ctxt->oid, &ctx, &msg); |
|
|
buffer_append(&b, msg.value, msg.length); |
if ((r = sshbuf_put(b, msg.value, msg.length)) != 0 || |
buffer_put_char(&b, '\n'); |
(r = sshbuf_put_u8(b, '\n')) != 0) |
|
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
|
|
gss_release_buffer(&lmin, &msg); |
gss_release_buffer(&lmin, &msg); |
} while (ctx != 0); |
} while (ctx != 0); |
|
|
buffer_put_char(&b, '\0'); |
if ((r = sshbuf_put_u8(b, '\n')) != 0) |
ret = xmalloc(buffer_len(&b)); |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
buffer_get(&b, ret, buffer_len(&b)); |
ret = xstrdup((const char *)sshbuf_ptr(b)); |
buffer_free(&b); |
sshbuf_free(b); |
return (ret); |
return (ret); |
} |
} |
|
|
|
|
} |
} |
|
|
void |
void |
ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service, |
ssh_gssapi_buildmic(struct sshbuf *b, const char *user, const char *service, |
const char *context) |
const char *context) |
{ |
{ |
buffer_init(b); |
int r; |
buffer_put_string(b, session_id2, session_id2_len); |
|
buffer_put_char(b, SSH2_MSG_USERAUTH_REQUEST); |
sshbuf_reset(b); |
buffer_put_cstring(b, user); |
if ((r = sshbuf_put_string(b, session_id2, session_id2_len)) != 0 || |
buffer_put_cstring(b, service); |
(r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 || |
buffer_put_cstring(b, context); |
(r = sshbuf_put_cstring(b, user)) != 0 || |
|
(r = sshbuf_put_cstring(b, service)) != 0 || |
|
(r = sshbuf_put_cstring(b, context)) != 0) |
|
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
} |
} |
|
|
int |
int |