summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/gssapi/krb5/display_status.c
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-08-15 18:31:28 +0400
committerAndrew Bartlett <abartlet@samba.org>2010-10-03 01:15:04 +0000
commitab6e3fce040f9ad27cbce44e9038a24f15b601c8 (patch)
treeab99a431c9610927b5d0d26335d2712b509fd6dc /source4/heimdal/lib/gssapi/krb5/display_status.c
parent197a1514d62494cc8b862d169c841a26e04b8925 (diff)
downloadsamba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.gz
samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.tar.bz2
samba-ab6e3fce040f9ad27cbce44e9038a24f15b601c8.zip
s4:heimdal: import lorikeet-heimdal-201009250123 (commit 42cabfb5b683dbcb97d583c397b897507689e382)
I based this on Matthieu's import of lorikeet-heimdal, and then updated it to this commit. Andrew Bartlett
Diffstat (limited to 'source4/heimdal/lib/gssapi/krb5/display_status.c')
-rw-r--r--source4/heimdal/lib/gssapi/krb5/display_status.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source4/heimdal/lib/gssapi/krb5/display_status.c b/source4/heimdal/lib/gssapi/krb5/display_status.c
index f9d84fc762..c50200672a 100644
--- a/source4/heimdal/lib/gssapi/krb5/display_status.c
+++ b/source4/heimdal/lib/gssapi/krb5/display_status.c
@@ -125,20 +125,21 @@ _gsskrb5_set_status (int ret, const char *fmt, ...)
krb5_context context;
va_list args;
char *str;
+ int e;
if (_gsskrb5_init (&context) != 0)
return;
va_start(args, fmt);
- vasprintf(&str, fmt, args);
+ e = vasprintf(&str, fmt, args);
va_end(args);
- if (str) {
+ if (e >= 0 && str) {
krb5_set_error_message(context, ret, "%s", str);
free(str);
}
}
-OM_uint32 _gsskrb5_display_status
+OM_uint32 GSSAPI_CALLCONV _gsskrb5_display_status
(OM_uint32 *minor_status,
OM_uint32 status_value,
int status_type,
@@ -147,7 +148,8 @@ OM_uint32 _gsskrb5_display_status
gss_buffer_t status_string)
{
krb5_context context;
- char *buf;
+ char *buf = NULL;
+ int e = 0;
GSSAPI_KRB5_INIT (&context);
@@ -162,27 +164,27 @@ OM_uint32 _gsskrb5_display_status
if (status_type == GSS_C_GSS_CODE) {
if (GSS_SUPPLEMENTARY_INFO(status_value))
- asprintf(&buf, "%s",
- supplementary_error(GSS_SUPPLEMENTARY_INFO(status_value)));
+ e = asprintf(&buf, "%s",
+ supplementary_error(GSS_SUPPLEMENTARY_INFO(status_value)));
else
- asprintf (&buf, "%s %s",
- calling_error(GSS_CALLING_ERROR(status_value)),
- routine_error(GSS_ROUTINE_ERROR(status_value)));
+ e = asprintf (&buf, "%s %s",
+ calling_error(GSS_CALLING_ERROR(status_value)),
+ routine_error(GSS_ROUTINE_ERROR(status_value)));
} else if (status_type == GSS_C_MECH_CODE) {
const char *buf2 = krb5_get_error_message(context, status_value);
if (buf2) {
buf = strdup(buf2);
krb5_free_error_message(context, buf2);
} else {
- asprintf(&buf, "unknown mech error-code %u",
- (unsigned)status_value);
+ e = asprintf(&buf, "unknown mech error-code %u",
+ (unsigned)status_value);
}
} else {
*minor_status = EINVAL;
return GSS_S_BAD_STATUS;
}
- if (buf == NULL) {
+ if (e < 0 || buf == NULL) {
*minor_status = ENOMEM;
return GSS_S_FAILURE;
}