View | Details | Raw Unified | Return to bug 1948
Collapse All | Expand All

(-)old/spamd (+47 lines)
Lines 135-140 Link Here
135
# somehow -- untaint the dir to be on the safe side.
135
# somehow -- untaint the dir to be on the safe side.
136
my $ORIG_CWD = Mail::SpamAssassin::Util::untaint_var( Cwd::cwd() );
136
my $ORIG_CWD = Mail::SpamAssassin::Util::untaint_var( Cwd::cwd() );
137
137
138
# Check to see if we want to ignore the spamd.args config file ('klear' config).
139
# Also check to see if a config file was specified, to override the default. 
140
my $cmdline_args_only = 0;
141
my $auto_config_file = 1;
142
foreach (@ARGV) {
143
  $cmdline_args_only = 1 if ($_ =~ /^-k$/);  # don't use long-opts to avoid 'shortening issues'
144
  $auto_config_file = 0 if ($_ =~ /^\@./);
145
  if ($_ =~ /^\@$/) {
146
    warn "There can be no spaces between the @ and the file path in a config file option.\n";
147
    exit 2;
148
  }
149
}
150
151
# Parse the spamd.args config file if Getopt::ArgvFile is available and we
152
# haven't been told to use command line options only.
153
unless ($cmdline_args_only) {
154
  eval { require Getopt::ArgvFile };
155
  unless ($@) {
156
    if ($Getopt::ArgvFile::VERSION >= 1.08) {
157
      # 'justload' Getopt::Argv, otherwise it parses config file hints at hints
158
      #  at compile time, before we can conditionally push one on @ARGV.
159
      use Getopt::ArgvFile justload => 1;
160
      push @ARGV, '@'.$LOCAL_RULES_DIR.'/spamd.args' if $auto_config_file;
161
162
      # Parse available config files.
163
      # Also check calling user's home directory for configuraton file.
164
      Getopt::ArgvFile::argvFile (home => $auto_config_file, startupFilename => 'spamd.args');
165
    }
166
  }
167
}
168
138
# Parse the command line
169
# Parse the command line
139
Getopt::Long::Configure("bundling");
170
Getopt::Long::Configure("bundling");
140
GetOptions(
171
GetOptions(
Lines 150-155 Link Here
150
  'helper-home-dir|H:s'      => \$opt{'home_dir_for_helpers'},
181
  'helper-home-dir|H:s'      => \$opt{'home_dir_for_helpers'},
151
  'help|h'                   => \$opt{'help'},
182
  'help|h'                   => \$opt{'help'},
152
  'ident-timeout=f'          => \$opt{'ident-timeout'},
183
  'ident-timeout=f'          => \$opt{'ident-timeout'},
184
  'k'                        => \$opt{'cmdline-only'},
153
  'ldap-config!'             => \$opt{'ldap-config'},
185
  'ldap-config!'             => \$opt{'ldap-config'},
154
  'listen-ip|ip-address|i:s' => \$opt{'listen-ip'},
186
  'listen-ip|ip-address|i:s' => \$opt{'listen-ip'},
155
  'local!'                   => \$opt{'local'},
187
  'local!'                   => \$opt{'local'},
Lines 1910-1921 Link Here
1910
1942
1911
Options:
1943
Options:
1912
1944
1945
 @/configpath/filename              Override default spamd config file setting
1913
 -c, --create-prefs                 Create user preferences files
1946
 -c, --create-prefs                 Create user preferences files
1914
 -C path, --configpath=path         Path for default config files
1947
 -C path, --configpath=path         Path for default config files
1915
 --siteconfigpath=path              Path for site configs
1948
 --siteconfigpath=path              Path for site configs
1916
 -d, --daemonize                    Daemonize
1949
 -d, --daemonize                    Daemonize
1917
 -h, --help                         Print usage message.
1950
 -h, --help                         Print usage message.
1918
 -i [ipaddr], --listen-ip=ipaddr    Listen on the IP ipaddr
1951
 -i [ipaddr], --listen-ip=ipaddr    Listen on the IP ipaddr
1952
 -k                                 Prevent the use of spamd config files
1919
 -p port, --port                    Listen on specified port
1953
 -p port, --port                    Listen on specified port
1920
 -m num, --max-children=num         Allow maximum num children
1954
 -m num, --max-children=num         Allow maximum num children
1921
 --max-conn-per-child=num	    Maximum connections accepted by child 
1955
 --max-conn-per-child=num	    Maximum connections accepted by child 
Lines 1980-1985 Link Here
1980
2014
1981
=over 4
2015
=over 4
1982
2016
2017
=item B<@/configpath/filename>
2018
2019
Override the spamd configuration file setting.  A full file path must be used.
2020
There must be no spaces between the @ and the file path.
2021
2022
This option may be used multiple times to specify that multiple configuration
2023
files be used.
2024
2025
=item B<-k>
2026
2027
Prevent command line specified and default spamd configuration files from
2028
being used.
2029
1983
=item B<-c>, B<--create-prefs>
2030
=item B<-c>, B<--create-prefs>
1984
2031
1985
Create user preferences files if they don't exist (default: don't).
2032
Create user preferences files if they don't exist (default: don't).

Return to bug 1948