Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21242
Modified Files:
dblayer.c cache.c
Log Message:
Resolves: #178248
Summary: db backend entry cache settings field "Memory available for cache"
boundaries
Fix Description:
db_strtoul: check the input string. If the string starts with '-', returning
the error ERANGE -- the same error as the larger the upper limit is passed.
cache.c: the minimum entry cache size defined in cache.c was 200000, which is
different from the info on the Configuration Command File Reference Guide:
Valid Range: 500 kilobytes to 4 gigabytes for 32-bit platforms and 500
kilobytes to 2^64-1 for 64-bit platforms
Adjusting the define to the doc.
Index: dblayer.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/dblayer.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- dblayer.c 20 Nov 2008 17:30:58 -0000 1.34
+++ dblayer.c 12 Dec 2008 21:09:31 -0000 1.35
@@ -3875,10 +3875,20 @@
unsigned long db_strtoul(const char *str, int *err)
{
- unsigned long val, result, multiplier = 1;
+ unsigned long val = 0, result, multiplier = 1;
char *p;
errno = 0;
+ /*
+ * manpage of strtoul: Negative values are considered valid input and
+ * are silently converted to the equivalent unsigned long int value.
+ */
+ /* We don't want to make it happen. */
+ for (p = str; p && *p && (*p == ' ' || *p == '\t');
p++) ;
+ if ('-' == *p) {
+ if (err) *err = ERANGE;
+ return val;
+ }
val = strtoul(str, &p, 10);
if (errno != 0) {
if (err) *err = errno;
Index: cache.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/cache.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cache.c 11 Nov 2008 21:31:41 -0000 1.8
+++ cache.c 12 Dec 2008 21:09:31 -0000 1.9
@@ -50,7 +50,7 @@
#endif
/* cache can't get any smaller than this (in bytes) */
-#define MINCACHESIZE (size_t)200000
+#define MINCACHESIZE (size_t)512000
/* don't let hash be smaller than this # of slots */
#define MINHASHSIZE 1024
Show replies by date