[PREVIOUS CHAPTER] [______TOC_______]

Appendix A C Wrapper

    Appendix A.1	C wrapper (when :include: does not work)

    When :include: statement does not work e.g. on old sendmail, you can
    use C wrapper. C wrapper uses setuid(). Please pay attention to use
    it.

    makefml newml creates examples of C wrappers, fmlwrapper.c, . "make"
    in $DIR.  Please check them and compile it under the ML's owner (NOT
    POSIX). On POSIX or not, please see the following sections. fmlwrapper.c is
    for delivery program,  is for command program.

    Example:

    	% cd /var/spool/ml/elena
    	% make fml
    	cc  -o fml fmlwrapper.c
    	chmod 4755 fml
    	cc  -DCTLADDR -o fml-ctl fmlwrapper.c
    	chmod 4755 fml-ctl

    (It is preferable to do "chmod 4555")

    After compiling, install fml, fml-c to somewhere only root can access.

    * Description

    [fmlwrapper.c]

      execl("_EXEC_DIR_/fml.pl", /* where is fml.pl */
    	"(fml)",
    	"_ML_DIR_/_ML_", /* where is config.ph */
    	"_EXEC_DIR_", /* library of fml package */
    #ifdef CTLADDR
    	"--ctladdr", /* --ctladdr, command mode */
    #endif
    	NULL);

      exit(0);

    Appendix A.2	C wrapper program fml on 4.3BSD

    If :include: statement is not used, you can use C wrapper program.
    C wrapper does setuid() and runs

    	/usr/local/fml/fml.pl $DIR $LIBDIR

    You can create C wrapper programs by

    	% make fml

    Please see previous sections.

    Appendix B.1	:include: file

    How to kick off "fml.pl" is

    	fml.pl $DIR $LIBDIR

    	$DIR	"ML's HOME directory, location of config.ph and so on
    	$LIBDIR	library path (if needed)

    MTA runs this command and injects mail to it. That is

    	| fml.pl $DIR $LIBDIR

    Consider Elena mailing list setting. Sendmail reads the content of
    /var/spool/ml/Elena/include (file to include) and checks the owner of
    the file. Sendmail runs "|/usr/local/fml/fml.pl /var/spool/ml/elena "
    (precisely e.g. sh -c "|/usr/local/fml/fml.pl /var/spool/ml/elena ")
    as the owner process and passes mail for Elena to it.

       [/etc/aliases]

    	Elena: :include:/var/spool/ml/Elena/include
    	owner-Elena: fukachan
    	Elena-request: fukachan
    	Elena-admin: fukachan

       [/var/spool/ml/Elena/include]

    	"|/usr/local/fml/fml.pl /var/spool/ml/elena "

    Please see ../troubleshoot 10.0 for OS dependence.