pyradius / pyrad

Python RADIUS Implementation
BSD 3-Clause "New" or "Revised" License
295 stars 186 forks source link

[PATCH] Various problems with freeradius 2.1.x dictionary #4

Open candlerb opened 13 years ago

candlerb commented 13 years ago

Using pyrad-2.0 (from easy_install), pointing it at freeradius 2.1.10's dictionary collection:

>>> from pyrad.dictionary import Dictionary
>>> Dictionary("/etc/freeradius/dictionary")
...
ParseError: dictionary.rfc5904(16): Parse error: Illegal type: short
>>> 

I hacked it about to add short and byte. This leaves two incompatible dictionary files: pyrad doesn't like <type> array (dictionary.dhcp) and there are various things in dictionary.wimax. such as VENDOR ... format=1,1,c, signed, flv and combo-ip (whatever that is)

I knocked together some quick patches (no test cases) and they're in the following branch: https://github.com/candlerb/pyrad/tree/candlerb%2Fshortbyte

It now at least reads the dictionary, even if it doesn't actually make use of attributes like 'array'

PigossiJr commented 7 years ago

Hello there. I am on the same problem. Could anyone please help me?

GIC-de commented 7 years ago

@PigossiJr I'm working on a new version including the required fix. The latest master already contains short and signed. Can you describe your issue in detail please!

candlerb commented 7 years ago

I'm not sure what you want me to do, having assigned it to me :-)

I don't use pyrad these days. However I have just done a quick re-test with pyrad master branch and dictionaries from freeradius-3.0.x master:

>>> from pyrad.dictionary import Dictionary
>>> Dictionary("/Users/brian/git/freeradius-server/share/dictionary")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyrad/dictionary.py", line 146, in __init__
    self.ReadDictionary(dict)
  File "pyrad/dictionary.py", line 338, in ReadDictionary
    self.__ParseAttribute(state, tokens)
  File "pyrad/dictionary.py", line 215, in __ParseAttribute
    line=state['line'])
pyrad.dictionary.ParseError: dictionary.rfc2865(34): Parse error: Illegal type: vsa

It appears to be objecting to this:

./dictionary.rfc2865:ATTRIBUTE  Vendor-Specific             26  vsa

Commenting that out, I get this error:

pyrad.dictionary.ParseError: dictionary.rfc4679(18): Parse error: Illegal type: tlv

Commenting that out:

pyrad.dictionary.ParseError: dictionary.rfc6572(20): Parse error: Illegal type: ipv4prefix

Then:

pyrad.dictionary.ParseError: dictionary.rfc6929(13): Parse error: Illegal type: extended

pyrad.dictionary.ParseError: dictionary.rfc6929(17): Parse error: Illegal type: long-extended

pyrad.dictionary.ParseError: dictionary.alcatel-lucent.aaa(42): Parse error: Illegal type: combo-ip

So there are still plenty of incompatibiliities with FreeRADIUS's dictionary files.

PigossiJr commented 7 years ago

Hello buddy. I have attached my dictionary file that I guess is triggering that error.

Basically, my scenario is: I am trying to run the simplest code of pyrad: https://pypi.python.org/pypi/pyrad

And after creating a file which contains the same code from https://pypi.python.org/pypi/pyrad, I tried to run by the command line: python auth.py.

After that, I got that error...something related to my dictionary file. dictionary.txt

I really appreciate your effort in helping me ! Thanks a lot!

rewinslove commented 7 years ago

@candlerb I have solved this problem, My dictionary file is copied from Windows NPS, At first, some error happened, Then I type # before the line where errors find. If your error is 3gpp Change dictionary file like this: #$INCLUDE dictionary.3gpp So I think the reason is this packet have some problem in compatible with these attribute.