From b654ce8c5194ffe0556c7ec7be1dd15966141f09 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Mon, 2 Feb 2009 20:29:53 -0500 Subject: [PATCH] Fixed status messages to use the new iteration type. --- src/commands.c | 26 +++++++++++++------------- src/pwmd.c | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/commands.c b/src/commands.c index 4680c20b..c64ac1b0 100644 --- a/src/commands.c +++ b/src/commands.c @@ -483,7 +483,7 @@ done: } if (!rc && client->new == FALSE && - client->crypto->fh->fh2.iter != (guint)get_key_file_integer(client->filename, "iterations")) { + client->crypto->fh->fh2.iter != (guint64)get_key_file_integer(client->filename, "iterations")) { g_key_file_set_integer(keyfileh, client->filename, "iterations", client->crypto->fh->fh2.iter); send_status_all(STATUS_CONFIG); @@ -962,7 +962,7 @@ gpg_error_t do_xml_encrypt(struct client_s *client, gpointer inbuf; gchar *p; gpg_error_t rc; - guint iter_progress = 0, n_iter = 0, xiter = 0; + guint64 iter_progress = 0, n_iter = 0, xiter = 0; gchar tmp[FILENAME_MAX]; struct stat st; mode_t mode = 0; @@ -1014,12 +1014,12 @@ gpg_error_t do_xml_encrypt(struct client_s *client, return rc; } - iter_progress = get_key_file_integer(client ? client->filename : "global", - "iteration_progress"); + iter_progress = (guint64)get_key_file_integer( + client ? client->filename : "global", "iteration_progress"); if (iter_progress && crypto->fh->fh2.iter >= iter_progress) { rc = send_status(client ? client->ctx : NULL, STATUS_ENCRYPT, - "%u %u", 0, crypto->fh->fh2.iter); + "0 %llu", crypto->fh->fh2.iter); pthread_testcancel(); if (rc) @@ -1030,7 +1030,7 @@ gpg_error_t do_xml_encrypt(struct client_s *client, if (iter_progress > 0 && xiter >= iter_progress) { if (!(xiter % iter_progress)) { rc = send_status(client ? client->ctx : NULL, STATUS_ENCRYPT, - "%u %u", ++n_iter * iter_progress, + "%llu %llu", ++n_iter * iter_progress, crypto->fh->fh2.iter); pthread_testcancel(); @@ -1073,7 +1073,7 @@ gpg_error_t do_xml_encrypt(struct client_s *client, if (iter_progress && crypto->fh->fh2.iter >= iter_progress) { rc = send_status(client ? client->ctx : NULL, STATUS_ENCRYPT, - "%u %u", crypto->fh->fh2.iter, crypto->fh->fh2.iter); + "%llu %llu", crypto->fh->fh2.iter, crypto->fh->fh2.iter); pthread_testcancel(); if (rc) @@ -3005,12 +3005,12 @@ gpg_error_t try_xml_decrypt(assuan_context_t ctx, guchar *key, { gsize insize, len; struct client_s *client = ctx ? assuan_get_pointer(ctx) : NULL; - guint iter = 0, n_iter = 0, iter_progress = 0; + guint64 iter = 0, n_iter = 0, iter_progress = 0; gint zrc = 0; gulong outsize = 0; gpg_error_t rc; gsize fh_size = crypto->fh->v1 ? sizeof(crypto->fh->fh1) : sizeof(crypto->fh->fh2); - glong fh_iter = crypto->fh->v1 ? crypto->fh->fh1.iter : crypto->fh->fh2.iter; + guint64 fh_iter = crypto->fh->v1 ? crypto->fh->fh1.iter : crypto->fh->fh2.iter; lseek(crypto->fh->fd, fh_size, SEEK_SET); insize = crypto->fh->st.st_size - fh_size; @@ -3063,11 +3063,11 @@ gpg_error_t try_xml_decrypt(assuan_context_t ctx, guchar *key, return rc; } - iter_progress = (guint)get_key_file_integer(client && client->filename ? + iter_progress = (guint64)get_key_file_integer(client && client->filename ? client->filename : "global", "iteration_progress"); if (iter_progress > 0 && fh_iter >= iter_progress) { - rc = send_status(ctx, STATUS_DECRYPT, "%u %u", 0, fh_iter); + rc = send_status(ctx, STATUS_DECRYPT, "0 %llu", fh_iter); pthread_testcancel(); if (rc) @@ -3098,7 +3098,7 @@ gpg_error_t try_xml_decrypt(assuan_context_t ctx, guchar *key, while (iter < (crypto->fh->v1 ? fh_iter : fh_iter-1)) { if (iter_progress > 0 && iter >= iter_progress) { if (!(iter % iter_progress)) { - rc = send_status(ctx, STATUS_DECRYPT, "%u %u", + rc = send_status(ctx, STATUS_DECRYPT, "%llu %llu", ++n_iter * iter_progress, fh_iter); pthread_testcancel(); @@ -3123,7 +3123,7 @@ gpg_error_t try_xml_decrypt(assuan_context_t ctx, guchar *key, } if (iter_progress && fh_iter >= iter_progress) { - rc = send_status(ctx, STATUS_DECRYPT, "%u %u", fh_iter, fh_iter); + rc = send_status(ctx, STATUS_DECRYPT, "%llu %llu", fh_iter, fh_iter); pthread_testcancel(); if (rc) diff --git a/src/pwmd.c b/src/pwmd.c index 3579b681..bf40b509 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -1311,7 +1311,7 @@ static gchar *parse_rcfile_keyfile(const gchar *filename, gboolean import, } static gboolean xml_import(const gchar *filename, const gchar *outfile, - const gchar *keyfile, gulong iter) + const gchar *keyfile, guint64 iter) { xmlDocPtr doc; gint fd; @@ -1990,7 +1990,7 @@ static gpg_error_t convert_file(const gchar *filename, const gchar *keyfile, { gpg_error_t rc; guchar md5file[16]; - guint iter; + guint64 iter; struct client_crypto_s *crypto = init_client_crypto(); if (!crypto) @@ -2185,9 +2185,9 @@ int main(int argc, char *argv[]) gboolean n; gchar *p; gchar **cache_push = NULL; - gint iter = 0; + guint64 iter = 0; gchar *import = NULL, *keyfile = NULL; - gulong cmd_iterations = -1; + guint64 cmd_iterations = -1; gint default_timeout; gboolean rcfile_spec = FALSE; gint estatus = EXIT_FAILURE; @@ -2380,7 +2380,7 @@ int main(int argc, char *argv[]) usage(argv[0]); if (cmd_iterations == -1) - cmd_iterations = get_key_file_integer("global", "iterations"); + cmd_iterations = (guint64)get_key_file_integer("global", "iterations"); opt = xml_import(import, outfile, keyfile, cmd_iterations); g_key_file_free(keyfileh); -- 2.11.4.GIT