summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-23 23:46:19 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-24 03:19:31 +0100
commit289632f85eefe987b429f6ca8500b3a17e42ebbb (patch)
tree2d98d41fd42ea42194f64ce1d7a2e752e570380a /selftest/target
parentf18d9e147d4a242cdfb31a816d91d277b99badae (diff)
downloadsamba-289632f85eefe987b429f6ca8500b3a17e42ebbb.tar.gz
samba-289632f85eefe987b429f6ca8500b3a17e42ebbb.tar.bz2
samba-289632f85eefe987b429f6ca8500b3a17e42ebbb.zip
selftest.py: Add mk_realms_stanza function.
Diffstat (limited to 'selftest/target')
-rw-r--r--selftest/target/samba.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/selftest/target/samba.py b/selftest/target/samba.py
index 5e652a3528..025dbaeed8 100644
--- a/selftest/target/samba.py
+++ b/selftest/target/samba.py
@@ -22,3 +22,35 @@ def bindir_path(binary_mapping, bindir, path):
if os.path.isfile(valpath):
return valpath
return path
+
+
+def mk_realms_stanza(realm, dnsname, domain, kdc_ipv4):
+ """Create a realms stanza for use in a krb5.conf file.
+
+ :param realm: Real name
+ :param dnsname: DNS name matching the realm
+ :param domain: Domain name
+ :param kdc_ipv4: IPv4 address of the KDC
+ :return: String with stanza
+ """
+ return """\
+ %(realm)s = {
+ kdc = %(kdc_ipv4)s:88
+ admin_server = %(kdc_ipv4)s:88
+ default_domain = %(dnsname)s
+ }
+ %(dnsname)s = {
+ kdc = %(kdc_ipv4)s:88
+ admin_server = %(kdc_ipv4)s:88
+ default_domain = %(dnsname)s
+ }
+ %(domain)s = {
+ kdc = %(kdc_ipv4)s:88
+ admin_server = %(kdc_ipv4)s:88
+ default_domain = %(dnsname)s
+ }
+
+""" % {
+ "kdc_ipv4": kdc_ipv4, "dnsname": dnsname, "realm": realm, "domain": domain}
+
+