]> andersk Git - gssapi-openssh.git/blobdiff - openssh/gss-genr.c
merging OPENSSH_5_2P1_SIMON_20090726_HPN13V6 to trunk:
[gssapi-openssh.git] / openssh / gss-genr.c
index c51fa727da3262f9a7f59d240a58a72a39ef6e72..a8255c3e2c72a193d66efa47a520f0815d6da3ba 100644 (file)
@@ -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);
 }
This page took 0.063646 seconds and 4 git commands to generate.