summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-06-10 11:43:18 +1000
committerStefan Metzmacher <metze@samba.org>2013-06-12 10:02:07 +0200
commiteec29db7c237c70732f94e33147c960fa8df39fb (patch)
tree48cb22ed16edbc0ea6e5355f040173a019ce37bc /python
parent3e66cb7d771e9f2156f4183485736cca7d5609f9 (diff)
downloadsamba-eec29db7c237c70732f94e33147c960fa8df39fb.tar.gz
samba-eec29db7c237c70732f94e33147c960fa8df39fb.tar.bz2
samba-eec29db7c237c70732f94e33147c960fa8df39fb.zip
python samba-tool drs: Correctly print KCC references to deleted servers
Tested against Windows 2008R2, presumably before the KCC ran. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/drs.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py
index ff8d8304eb..de78ac71c7 100644
--- a/python/samba/netcmd/drs.py
+++ b/python/samba/netcmd/drs.py
@@ -170,10 +170,19 @@ class cmd_drs_showrepl(Command):
self.message("==== KCC CONNECTION OBJECTS ====\n")
for c in conn:
- c_rdn, sep, c_server_dn = c['fromServer'][0].partition(',')
- c_server_res = self.samdb.search(base=c_server_dn, scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])
- c_server_dns = c_server_res[0]["dnsHostName"][0]
self.message("Connection --")
+
+ c_rdn, sep, c_server_dn = c['fromServer'][0].partition(',')
+ try:
+ c_server_res = self.samdb.search(base=c_server_dn, scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])
+ c_server_dns = c_server_res[0]["dnsHostName"][0]
+ except ldb.LdbError, (errno, _):
+ if errno == ldb.ERR_NO_SUCH_OBJECT:
+ self.message("\tWARNING: Connection to DELETED server!")
+ c_server_dns = ""
+ except KeyError:
+ c_server_dns = ""
+
self.message("\tConnection name: %s" % c['name'][0])
self.message("\tEnabled : %s" % attr_default(c, 'enabledConnection', 'TRUE'))
self.message("\tServer DNS name : %s" % c_server_dns)