chiark
/
gitweb
/
~ian
/
cgi-auth-flexible.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
caf.db: rename file from caf-assocs.db
[cgi-auth-flexible.git]
/
cgi-auth-flexible.pm
diff --git
a/cgi-auth-flexible.pm
b/cgi-auth-flexible.pm
index 940e5dc2223fcbcb47042c84aa02afa22644d66c..1d23ae7f7d3844fb17720e9a4e948dda5a8114c9 100644
(file)
--- a/
cgi-auth-flexible.pm
+++ b/
cgi-auth-flexible.pm
@@
-203,14
+203,14
@@
sub gen_plain_footer_html ($$) {
}
our @default_db_setup_stmts =
}
our @default_db_setup_stmts =
- ("CREATE TABLE $v->{S}{
assocdb_table}
(".
+ ("CREATE TABLE $v->{S}{
db_prefix}_assocs
(".
" assochash VARCHAR PRIMARY KEY,".
" username VARCHAR NOT NULL,".
" last INTEGER NOT NULL".
")"
,
" assochash VARCHAR PRIMARY KEY,".
" username VARCHAR NOT NULL,".
" last INTEGER NOT NULL".
")"
,
- "CREATE INDEX $v->{S}{
assocdb_table}
_timeout_index".
- " ON $v->{S}{
assocdb_table}
".
+ "CREATE INDEX $v->{S}{
db_prefix}_assocs
_timeout_index".
+ " ON $v->{S}{
db_prefix}_assocs
".
" (last)"
);
" (last)"
);
@@
-432,13
+432,13
@@
sub new_verifier {
S => {
dir => undef,
assocdb_dbh => undef, # must have AutoCommit=0, RaiseError=1
S => {
dir => undef,
assocdb_dbh => undef, # must have AutoCommit=0, RaiseError=1
- assocdb_path => 'caf
-assocs
.db',
+ assocdb_path => 'caf.db',
keys_path => 'caf-keys',
srcdump_path => 'caf-srcdump',
assocdb_dsn => undef,
assocdb_user => '',
assocdb_password => '',
keys_path => 'caf-keys',
srcdump_path => 'caf-srcdump',
assocdb_dsn => undef,
assocdb_user => '',
assocdb_password => '',
-
assocdb_table => 'caf_assocs
',
+
db_prefix => 'caf
',
assocdb_setup_stmts => [@_default_db_setup_statements],
random_source => '/dev/urandom',
secretbits => 128, # bits
assocdb_setup_stmts => [@_default_db_setup_statements],
random_source => '/dev/urandom',
secretbits => 128, # bits
@@
-964,12
+964,12
@@
sub _identify ($$) {
my $dbh = $r->{Dbh};
my $dbh = $r->{Dbh};
- $dbh->do("DELETE FROM $r->{S}{
assocdb_table}
".
+ $dbh->do("DELETE FROM $r->{S}{
db_prefix}_assocs
".
" WHERE last < ?", {},
time - $r->{S}{login_timeout});
my $row = $dbh->selectrow_arrayref("SELECT username, last".
" WHERE last < ?", {},
time - $r->{S}{login_timeout});
my $row = $dbh->selectrow_arrayref("SELECT username, last".
- " FROM $r->{S}{
assocdb_table}
".
+ " FROM $r->{S}{
db_prefix}_assocs
".
" WHERE assochash = ?", {}, $h);
if (defined $row) {
#print STDERR "_identify h=$h s=$s YES @$row\n";
" WHERE assochash = ?", {}, $h);
if (defined $row) {
#print STDERR "_identify h=$h s=$s YES @$row\n";
@@
-1010,7
+1010,7
@@
sub _db_revoke ($$) {
my $dbh = $r->{Dbh};
my $dbh = $r->{Dbh};
- $dbh->do("DELETE FROM $r->{S}{
assocdb_table}
".
+ $dbh->do("DELETE FROM $r->{S}{
db_prefix}_assocs
".
" WHERE assochash = ?", {}, $h);
}
" WHERE assochash = ?", {}, $h);
}
@@
-1018,7
+1018,7
@@
sub _db_record_login_ok ($$$) {
my ($r,$h,$user) = @_;
$r->_db_revoke($h);
my $dbh = $r->{Dbh};
my ($r,$h,$user) = @_;
$r->_db_revoke($h);
my $dbh = $r->{Dbh};
- $dbh->do("INSERT INTO $r->{S}{
assocdb_table}
".
+ $dbh->do("INSERT INTO $r->{S}{
db_prefix}_assocs
".
" (assochash, username, last) VALUES (?,?,?)", {},
$h, $user, time);
}
" (assochash, username, last) VALUES (?,?,?)", {},
$h, $user, time);
}