]> andersk Git - gssapi-openssh.git/blobdiff - openssh/gss-genr.c
drop support for old external-keyx and gssapi methods
[gssapi-openssh.git] / openssh / gss-genr.c
index c51fa727da3262f9a7f59d240a58a72a39ef6e72..dff09212e6ec066a3ab435fc49cbadc2fc413562 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: gss-genr.c,v 1.19 2007/06/12 11:56:15 dtucker Exp $ */
+/* $OpenBSD: gss-genr.c,v 1.20 2009/06/22 05:39:28 dtucker Exp $ */
 
 /*
  * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved.
@@ -38,6 +38,7 @@
 #include "xmalloc.h"
 #include "buffer.h"
 #include "log.h"
+#include "canohost.h"
 #include "ssh2.h"
 #include "cipher.h"
 #include "key.h"
@@ -310,10 +311,13 @@ ssh_gssapi_build_ctx(Gssctxt **ctx)
 void
 ssh_gssapi_delete_ctx(Gssctxt **ctx)
 {
+#if !defined(MECHGLUE)
        OM_uint32 ms;
+#endif
 
        if ((*ctx) == NULL)
                return;
+#if !defined(MECHGLUE) /* mechglue has some memory management issues */
        if ((*ctx)->context != GSS_C_NO_CONTEXT)
                gss_delete_sec_context(&ms, &(*ctx)->context, GSS_C_NO_BUFFER);
        if ((*ctx)->name != GSS_C_NO_NAME)
@@ -329,6 +333,7 @@ ssh_gssapi_delete_ctx(Gssctxt **ctx)
                gss_release_name(&ms, &(*ctx)->client);
        if ((*ctx)->client_creds != GSS_C_NO_CREDENTIAL)
                gss_release_cred(&ms, &(*ctx)->client_creds);
+#endif
 
        xfree(*ctx);
        *ctx = NULL;
@@ -367,9 +372,18 @@ OM_uint32
 ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
 {
        gss_buffer_desc gssbuf;
+       char *xhost;
        char *val;
 
-       xasprintf(&val, "host@%s", host);
+       /* Make a copy of the host name, in case it was returned by a
+        * previous call to gethostbyname(). */ 
+       xhost = xstrdup(host);
+
+       /* Make sure we have the FQDN. Some GSSAPI implementations don't do
+        * this for us themselves */
+       resolve_localhost(&xhost);
+       
+       xasprintf(&val, "host@%s", xhost);
        gssbuf.value = val;
        gssbuf.length = strlen(gssbuf.value);
 
@@ -377,6 +391,7 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
            &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name)))
                ssh_gssapi_error(ctx);
 
+       xfree(xhost);
        xfree(gssbuf.value);
        return (ctx->major);
 }
@@ -498,7 +513,6 @@ ssh_gssapi_credentials_updated(Gssctxt *ctxt) {
        static OM_uint32 last_call = 0;
        OM_uint32 lifetime, now, major, minor;
        int equal;
-       gss_cred_usage_t usage = GSS_C_INITIATE;
        
        now = time(NULL);
 
This page took 0.054839 seconds and 4 git commands to generate.