plajjan/NIPAP — Issue #135: Logging in with empty username & password causes error
Author: garberg
Created: 2011-11-11 14:57:32+00:00
State: open
Labels: bug, www-ui

An exception is thrown when a user tries to log in to the web ui with the username & password fields left empty. Seems as the LDAP DN gets invalid when missing password.

```
Error - : {'info': 'invalid DN', 'desc': 'Invalid DN syntax'}
URL: http://nipap.tele2.net/auth/login
File '/usr/lib/pymodules/python2.6/weberror/errormiddleware.py', line 162 in __call__
app_iter = self.application(environ, sr_checker)
File '/usr/lib/pymodules/python2.6/beaker/middleware.py', line 152 in __call__
return self.wrap_app(environ, session_start_response)
File '/usr/lib/pymodules/python2.6/routes/middleware.py', line 131 in __call__
response = self.app(environ, start_response)
File '/usr/lib/python2.6/dist-packages/pylons/wsgiapp.py', line 107 in __call__
response = self.dispatch(controller, environ, start_response)
File '/usr/lib/python2.6/dist-packages/pylons/wsgiapp.py', line 312 in dispatch
return controller(environ, start_response)
File '/usr/lib/python2.6/dist-packages/nipapwww/lib/base.py', line 49 in __call__
return WSGIController.__call__(self, environ, start_response)
File '/usr/lib/python2.6/dist-packages/pylons/controllers/core.py', line 211 in __call__
response = self._dispatch_call()
File '/usr/lib/python2.6/dist-packages/pylons/controllers/core.py', line 162 in _dispatch_call
response = self._inspect_call(func)
File '/usr/lib/python2.6/dist-packages/pylons/controllers/core.py', line 105 in _inspect_call
result = self._perform_call(func, args)
File '/usr/lib/python2.6/dist-packages/pylons/controllers/core.py', line 57 in _perform_call
return func(**args)
File '/usr/lib/python2.6/dist-packages/nipapwww/controllers/auth.py', line 31 in login
if not auth.authenticate():
File '/usr/lib/python2.6/dist-packages/nipap/authlib.py', line 308 in authenticate
self._ldap_conn.simple_bind_s('uid=' + self.username + ',' + self._ldap_basedn, self.password)
File '/usr/lib/python2.6/dist-packages/ldap/ldapobject.py', line 207 in simple_bind_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_DN_SYNTAX: {'info': 'invalid DN', 'desc': 'Invalid DN syntax'}
```