Skip to content

Login via user_ldap app throws HTTP500 on current master #28449

Closed

Description

@fredreichbier

Hi there!

Steps to reproduce

  1. Use current master of core (99cae7c) and of the user_ldap app (384180)
  2. configure the user_ldap app (without touching any advanced or expert options)
  3. try to log into ownCloud using the credentials of a user located on the LDAP server

Expected behaviour

The user should be logged into owncloud.

Actual behaviour

ownCloud throws a HTTP 500 and the user is not logged in. The log says:

{"reqId":"kQg7yuKsz3YUayMpxAGO","level":3,"time":"2017-07-20T12:54:52+00:00","remoteAddr":"192.168.33.1","user":"7c1247da-d30e-1036-8350-cd5127ce8b3b","app":"PHP","method":"POST","url":"\/index.php\/login?user=user333",
"message":"Call to a member function getUID() on null at \/var\/www\/owncloud\/core\/Controller\/LoginController.php#207"}

I'm filing this issue here instead of user_ldap because the exception is raised in core code. I'll also do a PR with a fix proposal shortly.

For the sake of completeness: I already mentioned this bug earlier in #26065 (here).

Server configuration

Operating system: Ubuntu 14.04.5 LTS

Web server: Apache 2.4.7-1ubuntu4.16

Database: mysql-server-5.5 5.5.55-0ubuntu0.14.04.1

PHP version: 5.6.31-1

ownCloud version: current master

Updated from an older ownCloud or fresh install: fresh install

Where did you install ownCloud from: git

Signing status (ownCloud 9.0 and above): (I think I can't do this because I've installed from git?)

The content of config/config.php: https://gist.github.com/fredreichbier/312e678bd5c682b6772bcbd9e9628bef

List of activated apps:

Enabled:
  - comments: 0.3.0
  - dav: 0.3.0
  - federatedfilesharing: 0.3.0
  - federation: 0.1.0
  - files: 1.5.1
  - files_external: 0.7.0
  - files_sharing: 0.10.0
  - files_trashbin: 0.9.0
  - files_versions: 1.3.0
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - updatenotification: 0.2.1
  - user_ldap: 0.9.1
Disabled:
  - encryption
  - testing
  - theme-example

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP

LDAP configuration (delete this part if not used)

https://gist.github.com/fredreichbier/7e33df45da54a077c040eea3d3e13d95

Client configuration

Browser: Chrome 52

Operating system: Arch Linux

Logs

ownCloud log (data/owncloud.log)

see above

Activity

  1. PVince81 commented on Jul 24, 2017

    @PVince81
    Contributor

    @jvillafanez known issue ?

  2. added this to the triage milestone on Jul 24, 2017
  3. jvillafanez commented on Jul 24, 2017

    @jvillafanez
    Member

    I haven't checked master, but as far as I know, stable10 should work. Any change in core that could cause this issue? I'm not aware of any change on the LDAP side.

  4. fredreichbier commented on Jul 24, 2017

    @fredreichbier
    ContributorAuthor

    @karakayasemi explains the root cause here -- just wanted to add that login via user_ldap indeed works on current stable10 (b2b1f18), but not on master.

  5. davitol commented on Jul 25, 2017

    @davitol
    Contributor

    I was able to reproduce it too:

    {"reqId":"lExi0uo0qHKRLZSR29B3","level":3,"time":"2017-07-25T08:24:47+00:00","remoteAddr":"85.57.168.79","user":"b8df1298-8742-1034-8cb4-39af73a96b9a","app":"index","method":"POST","url":"/index.php/login","message":"Exception: {"Exception":"Error","Message":"Call to a member function getUID() on null","Code":0,"Trace":"
    #0 [internal function]: OC\Core\Controller\LoginController->tryLogin(*** sensitive parameters replaced ***)
    #1 /opt/owncloud/lib/private/AppFramework/Http/Dispatcher.php(159): call_user_func_array(Array, Array)
    #2 /opt/owncloud/lib/private/AppFramework/Http/Dispatcher.php(89): OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Core\Controller\LoginController), 'tryLogin')
    #3 /opt/owncloud/lib/private/AppFramework/App.php(98): OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Core\Controller\LoginController), 'tryLogin')
    #4 /opt/owncloud/lib/private/AppFramework/Routing/RouteActionHandler.php(46): OC\AppFramework\App::main('LoginController', 'tryLogin', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
    #5 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
    #6 /opt/owncloud/lib/private/Route/Router.php(299): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
    #7 /opt/owncloud/lib/base.php(930): OC\Route\Router->match('/login')
    #8 /opt/owncloud/index.php(49): OC::handleRequest()
    #9 {main}","File":"/opt/owncloud/core/Controller/LoginController.php","Line":207}"}
    

    As said, it works in stable10
    @jvillafanez Can you please have a look?

  6. jvillafanez commented on Jul 25, 2017

    @jvillafanez
    Member

    I guess I finally got where the problem is: during the userSession->login(...) you use a login name + password as parameters, then you use the same login name to get the user instance from the user manager. That's where the problem is, because the user manager expects an uid not a login name.

    DB users usually have the same uid and login name, but that's not the case for LDAP.

  7. karakayasemi commented on Jul 25, 2017

    @karakayasemi
    Contributor

    @jvillafanez thanks to you, now I understand the current problem also. Anyway, seems related PR is solving the issue.

  8. karakayasemi commented on Aug 9, 2017

    @karakayasemi
    Contributor

    We can close this issue. Fix is merged: #28450

  9. removed this from the triage milestone on Apr 10, 2018
  10. lock commented on Jul 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  11. locked as resolved and limited conversation to collaborators on Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions