- Removed all debugging code. Now that Petidomo will be "rewritten"

in C++, I need a new paradigm for debugging anyway and the old
   solution of mine was to messy for my taste anyway.

 - Petidomo no longer cares under what name it has been started. The
   different modes of operation will now be distinguished by a
   mandatory command line parameter.
This commit is contained in:
Peter Simons 2000-12-15 15:48:00 +00:00
parent 5d6c97d465
commit 0cb339abd8
21 changed files with 60 additions and 444 deletions

View File

@ -2,6 +2,20 @@
# Petidomo Makefile
#
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
CC = @CC@
CXX = @CXX@
AR = ar
@ -14,13 +28,12 @@ CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
LDFLAGS = @LDFLAGS@
OBJS = acl.o archive.o argvSetDebugLevel.o authen.o config.o exit.o \
OBJS = acl.o archive.o authen.o config.o exit.o \
filter.o handleacl.o help.o hermes.o index.o io.o listserv.o \
mailer.o members.o parsearray.o password.o rfcparse.o \
subscribe.o tool.o signature.o unsubscribe.o main.o
LIBS = librfc822/librfc822.a liblists/liblists.a libargv/libargv.a \
libconfigfile/libconfigfile.a libtext/libtext.a \
libdebug/libdebug.a
libconfigfile/libconfigfile.a libtext/libtext.a
FLAGS_TO_PASS = CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" LEX="$(LEX)" \
YACC="$(YACC)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
@ -35,15 +48,9 @@ FLAGS_TO_PASS = CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" LEX="$(LEX
.cpp.o:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
all: hermes listserv
petidomo: $(OBJS) $(LIBS)
$(CC) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
hermes listserv: petidomo
@rm -f $@
ln -s petidomo $@
acl.c acl_scan.h: acl.y
$(YACC) -d -p acl acl.y
mv y.tab.c acl.c
@ -62,7 +69,7 @@ clean distclean realclean::
@for n in lib*; do (cd $$n && $(MAKE) $@); done
clean::
rm -f petidomo listserv hermes
rm -f petidomo
rm -f $(OBJS)
rm -f acl_scan.c acl_scan.h acl.c
@ -74,29 +81,28 @@ realclean:: distclean
# Dependencies
acl.o: libtext/text.h petidomo.h libargv/argv.h debug.h acl_scan.c acl_scan.h
acl.o: libtext/text.h petidomo.h libargv/argv.h acl_scan.c acl_scan.h
acl_scan.o: acl_scan.h
archive.o: libtext/text.h petidomo.h libargv/argv.h debug.h
argvSetDebugLevel.o: debug.h libargv/argv.h
authen.o: libtext/text.h petidomo.h libargv/argv.h debug.h
archive.o: libtext/text.h petidomo.h libargv/argv.h
authen.o: libtext/text.h petidomo.h libargv/argv.h
config.o: liblists/lists.h libconfigfile/configfile.h petidomo.h
config.o: libargv/argv.h debug.h
exit.o: libtext/text.h petidomo.h libargv/argv.h debug.h
filter.o: petidomo.h libargv/argv.h debug.h
handleacl.o: petidomo.h libargv/argv.h debug.h
help.o: libtext/text.h petidomo.h libargv/argv.h debug.h
hermes.o: libtext/text.h petidomo.h libargv/argv.h debug.h
index.o: libtext/text.h petidomo.h libargv/argv.h debug.h
io.o: petidomo.h libargv/argv.h debug.h
listserv.o: libtext/text.h petidomo.h libargv/argv.h debug.h
mailer.o: libtext/text.h petidomo.h libargv/argv.h debug.h
main.o: petidomo.h libargv/argv.h debug.h
members.o: libtext/text.h petidomo.h libargv/argv.h debug.h
parsearray.o: petidomo.h libargv/argv.h debug.h
password.o: petidomo.h libargv/argv.h debug.h
config.o: libargv/argv.h
exit.o: libtext/text.h petidomo.h libargv/argv.h
filter.o: petidomo.h libargv/argv.h
handleacl.o: petidomo.h libargv/argv.h
help.o: libtext/text.h petidomo.h libargv/argv.h
hermes.o: libtext/text.h petidomo.h libargv/argv.h
index.o: libtext/text.h petidomo.h libargv/argv.h
io.o: petidomo.h libargv/argv.h
listserv.o: libtext/text.h petidomo.h libargv/argv.h
mailer.o: libtext/text.h petidomo.h libargv/argv.h
main.o: petidomo.h libargv/argv.h
members.o: libtext/text.h petidomo.h libargv/argv.h
parsearray.o: petidomo.h libargv/argv.h
password.o: petidomo.h libargv/argv.h
rfcparse.o: librfc822/rfc822.h libtext/text.h petidomo.h libargv/argv.h
rfcparse.o: debug.h
signature.o: petidomo.h libargv/argv.h debug.h
subscribe.o: libtext/text.h petidomo.h libargv/argv.h debug.h
tool.o: libtext/text.h petidomo.h libargv/argv.h debug.h
unsubscribe.o: libtext/text.h petidomo.h libargv/argv.h debug.h
rfcparse.o:
signature.o: petidomo.h libargv/argv.h
subscribe.o: libtext/text.h petidomo.h libargv/argv.h
tool.o: libtext/text.h petidomo.h libargv/argv.h
unsubscribe.o: libtext/text.h petidomo.h libargv/argv.h

11
acl.y
View File

@ -155,7 +155,6 @@ dofilter(const char * filter)
FILE * fh;
int rc;
debug((DEBUG_ACL, 2, "Starting ACL-filter \"%s\".", filter));
fh = popen(filter, "w");
if (fh == NULL) {
syslog(LOG_ERR, "Failed to open ACL-filter \"%s\": %m", filter);
@ -171,10 +170,8 @@ dofilter(const char * filter)
rc = WEXITSTATUS(rc);
switch(rc) {
case 0:
debug((DEBUG_ACL, 2, "Filter returned %d (TRUE).", rc));
return TRUE;
case 1:
debug((DEBUG_ACL, 2, "Filter returned %d (FALSE).", rc));
return FALSE;
default:
syslog(LOG_ERR, "ACL-filter \"%s\" returned unexpected value %d.", filter, rc);
@ -213,20 +210,16 @@ domatch(int qualifier, int oper, char * string)
switch(oper) {
case TOK_EQUAL:
if (left != NULL && strcasecmp(left, string) == 0) {
debug((DEBUG_ACL, 1, "ACL: \"%s\" == \"%s\" == TRUE", left, string));
return TRUE;
}
else {
debug((DEBUG_ACL, 1, "ACL: \"%s\" == \"%s\" == FALSE", left, string));
return FALSE;
}
case TOK_MATCH:
if (left != NULL && text_easy_pattern_match(left, string) == TRUE) {
debug((DEBUG_ACL, 1, "ACL: \"%s\" match \"%s\" == TRUE", left, string));
return TRUE;
}
else {
debug((DEBUG_ACL, 1, "ACL: \"%s\" match \"%s\" == FALSE", left, string));
return FALSE;
}
default:
@ -260,13 +253,11 @@ int checkACL(struct Mail * MailStruct,
/* First check the mail against the master acl file. */
debug((DEBUG_ACL, 2, "Testing mail against \"~petidomo/etc/acl\"."));
yyin = fopen("etc/acl", "r");
if (yyin == NULL) {
switch(errno) {
case ENOENT:
/* no master acl file */
debug((DEBUG_ACL, 1, "No master acl file found."));
goto check_local_acl_file;
default:
syslog(LOG_ERR, "Couldn't open \"~petidomo/etc/acl\" acl file.: %m");
@ -306,13 +297,11 @@ check_local_acl_file:
goto finished;
filename = text_easy_sprintf("lists/%s/acl", listname);
debug((DEBUG_ACL, 2, "Testing mail against \"~petidomo/%s\".", filename));
yyin = fopen(filename, "r");
if (yyin == NULL) {
switch(errno) {
case ENOENT:
/* no list acl file */
debug((DEBUG_ACL, 1, "No acl file for list \"%s\".", listname));
goto finished;
default:
syslog(LOG_ERR, "Couldn't open \"~petidomo/%s\" file: %m", filename);

View File

@ -65,31 +65,26 @@ ArchiveMail(const struct Mail * MailStruct, const char * listname)
path = text_easy_sprintf("lists/%s/%s", listname, ListConfig->archivepath);
path = xstrdup(path);
}
debug((DEBUG_ARCHIVE, 2, "Our archive path is \"%s\".", path));
/* Check whether we have a file or a directory. */
if (stat(path, &sb) == 0 && (sb.st_mode & S_IFDIR) != 0) {
/* Store the article to the current number into the directory. */
debug((DEBUG_ARCHIVE, 3, "\"%s\" is a directory.", path));
/* Read the "active"-file to see at what article number we
were. */
filename = text_easy_sprintf("%s/.active", path);
fh = fopen(filename, "r");
if (fh != NULL) {
if (fh != NULL)
{
fscanf(fh, "%u", &counter);
debug((DEBUG_ARCHIVE, 5, ".active file contained '%u'.", counter));
fclose(fh);
}
else {
else
{
if (errno != ENOENT)
syslog(LOG_ERR, "Failed to read file \"%s\": %m", filename);
else
debug((DEBUG_ARCHIVE, 1, "File \".active\" did not exist."));
counter = 0;
}
@ -97,12 +92,8 @@ ArchiveMail(const struct Mail * MailStruct, const char * listname)
do {
filename = text_easy_sprintf("%s/%u", path, counter);
debug((DEBUG_ARCHIVE, 4, "Testing whether file \"%s\" exists already.",
filename));
if (stat(filename, &sb) == -1) {
debug((DEBUG_ARCHIVE, 7, "Nope, it doesn't."));
if (errno == ENOENT) {
debug((DEBUG_ARCHIVE, 1, "Writing mail to file \"%s\".", filename));
fh = fopen(filename, "a");
if (fh != NULL) {
fprintf(fh, "From %s-owner@%s %s", listname, ListConfig->fqdn, date);
@ -121,8 +112,6 @@ ArchiveMail(const struct Mail * MailStruct, const char * listname)
break;
}
}
else
debug((DEBUG_ARCHIVE, 7, "Yep, it does."));
} while (++counter); /* until break */
/* Write the current "active" number back to the file. */
@ -132,7 +121,6 @@ ArchiveMail(const struct Mail * MailStruct, const char * listname)
fh = fopen(filename, "w");
if (fh != NULL) {
fprintf(fh, "%u", counter);
debug((DEBUG_ARCHIVE, 5, "Wrote '%u' to .active file.", counter));
fclose(fh);
}
else
@ -142,7 +130,6 @@ ArchiveMail(const struct Mail * MailStruct, const char * listname)
/* Simply append the article to this file. */
debug((DEBUG_ARCHIVE, 1, "Appending mail to logfile \"%s\".", path));
fh = fopen(path, "a");
if (fh != NULL) {
/* Write an envelope first. */

View File

@ -1,88 +0,0 @@
/*
$Source$
$Revision$
Copyright (C) 2000 by CyberSolutions GmbH, Germany.
This file is part of OpenPetidomo.
OpenPetidomo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
OpenPetidomo is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "libargv/argv.h"
#ifdef DEBUG
extern const char * const ModuleTable[];
/* This routine is a convenient way to enable or disable various
debugging modules according to the wishes of the user. It takes a
result array from argv_process(3), parses the contents and set the
debug level of the specified modules accordingly.
The provided array must contain zero or more options describing how
the debug level should be set. Each string must be of the form
'module,level', 'module/level' or 'module:level', for example:
'rfcparse,5'. argvSetDebugLevel() will then set the debug level of
the module 'rfcparse' to '5'.
In order to be able to map the name of a debug module to the
according internal module number, argvSetDebugLevel() expects an
array string pointers of the name 'ModuleTable', which lists all
available module names in the order in which they have been
assigned an id number. This array will typically be provided by the
main() routine of the caller.
RETURNS: In case of an error, -1 is returned. A return code of 0
indicates success.
REQUIRES: extern const char * const ModuleTable[]
*/
/* let's define ModuleTable here */
MODULE_TABLE
int
argvSetDebugLevel(argv_array_t debug /* parameter array as returned by the argv routines */
)
{
char * ModuleName;
char * DebugLevel;
unsigned int count, i;
for (count = 0; count < debug.aa_entry_n; count++) {
ModuleName = strtok(ARGV_ARRAY_ENTRY(debug, char *, count), ",/:");
DebugLevel = strtok(NULL, ",/:");
if (ModuleName == NULL || DebugLevel == NULL
|| atoi(DebugLevel) < 0 || atoi(DebugLevel) > 9) {
fprintf(stderr, "\"%s\" is not a valid debug-level specification.\n",
ARGV_ARRAY_ENTRY(debug, char *, count));
return -1;
}
for (i = 0; ModuleTable[i] != NULL; i++) {
if (!strcasecmp(ModuleName, ModuleTable[i])) {
setDebugLevel(i, atoi(DebugLevel));
break;
}
}
if (ModuleTable[i] == NULL) {
fprintf(stderr, "\"%s\" is not a valid debug-module name.\n", ModuleName);
return -1;
}
}
return 0;
}
#endif

View File

@ -43,7 +43,6 @@ FindBodyPassword(struct Mail * MailStruct)
syslog(LOG_ERR, "Failed to parse the approve statement in the mail body.");
return -1;
}
debug((DEBUG_HERMES, 3, "Found password \"%s\" in mail body.", currLine));
MailStruct->Approve = currLine;
}
return 0;
@ -69,9 +68,6 @@ isValidAdminPassword(const char * password, const char * listname)
if (ListConfig->admin_password == NULL)
return FALSE;
debug((DEBUG_AUTHEN, 5, "Comparing provided password '%s' to correct one '%s'.",
ListConfig->admin_password, password));
if (!strcasecmp(ListConfig->admin_password, password))
return TRUE;
}
@ -80,7 +76,7 @@ isValidAdminPassword(const char * password, const char * listname)
bool
isValidPostingPassword(const char * password, const char * listname)
{
{
const struct List_Config * ListConfig;
if (password == NULL)
@ -89,24 +85,16 @@ isValidPostingPassword(const char * password, const char * listname)
if (isValidAdminPassword(password, listname) == TRUE)
return TRUE;
if (listname != NULL) {
if (listname != NULL)
{
ListConfig = getListConfig(listname);
if (ListConfig->posting_password == NULL)
return FALSE;
debug((DEBUG_AUTHEN, 5, "provided password '%s' to correct one '%s'.",
ListConfig->posting_password, password));
if (!strcasecmp(ListConfig->posting_password, password)) {
debug((DEBUG_AUTHEN, 2, "Provided password is correct!"));
if (!strcasecmp(ListConfig->posting_password, password))
return TRUE;
}
else {
debug((DEBUG_AUTHEN, 2, "Provided password is incorrect!"));
}
}
return FALSE;
}
}

View File

@ -73,17 +73,14 @@ InitPetidomo(void)
/* First of all, determine the home directory of the "petidomo"
user. This will be our base directory for all operations. */
debug((DEBUG_CONFIG, 9, "Looking for the home directory of user petidomo."));
pwd = getpwnam("petidomo");
if (pwd != NULL) {
debug((DEBUG_CONFIG, 8, "Home directory of petidomo is \"%s\".", pwd->pw_dir));
if (strcmp(basedir, pwd->pw_dir) != 0)
basedir = xstrdup(pwd->pw_dir); /* Replace the default above. */
endpwent();
}
else
syslog(LOG_WARNING, "User \"petidomo\" not found.");
debug((DEBUG_CONFIG, 8, "Will use basedir \"%s\".", basedir));
/* chdir() into the base directory. */
@ -186,7 +183,6 @@ getListConfig(const char * listname)
/* No? Then read the config file. */
sprintf(buffer, "lists/%s/config", listname);
debug((DEBUG_CONFIG, 6, "getListConfig(): Loading config file \"%s\".", buffer));
rc = ReadConfig(buffer, ListCF);
if (rc != 0) {
syslog(LOG_ERR, "Failed to parse the list \"%s\"'s config file.", listname);
@ -207,8 +203,6 @@ getListConfig(const char * listname)
syslog(LOG_ERR, "Failed to allocate %d byte of memory.", sizeof(struct List_Config));
exit(1);
}
debug((DEBUG_CONFIG, 6, "Loaded config file successfully."));
debug((DEBUG_CONFIG, 4, "Read listtype is \"%s\".", listtype));
if (!strcasecmp(listtype, "open"))
ListConfig->listtype = LIST_OPEN;
else if (!strcasecmp(listtype, "closed"))

77
debug.h
View File

@ -1,77 +0,0 @@
/*
$Source$
$Revision$
Copyright (C) 2000 by CyberSolutions GmbH, Germany.
This file is part of OpenPetidomo.
OpenPetidomo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
OpenPetidomo is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/
#ifndef __DEBUG_H__
#define __DEBUG_H__ 1
/********** Known debug modules. **********/
enum {
DEBUG_MAIN,
DEBUG_COMMAND,
DEBUG_LISTSERV,
DEBUG_HERMES,
DEBUG_CONFIG,
DEBUG_RFCPARSE,
DEBUG_MAILER,
DEBUG_ACL,
DEBUG_AUTHEN,
DEBUG_FILTER,
DEBUG_ARCHIVE,
DEBUG_EOL
};
#define MODULE_TABLE const char * const ModuleTable[] = { \
"main", \
"command", \
"listserv", \
"hermes", \
"config", \
"rfcparse", \
"mailer", \
"acl", \
"authen", \
"filter", \
"archive", \
NULL };
/********** Prototypes **********/
#ifdef DEBUG
# ifdef __cplusplus
extern "C" {
# endif
extern char * debug_fname;
void setDebugLevel(unsigned short, unsigned short);
unsigned short getDebugLevel(unsigned short);
void _debug(unsigned short, unsigned short, const char *, ...);
# ifdef __cplusplus
}
# endif
# ifdef __GNUC__
# define debug(x) { debug_fname = __FUNCTION__; _debug x; }
# else
# define debug(x) { debug_fname = "unknown"; _debug x; }
# endif
#else
# define setDebugLevel(a,b) ;
# define debug(x) ;
#endif
#endif /* !__DEBUG_H__ */

4
exit.c
View File

@ -74,7 +74,6 @@ RescueMail(const char * mail)
for (buffer = xmalloc(64), counter = 0; ; counter++) {
sprintf(buffer, "crash/mail%04d", counter);
debug((DEBUG_MAIN, 8, "Trying rescue file \"%s\".", buffer));
fd = open(buffer, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd == -1) {
if (errno == EEXIST)
@ -87,8 +86,6 @@ RescueMail(const char * mail)
else
break;
}
debug((DEBUG_MAIN, 8, "Saving read file to \"%s\" in case something goes wrong.",
buffer));
lock.l_start = 0;
lock.l_len = 0;
@ -111,7 +108,6 @@ void
RemoveRescueMail()
{
if (s_crash_filename) {
debug((DEBUG_MAIN, 8, "Removing crash rescue file \"%s\".", s_crash_filename));
remove(s_crash_filename);
s_crash_filename = NULL;
}

View File

@ -53,8 +53,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
assert(MailStruct != NULL);
assert(filter != NULL);
debug((DEBUG_FILTER, 2, "Starting mail filter \"%s\".", filter));
/* Sanity checks. */
if (MailStruct == NULL || filter == NULL)
@ -89,7 +87,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
}
close(child_in[READ]);
close(child_out[WRITE]);
debug((DEBUG_FILTER, 2, "Child process is set up. Executing filter."));
execl("/bin/sh", "sh", "-c", filter, NULL);
return -1;
case -1:
@ -130,7 +127,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
syslog(LOG_ERR, "Couldn't set flags for write-pipe descriptor: %m");
goto error_exit;
}
debug((DEBUG_FILTER, 4, "Pipes are in non-blocking mode now."));
/* Now write the mail into the pipe and read the result from the
child. This has to happen parallely or we risk that the child
@ -161,11 +157,9 @@ MailFilter(struct Mail * MailStruct, const char * filter)
rc = write(child_in[WRITE], p + byte_written,
(strlen(p + byte_written) > IO_BLOCKSIZE) ?
IO_BLOCKSIZE : strlen(p + byte_written));
debug((DEBUG_FILTER, 4, "Write returned '%d'.", rc));
if (rc >= 0) {
byte_written += rc;
if (p[byte_written] == '\0') {
debug((DEBUG_FILTER, 2, "New write state"));
write_state++; /* new state */
byte_written = 0;
if (write_state == STATE_FINISHED)
@ -182,7 +176,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
if ((newmail_size - byte_read) <= (IO_BLOCKSIZE)) {
newmail_size += 10*1024;
debug((DEBUG_FILTER, 4, "Allocting new read buffer: %d byte", newmail_size));
newmail = realloc(newmail, newmail_size);
if (newmail == NULL) {
syslog(LOG_ERR, "Failed to allocate %d byte of memory: %m", newmail_size);
@ -190,7 +183,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
}
}
rc = read(child_out[READ], newmail + byte_read, IO_BLOCKSIZE);
debug((DEBUG_FILTER, 4, "Read returned '%d'.", rc));
if (rc > 0)
byte_read += rc;
else if (rc == 0) {
@ -201,9 +193,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
syslog(LOG_ERR, "Reading from filter process failed: %m");
goto error_exit;
}
else {
debug((DEBUG_FILTER, 4, "read would block"));
}
}
newmail[byte_read] = '\0';
@ -218,8 +207,6 @@ MailFilter(struct Mail * MailStruct, const char * filter)
break;
}
}
debug((DEBUG_FILTER, 5, "New header is:\n%s", MailStruct->Header));
debug((DEBUG_FILTER, 5, "New body is:\n%s", MailStruct->Body));
/* Get returncode. */
@ -227,11 +214,8 @@ MailFilter(struct Mail * MailStruct, const char * filter)
if (!WIFEXITED(rc))
return -1;
debug((DEBUG_FILTER, 4, "Filter \"%s\" returned %d.", filter, WEXITSTATUS(rc)));
return WEXITSTATUS(rc);
return 0;
error_exit:
close(child_in[WRITE]);
close(child_out[READ]);

View File

@ -51,18 +51,14 @@ handleACL(struct Mail * MailStruct, const char * listname, int operation, char *
switch(operation) {
case ACL_NONE:
debug((DEBUG_ACL, 4, "No ACL statement matched the mail."));
break;
case ACL_PASS:
debug((DEBUG_ACL, 4, "Mail passed access control."));
break;
case ACL_DROP:
syslog(LOG_INFO, "Mail is dropped due to access control.");
return 1;
case ACL_REJECTWITH:
assert(parameter != NULL);
case ACL_REJECT:
syslog(LOG_INFO, "Mail is rejected due to access control.");
fh = vOpenMailer(envelope, owner, (MailStruct->Reply_To) ?
(MailStruct->Reply_To) : (MailStruct->From), NULL);
if (fh == NULL) {
@ -132,7 +128,6 @@ handleACL(struct Mail * MailStruct, const char * listname, int operation, char *
syslog(LOG_INFO, "Mail is filtered through \"%s\" due to access control.",
parameter);
rc = MailFilter(MailStruct, parameter);
debug((DEBUG_ACL, 3, "Mail filter \"%s\" returned %d.", parameter, rc));
if (rc != 0) {
syslog(LOG_ERR, "Mail filter \"%s\" returned error code %d.", parameter, rc);
return -1;
@ -146,15 +141,5 @@ handleACL(struct Mail * MailStruct, const char * listname, int operation, char *
if (parameter != NULL)
free(parameter);
#ifdef DEBUG
if (listname != NULL) {
debug((DEBUG_ACL, 3, "\"%s\" is authorized to post to \"%s\".",
MailStruct->From, listname));
}
else {
debug((DEBUG_ACL, 3, "Request from \"%s\" is okay, says ACL", MailStruct->From));
}
#endif
return 0;
}

6
help.c
View File

@ -49,8 +49,6 @@ SendHelp(struct Mail * MailStruct,
/* Send list's description back. */
debug((DEBUG_COMMAND, 5, "Sending \"%s\" list \"%s\" description.",
originator, param1));
ListConfig = getListConfig(param1);
sprintf(envelope, "%s-owner@%s", param1, MasterConfig->fqdn);
fh = vOpenMailer(envelope, originator, NULL);
@ -86,8 +84,6 @@ SendHelp(struct Mail * MailStruct,
/* List does not exist, I am afraid. */
debug((DEBUG_COMMAND, 5, "Received HELP command for non-existing list \"%s\".",
param1));
fh = vOpenMailer(envelope, originator, NULL);
if (fh == NULL) {
syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.",
@ -123,7 +119,6 @@ SendHelp(struct Mail * MailStruct,
/* Send help text to the originator. */
debug((DEBUG_COMMAND, 5, "Sending helpfile to \"%s\".", originator));
fh = vOpenMailer(envelope, originator, NULL);
if (fh == NULL) {
syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.",
@ -182,7 +177,6 @@ Indecipherable(struct Mail * MailStruct, const char * defaultlist)
/* Send the help file out. */
debug((DEBUG_COMMAND, 5, "Sending helpfile to \"%s\".", replyto));
fh = vOpenMailer(envelope, replyto, NULL);
if (fh == NULL) {
syslog(LOG_ERR, "Failed to send mail to \"%s\" regarding this request.", replyto);

View File

@ -43,7 +43,6 @@ hermes_main(char * incoming_mail, const char * listname)
int rc, len, operation;
assert(listname != NULL);
debug((DEBUG_HERMES, 5, "Received article for the \"%s\" mailing list", listname));
/* Initialize internals. */
@ -57,8 +56,6 @@ hermes_main(char * incoming_mail, const char * listname)
exit(rc);
}
debug((DEBUG_HERMES, 3, "Parsed incoming mail successfully."));
/* Do sanity checks. */
if (MailStruct->Envelope == NULL) {
@ -87,8 +84,6 @@ hermes_main(char * incoming_mail, const char * listname)
/* Check for authorization. */
debug((DEBUG_HERMES, 5, "Checking whether posting is authorized."));
if (FindBodyPassword(MailStruct) != 0)
exit(1);
@ -125,9 +120,6 @@ hermes_main(char * incoming_mail, const char * listname)
if (ListConfig->listtype == LIST_CLOSED) {
/* Only subscribers may post */
if (isSubscribed(listname, MailStruct->From, NULL, NULL, TRUE) == FALSE) {
debug((DEBUG_HERMES, 5, "\"%s\" is not a subscriber of \"%s\". Rejecting.",
MailStruct->From, listname));
fh = vOpenMailer(envelope, owner, NULL);
if (fh != NULL) {
fprintf(fh, "From: %s (Petidomo Mailing List Server)\n", owner);
@ -156,7 +148,6 @@ hermes_main(char * incoming_mail, const char * listname)
exit(1);
}
rc = handleACL(MailStruct, listname, operation, parameter);
debug((DEBUG_HERMES, 8, "handleACL() returned %d.", rc));
switch(rc) {
case -1:
syslog(LOG_ERR, "handleACL() failed with an error.");
@ -166,18 +157,11 @@ hermes_main(char * incoming_mail, const char * listname)
case 1:
return 0;
}
debug((DEBUG_HERMES, 3, "\"%s\" is authorized to post to \"%s\".",
MailStruct->From, listname));
}
else {
debug((DEBUG_HERMES, 5, "Listtype doesn't require authorization."));
}
/* Copy the desired headers from the original mail to our own
buffer. */
debug((DEBUG_HERMES, 9, "Preparing headers for posting."));
for(len = 0, currLine = MailStruct->Header, dst = PostingHeaders;
*currLine != '\0';
currLine = nextLine) {
@ -205,7 +189,6 @@ hermes_main(char * incoming_mail, const char * listname)
len = nextLine - currLine;
memmove(dst, currLine, len);
dst += len;
debug((DEBUG_HERMES, 9, "Copied line."));
}
}
@ -255,19 +238,14 @@ hermes_main(char * incoming_mail, const char * listname)
/* Add the signature if there is one. */
buffer = text_easy_sprintf("lists/%s/signature", listname);
debug((DEBUG_HERMES, 6, "Checking whether \"%s\" exists.", buffer));
if (stat(buffer, &sb) == 0) {
debug((DEBUG_HERMES, 3, "Appending signature \"%s\".", buffer));
buffer = loadfile(buffer);
if (buffer == NULL) {
syslog(LOG_ERR, "Failed reading the signature file for list \"%s\".", listname);
exit(1);
}
MailStruct->ListSignature = buffer;
debug((DEBUG_HERMES, 7, "Signature is: \"%s\".", buffer));
}
else
debug((DEBUG_HERMES, 3, "No signature file \"%s\".", buffer));
/* No more modifications will be made. Now copy the posting
headers into the structure instead of the original ones. */
@ -277,14 +255,12 @@ hermes_main(char * incoming_mail, const char * listname)
/* Apply the posting filter. */
if (ListConfig->postingfilter != NULL) {
debug((DEBUG_HERMES, 3, "Applying posting filter for list \"%s\".", listname));
rc = MailFilter(MailStruct, ListConfig->postingfilter);
if (rc != 0) {
syslog(LOG_ERR, "Postingfilter \"%s\" returned error %d while processing posting " \
"for list \"%s\".", ListConfig->postingfilter, rc, listname);
exit(1);
}
debug((DEBUG_HERMES, 6, "Filter was successful: returncode = %d.", rc));
}
/* Deliver the article to all recipients. */

View File

@ -45,9 +45,6 @@ GenIndex(struct Mail * MailStruct,
struct dirent * entry;
unsigned int entry_num;
debug((DEBUG_COMMAND, 3, "GenIndex(\"%s\", \"%s\") with default list \"%s\".",
param1, param2, defaultlist));
address = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From;
/* Initialize internal stuff. */
@ -96,14 +93,10 @@ GenIndex(struct Mail * MailStruct,
continue;
if (isValidListName(entry->d_name) == FALSE)
continue;
debug((DEBUG_COMMAND, 5, "Found entry \"lists/%s\".", entry->d_name));
ListConfig = getListConfig(entry->d_name);
if (ListConfig->showonindex == FALSE) {
debug((DEBUG_COMMAND, 5, "List \"%s\" won't appear on the index.",
entry->d_name));
if (ListConfig->showonindex == FALSE)
continue;
}
entry_num++;
/* Print stuff to the mail. */

View File

@ -51,7 +51,6 @@ listserv_main(char * incoming_mail, char * default_list)
syslog(LOG_ERR, "Parsing the incoming mail failed.");
exit(rc);
}
debug((DEBUG_LISTSERV, 3, "Parsed incoming mail successfully."));
/* Do sanity checks. */
@ -103,10 +102,8 @@ listserv_main(char * incoming_mail, char * default_list)
if (*g_currLine == '\0' || *g_currLine == '#')
continue;
if (!strcmp(g_currLine, "-- ")) {
debug((DEBUG_LISTSERV, 6, "Ignoring trailing signature."));
if (!strcmp(g_currLine, "-- "))
break;
}
/* Log contents of current line. */
@ -118,10 +115,8 @@ listserv_main(char * incoming_mail, char * default_list)
for (j = 0; !isspace((int)g_currLine[j]) && j < (sizeof(keyword)-1); j++)
keyword[j] = g_currLine[j];
keyword[j] = '\0';
debug((DEBUG_LISTSERV, 5, "command is \"%s\".", keyword));
for (i = 0; (&(ParseArray[i]))->keyword != NULL; i++) {
if (strcasecmp(keyword, (&(ParseArray[i]))->keyword) == 0) { /* hit */
debug((DEBUG_LISTSERV, 4, "Recognized command \"%s\".", keyword));
rc = sscanf(g_currLine, "%*s%511s%511s", param1, param2);
rc = ((&(ParseArray[i]))->handleCommand)(MailStruct,
((rc >= 1) ? param1 : NULL),
@ -140,7 +135,6 @@ listserv_main(char * incoming_mail, char * default_list)
/* No valid command. */
debug((DEBUG_LISTSERV, 4, "Unrecognized command \"%s\".", keyword));
junklines++;
}
}

View File

@ -63,10 +63,6 @@ vOpenMailer(const char * envelope, ...)
MasterConfig = getMasterConfig();
debug((DEBUG_MAILER, 2, "MTA is \"%s\".", MasterConfig->mta));
debug((DEBUG_MAILER, 2, "MTA options are \"%s\".", MasterConfig->mta_options));
debug((DEBUG_MAILER, 2, "Envelope is \"%s\".", envelope));
/* Determine the length of the required buffer. */
cmdline_len = strlen(MasterConfig->mta);
@ -74,12 +70,10 @@ vOpenMailer(const char * envelope, ...)
cmdline_len += strlen(envelope);
va_start(ap, envelope);
while ((q = va_arg(ap, const char *)) != NULL) {
debug((DEBUG_MAILER, 2, "Recipient: \"%s\".", q));
cmdline_len += strlen(q) + 1;
}
va_end(ap);
cmdline = xmalloc(cmdline_len+8); /* we don't take any risks :) */
debug((DEBUG_MAILER, 3, "Command line will be %u byte long.", cmdline_len));
/* Copy the mta's path and name into the buffer. */
@ -91,7 +85,6 @@ vOpenMailer(const char * envelope, ...)
for (options = MasterConfig->mta_options; *options != '\0'; )
{
debug((DEBUG_MAILER, 4, "Parsing '%c' character.", *options));
if (options[0] == '%' && options[1] == 's')
{
p = my_strcpy(p, envelope);
@ -101,7 +94,6 @@ vOpenMailer(const char * envelope, ...)
}
else
{
debug((DEBUG_MAILER, 4, "Wrote '%c' to aray.", *options));
*p++ = *options++;
}
}
@ -118,8 +110,6 @@ vOpenMailer(const char * envelope, ...)
p[-1] = '\0';
va_end(ap);
debug((DEBUG_MAILER, 1, "Starting up \"%s\".", cmdline));
fh = popen(cmdline, "w");
if (fh == NULL)
syslog(LOG_ERR, "Failed opening pipe to \"%s\": %m", cmdline);
@ -187,19 +177,14 @@ ListMail(const char * envelope, const char * listname, const struct Mail * MailS
/* Set up the call to the MTA, including options. */
arguments[counter++] = MasterConfig->mta;
debug((DEBUG_MAILER, 5, "MTA is \"%s\".", arguments[0]));
sprintf(buffer, MasterConfig->mta_options, envelope);
debug((DEBUG_MAILER, 5, "MTA options are \"%s\".", buffer));
for (p = buffer, arguments[counter++] = buffer; *p != '\0'; p++)
{
debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p));
if (isspace((int)*p))
{
*p++ = '\0';
debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p));
while(*p != '\0' && isspace((int)*p))
p++;
debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p));
arguments[counter++] = p;
}
}
@ -213,22 +198,14 @@ ListMail(const char * envelope, const char * listname, const struct Mail * MailS
nextAddress = text_find_next_line(currAddress);
len = my_strlen(currAddress);
if (address_byte + len > max_address_byte)
{
debug((DEBUG_MAILER, 1, "Sending early, command line exceeds %d characters.", ARG_MAX));
break;
}
if (counter > ARG_NUM_MAX)
{
debug((DEBUG_MAILER, 1, "Sending early, command line exceeds %d arguments.", ARG_NUM_MAX));
break;
}
currAddress[len] = '\0';
debug((DEBUG_MAILER, 8, "Address \"%s\" is %u byte long.", currAddress, len));
address_byte += len;
arguments[counter++] = currAddress;
if (counter+8 >= arguments_num)
{
debug((DEBUG_MAILER, 1, "Enlarging internal array."));
arguments_num += 256;
arguments = realloc(arguments, (arguments_num+1) * sizeof(char *));
if (arguments == NULL)

View File

@ -41,9 +41,6 @@ SendSubscriberList(struct Mail * MailStruct,
char * p;
int i;
debug((DEBUG_COMMAND, 3, "SendSubscriberList(\"%s\") with default list \"%s\".",
param1, defaultlist));
/* Try to find out, which parameter is what. */
if (param1 != NULL) {
@ -103,9 +100,6 @@ SendSubscriberList(struct Mail * MailStruct,
/* Okay, send the address list back. */
debug((DEBUG_COMMAND, 1, "Sending list of subscribed addresses for list "
"\"%s\" to \"%s\".", listname, address));
buffer = text_easy_sprintf("lists/%s/list", listname);
buffer = loadfile(buffer);
if (buffer == NULL) {

View File

@ -32,8 +32,6 @@ setPassword(struct Mail * MailStruct,
char * p;
char * q;
debug((DEBUG_COMMAND, 3, "setPassword(\"%s\").", param1));
/* Find the beginning of the parameter. */
p = g_currLine;
@ -63,7 +61,6 @@ setPassword(struct Mail * MailStruct,
/* Store the result. */
debug((DEBUG_COMMAND, 2, "Setting current password to \"%s\".", p));
s_password = p;
return 0;

View File

@ -53,16 +53,12 @@ isRFC822Address(const char * buffer)
rc = rfc822_parse_address(buffer, &address, NULL, NULL);
if (rc == RFC822_OK) {
debug((DEBUG_RFCPARSE, 3, "'%s' is a valid rfc address.", address));
if (address) {
if (address)
free(address);
}
return TRUE;
}
else {
debug((DEBUG_RFCPARSE, 4, "'%s' is not a valid rfc address", buffer));
else
return FALSE;
}
}
int
@ -82,8 +78,6 @@ ParseAddressLine(char * buffer)
sep_state.address_line = buffer;
sep_state.group_nest = 0;
debug((DEBUG_RFCPARSE, 2, "Original address is \"%s\".", buffer));
/* We want only the first address, if multiple are there. */
while ((p = rfc822_address_sep(&sep_state)) != NULL) {
@ -98,11 +92,8 @@ ParseAddressLine(char * buffer)
return -1;
}
debug((DEBUG_RFCPARSE, 2, "First part is \"%s\".", p));
rc = rfc822_parse_address(p, &address, NULL, NULL);
if (rc == RFC822_OK && address != NULL) {
debug((DEBUG_RFCPARSE, 2, "Parsed address is: '%s'", address));
strcpy(buffer, address);
free(address);
return 0;
@ -128,8 +119,6 @@ ParseMessageIdLine(char * buffer)
{
int rc;
debug((DEBUG_RFCPARSE, 2, "Unparsed Message-Id: '%s'", buffer));
rc = ParseAddressLine(buffer);
if (rc != 0)
return rc; /* Error! */
@ -138,8 +127,6 @@ ParseMessageIdLine(char * buffer)
buffer[0] = '<';
strcat(buffer, ">");
debug((DEBUG_RFCPARSE, 2, "Parsed Message-Id: '%s'", buffer));
return rc;
}
@ -198,13 +185,9 @@ CanonizeAddress(char ** buffer, const char * fqdn)
if (buffer == NULL || *buffer == NULL)
return;
debug((DEBUG_RFCPARSE, 3, "Check whether \"%s\" is a canon address.", *buffer));
rc = rfc822_parse_address(*buffer, NULL, &local, &host);
if (rc == RFC822_OK) {
if (local != NULL && host == NULL) {
debug((DEBUG_RFCPARSE, 3, "'%s' is a local address, appending my hostname.",
*buffer));
if (fqdn == NULL) {
MasterConfig = getMasterConfig();
fqdn = MasterConfig->fqdn;
@ -213,10 +196,7 @@ CanonizeAddress(char ** buffer, const char * fqdn)
sprintf(newbuf, "%s@%s", local, fqdn);
free(local);
*buffer = newbuf;
debug((DEBUG_RFCPARSE, 3, "Canonized address: '%s'.", *buffer));
}
else
debug((DEBUG_RFCPARSE, 3, "\"%s\" is a full address.", *buffer));
}
}
@ -268,7 +248,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
currLine++;
*currLine = '\0';
CanonizeAddress(&(MailStruct->Envelope), fqdn);
debug((DEBUG_RFCPARSE, 5, "Envelope is \"%s\".", MailStruct->Envelope));
currLine = nextLine;
}
@ -288,10 +267,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
if (nextLine[-1] == '\n')
nextLine[-1] = '\0';
/* Log contents of current line. */
debug((DEBUG_RFCPARSE, 6, "Parsing line \"%s\".", currLine));
/* Check whether it is a header we're interested in. */
if (strncasecmp("From:", currLine, strlen("From:")) == 0) {
@ -304,7 +279,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
if (rc != 0)
return rc;
CanonizeAddress(&(MailStruct->From), fqdn);
debug((DEBUG_RFCPARSE, 5, "From: is \"%s\".", MailStruct->From));
} else if (strncasecmp("Reply-To:", currLine, strlen("Reply-To:")) == 0) {
if (MailStruct->Reply_To != NULL) {
syslog(LOG_NOTICE, "Received mail with multiple Reply-To: lines.");
@ -315,7 +289,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
if (rc != 0)
return rc;
CanonizeAddress(&(MailStruct->Reply_To), fqdn);
debug((DEBUG_RFCPARSE, 5, "Reply-To: is \"%s\".", MailStruct->Reply_To));
} else if (strncasecmp("Message-Id:", currLine, strlen("Message-Id:")) == 0) {
if (MailStruct->Message_Id != NULL) {
syslog(LOG_NOTICE, "Received mail with multiple Message-Id: lines.");
@ -325,7 +298,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
rc = ParseMessageIdLine(MailStruct->Message_Id);
if (rc != 0)
return rc;
debug((DEBUG_RFCPARSE, 5, "Message-Id: is \"%s\".", MailStruct->Message_Id));
}
else if (strncasecmp("Approve:", currLine, strlen("Approve:")) == 0) {
if (MailStruct->Approve != NULL)
@ -334,7 +306,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
rc = ParseApproveLine(MailStruct->Approve);
if (rc != 0)
return rc;
debug((DEBUG_RFCPARSE, 5, "Approve: is \"%s\".", MailStruct->Approve));
}
else if (strncasecmp("Approved:", currLine, strlen("Approved:")) == 0) {
if (MailStruct->Approve != NULL)
@ -343,7 +314,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
rc = ParseApproveLine(MailStruct->Approve);
if (rc != 0)
return rc;
debug((DEBUG_RFCPARSE, 5, "Approve: is \"%s\".", MailStruct->Approve));
}
else if (strncasecmp("Subject:", currLine, strlen("Subject:")) == 0) {
if (MailStruct->Subject != NULL)
@ -351,7 +321,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
MailStruct->Subject = &currLine[strlen("Subject:")];
if (*MailStruct->Subject == ' ')
MailStruct->Subject += 1;
debug((DEBUG_RFCPARSE, 5, "Subject: is \"%s\".", MailStruct->Subject));
}
else if (strncasecmp("Sender:", currLine, strlen("Sender:")) == 0) {
if (MailStruct->Envelope != NULL)
@ -359,7 +328,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
MailStruct->Envelope = &currLine[strlen("Sender:")];
if (*MailStruct->Envelope == ' ')
MailStruct->Envelope += 1;
debug((DEBUG_RFCPARSE, 5, "Sender: is \"%s\".", MailStruct->Envelope));
}
else if (strncasecmp("Return-Path:", currLine, strlen("Return-Path:")) == 0 &&
MailStruct->Envelope == NULL)
@ -369,7 +337,6 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
MailStruct->Envelope = &currLine[strlen("Return-Path:")];
if (*MailStruct->Envelope == ' ')
MailStruct->Envelope += 1;
debug((DEBUG_RFCPARSE, 5, "Return-Path: is \"%s\".", MailStruct->Envelope));
}
}

View File

@ -38,9 +38,6 @@ AddAddress(struct Mail * MailStruct,
char * originator;
char * p;
debug((DEBUG_COMMAND, 3, "AddAddress(\"%s\", \"%s\") with default list \"%s\".",
param1, param2, defaultlist));
/* Try to find out, which parameter is what. */
if (param1 != NULL) {
@ -75,17 +72,12 @@ AddAddress(struct Mail * MailStruct,
sprintf(envelope, "%s-owner@%s", listname, ListConfig->fqdn);
originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From;
debug((DEBUG_COMMAND, 1, "Subscribing \"%s\" to list \"%s\".", address, listname));
/* Check whether the request is authorized at all. */
if (isValidAdminPassword(getPassword(), listname) == FALSE) {
/* No valid password, check further. */
debug((DEBUG_COMMAND, 5, "The mail didn't contain any admin password. " \
"Checking for authorization..."));
if (ListConfig->allowpubsub == FALSE) {
/* Access was unauthorized, notify the originator. */
@ -215,8 +207,6 @@ AddAddress(struct Mail * MailStruct,
/* Check whether the address is subscribed already. */
if (isSubscribed(listname, address, NULL, NULL, FALSE) == TRUE) {
debug((DEBUG_COMMAND, 2, "\"%s\" is already subscribed to list \"%s\".",
address, listname));
/* Notify the originator, that the address is already a
member. */
@ -310,8 +300,6 @@ AddAddress(struct Mail * MailStruct,
if (p != NULL) {
fh = vOpenMailer(envelope, address, NULL);
if (fh != NULL) {
debug((DEBUG_COMMAND, 5, "Sending \"%s\" as welcome mail to the new " \
"subscriber.", buffer));
fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n",
listname, ListConfig->fqdn);
fprintf(fh, "To: %s\n", address);

20
tool.c
View File

@ -43,9 +43,6 @@ isSubscribed(const char * listname, const char * address,
if (list == NULL)
return FALSE;
debug((DEBUG_COMMAND, 3, "Searching for subscriber \"%s\" in list \"%s\".",
address, listname));
for (len = strlen(address), p = list; *p != '\0'; p = text_find_next_line(p)) {
if (strncasecmp(p, address, len) == 0 &&
(p == list || p[-1] == '\n') &&
@ -55,7 +52,6 @@ isSubscribed(const char * listname, const char * address,
}
if (*p == '\0' && dofuzzy == TRUE) {
debug((DEBUG_COMMAND, 3, "No success, trying fuzzy matching."));
address = buildFuzzyMatchAddress(address);
if (address != NULL) {
for (len = strlen(address), p = list; *p != '\0'; p = text_find_next_line(p)) {
@ -67,14 +63,6 @@ isSubscribed(const char * listname, const char * address,
}
}
#ifdef DEBUG
if (*p != '\0') {
debug((DEBUG_COMMAND, 3, "Found address: \"%s\".", p));
}
else {
debug((DEBUG_COMMAND, 3, "Nope, couldn't find address."));
}
#endif
/* Save the returncode now, because p may be invalid in a few
moments. */
@ -102,8 +90,6 @@ buildFuzzyMatchAddress(const char * address)
char * fuzzyaddress;
int rc;
debug((DEBUG_COMMAND, 5, "Turning \"%s\" into a fuzzy match address.", address));
fuzzyaddress = xmalloc(strlen(address)+16);
rc = text_transform_text(fuzzyaddress, address, "([^@]+)@[^\\.]+\\.([^\\.]+\\..*)",
"\\1@([^\\\\.]+\\\\.)?\\2");
@ -120,12 +106,10 @@ buildFuzzyMatchAddress(const char * address)
case TEXT_REGEX_TRANSFORM_DIDNT_MATCH:
break;
case TEXT_REGEX_OK:
debug((DEBUG_COMMAND, 4, "Fuzzy-match address is \"%s\".", fuzzyaddress));
return fuzzyaddress;
default:
syslog(LOG_CRIT, "Internal error: Unexpected returncode in ParseMessageIdLine().");
}
debug((DEBUG_COMMAND, 3, "No fuzzy match address could be built."));
free(fuzzyaddress);
return NULL;
}
@ -140,10 +124,8 @@ isValidListName(const char * listname)
assert(listname != NULL);
if ((strchr(listname, '/') != NULL) || (strchr(listname, ':') != NULL)) {
debug((DEBUG_COMMAND, 1, "listname '%s' contains a slash or colon!", listname));
if ((strchr(listname, '/') != NULL) || (strchr(listname, ':') != NULL))
return FALSE;
}
buffer = text_easy_sprintf("lists/%s", listname);
if (stat(buffer, &sb) != 0)

View File

@ -38,9 +38,6 @@ DeleteAddress(struct Mail * MailStruct,
char * p;
char * list;
debug((DEBUG_COMMAND, 3, "DeleteAddress(\"%s\", \"%s\") with default list \"%s\".",
param1, param2, defaultlist));
/* Try to find out, which parameter is what. */
if (param1 != NULL) {
@ -75,8 +72,6 @@ DeleteAddress(struct Mail * MailStruct,
sprintf(envelope, "%s-owner@%s", listname, ListConfig->fqdn);
originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From;
debug((DEBUG_COMMAND, 1, "Unsubscribing \"%s\" to list \"%s\".", address, listname));
/* Check whether the request is authorized at all. */
if (isValidAdminPassword(getPassword(), listname) == FALSE) {
@ -214,11 +209,6 @@ DeleteAddress(struct Mail * MailStruct,
if (isSubscribed(listname, address, &list, &p, FALSE) == FALSE) {
/* Address is not subscribed. */
debug((DEBUG_COMMAND, 2, "\"%s\" is not subscribed to list \"%s\".",
address, listname));
/* Notify the originator, that the address is not subscribed at
all. */