We're including the new drac.c file in its entirety as well as a diff from the original drac.c.
(new) drac.c:
/* * Copyright (c) 2000 Qualcomm Incorporated. All rights reserved. * The file License.txt specifies the terms for use, modification, * and redistribution. * * Revisions: * * 06/27/00 [rcg] * - Fixed pop_log call. * - Drac host now set by -D run-time option instead * of reading file. * * 06/05/00 [rcg] * - File added. Based on patches by Mike McHenry, * Forrest Aldrich, Steven Champeon, and others. */ #include "config.h" #include "string.h" #ifdef DRAC_AUTH #include#include #include #include #include #include "popper.h" int drac_it ( POP *p ) { char *drac_host; char *delim = ","; int rslt = POP_SUCCESS; if ( p->drac_host != NULL && *p->drac_host != '\0' ) { drac_host = strtok ( p->drac_host, delim ); while ( drac_host != NULL ) { if ( drac_one ( p, drac_host ) == POP_FAILURE ) { rslt = POP_FAILURE; } drac_host = strtok ( NULL, delim ); } return rslt; } else { pop_log ( p, POP_PRIORITY, HERE, "drac not used; p->drac_host null" ); } return POP_FAILURE; } drac_one ( POP *p, char *drac_host ) { char *err = NULL; int rslt = 0; rslt = dracauth ( drac_host, inet_addr(p->ipaddr), &err ); if ( rslt != 0 ) { pop_log ( p, POP_PRIORITY, HERE, "[drac]: dracauth for %s returned %d: %s", drac_host, rslt, err ); return POP_FAILURE; } else { pop_log ( p, POP_PRIORITY, HERE, "[drac]: login by %s from host %s (%s) forwarded to %s", p->user, p->client, p->ipaddr, drac_host ); return POP_SUCCESS; } } #endif /* DRAC_AUTH */ ==================================================================================== Patchfile created using diff -uab from CygWin's GNU Diffutils 2.8.1: --- drac.c.original 2001-04-03 17:23:24.000000000 -0700 +++ drac.c.new 2003-08-11 11:36:40.000000000 -0700 @@ -16,6 +16,7 @@ */ #include "config.h" +#include "string.h" #ifdef DRAC_AUTH @@ -31,24 +32,24 @@ int drac_it ( POP *p ) { - char *err = NULL; - int rslt = 0; - + char *drac_host; + char *delim = ","; + int rslt = POP_SUCCESS; if ( p->drac_host != NULL && *p->drac_host != '\0' ) { - rslt = dracauth ( p->drac_host, inet_addr(p->ipaddr), &err ); - if ( rslt != 0 ) - pop_log ( p, POP_PRIORITY, HERE, - "[drac]: dracauth returned %d: %s", - rslt, err ); - else + + drac_host = strtok ( p->drac_host, delim ); + + while ( drac_host != NULL ) { - pop_log ( p, POP_PRIORITY, HERE, - "[drac]: login by %s from host %s (%s)", - p->user, p->client, p->ipaddr ); - return POP_SUCCESS; + if ( drac_one ( p, drac_host ) == POP_FAILURE ) + { + rslt = POP_FAILURE; + } + drac_host = strtok ( NULL, delim ); } + return rslt; } else { @@ -57,4 +58,28 @@ return POP_FAILURE; } + +drac_one ( POP *p, char *drac_host ) +{ + char *err = NULL; + int rslt = 0; + + + rslt = dracauth ( drac_host, inet_addr(p->ipaddr), &err ); + if ( rslt != 0 ) + { + pop_log ( p, POP_PRIORITY, HERE, + "[drac]: dracauth for %s returned %d: %s", + drac_host, rslt, err ); + return POP_FAILURE; + } + else + { + pop_log ( p, POP_PRIORITY, HERE, + "[drac]: login by %s from host %s (%s) forwarded to %s", + p->user, p->client, p->ipaddr, drac_host ); + return POP_SUCCESS; + } +} + #endif /* DRAC_AUTH */
We currently have this operational on a Solaris 8 box running QPopper 4.0.5 sending to multiple RedHat 9 boxes running Postfix. We've also tested the QPopper tweak on a RedHat 7.0 box. We've not noticed any issues with it so far.
Unfortunately, we're pretty much providing this code as is. I'm not much of an experienced C programmer and our free time is limited.
_Khalid & Justin (justin_donnelly at yahoo dot com)
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
