+
+if config.pwfile:
+ try:
+ pwperm = os.stat(config.pwfile)[0]
+ pwreadable = pwperm & (S_IRGRP | S_IROTH)
+ if pwreadable:
+ if pwreadable == (S_IRGRP | S_IROTH):
+ readable_by = "group and others"
+ elif pwreadable == S_IRGRP:
+ readable_by = "group"
+ else:
+ readable_by = "others"
+ print "WARNING: Password file %s is readable by %s" % (
+ config.pwfile, readable_by)
+
+ pwfile = open(config.pwfile, "r")
+ pw = string.strip(pwfile.readline())
+ pwfile.close()
+ except Exception, e:
+ fatal("Can't read secret from pwfile %s: %s" % (config.pwfile, e))
+else:
+ print "no pwfile specified, binding anonymously"
+ pw = ""
+