(init_fcc): provide better error codes
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21977 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -463,9 +463,13 @@ init_fcc (krb5_context context,
|
|||||||
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
||||||
ret = krb5_ret_int8(sp, &pvno);
|
ret = krb5_ret_int8(sp, &pvno);
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
if(ret == KRB5_CC_END)
|
if(ret == KRB5_CC_END) {
|
||||||
ret = ENOENT; /* empty file */
|
krb5_set_error_string(context, "Empty credential cache file: %s",
|
||||||
krb5_clear_error_string(context);
|
FILENAME(id));
|
||||||
|
ret = ENOENT;
|
||||||
|
} else
|
||||||
|
krb5_set_error_string(context, "Error reading pvno in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if(pvno != 5) {
|
if(pvno != 5) {
|
||||||
@@ -476,7 +480,8 @@ init_fcc (krb5_context context,
|
|||||||
}
|
}
|
||||||
ret = krb5_ret_int8(sp, &tag); /* should not be host byte order */
|
ret = krb5_ret_int8(sp, &tag); /* should not be host byte order */
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading tag in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -489,7 +494,8 @@ init_fcc (krb5_context context,
|
|||||||
ret = krb5_ret_int16 (sp, &length);
|
ret = krb5_ret_int16 (sp, &length);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading tag length in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
while(length > 0) {
|
while(length > 0) {
|
||||||
@@ -499,13 +505,15 @@ init_fcc (krb5_context context,
|
|||||||
|
|
||||||
ret = krb5_ret_int16 (sp, &dtag);
|
ret = krb5_ret_int16 (sp, &dtag);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading dtag in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = krb5_ret_int16 (sp, &data_len);
|
ret = krb5_ret_int16 (sp, &data_len);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading dlength in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -513,13 +521,15 @@ init_fcc (krb5_context context,
|
|||||||
case FCC_TAG_DELTATIME :
|
case FCC_TAG_DELTATIME :
|
||||||
ret = krb5_ret_int32 (sp, &context->kdc_sec_offset);
|
ret = krb5_ret_int32 (sp, &context->kdc_sec_offset);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading kdc_sec in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = krb5_ret_int32 (sp, &context->kdc_usec_offset);
|
ret = krb5_ret_int32 (sp, &context->kdc_usec_offset);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading kdc_usec in "
|
||||||
|
"cache file: %s", FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -528,7 +538,9 @@ init_fcc (krb5_context context,
|
|||||||
for (i = 0; i < data_len; ++i) {
|
for (i = 0; i < data_len; ++i) {
|
||||||
ret = krb5_ret_int8 (sp, &dummy);
|
ret = krb5_ret_int8 (sp, &dummy);
|
||||||
if(ret) {
|
if(ret) {
|
||||||
krb5_clear_error_string(context);
|
krb5_set_error_string(context, "Error reading unknown "
|
||||||
|
"tag in cache file: %s",
|
||||||
|
FILENAME(id));
|
||||||
ret = KRB5_CC_FORMAT;
|
ret = KRB5_CC_FORMAT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user