patch-spampd 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. $OpenBSD: patch-spampd,v 1.3 2014/11/27 12:37:29 ajacoutot Exp $
  2. https://github.com/mpaperno/spampd/commit/1fe20e4c0f06760eb341b519c32954bfc9ef7a15
  3. https://github.com/mpaperno/spampd/commit/9088ae52b6fc6dcf4bc1b2d19109166b4f76c66a
  4. https://github.com/mpaperno/spampd/commit/7706c364d19f630ba7fbc8681f6e75282d60a73f
  5. https://github.com/mpaperno/spampd/commit/e472b7b8f39f69ec20c81eaaf42c7fbfb9c703dd
  6. --- spampd.orig Wed Nov 26 09:56:25 2014
  7. +++ spampd Wed Nov 26 09:56:09 2014
  8. @@ -752,8 +752,8 @@ my $childtimeout = 6*60; # child process per-command t
  9. my $satimeout = 285; # SpamAssassin timeout in seconds (15s less than Postfix
  10. # default for smtp_data_done_timeout)
  11. my $pidfile = '/var/run/spampd.pid'; # write pid to file
  12. -my $user = 'mail'; # user to run as
  13. -my $group = 'mail'; # group to run as
  14. +my $user = '_spampd'; # user to run as
  15. +my $group = '_spampd'; # group to run as
  16. my $tagall = 0; # mark-up all msgs with SA, not just spam
  17. my $maxsize = 64; # max. msg size to scan with SA, in KB.
  18. my $rh = 0; # log which rules were hit
  19. @@ -824,6 +824,20 @@ if ( $logsock !~ /^(unix|inet)$/ ) {
  20. usage(0);
  21. }
  22. +# Untaint some options provided by admin command line.
  23. +$logsock = $1 if $logsock =~ /^(.*)$/;
  24. +
  25. +$pidfile = $1 if $pidfile =~ /^(.*)$/;
  26. +
  27. +$relayhost = $1 if $relayhost =~ /^(.*)$/;
  28. +
  29. +$relayport = $1 if $relayport =~ /^(.*)$/;
  30. +
  31. +$host = $1 if $host =~ /^(.*)$/;
  32. +
  33. +$port = $1 if $port =~ /^(.*)$/;
  34. +#
  35. +
  36. if ( $options{tagall} ) { $tagall = 1; }
  37. if ( $options{'log-rules-hit'} ) { $rh = 1; }
  38. if ( $options{debug} ) { $debug = 1; $nsloglevel = 4; }
  39. @@ -849,6 +863,7 @@ if ( $tmp[1] ) { $port = $tmp[1]; }
  40. my $assassin = Mail::SpamAssassin->new({
  41. 'dont_copy_prefs' => 1,
  42. 'debug' => $debug,
  43. + 'user_dir' => (getpwnam($user))[7],
  44. 'local_tests_only' => $options{'local-only'} || 0 });
  45. $options{'auto-whitelist'} and eval {
  46. @@ -942,9 +957,9 @@ Options:
  47. --pid=filename Store the daemon's process ID in this file.
  48. Default is /var/run/spampd.pid
  49. --user=username Specifies the user that the daemon runs as.
  50. - Default is mail.
  51. + Default is _spampd.
  52. --group=groupname Specifies the group that the daemon runs as.
  53. - Default is mail.
  54. + Default is _spampd.
  55. --nodetach Don't detach from the console and fork into
  56. background. Useful for some daemon control
  57. tools or when running as a win32 service
  58. @@ -1075,10 +1090,10 @@ L<http://www.WorldDesign.com/index.cfm/rd/mta/spampd.h
  59. =head1 Requires
  60. -=over 5
  61. -
  62. Perl modules:
  63. +=over 5
  64. +
  65. =item B<Mail::SpamAssassin>
  66. =item B<Net::Server::PreForkSimple>
  67. @@ -1249,7 +1264,7 @@ alternate to using the above --relayhost=ip:port notat
  68. =item B<--group=groupname> or B<--g=groupname>
  69. Specifies the user and group that the proxy will run as. Default is
  70. -I<mail>/I<mail>.
  71. +I<_spampd>/I<_spampd>.
  72. =item B<--children=n> or B<--c=n>
  73. @@ -1299,7 +1314,7 @@ Default is 285 seconds.
  74. Specifies a filename where I<spampd> will write its process ID so
  75. that it is easy to kill it later. The directory that will contain this
  76. -file must be writable by the I<spampd> user. The default is
  77. +file must be writable by the I<_spampd> user. The default is
  78. F</var/run/spampd.pid>.
  79. =item B<--logsock=unix or inet> C<(new in v2.20)>
  80. @@ -1390,10 +1405,10 @@ Prints usage information.
  81. =head2 Deprecated Options
  82. -=over 5
  83. -
  84. The following options are no longer used but still accepted for backwards
  85. compatibility with prevoius I<spampd> versions:
  86. +
  87. +=over 5
  88. =item B<--dead-letters>