[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Password checking API
From: Lukas Tinkl <lukas () kde ! org>
Date: 2001-10-02 11:55:44
[Download RAW message or body]
On Tuesday October 2 2001 13:37, Michael Goffioul wrote:
> 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.
I wonder how many times does it have to be said that passing
system(cmd.latin1()) is a BIG NO? :)
Please never expect that all the system related stuff is always in latin1
encoding.
--
Regards,
Lukáš Tinkl
KDE i18n maintainer
http://www.kde.org/international/czechia/
>> 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