summaryrefslogtreecommitdiff
path: root/git-cvsserver.perl
diff options
context:
space:
mode:
authorFrank Lichtenheld <frank@lichtenheld.de>2007-04-07 16:58:09 +0200
committerJunio C Hamano <junkio@cox.net>2007-04-07 23:02:13 -0700
commit473937ed44c112e5d3ced52ab3f9a9e53eccc272 (patch)
treea4c3ec0f1c25f1ec6f7350319396d2d7df599119 /git-cvsserver.perl
parent0cf611a300fbbbd12827f9defb9cbcc934a3b1d6 (diff)
downloadgit-473937ed44c112e5d3ced52ab3f9a9e53eccc272.tar.gz
cvsserver: Corrections to the database backend configuration
Don't include the scheme name in gitcvs.dbdriver, it is always 'dbi' anyway. Don't allow ':' in driver names nor ';' in database names for sanity reasons. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-cvsserver.perl')
-rwxr-xr-xgit-cvsserver.perl6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 5532ae7a31..7fe7949b39 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -2149,7 +2149,7 @@ sub new
die "Git repo '$self->{git_path}' doesn't exist" unless ( -d $self->{git_path} );
$self->{dbdriver} = $cfg->{gitcvs}{$state->{method}}{dbdriver} ||
- $cfg->{gitcvs}{dbdriver} || "dbi:SQLite";
+ $cfg->{gitcvs}{dbdriver} || "SQLite";
$self->{dbname} = $cfg->{gitcvs}{$state->{method}}{dbname} ||
$cfg->{gitcvs}{dbname} || "%Ggitcvs.%m.sqlite";
$self->{dbuser} = $cfg->{gitcvs}{$state->{method}}{dbuser} ||
@@ -2165,7 +2165,9 @@ sub new
$self->{dbname} =~ s/%([mauGg])/$mapping{$1}/eg;
$self->{dbuser} =~ s/%([mauGg])/$mapping{$1}/eg;
- $self->{dbh} = DBI->connect("$self->{dbdriver}:dbname=$self->{dbname}",
+ die "Invalid char ':' in dbdriver" if $self->{dbdriver} =~ /:/;
+ die "Invalid char ';' in dbname" if $self->{dbname} =~ /;/;
+ $self->{dbh} = DBI->connect("dbi:$self->{dbdriver}:dbname=$self->{dbname}",
$self->{dbuser},
$self->{dbpass});
die "Error connecting to database\n" unless defined $self->{dbh};