Deleted Added
full compact
gss-genr.c (124208) gss-genr.c (126274)
1/* $OpenBSD: gss-genr.c,v 1.1 2003/08/22 10:56:09 markus Exp $ */
1/* $OpenBSD: gss-genr.c,v 1.3 2003/11/21 11:57:03 djm Exp $ */
2
3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

28
29#ifdef GSSAPI
30
31#include "xmalloc.h"
32#include "bufaux.h"
33#include "compat.h"
34#include "log.h"
35#include "monitor_wrap.h"
2
3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

28
29#ifdef GSSAPI
30
31#include "xmalloc.h"
32#include "bufaux.h"
33#include "compat.h"
34#include "log.h"
35#include "monitor_wrap.h"
36#include "ssh2.h"
36
37#include "ssh-gss.h"
38
37
38#include "ssh-gss.h"
39
40extern u_char *session_id2;
41extern u_int session_id2_len;
39
40/* Check that the OID in a data stream matches that in the context */
41int
42ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len)
43{
44 return (ctx != NULL && ctx->oid != GSS_C_NO_OID &&
45 ctx->oid->length == len &&
46 memcmp(ctx->oid->elements, data, len) == 0);

--- 193 unchanged lines hidden (view full) ---

240 ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
241 ssh_gssapi_error(ctx);
242
243 gss_release_oid_set(&status, &oidset);
244 return (ctx->major);
245}
246
247OM_uint32
42
43/* Check that the OID in a data stream matches that in the context */
44int
45ssh_gssapi_check_oid(Gssctxt *ctx, void *data, size_t len)
46{
47 return (ctx != NULL && ctx->oid != GSS_C_NO_OID &&
48 ctx->oid->length == len &&
49 memcmp(ctx->oid->elements, data, len) == 0);

--- 193 unchanged lines hidden (view full) ---

243 ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
244 ssh_gssapi_error(ctx);
245
246 gss_release_oid_set(&status, &oidset);
247 return (ctx->major);
248}
249
250OM_uint32
251ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
252{
253 if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context,
254 GSS_C_QOP_DEFAULT, buffer, hash)))
255 ssh_gssapi_error(ctx);
256
257 return (ctx->major);
258}
259
260void
261ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service,
262 const char *context)
263{
264 buffer_init(b);
265 buffer_put_string(b, session_id2, session_id2_len);
266 buffer_put_char(b, SSH2_MSG_USERAUTH_REQUEST);
267 buffer_put_cstring(b, user);
268 buffer_put_cstring(b, service);
269 buffer_put_cstring(b, context);
270}
271
272OM_uint32
248ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) {
249 if (*ctx)
250 ssh_gssapi_delete_ctx(ctx);
251 ssh_gssapi_build_ctx(ctx);
252 ssh_gssapi_set_oid(*ctx, oid);
253 return (ssh_gssapi_acquire_cred(*ctx));
254}
255
256#endif /* GSSAPI */
273ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) {
274 if (*ctx)
275 ssh_gssapi_delete_ctx(ctx);
276 ssh_gssapi_build_ctx(ctx);
277 ssh_gssapi_set_oid(*ctx, oid);
278 return (ssh_gssapi_acquire_cred(*ctx));
279}
280
281#endif /* GSSAPI */