<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>194862</bug_id>
          
          <creation_ts>2007-10-05 23:42 0000</creation_ts>
          <short_desc>net-mail/mailman/mailman-2.1.9-r2 - make mailman user configurable</short_desc>
          <delta_ts>2007-11-29 09:47:26 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P5</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>sebastian@nanofortnight.org</reporter>
          <assigned_to>hanno@gentoo.org</assigned_to>
          <cc>hansmi@gentoo.org</cc>
    
    <cc>sebastian@nanofortnight.org</cc>

      

      
          <long_desc isprivate="0">
            <who>sebastian@nanofortnight.org</who>
            <bug_when>2007-10-05 23:42:18 0000</bug_when>
            <thetext>Is it possible to change the user &quot;mailman&quot; to a variable like we did it for VAR_PREFIX, CGIGID and MAILGID, too?
Because we would like to change VAR_PREFIX to a home directory of another user and then it would be great that portage doesn&apos;t create another mailman user.
I have got a test installation and it works great.

If you accept my suggestion, it would be necessary to change files/mailman.rc 
You can easily change to the new mailman user, but then please use the full path in the ebuild.


Another point is the line 67 in /usr/lib/mailman/bin/qmail-to-mailman.py:
&quot;local = re.sub(&quot;^mailman-&quot;,&quot;&quot;,local)&quot;
You strip there only the mailman user, but if we&apos;ve change to another user than mailman it would be better to use:
&quot;local = re.sub(&quot;^&quot; + os.environ[&apos;USER&apos;] + &quot;-&quot;,&quot;&quot;,local)&quot;


Hanno, thanks a lot for your help. :-)
If you&apos;ve got any questions feel free to ask me.


With the changes above it works for me very well.

