@@ -56,12 +56,20 @@ def setup_wrappers(base):
5656 f .write ('%s %s\n ' % (WRAP_IPADDR , WRAP_ALIASNAME ))
5757 f .write ('%s %s\n ' % (WRAP_IPADDR , WRAP_FAILNAME ))
5858
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+
5966 wenv = {'LD_PRELOAD' : 'libsocket_wrapper.so libnss_wrapper.so' ,
6067 'SOCKET_WRAPPER_DIR' : wrapdir ,
6168 'SOCKET_WRAPPER_DEFAULT_IFACE' : '9' ,
6269 'WRAP_PROXY_PORT' : WRAP_PROXY_PORT ,
6370 'NSS_WRAPPER_HOSTNAME' : WRAP_HOSTNAME ,
64- 'NSS_WRAPPER_HOSTS' : hosts_file }
71+ 'NSS_WRAPPER_HOSTS' : hosts_file ,
72+ 'NSS_WRAPPER_PASSWD' : passwd_file }
6573 return wenv
6674
6775
@@ -660,6 +668,40 @@ def test_hostname_acceptor(testdir, testenv, logfile):
660668 return 0
661669
662670
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+
663705if __name__ == '__main__' :
664706 args = parse_args ()
665707
@@ -701,6 +743,9 @@ def test_hostname_acceptor(testdir, testenv, logfile):
701743
702744 errs += test_bad_acceptor_name (testdir , testenv , logfile )
703745
746+ testenv ['MAG_REMOTE_USER' ] = USR_NAME
747+ errs += test_gss_localname (testdir , testenv , logfile )
748+
704749 rpm_path = "/usr/lib64/krb5/plugins/preauth/pkinit.so"
705750 deb_path = "/usr/lib/x86_64-linux-gnu/krb5/plugins/preauth/pkinit.so"
706751 if os .path .exists (rpm_path ) or os .path .exists (deb_path ):
0 commit comments