Add check for empty attributes to perl_mysql
authorThomas Hochstein <thh@inter.net>
Sun, 19 Jan 2014 17:19:47 +0000 (18:19 +0100)
committerThomas Hochstein <thh@inter.net>
Sun, 19 Jan 2014 17:19:47 +0000 (18:19 +0100)
Signed-off-by: Thomas Hochstein <thh@inter.net>
auth/perl_mysql

index 5f70039..dc963ec 100644 (file)
@@ -56,6 +56,11 @@ sub authenticate() {
  # $attributes{username}  username
  # $attributes{password}  password
 
  # $attributes{username}  username
  # $attributes{password}  password
 
+ # return if username or password not set
+ if (!defined($attributes{username}) or !defined($attributes{password})) {
+  return (481, 'Authentication failure');
+ }
+
  ### DB init
  my $dbs = sprintf('DBI:%s:database=%s;host=%s',$conf{'dbdriver'},$conf{'database'},$conf{'dbhost'});
  my $dbhandle = DBI->connect($dbs, $conf{'dbuser'}, $conf{'dbpw'}, { PrintError => 1 });
  ### DB init
  my $dbs = sprintf('DBI:%s:database=%s;host=%s',$conf{'dbdriver'},$conf{'database'},$conf{'dbhost'});
  my $dbhandle = DBI->connect($dbs, $conf{'dbuser'}, $conf{'dbpw'}, { PrintError => 1 });
This page took 0.010398 seconds and 4 git commands to generate.