components/krb5/patches/063-disable-rev-dns-lookup.patch
author Neng Xue <neng.xue@oracle.com>
Mon, 26 Sep 2016 15:58:55 -0700
changeset 6978 14cbeb78966a
parent 6599 1d033832c5e7
permissions -rw-r--r--
24669827 Update Userland krb5 to MIT 1.14.4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     1
#
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     2
# This patch disables reverse DNS IP address look-ups that MIT does by default.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     3
# Solaris krb has never done reverse look-ups so this makes MIT krb behave like
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     4
# Solaris in this regard.  MIT will not take this change upstream.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     5
# Patch source: in-house
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     6
#
6599
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
     7
--- a/src/lib/krb5/os/sn2princ.c
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
     8
+++ b/src/lib/krb5/os/sn2princ.c
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
     9
@@ -36,7 +36,7 @@
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    10
 #endif
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    11
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    12
 #if !defined(DEFAULT_RDNS_LOOKUP)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    13
-#define DEFAULT_RDNS_LOOKUP 1
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    14
+#define DEFAULT_RDNS_LOOKUP 0
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    15
 #endif
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    16
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    17
 /*
6599
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    18
--- a/src/man/krb5.conf.man
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    19
+++ b/src/man/krb5.conf.man
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    20
@@ -473,7 +473,7 @@ default, if allowed by the KDC.  The default value is false.
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    21
 If this flag is true, reverse name lookup will be used in addition
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    22
 to forward name lookup to canonicalizing hostnames for use in
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    23
 service principal names.  If \fBdns_canonicalize_hostname\fP is set
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    24
-to false, this flag has no effect.  The default value is true.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    25
+to false, this flag has no effect.  The default value is false.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    26
 .TP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    27
 .B \fBrealm_try_domains\fP
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    28
 Indicate whether a host\(aqs domain components should be used to
6599
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    29
--- a/src/tests/t_sn2princ.py
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    30
+++ b/src/tests/t_sn2princ.py
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    31
@@ -6,10 +6,12 @@ offline = (len(args) > 0 and args[0] != "no")
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    32
 conf = {'domain_realm': {'kerberos.org': 'R1',
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    33
                          'example.com': 'R2',
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    34
                          'mit.edu': 'R3'}}
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    35
+rdns_conf = {'libdefaults': {'rdns': 'true'}}
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    36
 no_rdns_conf = {'libdefaults': {'rdns': 'false'}}
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    37
 no_canon_conf = {'libdefaults': {'dns_canonicalize_hostname': 'false'}}
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    38
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    39
 realm = K5Realm(create_kdb=False, krb5_conf=conf)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    40
+rdns = realm.special_env('rdns', False, krb5_conf=rdns_conf)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    41
 no_rdns = realm.special_env('no_rdns', False, krb5_conf=no_rdns_conf)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    42
 no_canon = realm.special_env('no_canon', False, krb5_conf=no_canon_conf)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    43
 
6092
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    44
@@ -30,6 +32,10 @@ def testnc(host, princhost, princrealm):
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    45
     # Test with the host-based name type with canonicalization disabled.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    46
     testbase(host, 'srv-hst', princhost, princrealm, env=no_canon)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    47
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    48
+def testr(host, princhost, princrealm):
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    49
+    # Test with the host-based name type with reverse lookup enabled.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    50
+    testbase(host, 'srv-hst', princhost, princrealm, env=rdns)
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    51
+
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    52
 def testnr(host, princhost, princrealm):
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    53
     # Test with the host-based name type with reverse lookup disabled.
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    54
     testbase(host, 'srv-hst', princhost, princrealm, env=no_rdns)
6599
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    55
@@ -96,9 +102,14 @@ if rname == fname:
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    56
               '%s reverse resolves to %s '
1d033832c5e7 24377741 Update Userland krb5 to MIT 1.14.3
Shawn Emery <shawn.emery@oracle.com>
parents: 6092
diff changeset
    57
               'which should be different from %s' % (oname, rname, fname))
6092
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    58
 
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    59
-# Test default canonicalization (forward and reverse lookup).
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    60
-test(oname, rname, 'R3')
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    61
-test(oname + ':123', rname + ':123', 'R3')
a2af9dc56276 23495203 t_sn2princ.py fails with host name mismatch
Shawn Emery <shawn.emery@oracle.com>
parents: 5490
diff changeset
    62
-test(oname + ':xyZ', rname + ':xyZ', 'R3')
5490
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    63
+# Test forward+reverse lookup canonicalization (rdns=true).
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    64
+testr(oname, rname, 'R3')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    65
+testr(oname + ':123', rname + ':123', 'R3')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    66
+testr(oname + ':xyZ', rname + ':xyZ', 'R3')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    67
+
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    68
+# Test default canonicalization (forward lookup).
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    69
+test(oname, fname, 'R1')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    70
+test(oname + ':123', fname + ':123', 'R1')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    71
+test(oname + ':xyZ', fname + ':xyZ', 'R1')
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    72
 
9bf0bc57423a PSARC/2015/144 Kerberos 1.13 Delivery to Userland
Will Fiveash <will.fiveash@oracle.com>
parents:
diff changeset
    73
 success('krb5_sname_to_principal tests')