[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Cheshire Cat Computing • View topic - Mysql autentication proposal

Cheshire Cat Computing

Software support and information
It is currently Mon Nov 10, 2025 5:26 pm

All times are UTC + 12 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Dec 25, 2008 12:35 am 
Offline
User

Joined: Sat Oct 25, 2008 3:55 am
Posts: 1
Hi,
for my use, i had implemented a simple mysql autentication function with relative configuration parameter in routers2.conf:

in [web] section of routers2.conf i put:

mysql-server = 127.0.0.1
mysql-database = authdb
mysql-user = root
mysql-pass = password

and i modify routers2.cgi in this way:

in user_verify function i add after readconf( 'web' );

if( defined( $config{'web-mysql-server'} ) ) {
$rv = mysql_verify($u,$p);
return $rv if($rv);
}

and after sub ldap_verify i create the new function:

sub mysql_verify($$) {
my($u, $p) = @_;
require DBI;

my $dsn = "DBI:mysql:database=".$config{'web-mysql-database'}.";host=".$config{'web-mysql-server'}.";mysql_socket=/var/lib/m
ysql/mysql.sock";

my $dbh = DBI->connect("$dsn", $config{'web-mysql-user'}, $config{'web-mysql-pass'})
or die "Couldn't connect to database: " . DBI->errstr;

my $sthini = $dbh->prepare("SELECT PASSWORD(?),pass FROM users WHERE user=?")
or die "Couldn't prepare statement: " . $dbh->errstr;
$sthini->execute($p,$u)
or die "Couldn't execute statement:" . $dbh->errstr;

my @row = $sthini->fetchrow_array;
$sthini->finish;

if ($row[0] eq $row[1]) { return 1; }
return 0;
}


in mysql i create db authdb with this table structure:

CREATE TABLE `users` (
`user` varchar(15) NOT NULL,
`pass` varchar(50) NOT NULL,
PRIMARY KEY (`user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

For add a user just a simple:

INSERT INTO `authdb`.`users` (`user` ,`pass`) VALUES ('username', PASSWORD( 'something' ));

And it works well for my needs.
If you want to put this in future version i think is not so bad (it's a very simple mod).
Also i think that if it's possible, it's a good idea to put in table structure also personalized configuration option that i must now put in routers2.conf [user-something] section.
Bye.
Marco Chiavacci


Top
 Profile Send private message  
 
PostPosted: Sat Dec 27, 2008 9:49 pm 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 3039
Location: Auckland, New Zealand
This is really good, and I've been considering mySQL support for a long time. I'll add this to the next version... this of course uses a table to hold username/password rather than using the mySQL bind as a test, possibly giving both methods would be preferable. I'll see what I can do next week...

Thanks for this contribution!

Steve

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile Send private message  
 
PostPosted: Mon Dec 29, 2008 1:57 pm 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 3039
Location: Auckland, New Zealand
I've now incorporated this into v2.20beta3.

I've had to make a few changes (to give option of bind auth or table auth, to pass error messages in $debugmessage, explicitly disconnect (for mod_perl users) and to catch 'require' errors) but all looks OK - I'll need to run a few tests though so nothing just yet.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 12 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group