Univention Bugzilla – Bug 37665
traceback when logging attributes: TypeError: must be string without null bytes, not str
Last modified: 2016-09-13 13:52:10 CEST
4.0-0 errata66 (Walle) Traceback: Die Ausführung des Kommandos udm/put users/user ist fehlgeschlagen: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/modules/__init__.py", line 176, in _decorated return function(self, request, *args, **kwargs) File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run tmp = self._function() File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__ return self._function( *tmp, **self._kwargs ) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 408, in _thread module.modify(properties) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 159, in _decorated return func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 139, in wrapper_func ret = func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 545, in modify self._map_properties(obj, ldap_object) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 404, in _map_properties MODULE.info('Setting property %s to %s' % (property_name, value)) File "/usr/lib/pymodules/python2.7/univention/management/console/log.py", line 148, in info ud.debug(self._id, ud.INFO, message) File "/usr/lib/pymodules/python2.7/univention/debug.py", line 49, in debug _debug.debug(id, level, ustring) TypeError: must be string without null bytes, not str Remark: unter Konto - Windows einen Laufwerkbuchstaben (P:) für das Heimatverzeichnis und den Pfad zum Heimatverzeichnis (\\ucs\mr) eingetragen Remark: Versuch einem Benutzer ein Windows-Profile-UNC-Pfad hinzuzufügen
Got more feedback: ich habe noch eine kleine Anmerkung zu dem Fehler ... Ich hatte die Pfadfreigabe aus der Explorer-Adressleiste aus Windows per Copy'n'Paste in das Feld übertragen und damit den Fehler produzieren können. Als ich dann einen halben Tag später das Ganze noch einmal testen wollte trug ich den Pfad manuell ein und es funktionierte. Keine Ahnung, was da in der Zwischenablage für ein Fehler drin war, aber diese Info wollte ich auf jeden Fall noch mitteilen, damit nicht an einer falschen Stelle nach einem möglichen Fehler gesucht wird. Passieren sollte so etwas aber natürlich trotzdem nicht :-)
From the feedback I would say that he copied some nullbytes and this was sent to the backend. univention-debug ofc. raises when it gets nullbytes.
Created attachment 6681 [details] patch for sanitizing input before logging As first step we should not allow user input to crash the module by replacing the logentries %s by %r. After this the user should receive the correct error message from the syntax class telling him that the entered value is invalid.
TypeError is now catched and the logging is re-done with repr() to increase security. *** This bug has been marked as a duplicate of bug 42114 ***