@@ -56,12 +56,20 @@ def setup_wrappers(base):
56
56
f .write ('%s %s\n ' % (WRAP_IPADDR , WRAP_ALIASNAME ))
57
57
f .write ('%s %s\n ' % (WRAP_IPADDR , WRAP_FAILNAME ))
58
58
59
+ passwd_file = os .path .join (testdir , 'passwd' )
60
+ with open (passwd_file , 'w+' ) as f :
61
+ f .write ('root:x:0:0:root:/root:/bin/sh' )
62
+ f .write ('maguser:x:1:1:maguser:/maguser:/bin/sh' )
63
+ f .write ('maguser2:x:2:2:maguser2:/maguser2:/bin/sh' )
64
+ f .write ('maguser3:x:3:3:maguser3:/maguser3:/bin/sh' )
65
+
59
66
wenv = {'LD_PRELOAD' : 'libsocket_wrapper.so libnss_wrapper.so' ,
60
67
'SOCKET_WRAPPER_DIR' : wrapdir ,
61
68
'SOCKET_WRAPPER_DEFAULT_IFACE' : '9' ,
62
69
'WRAP_PROXY_PORT' : WRAP_PROXY_PORT ,
63
70
'NSS_WRAPPER_HOSTNAME' : WRAP_HOSTNAME ,
64
- 'NSS_WRAPPER_HOSTS' : hosts_file }
71
+ 'NSS_WRAPPER_HOSTS' : hosts_file ,
72
+ 'NSS_WRAPPER_PASSWD' : passwd_file }
65
73
return wenv
66
74
67
75
@@ -660,6 +668,40 @@ def test_hostname_acceptor(testdir, testenv, logfile):
660
668
return 0
661
669
662
670
671
+ def test_gss_localname (testdir , testenv , logfile ):
672
+ hdir = os .path .join (testdir , 'httpd' , 'html' , 'gss_localname' )
673
+ os .mkdir (hdir )
674
+ shutil .copy ('tests/localname.html' , os .path .join (hdir , 'index.html' ))
675
+ error_count = 0
676
+
677
+ # Make sure spnego is explicitly tested
678
+ spnego = subprocess .Popen (["tests/t_localname.py" , "SPNEGO" ],
679
+ stdout = logfile , stderr = logfile ,
680
+ env = testenv , preexec_fn = os .setsid )
681
+ spnego .wait ()
682
+ if spnego .returncode != 0 :
683
+ sys .stderr .write ('LOCALNAME(SPNEGO): FAILED\n ' )
684
+ error_count += 1
685
+ else :
686
+ sys .stderr .write ('LOCALNAME(SPNEGO): SUCCESS\n ' )
687
+
688
+ # and bare krb5 (GS2-KRB5 is the name used by SASL for it)
689
+ krb5 = subprocess .Popen (["tests/t_localname.py" , "GS2-KRB5" ],
690
+ stdout = logfile , stderr = logfile ,
691
+ env = testenv , preexec_fn = os .setsid )
692
+ krb5 .wait ()
693
+ if krb5 .returncode != 0 :
694
+ if krb5 .returncode == 42 :
695
+ sys .stderr .write ('LOCALNAME(KRB5): SKIPPED\n ' )
696
+ else :
697
+ sys .stderr .write ('LOCALNAME(KRB5): FAILED\n ' )
698
+ error_count += 1
699
+ else :
700
+ sys .stderr .write ('LOCALNAME(KRB5): SUCCESS\n ' )
701
+
702
+ return error_count
703
+
704
+
663
705
if __name__ == '__main__' :
664
706
args = parse_args ()
665
707
@@ -701,6 +743,9 @@ def test_hostname_acceptor(testdir, testenv, logfile):
701
743
702
744
errs += test_bad_acceptor_name (testdir , testenv , logfile )
703
745
746
+ testenv ['MAG_REMOTE_USER' ] = USR_NAME
747
+ errs += test_gss_localname (testdir , testenv , logfile )
748
+
704
749
rpm_path = "/usr/lib64/krb5/plugins/preauth/pkinit.so"
705
750
deb_path = "/usr/lib/x86_64-linux-gnu/krb5/plugins/preauth/pkinit.so"
706
751
if os .path .exists (rpm_path ) or os .path .exists (deb_path ):
0 commit comments