I am stumbling here.
How can I validate a domain-spec?
Here's what PySPF does:
PAT_CHAR = r'%(%|_|-|(\{[^\}]*\}))'
RE_TOPLAB = re.compile(r'\.(?:[0-9a-z]*[a-z][0-9a-z]*|
[0-9a-z]+-[0-9a-z-]*[0-9a-z])\.?$|%s'
% PAT_CHAR, re.IGNORECASE)
if RE_TOPLAB.split(arg)[-1]:
raise PermError('Invalid domain found (use FQDN)', arg)
Simple, right? Except for this:
I can't reproduce this in C. I have been trying for hours, but translating
this into a POSIX regexp, and then using my limited implementation of split()
just doesn't seem to cut it (either the translation or my split() is surely
wrong).
Anyone knows where I can find a nice, simple, C implementation of this
validation? Or at least one without regexps? If I get that, RASPF should pass
142 of the 145 tests...
--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) ralsina@kde.org
(_Y_.)' ._ ) `._`. " -.-' KDE Developer (MFCH)
_..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.' Buenos Aires - Argentina
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it. --Brian W. Kernighan
-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?list_id=1007
How can I validate a domain-spec?
Here's what PySPF does:
PAT_CHAR = r'%(%|_|-|(\{[^\}]*\}))'
RE_TOPLAB = re.compile(r'\.(?:[0-9a-z]*[a-z][0-9a-z]*|
[0-9a-z]+-[0-9a-z-]*[0-9a-z])\.?$|%s'
% PAT_CHAR, re.IGNORECASE)
if RE_TOPLAB.split(arg)[-1]:
raise PermError('Invalid domain found (use FQDN)', arg)
Simple, right? Except for this:
I can't reproduce this in C. I have been trying for hours, but translating
this into a POSIX regexp, and then using my limited implementation of split()
just doesn't seem to cut it (either the translation or my split() is surely
wrong).
Anyone knows where I can find a nice, simple, C implementation of this
validation? Or at least one without regexps? If I get that, RASPF should pass
142 of the 145 tests...
--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) ralsina@kde.org
(_Y_.)' ._ ) `._`. " -.-' KDE Developer (MFCH)
_..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.' Buenos Aires - Argentina
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it. --Brian W. Kernighan
-------
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?list_id=1007