Reproducible: Always</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>hansmi@gentoo.org</who>
            <bug_when>2007-10-06 08:56:50 0000</bug_when>
            <thetext>(In reply to comment #0)
&gt; Another point is the line 67 in /usr/lib/mailman/bin/qmail-to-mailman.py:
&gt; &quot;local = re.sub(&quot;^mailman-&quot;,&quot;&quot;,local)&quot;
&gt; You strip there only the mailman user, but if we&apos;ve change to another user than
&gt; mailman it would be better to use:
&gt; &quot;local = re.sub(&quot;^&quot; + os.environ[&apos;USER&apos;] + &quot;-&quot;,&quot;&quot;,local)&quot;

This creates a potential security problem. Please use re.escape(os.environ[&quot;USER&quot;]) at least.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sebastian@nanofortnight.org</who>
            <bug_when>2007-10-22 14:05:37 0000</bug_when>
            <thetext>
--- mailman-2.1.9-r2.ebuild     2007-10-22 10:10:22.000000000 +0000
+++ mailman-2.1.9-r100.ebuild   2007-10-22 14:03:58.000000000 +0000
@@ -22,15 +22,17 @@
        INSTALLDIR=${MAILMAN_PREFIX:-&quot;/usr/lib/mailman&quot;}
        VAR_PREFIX=${MAILMAN_VAR_PREFIX:-&quot;/var/lib/mailman&quot;}
        CGIGID=${MAILMAN_CGIGID:-81}
-       MAILGID=${MAILMAN_MAILGID:-280}
        MAILUSR=${MAILMAN_MAILUSR:-mailman}
        MAILUID=${MAILMAN_MAILUID:-280}
+       MAILGRP=${MAILMAN_MAILGRP:mailman}
+       MAILGID=${MAILMAN_MAILGID:-280}
+
 
        # Bug #58526: switch to enew{group,user}.
        # need to add mailman here for compile process.
        # Duplicated at pkg_postinst() for binary install.
-       enewgroup mailman 280
-       enewuser ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman -G cron -c ${MAILUSR}
+       enewgroup ${MAILGRP} ${MAILGID}
+       enewuser  ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
 }
 
 src_unpack() {
@@ -45,6 +47,8 @@
                --with-mail-gid=${MAILGID} \
                --with-cgi-gid=${CGIGID} \
                --with-var-prefix=${VAR_PREFIX} \
+               --with-username=${MAILUSR} \
+               --with-groupname=${MAILGRP} \
        || die &quot;configure failed&quot;
 
        emake || die &quot;make failed&quot;
@@ -88,7 +92,7 @@
        keepdir ${VAR_PREFIX}/lists
        keepdir ${VAR_PREFIX}/qfiles
 
-       chown -R mailman:mailman ${D}/${VAR_PREFIX} ${D}/${INSTALLDIR} ${D}/etc/mailman/*
+       chown -R ${MAILUSR}:${MAILGRP} ${D}/${VAR_PREFIX} ${D}/${INSTALLDIR} ${D}/etc/mailman/*
        chmod 2775 ${D}/${INSTALLDIR} ${D}/${INSTALLDIR}/templates/* \
                ${D}/${INSTALLDIR}/messages/* ${D}/${VAR_PREFIX} ${D}/${VAR_PREFIX}/{logs,lists,spam,locks,archives/public}
        chmod 2750 ${D}/${VAR_PREFIX}/archives/private
@@ -100,8 +104,8 @@
 pkg_postinst() {
        python_mod_optimize ${INSTALLDIR}/bin/ ${INSTALLDIR}/Mailman
 
-       enewgroup mailman 280
-       enewuser mailman 280 -1 ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
+       enewgroup ${MAILGRP} ${MAILGID}
+       enewuser  ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
        elog
        elog &quot;Please read /usr/share/doc/${PF}/README.gentoo.gz for additional&quot;
        elog &quot;Setup information, mailman will NOT run unless you follow&quot;
@@ -120,6 +124,9 @@
        ewarn &quot;MAILMAN_INSTALLDIR (default: /usr/lib/mailman)&quot;
        ewarn &quot;MAILMAN_VAR_PREFIX (default: /var/lib/mailman)&quot;
        ewarn &quot;MAILMAN_CGIGID (default: 81)&quot;
+       ewarn &quot;MAILMAN_MAILUSR (default: mailman)&quot;
+       ewarn &quot;MAILMAN_MAILUID (default: 280)&quot;
+       ewarn &quot;MAILMAN_MAILGRP (default: mailman)&quot;
        ewarn &quot;MAILMAN_MAILGID (default: 280)&quot;
        ewarn
        ewarn &quot;Config file is now symlinked in /etc/mailman, so etc-update works.&quot;


This could be help to change the mailman-user and mailman-group easily with some meta variables. It is tested and seems to work at least for me.


Sebastian &apos;kickino&apos; Wieseler</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sebastian@nanofortnight.org</who>
            <bug_when>2007-10-22 14:08:49 0000</bug_when>
            <thetext>
--- /usr/portage/net-mail/mailman/mailman-2.1.9-r2.ebuild       2007-09-28 07:36:11.000000000 +0000
+++ mailman-2.1.9-r100.ebuild     2007-10-22 14:08:21.000000000 +0000
@@ -22,13 +22,17 @@
        INSTALLDIR=${MAILMAN_PREFIX:-&quot;/usr/lib/mailman&quot;}
        VAR_PREFIX=${MAILMAN_VAR_PREFIX:-&quot;/var/lib/mailman&quot;}
        CGIGID=${MAILMAN_CGIGID:-81}
+       MAILUSR=${MAILMAN_MAILUSR:-mailman}
+       MAILUID=${MAILMAN_MAILUID:-280}
+       MAILGRP=${MAILMAN_MAILGRP:-mailman}
        MAILGID=${MAILMAN_MAILGID:-280}
 
+
        # Bug #58526: switch to enew{group,user}.
        # need to add mailman here for compile process.
        # Duplicated at pkg_postinst() for binary install.
-       enewgroup mailman 280
-       enewuser mailman 280 /bin/bash ${INSTALLDIR} mailman -G cron -c mailman
+       enewgroup ${MAILGRP} ${MAILGID}
+       enewuser  ${MAILUSR} ${MAILUID} /bin/bash ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
 }
 
 src_unpack() {
@@ -43,6 +47,8 @@
                --with-mail-gid=${MAILGID} \
                --with-cgi-gid=${CGIGID} \
                --with-var-prefix=${VAR_PREFIX} \
+               --with-username=${MAILUSR} \
+               --with-groupname=${MAILGRP} \
        || die &quot;configure failed&quot;
 
        emake || die &quot;make failed&quot;
@@ -86,7 +92,7 @@
        keepdir ${VAR_PREFIX}/lists
        keepdir ${VAR_PREFIX}/qfiles
 
-       chown -R mailman:mailman ${D}/${VAR_PREFIX} ${D}/${INSTALLDIR} ${D}/etc/mailman/*
+       chown -R ${MAILUSR}:${MAILGRP} ${D}/${VAR_PREFIX} ${D}/${INSTALLDIR} ${D}/etc/mailman/*
        chmod 2775 ${D}/${INSTALLDIR} ${D}/${INSTALLDIR}/templates/* \
                ${D}/${INSTALLDIR}/messages/* ${D}/${VAR_PREFIX} ${D}/${VAR_PREFIX}/{logs,lists,spam,locks,archives/public}
        chmod 2750 ${D}/${VAR_PREFIX}/archives/private
@@ -98,8 +104,8 @@
 pkg_postinst() {
        python_mod_optimize ${INSTALLDIR}/bin/ ${INSTALLDIR}/Mailman
 
-       enewgroup mailman 280
-       enewuser mailman 280 -1 ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
+       enewgroup ${MAILGRP} ${MAILGID}
+       enewuser  ${MAILUSR} ${MAILUID} -1 ${INSTALLDIR} mailman -G cron -c &quot;mailman&quot;
        elog
        elog &quot;Please read /usr/share/doc/${PF}/README.gentoo.gz for additional&quot;
        elog &quot;Setup information, mailman will NOT run unless you follow&quot;
@@ -118,6 +124,9 @@
        ewarn &quot;MAILMAN_INSTALLDIR (default: /usr/lib/mailman)&quot;
        ewarn &quot;MAILMAN_VAR_PREFIX (default: /var/lib/mailman)&quot;
        ewarn &quot;MAILMAN_CGIGID (default: 81)&quot;
+       ewarn &quot;MAILMAN_MAILUSR (default: mailman)&quot;
+       ewarn &quot;MAILMAN_MAILUID (default: 280)&quot;
+       ewarn &quot;MAILMAN_MAILGRP (default: mailman)&quot;
        ewarn &quot;MAILMAN_MAILGID (default: 280)&quot;
        ewarn
        ewarn &quot;Config file is now symlinked in /etc/mailman, so etc-update works.&quot;


Fixed some things.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sebastian@nanofortnight.org</who>
            <bug_when>2007-10-22 17:06:00 0000</bug_when>
            <thetext>Created an attachment (id=134121)
diff as attachment (maybe prefered?) - mailman user and group configurable

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>hanno@gentoo.org</who>
            <bug_when>2007-11-26 02:25:11 0000</bug_when>
            <thetext>ebuild changes committed, thanks.

About the qmail-to-mailman-script, can you make the patch secure and send it upstream?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>sebastian@nanofortnight.org</who>
            <bug_when>2007-11-29 09:47:26 0000</bug_when>
            <thetext>(In reply to comment #5)
&gt; About the qmail-to-mailman-script, can you make the patch secure and send it
&gt; upstream?

I did. But qmail-to-mailman isn&apos;t maintained by the mailman team but from a third party. I mailed my patch to the programmer but no respone since some weeks. :-/</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>134121</attachid>
            <date>2007-10-22 17:06 0000</date>
            <desc>diff as attachment (maybe prefered?) - mailman user and group configurable</desc>
            <filename>mailman-usr-grp.diff</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIC91c3IvcG9ydGFnZS9uZXQtbWFpbC9tYWlsbWFuL21haWxtYW4tMi4xLjktcjIuZWJ1aWxk
CTIwMDctMDktMjggMDc6MzY6MTEuMDAwMDAwMDAwICswMDAwCisrKyBtYWlsbWFuLTIuMS45LXIz
LmVidWlsZAkyMDA3LTEwLTIyIDE0OjA4OjIxLjAwMDAwMDAwMCArMDAwMApAQCAtMjIsMTMgKzIy
LDE3IEBACiAJSU5TVEFMTERJUj0ke01BSUxNQU5fUFJFRklYOi0iL3Vzci9saWIvbWFpbG1hbiJ9
CiAJVkFSX1BSRUZJWD0ke01BSUxNQU5fVkFSX1BSRUZJWDotIi92YXIvbGliL21haWxtYW4ifQog
CUNHSUdJRD0ke01BSUxNQU5fQ0dJR0lEOi04MX0KKwlNQUlMVVNSPSR7TUFJTE1BTl9NQUlMVVNS
Oi1tYWlsbWFufQorCU1BSUxVSUQ9JHtNQUlMTUFOX01BSUxVSUQ6LTI4MH0KKwlNQUlMR1JQPSR7
TUFJTE1BTl9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