pkgsrc/mail/ezmlm/files/patch-althash
schmonz 0d4c642ecb With the "althash" option, enable Iain Truskett's 2002-10-16 patch
to hash the on-disk subscriber database using an algorithm compatible
with case-insensitive filesystems. Enabled by default on Darwin.

Bump PKGREVISION.
2004-12-21 04:22:03 +00:00

78 lines
2 KiB
Text

Attached below are diffs. They convert the hashing to do:
'@'..'Z'
It's not that great as a hashing algorithm since you end up with a
non-prime number that's reasonably close to a power of 2 for your number
of buckets, but hey.
It's possible one other place (in constmap) needs to be changed. DJB's
code scares me in its lack of constants and lack of subroutines to
factor away similar bits of code.
Test it and see if it works.
cheers,
--
Iain.
--- ezmlm-list.c.orig 1997-06-29 23:11:54.000000000 -0400
+++ ezmlm-list.c
@@ -36,7 +36,7 @@ char **argv;
if (chdir(dir) == -1)
strerr_die4sys(111,FATAL,"unable to switch to ",dir,": ");
- for (fn[12] = 64;fn[12] < 64 + 53;++fn[12]) {
+ for (fn[12] = 64;fn[12] < 64 + 27;++fn[12]) {
fd = open_read(fn);
if (fd == -1) {
if (errno != error_noent)
--- ezmlm-send.c.orig 1997-06-29 23:11:54.000000000 -0400
+++ ezmlm-send.c
@@ -288,7 +288,7 @@ char **argv;
qmail_from(&qq,line.s);
- for (i = 0;i < 53;++i) {
+ for (i = 0;i < 27;++i) {
ch = 64 + i;
if (!stralloc_copys(&fnsub,"subscribers/")) die_nomem();
if (!stralloc_catb(&fnsub,&ch,1)) strerr_die2x(111,FATAL,"out of memory");
--- ezmlm.5.orig 1997-06-29 23:11:54.000000000 -0400
+++ ezmlm.5
@@ -30,10 +30,10 @@ allows automatic subscription if
.I dir\fB/public
exists.
-The list is hashed into 53 files, named
+The list is hashed into 27 files, named
.B @
through
-.B t
+.B Z
in ASCII.
A nonexistent file is treated as an empty file.
--- issub.c.orig 1997-06-29 23:11:54.000000000 -0400
+++ issub.c
@@ -35,7 +35,7 @@ char *userhost;
h = 5381;
for (j = 0;j < addr.len;++j)
h = (h + (h << 5)) ^ (uint32) (unsigned char) addr.s[j];
- ch = 64 + (h % 53);
+ ch = 64 + (h % 27);
if (!stralloc_0(&addr)) return -2;
--- subscribe.c.orig 1997-06-29 23:11:54.000000000 -0400
+++ subscribe.c
@@ -45,7 +45,7 @@ int flagadd;
h = 5381;
for (j = 0;j < addr.len;++j)
h = (h + (h << 5)) ^ (uint32) (unsigned char) addr.s[j];
- ch = 64 + (h % 53);
+ ch = 64 + (h % 27);
if (!stralloc_0(&addr)) return -2;