Bug 17720: CSRF - Handle unicode characters
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 5 Dec 2016 08:17:21 +0000 (08:17 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 5 Dec 2016 15:20:18 +0000 (15:20 +0000)
commit8edb7f6fb94a72f7ebc0b1d0ade031f0bed651cf
treec83a62dcac74baf8b67904f644ae41518ea532ac
parent59a322ae7014820603ac807de7234a13c06ad696
Bug 17720: CSRF - Handle unicode characters

From the pod of Digest::MD5:
"""
Since the MD5 algorithm is only defined for strings of bytes, it can not
be used on strings that contains chars with ordinal number above 255
(Unicode strings). The MD5 functions and methods will croak if you try
to feed them such input data.
What you can do is calculate the MD5 checksum of the UTF-8
representation of such strings.
"""

Test plan:
- Set a MySQL/MariaDB password with unicode characters:
  UPDATE user SET password=PASSWORD('❤') WHERE USER='koha_kohadev';
  FLUSH PRIVILEGES
- Update your $KOHA_CONF file
- Restart Memcached
- Hit the files modified by this patch

=> Without this patch, you will get a software error (with "Wide
character in subroutine entry" in the logs).
=> With this patch, everything will go fine

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Edit: removed debugging leftover

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
basket/sendbasket.pl
members/deletemem.pl
members/member-password.pl
members/memberentry.pl
members/moremember.pl
opac/opac-memberentry.pl
opac/opac-sendbasket.pl
tools/import_borrowers.pl
tools/picture-upload.pl