From: Michael Adam Date: Thu, 31 Jul 2008 22:07:40 +0000 (+0200) Subject: libnet keytab: implement cleaning of old entries in libnet_keytab_add(). X-Git-Tag: samba-3.3.0pre1~295 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5f4e3ad95c26064881918f3866efa7556055a8f;p=thirdparty%2Fsamba.git 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 --- diff --git a/source/libnet/libnet_keytab.c b/source/libnet/libnet_keytab.c index 87d83fc46e7..23eedafe2b7 100644 --- a/source/libnet/libnet_keytab.c +++ b/source/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];