Changeset 29 for trunk


Ignore:
Timestamp:
11/05/09 17:55:34 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

DNSDB::initGlobals

  • don't roll over and die if the "systemwide defaults" file is missing

dns.cgi

  • allow passwords to be crypt-MD5 hashes as well as plaintext (should we insist?)
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r25 r29  
    130130
    131131# load system-wide site defaults and things from config file
    132   open SYSDEFAULTS, "</etc/dnsdb.conf";
     132  if (open SYSDEFAULTS, "</etc/dnsdb.conf") {
    133133##fixme - error check!
    134   while (<SYSDEFAULTS>) {
    135     next if /^\s*#/;
    136     $def{contact}       = $1 if /contact ?= ?([a-z0-9_.-]+)/i;
    137     $def{prins}         = $1 if /prins ?= ?([a-z0-9_.-]+)/i;
    138     $def{soattl}        = $1 if /soattl ?= ?([a-z0-9_.-]+)/i;
    139     $def{refresh}       = $1 if /refresh ?= ?([a-z0-9_.-]+)/i;
    140     $def{retry}         = $1 if /retry ?= ?([a-z0-9_.-]+)/i;
    141     $def{expire}        = $1 if /expire ?= ?([a-z0-9_.-]+)/i;
    142     $def{minttl}        = $1 if /minttl ?= ?([a-z0-9_.-]+)/i;
    143     $def{ttl}           = $1 if /ttl ?= ?([a-z0-9_.-]+)/i;
     134    while (<SYSDEFAULTS>) {
     135      next if /^\s*#/;
     136      $def{contact}     = $1 if /contact ?= ?([a-z0-9_.-]+)/i;
     137      $def{prins}               = $1 if /prins ?= ?([a-z0-9_.-]+)/i;
     138      $def{soattl}      = $1 if /soattl ?= ?([a-z0-9_.-]+)/i;
     139      $def{refresh}     = $1 if /refresh ?= ?([a-z0-9_.-]+)/i;
     140      $def{retry}               = $1 if /retry ?= ?([a-z0-9_.-]+)/i;
     141      $def{expire}      = $1 if /expire ?= ?([a-z0-9_.-]+)/i;
     142      $def{minttl}      = $1 if /minttl ?= ?([a-z0-9_.-]+)/i;
     143      $def{ttl}         = $1 if /ttl ?= ?([a-z0-9_.-]+)/i;
    144144##fixme?  load DB user/pass from config file?
     145    }
    145146  }
    146147# load from database
  • trunk/dns.cgi

    r26 r29  
    1616use HTML::Template;
    1717use CGI::Session;
     18use Crypt::PasswdMD5;
    1819use DBI;
    1920
     
    7475my $sortorder = "asc";
    7576
    76 my ($dbh,$msg) = connectDB("dnsdb","dnsdb","secret");
     77my ($dbh,$msg) = connectDB("dnsdb","dnsdb","secret","dbhost");
    7778#my $dbh = DBI->connect("DBI:mysql:database=vegadns","vegadns","secret",
    7879#       { AutoCommit => 0 }) or die $DBI::errstr;
     
    9091  my ($uid,$gid,$pass,$fname,$lname) = $sth->fetchrow_array;
    9192  $webvar{loginfailed} = 1 if !defined($uid);
    92   $webvar{loginfailed} = 1 if $pass ne $webvar{password};
     93
     94  if ($pass =~ m|^\$1\$([A-Za-z0-9/.]+)\$|) {
     95    $webvar{loginfailed} = 1 if $pass ne unix_md5_crypt($webvar{password},$1);
     96  } else {
     97    $webvar{loginfailed} = 1 if $pass ne $webvar{password};
     98  }
    9399
    94100  # set session bits
Note: See TracChangeset for help on using the changeset viewer.