]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/general-functions.pl
BUG12070: Its not possible to use the underscore in email addresses
[ipfire-2.x.git] / config / cfgroot / general-functions.pl
index 0577afe2809e62b3de113f96b3819ab04a43d917..aefcfb6878442555edc1b73cdaf5ceb8793c88ef 100644 (file)
@@ -149,6 +149,10 @@ sub readhash
        while (<FILE>)
        {
                chop;
+
+               # Skip comments.
+               next if ($_ =~ /^#/);
+
                ($var, $val) = split /=/, $_, 2;
                if ($var)
                {
@@ -780,7 +784,7 @@ sub validemail {
     return 0 if ( substr($parts[1],-1,1) eq '.' );
 
     #check first addresspart (before '@' sign)
-    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\+#]+$/ );
+    return 0 if  ( $parts[0] !~ m/^[a-zA-Z0-9\.!\-\_\+#]+$/ );
 
     #check second addresspart (after '@' sign)
     return 0 if  ( $parts[1] !~ m/^[a-zA-Z0-9\.\-]+$/ );
@@ -1165,5 +1169,12 @@ sub dnssec_status() {
 
        return $status;
 }
+sub number_cpu_cores() {
+       open my $cpuinfo, "/proc/cpuinfo" or die "Can't open cpuinfo: $!\n";
+       my $cores = scalar (map /^processor/, <$cpuinfo>);
+       close $cpuinfo;
+
+       return $cores;
+}
 
 1;