summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-01-12 18:16:45 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-27 11:51:27 +1100
commit89eaef025376339ef25d07cdc4748920fceaa968 (patch)
treef514f4632c9d54a372a7f1f0ca845a0c3a488fbf /source4/heimdal/lib/hdb
parentfac8ca52ade6e490eea3cf3d0fc98287da321c13 (diff)
downloadsamba-89eaef025376339ef25d07cdc4748920fceaa968.tar.gz
samba-89eaef025376339ef25d07cdc4748920fceaa968.tar.bz2
samba-89eaef025376339ef25d07cdc4748920fceaa968.zip
s4:heimdal: import lorikeet-heimdal-201001120029 (commit a5e675fed7c5db8a7370b77ed0bfa724196aa84d)
Diffstat (limited to 'source4/heimdal/lib/hdb')
-rw-r--r--source4/heimdal/lib/hdb/ext.c20
-rw-r--r--source4/heimdal/lib/hdb/hdb.c27
-rw-r--r--source4/heimdal/lib/hdb/hdb.h7
-rw-r--r--source4/heimdal/lib/hdb/mkey.c2
4 files changed, 44 insertions, 12 deletions
diff --git a/source4/heimdal/lib/hdb/ext.c b/source4/heimdal/lib/hdb/ext.c
index a8a882c6b2..faf0b6bdf2 100644
--- a/source4/heimdal/lib/hdb/ext.c
+++ b/source4/heimdal/lib/hdb/ext.c
@@ -281,6 +281,7 @@ hdb_entry_get_password(krb5_context context, HDB *db,
const hdb_entry *entry, char **p)
{
HDB_extension *ext;
+ char *str;
int ret;
ext = hdb_find_extension(entry, choice_HDB_extension_data_password);
@@ -329,17 +330,14 @@ hdb_entry_get_password(krb5_context context, HDB *db,
return 0;
}
- {
- char *name;
- ret = krb5_unparse_name(context, entry->principal, &name);
- if (ret == 0) {
- krb5_set_error_message(context, ENOENT, "no password attributefor %s", name);
- free(name);
- } else
- krb5_clear_error_message(context);
-
- return ENOENT;
- }
+ ret = krb5_unparse_name(context, entry->principal, &str);
+ if (ret == 0) {
+ krb5_set_error_message(context, ENOENT, "no password attributefor %s", str);
+ free(str);
+ } else
+ krb5_clear_error_message(context);
+
+ return ENOENT;
}
int
diff --git a/source4/heimdal/lib/hdb/hdb.c b/source4/heimdal/lib/hdb/hdb.c
index fa70c7778d..97de918933 100644
--- a/source4/heimdal/lib/hdb/hdb.c
+++ b/source4/heimdal/lib/hdb/hdb.c
@@ -3,6 +3,8 @@
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
+ * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -65,9 +67,13 @@ static struct hdb_method methods[] = {
#if HAVE_DB1 || HAVE_DB3
{ HDB_INTERFACE_VERSION, "db:", hdb_db_create},
#endif
+#if HAVE_DB1
+ { HDB_INTERFACE_VERSION, "mit-db:", hdb_mdb_create},
+#endif
#if HAVE_NDBM
{ HDB_INTERFACE_VERSION, "ndbm:", hdb_ndbm_create},
#endif
+ { HDB_INTERFACE_VERSION, "keytab:", hdb_keytab_create},
#if defined(OPENLDAP) && !defined(OPENLDAP_MODULE)
{ HDB_INTERFACE_VERSION, "ldap:", hdb_ldap_create},
{ HDB_INTERFACE_VERSION, "ldapi:", hdb_ldapi_create},
@@ -411,6 +417,27 @@ hdb_list_builtin(krb5_context context, char **list)
return 0;
}
+krb5_error_code
+_hdb_keytab2hdb_entry(krb5_context context,
+ const krb5_keytab_entry *ktentry,
+ hdb_entry_ex *entry)
+{
+ entry->entry.kvno = ktentry->vno;
+ entry->entry.created_by.time = ktentry->timestamp;
+
+ entry->entry.keys.val = calloc(1, sizeof(entry->entry.keys.val[0]));
+ if (entry->entry.keys.val == NULL)
+ return ENOMEM;
+ entry->entry.keys.len = 1;
+
+ entry->entry.keys.val[0].mkvno = NULL;
+ entry->entry.keys.val[0].salt = NULL;
+
+ return krb5_copy_keyblock_contents(context,
+ &ktentry->keyblock,
+ &entry->entry.keys.val[0].key);
+}
+
/**
* Create a handle for a Kerberos database
*
diff --git a/source4/heimdal/lib/hdb/hdb.h b/source4/heimdal/lib/hdb/hdb.h
index f34c9fb36e..91b6753722 100644
--- a/source4/heimdal/lib/hdb/hdb.h
+++ b/source4/heimdal/lib/hdb/hdb.h
@@ -194,6 +194,13 @@ typedef struct HDB{
*/
krb5_error_code (*hdb_destroy)(krb5_context, struct HDB*);
/**
+ * Get the list of realms this backend handles.
+ * This call is optional to support. The returned realms are used
+ * for announcing the realms over bonjour. Free returned array
+ * with krb5_free_host_realm().
+ */
+ krb5_error_code (*hdb_get_realms)(krb5_context, struct HDB *, krb5_realm **);
+ /**
* Change password.
*
* Will update keys for the entry when given password. The new
diff --git a/source4/heimdal/lib/hdb/mkey.c b/source4/heimdal/lib/hdb/mkey.c
index 35323cf100..360bb33a3a 100644
--- a/source4/heimdal/lib/hdb/mkey.c
+++ b/source4/heimdal/lib/hdb/mkey.c
@@ -185,7 +185,7 @@ read_master_mit(krb5_context context, const char *filename,
if(ret)
goto out;
}
- ret = hdb_process_master_key(context, 0, &key, 0, mkey);
+ ret = hdb_process_master_key(context, 1, &key, 0, mkey);
krb5_free_keyblock_contents(context, &key);
out:
krb5_storage_free(sp);