Kipjr/Ldap_Login

Fail to login with Android App and Digikam

Closed this issue · 2 comments

Describe the bug
When Ldap_login plugin is enabled, I am not able to login.
Login through Piwigo NG (Android App) or Digikam always fails. However, login through web app still works.
Seems to be due to an error when user/group filters are set to null (ld_user_filter or ld_group_filter).

Workaround
Configure both ld_user_filter or ld_group_filter with 'cn=*' instead of 'null'.

To Reproduce

  • Enable Ldap_login plugin
  • Have user or group filter set to 'null' (=default value)
  • Try to login with Android app.

Expected behavior
I would like to be able to login with other tools than web app (such as android app or digikam).

Environment:

  • PHP-Version:
  • Piwigo Version:
  • ldap_login Version:

Your configuration:

  • Docker image lscr.io/linuxserver/piwigo:13.8.0-ls231
    • Alpine Linux v3.17.5
    • PHP 8.1.22
    • Piwigo 3.18.0
    • Ldap_login 13.6.0

Logs
The TCP dump below shows that the packet sent back to the app on login attempt contains some error due to null string:

00:00:29.923208 IP (tos 0x0, ttl 63, id 33308, offset 0, flags [DF], proto TCP (6), length 1061)
    192.168.1.15.30903 > 192.168.1.9.60970: Flags [P.], cksum 0xf71c (correct), seq 1:1010, ack 601, win 503, options [nop,nop,TS val 2164789850 ecr 689026014], length 1009
	0x0000:  4500 0425 821c 4000 3f06 324e c0a8 010f  E..%..@.?.2N....
	0x0010:  c0a8 0109 78b7 ee2a 3a71 77ae bfb8 d2ea  ....x..*:qw.....
	0x0020:  8018 01f7 f71c 0000 0101 080a 8108 125a  ...............Z
	0x0030:  2911 b3de 4854 5450 2f31 2e31 2032 3030  )...HTTP/1.1.200
	0x0040:  204f 4b0d 0a53 6572 7665 723a 206e 6769  .OK..Server:.ngi
	0x0050:  6e78 0d0a 4461 7465 3a20 4672 692c 2031  nx..Date:.Fri,.1
	0x0060:  3020 4e6f 7620 3230 3233 2030 303a 3030  0.Nov.2023.00:00
	0x0070:  3a32 3920 474d 540d 0a43 6f6e 7465 6e74  :29.GMT..Content
	0x0080:  2d54 7970 653a 2074 6578 742f 706c 6169  -Type:.text/plai
	0x0090:  6e3b 2063 6861 7273 6574 3d75 7466 2d38  n;.charset=utf-8
	0x00a0:  0d0a 436f 6e6e 6563 7469 6f6e 3a20 636c  ..Connection:.cl
	0x00b0:  6f73 650d 0a58 2d50 6f77 6572 6564 2d42  ose..X-Powered-B
	0x00c0:  793a 2050 4850 2f38 2e31 2e32 320d 0a45  y:.PHP/8.1.22..E
	0x00d0:  7870 6972 6573 3a20 5468 752c 2031 3920  xpires:.Thu,.19.
	0x00e0:  4e6f 7620 3139 3831 2030 383a 3532 3a30  Nov.1981.08:52:0
	0x00f0:  3020 474d 540d 0a43 6163 6865 2d43 6f6e  0.GMT..Cache-Con
	0x0100:  7472 6f6c 3a20 6e6f 2d73 746f 7265 2c20  trol:.no-store,.
	0x0110:  6e6f 2d63 6163 6865 2c20 6d75 7374 2d72  no-cache,.must-r
	0x0120:  6576 616c 6964 6174 650d 0a50 7261 676d  evalidate..Pragm
	0x0130:  613a 206e 6f2d 6361 6368 650d 0a53 6574  a:.no-cache..Set
	0x0140:  2d43 6f6f 6b69 653a 2070 7767 5f72 656d  -Cookie:.pwg_rem
	0x0150:  656d 6265 723d 6465 6c65 7465 643b 2065  ember=deleted;.e
	0x0160:  7870 6972 6573 3d54 6875 2c20 3031 2d4a  xpires=Thu,.01-J
	0x0170:  616e 2d31 3937 3020 3030 3a30 303a 3031  an-1970.00:00:01
	0x0180:  2047 4d54 3b20 4d61 782d 4167 653d 303b  .GMT;.Max-Age=0;
	0x0190:  2070 6174 683d 2f0d 0a53 6574 2d43 6f6f  .path=/..Set-Coo
	0x01a0:  6b69 653a 2070 7767 5f69 643d 3871 666c  kie:.pwg_id=8qfl
	0x01b0:  696e 6865 6c6f 3974 6969 6563 3639 306a  inhelo9tiiec690j
	0x01c0:  746b 7469 7275 3b20 7061 7468 3d2f 3b20  tktiru;.path=/;.
	0x01d0:  4874 7470 4f6e 6c79 0d0a 0d0a 3c62 7220  HttpOnly....<br.
	0x01e0:  2f3e 0a3c 623e 4465 7072 6563 6174 6564  />.<b>Deprecated
	0x01f0:  3c2f 623e 3a20 2073 7472 6c65 6e28 293a  </b>:..strlen():
	0x0200:  2050 6173 7369 6e67 206e 756c 6c20 746f  .Passing.null.to
	0x0210:  2070 6172 616d 6574 6572 2023 3120 2824  .parameter.#1.($
	0x0220:  7374 7269 6e67 2920 6f66 2074 7970 6520  string).of.type.
	0x0230:  7374 7269 6e67 2069 7320 6465 7072 6563  string.is.deprec
	0x0240:  6174 6564 2069 6e20 3c62 3e2f 636f 6e66  ated.in.<b>/conf
	0x0250:  6967 2f77 7777 2f70 6c75 6769 6e73 2f4c  ig/www/plugins/L
	0x0260:  6461 705f 4c6f 6769 6e2f 636c 6173 732e  dap_Login/class.
	0x0270:  6c64 6170 2e70 6870 3c2f 623e 206f 6e20  ldap.php</b>.on.
	0x0280:  6c69 6e65 203c 623e 3334 303c 2f62 3e3c  line.<b>340</b><
	0x0290:  6272 202f 3e0a 3c62 7220 2f3e 0a3c 623e  br./>.<br./>.<b>
	0x02a0:  4465 7072 6563 6174 6564 3c2f 623e 3a20  Deprecated</b>:.
	0x02b0:  2073 7472 6c65 6e28 293a 2050 6173 7369  .strlen():.Passi
	0x02c0:  6e67 206e 756c 6c20 746f 2070 6172 616d  ng.null.to.param
	0x02d0:  6574 6572 2023 3120 2824 7374 7269 6e67  eter.#1.($string
	0x02e0:  2920 6f66 2074 7970 6520 7374 7269 6e67  ).of.type.string
	0x02f0:  2069 7320 6465 7072 6563 6174 6564 2069  .is.deprecated.i
	0x0300:  6e20 3c62 3e2f 636f 6e66 6967 2f77 7777  n.<b>/config/www
	0x0310:  2f70 6c75 6769 6e73 2f4c 6461 705f 4c6f  /plugins/Ldap_Lo
	0x0320:  6769 6e2f 636c 6173 732e 6c64 6170 2e70  gin/class.ldap.p
	0x0330:  6870 3c2f 623e 206f 6e20 6c69 6e65 203c  hp</b>.on.line.<
	0x0340:  623e 3337 393c 2f62 3e3c 6272 202f 3e0a  b>379</b><br./>.
	0x0350:  3c62 7220 2f3e 0a3c 623e 4465 7072 6563  <br./>.<b>Deprec
	0x0360:  6174 6564 3c2f 623e 3a20 2073 7472 6c65  ated</b>:..strle
	0x0370:  6e28 293a 2050 6173 7369 6e67 206e 756c  n():.Passing.nul
	0x0380:  6c20 746f 2070 6172 616d 6574 6572 2023  l.to.parameter.#
	0x0390:  3120 2824 7374 7269 6e67 2920 6f66 2074  1.($string).of.t
	0x03a0:  7970 6520 7374 7269 6e67 2069 7320 6465  ype.string.is.de
	0x03b0:  7072 6563 6174 6564 2069 6e20 3c62 3e2f  precated.in.<b>/
	0x03c0:  636f 6e66 6967 2f77 7777 2f70 6c75 6769  config/www/plugi
	0x03d0:  6e73 2f4c 6461 705f 4c6f 6769 6e2f 636c  ns/Ldap_Login/cl
	0x03e0:  6173 732e 6c64 6170 2e70 6870 3c2f 623e  ass.ldap.php</b>
	0x03f0:  206f 6e20 6c69 6e65 203c 623e 3337 393c  .on.line.<b>379<
	0x0400:  2f62 3e3c 6272 202f 3e0a 7b22 7374 6174  /b><br./>.{"stat
	0x0410:  223a 226f 6b22 2c22 7265 7375 6c74 223a  ":"ok","result":
	0x0420:  7472 7565 7d                             true}
Kipjr commented

Thanks for the very clear issue submit! This is known problem ( passing null to parameter) and I will fix it in my next major release.