You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/12/17 03:34:33 UTC

svn commit: r357278 - /spamassassin/trunk/sa-update.raw

Author: jm
Date: Fri Dec 16 18:34:26 2005
New Revision: 357278

URL: http://svn.apache.org/viewcvs?rev=357278&view=rev
Log:
little bit of refactoring; no real changes. just noting a potential future TODO

Modified:
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/sa-update.raw?rev=357278&r1=357277&r2=357278&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Fri Dec 16 18:34:26 2005
@@ -162,7 +162,8 @@
 
   PREFIX          => $PREFIX,
   DEF_RULES_DIR   => $DEF_RULES_DIR,
-  LOCAL_RULES_DIR => $LOCAL_RULES_DIR
+  LOCAL_RULES_DIR => $LOCAL_RULES_DIR,
+  LOCAL_STATE_DIR => $LOCAL_STATE_DIR,
 });
 $site_rules_path ||= $SA->first_existing_path(@Mail::SpamAssassin::site_rules_path);
 
@@ -180,7 +181,7 @@
 if (@{$opt{'gpgkey'}}) {
   $GPG_ENABLED = 1;
   foreach my $key (@{$opt{'gpgkey'}}) {
-    unless ($key =~ /^[a-fA-F0-9]{8}$/) {
+    unless (is_valid_gpg_key_id($key)) {
       dbg("gpg: invalid gpgkey parameter $key");
       next;
     }
@@ -197,7 +198,7 @@
 
   dbg("gpg: reading in gpgfile ".$opt{'gpgkeyfile'});
   while(my $key = <GPG>) {
-    unless ($key =~ /^[a-fA-F0-9]{8}$/) {
+    unless (is_valid_gpg_key_id($key)) {
       dbg("gpg: invalid key id $key");
       next;
     }
@@ -206,6 +207,11 @@
     $valid_GPG{$key} = 1;
   }
   close(GPG);
+}
+
+sub is_valid_gpg_key_id {
+  # TODO: long gpg keys (over 8 hex digits)
+  return ($_[0] =~ /^[a-fA-F0-9]{8}$/);
 }
 
 # Deal with channel-related options