summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorMilan Jurik <Milan.Jurik@Sun.COM>2009-02-11 18:22:46 +0000
committerMilan Jurik <Milan.Jurik@Sun.COM>2009-02-11 18:22:46 +0000
commitd6fc3580b959bb971ca808c63cba30811e73737c (patch)
tree6428948094db7a1fac43feb65ac4af062e4f33a5 /usr/src
parentdb02be5754449d8a49e2d5a695ba0237d964b5dc (diff)
downloadillumos-joyent-d6fc3580b959bb971ca808c63cba30811e73737c.tar.gz
6742433 nss_dbddefs contains literals overflow
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/port/gen/nss_dbdefs.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr/src/lib/libc/port/gen/nss_dbdefs.c b/usr/src/lib/libc/port/gen/nss_dbdefs.c
index 9dd9193fc9..ee526c5f3c 100644
--- a/usr/src/lib/libc/port/gen/nss_dbdefs.c
+++ b/usr/src/lib/libc/port/gen/nss_dbdefs.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <mtlib.h>
#include <ctype.h>
@@ -242,12 +240,16 @@ typedef struct {
* necessitate re-testing for possible collisions.
*/
-#define DBOP_PRIME_HASH 223
+#define DBOP_PRIME_HASH 227
#define DBOP_HASH_TAG 0xf0000000
static int getXbyYdbopHASH[DBOP_PRIME_HASH] = { 0 };
static mutex_t getXbydbop_hash_lock = DEFAULTMUTEX;
static int getXbyYdbop_hashed = 0;
+/*
+ * If the size of getXbyY_to_dbop[] is changed then hash function must be
+ * corrected to be without collisions in nss_dbop_search().
+ */
static getXbyY_to_dbop_t getXbyY_to_dbop[] = {
/* NSS_MK_GETXYDBOP(ALIASES, ?, ?), */
NSS_MK_GETXYDBOPD(AUDITUSER, BYNAME, "auuser", "audituser", "n"),
@@ -300,6 +302,7 @@ nss_dbop_search(const char *name, uint32_t dbop)
uint32_t hval, g;
const char *cp;
int i, idx;
+ static const uint32_t hbits_tst = 0xf0000000;
/* Uses a table size is known to have no collisions */
if (getXbyYdbop_hashed == 0) {
@@ -310,7 +313,7 @@ nss_dbop_search(const char *name, uint32_t dbop)
hval = 0;
while (*cp) {
hval = (hval << 4) + *cp++;
- if ((g = (hval & 0xf00000000)) != 0)
+ if ((g = (hval & hbits_tst)) != 0)
hval ^= g >> 24;
hval &= ~g;
}
@@ -333,7 +336,7 @@ nss_dbop_search(const char *name, uint32_t dbop)
hval = 0;
while (*cp) {
hval = (hval << 4) + *cp++;
- if ((g = (hval & 0xf00000000)) != 0)
+ if ((g = (hval & hbits_tst)) != 0)
hval ^= g >> 24;
hval &= ~g;
}