Skip to content
Permalink
Browse files

Add check for unwanted LDAPv3 nodes bound to the local host.

  • Loading branch information...
cyrusdaboo committed Jun 8, 2015
1 parent eb17a77 commit 9b353eedb558bf24310a1ffe3e355f1c082cee3c
Showing with 20 additions and 0 deletions.
  1. +20 −0 odsetup.py
@@ -282,6 +282,24 @@ def cmd(args, input=None, raiseOnFail=True):



def checkDataSource(node):
"""
Verify that the specified node is the only node this host is bound to.
@param node: the node to verify
@type node: L{str}
"""

result = cmd("dscl localhost -list /LDAPv3")
result = ["/LDAPv3/{}".format(subnode) for subnode in result[0].splitlines()]
if len(result) > 1 or result[0] != node:
print "Error: Host is bound to other directory nodes: {}".format(result)
print "CalDAVTester will likely fail with other nodes present."
print "Please remove all nodes except the one being used for odsetup."
sys.exit(1)



def readConfig():
"""
Read useful information from calendarserver_config
@@ -710,6 +728,8 @@ def manageRecords(path, user):
usage()
raise ValueError

checkDataSource(directory_node)

if args[0] == "create":
# Read the caldavd.plist file and extract some information we will need.
hostname, port, sslport, authtype, docroot = readConfig()

0 comments on commit 9b353ee

Please sign in to comment.
You can’t perform that action at this time.