[PREVIOUS CHAPTER] [NEXT CHAPTER]

Appendix A C Wrapper

    Appendix A.1	C wrapper (:include: $B$,;H$($J$$>l9g(B)

    :include: $B9=J8$,;H$($J$$(B OS $B$b$7$/$O8E$$(B sendmail $B$N>l9g$O(B C wrapper
    $B$r;H$&I,MW$,$"$j$^$9!#(B
    C wrapper $B$O(B setuid $B$7$F;H$$$^$9!#(Bsetuid $B$5$l$?(B program $B$N0z?t$G(Bfml.pl
    $B$rEO$9$H$+$$$&$3$H$O$7$F$O$$$1$^$;$s!#(B
    $B!t$=$&$$$&$3$H$r$9$k309q$N%=%U%H$,$"$k$h$&$G$9$,!D2?9M$($F$k$s$@$m(B

    makefml newml $B$9$k$H8+K\$N(B fmlwrapper.c $B$r:n$C$F$/$l$F$$$k$N$G$=$l$r(B
    compile $B$7$F!"(Bfml-wrapper $B:n$r$j$^$9(B($DIR$B$G(Bmake)$B!#(B fml-ctl-wrapper $B$O(B
    listname-ctl $BMQ$G$9!#(B
    fmlwrapper.c $B$O4D6-$KJ;$;$FJQ99$5$l$F$$$^$9$,0l1~3NG'$O$7$F$_$F$/$@$5$$!#(B
    fmlwrapper.c $B$K$O@\(B edit
    $B$7$F2<$5$$!#(B

    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")

    $B:n@.8e(B fml, fml-ctl $B$r(Broot $B$7$+=q$1$J$$>l=j$X%$%s%9%H!<%k!#(B

    [²òÀâ]

    fmlwrapper.c $B$NFbMF$O(B

    	fml.pl$B$N>l=j(B   config.ph$B$N$"$k>l=j(B   $B%i%$%V%i%j$N>l=j(B

    $B$r(B exec $B$9$k(B C $B$N(B program $B$H$$$&$@$1$N$b$N$G$9!#$h$&$9$k$K(B include $B%U%!(B
    $B%$%k$NCf$G$d$k$3$H$HF1$8$3$H$r=q$-$^$9!#$A$,$&$N$O(B setuid() $B$r$9$k$N$,(B
    sendmail $B$G$O$J$/$3$N(B fmlwrapper.c $B$G$"$k$3$H$@$1$G$9!#(B

    $BNc!'(B fmlwrapper.c

    execl("/usr/local/fml/fml.pl", /* $BK\BN(B fml.pl $B$O$I$3!)(B */
          "(fml)",
          "/var/spool/ml/Elena",   /* config.ph $B$O(B $B$I$3!)(B */
          "/usr/local/fml",        /* fml package $B$N(B library $B$O$I$3!)(B */
          NULL);

    fml-ctl-wrapper $B$G$O(B
    execl("/usr/local/fml/fml.pl", /* $BK\BN(B fml.pl $B$O$I$3!)(B */
          "(fml)",
          "/var/spool/ml/Elena",   /* config.ph $B$O(B $B$I$3!)(B */
          "/usr/local/fml",        /* fml package $B$N(B library $B$O$I$3!)(B */
          "--ctladdr",             /* --ctladdr == $B%3%^%s%I%b!<%I(B */
          NULL);

    $B$K$J$j$^$9!#(Blistname-ctl $B$NJ}$K$O(B fml-ctl $B$r@_Dj$7$^$9!#(B

    Appendix A.2	C wrapper program fml on 4.3BSD

    :include: $B9=J8$,;H$($J$$;~$O!"(Bsetuid $B$5$l$?(B fml $B$H$$$&(B C $B$N(B wrapper
    program $B$r7PM3$7$F(B

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

    $B$r

    [PREVIOUS CHAPTER]
     [NEXT CHAPTER]