diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-07-27 16:09:25 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-07-27 22:41:42 +1000 |
commit | 56f4516399431cc508ca0c3e0dd7f179cc7ab62c (patch) | |
tree | 917157ee7f661927edd5535a5ed939d8bfe6a928 /source4/kdc/hdb-samba4.c | |
parent | b50ab318c1c66aaffd68c01b19140d0221c3e9c1 (diff) | |
download | samba-56f4516399431cc508ca0c3e0dd7f179cc7ab62c.tar.gz |
s4:kdc Push context to hdb_samba4 by way of the 'name' of the DB
This overloads the 'name' part of the keytab name to supply a context
pointer, and so avoids 3 global variables!
To do this, we had to stop putting the entry for kpasswd into the
secrets.ldb. (I don't consider this a big loss, and any entry left
there by an upgrade will be harmless).
Andrew Bartlett
Diffstat (limited to 'source4/kdc/hdb-samba4.c')
-rw-r--r-- | source4/kdc/hdb-samba4.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/kdc/hdb-samba4.c b/source4/kdc/hdb-samba4.c index f5e2f59b56f..1a0e93f7cef 100644 --- a/source4/kdc/hdb-samba4.c +++ b/source4/kdc/hdb-samba4.c @@ -1563,8 +1563,14 @@ NTSTATUS hdb_samba4_create_kdc(TALLOC_CTX *mem_ctx, static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db, const char *arg) { NTSTATUS nt_status; + void *ptr; + struct hdb_samba4_context *hdb_samba4_context; + if (sscanf(arg, "&%p", &ptr) != 1) { + return EINVAL; + } + hdb_samba4_context = talloc_get_type_abort(ptr, struct hdb_samba4_context); /* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */ - nt_status = hdb_samba4_create_kdc(hdb_samba4_mem_ctx, hdb_samba4_ev_ctx, hdb_samba4_lp_ctx, + nt_status = hdb_samba4_create_kdc(hdb_samba4_context, hdb_samba4_context->ev_ctx, hdb_samba4_context->lp_ctx, context, db); if (NT_STATUS_IS_OK(nt_status)) { @@ -1574,9 +1580,12 @@ static krb5_error_code hdb_samba4_create(krb5_context context, struct HDB **db, } /* Only used in the hdb-backed keytab code - * for a keytab of 'samba4:', to find + * for a keytab of 'samba4&<address>', to find * kpasswd's key in the main DB, and to - * copy all the keys into a file (libnet_keytab_export) */ + * copy all the keys into a file (libnet_keytab_export) + * + * The <address> is the string form of a pointer to a talloced struct hdb_samba_context + */ struct hdb_method hdb_samba4 = { .interface_version = HDB_INTERFACE_VERSION, .prefix = "samba4", |