--- filter.c 2000/12/13 15:35:14 1.2
+++ filter.c 2000/12/15 15:48:00 1.3
@@ -1,6 +1,6 @@
/*
$Source: /v/ossp/cvs/ossp-pkg/petidomo/filter.c,v $
- $Revision: 1.2 $
+ $Revision: 1.3 $
Copyright (C) 2000 by CyberSolutions GmbH, Germany.
@@ -53,8 +53,6 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
}
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 @@
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 @@
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 @@
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]);
|