]> andersk Git - gssapi-openssh.git/blobdiff - openssh/gss-serv-krb5.c
new comment in Simon's code
[gssapi-openssh.git] / openssh / gss-serv-krb5.c
index 8b3a4a7142398f3f9f10b16be11a23a4d97a884b..243fbd59895e5b07327853e6c84e9b1c31426655 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: gss-serv-krb5.c,v 1.3 2004/07/21 10:36:23 djm Exp $   */
+/* $OpenBSD: gss-serv-krb5.c,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */
 
 /*
  * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
 #ifdef GSSAPI
 #ifdef KRB5
 
-#include "auth.h"
+#include <sys/types.h>
+
+#include <stdarg.h>
+#include <string.h>
+
 #include "xmalloc.h"
+#include "key.h"
+#include "hostfile.h"
+#include "auth.h"
 #include "log.h"
 #include "servconf.h"
 
+#include "buffer.h"
 #include "ssh-gss.h"
 
 extern ServerOptions options;
 
 #ifdef HEIMDAL
 # include <krb5.h>
-#else
-# ifdef HAVE_GSSAPI_KRB5
+#elif !defined(MECHGLUE)
+# ifdef HAVE_GSSAPI_KRB5_H
 #  include <gssapi_krb5.h>
-# elif HAVE_GSSAPI_GSSAPI_KRB5
+# elif HAVE_GSSAPI_GSSAPI_KRB5_H
 #  include <gssapi/gssapi_krb5.h>
 # endif
 #endif
@@ -156,6 +164,7 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
        OM_uint32 maj_status, min_status;
        gss_cred_id_t krb5_cred_handle;
        int len;
+    const char* new_ccname;
 
        if (client->creds == NULL) {
                debug("No credentials stored");
@@ -212,11 +221,16 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
                return;
        }
 
-       client->store.filename = xstrdup(krb5_cc_get_name(krb_context, ccache));
+       new_ccname = krb5_cc_get_name(krb_context, ccache);
+
        client->store.envvar = "KRB5CCNAME";
-       len = strlen(client->store.filename) + 6;
-       client->store.envval = xmalloc(len);
-       snprintf(client->store.envval, len, "FILE:%s", client->store.filename);
+#ifdef USE_CCAPI
+       xasprintf(&client->store.envval, "API:%s", new_ccname);
+       client->store.filename = NULL;
+#else
+       xasprintf(&client->store.envval, "FILE:%s", new_ccname);
+       client->store.filename = xstrdup(new_ccname);
+#endif
 
 #ifdef USE_PAM
        if (options.use_pam)
This page took 0.085457 seconds and 4 git commands to generate.