diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-11-29 11:24:08 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-12-01 17:00:47 +1100 |
commit | c5bea98ddb2f7967df572160f639da3cba381a87 (patch) | |
tree | e5ca502195932ea7674f03a732fc26dd5427553d /source4/heimdal/lib/hdb | |
parent | 9c84f987acb5ffc97a612839e13e8b8042e6120e (diff) | |
download | samba-c5bea98ddb2f7967df572160f639da3cba381a87.tar.gz samba-c5bea98ddb2f7967df572160f639da3cba381a87.tar.bz2 samba-c5bea98ddb2f7967df572160f639da3cba381a87.zip |
s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759b9df1a5e935c)
Diffstat (limited to 'source4/heimdal/lib/hdb')
-rw-r--r-- | source4/heimdal/lib/hdb/db.c | 2 | ||||
-rw-r--r-- | source4/heimdal/lib/hdb/hdb-keytab.c | 10 | ||||
-rw-r--r-- | source4/heimdal/lib/hdb/hdb.c | 2 | ||||
-rw-r--r-- | source4/heimdal/lib/hdb/hdb.h | 22 | ||||
-rw-r--r-- | source4/heimdal/lib/hdb/keytab.c | 15 | ||||
-rw-r--r-- | source4/heimdal/lib/hdb/ndbm.c | 2 |
6 files changed, 18 insertions, 35 deletions
diff --git a/source4/heimdal/lib/hdb/db.c b/source4/heimdal/lib/hdb/db.c index 9de0a04a1f..69940edf89 100644 --- a/source4/heimdal/lib/hdb/db.c +++ b/source4/heimdal/lib/hdb/db.c @@ -318,7 +318,7 @@ hdb_db_create(krb5_context context, HDB **db, (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL; (*db)->hdb_open = DB_open; (*db)->hdb_close = DB_close; - (*db)->hdb_fetch = _hdb_fetch; + (*db)->hdb_fetch_kvno = _hdb_fetch_kvno; (*db)->hdb_store = _hdb_store; (*db)->hdb_remove = _hdb_remove; (*db)->hdb_firstkey = DB_firstkey; diff --git a/source4/heimdal/lib/hdb/hdb-keytab.c b/source4/heimdal/lib/hdb/hdb-keytab.c index 393981e47d..c1bad86796 100644 --- a/source4/heimdal/lib/hdb/hdb-keytab.c +++ b/source4/heimdal/lib/hdb/hdb-keytab.c @@ -118,7 +118,7 @@ hkt_open(krb5_context context, HDB * db, int flags, mode_t mode) static krb5_error_code hkt_fetch_kvno(krb5_context context, HDB * db, krb5_const_principal principal, - unsigned flags, unsigned kvno, hdb_entry_ex * entry) + unsigned flags, krb5_kvno kvno, hdb_entry_ex * entry) { hdb_keytab k = (hdb_keytab)db->hdb_db; krb5_error_code ret; @@ -171,13 +171,6 @@ hkt_fetch_kvno(krb5_context context, HDB * db, krb5_const_principal principal, } static krb5_error_code -hkt_fetch(krb5_context context, HDB * db, krb5_const_principal principal, - unsigned flags, hdb_entry_ex * entry) -{ - return hkt_fetch_kvno(context, db, principal, flags & ~HDB_F_KVNO_SPECIFIED, 0, entry); -} - -static krb5_error_code hkt_store(krb5_context context, HDB * db, unsigned flags, hdb_entry_ex * entry) { @@ -221,7 +214,6 @@ hdb_keytab_create(krb5_context context, HDB ** db, const char *arg) (*db)->hdb_openp = 0; (*db)->hdb_open = hkt_open; (*db)->hdb_close = hkt_close; - (*db)->hdb_fetch = hkt_fetch; (*db)->hdb_fetch_kvno = hkt_fetch_kvno; (*db)->hdb_store = hkt_store; (*db)->hdb_remove = NULL; diff --git a/source4/heimdal/lib/hdb/hdb.c b/source4/heimdal/lib/hdb/hdb.c index 97de918933..2c1de8b3d7 100644 --- a/source4/heimdal/lib/hdb/hdb.c +++ b/source4/heimdal/lib/hdb/hdb.c @@ -318,7 +318,7 @@ find_dynamic_method (krb5_context context, if (asprintf(&symbol, "hdb_%s_interface", prefix) == -1) krb5_errx(context, 1, "out of memory"); - mso = dlsym(dl, symbol); + mso = (struct hdb_so_method *) dlsym(dl, symbol); if (mso == NULL) { krb5_warnx(context, "error finding symbol %s in %s: %s\n", symbol, path, dlerror()); diff --git a/source4/heimdal/lib/hdb/hdb.h b/source4/heimdal/lib/hdb/hdb.h index bcd190caa3..1b0468a481 100644 --- a/source4/heimdal/lib/hdb/hdb.h +++ b/source4/heimdal/lib/hdb/hdb.h @@ -71,6 +71,13 @@ enum hdb_lockop{ HDB_RLOCK, HDB_WLOCK }; typedef struct hdb_master_key_data *hdb_master_key; +/** + * hdb_entry_ex is a wrapper structure around the hdb_entry structure + * that allows backends to keep a pointer to the backing store, ie in + * ->hdb_fetch_kvno(), so that we the kadmin/kpasswd backend gets around to + * ->hdb_store(), the backend doesn't need to lookup the entry again. + */ + typedef struct hdb_entry_ex { void *ctx; hdb_entry entry; @@ -121,19 +128,10 @@ typedef struct HDB{ * * Fetch an entry from the backend, flags are what type of entry * should be fetch: client, server, krbtgt. - */ - krb5_error_code (*hdb_fetch)(krb5_context, struct HDB*, - krb5_const_principal, unsigned, - hdb_entry_ex*); - /** - * Fetch an entry from the backend - * - * Fetch an entry from the backend, flags are what type of entry - * should be fetch: client, server, krbtgt. * knvo (if specified and flags HDB_F_KVNO_SPECIFIED set) is the kvno to get */ krb5_error_code (*hdb_fetch_kvno)(krb5_context, struct HDB*, - krb5_const_principal, unsigned, unsigned, + krb5_const_principal, unsigned, krb5_kvno, hdb_entry_ex*); /** * Store an entry to database @@ -222,7 +220,7 @@ typedef struct HDB{ * all other operations, increasing the kvno, and update * modification timestamp. * - * The backen need to call _kadm5_set_keys() and perform password + * The backend needs to call _kadm5_set_keys() and perform password * quality checks. */ krb5_error_code (*hdb_password)(krb5_context, struct HDB*, hdb_entry_ex*, const char *, int); @@ -238,7 +236,7 @@ typedef struct HDB{ */ krb5_error_code (*hdb_auth_status)(krb5_context, struct HDB *, hdb_entry_ex *, int); /** - * Check is delegation is allowed. + * Check if delegation is allowed. */ krb5_error_code (*hdb_check_constrained_delegation)(krb5_context, struct HDB *, hdb_entry_ex *, krb5_const_principal); diff --git a/source4/heimdal/lib/hdb/keytab.c b/source4/heimdal/lib/hdb/keytab.c index b8cc0d47ee..05b78dafc5 100644 --- a/source4/heimdal/lib/hdb/keytab.c +++ b/source4/heimdal/lib/hdb/keytab.c @@ -211,17 +211,10 @@ hdb_get_entry(krb5_context context, goto out2; } - if (*db->hdb_fetch_kvno) { - ret = (*db->hdb_fetch_kvno)(context, db, principal, - HDB_F_DECRYPT|HDB_F_KVNO_SPECIFIED| - HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT, - kvno, &ent); - } else { - ret = (*db->hdb_fetch)(context, db, principal, - HDB_F_DECRYPT| - HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT, - &ent); - } + ret = (*db->hdb_fetch_kvno)(context, db, principal, + HDB_F_DECRYPT|HDB_F_KVNO_SPECIFIED| + HDB_F_GET_CLIENT|HDB_F_GET_SERVER|HDB_F_GET_KRBTGT, + kvno, &ent); if(ret == HDB_ERR_NOENTRY) { ret = KRB5_KT_NOTFOUND; diff --git a/source4/heimdal/lib/hdb/ndbm.c b/source4/heimdal/lib/hdb/ndbm.c index 2a57d2ac27..5b2c07e5f6 100644 --- a/source4/heimdal/lib/hdb/ndbm.c +++ b/source4/heimdal/lib/hdb/ndbm.c @@ -370,7 +370,7 @@ hdb_ndbm_create(krb5_context context, HDB **db, (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL; (*db)->hdb_open = NDBM_open; (*db)->hdb_close = NDBM_close; - (*db)->hdb_fetch = _hdb_fetch; + (*db)->hdb_fetch_kvno = _hdb_fetch_kvno; (*db)->hdb_store = _hdb_store; (*db)->hdb_remove = _hdb_remove; (*db)->hdb_firstkey = NDBM_firstkey; |