summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-08-01 00:07:40 +0200
committerMichael Adam <obnox@samba.org>2008-08-01 16:07:59 +0200
commit52fee9c87ac26fe2bcf4b4795b2c380cf7543c0f (patch)
tree7a003f249fd8c426a3835909735808e315876f73 /source3/libnet
parent8876d793110262625adefe91efdd835119979e5e (diff)
downloadsamba-52fee9c87ac26fe2bcf4b4795b2c380cf7543c0f.tar.gz
samba-52fee9c87ac26fe2bcf4b4795b2c380cf7543c0f.tar.bz2
samba-52fee9c87ac26fe2bcf4b4795b2c380cf7543c0f.zip
libnet keytab: implement cleaning of old entries in libnet_keytab_add().
Triggered by the flag clean_old_entries from the libnet_keytab_contex (unused yet...). Michael (This used to be commit a5f4e3ad95c26064881918f3866efa7556055a8f)
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_keytab.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/libnet/libnet_keytab.c b/source3/libnet/libnet_keytab.c
index 87d83fc46e..23eedafe2b 100644
--- a/source3/libnet/libnet_keytab.c
+++ b/source3/libnet/libnet_keytab.c
@@ -265,6 +265,28 @@ krb5_error_code libnet_keytab_add(struct libnet_keytab_context *ctx)
krb5_error_code ret = 0;
uint32_t i;
+
+ if (ctx->clean_old_entries) {
+ DEBUG(0, ("cleaning old entries...\n"));
+ for (i=0; i < ctx->count; i++) {
+ struct libnet_keytab_entry *entry = &ctx->entries[i];
+
+ ret = libnet_keytab_remove_entries(ctx->context,
+ ctx->keytab,
+ entry->principal,
+ 0,
+ entry->enctype,
+ true);
+ if (ret) {
+ DEBUG(1,("libnet_keytab_add: Failed to remove "
+ "old entries for %s (enctype %u): %s\n",
+ entry->principal, entry->enctype,
+ error_message(ret)));
+ return ret;
+ }
+ }
+ }
+
for (i=0; i<ctx->count; i++) {
struct libnet_keytab_entry *entry = &ctx->entries[i];