From 52fee9c87ac26fe2bcf4b4795b2c380cf7543c0f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 00:07:40 +0200 Subject: 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) --- source3/libnet/libnet_keytab.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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; icount; i++) { struct libnet_keytab_entry *entry = &ctx->entries[i]; -- cgit