OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael van Elst
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   27-Jan-2003 17:19:28
  Branch: HEAD                             Handle: 2003012716192700

  Added files:
    openpkg-src/rt          rt-mailgate.c
  Modified files:
    openpkg-src/rt          rc.rt rt.spec

  Log:
    added suid-wrapper for mailgate

  Summary:
    Revision    Changes     Path
    1.3         +1  -0      openpkg-src/rt/rc.rt
    1.1         +21 -0      openpkg-src/rt/rt-mailgate.c
    1.20        +29 -6      openpkg-src/rt/rt.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/rt/rc.rt
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 rc.rt
  --- openpkg-src/rt/rc.rt      27 Jan 2003 12:43:19 -0000      1.2
  +++ openpkg-src/rt/rc.rt      27 Jan 2003 16:19:27 -0000      1.3
  @@ -32,6 +32,7 @@
   %restart -u root
       opServiceEnabled rt || exit 0
       ${rt_apachectl} stop
  +    sleep 2
       ${rt_apachectl} start
   
   %daily -u root
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/rt/rt-mailgate.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1 rt-mailgate.c
  --- /dev/null 2003-01-27 17:19:28.000000000 +0100
  +++ rt-mailgate.c     2003-01-27 17:19:28.000000000 +0100
  @@ -0,0 +1,21 @@
  +#include <sys/types.h>
  +#include <unistd.h>
  +
  +#define DIR  "@l_prefix@/libexec/rt"
  +#define PROG "@l_prefix@/libexec/rt/tools/rt-mailgate"
  +
  +int main(int argc, char *argv[])
  +{
  +    static char *const myenv[] = {
  +        "PATH=/bin:/usr/bin",
  +        NULL
  +    };
  +
  +    if (chdir(DIR) == -1) {
  +        perror("chdir");
  +        exit(1);
  +    }
  +
  +    execve(PROG, argv, myenv);
  +}
  +
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/rt/rt.spec
  ============================================================================
  $ cvs diff -u -r1.19 -r1.20 rt.spec
  --- openpkg-src/rt/rt.spec    27 Jan 2003 12:43:19 -0000      1.19
  +++ openpkg-src/rt/rt.spec    27 Jan 2003 16:19:27 -0000      1.20
  @@ -51,18 +51,21 @@
   Source6:      rtcleanup
   Source7:      rtupgrade
   Source8:      rtapachectl
  +Source9:      rt-mailgate.c
   
   #   build information
   Prefix:       %{l_prefix}
   BuildRoot:    %{l_buildroot}
   BuildPreReq:  OpenPKG, openpkg >= 20020206, perl, perl-openpkg
  -BuildPreReq:  perl-sys, perl-util, perl-ds, perl-text
  +BuildPreReq:  perl-sys, perl-util, perl-ds, perl-text, perl-apache
   BuildPreReq:  perl-dbi, perl-dbix, perl-mail, perl-www
  +BuildPreReq:  apache, apache::with_mod_perl = yes
   PreReq:       OpenPKG, openpkg >= 20020206, perl, perl-openpkg,
  -PreReq:       MTA, MYSQL, apache, apache::with_mod_perl = yes, perl-apache
  -PreReq:       perl-sys, perl-util, perl-ds, perl-text
  +PreReq:       perl-sys, perl-util, perl-ds, perl-text, perl-apache
   PreReq:       perl-dbi, perl-dbix, perl-mail, perl-www
  -PreReq:       perl-dbi::with_dbd_mysql = yes
  +PreReq:       apache, apache::with_mod_perl = yes
  +PreReq:       MYSQL, perl-dbi::with_dbd_mysql = yes
  +PreReq:       MTA
   AutoReq:      no
   AutoReqProv:  no
   
  @@ -82,6 +85,18 @@
   %build
       rm -rf $RPM_BUILD_ROOT
   
  +    #   compile SUID wrapper
  +    mkdir suidwrap
  +    ( cd suidwrap
  +      cp %{SOURCE rt-mailgate.c} .
  +      %{l_shtool} subst \
  +        -e 's;@l_prefix@;%{l_prefix};g' \
  +        -e 's;@l_rusr@;%{l_rusr};g' \
  +        -e 's;@l_rgrp@;%{l_rgrp};g' \
  +        rt-mailgate.c
  +      %{l_cc} -o rt-mailgate rt-mailgate.c
  +    )
  +
       #   perform common prolog operations
       rt=%{l_prefix}/libexec/rt
       %{l_prefix}/bin/perl-openpkg prolog
  @@ -250,13 +265,21 @@
       %{l_shtool} mkdir -f -p -m 755 \
           $RPM_BUILD_ROOT%{l_prefix}/var/rt/log
   
  -    # better places ?
  +    # better places
       mv $RPM_BUILD_ROOT%{l_prefix}/etc/rt/insertdata \
          $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools/
  +    mv $RPM_BUILD_ROOT%{l_prefix}/bin/rt-mailgate \
  +       $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools/
  +    %{l_shtool} install -c -s -m 755 \
  +        suidwrap/rt-mailgate \
  +        $RPM_BUILD_ROOT%{l_prefix}/bin/
   
       %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
           %{l_files_std} \
           '%{l_prefix}/libexec/rt' \
  +        '%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/libexec/rt/tools/rt-mailgate' \
  +        '%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/libexec/rt/tools/insertdata' \
  +        '%attr(6755,%{l_rusr},%{l_rgrp}) %{l_prefix}/bin/rt-mailgate' \
           '%attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/rt/config.pm' \
           '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/mason-data' \
           '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/mason-session' \
  @@ -286,6 +309,6 @@
       if [ $1 -eq 0 ]; then
           $RPM_INSTALL_PREFIX/etc/rc rt stop
           rm -f $RPM_INSTALL_PREFIX/var/rt/mason-session/*
  -        rm -f $RPM_INSTALL_PREFIX/var/rt/mason-data/*
  +        rm -f -r $RPM_INSTALL_PREFIX/var/rt/mason-data/*
           rm -f $RPM_INSTALL_PREFIX/var/rt/log/*
       fi
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to