lib/krb5: unparse_name_fixed ERANGE if zero buffer len
The tests depend upon an ERANGE error for buffer length zero.
They broken due to 8324a2af1d
("lib/krb5: unparse_name_fixed error if invalid name buffer or length")
which returned EINVAL.
Change-Id: I81693f9d3f5fdc1838c11ffbfe0dafc742d9b207
This commit is contained in:
@@ -457,13 +457,20 @@ unparse_name_fixed(krb5_context context,
|
||||
int no_realm = (flags & KRB5_PRINCIPAL_UNPARSE_NO_REALM) != 0;
|
||||
int display = (flags & KRB5_PRINCIPAL_UNPARSE_DISPLAY) != 0;
|
||||
|
||||
if (name == NULL || len == 0) {
|
||||
if (name == NULL) {
|
||||
krb5_set_error_message(context, EINVAL,
|
||||
N_("Invalid name buffer or length, "
|
||||
N_("Invalid name buffer, "
|
||||
"can't unparse", ""));
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
krb5_set_error_message(context, ERANGE,
|
||||
N_("Invalid name buffer length, "
|
||||
"can't unparse", ""));
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
if (!no_realm && princ_realm(principal) == NULL) {
|
||||
|
Reference in New Issue
Block a user