Just figured out what the problem was.

add to encode "username" to utf-8 to send it to the radius.

username_enc = username.encode('utf-8')

and use it in the server connection.




iGama wrote:
> Hy all!
>
> I'm trying to use Radius to Auth in to Django.
>
> This is the code im using for the auth backend : http://pastebin.com/m57597407
>
> Using Django 1.0.2, Ubuntu Intrepid
>
> This is my error Report :
> -----------------------------------------------------------------------------------
> Environment:
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/
> Django Version: 1.0.2 final
> Python Version: 2.5.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'RFIDPortal.portal',
>  'django.contrib.admin']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
>
> Traceback:
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in get_response
>   86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
> in root
>   141.             return self.login(request)
> File "/usr/lib/python2.5/site-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   44.         response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
> in login
>   241.         user = authenticate(username=username,
> password=password)
> File "/usr/lib/python2.5/site-packages/django/contrib/auth/
> __init__.py" in authenticate
>   36.             user = backend.authenticate(**credentials)
> File "/home/igama/Private/workspace/RFID-Portal/src/RFIDPortal/../
> RFIDPortal/radiusauth.py" in authenticate
>   29.         reply=srv.SendPacket(req)
> File "/home/igama/Private/workspace/RFID-Portal/src/RFIDPortal/../
> RFIDPortal/pyrad/client.py" in SendPacket
>   166.                        return self._SendPacket(pkt, self.authport)
> File "/home/igama/Private/workspace/RFID-Portal/src/RFIDPortal/../
> RFIDPortal/pyrad/client.py" in _SendPacket
>   130.                        self._socket.sendto(pkt.RequestPacket(), 
> (self.server,
> port))
> File "/home/igama/Private/workspace/RFID-Portal/src/RFIDPortal/../
> RFIDPortal/pyrad/packet.py" in RequestPacket
>   384.                attr=self._PktEncodeAttributes()
> File "/home/igama/Private/workspace/RFID-Portal/src/RFIDPortal/../
> RFIDPortal/pyrad/packet.py" in _PktEncodeAttributes
>   287.                                result+=self._PktEncodeAttribute(code, 
> data)
>
> Exception Type: UnicodeDecodeError at /admin/
> Exception Value: 'ascii' codec can't decode byte 0xdc in position 2:
> ordinal not in range(128)
>
> -----------------------------------------------------------------------------------
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to