[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Password checking API
From: Michael Goffioul <goffioul () imec ! be>
Date: 2001-10-02 11:37:32
[Download RAW message or body]
Carsten Pfeiffer wrote:
>
> On Dienstag, 2. Oktober 2001 11:13 Michael Goffioul wrote:
> > Is there any high-level API to check the validity for a password.
> > Something like:
> >
> > bool checkPassword(const QString& user, const QString& password)
>
> No, I don't think so. We have kdebase/kcheckpass, where there is:
>
> int Authenticate(const char *login, const char *pass);
>
> Maybe a wrapper for that would be a good idea.
You could implement this "checkPassword" utility around the kcheckpass
program, the problem is that you can't supply a user name to it, it
uses automatically your login name. For example, if kcheckpass would
accept a "-U" option for the user, you could write:
bool checkPassword(const QString& user, const QString& password)
{
QString exe = KStandardDirs::findExe( "kcheckpass" );
if ( exe.isEmpty() )
return false;
QString cmd = QString::fromLatin1("echo '%1' | %2 -U %3")
.arg(password)
.arg(exe)
.arg(user);
return (system(cmd.latin1()) == 0);
}
Michael.
--
------------------------------------------------------------------
Michael Goffioul IMEC-DESICS-MIRA
e-mail: goffioul@imec.be (Mixed-Signal and RF Applications)
Tel: +32/16/28-8510 Kapeldreef, 75
Fax: +32/16/28-1515 3001 HEVERLEE, BELGIUM
------------------------------------------------------------------
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic