From fe97a63dcd53bedf7b06435f32630f419da1be79 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu, 2 Jul 2009 08:49:52 -0700
Subject: [PATCH] Bug: 509401 - dnaNextValue not updated when dnaMaxValue set to -1
When "dnaMaxValue" is set to "-1" or omitted from a range
configuration entry
(which defautls to "-1" internally), the "dnaNextValue" attribute is
not
updated in the range configuration entry when a value is allocated from that
range.
We were only updating the configuration entry if the new nextvalue was >=
the maxval plus the interval (1). We need to check if the maxval is -1
specifically, and update the config entry if so.
---
ldap/servers/plugins/dna/dna.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index dfd0619..0f509c0 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -1972,7 +1972,8 @@ static int dna_get_next_value(struct configEntry *config_entry,
nextval = setval + config_entry->interval;
/* update nextval if we have not reached the end
* of our current range */
- if (nextval <= (config_entry->maxval + config_entry->interval)) {
+ if ((config_entry->maxval == -1) ||
+ (nextval <= (config_entry->maxval + config_entry->interval))) {
/* try to set the new next value in the config entry */
PR_snprintf(next_value, sizeof(next_value),"%" NSPRIu64, nextval);
--
1.6.0.6