Gossamer Forum
Home : Products : DBMan : Customization :

Open/Close Issue

Quote Reply
Open/Close Issue
db.cgi has the following code. There seems to be a 'close PASS;' missing for the second 'open (PASS,' function? Can anyone comment on this one - where should the second 'close' actually go?

# If we have a username, and the admin didn't press inquire, then
# we are updating a user.
($in{'username'} && !$in{'inquire'}) and do {
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS;

open (PASS, ">$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
my $found = 0;
foreach $line (@lines) {
if ($line =~ /^$in{'username'}:/) {
my $password = (split (/:/, $line))[1];
unless ($password eq $in{'password'}) {
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
$password = crypt($in{'password'}, $salt);
}
print PASS "$in{'username'}:$password:$in{'per_view'}:$in{'per_add'}:$in{'per_del'}:$in{'per_mod'}:$in{'per_admin'}\n";
$found = 1;
}
else {
print PASS $line;
}
}
$in{'inquire'} = $in{'username'};
$found ?
($message = "User: $in{'username'} updated.") :
($message = "Unable to find user: '$in{'username'}' in the password file.");
last CASE;
};

Subject Author Views Date
Thread Open/Close Issue Keef 2090 Aug 26, 2000, 5:16 AM
Thread Re: Open/Close Issue
Keef 2007 Mar 26, 2001, 9:41 PM
Thread Re: Open/Close Issue
LoisC 2007 Mar 26, 2001, 11:34 PM
Thread Re: Open/Close Issue
Keef 2001 Mar 27, 2001, 9:29 AM
Thread Re: Open/Close Issue
JPDeni 1990 Mar 27, 2001, 11:11 AM
Thread Re: Open/Close Issue
Keef 1983 Mar 27, 2001, 9:44 PM
Post Re: Open/Close Issue
JPDeni 1982 Mar 27, 2001, 10:45 PM