summaryrefslogtreecommitdiff
path: root/gss-genr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gss-genr.c')
-rw-r--r--gss-genr.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/gss-genr.c b/gss-genr.c
index 57f12a2dc..e9190575d 100644
--- a/gss-genr.c
+++ b/gss-genr.c
@@ -1,7 +1,7 @@
1/* $OpenBSD: gss-genr.c,v 1.17 2006/08/29 12:02:30 dtucker Exp $ */ 1/* $OpenBSD: gss-genr.c,v 1.19 2007/06/12 11:56:15 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
@@ -107,7 +107,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status,
107 /* The GSSAPI error */ 107 /* The GSSAPI error */
108 do { 108 do {
109 gss_display_status(&lmin, ctxt->major, 109 gss_display_status(&lmin, ctxt->major,
110 GSS_C_GSS_CODE, GSS_C_NULL_OID, &ctx, &msg); 110 GSS_C_GSS_CODE, ctxt->oid, &ctx, &msg);
111 111
112 buffer_append(&b, msg.value, msg.length); 112 buffer_append(&b, msg.value, msg.length);
113 buffer_put_char(&b, '\n'); 113 buffer_put_char(&b, '\n');
@@ -118,7 +118,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status,
118 /* The mechanism specific error */ 118 /* The mechanism specific error */
119 do { 119 do {
120 gss_display_status(&lmin, ctxt->minor, 120 gss_display_status(&lmin, ctxt->minor,
121 GSS_C_MECH_CODE, GSS_C_NULL_OID, &ctx, &msg); 121 GSS_C_MECH_CODE, ctxt->oid, &ctx, &msg);
122 122
123 buffer_append(&b, msg.value, msg.length); 123 buffer_append(&b, msg.value, msg.length);
124 buffer_put_char(&b, '\n'); 124 buffer_put_char(&b, '\n');
@@ -226,39 +226,6 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
226 return (ctx->major); 226 return (ctx->major);
227} 227}
228 228
229/* Acquire credentials for a server running on the current host.
230 * Requires that the context structure contains a valid OID
231 */
232
233/* Returns a GSSAPI error code */
234OM_uint32
235ssh_gssapi_acquire_cred(Gssctxt *ctx)
236{
237 OM_uint32 status;
238 char lname[MAXHOSTNAMELEN];
239 gss_OID_set oidset;
240
241 gss_create_empty_oid_set(&status, &oidset);
242 gss_add_oid_set_member(&status, ctx->oid, &oidset);
243
244 if (gethostname(lname, MAXHOSTNAMELEN)) {
245 gss_release_oid_set(&status, &oidset);
246 return (-1);
247 }
248
249 if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
250 gss_release_oid_set(&status, &oidset);
251 return (ctx->major);
252 }
253
254 if ((ctx->major = gss_acquire_cred(&ctx->minor,
255 ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
256 ssh_gssapi_error(ctx);
257
258 gss_release_oid_set(&status, &oidset);
259 return (ctx->major);
260}
261
262OM_uint32 229OM_uint32
263ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash) 230ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
264{ 231{
@@ -281,16 +248,6 @@ ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service,
281 buffer_put_cstring(b, context); 248 buffer_put_cstring(b, context);
282} 249}
283 250
284OM_uint32
285ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
286{
287 if (*ctx)
288 ssh_gssapi_delete_ctx(ctx);
289 ssh_gssapi_build_ctx(ctx);
290 ssh_gssapi_set_oid(*ctx, oid);
291 return (ssh_gssapi_acquire_cred(*ctx));
292}
293
294int 251int
295ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host) 252ssh_gssapi_check_mechanism(Gssctxt **ctx, gss_OID oid, const char *host)
296{ 253{