storage tweaks
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10934 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1997 - 2002 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -58,7 +58,7 @@ struct fcc_cursor {
|
|||||||
|
|
||||||
#define FCC_CURSOR(C) ((struct fcc_cursor*)(C))
|
#define FCC_CURSOR(C) ((struct fcc_cursor*)(C))
|
||||||
|
|
||||||
static char*
|
static const char*
|
||||||
fcc_get_name(krb5_context context,
|
fcc_get_name(krb5_context context,
|
||||||
krb5_ccache id)
|
krb5_ccache id)
|
||||||
{
|
{
|
||||||
@@ -248,6 +248,7 @@ fcc_initialize(krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
|
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
||||||
if(context->fcache_vno != 0)
|
if(context->fcache_vno != 0)
|
||||||
f->version = context->fcache_vno;
|
f->version = context->fcache_vno;
|
||||||
else
|
else
|
||||||
@@ -321,6 +322,7 @@ fcc_store_cred(krb5_context context,
|
|||||||
{
|
{
|
||||||
krb5_storage *sp;
|
krb5_storage *sp;
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
|
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
||||||
storage_set_flags(context, sp, FCACHE(id)->version);
|
storage_set_flags(context, sp, FCACHE(id)->version);
|
||||||
ret = krb5_store_creds(sp, creds);
|
ret = krb5_store_creds(sp, creds);
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
@@ -366,11 +368,10 @@ init_fcc (krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
|
krb5_storage_set_eof_code(sp, KRB5_CC_END);
|
||||||
ret = krb5_ret_int8(sp, &pvno);
|
ret = krb5_ret_int8(sp, &pvno);
|
||||||
if(ret == KRB5_CC_END) {
|
if(ret == KRB5_CC_END)
|
||||||
|
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
if(pvno != 5) {
|
if(pvno != 5) {
|
||||||
|
@@ -208,7 +208,7 @@ akf_start_seq_get(krb5_context context,
|
|||||||
krb5_storage_free(c->sp);
|
krb5_storage_free(c->sp);
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
krb5_clear_error_string (context);
|
krb5_clear_error_string (context);
|
||||||
if(ret == KRB5_CC_END)
|
if(ret == KRB5_KT_END)
|
||||||
return KRB5_KT_NOTFOUND;
|
return KRB5_KT_NOTFOUND;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ akf_next_entry(krb5_context context,
|
|||||||
off_t pos;
|
off_t pos;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pos = cursor->sp->seek(cursor->sp, 0, SEEK_CUR);
|
pos = krb5_storage_seek(cursor->sp, 0, SEEK_CUR);
|
||||||
|
|
||||||
if ((pos - 4) / (4 + 8) >= d->num_entries)
|
if ((pos - 4) / (4 + 8) >= d->num_entries)
|
||||||
return KRB5_KT_END;
|
return KRB5_KT_END;
|
||||||
@@ -255,7 +255,7 @@ akf_next_entry(krb5_context context,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = cursor->sp->fetch(cursor->sp, entry->keyblock.keyvalue.data, 8);
|
ret = krb5_storage_read(cursor->sp, entry->keyblock.keyvalue.data, 8);
|
||||||
if(ret != 8)
|
if(ret != 8)
|
||||||
ret = (ret < 0) ? errno : KRB5_KT_END;
|
ret = (ret < 0) ? errno : KRB5_KT_END;
|
||||||
else
|
else
|
||||||
@@ -264,7 +264,7 @@ akf_next_entry(krb5_context context,
|
|||||||
entry->timestamp = time(NULL);
|
entry->timestamp = time(NULL);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
cursor->sp->seek(cursor->sp, pos + 4 + 8, SEEK_SET);
|
krb5_storage_seek(cursor->sp, pos + 4 + 8, SEEK_SET);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ akf_add_entry(krb5_context context,
|
|||||||
if (created)
|
if (created)
|
||||||
len = 0;
|
len = 0;
|
||||||
else {
|
else {
|
||||||
if((*sp->seek)(sp, 0, SEEK_SET) < 0) {
|
if(krb5_storage_seek(sp, 0, SEEK_SET) < 0) {
|
||||||
ret = errno;
|
ret = errno;
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -333,7 +333,7 @@ akf_add_entry(krb5_context context,
|
|||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
if((*sp->seek)(sp, 0, SEEK_SET) < 0) {
|
if(krb5_storage_seek(sp, 0, SEEK_SET) < 0) {
|
||||||
ret = errno;
|
ret = errno;
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -349,7 +349,7 @@ akf_add_entry(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if((*sp->seek)(sp, (len - 1) * (8 + 4), SEEK_CUR) < 0) {
|
if(krb5_storage_seek(sp, (len - 1) * (8 + 4), SEEK_CUR) < 0) {
|
||||||
ret = errno;
|
ret = errno;
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -363,7 +363,7 @@ akf_add_entry(krb5_context context,
|
|||||||
close(fd);
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = sp->store(sp, entry->keyblock.keyvalue.data,
|
ret = krb5_storage_write(sp, entry->keyblock.keyvalue.data,
|
||||||
entry->keyblock.keyvalue.length);
|
entry->keyblock.keyvalue.length);
|
||||||
if(ret != entry->keyblock.keyvalue.length) {
|
if(ret != entry->keyblock.keyvalue.length) {
|
||||||
krb5_storage_free(sp);
|
krb5_storage_free(sp);
|
||||||
|
@@ -139,6 +139,7 @@ krb4_kt_start_seq_get_int (krb5_context context,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
c->sp = krb5_storage_from_fd(c->fd);
|
c->sp = krb5_storage_from_fd(c->fd);
|
||||||
|
krb5_storage_set_eof_code(c->sp, KRB5_KT_END);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +188,7 @@ read_v4_entry (krb5_context context,
|
|||||||
krb5_free_principal (context, ed->entry.principal);
|
krb5_free_principal (context, ed->entry.principal);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = c->sp->fetch(c->sp, key, 8);
|
ret = krb5_storage_read(c->sp, key, 8);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
krb5_free_principal(context, ed->entry.principal);
|
krb5_free_principal(context, ed->entry.principal);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -274,7 +275,7 @@ krb4_store_keytab_entry(krb5_context context,
|
|||||||
ret = krb5_store_stringz(sp, instance);
|
ret = krb5_store_stringz(sp, instance);
|
||||||
ret = krb5_store_stringz(sp, realm);
|
ret = krb5_store_stringz(sp, realm);
|
||||||
ret = krb5_store_int8(sp, entry->vno);
|
ret = krb5_store_int8(sp, entry->vno);
|
||||||
ret = (*sp->store)(sp, entry->keyblock.keyvalue.data, 8);
|
ret = krb5_storage_write(sp, entry->keyblock.keyvalue.data, 8);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -301,6 +302,7 @@ krb4_kt_add_entry (krb5_context context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp = krb5_storage_from_fd(fd);
|
sp = krb5_storage_from_fd(fd);
|
||||||
|
krb5_storage_set_eof_code(sp, KRB5_KT_END);
|
||||||
if(sp == NULL) {
|
if(sp == NULL) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
Reference in New Issue
Block a user