Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1058 UsersLib: Pear::Auth does not work

BRANCH-1-8_(CVS)
closed-fixed
5
2003-12-03
2003-11-23
Andreas Neuhaus
No

Pear::Auth authentication does not work, because
UsersLib::validate_user_auth calls Pear::Auth::start,
which in turn calls start_session, which fails because a
session is already started. However Pear::Auth's session
features aren't used anyway, so here's a patch for 1.
8rc2, which uses Pear::Auth::getStatus after Pear::
Auth::login to see if authentication was successful.

--- lib/userslib.php.orig 2003-11-17 04:13:14.
000000000 +0100
+++ lib/userslib.php 2003-11-23 01:59:18.000000000
+0100
@@ -366,21 +366,22 @@

// set the Auth options
$a = new Auth("LDAP", $options, "", false, $user,
$pass);
- // turn off the error message
- $a->setShowLogin(false);
- $a->start();
- $status = "";

// check if the login correct
- if ($a->getAuth())
- $status = USER_VALID;
+ $a->login();
+ switch ($a->getStatus()) {
+ case AUTH_LOGIN_OK:
+ return USER_VALID;

- // otherwise use the error status given back
- else
- $status = $a->getStatus();
+ case AUTH_USER_NOT_FOUND:
+ return USER_NOT_FOUND;

+ case AUTH_WRONG_LOGIN:
+ return PASSWORD_INCORRECT;

- return $status;
+ default:
+ return SERVER_ERROR;
+ }
}

// validate the user in the Tiki database

Discussion

    • assigned_to: nobody --> aneuhaus
    • status: open --> closed-fixed