use krb5_set_error_message

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23310 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-06-23 03:30:49 +00:00
parent 366734d9a2
commit 32d7980f02

View File

@@ -57,7 +57,7 @@ krb5_copy_ticket(krb5_context context,
*to = NULL; *to = NULL;
tmp = malloc(sizeof(*tmp)); tmp = malloc(sizeof(*tmp));
if(tmp == NULL) { if(tmp == NULL) {
krb5_set_error_string (context, "malloc: out of memory"); krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
return ENOMEM; return ENOMEM;
} }
if((ret = copy_EncTicketPart(&from->ticket, &tmp->ticket))){ if((ret = copy_EncTicketPart(&from->ticket, &tmp->ticket))){
@@ -118,9 +118,10 @@ find_type_in_ad(krb5_context context,
int i; int i;
if (level > 9) { if (level > 9) {
krb5_set_error_string(context, "Authorization data nested deeper "
"then %d levels, stop searching", level);
ret = ENOENT; /* XXX */ ret = ENOENT; /* XXX */
krb5_set_error_message(context, ret,
"Authorization data nested deeper "
"then %d levels, stop searching", level);
goto out; goto out;
} }
@@ -133,7 +134,7 @@ find_type_in_ad(krb5_context context,
if (!*found && ad->val[i].ad_type == type) { if (!*found && ad->val[i].ad_type == type) {
ret = der_copy_octet_string(&ad->val[i].ad_data, data); ret = der_copy_octet_string(&ad->val[i].ad_data, data);
if (ret) { if (ret) {
krb5_set_error_string(context, "malloc - out of memory"); krb5_set_error_message(context, ret, "malloc: out of memory");
goto out; goto out;
} }
*found = TRUE; *found = TRUE;
@@ -147,7 +148,7 @@ find_type_in_ad(krb5_context context,
&child, &child,
NULL); NULL);
if (ret) { if (ret) {
krb5_set_error_string(context, "Failed to decode " krb5_set_error_message(context, ret, "Failed to decode "
"IF_RELEVANT with %d", (int)ret); "IF_RELEVANT with %d", (int)ret);
goto out; goto out;
} }
@@ -167,7 +168,7 @@ find_type_in_ad(krb5_context context,
&child, &child,
NULL); NULL);
if (ret) { if (ret) {
krb5_set_error_string(context, "Failed to decode " krb5_set_error_message(context, ret, "Failed to decode "
"AD_KDCIssued with %d", ret); "AD_KDCIssued with %d", ret);
goto out; goto out;
} }
@@ -211,17 +212,17 @@ find_type_in_ad(krb5_context context,
case KRB5_AUTHDATA_AND_OR: case KRB5_AUTHDATA_AND_OR:
if (!failp) if (!failp)
break; break;
krb5_set_error_string(context, "Authorization data contains " ret = ENOENT; /* XXX */
krb5_set_error_message(context, ret, "Authorization data contains "
"AND-OR element that is unknown to the " "AND-OR element that is unknown to the "
"application"); "application");
ret = ENOENT; /* XXX */
goto out; goto out;
default: default:
if (!failp) if (!failp)
break; break;
krb5_set_error_string(context, "Authorization data contains "
"unknown type (%d) ", ad->val[i].ad_type);
ret = ENOENT; /* XXX */ ret = ENOENT; /* XXX */
krb5_set_error_message(context, ret, "Authorization data contains "
"unknown type (%d) ", ad->val[i].ad_type);
goto out; goto out;
} }
} }
@@ -255,7 +256,8 @@ krb5_ticket_get_authorization_data_type(krb5_context context,
ad = ticket->ticket.authorization_data; ad = ticket->ticket.authorization_data;
if (ticket->ticket.authorization_data == NULL) { if (ticket->ticket.authorization_data == NULL) {
krb5_set_error_string(context, "Ticket have not authorization data"); krb5_set_error_message(context, ENOENT,
"Ticket have not authorization data");
return ENOENT; /* XXX */ return ENOENT; /* XXX */
} }
@@ -264,8 +266,8 @@ krb5_ticket_get_authorization_data_type(krb5_context context,
if (ret) if (ret)
return ret; return ret;
if (!found) { if (!found) {
krb5_set_error_string(context, "Ticket have not authorization " krb5_set_error_message(context, ENOENT, "Ticket have not "
"data of type %d", type); "authorization data of type %d", type);
return ENOENT; /* XXX */ return ENOENT; /* XXX */
} }
return 0; return 0;