removed sapi/milter

This commit is contained in:
Anatol Belski 2015-02-10 08:38:21 +01:00
parent 4fedc42c2b
commit e6f62c50cc
10 changed files with 0 additions and 1590 deletions

View File

@ -1,2 +0,0 @@
Sendmail Milter
Harald Radi

View File

@ -1,5 +0,0 @@
this module is experimental,
its functions may change their names
or move to extension all together
so do not rely to much on them
you have been warned!

View File

@ -1,8 +0,0 @@
milter: $(SAPI_MILTER_PATH)
$(SAPI_MILTER_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_MILTER_OBJS)
$(BUILD_MILTER)
install-milter: $(SAPI_MILTER_PATH)
@$(INSTALL) -m 0755 $(SAPI_MILTER_PATH) $(INSTALL_ROOT)$(bindir)/php-milter

View File

@ -1,5 +0,0 @@
threaded version still leaks mem, don't know why
extensions aren't loaded
stdout to syslog
testing
documentation

View File

@ -1,31 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(milter, for Milter support,
[ --with-milter[=DIR] Build PHP as Milter application], no, no)
if test "$PHP_MILTER" != "no"; then
if test "$PHP_MILTER" = "yes"; then
if test -f /usr/lib/libmilter.a ; then
MILTERPATH=/usr/lib
else
if test -f /usr/lib/libmilter/libmilter.a ; then
MILTERPATH=/usr/lib/libmilter
else
AC_MSG_ERROR([Unable to find libmilter.a])
fi
fi
else
MILTERPATH=$PHP_MILTER
fi
SAPI_MILTER_PATH=sapi/milter/php-milter
PHP_BUILD_THREAD_SAFE
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/milter/Makefile.frag,$abs_srcdir/sapi/milter,sapi/milter)
PHP_SELECT_SAPI(milter, program, php_milter.c getopt.c,,'$(SAPI_MILTER_PATH)')
PHP_ADD_LIBRARY_WITH_PATH(milter, $MILTERPATH,)
BUILD_MILTER="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_MILTER_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_MILTER_PATH)"
PHP_SUBST(SAPI_MILTER_PATH)
PHP_SUBST(BUILD_MILTER)
fi

View File

@ -1,173 +0,0 @@
/* Borrowed from Apache NT Port */
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "php_getopt.h"
#define OPTERRCOLON (1)
#define OPTERRNF (2)
#define OPTERRARG (3)
char *ap_php_optarg;
int ap_php_optind = 1;
static int ap_php_opterr = 1;
static int
ap_php_optiserr(int argc, char * const *argv, int oint, const char *optstr,
int optchr, int err)
{
if (ap_php_opterr)
{
fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
switch(err)
{
case OPTERRCOLON:
fprintf(stderr, ": in flags\n");
break;
case OPTERRNF:
fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
break;
case OPTERRARG:
fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
break;
default:
fprintf(stderr, "unknown\n");
break;
}
}
return('?');
}
int ap_php_getopt(int argc, char* const *argv, const char *optstr)
{
static int optchr = 0;
static int dash = 0; /* have already seen the - */
char *cp;
if (ap_php_optind >= argc)
return(EOF);
if (!dash && (argv[ap_php_optind][0] != '-'))
return(EOF);
if (!dash && (argv[ap_php_optind][0] == '-') && !argv[ap_php_optind][1])
{
/*
* use to specify stdin. Need to let pgm process this and
* the following args
*/
return(EOF);
}
if ((argv[ap_php_optind][0] == '-') && (argv[ap_php_optind][1] == '-'))
{
/* -- indicates end of args */
ap_php_optind++;
return(EOF);
}
if (!dash)
{
assert((argv[ap_php_optind][0] == '-') && argv[ap_php_optind][1]);
dash = 1;
optchr = 1;
}
/* Check if the guy tries to do a -: kind of flag */
assert(dash);
if (argv[ap_php_optind][optchr] == ':')
{
dash = 0;
ap_php_optind++;
return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRCOLON));
}
if (!(cp = strchr(optstr, argv[ap_php_optind][optchr])))
{
int errind = ap_php_optind;
int errchr = optchr;
if (!argv[ap_php_optind][optchr+1])
{
dash = 0;
ap_php_optind++;
}
else
optchr++;
return(ap_php_optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
}
if (cp[1] == ':')
{
/* Check for cases where the value of the argument
is in the form -<arg> <val> or in the form -<arg><val> */
dash = 0;
if(!argv[ap_php_optind][2]) {
ap_php_optind++;
if (ap_php_optind == argc)
return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRARG));
ap_php_optarg = argv[ap_php_optind++];
}
else
{
ap_php_optarg = &argv[ap_php_optind][2];
ap_php_optind++;
}
return(*cp);
}
else
{
if (!argv[ap_php_optind][optchr+1])
{
dash = 0;
ap_php_optind++;
}
else
optchr++;
return(*cp);
}
assert(0);
return(0); /* never reached */
}
#ifdef TESTGETOPT
int
main (int argc, char **argv)
{
int c;
extern char *ap_php_optarg;
extern int ap_php_optind;
int aflg = 0;
int bflg = 0;
int errflg = 0;
char *ofile = NULL;
while ((c = ap_php_getopt(argc, argv, "abo:")) != EOF)
switch (c) {
case 'a':
if (bflg)
errflg++;
else
aflg++;
break;
case 'b':
if (aflg)
errflg++;
else
bflg++;
break;
case 'o':
ofile = ap_php_optarg;
(void)printf("ofile = %s\n", ofile);
break;
case '?':
errflg++;
}
if (errflg) {
(void)fprintf(stderr,
"usage: cmd [-a|-b] [-o <filename>] files...\n");
exit (2);
}
for ( ; ap_php_optind < argc; ap_php_optind++)
(void)printf("%s\n", argv[ap_php_optind]);
return 0;
}
#endif /* TESTGETOPT */

