add some krb5_{set,clear}_error_string

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9937 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-05-14 06:14:52 +00:00
parent ffc0237390
commit d27aa3b62e
65 changed files with 1287 additions and 481 deletions

View File

@@ -70,11 +70,14 @@ fcc_resolve(krb5_context context, krb5_ccache *id, const char *res)
{
krb5_fcache *f;
f = malloc(sizeof(*f));
if(f == NULL)
if(f == NULL) {
krb5_set_error_string(context, "malloc: out of memory");
return KRB5_CC_NOMEM;
}
f->filename = strdup(res);
if(f->filename == NULL){
free(f);
krb5_set_error_string(context, "malloc: out of memory");
return KRB5_CC_NOMEM;
}
f->version = 0;
@@ -171,18 +174,23 @@ fcc_gen_new(krb5_context context, krb5_ccache *id)
krb5_fcache *f;
int fd;
char *file;
f = malloc(sizeof(*f));
if(f == NULL)
if(f == NULL) {
krb5_set_error_string(context, "malloc: out of memory");
return KRB5_CC_NOMEM;
}
asprintf (&file, "%sXXXXXX", KRB5_DEFAULT_CCFILE_ROOT);
if(file == NULL) {
free(f);
krb5_set_error_string(context, "malloc: out of memory");
return KRB5_CC_NOMEM;
}
fd = mkstemp(file);
if(fd < 0) {
free(f);
free(file);
krb5_set_error_string(context, "mkstemp %s", file);
return errno;
}
close(fd);
@@ -263,8 +271,11 @@ fcc_initialize(krb5_context context,
krb5_storage_free(sp);
}
if(close(fd) < 0)
if (ret == 0)
if (ret == 0) {
ret = errno;
krb5_set_error_string (context, "close %s: %s", filename,
strerror(ret));
}
return ret;
}
@@ -315,8 +326,10 @@ fcc_store_cred(krb5_context context,
krb5_storage_free(sp);
}
if (close(fd) < 0)
if (ret == 0)
if (ret == 0) {
ret = errno;
krb5_set_error_string (context, "close %s: %s", f, strerror(ret));
}
return ret;
}
@@ -354,8 +367,10 @@ init_fcc (krb5_context context,
}
sp = krb5_storage_from_fd(fd);
ret = krb5_ret_int8(sp, &pvno);
if(ret == KRB5_CC_END)
if(ret == KRB5_CC_END) {
return ENOENT;
}
if(ret)
return ret;
if(pvno != 5) {