diff -r -u ../pwd_mkdb/pwd_mkdb.c ./pwd_mkdb.c --- ../pwd_mkdb/pwd_mkdb.c Fri Jul 12 01:16:52 2002 +++ ./pwd_mkdb.c Sat Apr 19 07:31:52 2003 @@ -66,14 +66,17 @@ #define SECURE 2 #define PERM_INSECURE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) #define PERM_SECURE (S_IRUSR|S_IWUSR) +#define MINCACHE 2 +#define MAXCACHE 16 +#define CACHESZ_ENV "PWDB_CACHE" HASHINFO openinfo = { - 4096, /* bsize */ - 32, /* ffactor */ - 256, /* nelem */ - 2048 * 1024, /* cachesize */ - NULL, /* hash() */ - 0 /* lorder */ + 4096, /* bsize */ + 32, /* ffactor */ + 256, /* nelem */ + MINCACHE * 1024 * 1024, /* cachesize */ + NULL, /* hash() */ + 0 /* lorder */ }; static enum state { FILE_INSECURE, FILE_SECURE, FILE_ORIG } clean; @@ -101,6 +104,8 @@ int ch, cnt, ypcnt, makeold, tfd, yp_enabled = 0; unsigned int len; int32_t pw_change, pw_expire; + int cache; + char *penv; const char *t; char *p; char buf[MAX(MAXPATHLEN, LINE_MAX * 2)], tbuf[1024]; @@ -116,6 +121,17 @@ strcpy(prefix, _PATH_PWD); makeold = 0; username = NULL; + + penv = getenv(CACHESZ_ENV); + if (penv != NULL) { + cache = atoi(penv); + if (cache < MINCACHE) + cache = MINCACHE; + if (cache > MAXCACHE) + cache = MAXCACHE; + openinfo.cachesize = cache * 1024 * 1024; + } + while ((ch = getopt(argc, argv, "Cd:ps:u:vN")) != -1) switch(ch) { case 'C': /* verify only */