summaryrefslogtreecommitdiffstats
path: root/util/ipa_pwd.c
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-04-09 23:42:41 -0400
committerMartin Kosek <mkosek@redhat.com>2012-04-10 18:33:04 +0200
commit35f44a1aebe0350884113c0ce57c2aeb736c714b (patch)
tree6fbb80b66fb84be86e051a58a67dee12f1720f2b /util/ipa_pwd.c
parent2e3f5f25c429e7fef95505c0a77167951daea95d (diff)
downloadfreeipa-35f44a1aebe0350884113c0ce57c2aeb736c714b.tar.gz
freeipa-35f44a1aebe0350884113c0ce57c2aeb736c714b.tar.xz
freeipa-35f44a1aebe0350884113c0ce57c2aeb736c714b.zip
Dereference pointer when comparing password history in qsort compare.
The man page for qsort(3) says that the comparison function is called with pointers to pointers to char but memcmp(3) wants a pointer to void so we need to cast and dereference. Without this the qsort() call wasn't properly sorting the elements so a random password was being removed rather than the oldest when the list overflowed. https://fedorahosted.org/freeipa/ticket/2613
Diffstat (limited to 'util/ipa_pwd.c')
-rw-r--r--util/ipa_pwd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/ipa_pwd.c b/util/ipa_pwd.c
index b6ed929b3..92fb3b029 100644
--- a/util/ipa_pwd.c
+++ b/util/ipa_pwd.c
@@ -152,7 +152,7 @@ static int ipapwd_gentime_cmp(const void *p1, const void *p2)
* a higher letter or number */
/* return youngest first by inverting terms */
- return memcmp(p2, p1, GENERALIZED_TIME_LENGTH);
+ return memcmp(*(void * const *)p2, *(void * const *)p1, GENERALIZED_TIME_LENGTH);
}
#define SHA_SALT_LENGTH 8