patch-postgrey 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # $OpenBSD: patch-postgrey,v 1.6 2014/08/19 13:54:56 giovanni Exp $
  2. default path/uid/gid changes, plus untaint for Perl 5.18
  3. From 9673b54064691a5b9c295ffea340d8a1f9ee1cb8 Mon Sep 17 00:00:00 2001
  4. From: Yasuhiro KIMURA <yasu@utahime.org>
  5. Date: Sat, 17 Aug 2013 22:05:27 +0900
  6. Subject: [PATCH] Make postgrey work with Perl 5.18
  7. --- postgrey.orig Wed Jun 11 15:13:50 2014
  8. +++ postgrey Sat Jul 12 17:18:21 2014
  9. @@ -23,7 +23,7 @@ use vars qw(@ISA);
  10. @ISA = qw(Net::Server::Multiplex);
  11. my $VERSION = '1.35';
  12. -my $DEFAULT_DBDIR = '/var/spool/postfix/postgrey';
  13. +my $DEFAULT_DBDIR = '/var/db/postgrey';
  14. my $CONFIG_DIR = '/etc/postfix';
  15. sub cidr_parse($)
  16. @@ -551,6 +551,16 @@ sub main()
  17. " followed by 'h' for hours ('6h' for example).\n";
  18. }
  19. }
  20. + # untaint what is given on --pidfile. It is not security sensitive since
  21. + # it is provided by the admin
  22. + if($opt{pidfile}) {
  23. + $opt{pidfile} =~ /^(.*)$/; $opt{pidfile} = $1;
  24. + }
  25. + # untaint what is given on --inet. It is not security sensitive since
  26. + # it is provided by the admin
  27. + if($opt{inet}) {
  28. + $opt{inet} =~ /^(.*)$/; $opt{inet} = $1;
  29. + }
  30. # untaint what is given on --dbdir. It is not security sensitive since
  31. # it is provided by the admin
  32. @@ -595,8 +605,8 @@ sub main()
  33. commandline => [ 'postgrey', @ARGV_saved ],
  34. port => [ $opt{inet} ? $opt{inet} : $opt{unix}."|unix" ],
  35. proto => $opt{inet} ? 'tcp' : 'unix',
  36. - user => $opt{user} || 'postgrey',
  37. - group => $opt{group} || 'nogroup',
  38. + user => $opt{user} || '_postgrey',
  39. + group => $opt{group} || '_postgrey',
  40. dbdir => $opt{dbdir} || $DEFAULT_DBDIR,
  41. setsid => $opt{daemonize} ? 1 : undef,
  42. pid_file => $opt{daemonize} ? $opt{pidfile} : undef,
  43. @@ -804,9 +814,9 @@ B<postgrey> [I<options>...]
  44. -i, --inet=[HOST:]PORT listen on PORT, localhost if HOST is not specified
  45. -d, --daemonize run in the background
  46. --pidfile=PATH put daemon pid into this file
  47. - --user=USER run as USER (default: postgrey)
  48. - --group=GROUP run as group GROUP (default: nogroup)
  49. - --dbdir=PATH put db files in PATH (default: /var/spool/postfix/postgrey)
  50. + --user=USER run as USER (default: _postgrey)
  51. + --group=GROUP run as group GROUP (default: _postgrey)
  52. + --dbdir=PATH put db files in PATH (default: /var/db/postgrey)
  53. --delay=N greylist for N seconds (default: 300)
  54. --max-age=N delete entries older than N days since the last time
  55. that they have been seen (default: 35)