summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/gssapi/test_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/gssapi/test_common.c')
-rw-r--r--crypto/heimdal/lib/gssapi/test_common.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/crypto/heimdal/lib/gssapi/test_common.c b/crypto/heimdal/lib/gssapi/test_common.c
index 329180f..8251aef 100644
--- a/crypto/heimdal/lib/gssapi/test_common.c
+++ b/crypto/heimdal/lib/gssapi/test_common.c
@@ -1,18 +1,18 @@
/*
- * Copyright (c) 2006 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
+ * Copyright (c) 2006 - 2008 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
*
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of KTH nor the names of its contributors may be
* used to endorse or promote products derived from this software without
@@ -35,8 +35,6 @@
#include <err.h>
#include "test_common.h"
-RCSID("$Id: test_common.c 20075 2007-01-31 06:05:19Z lha $");
-
char *
gssapi_err(OM_uint32 maj_stat, OM_uint32 min_stat, gss_OID mech)
{
@@ -51,20 +49,21 @@ gssapi_err(OM_uint32 maj_stat, OM_uint32 min_stat, gss_OID mech)
maj_error_message.value = NULL;
min_error_message.length = 0;
min_error_message.value = NULL;
-
- disp_maj_stat = gss_display_status(&disp_min_stat, maj_stat,
+
+ disp_maj_stat = gss_display_status(&disp_min_stat, maj_stat,
GSS_C_GSS_CODE,
mech, &msg_ctx, &maj_error_message);
disp_maj_stat = gss_display_status(&disp_min_stat, min_stat,
GSS_C_MECH_CODE,
mech, &msg_ctx, &min_error_message);
- asprintf(&ret, "gss-code: %lu %.*s\nmech-code: %lu %.*s",
- (unsigned long)maj_stat,
- (int)maj_error_message.length,
- (char *)maj_error_message.value,
- (unsigned long)min_stat,
- (int)min_error_message.length,
- (char *)min_error_message.value);
+ if (asprintf(&ret, "gss-code: %lu %.*s -- mech-code: %lu %.*s",
+ (unsigned long)maj_stat,
+ (int)maj_error_message.length,
+ (char *)maj_error_message.value,
+ (unsigned long)min_stat,
+ (int)min_error_message.length,
+ (char *)min_error_message.value) < 0 || ret == NULL)
+ errx(1, "malloc");
gss_release_buffer(&disp_min_stat, &maj_error_message);
gss_release_buffer(&disp_min_stat, &min_error_message);
OpenPOWER on IntegriCloud