summaryrefslogtreecommitdiff
path: root/source3/libnet/libnet_keytab.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-11-18 01:16:53 +0100
committerGünther Deschner <gd@samba.org>2008-11-18 16:03:49 +0100
commit0861a7122e5772d4a987afb3e77baa2faa99fb32 (patch)
treef58ffb3566f228538cf0b000680443c4eff8a2cc /source3/libnet/libnet_keytab.c
parent9f86dd715a3d79d17c9366293f0dccdf95cc31ba (diff)
downloadsamba-0861a7122e5772d4a987afb3e77baa2faa99fb32.tar.gz
samba-0861a7122e5772d4a987afb3e77baa2faa99fb32.tar.bz2
samba-0861a7122e5772d4a987afb3e77baa2faa99fb32.zip
s3-libnet: move add_to_keytab_entries to libnet_keytab.
Guenther
Diffstat (limited to 'source3/libnet/libnet_keytab.c')
-rw-r--r--source3/libnet/libnet_keytab.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/libnet/libnet_keytab.c b/source3/libnet/libnet_keytab.c
index 46c17b219c..990f6f6a63 100644
--- a/source3/libnet/libnet_keytab.c
+++ b/source3/libnet/libnet_keytab.c
@@ -401,4 +401,37 @@ cont:
return entry;
}
+/**
+ * Helper function to add data to the list
+ * of keytab entries. It builds the prefix from the input.
+ */
+NTSTATUS libnet_keytab_add_to_keytab_entries(TALLOC_CTX *mem_ctx,
+ struct libnet_keytab_context *ctx,
+ uint32_t kvno,
+ const char *name,
+ const char *prefix,
+ const krb5_enctype enctype,
+ DATA_BLOB blob)
+{
+ struct libnet_keytab_entry entry;
+
+ entry.kvno = kvno;
+ entry.name = talloc_strdup(mem_ctx, name);
+ entry.principal = talloc_asprintf(mem_ctx, "%s%s%s@%s",
+ prefix ? prefix : "",
+ prefix ? "/" : "",
+ name, ctx->dns_domain_name);
+ entry.enctype = enctype;
+ entry.password = blob;
+ NT_STATUS_HAVE_NO_MEMORY(entry.name);
+ NT_STATUS_HAVE_NO_MEMORY(entry.principal);
+ NT_STATUS_HAVE_NO_MEMORY(entry.password.data);
+
+ ADD_TO_ARRAY(mem_ctx, struct libnet_keytab_entry, entry,
+ &ctx->entries, &ctx->count);
+ NT_STATUS_HAVE_NO_MEMORY(ctx->entries);
+
+ return NT_STATUS_OK;
+}
+
#endif /* HAVE_KRB5 */