dovecot-2.1: doveadm pw: Minor code cleanups.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 9 05:27:37 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/12579e53f575
changeset: 14099:12579e53f575
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 09 05:27:32 2012 +0200
description:
doveadm pw: Minor code cleanups.
diffstat:
src/doveadm/doveadm-pw.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (63 lines):
diff -r 75d6cd91fabe -r 12579e53f575 src/doveadm/doveadm-pw.c
--- a/src/doveadm/doveadm-pw.c Thu Feb 09 05:25:17 2012 +0200
+++ b/src/doveadm/doveadm-pw.c Thu Feb 09 05:27:32 2012 +0200
@@ -21,16 +21,17 @@
const char *user = NULL;
const char *scheme = NULL;
const char *plaintext = NULL;
- int ch, lflag = 0, Vflag = 0;
+ bool list_schemes = FALSE, reverse_verify = FALSE;
unsigned int rounds = 0;
+ int c;
random_init();
password_schemes_init();
- while ((ch = getopt(argc, argv, "lp:r:s:u:V")) != -1) {
- switch (ch) {
+ while ((c = getopt(argc, argv, "lp:r:s:u:V")) > 0) {
+ switch (c) {
case 'l':
- lflag = 1;
+ list_schemes = 1;
break;
case 'p':
plaintext = optarg;
@@ -46,7 +47,7 @@
user = optarg;
break;
case 'V':
- Vflag = 1;
+ reverse_verify = TRUE;
break;
case '?':
default:
@@ -54,7 +55,7 @@
}
}
- if (lflag) {
+ if (list_schemes) {
const struct password_scheme *const *schemes;
unsigned int i, count;
@@ -90,7 +91,7 @@
fprintf(stderr, "Unknown scheme: %s\n", scheme);
exit(1);
}
- if (Vflag == 1) {
+ if (reverse_verify) {
const unsigned char *raw_password;
size_t size;
const char *error;
@@ -110,8 +111,9 @@
}
printf("{%s}%s (verified)\n", scheme, hash);
- } else
+ } else {
printf("{%s}%s\n", scheme, hash);
+ }
password_schemes_deinit();
random_deinit();
More information about the dovecot-cvs
mailing list