]> andersk Git - gssapi-openssh.git/blobdiff - openssh/gss-genr.c
added note that we added GT 3.2b compatibility in this release
[gssapi-openssh.git] / openssh / gss-genr.c
index 1d08e5b1ba101431fb26755b01e5ed1eb8f6566b..dee38125223c28ae465d2359d90230f5f554a5cb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: gss-genr.c,v 1.1 2003/08/22 10:56:09 markus Exp $     */
+/*     $OpenBSD: gss-genr.c,v 1.3 2003/11/21 11:57:03 djm Exp $        */
 
 /*
  * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
 
 #ifdef GSSAPI
 
-#include "ssh.h"
-#include "ssh2.h"
 #include "xmalloc.h"
 #include "buffer.h"
 #include "bufaux.h"
-#include "packet.h"
 #include "compat.h"
 #include <openssl/evp.h>
-#include "cipher.h"
 #include "kex.h"
 #include "log.h"
-#include "compat.h"
 #include "monitor_wrap.h"
 #include "canohost.h"
-
-#include <netdb.h>
+#include "ssh2.h"
 
 #include "ssh-gss.h"
 
+extern u_char *session_id2;
+extern u_int session_id2_len;
+
 typedef struct {
        char *encoded;
        gss_OID oid;
@@ -384,7 +381,7 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
        
        gssbuf.length = sizeof("host@") + strlen(xhost);
        gssbuf.value = xmalloc(gssbuf.length);
-       snprintf(gssbuf.value, gssbuf.length, "host@%s", host);
+       snprintf(gssbuf.value, gssbuf.length, "host@%s", xhost);
 
        if ((ctx->major = gss_import_name(&ctx->minor,
            &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name)))
@@ -424,6 +421,28 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
        return (ctx->major);
 }
 
+OM_uint32
+ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
+{
+       if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context,
+           GSS_C_QOP_DEFAULT, buffer, hash)))
+               ssh_gssapi_error(ctx);
+
+       return (ctx->major);
+}
+
+void
+ssh_gssapi_buildmic(Buffer *b, const char *user, const char *service,
+    const char *context)
+{
+       buffer_init(b);
+       buffer_put_string(b, session_id2, session_id2_len);
+       buffer_put_char(b, SSH2_MSG_USERAUTH_REQUEST);
+       buffer_put_cstring(b, user);
+       buffer_put_cstring(b, service);
+       buffer_put_cstring(b, context);
+}
+
 OM_uint32
 ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) {
        if (*ctx)
@@ -433,17 +452,6 @@ ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) {
        return (ssh_gssapi_acquire_cred(*ctx));
 }
 
-OM_uint32
-ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *buffer, gss_buffer_desc *hash) {
-       
-       if ((ctx->major=gss_get_mic(&ctx->minor,ctx->context,
-                                   GSS_C_QOP_DEFAULT, buffer, hash))) {
-               ssh_gssapi_error(ctx);
-       }
-       
-       return(ctx->major);
-}
-
 int
 ssh_gssapi_check_mechanism(gss_OID oid, char *host) {
        Gssctxt * ctx = NULL;
This page took 0.046333 seconds and 4 git commands to generate.