The branch, v3-3-test has been updated via 48efe7dbce1cde6689f94fafe2d7756f673bc050 (commit) from e321377174f579ba57a70f260f4d4bc234a07439 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log ----------------------------------------------------------------- commit 48efe7dbce1cde6689f94fafe2d7756f673bc050 Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Jun 27 15:54:01 2008 +0200 net_vampire: keep keytab context and flush keytab only after the last query. Guenther ----------------------------------------------------------------------- Summary of changes: source/libnet/libnet_samsync_keytab.c | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libnet/libnet_samsync_keytab.c b/source/libnet/libnet_samsync_keytab.c index bfb3a58..f284f08 100644 --- a/source/libnet/libnet_samsync_keytab.c +++ b/source/libnet/libnet_samsync_keytab.c @@ -116,13 +116,16 @@ NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx, { NTSTATUS status = NT_STATUS_OK; krb5_error_code ret = 0; - struct libnet_keytab_context *keytab_ctx = NULL; + static struct libnet_keytab_context *keytab_ctx = NULL; int i; - ret = libnet_keytab_init(mem_ctx, ctx->output_filename, &keytab_ctx); - if (ret) { - status = krb5_to_nt_status(ret); - goto out; + if (!keytab_ctx) { + ret = libnet_keytab_init(mem_ctx, ctx->output_filename, + &keytab_ctx); + if (ret) { + status = krb5_to_nt_status(ret); + goto out; + } } status = keytab_ad_connect(mem_ctx, @@ -150,20 +153,22 @@ NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx, } } - ret = libnet_keytab_add(keytab_ctx); - if (ret) { - status = krb5_to_nt_status(ret); - ctx->error_message = talloc_asprintf(mem_ctx, - "Failed to add entries to keytab %s: %s", - keytab_ctx->keytab_name, error_message(ret)); - goto out; - } - if (last_query) { + + ret = libnet_keytab_add(keytab_ctx); + if (ret) { + status = krb5_to_nt_status(ret); + ctx->error_message = talloc_asprintf(mem_ctx, + "Failed to add entries to keytab %s: %s", + keytab_ctx->keytab_name, error_message(ret)); + goto out; + } + ctx->result_message = talloc_asprintf(mem_ctx, "Vampired %d accounts to keytab %s", keytab_ctx->count, keytab_ctx->keytab_name); + TALLOC_FREE(keytab_ctx); } -- Samba Shared Repository