Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Thread

PATCH: DRAC + db 4.2.52

PATCH: DRAC + db 4.2.52

2007-01-16 by Carl Swart

Hi All,

Here is a patch I made to get milter-greylist version 3.0.0, the
current stable version, to compile milter-greylist with DRAC enabled
using Berkeley DB (now Oracle Berkeley DB) version 4.2.52.

I am of the opinion that the patch should work for all DB versions
with a major version number >= 4 and a minor version number >= 1.

Without the patch, the DRAC code will only compile for DB versions < 2.

You will need to add '-ldb' to the Makefile to be able to compile
milter-greylist once the patch have been applied.

I hope that the patch can be incorporated into milter-greylist's
future versions.

It is really nice to have greylisting bypassed if the user is in the
DRAC db. It makes lots of our users very happy to have the best of
both worlds.

[root@wist milter-greylist-3.0]# diff -ruN milter-greylist.c.old
milter-greylist.c
--- milter-greylist.c.old       2007-01-16 20:26:40.000000000 +0200
+++ milter-greylist.c   2007-01-16 20:05:59.000000000 +0200
@@ -1342,16 +1342,20 @@
        char ipkey[16];
        int rc;

-       ddb = dbopen(conf.c_dracdb, O_RDONLY | O_SHLOCK, 0666, DB_BTREE, NULL);
-       if (ddb == NULL) {
-               mg_log(LOG_DEBUG, "dbopen \"%s\" failed", conf.c_dracdb);
+       errno = db_create(&ddb, NULL, 0);
+       if (errno != 0) {
+               mg_log(LOG_DEBUG, "db_create \"%s\" failed", conf.c_dracdb);
                return 0;
        }

+       ddb->set_pagesize(ddb, 512);
+       errno = ddb->open(ddb, NULL, conf.c_dracdb, NULL, DB_BTREE,
DB_RDONLY, 0644);
+       memset(&key, 0, sizeof(key));
+       memset(&data, 0, sizeof(data));
        key.data = strncpy(ipkey, dotted_ip, sizeof(ipkey));
        key.size = strlen(ipkey);
-       rc = ddb->get(ddb, &key, &data, 0);
-       ddb->close(ddb);
+       rc = ddb->get(ddb, NULL, &key, &data, 0);
+       (void)ddb->close(ddb, 0);

        switch (rc) {
        case 0:
@@ -1364,12 +1368,12 @@
                return 1;
                break;

-       case 1:
+       case DB_NOTFOUND:
                return 0;
                break;

        default:
-               mg_log(LOG_ERR, "check_drack: errno=%d", errno);
+               mg_log(LOG_ERR, "check_drac: errno=%d", errno);
                break;
        }

I hope that this helps someone.

--
Regards,
-Carl

Re: [milter-greylist] PATCH: DRAC + db 4.2.52

2007-01-17 by Emmanuel Dreyfus

On Wed, Jan 17, 2007 at 01:30:56AM +0200, Carl Swart wrote:
> You will need to add '-ldb' to the Makefile to be able to compile
> milter-greylist once the patch have been applied.
> I hope that the patch can be incorporated into milter-greylist's
> future versions.

There are missing bits to your contribution:

1) configure  machinery  should etect the newer db, or at least have a 
--with flag to toggle it on. It should update Makefile correctly

2) Please send patches against HEAD of CVS. Once your modification
will have been tested in developement snapshots, we can think about
backporting them to a stable release.

-- 
Emmanuel Dreyfus
manu@...

RE:[milter-greylist] PATCH: DRAC + db 4.2.52

2007-01-23 by hein273

Hi Carl,
just to give you a feedback: your DRAC patch for milter-greylist works 
fine for me. I'm using it with milter-greylist-3.0rc7 and 
BerkeleyDB.4.5. I've tried it before 'out of the box' but it didn't 
work. Now it does. Fine.

Regards Mario

Re: [milter-greylist] PATCH: DRAC + db 4.2.52

2007-01-23 by Carl Swart

Hi Mario, Thank you for the feedback. I have submitted a newer version of the patch against the development version of milter-greylist, to make DRAC work with

Re: [milter-greylist] PATCH: DRAC + db 4.2.52

2007-01-23 by Emmanuel Dreyfus

On Tue, Jan 23, 2007 at 04:53:07PM +0200, Carl Swart wrote:
> I have submitted a newer version of the patch against the development
> version of milter-greylist, to make DRAC work with Oracle Berkeley DB
> (formerly Berkeley DB) versions 1, 2, 3 and 4. I hope that it will be
> included in future releases so the DRAC supports work out-of-the-box for
> everyone that uses it.

I'm affraid I missed it. Where is it?

-- 
Emmanuel Dreyfus
manu@...

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.