/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz12431-spoolmail.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme10/e-smith-base-5.8.1-bz12431-spoolmail.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri Nov 24 03:27:13 2023 UTC (12 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-base-5_8_1-31_el7_sme, e-smith-base-5_8_1-30_el7_sme, HEAD
* Thu Nov 23 2023 Jean-Philippe Pialasse <tests@pialasse.com> 5.8.1-30.sme
- fix group deletion leaves mail spool file [SME: 12431]

1 jpp 1.1 diff -Nur --no-dereference e-smith-base-5.8.1.old/createlinks e-smith-base-5.8.1/createlinks
2     --- e-smith-base-5.8.1.old/createlinks 2023-11-23 22:07:39.027000000 -0500
3     +++ e-smith-base-5.8.1/createlinks 2023-11-23 22:19:11.493000000 -0500
4     @@ -308,6 +308,7 @@
5     event_link("systemd-journald", $event, "02");
6     event_link("fix-startup", $event, "05");
7     event_link("init-accounts", $event, "05");
8     +event_link("mail-spool-fix", $event, "05");
9     event_link("logrotate-migrate", $event, "06");
10     event_link("rotate_logfiles", $event, "07");
11     event_link("set-hostname", $event, "10");
12     diff -Nur --no-dereference e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/group-delete-unix e-smith-base-5.8.1/root/etc/e-smith/events/actions/group-delete-unix
13     --- e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/group-delete-unix 2013-01-31 10:52:04.000000000 -0500
14     +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/group-delete-unix 2023-11-23 22:10:23.904000000 -0500
15     @@ -51,4 +51,6 @@
16     system("/usr/sbin/cpu", "groupdel", "$groupName") == 0
17     or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group $groupName.\n" );
18    
19     +unless ($x == 255) { unlink("/var/spool/mail/$groupName") or ( $x = 255, warn "Failed to delete /var/spool/mail/$groupName.\n" );}
20     +
21     exit ($x);
22     diff -Nur --no-dereference e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/mail-spool-fix e-smith-base-5.8.1/root/etc/e-smith/events/actions/mail-spool-fix
23     --- e-smith-base-5.8.1.old/root/etc/e-smith/events/actions/mail-spool-fix 1969-12-31 19:00:00.000000000 -0500
24     +++ e-smith-base-5.8.1/root/etc/e-smith/events/actions/mail-spool-fix 2023-11-23 22:16:43.273000000 -0500
25     @@ -0,0 +1,47 @@
26     +#! /bin/bash
27     +
28     +#----------------------------------------------------------------------
29     +# copyright (C) 2023 Koozali SME Server
30     +#
31     +# This program is free software; you can redistribute it and/or modify
32     +# it under the terms of the GNU General Public License as published by
33     +# the Free Software Foundation; either version 2 of the License, or
34     +# (at your option) any later version.
35     +#
36     +# This program is distributed in the hope that it will be useful,
37     +# but WITHOUT ANY WARRANTY; without even the implied warranty of
38     +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39     +# GNU General Public License for more details.
40     +#
41     +# You should have received a copy of the GNU General Public License
42     +# along with this program; if not, write to the Free Software
43     +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44     +#
45     +#----------------------------------------------------------------------
46     +
47     +# fix ownership of spool folder content
48     +pushd /var/spool/mail/ >/dev/null
49     +for file in *; do
50     + if [ ! -f "$file" ]; then
51     + continue
52     + fi
53     + if ( ! `id -u $file 2>/dev/null 1>&2`) ; then
54     + echo "$file user does not exist deleting mail spool file"
55     + rm -f /var/spool/mail/$file
56     + continue
57     + fi
58     + userf=$(stat -c %U /var/spool/mail/$file 2>/dev/null)
59     + if [[ "$userf" != "$file" ]]; then
60     + uidf=$(stat -c %u /var/spool/mail/$file 2>/dev/null)
61     + uiduser=$(id -u $file 2>/dev/null )
62     + # extra step needed if username has an alias eg www=apache
63     + if [[ "$uidf" != "$uiduser" ]]; then
64     + echo "fixing ownership of $file spool mail"
65     + # extra security we want to clean it from sensitive information
66     + echo ""> /var/spool/mail/$file
67     + chown $file /var/spool/mail/$file
68     + fi
69     + fi
70     +done
71     +popd >/dev/null
72     +

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed