Re: Change Password....

Torsten Mueller <[email protected]>
Newsgroups gmane.mail.neomail.general
Message-ID <[email protected]>
[ P.S. Please don't reply in P.M. ]

"J.C.P.D. Jessy Leeuwenhage" schrieb:
> 
> Actually,
> 
> I also have a forum @ http://forums.wabbit-wion.nl and my initial idea
> was to link the usernames from Neomail to the MySQL-database but coz a
> lack of knowledge on my part :-(

This could be done, if you modify your checklogin script and link in
there
the mysql stuff. However, as i said it before, possibly more
modifications
need to be done on the MTA side.

Here is my checklogin.pl script, possibly a starting point ...

######
#!/usr/bin/perl -T
use DBI;

#mysql extension for neomail
#tested with neomail 1.22 mysql 3.23.32 exim with virtual mail support
#[email protected]
#
#basics: autentification against a mysql database
#
#more info:
#

#config
$SQL_DB = 'popaccounts'; #database to connect
$SQL_HOST = 'localhost'; #mysql server host
$SQL_PORT = '3306'; #mysql port to connect
$SQL_ACC = 'hghjghj'; #mysql user to connect to the database
$SQL_PWD = 'hghghjghj'; # mysql password for the user
$SQL_TBL = 'mail'; # table with the mailusers and passwords
$SQL_USERFLD = 'username'; #column in the table which contains the
username
$SQL_PWFLD = 'password'; #column in the table which contains the
password
$SQL_QRYPT = 'plain'; #how are the passwords stored plain or crypt
$SQL_ADSEARCH = "and domain='web.de'"; #additional select statement for
mysql if you want it, leave empty if not needed
#end config

my ($username, $password, $usr, $pswd, $passwdfile);
my $passcorrect = 0; # default to correct, set incorrect when determined
my $line;
chomp($passwdfile = <STDIN>);
chomp($username = <STDIN>);
chomp($password = <STDIN>);

if ( $passwdfile && $username && $password ) {

$dsn = "DBI:mysql:database=$SQL_DB;host=$SQL_HOST;port=$SQL_PORT";
$dbh = DBI->connect($dsn, $SQL_ACC, $SQL_PWD);
$drh = DBI->install_driver("mysql");
#@domainnames
$quotedusername = $dbh->quote($username);
$gselect="select * from $SQL_TBL where $SQL_USERFLD=$quotedusername
$SQL_ADSEARCH";
$sth = $dbh->prepare($gselect);
$sth->execute;

while($ref = $sth->fetchrow_hashref) {
$usr = $ref->{$SQL_USERFLD};
$pswd = $ref->{$SQL_PWFLD};
}

$sth->finish;
$dbh->disconnect;



    if ($SQL_QRYPT eq 'plain') {
        # if the passwords are plain stored
        if (($usr ne $username) or ($password ne $pswd)) {
             $passcorrect = 1; # User/Pass combo is WRONG!
            }
        } else {
        # the passwords are crypted in the table
        # !! not tested by me !!
        if (($usr ne $username) or (crypt($password, $pswd) ne $pswd)) {
             $passcorrect = 1; # User/Pass combo is WRONG!
            }
        }


} else {
   $passcorrect = 1;
        }
exit $passcorrect;

#############

Torsten


> 
> Again : Thank you for your help
> 
> greets,
> 
> Jessy
> 
> >
> >
> > "J.C.P.D. Jessy Leeuwenhage" schrieb:
> > >
> > > Aloha !!!
> > >
> > > Regarding the last mail/question I send. I think I have a nice
> solution..
> >
> > Congratulations.
> >
> > Possibly (if you want this too), it would be a first step to keep
> > user/pass combos in a different place than /etc/passwd to avoid
> > having a system account because of a neomail account.
> > Of course you would need to tune your mailserver too ...
> >
> > Torsten
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > NeoMail-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/neomail-users
> >
> >
> 
> --
> Send With Wabbit-Wion-Webmail


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.