Decoding error when trying to use system documentation


#1

Hello everyone,

when I try to get the system documentation I get following error and nothing happens:

[2018-08-13 14:00:49,852][21277][140600786581248][ERROR][privacyidea.app:1423] Exception on /system/documentation [GET]
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/flask/app.py”, line 1817, in wsgi_app
response = self.full_dispatch_request()
File “/usr/lib/python2.7/dist-packages/flask/app.py”, line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/lib/python2.7/dist-packages/flask/app.py”, line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python2.7/dist-packages/flask/app.py”, line 1475, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/lib/python2.7/dist-packages/flask/app.py”, line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/lib/python2.7/dist-packages/privacyidea/api/lib/prepolicy.py”, line 120, in policy_wrapper
return wrapped_function(*args, **kwds)
File “/usr/lib/python2.7/dist-packages/privacyidea/api/auth.py”, line 313, in decorated_function
return f(*args, **kwargs)
File “/usr/lib/python2.7/dist-packages/privacyidea/api/system.py”, line 113, in get_config_documentation
context=context))
File “/usr/lib/python2.7/dist-packages/flask/templating.py”, line 128, in render_template
context, ctx.app)
File “/usr/lib/python2.7/dist-packages/flask/templating.py”, line 110, in _render
rv = template.render(context)
File “/usr/lib/python2.7/dist-packages/jinja2/environment.py”, line 989, in render
return self.environment.handle_exception(exc_info, True)
File “/usr/lib/python2.7/dist-packages/jinja2/environment.py”, line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python2.7/dist-packages/privacyidea/static/templates/documentation.rst”, line 56, in top-level template code
{{k}}: {{v}}
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc2 in position 7: ordinal not in range(128)
[2018-08-13 14:00:49,881][21277][140600786581248][ERROR][privacyidea.lib.auditmodules.sqlaudit:240] exception DataError(’(pymysql.err.DataError) (1406, u"Data too long for column ‘info’ at row 1")’,)
[2018-08-13 14:00:49,881][21277][140600786581248][ERROR][privacyidea.lib.auditmodules.sqlaudit:241] DATA: {‘info’: u"‘ascii’ codec can’t decode byte 0xc2 in position 7: ordinal not in range(128)", ‘admin’: u’admin’, ‘realm’: None, ‘success’: True, ‘privacyidea_server’: ‘pi.mydomain.com’, ‘client_user_agent’: ‘chrome’, ‘token_type’: None, ‘client’: ‘192.168.0.5’, ‘user’: ‘’, ‘resolver’: ‘’, ‘action_detail’: ‘’, ‘action’: ‘GET /system/documentation’, ‘serial’: None}

As mentioned in my other post. My PHP-skills are more than basic. The problem is not killing any functionality, so I can live with it, but I wanted you to know.

Best regards,


#2

Hi Baltic,

thank you for the pointer! This sounds like a bug. Just a question: Am I right to assume that you’re using the LDAP resolver with a password with characters outside of ASCII?

Best Regards

Friedrich


#3

Hello Friedrich,

sorry for replying late. You might be right with your assumption, because I had encoding issues before, when it came down to the NTLM-bind (Problems with LDAP-Resolver). I worked around this by using simple bind, without changing any passwords. So this might as well be the cause.

Best regards,
Nils


#4

Hi Nils,

thanks for the confirmation! I’ve opened a bug for the issue: https://github.com/privacyidea/privacyidea/issues/1181 and both the NTLM and the system documentation issue should be fixed in the next version 2.23.

Best Regards

Friedrich