Clear error-string when introducing new errors.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16661 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997-2000, 2005-2006 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -96,8 +96,10 @@ kadm5_c_chpass_principal_with_key(void *server_handle,
|
||||
return ret;
|
||||
|
||||
sp = krb5_storage_from_mem(buf, sizeof(buf));
|
||||
if (sp == NULL)
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_store_int32(sp, kadm_chpass_with_key);
|
||||
krb5_store_principal(sp, princ);
|
||||
krb5_store_int32(sp, n_key_data);
|
||||
@@ -110,10 +112,12 @@ kadm5_c_chpass_principal_with_key(void *server_handle,
|
||||
return ret;
|
||||
sp = krb5_storage_from_data (&reply);
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_data_free (&reply);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_ret_int32(sp, &tmp);
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_storage_free(sp);
|
||||
krb5_data_free (&reply);
|
||||
return tmp;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 1999 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997-2000, 2005-2006 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -53,8 +53,10 @@ kadm5_c_create_principal(void *server_handle,
|
||||
return ret;
|
||||
|
||||
sp = krb5_storage_from_mem(buf, sizeof(buf));
|
||||
if (sp == NULL)
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_store_int32(sp, kadm_create);
|
||||
kadm5_store_principal_ent(sp, princ);
|
||||
krb5_store_int32(sp, mask);
|
||||
@@ -66,10 +68,12 @@ kadm5_c_create_principal(void *server_handle,
|
||||
return ret;
|
||||
sp = krb5_storage_from_data (&reply);
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_data_free (&reply);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_ret_int32(sp, &tmp);
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_storage_free(sp);
|
||||
krb5_data_free (&reply);
|
||||
return tmp;
|
||||
|
@@ -50,8 +50,10 @@ kadm5_c_delete_principal(void *server_handle, krb5_principal princ)
|
||||
return ret;
|
||||
|
||||
sp = krb5_storage_from_mem(buf, sizeof(buf));
|
||||
if (sp == NULL)
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_store_int32(sp, kadm_delete);
|
||||
krb5_store_principal(sp, princ);
|
||||
ret = _kadm5_client_send(context, sp);
|
||||
@@ -63,10 +65,12 @@ kadm5_c_delete_principal(void *server_handle, krb5_principal princ)
|
||||
return ret;
|
||||
sp = krb5_storage_from_data (&reply);
|
||||
if(sp == NULL) {
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_data_free (&reply);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_ret_int32(sp, &tmp);
|
||||
krb5_clear_error_string(context->context);
|
||||
krb5_storage_free(sp);
|
||||
krb5_data_free (&reply);
|
||||
return tmp;
|
||||
|
@@ -368,8 +368,10 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
hostname = slash + 1;
|
||||
|
||||
error = getaddrinfo (hostname, portstr, &hints, &ai);
|
||||
if (error)
|
||||
if (error) {
|
||||
krb5_clear_error_string(context);
|
||||
return KADM5_BAD_SERVER_NAME;
|
||||
}
|
||||
|
||||
for (a = ai; a != NULL; a = a->ai_next) {
|
||||
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
|
||||
@@ -384,6 +386,7 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
}
|
||||
if (a == NULL) {
|
||||
freeaddrinfo (ai);
|
||||
krb5_clear_error_string(context);
|
||||
krb5_warnx (context, "failed to contact %s", hostname);
|
||||
return KADM5_FAILURE;
|
||||
}
|
||||
@@ -407,6 +410,7 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
if (service_name == NULL) {
|
||||
freeaddrinfo (ai);
|
||||
close(s);
|
||||
krb5_clear_error_string(context);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -450,11 +454,13 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
|
||||
if (s < 0) {
|
||||
freeaddrinfo (ai);
|
||||
krb5_clear_error_string(context);
|
||||
return errno;
|
||||
}
|
||||
if (connect (s, a->ai_addr, a->ai_addrlen) < 0) {
|
||||
close (s);
|
||||
freeaddrinfo (ai);
|
||||
krb5_clear_error_string(context);
|
||||
return errno;
|
||||
}
|
||||
ret = krb5_sendauth(context, &ctx->ac, &s,
|
||||
@@ -471,10 +477,6 @@ kadm_connect(kadm5_client_context *ctx)
|
||||
krb5_free_principal(context, server);
|
||||
if(ctx->ccache == NULL)
|
||||
krb5_cc_close(context, cc);
|
||||
if(ret) {
|
||||
close(s);
|
||||
return ret;
|
||||
}
|
||||
ctx->sock = s;
|
||||
|
||||
return 0;
|
||||
|
@@ -52,8 +52,10 @@ kadm5_c_modify_principal(void *server_handle,
|
||||
return ret;
|
||||
|
||||
sp = krb5_storage_from_mem(buf, sizeof(buf));
|
||||
if (sp == NULL)
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->contect);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_store_int32(sp, kadm_modify);
|
||||
kadm5_store_principal_ent(sp, princ);
|
||||
krb5_store_int32(sp, mask);
|
||||
@@ -66,10 +68,12 @@ kadm5_c_modify_principal(void *server_handle,
|
||||
return ret;
|
||||
sp = krb5_storage_from_data (&reply);
|
||||
if (sp == NULL) {
|
||||
krb5_clear_error_string(context->contect);
|
||||
krb5_data_free (&reply);
|
||||
return ENOMEM;
|
||||
}
|
||||
krb5_ret_int32(sp, &tmp);
|
||||
krb5_clear_error_string(context->contect);
|
||||
krb5_storage_free(sp);
|
||||
krb5_data_free (&reply);
|
||||
return tmp;
|
||||
|
Reference in New Issue
Block a user