[OpenSIPS-Users] bug in the RadiusDictionaryFile fonction

Geoffroy Rabouin geoffroy.rabouin at gmail.com
Tue Oct 7 12:02:36 CEST 2008


Hi,
There is a bug when a $INCLUDE is use in the dict file of the
radiusclient-ng.
If I concatenate all my dict in one bigger, all is ok.
I try to make a fonction who handle the $INCLUDE :
class RadiusDictionaryFile(object):
*    def __init__(self, base_file_name):
        self.file_names = [base_file_name]
        log.warn(base_file_name)
        self.fd_stack = [open(base_file_name)]

    def readlines(self):
        i=-1
        while i<len(self.fd_stack)-1:
            line = self.fd_stack[i].readline()
            if line:
                if line.startswith("$INCLUDE"):
                    file_name = line.rstrip("\n").split(None, 1)[1]
                    if file_name not in self.file_names:
                        self.file_names.append(file_name)
                        self.fd_stack.append(open(file_name))
                    continue
                else:
                    yield line
            else:
                self.fd_stack.pop()
                if len(self.fd_stack) == 0:
                    return
            i=i+1*


Let me know if this is correct for you.
Have a nice day.

-- 
Geoffroy Rabouin
HighColoc
13710 La Barque
FRANCE
téléphone : +33 6-27-19-13-07

-- 
Geoffroy Rabouin
HighColoc
13710 La Barque
téléphone : 06-27-19-13-07
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20081007/7c2ba15e/attachment.htm 


More information about the Users mailing list