Project

General

Profile

Task #370

Associated revisions

Revision 4 (diff)
Added by Luke Murphey about 12 years ago

Added the basic authentication script as well as unit tests. Closes #370.

Revision 2 (diff)
Added by Luke Murphey about 12 years ago

Added the basic authentication script as well as unit tests. Closes #370.

Revision 18 (diff)
Added by Luke Murphey about 12 years ago

Updated the authentication script such that it loads conf files even if they have a UTF-8 byte order mark (closes #370)

Revision 15 (diff)
Added by Luke Murphey about 12 years ago

Updated the authentication script such that it loads conf files even if they have a UTF-8 byte order mark (closes #370)

History

#1 Updated by Luke Murphey about 12 years ago

  • Assignee set to Luke Murphey

#2 Updated by Luke Murphey about 12 years ago

  • Status changed from New to In Progress

#3 Updated by Luke Murphey about 12 years ago

  • Target version set to 1.0.0

#4 Updated by Luke Murphey about 12 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

Applied in changeset r4.

#5 Updated by Luke Murphey about 12 years ago

The current script does not read the conf files created by Splunk because Splunk includes some junk at the top of the file. This can be addressed using the following options:

  1. Utilize the Splunk conf parsing libraries
  2. Write my own parsing library
  3. Chop the the junk off and hand the resulting string to the config parser
  4. Try a different parser (like http://code.google.com/p/configobj/)

It is possible that the characters I am seeing are the BOM character. Note that bom_aware_readline in ($SPLUNK_HOME/lib/python2.7/site-packages/splunk/clilib/cli_common.py) may be filtering this:

def bom_aware_readline(fileobj):
    atstart = (fileobj.tell() == 0)
    line = "" 
    while True:
        l = fileobj.readline()
        if atstart:
            if len(l) > 2 and ord(l[0]) == 239 and ord(l[1]) == 187 and ord(l[2]) == 191:
                # UTF-8 BOM detected: skip it over
                l = l[3:]
            atstart = False
        # if line ends with \, append \n, then to the top of the loop to append the next line.
        if l.rstrip("\r\n").endswith("\\"):
          line += l.rstrip("\r\n")
          line += "\n" 
        else:
          line += l
          break
    return line

#6 Updated by Luke Murphey about 12 years ago

  • Status changed from Closed to In Progress

#7 Updated by Luke Murphey about 12 years ago

The UTF-8 BOM mark is 0xEF,0xBB,0xBF.

#8 Updated by Luke Murphey about 12 years ago

Confirmed that the characters I am seeing are the BOM mark. The unit tests indicate the following:

MissingSectionHeaderError: File contains no section headers.
file: test_load_bad_conf\default\radius.conf, line: 1
'\xef\xbb\xbf\n'

#9 Updated by Luke Murphey about 12 years ago

  • Status changed from In Progress to Closed

Applied in changeset r18.

Also available in: Atom PDF