]> andersk Git - openssh.git/blobdiff - gss-genr.c
- (djm) [acss.c auth-krb5.c auth-options.c auth-pam.c auth-shadow.c]
[openssh.git] / gss-genr.c
index 8d75ee5c7bb28d3fda6fda89d94cee913034b9d2..522fedab3c3796d19300102b59115e5757a53ff7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: gss-genr.c,v 1.7 2006/03/20 04:07:49 djm Exp $        */
+/* $OpenBSD: gss-genr.c,v 1.11 2006/07/22 20:48:23 stevesk Exp $ */
 
 /*
  * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -28,6 +28,9 @@
 
 #ifdef GSSAPI
 
+#include <string.h>
+#include <unistd.h>
+
 #include "xmalloc.h"
 #include "bufaux.h"
 #include "log.h"
@@ -135,9 +138,7 @@ ssh_gssapi_last_error(Gssctxt *ctxt, OM_uint32 *major_status,
 void
 ssh_gssapi_build_ctx(Gssctxt **ctx)
 {
-       *ctx = xmalloc(sizeof (Gssctxt));
-       (*ctx)->major = 0;
-       (*ctx)->minor = 0;
+       *ctx = xcalloc(1, sizeof (Gssctxt));
        (*ctx)->context = GSS_C_NO_CONTEXT;
        (*ctx)->name = GSS_C_NO_NAME;
        (*ctx)->oid = GSS_C_NO_OID;
@@ -207,10 +208,11 @@ OM_uint32
 ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
 {
        gss_buffer_desc gssbuf;
+       char *val;
 
-       gssbuf.length = sizeof("host@") + strlen(host);
-       gssbuf.value = xmalloc(gssbuf.length);
-       snprintf(gssbuf.value, gssbuf.length, "host@%s", host);
+       xasprintf(&val, "host@%s", host);
+       gssbuf.value = val;
+       gssbuf.length = strlen(gssbuf.value);
 
        if ((ctx->major = gss_import_name(&ctx->minor,
            &gssbuf, GSS_C_NT_HOSTBASED_SERVICE, &ctx->name)))
This page took 0.480061 seconds and 4 git commands to generate.