Skip to content

LDAP - avatar in format other than jpg/png throws exception #17232

Closed

Description

@11mariom

Hi,
when using LDAP with OwnCloud lib/private/avatar.php ( https://github.com/owncloud/core/blob/master/lib/private/avatar.php#L104 ) could make instance unusable for some users. If they have avatar in other format than jpg or png - they have 500 internal server error, in logs you just see exception from avatar.php.

Exception:

{"Message":"Unknown filetype","Code":0,"Trace":"#0 \/var\/www\/html\/owncloud\/apps\/user_ldap\/lib\/user\/user.php(346): OC_Avatar->set(Object(OCP\\Image))\n#1 \/var\/www\/html\/owncloud\/apps\/user_ldap\/lib\/user\/user.php(319): OCA\\user_ldap\\lib\\user\\User->setOwnCloudAvatar()\n#2 \/var\/www\/html\/owncloud\/apps\/user_ldap\/lib\/user\/user.php(134): OCA\\user_ldap\\lib\\user\\User->updateAvatar()\n#3 \/var\/www\/html\/owncloud\/apps\/user_ldap\/user_ldap.php(213): OCA\\user_ldap\\lib\\user\\User->update()\n#4 \/var\/www\/html\/owncloud\/lib\/private\/user\/manager.php(113): OCA\\user_ldap\\USER_LDAP->userExists('user')\n#5 \/var\/www\/html\/owncloud\/lib\/private\/user\/manager.php(142): OC\\User\\Manager->get('user')\n#6 \/var\/www\/html\/owncloud\/lib\/private\/user.php(574): OC\\User\\Manager->userExists('user')\n#7 \/var\/www\/html\/owncloud\/lib\/private\/user.php(334): OC_User::userExists('user')\n#8 \/var\/www\/html\/owncloud\/lib\/base.php(774): OC_User::isLoggedIn()\n#9 \/var\/www\/html\/owncloud\/index.php(36): OC::handleRequest()\n#10 {main}","File":"\/var\/www\/html\/owncloud\/lib\/private\/avatar.php","Line":66} 

Steps to reproduce:

  1. Use LDAP
  2. Create user in LDAP with f.e. gif avatar.
  3. Try to login to OwnCloud

or

  1. Use LDAP
  2. Create user in LDAP
  3. Login to OwnCloud with that user
  4. Set in LDAP gif avatar
  5. Every link user opens - will give 500 Internal server error.

Activity

  1. DeepDiver1975 commented on Jun 30, 2015

    @DeepDiver1975
    Contributor
  2. blizzz commented on Jun 30, 2015

    @blizzz
    Contributor

    Thank you for reporting.

    Interesting thing is that the image was checked earlier in that function to be valid. But Avatar has more restrictions. We just need to catch the exception there and leave a log message.

  3. added this to the milestone on Jun 30, 2015
  4. added a commit that references this issue on Jul 8, 2015
    eb32b4f
  5. DeepDiver1975 commented on Jul 20, 2015

    @DeepDiver1975
    Contributor

    #17464 is still under review to be merged into master - no backport yet available -> 8.0.7

  6. modified the milestones: , on Jul 20, 2015
  7. added a commit that references this issue on Jul 27, 2015
    b37d62d
  8. added 3 commits that reference this issue on Jul 29, 2015
    b0036ec
    9bfbed5
    232e382
  9. modified the milestones: , on Jul 29, 2015
  10. added a commit that references this issue on Jul 29, 2015
    d44a656
  11. locked as resolved and limited conversation to collaborators on Aug 9, 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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions