summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-17 17:06:29 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-17 19:02:19 +1000
commit90d685afe57e08ce7da575783c4d279e1be021f6 (patch)
treee700d2623ae4dcbc86b23ace207534023b61e413 /source4
parentfb81cc080d40844010daae559e6be6a747c10ecd (diff)
downloadsamba-90d685afe57e08ce7da575783c4d279e1be021f6.tar.gz
samba-90d685afe57e08ce7da575783c4d279e1be021f6.tar.bz2
samba-90d685afe57e08ce7da575783c4d279e1be021f6.zip
s4-devel: developer script for adding DNS entries via netlogon RPC
this calls the netlogon DsrUpdateReadOnlyServerDnsRecords call to add DNS entries for a RODC via RPC calls. The call is routed via a IRPC call to winbind, as winbind is the one with the schannel credential chaining setup. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/devel/rodcdns43
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/scripting/devel/rodcdns b/source4/scripting/devel/rodcdns
new file mode 100755
index 0000000000..bd24342ab8
--- /dev/null
+++ b/source4/scripting/devel/rodcdns
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# script to call a netlogon RODC DNS update
+
+import sys
+from optparse import OptionParser
+
+sys.path.insert(0, "bin/python")
+
+import samba
+import samba.getopt as options
+from samba.dcerpc import netlogon, winbind
+
+########### main code ###########
+if __name__ == "__main__":
+ parser = OptionParser("rodcdns [options]")
+ sambaopts = options.SambaOptions(parser)
+
+ parser.add_option("", "--weight", dest="weight", help="record weight", default=0, type='int')
+ parser.add_option("", "--priority", dest="priority", help="record priority", default=100, type='int')
+ parser.add_option("", "--port", dest="port", help="port number", default=389, type='int')
+ parser.add_option("", "--type", dest="type", help="record type", default=netlogon.NlDnsLdapAtSite, type='int')
+ parser.add_option("", "--site", dest="site", help="site name", default="Default-First-Site-Name")
+
+ (opts, args) = parser.parse_args()
+
+ lp = sambaopts.get_loadparm()
+
+ w = winbind.winbind("irpc:winbind_server", lp)
+
+ dns_names = netlogon.NL_DNS_NAME_INFO_ARRAY()
+ dns_names.count = 1
+ name = netlogon.NL_DNS_NAME_INFO()
+ name.type = opts.type
+ name.priority = opts.priority
+ name.weight = opts.weight
+ name.port = opts.port
+ name.dns_register = True
+ dns_names.names = [ name ]
+ site_name = opts.site.decode('utf-8')
+
+ ret_names = w.DsrUpdateReadOnlyServerDnsRecords(site_name, 600, dns_names)
+ print("Status: %u" % ret_names.names[0].status)