View File

@ -1,132 +0,0 @@
<?php
/**
* example milter script
*
* run: php-milter -D -p /path/to/sock milter.php
*
* for details on how to set up sendmail and configure the milter see
* http://www.sendmail.com/partner/resources/development/milter_api/
*
* for api details see
* http://www.sendmail.com/partner/resources/development/milter_api/api.html
*
* below is a list of all callbacks, that are available through the milter sapi,
* if you leave one or more out they simply won't get called (e.g. if you secify an
* empty php file, the milter would do nothing :)
*/
/**
* this function is called once on sapi startup,
* here you can specify the actions the filter may take
*
* see http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
*/
function milter_log($msg)
{
$GLOBALS['log'] = fopen("/tmp/milter.log", "a");
fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
fclose($GLOBALS['log']);
}
function milter_init() {
milter_log("-- startup --");
milter_log("milter_init()");
smfi_setflags(SMFIF_ADDHDRS);
}
/**
* is called once, at the start of each SMTP connection
*/
function milter_connect($connect)
{
milter_log("milter_connect('$connect')");
}
/**
* is called whenever the client sends a HELO/EHLO command.
* It may therefore be called between zero and three times.
*/
function milter_helo($helo)
{
milter_log("milter_helo('$helo')");
}
/**
* is called once at the beginning of each message,
* before milter_envrcpt.
*/
function milter_envfrom($args)
{
milter_log("milter_envfrom(args[])");
foreach ($args as $ix => $arg) {
milter_log("\targs[$ix] = $arg");
}
}
/**
* is called once per recipient, hence one or more times per message,
* immediately after milter_envfrom
*/
function milter_envrcpt($args)
{
milter_log("milter_envrcpt(args[])");
foreach ($args as $ix => $arg) {
milter_log("\targs[$ix] = $arg");
}
}
/**
* is called zero or more times between milter_envrcpt and milter_eoh,
* once per message header
*/
function milter_header($header, $value)
{
milter_log("milter_header('$header', '$value')");
}
/**
* is called once after all headers have been sent and processed.
*/
function milter_eoh()
{
milter_log("milter_eoh()");
}
/**
* is called zero or more times between milter_eoh and milter_eom.
*/
function milter_body($bodypart)
{
milter_log("milter_body('$bodypart')");
}
/**
* is called once after all calls to milter_body for a given message.
* most of the api functions, that alter the message can only be called
* within this callback.
*/
function milter_eom()
{
milter_log("milter_eom()");
/* add PHP header to the message */
smfi_addheader("X-PHP", phpversion());
}
/**
* may be called at any time during message processing
* (i.e. between some message-oriented routine and milter_eom).
*/
function milter_abort()
{
milter_log("milter_abort()");
}
/**
* is always called once at the end of each connection.
*/
function milter_close()
{
milter_log("milter_close()");
}
?>

View File

@ -1,7 +0,0 @@
/* Borrowed from Apache NT Port */
#include "php.h"
extern char *ap_php_optarg;
extern int ap_php_optind;
int ap_php_getopt(int argc, char* const *argv, const char *optstr);

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
#ifndef PHP_MILTER_H
#define PHP_MILTER_H
#include "libmilter/mfapi.h"
#define MLFI_NONE 0
#define MLFI_CONNECT 1
#define MLFI_HELO 2
#define MLFI_ENVFROM 3
#define MLFI_ENVRCPT 4
#define MLFI_HEADER 5
#define MLFI_EOH 6
#define MLFI_BODY 7
#define MLFI_EOM 8
#define MLFI_ABORT 9
#define MLFI_CLOSE 10
#define MLFI_INIT 11
#define MG(v) TSRMG(milter_globals_id, zend_milter_globals *, v)
typedef struct {
pthread_t thread;
MUTEX_T receiver;
MUTEX_T sender;
SMFICTX *ctx;
sfsistat retval;
int message;
void **args;
} worker_thread;
#endif