+def do_kline(parts):
+ if len(parts)!=4:
+ sys.stderr.write("WARNING: Wrong number of parameters on line %i\n" % lno)
+ return
+ letter,host,reason,user=parts
+ print "Kill {"
+ if host[:2]=="$R":
+ if host=="$R":
+ sys.stderr.write("WARNING: Empty realname kline on line %i\n" % lno)
+ print "\trealname = \"%s\";" % qstr(host[2:])
+ else:
+ print "\thost = \"%s@%s\";" % (qstr(user),qstr(host))
+ if reason[:1]=="!":
+ print "\tfile = \"%s\";" % qstr(reason[1:])
+ else:
+ print "\treason = \"%s\";" % qstr(reason)
+ print "};"
+ print
+
+def do_iline(parts):
+ if len(parts)!=6:
+ sys.stderr.write("WARNING: I:line doesn't have enough fields on line %i\n" % lno)
+ return
+ iline,ip,password,host,dummy,clss = parts
+ for i in [0,1]:
+ mask = [ip,host][i]
+ # Ignore things that aren't masks
+ if "." not in mask and "*" not in mask and "@" not in mask:
+ continue
+ if "@" in mask:
+ user,host = split(mask,"@")
+ else:
+ user,host = "*",mask
+ if i==0 and not re.match("^[0-9\.\*]+$",host):
+ sys.stderr.write("WARNING: Bad IP mask in line %s (%s)\n" % (lno,repr(mask)))
+ continue
+ print "Client {"
+ if re.match("^[1-9][1-9]?$",password):
+ print "\tmaxlinks = %s;" % int(password)
+ elif password:
+ print "\tpassword = \"%s\";" % qstr(password)
+ print "\tclass = \"%s\";" % clss
+ if i == 0:
+ print "\tip = \"%s\";" % qstr(host)
+ else:
+ print "\thost = \"%s\";" % qstr(host)
+ if user!="*":
+ print "\tusername = \"%s\";" % qstr(user)
+ print "};"
+ print
+
+def do_cline(parts):
+ name=lower(parts[3])
+ if not connects.has_key(name):
+ connects[name]={}
+ connects[name]["host"]=parts[1]
+ connects[name]["password"]=parts[2]
+ connects[name]["name"]=parts[3]
+ connects[name]["port"]=parts[4]
+ connects[name]["class"]=parts[5]
+