(NDBM_open): add test for database format
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5395 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -240,6 +240,7 @@ NDBM__del(krb5_context context, HDB *db, krb5_data key)
|
|||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
NDBM_open(krb5_context context, HDB *db, int flags, mode_t mode)
|
NDBM_open(krb5_context context, HDB *db, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
|
krb5_error_code ret;
|
||||||
struct ndbm_db *d = malloc(sizeof(*d));
|
struct ndbm_db *d = malloc(sizeof(*d));
|
||||||
char *lock_file;
|
char *lock_file;
|
||||||
if(d == NULL)
|
if(d == NULL)
|
||||||
@@ -263,7 +264,13 @@ NDBM_open(krb5_context context, HDB *db, int flags, mode_t mode)
|
|||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
db->db = d;
|
db->db = d;
|
||||||
|
if((flags & O_ACCMODE) == O_RDONLY)
|
||||||
|
ret = hdb_check_db_format(context, db);
|
||||||
|
else
|
||||||
|
ret = hdb_init_db(context, db);
|
||||||
|
if(ret == HDB_ERR_NOENTRY)
|
||||||
return 0;
|
return 0;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static krb5_error_code
|
static krb5_error_code
|
||||||
|
Reference in New Issue
Block a user