Bug 30156 - license import traceback when uploading invalid license
license import traceback when uploading invalid license
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 3.2-0-errata
Assigned To: Alexander Kläser
Dirk Wiesenthal
:
: 32160 (view as bug list)
Depends on:
Blocks: 33623
  Show dependency treegraph
 
Reported: 2013-01-24 10:59 CET by Florian Best
Modified: 2013-12-02 08:56 CET (History)
7 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2013-01-24 10:59:33 CET
Die Ausführung des Kommandos udm/license/import ist fehlgeschlagen:

Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
func( request )
File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 175, in wrapper_func
ret = func( *args, **kwargs )
File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 237, in license_import
importer = LicenseImport( open( filename, 'rb' ) )
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/var/tmp/univention-management-console-frontend/135892704881303-24661LqLt9l'
Comment 1 Moritz Muehlenhoff univentionstaff 2013-09-27 08:39:24 CEST
This still occurs with current 3.2
Comment 2 Stefan Gohmann univentionstaff 2013-11-20 15:33:14 CET
Reported again.
Comment 3 Florian Best univentionstaff 2013-11-27 12:07:20 CET
This must be a generic problem with the file handling in UMC and has nothing to do with an invalid license.
Somehow the uploaded file gets deleted before the module process of UDM executes the import_license method.
Comment 4 Alexander Kläser univentionstaff 2013-11-27 14:19:58 CET
Piwik reports that the majority of all tracebacks (18%) occur during the import of a new license.
Comment 5 Florian Best univentionstaff 2013-11-27 14:27:42 CET
Seems that the method is executed twice by the UMC module process (maybe appended twice to the message queue?)

I take this bug.
Comment 6 Florian Best univentionstaff 2013-11-27 16:26:44 CET
fixed in univention-management-console-module-udm (4.0.97-4)

Responsible for the error was the LDAP_Connection decorator which executes the method again when a "LDAPError" or "udm_errors.base" exception occurs. Because the license file was invalid such a exception has been raised. The file was already deleted so it could not be opened again resulting in that the first second method call answered the UMCP response at first.

I could trigger ValueError, AttributeError, ldap.UNDEFINED_TYPE exceptions which are now catched and a reasonable message is displayed.
Comment 7 Florian Best univentionstaff 2013-11-27 16:42:12 CET
YAML adapted.
Comment 8 Dirk Wiesenthal univentionstaff 2013-11-28 16:32:24 CET
License with wrong "dn:" line:

Die Ausführung des Kommandos udm/license/import ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 268, in license_import
    importer.write( self._user_dn, self._password )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/tools.py", line 98, in write
    ldap_con.add_s( self.dn, self.addlist )
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 194, in add_s
    return self.result(msgid,all=1,timeout=self.timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 422, in result
    res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 426, in result2
    res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 432, in result3
    ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)
UNWILLING_TO_PERFORM: {'info': 'no global superior knowledge', 'desc': 'Server is unwilling to perform'}
Comment 9 Dirk Wiesenthal univentionstaff 2013-11-28 17:03:56 CET
I do not see the reason why LDAP_Connection is used at all. The only purpose seems to be returning ldap_position and this is only used for getBase(). This is roughly ucr.get('ldap/base')
Comment 10 Dirk Wiesenthal univentionstaff 2013-11-28 17:08:18 CET
German:
  Die Lizenz konnte nich importiert werden: missgestaltetes LDIF-Format

nich -> nicht
missgestaltet -> ungültig, maybe change English, too.
Comment 11 Dirk Wiesenthal univentionstaff 2013-11-28 17:12:17 CET
Error in objectClass (e.g. wrong name):

Die Ausführung des Kommandos udm/license/import ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 269, in license_import
    importer.write( self._user_dn, self._password )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/tools.py", line 98, in write
    ldap_con.add_s( self.dn, self.addlist )
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 194, in add_s
    return self.result(msgid,all=1,timeout=self.timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 422, in result
    res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 426, in result2
    res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 432, in result3
    ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)
INVALID_SYNTAX: {'info': 'objectClass: value #1 invalid per syntax', 'desc': 'Invalid syntax'}
Comment 12 Dirk Wiesenthal univentionstaff 2013-11-28 17:17:01 CET
See also Bug#32160.

There are several ways to let the import fail (all result in tracebacks). I would suggest catching all LDAP_Errors, assuming error in license file and present something like:

"The import of the license failed. Check the integrity of the original file given to you. If this error persists, contact Univention or your Univention partner. LDAP error message was: %s" % err['desc']
Comment 13 Alexander Kläser univentionstaff 2013-11-28 18:05:18 CET
(In reply to Dirk Wiesenthal from comment #12)
> See also Bug#32160.
> 
> There are several ways to let the import fail (all result in tracebacks). I
> would suggest catching all LDAP_Errors, assuming error in license file and
> present something like:
> 
> "The import of the license failed. Check the integrity of the original file
> given to you. If this error persists, contact Univention or your Univention
> partner. LDAP error message was: %s" % err['desc']

Good idea! I added an explicit pre-check for the base DN, LDAP errors are not caught generically with the suggested error message.

univention-management-console-module-udm (4.0.97-6):
* Bug #30156: adjusted error handling and messages for license import
Comment 14 Alexander Kläser univentionstaff 2013-11-28 18:27:38 CET
Fixed some typos that you found, Dirk.
univention-management-console-module-udm (4.0.97-7):
* Bug #30156: fixed typos
Comment 15 Alexander Kläser univentionstaff 2013-11-28 18:39:13 CET
Once again, adjusted the error messages.
univention-management-console-module-udm (4.0.97-8):
* Bug #30156: adjusted error messages for license import
Comment 16 Alexander Kläser univentionstaff 2013-11-28 18:56:28 CET
univention-management-console-module-udm (4.0.97-9):
* Bug #30156: adjusted error representation in frontend
Comment 17 Dirk Wiesenthal univentionstaff 2013-11-28 19:07:29 CET
*** Bug 32160 has been marked as a duplicate of this bug. ***
Comment 18 Dirk Wiesenthal univentionstaff 2013-11-28 19:08:25 CET
Much better
Comment 19 Janek Walkenhorst univentionstaff 2013-11-29 11:45:14 CET
http://errata.univention.de/ucs/3.2/3.html