From: Sam Hartman Date: Thu, 12 Aug 2004 00:53:10 +0000 (+0000) Subject: Import OpenAFS 1.3.70 sources X-Git-Tag: upstream/1.3.70 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=e16de1064a77b1d621b95349767d582bd25bf0a6;p=packages%2Fo%2Fopenafs.git Import OpenAFS 1.3.70 sources as tagged in openafs.org cvs --- diff --git a/.cvsignore b/.cvsignore index 36ed4a61e..bcd5ed6da 100644 --- a/.cvsignore +++ b/.cvsignore @@ -20,3 +20,8 @@ sun4x_57 autom4te.cache ID TAGS +dest +obj +NTLang.bat +NTMakefile +golast.bat diff --git a/Makefile.in b/Makefile.in index c4ca338a0..23c26e9c6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -443,7 +443,7 @@ butc: cmd comerr bubasics butm budb bucoord cmd rxgen rx tbutc: cmd comerr bubasics butm budb bucoord cmd butc case ${SYS_NAME} in \ - alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix4*|*linux*|hp_ux11*|ia64_hpux*) \ + alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \ ${COMPILE_PART1} tbutc ${COMPILE_PART2} ;; \ *) \ echo Not building MT butc for ${SYS_NAME} ;; \ @@ -548,13 +548,13 @@ jafs: libjafs jafsadm: libjafsadm finale: project cmd comerr afsd allrcmds butc tbutc @ENABLE_KERNEL_MODULE@ libuafs audit kauth log package \ - ptserver scout bu_utils ubik uss bozo vfsck volser \ + ptserver scout bu_utils ubik uss bozo vfsck volser tvolser \ venus update xstat afsmonitor dauth rxdebug libafsrpc \ libafsauthent shlibafsrpc shlibafsauthent libadmin ${COMPILE_PART1} finale ${COMPILE_PART2} finale_nolibafs: project cmd comerr afsd allrcmds butc tbutc libuafs audit kauth log package \ - ptserver scout bu_utils ubik uss bozo vfsck volser \ + ptserver scout bu_utils ubik uss bozo vfsck volser tvolser \ venus update xstat afsmonitor dauth rxdebug libafsrpc \ libafsauthent shlibafsrpc shlibafsauthent libadmin ${COMPILE_PART1} finale ${COMPILE_PART2} @@ -609,9 +609,9 @@ clean2: -${COMPILE_PART1} vol ${COMPILE_CLEAN} -${COMPILE_PART1} vlserver ${COMPILE_CLEAN} -${COMPILE_PART1} viced ${COMPILE_CLEAN} - -${COMPILE_PART1} viced ${COMPILE_CLEAN} -${COMPILE_PART1} tviced ${COMPILE_CLEAN} -${COMPILE_PART1} volser ${COMPILE_CLEAN} + -${COMPILE_PART1} tvolser ${COMPILE_CLEAN} -${COMPILE_PART1} venus ${COMPILE_CLEAN} -${COMPILE_PART1} venus/test ${COMPILE_CLEAN} -${COMPILE_PART1} afsd ${COMPILE_CLEAN} @@ -782,6 +782,7 @@ distclean: clean src/tests/OpenAFS/Dirpath.pm \ src/tsm41/Makefile \ src/tviced/Makefile \ + src/tvolser/Makefile \ src/ubik/Makefile \ src/update/Makefile \ src/usd/test/Makefile \ diff --git a/README b/README index e7ea09c0b..6757cd585 100644 --- a/README +++ b/README @@ -34,13 +34,14 @@ A. Creating the proper directory structure. alpha_dux50 (only tested on 5.0A, does not work with 5.1) i386_fbsd_42, i386_fbsd_43, i386_fbsd_44, i386_fbsd_45, i386_fbsd_46, i386_fbsd_47, i386_fbsd_50, i386_fbsd_51, - i386_fbsd_52 + i386_fbsd_52, i386_fbsd_53 i386_linux22 i386_linux24 i386_linux26 i386_umlinux22 i386_umlinux24 - i386_obsd31, i386_obsd32, i386_obsd33, i386_obsd34, i386_obsd35 + i386_obsd31, i386_obsd32, i386_obsd33, i386_obsd34, i386_obsd35, + i386_obsd36 rs_aix42 sgi_65 (file server not tested) sun4_413 (No client support, no fileserver support, db servers only) diff --git a/README-NT b/README-NT index 37895c8a5..292aa72ad 100644 --- a/README-NT +++ b/README-NT @@ -46,7 +46,8 @@ versions are supported: Microsoft Visual .NET Microsoft Visual .NET 2003 (recommended) - Any version of the Microsoft SDK and Tools released August 2001 or later. + Microsoft Platform SDK for Windows XP SP2 + [Core and Data Access SDKs are required] The NSIS installer requires about 14 MB of storage. The following version is supported. @@ -273,9 +274,9 @@ From the DOS command prompt window run: STEP I. Install Wix MSI Installer -Download the Wix 2.0.1727 installer from +Download the Wix 2.0.1927.1 installer from - http://prdownloads.sourceforge.net/wix/sources-2.0.1727.0.zip + http://prdownloads.sourceforge.net/wix/sources-2.0.1927.1.zip Apply the following patches to the source tree and execute @@ -286,11 +287,11 @@ from the \src\wix directory. Index: src/wix/Compiler.cs =================================================================== RCS file: /cvsroot/wix/wix/src/wix/Compiler.cs,v -retrieving revision 1.9 -diff -u -b -r1.9 Compiler.cs ---- src/wix/Compiler.cs 31 May 2004 01:07:39 -0000 1.9 -+++ src/wix/Compiler.cs 20 Jun 2004 14:06:54 -0000 -@@ -657,7 +657,7 @@ +retrieving revision 1.10 +diff -u -w -r1.10 Compiler.cs +--- src/wix/Compiler.cs 28 Jul 2004 15:50:22 -0000 1.10 ++++ src/wix/Compiler.cs 4 Aug 2004 16:28:16 -0000 +@@ -647,7 +647,7 @@ // add the core registry keys for each context in the class for (int i = 0; i < contextCount; ++i) { @@ -299,9 +300,9 @@ diff -u -b -r1.9 Compiler.cs if (null != icon) // ClassId default icon { if (null != iconIndex) -@@ -5710,6 +5710,20 @@ - break; - } +@@ -7385,6 +7385,20 @@ + break; + } break; + case "Delete": + switch (attrib.Value) @@ -320,7 +321,7 @@ diff -u -b -r1.9 Compiler.cs case "Wait": wait = Common.IsYes(attrib.Value, sourceLineNumbers, node.Name, attrib.Name, id) ? "1" : "0"; // strings used since integer column is nullable break; -@@ -7034,6 +7048,7 @@ +@@ -8715,6 +8729,7 @@ } bits ^= (bit * 65536); break; @@ -328,30 +329,14 @@ diff -u -b -r1.9 Compiler.cs default: bit = this.NameToBit(MsiInterop.CommonControlAttributes, attrib.Name, attrib.Value, node.Name, id); if (-1 == bit) -Index: src/wix/Decompiler.cs -=================================================================== -RCS file: /cvsroot/wix/wix/src/wix/Decompiler.cs,v -retrieving revision 1.6 -diff -u -b -r1.6 Decompiler.cs ---- src/wix/Decompiler.cs 21 May 2004 03:57:42 -0000 1.6 -+++ src/wix/Decompiler.cs 20 Jun 2004 14:06:54 -0000 -@@ -2562,7 +2562,7 @@ - this.writer.WriteAttributeString("Group", "yes"); - text = text.Substring(1); - } -- this.writer.WriteString(text); -+ this.writer.WriteAttributeString("Id", text); - this.writer.WriteEndElement(); - } - } Index: src/wix/Preprocessor.cs =================================================================== RCS file: /cvsroot/wix/wix/src/wix/Preprocessor.cs,v -retrieving revision 1.4 -diff -u -b -r1.4 Preprocessor.cs ---- src/wix/Preprocessor.cs 31 May 2004 01:07:40 -0000 1.4 -+++ src/wix/Preprocessor.cs 20 Jun 2004 14:06:55 -0000 -@@ -269,12 +269,12 @@ +retrieving revision 1.5 +diff -u -w -r1.5 Preprocessor.cs +--- src/wix/Preprocessor.cs 28 Jul 2004 15:50:22 -0000 1.5 ++++ src/wix/Preprocessor.cs 4 Aug 2004 16:28:16 -0000 +@@ -267,12 +267,12 @@ break; case "ifdef": stack.Push(context); @@ -366,7 +351,7 @@ diff -u -b -r1.4 Preprocessor.cs ignore = true; break; case "elseif": -@@ -356,6 +356,8 @@ +@@ -354,6 +354,8 @@ break; case "endforeach": // endforeach is handled in PreprocessForeach, so seeing it here is an error throw new WixPreprocessorException(this.GetCurrentSourceLineNumbers(), "Cannot have a processing instruction without a matching ."); @@ -375,7 +360,7 @@ diff -u -b -r1.4 Preprocessor.cs default: // Console.WriteLine("processing instruction: {0}, {1}", reader.Name, reader.Value); break; -@@ -403,6 +405,22 @@ +@@ -401,6 +403,22 @@ } /// @@ -398,14 +383,41 @@ diff -u -b -r1.4 Preprocessor.cs /// Replaces parameters in the source text. /// /// Text that may contain parameters to replace. +Index: src/wix/wix.csproj +=================================================================== +RCS file: /cvsroot/wix/wix/src/wix/wix.csproj,v +retrieving revision 1.4 +diff -u -w -r1.4 wix.csproj +--- src/wix/wix.csproj 31 May 2004 01:07:40 -0000 1.4 ++++ src/wix/wix.csproj 4 Aug 2004 16:28:16 -0000 +@@ -659,9 +659,19 @@ + BuildAction = "EmbeddedResource" + /> + ++ ++ + + + Index: src/wix/Xsd/wix.xsd =================================================================== RCS file: /cvsroot/wix/wix/src/wix/Xsd/wix.xsd,v -retrieving revision 1.11 -diff -u -b -r1.11 wix.xsd ---- src/wix/Xsd/wix.xsd 31 May 2004 01:07:40 -0000 1.11 -+++ src/wix/Xsd/wix.xsd 20 Jun 2004 14:06:55 -0000 -@@ -1736,6 +1736,7 @@ +retrieving revision 1.12 +diff -u -w -r1.12 wix.xsd +--- src/wix/Xsd/wix.xsd 28 Jul 2004 15:50:24 -0000 1.12 ++++ src/wix/Xsd/wix.xsd 4 Aug 2004 16:28:17 -0000 +@@ -2733,6 +2733,7 @@ diff --git a/acinclude.m4 b/acinclude.m4 index ff614a303..0f7b78a86 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -523,6 +523,12 @@ else powerpc-apple-darwin7.3*) AFS_SYSNAME="ppc_darwin_70" ;; + powerpc-apple-darwin7.4*) + AFS_SYSNAME="ppc_darwin_70" + ;; + powerpc-apple-darwin7.5*) + AFS_SYSNAME="ppc_darwin_70" + ;; sparc-sun-solaris2.5*) AFS_SYSNAME="sun4x_55" enable_login="yes" diff --git a/aclocal.m4 b/aclocal.m4 index 0ce56829d..325b2a5e0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -535,6 +535,12 @@ else powerpc-apple-darwin7.3*) AFS_SYSNAME="ppc_darwin_70" ;; + powerpc-apple-darwin7.4*) + AFS_SYSNAME="ppc_darwin_70" + ;; + powerpc-apple-darwin7.5*) + AFS_SYSNAME="ppc_darwin_70" + ;; sparc-sun-solaris2.5*) AFS_SYSNAME="sun4x_55" enable_login="yes" @@ -2612,6 +2618,27 @@ case $AFS_SYSNAME in SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" ;; + sunx86_59) + CC="/opt/SUNWspro/bin/cc" + CCOBJ="/opt/SUNWspro/bin/cc" + LEX="lex" + LD="/usr/ccs/bin/ld" + MT_CC="/opt/SUNWspro/bin/cc" + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_LIBS="-lpthread -lsocket" + PAM_CFLAGS="-KPIC" + PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" + SHLIB_CFLAGS="-KPIC" + SHLIB_LDFLAGS="-G -Bsymbolic" + TXLIBS="-lcurses" + XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS="-dy -Bdynamic" + XLIBELFA="-lelf" + XLIBKVM="-lkvm" + XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl" + SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" + ;; + sunx86_510) CC="/opt/SUNWspro/bin/cc" CCOBJ="/opt/SUNWspro/bin/cc" diff --git a/configure b/configure index a9e67551a..d10426948 100644 --- a/configure +++ b/configure @@ -754,7 +754,7 @@ fi PACKAGE=openafs -VERSION=1.3.65 +VERSION=devel if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -3940,6 +3940,12 @@ echo "configure:3795: checking your AFS sysname" >&5 powerpc-apple-darwin7.3*) AFS_SYSNAME="ppc_darwin_70" ;; + powerpc-apple-darwin7.4*) + AFS_SYSNAME="ppc_darwin_70" + ;; + powerpc-apple-darwin7.5*) + AFS_SYSNAME="ppc_darwin_70" + ;; sparc-sun-solaris2.5*) AFS_SYSNAME="sun4x_55" enable_login="yes" @@ -4047,7 +4053,7 @@ echo "configure:3795: checking your AFS sysname" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" cat > conftest.$ac_ext < int main() { @@ -4056,7 +4062,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_is_uml=yes else @@ -4086,14 +4092,14 @@ EOF ;; *) echo $ac_n "checking for definition of struct buf""... $ac_c" 1>&6 -echo "configure:4090: checking for definition of struct buf" >&5 +echo "configure:4096: checking for definition of struct buf" >&5 if eval "test \"`echo '$''{'ac_cv_have_struct_buf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_have_struct_buf=no cat > conftest.$ac_ext < int main() { @@ -4101,7 +4107,7 @@ struct buf x; printf("%d\n", sizeof(x)); ; return 0; } EOF -if { (eval echo configure:4105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_struct_buf=yes else @@ -4129,9 +4135,9 @@ if eval "test \"`echo '$''{'ac_cv_sockaddr_len'+set}'`\" = set"; then else echo $ac_n "checking if struct sockaddr has sa_len field""... $ac_c" 1>&6 -echo "configure:4133: checking if struct sockaddr has sa_len field" >&5 +echo "configure:4139: checking if struct sockaddr has sa_len field" >&5 cat > conftest.$ac_ext < #include @@ -4140,7 +4146,7 @@ struct sockaddr *a; a->sa_len=0; ; return 0; } EOF -if { (eval echo configure:4144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sockaddr_len=yes else @@ -4165,12 +4171,12 @@ else for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4169: checking for $ac_func" >&5 +echo "configure:4175: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4222,7 +4228,7 @@ done for lib in socket inet; do if test "$HAVE_SOCKET" != 1; then echo $ac_n "checking for socket in -l${lib}""... $ac_c" 1>&6 -echo "configure:4226: checking for socket in -l${lib}" >&5 +echo "configure:4232: checking for socket in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4230,7 +4236,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4271,12 +4277,12 @@ fi for ac_func in connect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4275: checking for $ac_func" >&5 +echo "configure:4281: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4328,7 +4334,7 @@ done for lib in nsl; do if test "$HAVE_CONNECT" != 1; then echo $ac_n "checking for connect in -l${lib}""... $ac_c" 1>&6 -echo "configure:4332: checking for connect in -l${lib}" >&5 +echo "configure:4338: checking for connect in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4336,7 +4342,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4377,12 +4383,12 @@ fi for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4381: checking for $ac_func" >&5 +echo "configure:4387: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4433,7 +4439,7 @@ done for lib in dns nsl resolv; do if test "$HAVE_GETHOSTBYNAME" != 1; then echo $ac_n "checking for gethostbyname in -l${lib}""... $ac_c" 1>&6 -echo "configure:4437: checking for gethostbyname in -l${lib}" >&5 +echo "configure:4443: checking for gethostbyname in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4441,7 +4447,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4480,9 +4486,9 @@ fi fi echo $ac_n "checking for the useability of arpa/nameser_compat.h""... $ac_c" 1>&6 -echo "configure:4484: checking for the useability of arpa/nameser_compat.h" >&5 +echo "configure:4490: checking for the useability of arpa/nameser_compat.h" >&5 cat > conftest.$ac_ext < @@ -4499,7 +4505,7 @@ int main() { static int i; i = 0; ; return 0; } EOF -if { (eval echo configure:4503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -4517,11 +4523,11 @@ rm -f conftest* openafs_save_libs="$LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:4521: checking for res_search" >&5 +echo "configure:4527: checking for res_search" >&5 ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4545,7 +4551,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4562,7 +4568,7 @@ rm -f conftest* ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4586,7 +4592,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4620,7 +4626,7 @@ fi PTHREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:4624: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:4630: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4628,7 +4634,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4661,7 +4667,7 @@ fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:4665: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:4671: checking for pthread_attr_init in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4669,7 +4675,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4703,7 +4709,7 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:4707: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:4713: checking for pthread_attr_init in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4711,7 +4717,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4745,12 +4751,12 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:4749: checking for pthread_attr_init" >&5 +echo "configure:4755: checking for pthread_attr_init" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_init=yes" else @@ -4893,7 +4899,7 @@ EOF fi echo $ac_n "checking for tivoli tsm butc support""... $ac_c" 1>&6 -echo "configure:4897: checking for tivoli tsm butc support" >&5 +echo "configure:4903: checking for tivoli tsm butc support" >&5 XBSA_CFLAGS="" if test "$enable_tivoli_tsm" = "yes"; then XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen @@ -4914,12 +4920,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4918: checking for ANSI C header files" >&5 +echo "configure:4924: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4927,7 +4933,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4944,7 +4950,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4962,7 +4968,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4983,7 +4989,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4994,7 +5000,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5018,12 +5024,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5022: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5028: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5039,7 +5045,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5064,12 +5070,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5068: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5074: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5077,7 +5083,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5102,7 +5108,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5106: checking for opendir in -ldir" >&5 +echo "configure:5112: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5110,7 +5116,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5143,7 +5149,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5147: checking for opendir in -lx" >&5 +echo "configure:5153: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5151,7 +5157,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5188,17 +5194,17 @@ for ac_hdr in stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5192: checking for $ac_hdr" >&5 +echo "configure:5198: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5228,17 +5234,17 @@ for ac_hdr in netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5232: checking for $ac_hdr" >&5 +echo "configure:5238: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5268,17 +5274,17 @@ for ac_hdr in mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5272: checking for $ac_hdr" >&5 +echo "configure:5278: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5308,17 +5314,17 @@ for ac_hdr in sys/mount.h strings.h termios.h signal.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5312: checking for $ac_hdr" >&5 +echo "configure:5318: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5348,17 +5354,17 @@ for ac_hdr in windows.h malloc.h winsock2.h direct.h io.h sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5352: checking for $ac_hdr" >&5 +echo "configure:5358: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5388,17 +5394,17 @@ for ac_hdr in security/pam_modules.h siad.h usersec.h ucontext.h regex.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5392: checking for $ac_hdr" >&5 +echo "configure:5398: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5442,12 +5448,12 @@ fi for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5446: checking for $ac_func" >&5 +echo "configure:5452: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5497,12 +5503,12 @@ done for ac_func in setprogname getprogname sigaction mkstemp vsnprintf strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5501: checking for $ac_func" >&5 +echo "configure:5507: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5553,12 +5559,12 @@ done for ac_func in regcomp regexec regerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5557: checking for $ac_func" >&5 +echo "configure:5563: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5606,7 +5612,7 @@ fi done echo $ac_n "checking for POSIX regex library""... $ac_c" 1>&6 -echo "configure:5610: checking for POSIX regex library" >&5 +echo "configure:5616: checking for POSIX regex library" >&5 if test "$ac_cv_header_regex_h" = "yes" && \ test "$ac_cv_func_regcomp" = "yes" && \ test "$ac_cv_func_regexec" = "yes" && \ @@ -5621,12 +5627,12 @@ else fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5625: checking for ssize_t" >&5 +echo "configure:5631: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5654,7 +5660,7 @@ EOF fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:5658: checking size of long" >&5 +echo "configure:5664: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5662,7 +5668,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -5673,7 +5679,7 @@ main() exit(0); } EOF -if { (eval echo configure:5677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -5696,12 +5702,12 @@ EOF for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5700: checking for $ac_func" >&5 +echo "configure:5706: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5828,7 +5834,7 @@ LWP_OPTMZ=-O # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5832: checking for $ac_word" >&5 +echo "configure:5838: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5860,7 +5866,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5864: checking for $ac_word" >&5 +echo "configure:5870: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5895,7 +5901,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5899: checking for $ac_word" >&5 +echo "configure:5905: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5930,7 +5936,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5934: checking for $ac_word" >&5 +echo "configure:5940: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5965,7 +5971,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5969: checking for $ac_word" >&5 +echo "configure:5975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6000,7 +6006,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6004: checking for $ac_word" >&5 +echo "configure:6010: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6035,7 +6041,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6039: checking for $ac_word" >&5 +echo "configure:6045: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6070,7 +6076,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6074: checking for $ac_word" >&5 +echo "configure:6080: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6105,7 +6111,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6109: checking for $ac_word" >&5 +echo "configure:6115: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LORDER'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6853,6 +6859,27 @@ case $AFS_SYSNAME in SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" ;; + sunx86_59) + CC="/opt/SUNWspro/bin/cc" + CCOBJ="/opt/SUNWspro/bin/cc" + LEX="lex" + LD="/usr/ccs/bin/ld" + MT_CC="/opt/SUNWspro/bin/cc" + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_LIBS="-lpthread -lsocket" + PAM_CFLAGS="-KPIC" + PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" + SHLIB_CFLAGS="-KPIC" + SHLIB_LDFLAGS="-G -Bsymbolic" + TXLIBS="-lcurses" + XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS="-dy -Bdynamic" + XLIBELFA="-lelf" + XLIBKVM="-lkvm" + XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl" + SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" + ;; + sunx86_510) CC="/opt/SUNWspro/bin/cc" CCOBJ="/opt/SUNWspro/bin/cc" @@ -6882,7 +6909,7 @@ case $AFS_SYSNAME in sgi_6*) echo $ac_n "checking for mem* in sys/systm.h""... $ac_c" 1>&6 -echo "configure:6886: checking for mem* in sys/systm.h" >&5 +echo "configure:6913: checking for mem* in sys/systm.h" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_KERNEL -D__STRING_H__" if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set"; then @@ -6890,7 +6917,7 @@ if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set else cat > conftest.$ac_ext < #include @@ -6900,7 +6927,7 @@ extern void *memcpy(char *, const void *, size_t); ; return 0; } EOF -if { (eval echo configure:6904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_irix_sys_systm_h_has_mem_funcs=no else diff --git a/configure-libafs b/configure-libafs index a5ea3f6aa..e25d8bcd3 100644 --- a/configure-libafs +++ b/configure-libafs @@ -754,7 +754,7 @@ fi PACKAGE=openafs-libafs -VERSION=1.3.65 +VERSION=devel if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -3940,6 +3940,12 @@ echo "configure:3795: checking your AFS sysname" >&5 powerpc-apple-darwin7.3*) AFS_SYSNAME="ppc_darwin_70" ;; + powerpc-apple-darwin7.4*) + AFS_SYSNAME="ppc_darwin_70" + ;; + powerpc-apple-darwin7.5*) + AFS_SYSNAME="ppc_darwin_70" + ;; sparc-sun-solaris2.5*) AFS_SYSNAME="sun4x_55" enable_login="yes" @@ -4047,7 +4053,7 @@ echo "configure:3795: checking your AFS sysname" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" cat > conftest.$ac_ext < int main() { @@ -4056,7 +4062,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_is_uml=yes else @@ -4086,14 +4092,14 @@ EOF ;; *) echo $ac_n "checking for definition of struct buf""... $ac_c" 1>&6 -echo "configure:4090: checking for definition of struct buf" >&5 +echo "configure:4096: checking for definition of struct buf" >&5 if eval "test \"`echo '$''{'ac_cv_have_struct_buf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_have_struct_buf=no cat > conftest.$ac_ext < int main() { @@ -4101,7 +4107,7 @@ struct buf x; printf("%d\n", sizeof(x)); ; return 0; } EOF -if { (eval echo configure:4105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_struct_buf=yes else @@ -4129,9 +4135,9 @@ if eval "test \"`echo '$''{'ac_cv_sockaddr_len'+set}'`\" = set"; then else echo $ac_n "checking if struct sockaddr has sa_len field""... $ac_c" 1>&6 -echo "configure:4133: checking if struct sockaddr has sa_len field" >&5 +echo "configure:4139: checking if struct sockaddr has sa_len field" >&5 cat > conftest.$ac_ext < #include @@ -4140,7 +4146,7 @@ struct sockaddr *a; a->sa_len=0; ; return 0; } EOF -if { (eval echo configure:4144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sockaddr_len=yes else @@ -4165,12 +4171,12 @@ else for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4169: checking for $ac_func" >&5 +echo "configure:4175: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4222,7 +4228,7 @@ done for lib in socket inet; do if test "$HAVE_SOCKET" != 1; then echo $ac_n "checking for socket in -l${lib}""... $ac_c" 1>&6 -echo "configure:4226: checking for socket in -l${lib}" >&5 +echo "configure:4232: checking for socket in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4230,7 +4236,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4271,12 +4277,12 @@ fi for ac_func in connect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4275: checking for $ac_func" >&5 +echo "configure:4281: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4328,7 +4334,7 @@ done for lib in nsl; do if test "$HAVE_CONNECT" != 1; then echo $ac_n "checking for connect in -l${lib}""... $ac_c" 1>&6 -echo "configure:4332: checking for connect in -l${lib}" >&5 +echo "configure:4338: checking for connect in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4336,7 +4342,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4377,12 +4383,12 @@ fi for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4381: checking for $ac_func" >&5 +echo "configure:4387: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4433,7 +4439,7 @@ done for lib in dns nsl resolv; do if test "$HAVE_GETHOSTBYNAME" != 1; then echo $ac_n "checking for gethostbyname in -l${lib}""... $ac_c" 1>&6 -echo "configure:4437: checking for gethostbyname in -l${lib}" >&5 +echo "configure:4443: checking for gethostbyname in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4441,7 +4447,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4480,9 +4486,9 @@ fi fi echo $ac_n "checking for the useability of arpa/nameser_compat.h""... $ac_c" 1>&6 -echo "configure:4484: checking for the useability of arpa/nameser_compat.h" >&5 +echo "configure:4490: checking for the useability of arpa/nameser_compat.h" >&5 cat > conftest.$ac_ext < @@ -4499,7 +4505,7 @@ int main() { static int i; i = 0; ; return 0; } EOF -if { (eval echo configure:4503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -4517,11 +4523,11 @@ rm -f conftest* openafs_save_libs="$LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:4521: checking for res_search" >&5 +echo "configure:4527: checking for res_search" >&5 ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4545,7 +4551,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4562,7 +4568,7 @@ rm -f conftest* ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4586,7 +4592,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4620,7 +4626,7 @@ fi PTHREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:4624: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:4630: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4628,7 +4634,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4661,7 +4667,7 @@ fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:4665: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:4671: checking for pthread_attr_init in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4669,7 +4675,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4703,7 +4709,7 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:4707: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:4713: checking for pthread_attr_init in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4711,7 +4717,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4745,12 +4751,12 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:4749: checking for pthread_attr_init" >&5 +echo "configure:4755: checking for pthread_attr_init" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_init=yes" else @@ -4893,7 +4899,7 @@ EOF fi echo $ac_n "checking for tivoli tsm butc support""... $ac_c" 1>&6 -echo "configure:4897: checking for tivoli tsm butc support" >&5 +echo "configure:4903: checking for tivoli tsm butc support" >&5 XBSA_CFLAGS="" if test "$enable_tivoli_tsm" = "yes"; then XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen @@ -4914,12 +4920,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4918: checking for ANSI C header files" >&5 +echo "configure:4924: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4927,7 +4933,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4944,7 +4950,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4962,7 +4968,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4983,7 +4989,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4994,7 +5000,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5018,12 +5024,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5022: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5028: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5039,7 +5045,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5064,12 +5070,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5068: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5074: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5077,7 +5083,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5102,7 +5108,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5106: checking for opendir in -ldir" >&5 +echo "configure:5112: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5110,7 +5116,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5143,7 +5149,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5147: checking for opendir in -lx" >&5 +echo "configure:5153: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5151,7 +5157,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5188,17 +5194,17 @@ for ac_hdr in stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5192: checking for $ac_hdr" >&5 +echo "configure:5198: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5228,17 +5234,17 @@ for ac_hdr in netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5232: checking for $ac_hdr" >&5 +echo "configure:5238: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5268,17 +5274,17 @@ for ac_hdr in mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5272: checking for $ac_hdr" >&5 +echo "configure:5278: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5308,17 +5314,17 @@ for ac_hdr in sys/mount.h strings.h termios.h signal.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5312: checking for $ac_hdr" >&5 +echo "configure:5318: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5348,17 +5354,17 @@ for ac_hdr in windows.h malloc.h winsock2.h direct.h io.h sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5352: checking for $ac_hdr" >&5 +echo "configure:5358: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5388,17 +5394,17 @@ for ac_hdr in security/pam_modules.h siad.h usersec.h ucontext.h regex.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5392: checking for $ac_hdr" >&5 +echo "configure:5398: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5442,12 +5448,12 @@ fi for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5446: checking for $ac_func" >&5 +echo "configure:5452: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5497,12 +5503,12 @@ done for ac_func in setprogname getprogname sigaction mkstemp vsnprintf strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5501: checking for $ac_func" >&5 +echo "configure:5507: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5553,12 +5559,12 @@ done for ac_func in regcomp regexec regerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5557: checking for $ac_func" >&5 +echo "configure:5563: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5606,7 +5612,7 @@ fi done echo $ac_n "checking for POSIX regex library""... $ac_c" 1>&6 -echo "configure:5610: checking for POSIX regex library" >&5 +echo "configure:5616: checking for POSIX regex library" >&5 if test "$ac_cv_header_regex_h" = "yes" && \ test "$ac_cv_func_regcomp" = "yes" && \ test "$ac_cv_func_regexec" = "yes" && \ @@ -5621,12 +5627,12 @@ else fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5625: checking for ssize_t" >&5 +echo "configure:5631: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5654,7 +5660,7 @@ EOF fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:5658: checking size of long" >&5 +echo "configure:5664: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5662,7 +5668,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -5673,7 +5679,7 @@ main() exit(0); } EOF -if { (eval echo configure:5677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -5696,12 +5702,12 @@ EOF for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5700: checking for $ac_func" >&5 +echo "configure:5706: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5828,7 +5834,7 @@ LWP_OPTMZ=-O # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5832: checking for $ac_word" >&5 +echo "configure:5838: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5860,7 +5866,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5864: checking for $ac_word" >&5 +echo "configure:5870: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5895,7 +5901,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5899: checking for $ac_word" >&5 +echo "configure:5905: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5930,7 +5936,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5934: checking for $ac_word" >&5 +echo "configure:5940: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5965,7 +5971,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5969: checking for $ac_word" >&5 +echo "configure:5975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6000,7 +6006,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6004: checking for $ac_word" >&5 +echo "configure:6010: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6035,7 +6041,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6039: checking for $ac_word" >&5 +echo "configure:6045: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6070,7 +6076,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6074: checking for $ac_word" >&5 +echo "configure:6080: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6105,7 +6111,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6109: checking for $ac_word" >&5 +echo "configure:6115: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LORDER'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6853,6 +6859,27 @@ case $AFS_SYSNAME in SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" ;; + sunx86_59) + CC="/opt/SUNWspro/bin/cc" + CCOBJ="/opt/SUNWspro/bin/cc" + LEX="lex" + LD="/usr/ccs/bin/ld" + MT_CC="/opt/SUNWspro/bin/cc" + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_LIBS="-lpthread -lsocket" + PAM_CFLAGS="-KPIC" + PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" + SHLIB_CFLAGS="-KPIC" + SHLIB_LDFLAGS="-G -Bsymbolic" + TXLIBS="-lcurses" + XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS="-dy -Bdynamic" + XLIBELFA="-lelf" + XLIBKVM="-lkvm" + XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl" + SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" + ;; + sunx86_510) CC="/opt/SUNWspro/bin/cc" CCOBJ="/opt/SUNWspro/bin/cc" @@ -6882,7 +6909,7 @@ case $AFS_SYSNAME in sgi_6*) echo $ac_n "checking for mem* in sys/systm.h""... $ac_c" 1>&6 -echo "configure:6886: checking for mem* in sys/systm.h" >&5 +echo "configure:6913: checking for mem* in sys/systm.h" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_KERNEL -D__STRING_H__" if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set"; then @@ -6890,7 +6917,7 @@ if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set else cat > conftest.$ac_ext < #include @@ -6900,7 +6927,7 @@ extern void *memcpy(char *, const void *, size_t); ; return 0; } EOF -if { (eval echo configure:6904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_irix_sys_systm_h_has_mem_funcs=no else diff --git a/configure-libafs.in b/configure-libafs.in index e077c68e3..f9fa0faca 100644 --- a/configure-libafs.in +++ b/configure-libafs.in @@ -1,5 +1,5 @@ AC_INIT(src/libafs/Makefile.common.in) -AM_INIT_AUTOMAKE(openafs-libafs,1.3.65) +AM_INIT_AUTOMAKE(openafs-libafs,devel) AC_CONFIG_HEADER(src/config/afsconfig.h) define(OPENAFS_CONFIGURE_LIBAFS) diff --git a/configure.in b/configure.in index e8c412a58..76956d14d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(src/config/stds.h) -AM_INIT_AUTOMAKE(openafs,1.3.65) +AM_INIT_AUTOMAKE(openafs,devel) AC_CONFIG_HEADER(src/config/afsconfig.h) AC_PROG_CC diff --git a/src/WINNT/afs_setup_utils/afs_setup_utils.cpp b/src/WINNT/afs_setup_utils/afs_setup_utils.cpp index 2e6ff61cc..5ef39ca1f 100644 --- a/src/WINNT/afs_setup_utils/afs_setup_utils.cpp +++ b/src/WINNT/afs_setup_utils/afs_setup_utils.cpp @@ -234,11 +234,11 @@ struct APPINFO appClient = { TARGETDIR"\\Common\\*.gid\0" TARGETDIR"\\Common\\*.fts\0" WINDIR"\\..\\AFSCache\0" - WINDIR"\\afsd.log\0" - WINDIR"\\afsd.ini\0" - WINDIR"\\afsdsbmt.ini\0" - WINDIR"\\afsdcell.ini\0" - WINDIR"\\afsd_init.log\0", + WINDIR"\\TEMP\\afsd.log\0" + TARGETDIR"\\Client\\afsd.ini\0" + TARGETDIR"\\Client\\afsdsbmt.ini\0" + TARGETDIR"\\Client\\afsdcell.ini\0" + WINDIR"\\TEMP\\afsd_init.log\0", clientRegValues, clientWinNTRegValues, diff --git a/src/WINNT/afs_setup_utils/forceremove.c b/src/WINNT/afs_setup_utils/forceremove.c index a849f9203..49a93b36a 100644 --- a/src/WINNT/afs_setup_utils/forceremove.c +++ b/src/WINNT/afs_setup_utils/forceremove.c @@ -119,13 +119,13 @@ DWORD Client34Eradicate(BOOL keepConfig) } } - sprintf(filePath, "%s\\%s", winPath, "afsd.log"); + sprintf(filePath, "%s\\%s", winPath, "temp\\afsd.log"); status = FileForceRemove(filePath); if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) { rc = status; } - sprintf(filePath, "%s\\%s", winPath, "afsd_init.log"); + sprintf(filePath, "%s\\%s", winPath, "temp\\afsd_init.log"); status = FileForceRemove(filePath); if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) { rc = status; @@ -144,19 +144,19 @@ DWORD Client34Eradicate(BOOL keepConfig) } if (!keepConfig) { - sprintf(filePath, "%s\\%s", winPath, "afsdcell.ini"); + sprintf(filePath, "%s\\%s", installPath, "Client\\afsdcell.ini"); status = FileForceRemove(filePath); if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) { rc = status; } - sprintf(filePath, "%s\\%s", winPath, "afsdsbmt.ini"); + sprintf(filePath, "%s\\%s", installPath, "Client\\afsdsbmt.ini"); status = FileForceRemove(filePath); if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) { rc = status; } - sprintf(filePath, "%s\\%s", winPath, "afsd.ini"); + sprintf(filePath, "%s\\%s", installPath, "Client\\afsd.ini"); status = FileForceRemove(filePath); if (status != ERROR_SUCCESS && status != ERROR_FILE_NOT_FOUND) { rc = status; diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index 76a9690a5..6586818a1 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -64,7 +64,8 @@ INCFILES =\ $(INCFILEDIR)\cm_freelance.h \ $(INCFILEDIR)\afsd_eventlog.h \ $(INCFILEDIR)\afsd_eventmessages.h \ - $(INCFILEDIR)\afskfw.h + $(INCFILEDIR)\afskfw.h \ + $(INCFILEDIR)\afsicf.h IDLFILES =\ afsrpc.h $(OUT)\afsrpc_c.obj @@ -116,7 +117,8 @@ AFSDOBJS=\ !ENDIF $(OUT)\cm_freelance.obj \ $(OUT)\afsd_eventlog.obj \ - $(OUT)\afsd_flushvol.obj + $(OUT)\afsd_flushvol.obj \ + $(OUT)\afsicf.obj $(AFSDOBJS): @@ -170,7 +172,7 @@ CONF_DLLLIBS = \ $(DESTDIR)\lib\afs\afsreg.lib $(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res $(CONF_DLLLIBS) - $(DLLGUILINK) -def:libafsconf.def dnsapi.lib + $(DLLGUILINK) -def:libafsconf.def dnsapi.lib mpr.lib $(DLLPREP) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp @@ -208,6 +210,7 @@ LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll LOGON_DLLOBJS =\ $(OUT)\afslogon.obj \ + $(OUT)\logon_ad.obj \ $(OUT)\afslogon.res LOGON_DLLLIBS =\ @@ -217,8 +220,19 @@ LOGON_DLLLIBS =\ $(DESTDIR)\lib\afsdes.lib \ $(AFSKFWLIB) +LOGON_DLLSDKLIBS =\ + dnsapi.lib mpr.lib \ + advapi32.lib \ + secur32.lib \ + strsafe.lib \ + oleaut32.lib \ + ole32.lib \ + adsiid.lib \ + activeds.lib \ + userenv.lib + $(LOGON_DLLFILE): $(LOGON_DLLOBJS) $(LOGON_DLLLIBS) - $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslogon.def dnsapi.lib secur32.lib + $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslogon.def $(LOGON_DLLSDKLIBS) $(DLLPREP) $(COPY) $*.lib $(DESTDIR)\lib $(DEL) $*.lib $*.exp @@ -237,7 +251,7 @@ LOG95_DLLLIBS =\ $(DESTDIR)\lib\libafsconf.lib $(LOG95_DLLFILE): $(LOG95_DLLOBJS) $(LOG95_DLLLIBS) - $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslog95.def dnsapi.lib + $(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslog95.def dnsapi.lib mpr.lib $(DLLPREP) $(COPY) $*.lib $(DESTDIR)\lib $(DEL) $*.lib $*.exp @@ -245,9 +259,10 @@ $(LOG95_DLLFILE): $(LOG95_DLLOBJS) $(LOG95_DLLLIBS) ############################################################################ # Install target; primary makefile target -install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(LANAHELPERLIB) +install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(LANAHELPERLIB) $(OUT)\afsicf.obj $(COPY) $(OUT)\cm_dns.obj $(DESTDIR)\lib $(COPY) $(OUT)\cm_config.obj $(DESTDIR)\lib + $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib install_headers: $(IDLFILES) $(INCFILES) @@ -303,17 +318,17 @@ EXELIBS = \ # klog.exe $(EXEDIR)\klog.exe: $(OUT)\cklog.obj $(OUT)\klog.res $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) # tokens.exe $(EXEDIR)\tokens.exe: $(OUT)\ctokens.obj $(OUT)\tokens.res $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) # unlog.exe $(EXEDIR)\unlog.exe: $(OUT)\cunlog.obj $(OUT)\unlog.res $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) # afsd.exe @@ -322,12 +337,15 @@ AFSD_EXEFILE = $(EXEDIR)\afsd.exe AFSD_SDKLIBS =\ largeint.lib \ netapi32.lib \ - mpr.lib \ - dnsapi.lib \ + dnsapi.lib mpr.lib \ rpcrt4.lib \ user32.lib \ Dbghelp.lib \ - strsafe.lib + strsafe.lib \ + mpr.lib \ + secur32.lib \ + ole32.lib \ + oleaut32.lib AFSD_EXELIBS =\ $(DESTDIR)\lib\libosi.lib \ @@ -351,12 +369,12 @@ $(EXEDIR)\afsd_service.exe: $(OUT)\afsd_service.obj $(AFSDOBJS) $(OUT)\afsd_serv # fs.exe $(EXEDIR)\fs.exe: $(FSOBJS) $(OUT)\fs.res $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) # symlink.exe $(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) # afsshare.exe diff --git a/src/WINNT/afsd/afsd.h b/src/WINNT/afsd/afsd.h index 6456c7139..1e3a7571e 100644 --- a/src/WINNT/afsd/afsd.h +++ b/src/WINNT/afsd/afsd.h @@ -61,6 +61,7 @@ BOOL APIENTRY About(HWND, unsigned int, unsigned int, long); #include "cm_dnlc.h" #include "cm_buf.h" #include "cm_freelance.h" +#include "smb_ioctl.h" #ifdef DJGPP #include "afs/afsmsg95.h" #endif diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 5da8aceba..db6c3a54c 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "afsd.h" @@ -29,6 +28,8 @@ #include "smb.h" #include "cm_rpc.h" #include "lanahelper.h" +#include +#include "afsicf.h" extern int RXAFSCB_ExecuteRequest(struct rx_call *z_call); extern int RXSTATS_ExecuteRequest(struct rx_call *z_call); @@ -68,7 +69,7 @@ int logReady = 0; char cm_HostName[200]; long cm_HostAddr; -char cm_NetbiosName[MAX_NB_NAME_LENGTH]; +char cm_NetbiosName[MAX_NB_NAME_LENGTH] = ""; char cm_CachePath[200]; DWORD cm_CachePathLen; @@ -83,6 +84,8 @@ char *cm_sysName = 0; int cm_sysNameCount = 0; char *cm_sysNameList[MAXNUMSYSNAMES]; +DWORD TraceOption = 0; + /* * AFSD Initialization Log * @@ -97,8 +100,6 @@ HANDLE afsi_file; int cm_dnsEnabled = 1; #endif -char cm_NetBiosName[32]; - extern initUpperCaseTable(); void afsd_initUpperCaseTable() { @@ -112,6 +113,10 @@ afsi_start() char t[100], u[100], *p, *path; int zilch; int code; + DWORD dwLow, dwHigh; + HKEY parmKey; + DWORD dummyLen; + DWORD maxLogSize = 100 * 1024; afsi_file = INVALID_HANDLE_VALUE; if (getenv("TEMP")) @@ -127,6 +132,25 @@ afsi_start() GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t)); afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL); + + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, + 0, KEY_QUERY_VALUE, &parmKey); + if (code == ERROR_SUCCESS) { + dummyLen = sizeof(maxLogSize); + code = RegQueryValueEx(parmKey, "MaxLogSize", NULL, NULL, + (BYTE *) &maxLogSize, &dummyLen); + RegCloseKey (parmKey); + } + + if (maxLogSize) { + dwLow = GetFileSize( afsi_file, &dwHigh ); + if ( dwHigh > 0 || dwLow >= maxLogSize ) { + CloseHandle(afsi_file); + afsi_file = CreateFile( wd, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL); + } + } + SetFilePointer(afsi_file, 0, NULL, FILE_END); GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, u, sizeof(u)); StringCbCatA(t, sizeof(t), ": Create log file\n"); @@ -193,6 +217,141 @@ void afsd_ForceTrace(BOOL flush) CloseHandle(handle); } +static void +configureBackConnectionHostNames(void) +{ + /* On Windows XP SP2, Windows 2003 SP1, and all future Windows operating systems + * there is a restriction on the use of SMB authentication on loopback connections. + * There are two work arounds available: + * + * (1) We can disable the check for matching host names. This does not + * require a reboot: + * [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] + * "DisableLoopbackCheck"=dword:00000001 + * + * (2) We can add the AFS SMB/CIFS service name to an approved list. This + * does require a reboot: + * [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0] + * "BackConnectionHostNames"=multi-sz + * + * The algorithm will be: + * (1) Check to see if cm_NetbiosName exists in the BackConnectionHostNames list + * (2a) If not, add it to the list. (This will not take effect until the next reboot.) + * (2b1) and check to see if DisableLoopbackCheck is set. + * (2b2) If not set, set the DisableLoopbackCheck value to 0x1 + * (2b3) and create HKLM\SOFTWARE\OpenAFS\Client UnsetDisableLoopbackCheck + * (2c) else If cm_NetbiosName exists in the BackConnectionHostNames list, + * check for the UnsetDisableLoopbackCheck value. + * If set, set the DisableLoopbackCheck flag to 0x0 + * and delete the UnsetDisableLoopbackCheck value + */ + HKEY hkLsa; + HKEY hkMSV10; + HKEY hkClient; + DWORD dwType; + DWORD dwSize; + DWORD dwValue; + PBYTE pHostNames = NULL, pName; + BOOL bNameFound = FALSE; + + if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0", + 0, + KEY_READ|KEY_WRITE, + &hkMSV10) == ERROR_SUCCESS ) + { + if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS) { + pHostNames = malloc(dwSize + strlen(cm_NetbiosName) + 1); + RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, pHostNames, &dwSize); + + for (pName = pHostNames; *pName ; pName += strlen(pName) + 1) + { + if ( !stricmp(pName, cm_NetbiosName) ) { + bNameFound = TRUE; + break; + } + } + } + + if ( !bNameFound ) { + if ( !pHostNames ) { + pName = pHostNames = malloc(strlen(cm_NetbiosName) + 2); + dwSize = 1; + } + strcpy(pName, cm_NetbiosName); + pName += strlen(cm_NetbiosName) + 1; + *pName = '\0'; /* add a second nul terminator */ + + dwType = REG_MULTI_SZ; + dwSize += strlen(cm_NetbiosName) + 1; + RegSetValueEx( hkMSV10, "BackConnectionHostNames", 0, dwType, pHostNames, dwSize); + + if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Lsa", + 0, + KEY_READ|KEY_WRITE, + &hkLsa) == ERROR_SUCCESS ) + { + dwSize = sizeof(DWORD); + if ( RegQueryValueEx( hkLsa, "DisableLoopbackCheck", 0, &dwType, &dwValue, &dwSize) != ERROR_SUCCESS || + dwValue == 0 ) { + dwType = REG_DWORD; + dwSize = sizeof(DWORD); + dwValue = 1; + RegSetValueEx( hkLsa, "DisableLoopbackCheck", 0, dwType, &dwValue, dwSize); + + if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE, + NULL, + &hkClient, + NULL) == ERROR_SUCCESS) { + + dwType = REG_DWORD; + dwSize = sizeof(DWORD); + dwValue = 1; + RegSetValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, dwType, &dwValue, dwSize); + RegCloseKey(hkClient); + } + RegCloseKey(hkLsa); + } + } + } else { + if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE, + NULL, + &hkClient, + NULL) == ERROR_SUCCESS) { + + dwSize = sizeof(DWORD); + if ( RegQueryValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, &dwType, &dwValue, &dwSize) == ERROR_SUCCESS && + dwValue == 1 ) { + if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Lsa", + 0, + KEY_READ|KEY_WRITE, + &hkLsa) == ERROR_SUCCESS ) + { + RegDeleteValue(hkLsa, "DisableLoopbackCheck"); + RegCloseKey(hkLsa); + } + } + RegDeleteValue(hkClient, "RemoveDisableLoopbackCheck"); + RegCloseKey(hkClient); + } + } + RegCloseKey(hkMSV10); + } +} + + /* * AFSD Initialization */ @@ -205,8 +364,10 @@ int afsd_InitCM(char **reasonP) long logChunkSize; long stats; long traceBufSize; + long maxcpus; long ltt, ltto; long rx_mtu, rx_nojumbo; + long virtualCache; char rootCellName[256]; struct rx_service *serverp; static struct rx_securityClass *nullServerSecurityClassp; @@ -215,6 +376,7 @@ int afsd_InitCM(char **reasonP) char buf[200]; HKEY parmKey; DWORD dummyLen; + DWORD regType; long code; /*int freelanceEnabled;*/ WSADATA WSAjunk; @@ -258,6 +420,47 @@ int afsd_InitCM(char **reasonP) osi_panic(buf, __FILE__, __LINE__); } + dummyLen = sizeof(maxcpus); + code = RegQueryValueEx(parmKey, "MaxCPUs", NULL, NULL, + (BYTE *) &maxcpus, &dummyLen); + if (code == ERROR_SUCCESS) { + HANDLE hProcess; + DWORD_PTR processAffinityMask, systemAffinityMask; + + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, + FALSE, GetCurrentProcessId()); + if ( hProcess != NULL && + GetProcessAffinityMask(hProcess, &processAffinityMask, &systemAffinityMask) ) + { + int i, n, bits; + DWORD_PTR mask, newAffinityMask; + +#if defined(_WIN64) + bits = 64; +#else + bits = 32; +#endif + for ( i=0, n=0, mask=1, newAffinityMask=0; i sizeof(cm_CachePath)) { + afsi_log("Cache path [%s] longer than %d after expanding env strings", buf, sizeof(cm_CachePath)); + osi_panic("CachePath too long", __FILE__, __LINE__); + } + } else { + StringCbCopyA(cm_CachePath, sizeof(cm_CachePath), buf); + } afsi_log("Cache path %s", cm_CachePath); - else { + } else { GetWindowsDirectory(cm_CachePath, sizeof(cm_CachePath)); cm_CachePath[2] = 0; /* get drive letter only */ StringCbCatA(cm_CachePath, sizeof(cm_CachePath), "\\AFSCache"); afsi_log("Default cache path %s", cm_CachePath); } + dummyLen = sizeof(virtualCache); + code = RegQueryValueEx(parmKey, "NonPersistentCaching", NULL, NULL, + &virtualCache, &dummyLen); + if (code == ERROR_SUCCESS && virtualCache) { + buf_cacheType = CM_BUF_CACHETYPE_VIRTUAL; + } else { + buf_cacheType = CM_BUF_CACHETYPE_FILE; + } + afsi_log("Cache type is %s", ((buf_cacheType == CM_BUF_CACHETYPE_FILE)?"FILE":"VIRTUAL")); + dummyLen = sizeof(traceOnPanic); code = RegQueryValueEx(parmKey, "TrapOnPanic", NULL, NULL, (BYTE *) &traceOnPanic, &dummyLen); @@ -472,21 +696,24 @@ int afsd_InitCM(char **reasonP) } #endif /* AFS_FREELANCE_CLIENT */ +#ifdef COMMENT + /* The netbios name is looked up in lana_GetUNCServerNameEx */ dummyLen = sizeof(buf); code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL, (BYTE *) &buf, &dummyLen); if (code == ERROR_SUCCESS) { - DWORD len = ExpandEnvironmentStrings(buf, cm_NetBiosName, MAX_NB_NAME_LENGTH); + DWORD len = ExpandEnvironmentStrings(buf, cm_NetbiosName, MAX_NB_NAME_LENGTH); if ( len > 0 && len <= MAX_NB_NAME_LENGTH ) { - afsi_log("Explicit NetBios name is used %s", cm_NetBiosName); + afsi_log("Explicit NetBios name is used %s", cm_NetbiosName); } else { afsi_log("Unable to Expand Explicit NetBios name: %s", buf); - cm_NetBiosName[0] = 0; /* turn it off */ + cm_NetbiosName[0] = 0; /* turn it off */ } } else { - cm_NetBiosName[0] = 0; /* default off */ + cm_NetbiosName[0] = 0; /* default off */ } +#endif dummyLen = sizeof(smb_hideDotFiles); code = RegQueryValueEx(parmKey, "HideDotFiles", NULL, NULL, @@ -513,6 +740,16 @@ int afsd_InitCM(char **reasonP) } afsi_log("Maximum number of VCs per server is %d", smb_maxVCPerServer); + dummyLen = sizeof(smb_authType); + code = RegQueryValueEx(parmKey, "SMBAuthType", NULL, NULL, + (BYTE *) &smb_authType, &dummyLen); + + if (code != ERROR_SUCCESS || + (smb_authType != SMB_AUTH_EXTENDED && smb_authType != SMB_AUTH_NTLM && smb_authType != SMB_AUTH_NONE)) { + smb_authType = SMB_AUTH_EXTENDED; /* default is to use extended authentication */ + } + afsi_log("SMB authentication type is %s", ((smb_authType == SMB_AUTH_NONE)?"NONE":((smb_authType == SMB_AUTH_EXTENDED)?"EXTENDED":"NTLM"))); + dummyLen = sizeof(rx_nojumbo); code = RegQueryValueEx(parmKey, "RxNoJumbo", NULL, NULL, (BYTE *) &rx_nojumbo, &dummyLen); @@ -607,25 +844,10 @@ int afsd_InitCM(char **reasonP) } /* Open Microsoft Firewall to allow in port 7001 */ - { - HKEY hk; - DWORD dwDisp; - TCHAR* value = TEXT("7001:UDP:*:Enabled:AFS Cache Manager Callback"); - if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\DomainProfile\\GloballyOpenP", - 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) - { - RegSetValueEx (hk, TEXT("7001:UDP"), 0, REG_SZ, (PBYTE)value, sizeof(TCHAR) * (1+lstrlen(value))); - RegCloseKey (hk); - } - if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\GloballyOpenP", - 0, TEXT("container"), 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS) - { - RegSetValueEx (hk, TEXT("7001:UDP"), 0, REG_SZ, (PBYTE)value, sizeof(TCHAR) * (1+lstrlen(value))); - RegCloseKey (hk); - } - } + icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT); + + /* Ensure the AFS Netbios Name is registered to allow loopback access */ + configureBackConnectionHostNames(); /* initialize RX, and tell it to listen to port 7001, which is used for * callback RPC messages. diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 09719c8fc..0517edec7 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -346,14 +346,14 @@ static void MountGlobalDrives() sprintf(szAfsPath,"\\\\%s\\%s",cm_NetbiosName,szSubMount); - nr.dwScope = RESOURCE_GLOBALNET; + nr.dwScope = RESOURCE_GLOBALNET; /* ignored parameter */ nr.dwType=RESOURCETYPE_DISK; nr.lpLocalName=szDriveToMapTo; nr.lpRemoteName=szAfsPath; - nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; - nr.dwUsage = RESOURCEUSAGE_CONNECTABLE; + nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; /* ignored parameter */ + nr.dwUsage = RESOURCEUSAGE_CONNECTABLE; /* ignored parameter */ - dwResult = WNetAddConnection2(&nr,NULL,NULL,FALSE); + dwResult = WNetAddConnection2(&nr,NULL,NULL,0); afsi_log("GlobalAutoMap of %s to %s %s (%d)", szDriveToMapTo, szSubMount, (dwResult == NO_ERROR) ? "succeeded" : "failed", dwResult); if (dwResult == NO_ERROR) { @@ -361,6 +361,9 @@ static void MountGlobalDrives() } /* wait for smb server to come up */ Sleep((DWORD)1000 /* miliseconds */); + + /* Disconnect any previous mappings */ + dwResult = WNetCancelConnection2(szDriveToMapTo, 0, TRUE); } } @@ -400,6 +403,7 @@ static void DismountGlobalDrives() sprintf(szAfsPath,"\\\\%s\\%s",cm_NetbiosName,szSubMount); + dwResult = WNetCancelConnection2(szDriveToMapTo, 0, TRUE); dwResult = WNetCancelConnection(szAfsPath, TRUE); afsi_log("Disconnect from GlobalAutoMap of %s to %s %s", szDriveToMapTo, szSubMount, dwResult ? "succeeded" : "failed"); diff --git a/src/WINNT/afsd/afsicf.cpp b/src/WINNT/afsd/afsicf.cpp new file mode 100644 index 000000000..08ebec6fc --- /dev/null +++ b/src/WINNT/afsd/afsicf.cpp @@ -0,0 +1,326 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#define _WIN32_DCOM +#include +#include +#include +#include +#include "afsicf.h" + +//#define TESTMAIN + +#ifdef TESTMAIN +#include +#pragma comment(lib,"ole32.lib") +#pragma comment(lib,"oleaut32.lib") +#define DEBUGOUT(x) printf x +#else +#define DEBUGOUT(x) +#endif + +/* an IPv4, enabled port with global scope */ +struct global_afs_port_type { + LPWSTR name; + LONG port; + NET_FW_IP_PROTOCOL protocol; +}; + +typedef struct global_afs_port_type global_afs_port_t; + +global_afs_port_t afs_clientPorts[] = { + { L"AFS CacheManager Callback (UDP)", 7001, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS CacheManager Callback (TCP)", 7001, NET_FW_IP_PROTOCOL_TCP } +}; + +global_afs_port_t afs_serverPorts[] = { + { L"AFS File Server (UDP)", 7000, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS File Server (TCP)", 7000, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS User & Group Database (UDP)", 7002, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS User & Group Database (TCP)", 7002, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Volume Location Database (UDP)", 7003, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Volume Location Database (TCP)", 7003, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS/Kerberos Authentication (UDP)", 7004, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS/Kerberos Authentication (TCP)", 7004, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Volume Mangement (UDP)", 7005, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Volume Mangement (TCP)", 7005, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Error Interpretation (UDP)", 7006, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Error Interpretation (TCP)", 7006, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Basic Overseer (UDP)", 7007, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Basic Overseer (TCP)", 7007, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Server-to-server Updater (UDP)", 7008, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Server-to-server Updater (TCP)", 7008, NET_FW_IP_PROTOCOL_TCP }, + { L"AFS Remote Cache Manager (UDP)", 7009, NET_FW_IP_PROTOCOL_UDP }, + { L"AFS Remote Cache Manager (TCP)", 7009, NET_FW_IP_PROTOCOL_TCP } +}; + +HRESULT icf_OpenFirewallProfile(INetFwProfile ** fwProfile) { + HRESULT hr = S_OK; + INetFwMgr* fwMgr = NULL; + INetFwPolicy* fwPolicy = NULL; + + *fwProfile = NULL; + + // Create an instance of the firewall settings manager. + hr = CoCreateInstance( + __uuidof(NetFwMgr), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(INetFwMgr), + reinterpret_cast(static_cast(&fwMgr)) + ); + if (FAILED(hr)) + { + DEBUGOUT(("Can't create fwMgr\n")); + goto error; + } + + // Retrieve the local firewall policy. + hr = fwMgr->get_LocalPolicy(&fwPolicy); + if (FAILED(hr)) + { + DEBUGOUT(("Cant get local policy\n")); + goto error; + } + + // Retrieve the firewall profile currently in effect. + hr = fwPolicy->get_CurrentProfile(fwProfile); + if (FAILED(hr)) + { + DEBUGOUT(("Can't get current profile\n")); + goto error; + } + +error: + + // Release the local firewall policy. + if (fwPolicy != NULL) + { + fwPolicy->Release(); + } + + // Release the firewall settings manager. + if (fwMgr != NULL) + { + fwMgr->Release(); + } + + return hr; +} + +HRESULT icf_CheckAndAddPorts(INetFwProfile * fwProfile, global_afs_port_t * ports, int nPorts) { + INetFwOpenPorts * fwPorts = NULL; + INetFwOpenPort * fwPort = NULL; + HRESULT hr; + HRESULT rhr = S_OK; /* return value */ + + hr = fwProfile->get_GloballyOpenPorts(&fwPorts); + if (FAILED(hr)) { + // Abort! + DEBUGOUT(("Can't get globallyOpenPorts\n")); + rhr = hr; + goto cleanup; + } + + // go through the supplied ports + for (int i=0; iItem(ports[i].port, ports[i].protocol, &fwPort); + if (SUCCEEDED(hr)) { + DEBUGOUT(("Found port for %S\n",ports[i].name)); + hr = fwPort->get_Enabled(&vbEnabled); + if (SUCCEEDED(hr)) { + if ( vbEnabled == VARIANT_FALSE ) { + hr = fwPort->put_Enabled(VARIANT_TRUE); + if (FAILED(hr)) { + // failed. Mark as failure. Don't try to create the port either. + rhr = hr; + } + } // else we are fine + } else { + // Something is wrong with the port. + // We try to create a new one thus overriding this faulty one. + bCreate = TRUE; + } + fwPort->Release(); + fwPort = NULL; + } else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) { + DEBUGOUT(("Port not found for %S\n", ports[i].name)); + bCreate = TRUE; + } + + if (bCreate) { + DEBUGOUT(("Trying to create port %S\n",ports[i].name)); + hr = CoCreateInstance( + __uuidof(NetFwOpenPort), + NULL, + CLSCTX_INPROC_SERVER, + __uuidof(INetFwOpenPort), + reinterpret_cast + (static_cast(&fwPort)) + ); + + if (FAILED(hr)) { + DEBUGOUT(("Can't create port\n")); + rhr = hr; + } else { + DEBUGOUT(("Created port\n")); + hr = fwPort->put_IpVersion( NET_FW_IP_VERSION_ANY ); + if (FAILED(hr)) { + DEBUGOUT(("Can't set IpVersion\n")); + rhr = hr; + goto abandon_port; + } + + hr = fwPort->put_Port( ports[i].port ); + if (FAILED(hr)) { + DEBUGOUT(("Can't set Port\n")); + rhr = hr; + goto abandon_port; + } + + hr = fwPort->put_Protocol( ports[i].protocol ); + if (FAILED(hr)) { + DEBUGOUT(("Can't set Protocol\n")); + rhr = hr; + goto abandon_port; + } + + hr = fwPort->put_Scope( NET_FW_SCOPE_ALL ); + if (FAILED(hr)) { + DEBUGOUT(("Can't set Scope\n")); + rhr = hr; + goto abandon_port; + } + + bstName = SysAllocString( ports[i].name ); + + if (SysStringLen(bstName) == 0) { + rhr = E_OUTOFMEMORY; + } else { + hr = fwPort->put_Name( bstName ); + if (FAILED(hr)) { + DEBUGOUT(("Can't set Name\n")); + rhr = hr; + SysFreeString( bstName ); + goto abandon_port; + } + } + + SysFreeString( bstName ); + + hr = fwPorts->Add( fwPort ); + if (FAILED(hr)) { + DEBUGOUT(("Can't add port\n")); + rhr = hr; + } else + DEBUGOUT(("Added port\n")); + +abandon_port: + fwPort->Release(); + } + } + } // loop through ports + + fwPorts->Release(); + +cleanup: + + if (fwPorts != NULL) + fwPorts->Release(); + + return rhr; +} + +long icf_CheckAndAddAFSPorts(int portset) { + HRESULT hr; + BOOL coInitialized = FALSE; + INetFwProfile * fwProfile = NULL; + global_afs_port_t * ports; + int nports; + long code = 0; + + if (portset == AFS_PORTSET_CLIENT) { + ports = afs_clientPorts; + nports = sizeof(afs_clientPorts) / sizeof(*afs_clientPorts); + } else if (portset == AFS_PORTSET_SERVER) { + ports = afs_serverPorts; + nports = sizeof(afs_serverPorts) / sizeof(*afs_serverPorts); + } else + return 1; /* Invalid port set */ + + hr = CoInitializeEx( + NULL, + COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE + ); + + if (SUCCEEDED(hr) || RPC_E_CHANGED_MODE == hr) + { + coInitialized = TRUE; + } + // not necessarily catastrophic if the call failed. We'll try to + // continue as if it succeeded. + + hr = icf_OpenFirewallProfile(&fwProfile); + if (FAILED(hr)) { + // Ok. That didn't work. This could be because the machine we + // are running on doesn't have Windows Firewall. We'll return + // a failure to the caller, which shouldn't be taken to mean + // it's catastrophic. + DEBUGOUT(("Can't open Firewall profile\n")); + code = 1; + goto cleanup; + } + + // Now that we have a firewall profile, we can start checking + // and adding the ports that we want. + hr = icf_CheckAndAddPorts(fwProfile, ports, nports); + if (FAILED(hr)) + code = 1; + +cleanup: + if (coInitialized) { + CoUninitialize(); + } + + return code; +} + + +#ifdef TESTMAIN +int main(int argc, char **argv) { + printf("Starting...\n"); + if (icf_CheckAndAddAFSPorts(AFS_PORTSET_CLIENT)) + printf("Failed\n"); + else + printf("Succeeded\n"); + printf("Done\n"); + return 0; +} +#endif \ No newline at end of file diff --git a/src/WINNT/afsd/afsicf.h b/src/WINNT/afsd/afsicf.h new file mode 100644 index 000000000..05adc99a0 --- /dev/null +++ b/src/WINNT/afsd/afsicf.h @@ -0,0 +1,40 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +long icf_CheckAndAddAFSPorts(int portset); + +#ifdef __cplusplus +} +#endif + +#define AFS_PORTSET_CLIENT 1 +#define AFS_PORTSET_SERVER 2 + diff --git a/src/WINNT/afsd/afskfw-int.h b/src/WINNT/afsd/afskfw-int.h index 5f96120f8..dba551d90 100644 --- a/src/WINNT/afsd/afskfw-int.h +++ b/src/WINNT/afsd/afskfw-int.h @@ -247,5 +247,5 @@ int KFW_AFS_unlog(void); int KFW_AFS_klog(krb5_context, krb5_ccache, char*, char*, char*, int, char*); void KFW_import_ccache_data(void); BOOL MSLSA_IsKerberosLogon(); -char *afs_realm_of_cell(struct afsconf_cell *); +char *afs_realm_of_cell(krb5_context, struct afsconf_cell *); #endif /* AFSKFW_INT_H */ diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index 89d085b48..fbf10568a 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -1197,23 +1197,25 @@ KFW_AFS_get_cred( char * username, if ( lifetime == 0 ) lifetime = pLeash_get_default_lifetime(); - code = KFW_kinit(ctx, cc, HWND_DESKTOP, - pname, - password, - lifetime, - pLeash_get_default_forwardable(), - pLeash_get_default_proxiable(), - pLeash_get_default_renewable() ? pLeash_get_default_renew_till() : 0, - pLeash_get_default_noaddresses(), - pLeash_get_default_publicip()); - if ( IsDebuggerPresent() ) { - char message[256]; - sprintf(message,"KFW_kinit() returns: %d\n",code); - OutputDebugString(message); + if ( password && password[0] ) { + code = KFW_kinit( ctx, cc, HWND_DESKTOP, + pname, + password, + lifetime, + pLeash_get_default_forwardable(), + pLeash_get_default_proxiable(), + pLeash_get_default_renewable() ? pLeash_get_default_renew_till() : 0, + pLeash_get_default_noaddresses(), + pLeash_get_default_publicip()); + if ( IsDebuggerPresent() ) { + char message[256]; + sprintf(message,"KFW_kinit() returns: %d\n",code); + OutputDebugString(message); + } + if ( code ) goto cleanup; + + KFW_AFS_update_princ_ccache_data(ctx, cc, FALSE); } - if ( code ) goto cleanup; - - KFW_AFS_update_princ_ccache_data(ctx, cc, FALSE); code = KFW_AFS_klog(ctx, cc, "afs", cell, realm, lifetime,smbname); if ( IsDebuggerPresent() ) { @@ -2716,13 +2718,13 @@ KFW_AFS_klog( } if ( smbname ) { - strncpy(aclient.smbname, smbname, MAXRANDOMNAMELEN); - aclient.smbname[MAXRANDOMNAMELEN-1] = '\0'; + strncpy(aclient.smbname, smbname, sizeof(aclient.smbname)); + aclient.smbname[sizeof(aclient.smbname)-1] = '\0'; } else { aclient.smbname[0] = '\0'; } - rc = ktc_SetToken(&aserver, &atoken, &aclient, 0); + rc = ktc_SetToken(&aserver, &atoken, &aclient, (aclient.smbname[0]?AFS_SETTOK_LOGON:0)); if (!rc) goto cleanup; /* We have successfully inserted the token */ @@ -2834,13 +2836,13 @@ KFW_AFS_klog( strcpy(aclient.cell, CellName); if ( smbname ) { - strncpy(aclient.smbname, smbname, MAXRANDOMNAMELEN); - aclient.smbname[MAXRANDOMNAMELEN-1] = '\0'; + strncpy(aclient.smbname, smbname, sizeof(aclient.smbname)); + aclient.smbname[sizeof(aclient.smbname)-1] = '\0'; } else { aclient.smbname[0] = '\0'; } - if (rc = ktc_SetToken(&aserver, &atoken, &aclient, 0)) + if (rc = ktc_SetToken(&aserver, &atoken, &aclient, (aclient.smbname[0]?AFS_SETTOK_LOGON:0))) { KFW_AFS_error(rc, "ktc_SetToken()"); code = rc; diff --git a/src/WINNT/afsd/afslogon.c b/src/WINNT/afsd/afslogon.c index 8cb927031..3e63daa1f 100644 --- a/src/WINNT/afsd/afslogon.c +++ b/src/WINNT/afsd/afslogon.c @@ -7,89 +7,55 @@ * directory or online at http://www.openafs.org/dl/license10.html */ -#include -#include - -#include -#include -#include -#include "afsd.h" -#include -#include -#include "cm_config.h" -#include "krb.h" +#include "afslogon.h" #include #include #include #include -DWORD LogonOption,TraceOption; +#include -HANDLE hDLL; +#include +#include +#include +#include -WSADATA WSAjunk; +#include "afsd.h" +#include "cm_config.h" +#include "krb.h" +#include "afskfw.h" -#define REG_CLIENT_PARMS_KEY "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters" -#define REG_CLIENT_PROVIDER_KEY "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider" -#define REG_CLIENT_RETRY_INTERVAL_PARM "LoginRetryInterval" -#define REG_CLIENT_FAIL_SILENTLY_PARM "FailLoginsSilently" -#define DEFAULT_RETRY_INTERVAL 30 /* seconds*/ -#define DEFAULT_FAIL_SILENTLY FALSE -#define DEFAULT_SLEEP_INTERVAL 5 /* seconds*/ - -#define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED) -#define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY) - -#define TRACE_OPTION_EVENT 1 -#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) - -/* Structure def copied from DDK (NTDEF.H) */ -typedef struct UNICODE_STRING { - USHORT Length; /* number of bytes of Buffer actually used */ - USHORT MaximumLength; /* sizeof buffer in bytes */ - WCHAR *Buffer; /* 16 bit characters */ -} UNICODE_STRING; - -/* Structure def copied from NP API documentation */ -typedef struct _MSV1_0_INTERACTIVE_LOGON { - DWORD MessageType; /* Actually this is an enum; ignored */ - UNICODE_STRING LogonDomainName; - UNICODE_STRING UserName; - UNICODE_STRING Password; -} MSV1_0_INTERACTIVE_LOGON; +DWORD TraceOption = 0; -/* - * GetLogonScript - * - * We get a logon script pathname from the HKEY_LOCAL_MACHINE registry. - * I don't know what good this does; I just copied it from DFS. - * - * Returns NULL on failure. - */ +HANDLE hDLL; +WSADATA WSAjunk; +#define AFS_LOGON_EVENT_NAME TEXT("AFS Logon") void DebugEvent0(char *a) { HANDLE h; char *ptbuf[1]; if (!ISLOGONTRACE(TraceOption)) return; - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); + h = RegisterEventSource(NULL, AFS_LOGON_EVENT_NAME); ptbuf[0] = a; ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL); DeregisterEventSource(h); } -#define MAXBUF_ 131 -void DebugEvent(char *a,char *b,...) +#define MAXBUF_ 512 +void DebugEvent(char *b,...) { HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; va_list marker; + if (!ISLOGONTRACE(TraceOption)) return; - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); + + h = RegisterEventSource(NULL, AFS_LOGON_EVENT_NAME); va_start(marker,b); - _vsnprintf(buf,MAXBUF_,b,marker); + StringCbVPrintf(buf, MAXBUF_+1,b,marker); buf[MAXBUF_] = '\0'; ptbuf[0] = buf; ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);\ @@ -97,6 +63,47 @@ void DebugEvent(char *a,char *b,...) va_end(marker); } +static HANDLE hInitMutex = NULL; +static BOOL bInit = FALSE; + +BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) +{ + hDLL = dll; + switch (reason) { + case DLL_PROCESS_ATTACH: + /* Initialization Mutex */ + hInitMutex = CreateMutex(NULL, FALSE, NULL); + break; + + case DLL_PROCESS_DETACH: + CloseHandle(hInitMutex); + break; + + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + default: + /* Everything else succeeds but does nothing. */ + break; + } + + return TRUE; +} + +void AfsLogonInit(void) +{ + if ( bInit == FALSE ) { + if ( WaitForSingleObject( hInitMutex, INFINITE ) == WAIT_OBJECT_0 ) { + if ( bInit == FALSE ) { + rx_Init(0); + initAFSDirPath(); + ka_Init(0); + bInit = TRUE; + } + ReleaseMutex(hInitMutex); + } + } +} + CHAR *GenRandomName(CHAR *pbuf) { int i; @@ -107,66 +114,6 @@ CHAR *GenRandomName(CHAR *pbuf) return pbuf; } -WCHAR *GetLogonScript(CHAR *pname) -{ - WCHAR *script,*buf; - DWORD code; - DWORD LSPtype, LSPsize; - HKEY NPKey; - WCHAR randomName[MAXRANDOMNAMELEN]; - - /* - * Get Network Provider key. - * Assume this works or we wouldn't be here. - */ - (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY, - 0, KEY_QUERY_VALUE, &NPKey); - - /* - * Get Logon Script pathname length - */ - - code = RegQueryValueExW(NPKey, L"LogonScript", NULL, - &LSPtype, NULL, &LSPsize); - - if (code) { - RegCloseKey (NPKey); - return NULL; - } - - if (LSPtype != REG_SZ) { /* Maybe handle REG_EXPAND_SZ? */ - RegCloseKey (NPKey); - return NULL; - } - - buf=(WCHAR *)LocalAlloc(LMEM_FIXED,LSPsize); - script=(WCHAR *)LocalAlloc(LMEM_FIXED,LSPsize+(MAXRANDOMNAMELEN)*sizeof(WCHAR)); - /* - * Explicitly call UNICODE version - * Assume it will succeed since it did before - */ - (void) RegQueryValueExW(NPKey, L"LogonScript", NULL, - &LSPtype, (LPBYTE)buf, &LSPsize); - MultiByteToWideChar(CP_ACP,0,pname,strlen(pname)+1,randomName,(strlen(pname)+1)*sizeof(WCHAR)); - swprintf(script,buf,randomName); - LocalFree(buf); - -#ifdef DEBUG_VERBOSE - { - HANDLE h; char *ptbuf[1],buf[132],tbuf[255]; - WideCharToMultiByte(CP_ACP,0,script,LSPsize,tbuf,255,NULL,NULL); - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); - sprintf(buf, "Script[%s,%d] Return Code[%x]",tbuf,LSPsize,code); - ptbuf[0] = buf; - ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL); - DeregisterEventSource(h); - } -#endif - - RegCloseKey (NPKey); - return script; -} - BOOLEAN AFSWillAutoStart(void) { SC_HANDLE scm; @@ -178,7 +125,7 @@ BOOLEAN AFSWillAutoStart(void) LONG status; /* Open services manager */ - scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + scm = OpenSCManager(NULL, NULL, GENERIC_READ); if (!scm) return FALSE; /* Open AFSD service */ @@ -220,75 +167,35 @@ close_scm: DWORD MapAuthError(DWORD code) { switch (code) { - case KTC_NOCM: + /* Unfortunately, returning WN_NO_NETWORK results in the MPR abandoning + * logon scripts for all credential managers, although they will still + * receive logon notifications. Since we don't want this, we return + * WN_SUCCESS. This is highly undesirable, but we also don't want to + * break other network providers. + */ +/* case KTC_NOCM: case KTC_NOCMRPC: - return WN_NO_NETWORK; -/* case INTK_BADPW: return WN_BAD_PASSWORD;*/ -/* case KERB_ERR_PRINCIPAL_UNKNOWN: return WN_BAD_USER;*/ + return WN_NO_NETWORK; */ default: return WN_SUCCESS; } } -BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved) -{ - hDLL = dll; - switch (reason) { - case DLL_PROCESS_ATTACH: - /* Initialize AFS libraries */ - rx_Init(0); - initAFSDirPath(); - ka_Init(0); - break; - - /* Everything else succeeds but does nothing. */ - case DLL_PROCESS_DETACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - default: - break; - } - - return TRUE; -} - DWORD APIENTRY NPGetCaps(DWORD index) { switch (index) { case WNNC_NET_TYPE: /* Don't have our own type; use somebody else's. */ return WNNC_NET_SUN_PC_NFS; + + case WNNC_START: + /* Say we are already started, even though we might wait after we receive NPLogonNotify */ + return 1; + default: return 0; } } -static void GetLoginBehavior(int *pRetryInterval, BOOLEAN *pFailSilently) -{ - long result; - HKEY hKey; - DWORD dummyLen; - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, 0, KEY_QUERY_VALUE, &hKey); - if (result != ERROR_SUCCESS) { - *pRetryInterval = DEFAULT_RETRY_INTERVAL; - *pFailSilently = DEFAULT_FAIL_SILENTLY; - return; - } - - result = RegQueryValueEx(hKey, REG_CLIENT_RETRY_INTERVAL_PARM, 0, 0, (BYTE *)pRetryInterval, &dummyLen); - if (result != ERROR_SUCCESS) - *pRetryInterval = DEFAULT_RETRY_INTERVAL; - - result = RegQueryValueEx(hKey, REG_CLIENT_FAIL_SILENTLY_PARM, 0, 0, (BYTE *)pFailSilently, &dummyLen); - if (result != ERROR_SUCCESS) - *pFailSilently = DEFAULT_FAIL_SILENTLY; - - /* Make sure this is really a bool value in the strict sense*/ - *pFailSilently = !!*pFailSilently; - - RegCloseKey(hKey); -} - BOOL IsServiceRunning (void) { SERVICE_STATUS Status; @@ -311,6 +218,319 @@ BOOL IsServiceRunning (void) return (Status.dwCurrentState == SERVICE_RUNNING); } +/* LOOKUPKEYCHAIN: macro to look up the value in the list of keys in order until it's found + v:variable to receive value (reference type) + t:type + d:default, in case the value isn't on any of the keys + n:name of value */ +#define LOOKUPKEYCHAIN(v,t,d,n) \ + do { \ + rv = ~ERROR_SUCCESS; \ + dwType = t; \ + if(hkDom) { \ + dwSize = sizeof(v); \ + rv = RegQueryValueEx(hkDom, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \ + if(rv == ERROR_SUCCESS) DebugEvent(#v " found in hkDom with type [%d]", dwType); \ + } \ + if(hkDoms && (rv != ERROR_SUCCESS || dwType != t)) { \ + dwSize = sizeof(v); \ + rv = RegQueryValueEx(hkDoms, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \ + if(rv == ERROR_SUCCESS) DebugEvent(#v " found in hkDoms with type [%d]", dwType); \ + } \ + if(hkNp && (rv != ERROR_SUCCESS || dwType != t)) { \ + dwSize = sizeof(v); \ + rv = RegQueryValueEx(hkNp, n, 0, &dwType, (LPBYTE) &(v), &dwSize); \ + if(rv == ERROR_SUCCESS) DebugEvent(#v " found in hkNp with type [%d]", dwType); \ + } \ + if(rv != ERROR_SUCCESS || dwType != t) { \ + v = d; \ + DebugEvent(#v " being set to default"); \ + } \ + } while(0) + +/* Get domain specific configuration info. We are returning void because if anything goes wrong + we just return defaults. + */ +void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt ) { + HKEY hkParm = NULL; /* Service parameter */ + HKEY hkNp = NULL; /* network provider key */ + HKEY hkDoms = NULL; /* domains key */ + HKEY hkDom = NULL; /* DOMAINS/domain key */ + HKEY hkTemp = NULL; + LONG rv; + DWORD dwSize; + DWORD dwType; + DWORD dwDummy; + char computerName[MAX_COMPUTERNAME_LENGTH + 1]; + char *effDomain; + + DebugEvent("In GetDomainLogonOptions for user [%s] in domain [%s]", username, domain); + /* If the domain is the same as the Netbios computer name, we use the LOCALHOST domain name*/ + opt->flags = LOGON_FLAG_REMOTE; + if(domain) { + dwSize = MAX_COMPUTERNAME_LENGTH; + if(GetComputerName(computerName, &dwSize)) { + if(!stricmp(computerName, domain)) { + effDomain = "LOCALHOST"; + opt->flags = LOGON_FLAG_LOCAL; + } + else + effDomain = domain; + } + } else + effDomain = NULL; + + rv = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, 0, KEY_READ, &hkParm ); + if(rv != ERROR_SUCCESS) { + hkParm = NULL; + DebugEvent("GetDomainLogonOption: Can't open parms key [%d]", rv); + } + + rv = RegOpenKeyEx( HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY, 0, KEY_READ, &hkNp ); + if(rv != ERROR_SUCCESS) { + hkNp = NULL; + DebugEvent("GetDomainLogonOptions: Can't open NP key [%d]", rv); + } + + if(hkNp) { + rv = RegOpenKeyEx( hkNp, REG_CLIENT_DOMAINS_SUBKEY, 0, KEY_READ, &hkDoms ); + if( rv != ERROR_SUCCESS ) { + hkDoms = NULL; + DebugEvent("GetDomainLogonOptions: Can't open Domains key [%d]", rv); + } + } + + if(hkDoms && effDomain) { + rv = RegOpenKeyEx( hkDoms, effDomain, 0, KEY_READ, &hkDom ); + if( rv != ERROR_SUCCESS ) { + hkDom = NULL; + DebugEvent("GetDomainLogonOptions: Can't open domain key for [%s] [%d]", effDomain, rv); + /* If none of the domains match, we shouldn't use the domain key either */ + RegCloseKey(hkDoms); + hkDoms = NULL; + } + } else + DebugEvent("Not opening domain key for [%s]", effDomain); + + /* Each individual can either be specified on the domain key, the domains key or in the + net provider key. They fail over in that order. If none is found, we just use the + defaults. */ + + /* LogonOption */ + LOOKUPKEYCHAIN(opt->LogonOption, REG_DWORD, DEFAULT_LOGON_OPTION, REG_CLIENT_LOGON_OPTION_PARM); + + /* FailLoginsSilently */ + dwSize = sizeof(dwDummy); + rv = RegQueryValueEx(hkParm, REG_CLIENT_FAIL_SILENTLY_PARM, 0, &dwType, (LPBYTE) &dwDummy, &dwSize); + if(rv != ERROR_SUCCESS) + LOOKUPKEYCHAIN(dwDummy, REG_DWORD, DEFAULT_FAIL_SILENTLY, REG_CLIENT_FAIL_SILENTLY_PARM); + opt->failSilently = !!dwDummy; + + /* Retry interval */ + LOOKUPKEYCHAIN(opt->retryInterval, REG_DWORD, DEFAULT_RETRY_INTERVAL, REG_CLIENT_RETRY_INTERVAL_PARM); + + /* Sleep interval */ + LOOKUPKEYCHAIN(opt->sleepInterval, REG_DWORD, DEFAULT_SLEEP_INTERVAL, REG_CLIENT_SLEEP_INTERVAL_PARM); + + opt->logonScript = NULL; + opt->smbName = NULL; + + if(!ISLOGONINTEGRATED(opt->LogonOption)) { + goto cleanup; /* no need to lookup the logon script */ + } + + /* come up with SMB username */ + if(ISHIGHSECURITY(opt->LogonOption)) { + opt->smbName = malloc( MAXRANDOMNAMELEN ); + GenRandomName(opt->smbName); + } else { + /* username and domain for logon session is not necessarily the same as + username and domain passed into network provider. */ + PSECURITY_LOGON_SESSION_DATA plsd; + char lsaUsername[MAX_USERNAME_LENGTH]; + char lsaDomain[MAX_DOMAIN_LENGTH]; + size_t len, tlen; + + LsaGetLogonSessionData(lpLogonId, &plsd); + + UnicodeStringToANSI(plsd->UserName, lsaUsername, MAX_USERNAME_LENGTH); + UnicodeStringToANSI(plsd->LogonDomain, lsaDomain, MAX_DOMAIN_LENGTH); + + DebugEvent("PLSD username[%s] domain[%s]",lsaUsername,lsaDomain); + + if(SUCCEEDED(StringCbLength(lsaUsername, MAX_USERNAME_LENGTH, &tlen))) + len = tlen; + else + goto bad_strings; + + if(SUCCEEDED(StringCbLength(lsaDomain, MAX_DOMAIN_LENGTH, &tlen))) + len += tlen; + else + goto bad_strings; + + len += 2; + + opt->smbName = malloc(len); + + StringCbCopy(opt->smbName, len, lsaDomain); + StringCbCat(opt->smbName, len, "\\"); + StringCbCat(opt->smbName, len, lsaUsername); + + strlwr(opt->smbName); + +bad_strings: + LsaFreeReturnBuffer(plsd); + } + + DebugEvent("Looking up logon script"); + /* Logon script */ + /* First find out where the key is */ + hkTemp = NULL; + rv = ~ERROR_SUCCESS; + dwType = 0; + if(hkDom) + rv = RegQueryValueExW(hkDom, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize); + if(rv == ERROR_SUCCESS && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) { + hkTemp = hkDom; + DebugEvent("Located logon script in hkDom"); + } + else if(hkDoms) + rv = RegQueryValueExW(hkDoms, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize); + if(rv == ERROR_SUCCESS && !hkTemp && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) { + hkTemp = hkDoms; + DebugEvent("Located logon script in hkDoms"); + } + /* Note that the LogonScript in the NP key is only used if we are doing high security. */ + else if(hkNp && ISHIGHSECURITY(opt->LogonOption)) + rv = RegQueryValueExW(hkNp, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, NULL, &dwSize); + if(rv == ERROR_SUCCESS && !hkTemp && (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) { + hkTemp = hkNp; + DebugEvent("Located logon script in hkNp"); + } + + if(hkTemp) { + WCHAR *regscript = NULL; + WCHAR *regexscript = NULL; + WCHAR *regexuscript = NULL; + WCHAR *wuname = NULL; + HRESULT hr; + + size_t len; + + StringCbLength(opt->smbName, MAX_USERNAME_LENGTH, &len); + len ++; + + wuname = malloc(len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP,0,opt->smbName,-1,wuname,len*sizeof(WCHAR)); + + DebugEvent("Username is set for [%S]", wuname); + + /* dwSize still has the size of the required buffer in bytes. */ + regscript = malloc(dwSize); + rv = RegQueryValueExW(hkTemp, REG_CLIENT_LOGON_SCRIPT_PARMW, 0, &dwType, (LPBYTE) regscript, &dwSize); + if(rv != ERROR_SUCCESS) {/* what the ..? */ + DebugEvent("Can't look up logon script [%d]",rv); + goto doneLogonScript; + } + + DebugEvent("Found logon script [%S]", regscript); + + if(dwType == REG_EXPAND_SZ) { + DWORD dwReq; + + dwSize += MAX_PATH * sizeof(WCHAR); /* make room for environment expansion. */ + regexscript = malloc(dwSize); + dwReq = ExpandEnvironmentStringsW(regscript, regexscript, dwSize / sizeof(WCHAR)); + free(regscript); + regscript = regexscript; + regexscript = NULL; + if(dwReq > (dwSize / sizeof(WCHAR))) { + DebugEvent("Overflow while expanding environment strings."); + goto doneLogonScript; + } + } + + DebugEvent("After expanding env strings [%S]", regscript); + + if(wcsstr(regscript, L"%s")) { + dwSize += len * sizeof(WCHAR); /* make room for username expansion */ + regexuscript = (WCHAR *) LocalAlloc(LMEM_FIXED, dwSize); + hr = StringCbPrintfW(regexuscript, dwSize, regscript, wuname); + } else { + regexuscript = (WCHAR *) LocalAlloc(LMEM_FIXED, dwSize); + hr = StringCbCopyW(regexuscript, dwSize, regscript); + } + + DebugEvent("After expanding username [%S]", regexuscript); + + if(hr == S_OK) + opt->logonScript = regexuscript; + else + LocalFree(regexuscript); + +doneLogonScript: + if(wuname) free(wuname); + if(regscript) free(regscript); + if(regexscript) free(regexscript); + } + +cleanup: + if(hkNp) RegCloseKey(hkNp); + if(hkDom) RegCloseKey(hkDom); + if(hkDoms) RegCloseKey(hkDoms); + if(hkParm) RegCloseKey(hkParm); +} + +#undef LOOKUPKEYCHAIN + +/* Try to find out which cell the given path is in. We must retain + the contents of *cell in case of failure. *cell is assumed to be + at least cellLen chars */ +DWORD GetFileCellName(char * path, char * cell, size_t cellLen) { + struct ViceIoctl blob; + char tcell[MAX_PATH]; + DWORD code; + + blob.in_size = 0; + blob.out_size = MAX_PATH; + blob.out = tcell; + + code = pioctl(path, VIOC_FILE_CELL_NAME, &blob, 1); + + if(!code) { + strncpy(cell, tcell, cellLen); + cell[cellLen - 1] = '\0'; + } + return code; +} + + +static BOOL +WINAPI +UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen) +{ + CPINFO CodePageInfo; + + GetCPInfo(CP_ACP, &CodePageInfo); + + if (CodePageInfo.MaxCharSize > 1) + // Only supporting non-Unicode strings + return FALSE; + + if (uInputString.Buffer && ((LPBYTE) uInputString.Buffer)[1] == '\0') + { + // Looks like unicode, better translate it + // UNICODE_STRING specifies the length of the buffer string in Bytes not WCHARS + WideCharToMultiByte(CP_ACP, 0, (LPCWSTR) uInputString.Buffer, uInputString.Length/2, + lpszOutputString, nOutStringLen-1, NULL, NULL); + lpszOutputString[min(uInputString.Length/2,nOutStringLen-1)] = '\0'; + return TRUE; + } + else + lpszOutputString[0] = '\0'; + return FALSE; +} // UnicodeStringToANSI + DWORD APIENTRY NPLogonNotify( PLUID lpLogonId, LPCWSTR lpAuthentInfoType, @@ -321,37 +541,55 @@ DWORD APIENTRY NPLogonNotify( LPVOID StationHandle, LPWSTR *lpLogonScript) { - char uname[256]=""; - char *ctemp; - char password[256]=""; + char uname[MAX_USERNAME_LENGTH]=""; + char password[MAX_PASSWORD_LENGTH]=""; + char logonDomain[MAX_DOMAIN_LENGTH]=""; char cell[256]=""; + char homePath[MAX_PATH]=""; + MSV1_0_INTERACTIVE_LOGON *IL; + DWORD code; + int pw_exp; char *reason; + char *ctemp; + BOOLEAN interactive; BOOLEAN flag; DWORD LSPtype, LSPsize; HKEY NPKey; + HWND hwndOwner = (HWND)StationHandle; - BOOLEAN failSilently; - int retryInterval; - int sleepInterval = DEFAULT_SLEEP_INTERVAL; /* seconds */ - BOOLEAN afsWillAutoStart; - CHAR RandomName[MAXRANDOMNAMELEN]; + + BOOLEAN afsWillAutoStart; + BOOLEAN uppercased_name = TRUE; + LogonOptions_t opt; /* domain specific logon options */ + int retryInterval; + int sleepInterval; + + /* Make sure the AFS Libraries are initialized */ + AfsLogonInit(); + /* Initialize Logon Script to none */ *lpLogonScript=NULL; - + + /* TODO: We should check the value of lpAuthentInfoType before assuming that it is + MSV1_0_INTERACTIVE_LOGON though for our purposes KERB_INTERACTIVE_LOGON is + co-incidentally equivalent. */ IL = (MSV1_0_INTERACTIVE_LOGON *) lpAuthentInfo; /* Are we interactive? */ interactive = (wcscmp(lpStationName, L"WinSta0") == 0); /* Convert from Unicode to ANSI */ - wcstombs(uname, IL->UserName.Buffer, 256); - wcstombs(password, IL->Password.Buffer, 256); + + /*TODO: Use SecureZeroMemory to erase passwords */ + UnicodeStringToANSI(IL->UserName, uname, MAX_USERNAME_LENGTH); + UnicodeStringToANSI(IL->Password, password, MAX_PASSWORD_LENGTH); + UnicodeStringToANSI(IL->LogonDomainName, logonDomain, MAX_DOMAIN_LENGTH); /* Make sure AD-DOMANS sent from login that is sent to us is striped */ ctemp = strchr(uname, '@'); @@ -368,93 +606,89 @@ DWORD APIENTRY NPLogonNotify( (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, 0, KEY_QUERY_VALUE, &NPKey); LSPsize=sizeof(TraceOption); - RegQueryValueEx(NPKey, "TraceOption", NULL, + RegQueryValueEx(NPKey, REG_CLIENT_TRACE_OPTION_PARM, NULL, &LSPtype, (LPBYTE)&TraceOption, &LSPsize); - RegCloseKey (NPKey); - + + RegCloseKey (NPKey); + /* - * Get Logon OPTIONS + * Get Logon options */ - (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY, - 0, KEY_QUERY_VALUE, &NPKey); + GetDomainLogonOptions( lpLogonId, uname, logonDomain, &opt ); + retryInterval = opt.retryInterval; + sleepInterval = opt.sleepInterval; + *lpLogonScript = opt.logonScript; - LSPsize=sizeof(LogonOption); - code = RegQueryValueEx(NPKey, "LogonOptions", NULL, - &LSPtype, (LPBYTE)&LogonOption, &LSPsize); - - RegCloseKey (NPKey); - if ((code!=0) || (LSPtype!=REG_DWORD)) - LogonOption=LOGON_OPTION_INTEGRATED; /*default to integrated logon only*/ + DebugEvent("Got logon script: %S",opt.logonScript); afsWillAutoStart = AFSWillAutoStart(); - - DebugEvent("AFS AfsLogon - NPLogonNotify","LogonOption[%x], Service AutoStart[%d]", - LogonOption,afsWillAutoStart); + + DebugEvent("LogonOption[%x], Service AutoStart[%d]", + opt.LogonOption,afsWillAutoStart); - /* Get local machine specified login behavior (or defaults) */ - GetLoginBehavior(&retryInterval, &failSilently); - /* Check for zero length password if integrated logon*/ - if ( ISLOGONINTEGRATED(LogonOption) ) { + if ( ISLOGONINTEGRATED(opt.LogonOption) ) { if ( password[0] == 0 ) { + DebugEvent("Password is the empty string"); code = GT_PW_NULL; reason = "zero length password is illegal"; code=0; } - /* Get cell name if doing integrated logon */ + /* Get cell name if doing integrated logon. + We might overwrite this if we are logging into an AD realm and we find out that + the user's home dir is in some other cell. */ + DebugEvent("About to call cm_GetRootCellName(%s)",cell); code = cm_GetRootCellName(cell); if (code < 0) { + DebugEvent("Unable to obtain Root Cell"); code = KTC_NOCELL; reason = "unknown cell"; code=0; - } + } else { + DebugEvent("Cell is %s",cell); + } - /*only do if high security option is on*/ - if (ISHIGHSECURITY(LogonOption)) - *lpLogonScript = GetLogonScript(GenRandomName(RandomName)); + /* We get the user's home directory path, if applicable, though we can't lookup the + cell right away because the client service may not have started yet. This call + also sets the AD_REALM flag in opt.flags if applicable. */ + if(ISREMOTE(opt.flags)) { + DebugEvent("Is Remote"); + GetAdHomePath(homePath,MAX_PATH,lpLogonId,&opt); + } } /* loop until AFS is started. */ while (TRUE) { - code=0; + DebugEvent("while(TRUE) LogonOption[%x], Service AutoStart[%d]", + opt.LogonOption,afsWillAutoStart); + + if(ISADREALM(opt.flags)) { + code = GetFileCellName(homePath,cell,256); + if(!code) { + DebugEvent("profile path [%s] is in cell [%s]",homePath,cell); + } + /* Don't bail out if GetFileCellName failed. + * The home dir may not be in AFS after all. + */ + } else + code=0; - /* is service started yet?*/ - DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]", - code,uname,cell); - - /* if Integrated Logon only */ - if (ISLOGONINTEGRATED(LogonOption) && !ISHIGHSECURITY(LogonOption)) + /* if Integrated Logon */ + if (ISLOGONINTEGRATED(opt.LogonOption)) { - if ( KFW_is_available() ) - code = KFW_AFS_get_cred(uname, cell, password, 0, uname, &reason); - else - code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON, - uname, "", cell, password, uname, 0, &pw_exp, 0, - &reason); - DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]", - code); - if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) { - for ( ctemp = uname; *ctemp ; ctemp++) { - *ctemp = tolower(*ctemp); - } - uppercased_name = FALSE; - continue; - } - } - /* if Integrated Logon and High Security pass random generated name*/ - else if (ISLOGONINTEGRATED(LogonOption) && ISHIGHSECURITY(LogonOption)) - { - if ( KFW_is_available() ) - code = KFW_AFS_get_cred(uname, cell, password, 0, RandomName, &reason); - else + if ( KFW_is_available() ) { + code = KFW_AFS_get_cred(uname, cell, password, 0, opt.smbName, &reason); + DebugEvent("KFW_AFS_get_cred uname=[%s] smbname=[%s] cell=[%s] code=[%d]",uname,opt.smbName,cell,code); + } + else { code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON, - uname, "", cell, password,RandomName, 0, &pw_exp, 0, + uname, "", cell, password, opt.smbName, 0, &pw_exp, 0, &reason); - DebugEvent("AFS AfsLogon - (Both)ka_UserAuthenticateGeneral2","Code[%x] RandomName[%s]", - code, RandomName); - + DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]", + code); + } if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) { for ( ctemp = uname; *ctemp ; ctemp++) { *ctemp = tolower(*ctemp); @@ -462,7 +696,8 @@ DWORD APIENTRY NPLogonNotify( uppercased_name = FALSE; continue; } - } else { + } + else { /*JUST check to see if its running*/ if (IsServiceRunning()) break; @@ -471,6 +706,10 @@ DWORD APIENTRY NPLogonNotify( break; } + /* is service started yet?*/ + DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]", + code,uname,cell); + /* If we've failed because the client isn't running yet and the * client is set to autostart (and therefore it makes sense for * us to wait for it to start) then sleep a while and try again. @@ -484,7 +723,7 @@ DWORD APIENTRY NPLogonNotify( * user know we failed and give them a chance to try again. */ if (retryInterval <= 0) { reason = "AFS not running"; - if (!interactive || failSilently) + if (!interactive || opt.failSilently) break; flag = MessageBox(hwndOwner, "AFS is still starting. Retry?", @@ -505,30 +744,31 @@ DWORD APIENTRY NPLogonNotify( retryInterval -= sleepInterval; } + DebugEvent("while loop exited"); /* remove any kerberos 5 tickets currently held by the SYSTEM account */ if ( KFW_is_available() ) KFW_AFS_destroy_tickets_for_cell(cell); if (code) { char msg[128]; - sprintf(msg, "Integrated login failed: %s", reason); + HANDLE h; + char *ptbuf[1]; + + StringCbPrintf(msg, sizeof(msg), "Integrated login failed: %s", reason); - if (interactive && !failSilently) + if (ISLOGONINTEGRATED(opt.LogonOption) && interactive && !opt.failSilently) MessageBox(hwndOwner, msg, "AFS Logon", MB_OK); - else { - HANDLE h; - char *ptbuf[1]; - - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); - ptbuf[0] = msg; - ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1008, NULL, - 1, 0, ptbuf, NULL); - DeregisterEventSource(h); - } - code = MapAuthError(code); + + h = RegisterEventSource(NULL, AFS_LOGON_EVENT_NAME); + ptbuf[0] = msg; + ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1008, NULL, + 1, 0, ptbuf, NULL); + DeregisterEventSource(h); + + code = MapAuthError(code); SetLastError(code); - if (ISLOGONINTEGRATED(LogonOption) && (code!=0)) + if (ISLOGONINTEGRATED(opt.LogonOption) && (code!=0)) { if (*lpLogonScript) LocalFree(*lpLogonScript); @@ -539,6 +779,8 @@ DWORD APIENTRY NPLogonNotify( } } + if(opt.smbName) free(opt.smbName); + DebugEvent("AFS AfsLogon - Exit","Return Code[%x]",code); return code; } @@ -552,7 +794,116 @@ DWORD APIENTRY NPPasswordChangeNotify( LPVOID StationHandle, DWORD dwChangeInfo) { + /* Make sure the AFS Libraries are initialized */ + AfsLogonInit(); + DebugEvent0("AFS AfsLogon - NPPasswordChangeNotify"); return 0; } +#include +#include +#include +#include + +BOOL IsPathInAfs(const CHAR *strPath) +{ + char space[2048]; + struct ViceIoctl blob; + int code; + + blob.in_size = 0; + blob.out_size = 2048; + blob.out = space; + + code = pioctl((LPTSTR)((LPCTSTR)strPath), VIOC_FILE_CELL_NAME, &blob, 1); + if (code) + return FALSE; + return TRUE; +} + +#ifdef COMMENT +typedef struct _WLX_NOTIFICATION_INFO { + ULONG Size; + ULONG Flags; + PWSTR UserName; + PWSTR Domain; + PWSTR WindowStation; + HANDLE hToken; + HDESK hDesktop; + PFNMSGECALLBACK pStatusCallback; +} WLX_NOTIFICATION_INFO, *PWLX_NOTIFICATION_INFO; +#endif + +VOID AFS_Startup_Event( PWLX_NOTIFICATION_INFO pInfo ) +{ + DWORD LSPtype, LSPsize; + HKEY NPKey; + + /* Make sure the AFS Libraries are initialized */ + AfsLogonInit(); + + (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, + 0, KEY_QUERY_VALUE, &NPKey); + LSPsize=sizeof(TraceOption); + RegQueryValueEx(NPKey, REG_CLIENT_TRACE_OPTION_PARM, NULL, + &LSPtype, (LPBYTE)&TraceOption, &LSPsize); + + RegCloseKey (NPKey); + DebugEvent0("AFS_Startup_Event"); +} + +VOID AFS_Logoff_Event( PWLX_NOTIFICATION_INFO pInfo ) +{ + DWORD code; + TCHAR profileDir[256] = TEXT(""); + DWORD len = 256; + PTOKEN_USER tokenUser = NULL; + DWORD retLen; + HANDLE hToken; + + /* Make sure the AFS Libraries are initialized */ + AfsLogonInit(); + + DebugEvent0("AFS_Logoff_Event - Starting"); + + if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen)) + { + if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER ) { + tokenUser = (PTOKEN_USER) LocalAlloc(LPTR, retLen); + + if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen)) + { + DebugEvent("GetTokenInformation failed: GLE = %lX", GetLastError()); + } + } + } + + /* We can't use pInfo->Domain for the domain since in the cross realm case + * this is source domain and not the destination domain. + */ + if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) { + WCHAR Domain[64]=L""; + GetLocalShortDomain(Domain, sizeof(Domain)); + if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) + GetUserProfileDirectory(pInfo->hToken, profileDir, &len); + } + + if (strlen(profileDir)) { + DebugEvent("Profile Directory: %s", profileDir); + if (!IsPathInAfs(profileDir)) { + if (code = ktc_ForgetAllTokens()) + DebugEvent("AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code); + else + DebugEvent0("AFS_Logoff_Event - ForgetAllTokens succeeded"); + } else { + DebugEvent0("AFS_Logoff_Event - Tokens left in place; profile in AFS"); + } + } else { + DebugEvent0("AFS_Logoff_Event - Unable to load profile"); + } + + if ( tokenUser ) + LocalFree(tokenUser); +} + diff --git a/src/WINNT/afsd/afslogon.def b/src/WINNT/afsd/afslogon.def index a1000c401..28cafc527 100644 --- a/src/WINNT/afsd/afslogon.def +++ b/src/WINNT/afsd/afslogon.def @@ -8,4 +8,7 @@ EXPORTS NPGetCaps NPLogonNotify NPPasswordChangeNotify + AFS_Startup_Event + AFS_Logoff_Event + diff --git a/src/WINNT/afsd/afslogon.h b/src/WINNT/afsd/afslogon.h new file mode 100644 index 000000000..d222642f3 --- /dev/null +++ b/src/WINNT/afsd/afslogon.h @@ -0,0 +1,127 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +/* We only support VC 1200 and above anyway */ +#pragma once + +#include +#include +#include +#include + + +#define REG_CLIENT_PARMS_KEY "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters" +#define REG_CLIENT_PROVIDER_KEY "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider" +#define REG_CLIENT_DOMAINS_SUBKEY "Domain" +#define REG_CLIENT_RETRY_INTERVAL_PARM "LoginRetryInterval" +#define REG_CLIENT_SLEEP_INTERVAL_PARM "LoginSleepInterval" +#define REG_CLIENT_FAIL_SILENTLY_PARM "FailLoginsSilently" +#define REG_CLIENT_TRACE_OPTION_PARM "TraceOption" +#define REG_CLIENT_LOGON_OPTION_PARM "LogonOptions" +#define REG_CLIENT_LOGON_SCRIPT_PARMW L"LogonScript" +#define DEFAULT_RETRY_INTERVAL 30 /* seconds*/ +#define DEFAULT_FAIL_SILENTLY FALSE +#define DEFAULT_SLEEP_INTERVAL 5 /* seconds*/ +#define DEFAULT_LOGON_OPTION 1 + +#define TRACE_OPTION_EVENT 1 + +#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) + +#define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED) +#define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY) + +#define ISREMOTE(v) ( ((v) & LOGON_FLAG_REMOTE)==LOGON_FLAG_REMOTE) +#define ISADREALM(v) ( ((v) & LOGON_FLAG_AD_REALM)==LOGON_FLAG_AD_REALM) +extern DWORD TraceOption; + +#define LOGON_FLAG_LOCAL 0 +#define LOGON_FLAG_REMOTE 1 +#define LOGON_FLAG_AD_REALM 2 + +typedef struct LogonOptions_type { + DWORD LogonOption; + BOOLEAN failSilently; + int retryInterval; + int sleepInterval; + char * smbName; + LPWSTR logonScript; + DWORD flags; /* LOGON_FLAG_* */ +} LogonOptions_t; + +/* */ +#define MAX_USERNAME_LENGTH 256 +#define MAX_PASSWORD_LENGTH 256 +#define MAX_DOMAIN_LENGTH 256 + +BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved); + +DWORD APIENTRY NPGetCaps(DWORD index); + +DWORD APIENTRY NPLogonNotify( + PLUID lpLogonId, + LPCWSTR lpAuthentInfoType, + LPVOID lpAuthentInfo, + LPCWSTR lpPreviousAuthentInfoType, + LPVOID lpPreviousAuthentInfo, + LPWSTR lpStationName, + LPVOID StationHandle, + LPWSTR *lpLogonScript); + +DWORD APIENTRY NPPasswordChangeNotify( + LPCWSTR lpAuthentInfoType, + LPVOID lpAuthentInfo, + LPCWSTR lpPreviousAuthentInfoType, + LPVOID lpPreviousAuthentInfo, + LPWSTR lpStationName, + LPVOID StationHandle, + DWORD dwChangeInfo); + +#ifdef __cplusplus +extern "C" { +#endif + +void DebugEvent0(char *a); +void DebugEvent(char *b,...); + +CHAR *GenRandomName(CHAR *pbuf); + +BOOLEAN AFSWillAutoStart(void); + +DWORD MapAuthError(DWORD code); + +BOOL IsServiceRunning (void); + +static BOOL WINAPI UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOutStringLen); + +void GetDomainLogonOptions( PLUID lpLogonId, char * username, char * domain, LogonOptions_t *opt ); +DWORD GetFileCellName(char * path, char * cell, size_t cellLen); +DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt); +DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain); +BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain); + +#ifdef __cplusplus +} +#endif diff --git a/src/WINNT/afsd/afsshare.c b/src/WINNT/afsd/afsshare.c index 6382c52fb..eb0f83a52 100644 --- a/src/WINNT/afsd/afsshare.c +++ b/src/WINNT/afsd/afsshare.c @@ -13,18 +13,69 @@ #include #include +int main(int argc, char **argv) { BOOL res; + HKEY hkSubmounts; + HKEY hkParameters; + char mountRoot[64]="/afs"; + char * mountstring; + if (argc < 2 || argc > 3) { - fprintf(stderr, "Incorrect arguments\n"); - exit(1); + fprintf(stderr, "afsshare.exe []\n"); + exit(1); } - res = WritePrivateProfileString("AFS Submounts", - argv[1], - (argc == 3) ? argv[2] : NULL, - "afsdsbmt.ini"); - if (res == FALSE) - fprintf(stderr, "Failed, error code %d\n", GetLastError()); + if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE, + NULL, + &hkSubmounts, + NULL) == ERROR_SUCCESS) + { + if ( argc == 2 ) { + if (RegDeleteValue(hkSubmounts, argv[1])) { + fprintf(stderr,"Submount Deletion failure for [%s]: %lX", + argv[1], GetLastError()); + RegCloseKey(hkSubmounts); + return 1; + } + } else { + if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkParameters, + NULL) == ERROR_SUCCESS) + { + DWORD dwSize = sizeof(mountRoot); + RegQueryValueEx (hkParameters, "MountRoot", NULL, NULL, (PBYTE)mountRoot, &dwSize); + RegCloseKey(hkParameters); + } + + + if ( !strncmp(mountRoot, argv[2], strlen(mountRoot)) ) + mountstring = argv[2] + strlen(mountRoot); + else + mountstring = argv[2]; + + if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_SZ, mountstring, strlen(mountstring)+1)) { + fprintf(stderr,"Submount Set failure for [%s]: %lX", + argv[1], GetLastError()); + RegCloseKey(hkSubmounts); + return 2; + } + } + RegCloseKey(hkSubmounts); + } else { + fprintf(stderr,"Submount access denied: %lX", GetLastError()); + return 3; + } return 0; } diff --git a/src/WINNT/afsd/cm.h b/src/WINNT/afsd/cm.h index 62fa7f88e..b0cef02e8 100644 --- a/src/WINNT/afsd/cm.h +++ b/src/WINNT/afsd/cm.h @@ -219,7 +219,7 @@ int RXAFS_Lookup (struct rx_connection *, #define CM_ERROR_EXISTS (CM_ERROR_BASE+11) #define CM_ERROR_CROSSDEVLINK (CM_ERROR_BASE+12) #define CM_ERROR_BADOP (CM_ERROR_BASE+13) -/* CM_ERROR_BADPASSWORD used to be here */ +#define CM_ERROR_BADPASSWORD (CM_ERROR_BASE+14) #define CM_ERROR_NOTDIR (CM_ERROR_BASE+15) #define CM_ERROR_ISDIR (CM_ERROR_BASE+16) #define CM_ERROR_READONLY (CM_ERROR_BASE+17) @@ -246,4 +246,7 @@ int RXAFS_Lookup (struct rx_connection *, #define CM_ERROR_RENAME_IDENTICAL (CM_ERROR_BASE+39) #define CM_ERROR_ALLOFFLINE (CM_ERROR_BASE+40) #define CM_ERROR_AMBIGUOUS_FILENAME (CM_ERROR_BASE+41) +#define CM_ERROR_BADLOGONTYPE (CM_ERROR_BASE+42) +#define CM_ERROR_GSSCONTINUE (CM_ERROR_BASE+43) +#define CM_ERROR_TIDIPC (CM_ERROR_BASE+44) #endif /* __CM_H_ENV__ */ diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index 389c7f647..e8580339c 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -75,6 +75,7 @@ long buf_nbuffers = CM_BUF_BUFFERS; long buf_nOrigBuffers; long buf_bufferSize = CM_BUF_SIZE; long buf_hashSize = CM_BUF_HASHSIZE; +int buf_cacheType = CM_BUF_CACHETYPE_FILE; #ifndef DJGPP static @@ -295,6 +296,7 @@ long buf_Init(cm_buf_ops_t *opsp) sectorSize = 1; #ifndef DJGPP + if(buf_cacheType == CM_BUF_CACHETYPE_FILE) { /* Reserve buffer space by mapping cache file */ psa = CreateCacheFileSA(); hf = CreateFile(cm_CachePath, @@ -309,6 +311,9 @@ long buf_Init(cm_buf_ops_t *opsp) return CM_ERROR_INVAL; } FreeCacheFileSA(psa); + } else { /* buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL */ + hf = INVALID_HANDLE_VALUE; + } CacheHandle = hf; hm = CreateFileMapping(hf, NULL, @@ -327,7 +332,7 @@ long buf_Init(cm_buf_ops_t *opsp) 0, 0, buf_nbuffers * buf_bufferSize); if (data == NULL) { - CloseHandle(hf); + if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf); CloseHandle(hm); return CM_ERROR_INVAL; } @@ -404,6 +409,15 @@ long buf_AddBuffers(long nbuffers) afsi_log("%d buffers being added to the existing cache of size %d", nbuffers, buf_nbuffers); + if (buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL) { + /* The size of a virtual cache cannot be changed after it has + * been created. Subsequent calls to MapViewofFile() with + * an existing mapping object name would not allow the + * object to be resized. Return failure immediately. + */ + return CM_ERROR_INVAL; + } + /* * Cache file mapping constrained by * system allocation granularity; diff --git a/src/WINNT/afsd/cm_buf.h b/src/WINNT/afsd/cm_buf.h index f37094f6a..8840aae66 100644 --- a/src/WINNT/afsd/cm_buf.h +++ b/src/WINNT/afsd/cm_buf.h @@ -32,6 +32,11 @@ extern long buf_bufferSize; #define CM_BUF_HASHSIZE 1024 extern long buf_hashSize; +/* cache type */ +#define CM_BUF_CACHETYPE_FILE 1 +#define CM_BUF_CACHETYPE_VIRTUAL 2 +extern int buf_cacheType; + /* force it to be signed so that mod comes out positive or 0 */ #define BUF_HASH(fidp,offsetp) ((((fidp)->vnode+((fidp)->unique << 5) \ +(fidp)->volume+(fidp)->cell \ diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index bade3f29e..c84b367b3 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -73,6 +73,10 @@ void cm_RecordRacingRevoke(cm_fid_t *fidp, long cancelFlags) cm_racingRevokes_t *rp; lock_ObtainWrite(&cm_callbackLock); + + osi_Log3(afsd_logp, "RecordRacingRevoke Volume %d Flags %lX activeCalls %d", + fidp->volume, cancelFlags, cm_activeCallbackGrantingCalls); + if (cm_activeCallbackGrantingCalls > 0) { rp = malloc(sizeof(*rp)); memset(rp, 0, sizeof(*rp)); @@ -89,6 +93,9 @@ void cm_RecordRacingRevoke(cm_fid_t *fidp, long cancelFlags) */ void cm_CallbackNotifyChange(cm_scache_t *scp) { + osi_Log2(afsd_logp, "CallbackNotifyChange FileType %d Flags %lX", + scp->fileType, scp->flags); + if (scp->fileType == CM_SCACHETYPE_DIRECTORY) { if (scp->flags & CM_SCACHEFLAG_ANYWATCH) smb_NotifyChange(0, @@ -134,7 +141,7 @@ void cm_RevokeCallback(struct rx_call *callp, AFSFid *fidp) tfid.unique = fidp->Unique; hash = CM_SCACHE_HASH(&tfid); - osi_Log3(afsd_logp, "Revoke callback vol %d vn %d un %d", + osi_Log3(afsd_logp, "RevokeCallback vol %d vn %d un %d", fidp->Volume, fidp->Vnode, fidp->Unique); /* do this first, so that if we're executing a callback granting call @@ -154,7 +161,7 @@ void cm_RevokeCallback(struct rx_call *callp, AFSFid *fidp) scp->fid.unique == tfid.unique) { scp->refCount++; lock_ReleaseWrite(&cm_scacheLock); - osi_Log1(afsd_logp, "Revoke scp %x", scp); + osi_Log1(afsd_logp, "Discarding SCache scp %x", scp); lock_ObtainMutex(&scp->mx); cm_DiscardSCache(scp); lock_ReleaseMutex(&scp->mx); @@ -177,6 +184,8 @@ void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp) cm_scache_t *scp; cm_fid_t tfid; + osi_Log1(afsd_logp, "RevokeVolumeCallback %d", fidp->Volume); + /* do this first, so that if we're executing a callback granting call * at this moment, we kill it before it can be merged in. Otherwise, * it could complete while we're doing the scan below, and get missed @@ -186,7 +195,6 @@ void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp) tfid.volume = fidp->Volume; cm_RecordRacingRevoke(&tfid, CM_RACINGFLAG_CANCELVOL); - osi_Log1(afsd_logp, "Revoke Volume %d", fidp->Volume); lock_ObtainWrite(&cm_scacheLock); for(hash = 0; hash < cm_hashTableSize; hash++) { @@ -195,6 +203,7 @@ void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp) scp->refCount++; lock_ReleaseWrite(&cm_scacheLock); lock_ObtainMutex(&scp->mx); + osi_Log1(afsd_logp, "Discarding SCache scp %x", scp); cm_DiscardSCache(scp); lock_ReleaseMutex(&scp->mx); cm_CallbackNotifyChange(scp); @@ -215,13 +224,17 @@ SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArray int i; AFSFid *tfidp; + osi_Log0(afsd_logp, "SRXAFSCB_CallBack"); + for(i=0; i < (long) fidsArrayp->AFSCBFids_len; i++) { tfidp = &fidsArrayp->AFSCBFids_val[i]; - if (tfidp->Volume == 0) continue; /* means don't do anything */ + if (tfidp->Volume == 0) + continue; /* means don't do anything */ else if (tfidp->Vnode == 0) cm_RevokeVolumeCallback(callp, tfidp); - else cm_RevokeCallback(callp, tfidp); + else + cm_RevokeCallback(callp, tfidp); } return 0; @@ -239,6 +252,8 @@ SRXAFSCB_InitCallBackState(struct rx_call *callp) int hash; int discarded; + osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState"); + if ((rx_ConnectionOf(callp)) && (rx_PeerOf(rx_ConnectionOf(callp)))) { taddr.sin_family = AF_INET; taddr.sin_addr.s_addr = rx_HostOf(rx_PeerOf(rx_ConnectionOf(callp))); @@ -281,6 +296,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *callp) if (scp->cbServerp != NULL) { /* we have a callback, now decide if we should clear it */ if (scp->cbServerp == tsp || tsp == NULL) { + osi_Log1(afsd_logp, "Discarding SCache scp %x", scp); cm_DiscardSCache(scp); discarded = 1; } @@ -305,6 +321,7 @@ SRXAFSCB_InitCallBackState(struct rx_call *callp) /* just returns if we're up */ SRXAFSCB_Probe(struct rx_call *callp) { + osi_Log0(afsd_logp, "SRXAFSCB_Probe - not implemented"); return 0; } @@ -312,6 +329,7 @@ SRXAFSCB_Probe(struct rx_call *callp) SRXAFSCB_GetCE64(struct rx_call *callp, long index, AFSDBCacheEntry *cep) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_GetCE64 - not implemented"); return RXGEN_OPCODE; } @@ -319,6 +337,7 @@ SRXAFSCB_GetCE64(struct rx_call *callp, long index, AFSDBCacheEntry *cep) SRXAFSCB_GetLock(struct rx_call *callp, long index, AFSDBLock *lockp) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_GetLock - not implemented"); return RXGEN_OPCODE; } @@ -326,6 +345,7 @@ SRXAFSCB_GetLock(struct rx_call *callp, long index, AFSDBLock *lockp) SRXAFSCB_GetCE(struct rx_call *callp, long index, AFSDBCacheEntry *cep) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_GetCE - not implemented"); return RXGEN_OPCODE; } @@ -333,6 +353,7 @@ SRXAFSCB_GetCE(struct rx_call *callp, long index, AFSDBCacheEntry *cep) SRXAFSCB_XStatsVersion(struct rx_call *callp, long *vp) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_XStatsVersion - not implemented"); *vp = -1; return RXGEN_OPCODE; } @@ -342,6 +363,7 @@ SRXAFSCB_GetXStats(struct rx_call *callp, long cvn, long coln, long *srvp, long AFSCB_CollData *datap) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_GetXStats - not implemented"); return RXGEN_OPCODE; } @@ -349,6 +371,7 @@ SRXAFSCB_GetXStats(struct rx_call *callp, long cvn, long coln, long *srvp, long SRXAFSCB_InitCallBackState2(struct rx_call *callp, struct interfaceAddr* addr) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState2 - not implemented"); return RXGEN_OPCODE; } @@ -356,6 +379,7 @@ SRXAFSCB_InitCallBackState2(struct rx_call *callp, struct interfaceAddr* addr) SRXAFSCB_WhoAreYou(struct rx_call *callp, struct interfaceAddr* addr) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_WhoAreYou - not implemented"); return RXGEN_OPCODE; } @@ -363,6 +387,7 @@ SRXAFSCB_WhoAreYou(struct rx_call *callp, struct interfaceAddr* addr) SRXAFSCB_InitCallBackState3(struct rx_call *callp, afsUUID* serverUuid) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState3 - not implemented"); return RXGEN_OPCODE; } @@ -370,6 +395,7 @@ SRXAFSCB_InitCallBackState3(struct rx_call *callp, afsUUID* serverUuid) SRXAFSCB_ProbeUuid(struct rx_call *callp, afsUUID* clientUuid) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_ProbeUuid - not implemented"); return RXGEN_OPCODE; } @@ -401,6 +427,8 @@ int SRXAFSCB_GetServerPrefs( afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank) { + osi_Log0(afsd_logp, "SRXAFSCB_GetServerPrefs - not implemented"); + *a_srvr_addr = 0xffffffff; *a_srvr_rank = 0xffffffff; return 0; @@ -436,6 +464,8 @@ int SRXAFSCB_GetCellServDB( { char *t_name; + osi_Log0(afsd_logp, "SRXAFSCB_GetCellServDB - not implemented"); + t_name = (char *)malloc(AFSNAMEMAX); t_name[0] = '\0'; *a_name = t_name; @@ -469,6 +499,8 @@ int SRXAFSCB_GetLocalCell( { char *t_name; + osi_Log0(afsd_logp, "SRXAFSCB_GetLocalCell"); + if (cm_rootCellp) { t_name = (char *)malloc(strlen(cm_rootCellp->namep)+1); strcpy(t_name, cm_rootCellp->namep); @@ -554,6 +586,8 @@ cacheConfig *config; size_t allocsize; extern cm_initparams_v1 cm_initParams; + osi_Log0(afsd_logp, "SRXAFSCB_GetCacheConfig - version 1 only"); + /* * Currently only support version 1 */ @@ -600,7 +634,9 @@ int cm_HaveCallback(cm_scache_t *scp) // good shape and we simply return true, provided no change is detected. int fdc, fgc; - if (cm_freelanceEnabled && scp->fid.cell==0x1 && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) { // if it's something on /afs + if (cm_freelanceEnabled && + scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && + scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) { // if it's something on /afs if (!(scp->fid.vnode==0x1 && scp->fid.unique==0x1)) // if it's not root.afs return 1; else { @@ -614,7 +650,9 @@ int cm_HaveCallback(cm_scache_t *scp) } else if (fdc==2 && !fgc) { // we're in good shape if (cm_getLocalMountPointChange()) { // check for changes cm_clearLocalMountPointChange(); // clear the changefile + lock_ReleaseMutex(&scp->mx); // this is re-locked in reInitLocalMountPoints cm_reInitLocalMountPoints(); // start reinit + lock_ObtainMutex(&scp->mx); // now get the lock back return 0; } return 1; // no change @@ -701,8 +739,7 @@ void cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp, */ if (scp && cbrp->callbackCount != cm_callbackCount && revp->callbackCount > cbrp->callbackCount - && ( - (scp->fid.volume == revp->fid.volume && + && (( scp->fid.volume == revp->fid.volume && scp->fid.vnode == revp->fid.vnode && scp->fid.unique == revp->fid.unique) || @@ -751,41 +788,41 @@ long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp, long sflags; cm_fid_t sfid; + osi_Log2(afsd_logp, "GetCallback scp %x flags %lX", scp, flags); + #ifdef AFS_FREELANCE_CLIENT - // yj // The case where a callback is needed on /afs is handled // specially. We need to fetch the status by calling // cm_MergeStatus and mark that cm_fakeDirCallback is 2 - if (cm_freelanceEnabled && - scp->fid.cell==0x1 && - scp->fid.volume==AFS_FAKE_ROOT_VOL_ID && - scp->fid.unique==0x1 && - scp->fid.vnode==0x1) { - // Start by indicating that we're in the process - // of fetching the callback - - lock_ObtainMutex(&cm_Freelance_Lock); - cm_fakeGettingCallback = 1; - lock_ReleaseMutex(&cm_Freelance_Lock); - - // Fetch the status info - cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0); - - // Indicate that the callback is not done - lock_ObtainMutex(&cm_Freelance_Lock); - cm_fakeDirCallback = 2; - // Indicate that we're no longer fetching the callback - cm_fakeGettingCallback = 0; - lock_ReleaseMutex(&cm_Freelance_Lock); + if (cm_freelanceEnabled) { + if (scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && + scp->fid.volume==AFS_FAKE_ROOT_VOL_ID && + scp->fid.unique==0x1 && + scp->fid.vnode==0x1) { + // Start by indicating that we're in the process + // of fetching the callback + + lock_ObtainMutex(&cm_Freelance_Lock); + cm_fakeGettingCallback = 1; + lock_ReleaseMutex(&cm_Freelance_Lock); + + // Fetch the status info + cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0); - return 0; - } + // Indicate that the callback is not done + lock_ObtainMutex(&cm_Freelance_Lock); + cm_fakeDirCallback = 2; + // Indicate that we're no longer fetching the callback + cm_fakeGettingCallback = 0; + lock_ReleaseMutex(&cm_Freelance_Lock); - if (scp->fid.cell==0x1 && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) { - osi_Log0(afsd_logp,"cm_getcallback should NEVER EVER get here... "); - } - // yj: end of getcallback modifications --------------- - + return 0; + } + + if (scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) { + osi_Log0(afsd_logp,"cm_getcallback should NEVER EVER get here... "); + } + } #endif /* AFS_FREELANCE_CLIENT */ mustCall = (flags & 1); @@ -812,7 +849,7 @@ long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp, code = RXAFS_FetchStatus(connp->callp, &tfid, &afsStatus, &callback, &volSync); - } while (cm_Analyze(connp, userp, reqp, &sfid, &volSync, + } while (cm_Analyze(connp, userp, reqp, &sfid, &volSync, NULL, &cbr, code)); code = cm_MapRPCError(code, reqp); osi_Log0(afsd_logp, "CALL FetchStatus DONE"); @@ -838,6 +875,8 @@ void cm_CheckCBExpiration(void) cm_scache_t *scp; long now; + osi_Log0(afsd_logp, "CheckCBExpiration"); + now = osi_Time(); lock_ObtainWrite(&cm_scacheLock); for(i=0; imx); if (scp->cbServerp && now > scp->cbExpires) { + osi_Log1(afsd_logp, "Discarding SCache scp %x", scp); cm_DiscardSCache(scp); } lock_ReleaseMutex(&scp->mx); @@ -861,6 +901,7 @@ int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum, char **a_name, serverList *a_hosts) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_GetCellByNum - not implemented"); return RXGEN_OPCODE; } @@ -869,5 +910,6 @@ int SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, afs_int32 a_cellnum, char **a_name, serverList *a_hosts) { /* XXXX */ + osi_Log0(afsd_logp, "SRXAFSCB_TellMeAboutYourself - not implemented"); return RXGEN_OPCODE; } diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index 8107329da..d51e4e1da 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -45,12 +45,15 @@ long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep) tsp->cellp = cellp; } else - tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp); + tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp); /* Insert the vlserver into a sorted list, sorted by server rank */ tsrp = cm_NewServerRef(tsp); cm_InsertServerList(&cellp->vlServersp, tsrp); - + /* drop the allocation reference */ + lock_ObtainWrite(&cm_serverLock); + tsrp->refCount--; + lock_ReleaseWrite(&cm_serverLock); return 0; } @@ -68,6 +71,9 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) int ttl; char fullname[200]=""; + if (!strcmp(namep,SMB_IOCTL_FILENAME_NOSLASH)) + return NULL; + lock_ObtainWrite(&cm_cellLock); for (cp = cm_allCellsp; cp; cp=cp->nextp) { if (strcmp(namep, cp->namep) == 0) { @@ -85,14 +91,16 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) ) { int dns_expired = 0; if (!cp) { - cp = malloc(sizeof(*cp)); - memset(cp, 0, sizeof(*cp)); + cp = malloc(sizeof(cm_cell_t)); + memset(cp, 0, sizeof(cm_cell_t)); } else { dns_expired = 1; /* must empty cp->vlServersp */ + lock_ObtainWrite(&cp->mx); cm_FreeServerList(&cp->vlServersp); cp->vlServersp = NULL; + lock_ReleaseWrite(&cp->mx); } code = cm_SearchCellFile(namep, fullname, cm_AddCellProc, cp); @@ -109,6 +117,7 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) if (dns_expired) { cp->flags |= CM_CELLFLAG_VLSERVER_INVALID; cp = NULL; /* set cp to NULL to indicate error */ + goto done; } } else { /* got cell from DNS */ @@ -126,7 +135,7 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) } /* randomise among those vlservers having the same rank*/ - cm_RandomizeServer(&cp->vlServersp); + cm_RandomizeServer(&cp->vlServersp); #ifdef AFS_AFSDB_ENV if (dns_expired) { diff --git a/src/WINNT/afsd/cm_cell.h b/src/WINNT/afsd/cm_cell.h index e462a7ff9..f681966bb 100644 --- a/src/WINNT/afsd/cm_cell.h +++ b/src/WINNT/afsd/cm_cell.h @@ -17,7 +17,7 @@ typedef struct cm_cell { long cellID; /* cell ID */ struct cm_cell *nextp; /* locked by cm_cellLock */ char *namep; /* cell name; never changes */ - struct cm_serverRef *vlServersp; /* locked by cm_serverLock */ + cm_serverRef_t *vlServersp; /* locked by cm_serverLock */ osi_mutex_t mx; /* mutex locking fields (flags) */ long flags; /* locked by mx */ long timeout; /* if dns, time at which the server addrs expire */ diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index ce6f9257f..949850399 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -23,6 +23,7 @@ #include #include "cm_config.h" +#include #ifdef AFS_AFSDB_ENV #include "cm_dns.h" #include @@ -30,9 +31,12 @@ char AFSConfigKeyName[] = "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"; +char AFSLocalMachineKeyName[] = "SOFTWARE\\OpenAFS\\Client"; /* TODO: these should be pulled in from dirpath.h */ +#if !defined(DJGPP) && !defined(AFS_WIN95_ENV) #define AFS_THISCELL "ThisCell" +#endif #define AFS_CELLSERVDB_UNIX "CellServDB" #define AFS_CELLSERVDB_NT "afsdcell.ini" #ifndef AFSDIR_CLIENT_ETC_DIRPATH @@ -45,19 +49,20 @@ extern char cm_confDir[]; extern int errno; #endif /* DJGPP */ #else -#define AFS_CELLSERVDB AFS_CELLSERVDB_NT +#define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX #endif /* DJGPP || WIN95 */ -#ifdef DEBUG -DWORD TraceOption=1; +static DWORD TraceOption = 0; + +/* This really needs to be initialized at DLL Init */ +#define TRACE_OPTION_EVENT 4 -#define TRACE_OPTION_EVENT 1 -#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) +#define ISCONFIGTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) void DebugEvent0_local(char *a) { HANDLE h; char *ptbuf[1]; - if (!ISLOGONTRACE(TraceOption)) + if (!ISCONFIGTRACE(TraceOption)) return; h = RegisterEventSource(NULL, a); ptbuf[0] = a; @@ -71,7 +76,7 @@ void DebugEvent_local(char *a,char *b,...) { HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; va_list marker; - if (!ISLOGONTRACE(TraceOption)) + if (!ISCONFIGTRACE(TraceOption)) return; h = RegisterEventSource(NULL, a); va_start(marker,b); @@ -81,7 +86,45 @@ void DebugEvent_local(char *a,char *b,...) DeregisterEventSource(h); va_end(marker); } -#endif /* DEBUG */ + +#define REG_CLIENT_PARMS_KEY TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters") +#define REG_CLIENT_TRACE_OPTION_PARM TEXT("TraceOption") + +#ifdef COMMENT +BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: { + DWORD LSPtype, LSPsize; + HKEY NPKey; + + (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY, + 0, KEY_QUERY_VALUE, &NPKey); + LSPsize=sizeof(TraceOption); + RegQueryValueEx(NPKey, REG_CLIENT_TRACE_OPTION_PARM, NULL, + &LSPtype, (LPBYTE)&TraceOption, &LSPsize); + + RegCloseKey (NPKey); + break; + } + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + break; + + case DLL_PROCESS_DETACH: + break; + + default: + return FALSE; + } + + return TRUE; // successful DLL_PROCESS_ATTACH +} +#endif /* COMMENT */ static long cm_ParsePair(char *lineBufferp, char *leftp, char *rightp) { @@ -149,38 +192,21 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, cm_configProc_t *procp, void *rockp) { char wdir[257]; - int tlen; - FILE *tfilep, *bestp, *tempp; + FILE *tfilep = NULL, *bestp, *tempp; char *tp; char lineBuffer[257]; struct hostent *thp; char *valuep; struct sockaddr_in vlSockAddr; int inRightCell; - int foundCell; + int foundCell = 0; long code; int tracking = 1, partial = 0; #if defined(DJGPP) || defined(AFS_WIN95_ENV) char *afsconf_path; #endif - foundCell = 0; - -#if !defined(DJGPP) - code = GetWindowsDirectory(wdir, sizeof(wdir)); - if (code == 0 || code > sizeof(wdir)) - return -1; - - /* add trailing backslash, if required */ - tlen = strlen(wdir); - if (wdir[tlen-1] != '\\') strcat(wdir, "\\"); -#else - strcpy(wdir, cm_confDir); - strcat(wdir,"/"); -#endif /* !DJGPP */ - - strcat(wdir, AFS_CELLSERVDB); - + cm_GetCellServDB(wdir); tfilep = fopen(wdir, "r"); #if defined(DJGPP) || defined(AFS_WIN95_ENV) @@ -195,7 +221,7 @@ long cm_SearchCellFile(char *cellNamep, char *newCellNamep, else strcpy(wdir, afsconf_path); strcat(wdir, "/"); - strcat(wdir, AFS_CELLSERVDB_UNIX); + strcat(wdir, AFS_CELLSERVDB); /*fprintf(stderr, "opening cellservdb file %s\n", wdir);*/ tfilep = fopen(wdir, "r"); if (!tfilep) return -2; @@ -397,6 +423,44 @@ long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl, } #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) +/* look up the CellServDBDir's name in the Registry + * or use the Client Dirpath value to produce a CellServDB + * filename + */ +long cm_GetCellServDB(char *cellNamep) +{ +#if !defined(DJGPP) + DWORD code, dummyLen; + HKEY parmKey; + int tlen; + + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLocalMachineKeyName, + 0, KEY_QUERY_VALUE, &parmKey); + if (code != ERROR_SUCCESS) + goto dirpath; + + dummyLen = 256; + code = RegQueryValueEx(parmKey, "CellServDBDir", NULL, NULL, + cellNamep, &dummyLen); + RegCloseKey (parmKey); + + dirpath: + if (code != ERROR_SUCCESS || cellNamep[0] == 0) + strcpy(cellNamep, AFSDIR_CLIENT_ETC_DIRPATH); + + /* add trailing backslash, if required */ + tlen = strlen(cellNamep); + if (cellNamep[tlen-1] != '\\') + strcat(cellNamep, "\\"); +#else + strcpy(cellNamep, cm_confDir); + strcat(cellNamep,"/"); +#endif /* !DJGPP */ + + strcat(cellNamep, AFS_CELLSERVDB); + return 0; +} + /* look up the root cell's name in the Registry */ long cm_GetRootCellName(char *cellNamep) { @@ -458,14 +522,11 @@ long cm_GetRootCellName(char *cellNamep) cm_configFile_t *cm_CommonOpen(char *namep, char *rwp) { char wdir[256]; - long code; long tlen; FILE *tfilep; #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) - code = GetWindowsDirectory(wdir, sizeof(wdir)); - if (code == 0 || code > sizeof(wdir)) - return 0; + strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); /* add trailing backslash, if required */ tlen = strlen(wdir); @@ -635,75 +696,71 @@ long cm_CloseCellFile(cm_configFile_t *filep) closeCode = fclose((FILE *)filep); #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) - code = GetWindowsDirectory(wdir, sizeof(wdir)); - if (code == 0 || code > sizeof(wdir)) - return closeCode; + strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); /* add trailing backslash, if required */ - tlen = strlen(wdir); - if (wdir[tlen-1] != '\\') strcat(wdir, "\\"); + tlen = strlen(wdir); + if (wdir[tlen-1] != '\\') strcat(wdir, "\\"); #else #ifdef DJGPP - strcpy(wdir,cm_confDir); + strcpy(wdir,cm_confDir); #else - afsconf_path = getenv("AFSCONF"); - if (!afsconf_path) - strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); - else - strcpy(wdir, afsconf_path); + afsconf_path = getenv("AFSCONF"); + if (!afsconf_path) + strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); + else + strcpy(wdir, afsconf_path); #endif /* !DJGPP */ - strcat(wdir,"/"); + strcat(wdir,"/"); #endif /* DJGPP || WIN95 */ - strcpy(sdir, wdir); + strcpy(sdir, wdir); if (closeCode != 0) { /* something went wrong, preserve original database */ - strcat(wdir, "afsdcel2.ini"); - unlink(wdir); - return closeCode; - } + strcat(wdir, "afsdcel2.ini"); + unlink(wdir); + return closeCode; + } - strcat(wdir, AFS_CELLSERVDB); - strcat(sdir, "afsdcel2.ini"); /* new file */ - - unlink(wdir); /* delete old file */ - - code = rename(sdir, wdir); /* do the rename */ - - if (code) - code = errno; - - return code; -} + strcat(wdir, AFS_CELLSERVDB); + strcat(sdir, "afsdcel2.ini"); /* new file */ + + unlink(wdir); /* delete old file */ + + code = rename(sdir, wdir); /* do the rename */ + + if (code) + code = errno; + + return code; +} void cm_GetConfigDir(char *dir) { char wdir[256]; - int code; int tlen; #ifdef AFS_WIN95_ENV char *afsconf_path; #endif #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) - code = GetWindowsDirectory(wdir, sizeof(wdir)); - if (code == 0 || code > sizeof(wdir)) wdir[0] = 0; + strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); /* add trailing backslash, if required */ - tlen = strlen(wdir); - if (wdir[tlen-1] != '\\') strcat(wdir, "\\"); + tlen = strlen(wdir); + if (wdir[tlen-1] != '\\') strcat(wdir, "\\"); #else #ifdef DJGPP - strcpy(wdir,cm_confDir); + strcpy(wdir,cm_confDir); #else - afsconf_path = getenv("AFSCONF"); - if (!afsconf_path) - strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); - else - strcpy(wdir, afsconf_path); + afsconf_path = getenv("AFSCONF"); + if (!afsconf_path) + strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); + else + strcpy(wdir, afsconf_path); #endif /* !DJGPP */ - strcat(wdir,"\\"); + strcat(wdir,"\\"); #endif /* DJGPP || WIN95 */ - strcpy(dir, wdir); + strcpy(dir, wdir); } diff --git a/src/WINNT/afsd/cm_config.h b/src/WINNT/afsd/cm_config.h index 11996e55c..ae8a2cde1 100644 --- a/src/WINNT/afsd/cm_config.h +++ b/src/WINNT/afsd/cm_config.h @@ -13,9 +13,9 @@ #define CM_CONFIGDEFAULT_CACHESIZE 20480 #define CM_CONFIGDEFAULT_BLOCKSIZE 4096 #define CM_CONFIGDEFAULT_STATS 1000 -#define CM_CONFIGDEFAULT_CHUNKSIZE 15 +#define CM_CONFIGDEFAULT_CHUNKSIZE 17 #define CM_CONFIGDEFAULT_DAEMONS 2 -#define CM_CONFIGDEFAULT_SVTHREADS 4 +#define CM_CONFIGDEFAULT_SVTHREADS 25 #define CM_CONFIGDEFAULT_TRACEBUFSIZE 5000 #ifndef __CM_CONFIG_INTERFACES_ONLY__ @@ -53,6 +53,8 @@ extern long cm_AppendNewCellLine(cm_configFile_t *filep, char *linep); extern long cm_CloseCellFile(cm_configFile_t *filep); +extern long cm_GetCellServDB(char *cellNamep); + #endif /* __CM_CONFIG_INTERFACES_ONLY__ */ #endif /* __CONFIG_H_ENV_ */ diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index b3e22c0e3..90542fdbd 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -97,36 +97,27 @@ void cm_InitReq(cm_req_t *reqp) } -long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, - struct cm_req *reqp, cm_serverRef_t **serverspp) +static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, + struct cm_req *reqp, cm_serverRef_t ***serversppp) { long code; - cm_volume_t *volp = NULL; - cm_serverRef_t *serversp = NULL; - cm_cell_t *cellp = NULL; + cm_volume_t *volp = NULL; + cm_cell_t *cellp = NULL; - if (!fidp) { - *serverspp = NULL; + if (!fidp) { + *serversppp = NULL; return 0; } cellp = cm_FindCellByID(fidp->cell); - if (!cellp) return CM_ERROR_NOSUCHCELL; + if (!cellp) return CM_ERROR_NOSUCHCELL; - code = cm_GetVolumeByID(cellp, fidp->volume, userp, reqp, &volp); - if (code) return code; - - if (fidp->volume == volp->rwID) - serversp = volp->rwServersp; - else if (fidp->volume == volp->roID) - serversp = volp->roServersp; - else if (fidp->volume == volp->bkID) - serversp = volp->bkServersp; - else - serversp = NULL; - - cm_PutVolume(volp); - *serverspp = serversp; + code = cm_GetVolumeByID(cellp, fidp->volume, userp, reqp, &volp); + if (code) return code; + + *serversppp = cm_GetVolServers(volp, fidp->volume); + + cm_PutVolume(volp); return 0; } @@ -148,14 +139,19 @@ long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, */ int cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, - struct cm_fid *fidp, - AFSVolSync *volSyncp, cm_callbackRequest_t *cbrp, long errorCode) + struct cm_fid *fidp, + AFSVolSync *volSyncp, + cm_serverRef_t * serversp, + cm_callbackRequest_t *cbrp, long errorCode) { cm_server_t *serverp; - cm_serverRef_t *serversp, *tsrp; + cm_serverRef_t **serverspp = 0; + cm_serverRef_t *tsrp; cm_ucell_t *ucellp; - int retry = 0; + int retry = 0; + int free_svr_list = 0; int dead_session; + long timeUsed, timeLeft; osi_Log2(afsd_logp, "cm_Analyze connp 0x%x, code %d", (long) connp, errorCode); @@ -167,17 +163,16 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, serverp = connp->serverp; /* Update callback pointer */ - if (cbrp && errorCode == 0) cbrp->serverp = connp->serverp; + if (cbrp && errorCode == 0) + cbrp->serverp = connp->serverp; /* If not allowed to retry, don't */ if (reqp->flags & CM_REQ_NORETRY) goto out; /* if timeout - check that it did not exceed the SMB timeout - and retry */ - if (errorCode == CM_ERROR_TIMEDOUT) - { - long timeUsed, timeLeft; + * and retry */ + /* timeleft - get if from reqp the same way as cmXonnByMServers does */ #ifndef DJGPP timeUsed = (GetCurrentTime() - reqp->startTime) / 1000; @@ -188,37 +183,75 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, /* leave 5 seconds margin for sleep */ timeLeft = RDRtimeout - timeUsed; - if (timeLeft > 5) - { + + if (errorCode == CM_ERROR_TIMEDOUT && timeLeft > 5 ) { thrd_Sleep(3000); cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); retry = 1; } - } /* if all servers are offline, mark them non-busy and start over */ - if (errorCode == CM_ERROR_ALLOFFLINE) { + if (errorCode == CM_ERROR_ALLOFFLINE && timeLeft > 7) { osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE."); thrd_Sleep(5000); /* cm_ForceUpdateVolume marks all servers as non_busy */ - cm_ForceUpdateVolume(fidp, userp, reqp); - retry = 1; + /* No it doesn't and it won't do anything if all of the + * the servers are marked as DOWN. So clear the DOWN + * flag and reset the busy state as well. + */ + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } + if (serversp) { + lock_ObtainWrite(&cm_serverLock); + for (tsrp = serversp; tsrp; tsrp=tsrp->next) { + tsrp->server->flags &= ~CM_SERVERFLAG_DOWN; + if (tsrp->status == busy) + tsrp->status = not_busy; + } + lock_ReleaseWrite(&cm_serverLock); + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } + retry = 1; + } + + if (fidp != NULL) /* Not a VLDB call */ + cm_ForceUpdateVolume(fidp, userp, reqp); } /* if all servers are busy, mark them non-busy and start over */ - if (errorCode == CM_ERROR_ALLBUSY) { - cm_GetServerList(fidp, userp, reqp, &serversp); + if (errorCode == CM_ERROR_ALLBUSY && timeLeft > 7) { + thrd_Sleep(5000); + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } + lock_ObtainWrite(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->status == busy) tsrp->status = not_busy; } - thrd_Sleep(5000); + lock_ReleaseWrite(&cm_serverLock); + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } retry = 1; } /* special codes: VBUSY and VRESTARTING */ if (errorCode == VBUSY || errorCode == VRESTARTING) { - cm_GetServerList(fidp, userp, reqp, &serversp); + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } + lock_ObtainWrite(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->server == serverp && tsrp->status == not_busy) { @@ -226,6 +259,11 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, break; } } + lock_ReleaseWrite(&cm_serverLock); + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } retry = 1; } @@ -257,12 +295,20 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, } /* Mark server offline for this volume */ - cm_GetServerList(fidp, userp, reqp, &serversp); - + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->server == serverp) tsrp->status = offline; } + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } + if ( timeLeft > 2 ) retry = 1; } @@ -291,10 +337,11 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, else if (errorCode >= -64 && errorCode < 0) { /* mark server as down */ lock_ObtainMutex(&serverp->mx); - serverp->flags |= CM_SERVERFLAG_DOWN; + serverp->flags |= CM_SERVERFLAG_DOWN; lock_ReleaseMutex(&serverp->mx); - retry = 1; - } + if ( timeLeft > 2 ) + retry = 1; + } if (errorCode == RXKADEXPIRED && !dead_session) { lock_ObtainMutex(&userp->mx); @@ -306,6 +353,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, ucellp->flags &= ~CM_UCELLFLAG_RXKAD; ucellp->gen++; lock_ReleaseMutex(&userp->mx); + if ( timeLeft > 2 ) retry = 1; } @@ -326,21 +374,21 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, { long code; cm_serverRef_t *tsrp; - cm_server_t *tsp; - long firstError = 0; - int someBusy = 0, someOffline = 0, allDown = 1; + cm_server_t *tsp; + long firstError = 0; + int someBusy = 0, someOffline = 0, allBusy = 1, allDown = 1; long timeUsed, timeLeft, hardTimeLeft; #ifdef DJGPP - struct timeval now; + struct timeval now; #endif /* DJGPP */ - *connpp = NULL; + *connpp = NULL; #ifndef DJGPP timeUsed = (GetCurrentTime() - reqp->startTime) / 1000; #else - gettimeofday(&now, NULL); - timeUsed = sub_time(now, reqp->startTime) / 1000; + gettimeofday(&now, NULL); + timeUsed = sub_time(now, reqp->startTime) / 1000; #endif /* leave 5 seconds margin of safety */ @@ -348,8 +396,7 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, hardTimeLeft = HardDeadtimeout - timeUsed - 5; lock_ObtainWrite(&cm_serverLock); - - for(tsrp = serversp; tsrp; tsrp=tsrp->next) { + for (tsrp = serversp; tsrp; tsrp=tsrp->next) { tsp = tsrp->server; tsp->refCount++; lock_ReleaseWrite(&cm_serverLock); @@ -360,6 +407,7 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, else if (tsrp->status == offline) someOffline = 1; else { + allBusy = 0; code = cm_ConnByServer(tsp, usersp, connpp); if (code == 0) { cm_PutServer(tsp); @@ -371,10 +419,8 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, hardTimeLeft = HardDeadtimeout; lock_ObtainMutex(&(*connpp)->mx); - rx_SetConnDeadTime((*connpp)->callp, - timeLeft); - rx_SetConnHardDeadTime((*connpp)->callp, - (u_short) hardTimeLeft); + rx_SetConnDeadTime((*connpp)->callp, timeLeft); + rx_SetConnHardDeadTime((*connpp)->callp, (u_short) hardTimeLeft); lock_ReleaseMutex(&(*connpp)->mx); return 0; @@ -389,17 +435,16 @@ long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, lock_ReleaseWrite(&cm_serverLock); if (firstError == 0) { - if (someBusy) - firstError = CM_ERROR_ALLBUSY; - else if (someOffline) + if (serversp == NULL) + firstError = CM_ERROR_NOSUCHVOLUME; + else if (allDown) firstError = CM_ERROR_ALLOFFLINE; - else if (!allDown && serversp) + else if (allBusy) + firstError = CM_ERROR_ALLBUSY; + else firstError = CM_ERROR_TIMEDOUT; - /* Only return CM_ERROR_NOSUCHVOLUME if there are no - servers for this volume */ - else - firstError = CM_ERROR_NOSUCHVOLUME; } + osi_Log1(afsd_logp, "cm_ConnByMServers returning %x", firstError); return firstError; } @@ -527,14 +572,15 @@ long cm_Conn(struct cm_fid *fidp, struct cm_user *userp, cm_req_t *reqp, { long code; - cm_serverRef_t *serversp; + cm_serverRef_t **serverspp; - code = cm_GetServerList(fidp, userp, reqp, &serversp); + code = cm_GetServerList(fidp, userp, reqp, &serverspp); if (code) { *connpp = NULL; return code; } - code = cm_ConnByMServers(serversp, userp, reqp, connpp); - return code; + code = cm_ConnByMServers(*serverspp, userp, reqp, connpp); + cm_FreeServerList(serverspp); + return code; } diff --git a/src/WINNT/afsd/cm_conn.h b/src/WINNT/afsd/cm_conn.h index 719d438d3..6f2f2e385 100644 --- a/src/WINNT/afsd/cm_conn.h +++ b/src/WINNT/afsd/cm_conn.h @@ -91,6 +91,7 @@ extern void cm_InitReq(cm_req_t *reqp); extern int cm_Analyze(cm_conn_t *connp, struct cm_user *up, struct cm_req *reqp, struct cm_fid *fidp, struct AFSVolSync *volInfop, + cm_serverRef_t * serversp, struct cm_callbackRequest *cbrp, long code); extern long cm_ConnByMServers(struct cm_serverRef *, struct cm_user *, diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index 1ea2be857..512876930 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -153,19 +153,27 @@ long cm_BufWrite(void *vfidp, osi_hyper_t *offsetp, long length, long flags, /* write out wbytes of data from bufferp */ temp = rx_Write(callp, bufferp, wbytes); if (temp != wbytes) { + osi_Log2(afsd_logp, "rx_Write failed %d != %d",temp,wbytes); code = -1; break; - } + } else { + osi_Log1(afsd_logp, "rx_Write succeeded %d",temp); + } nbytes -= wbytes; } /* while more bytes to write */ } /* if RPC started successfully */ - - if (code == 0) + else { + osi_Log1(afsd_logp, "StartRXAFS_StoreData failed (%lX)",code); + } + if (code == 0) { code = EndRXAFS_StoreData(callp, &outStatus, &volSync); + if (code) + osi_Log1(afsd_logp, "EndRXAFS_StoreData failed (%lX)",code); + } code = rx_EndCall(callp, code); osi_Log0(afsd_logp, "CALL StoreData DONE"); - } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, NULL, code)); + } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); /* now, clean up our state */ @@ -258,7 +266,7 @@ long cm_StoreMini(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp) if (code == 0) code = EndRXAFS_StoreData(callp, &outStatus, &volSync); code = rx_EndCall(callp, code); - } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, NULL, code)); + } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); /* now, clean up our state */ @@ -1178,8 +1186,8 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up, afsStatus.ParentVnode = 0x1; afsStatus.ParentUnique = 0x1; afsStatus.ResidencyMask = 0; - afsStatus.ClientModTime = 0x3b49f6e2; - afsStatus.ServerModTime = 0x3b49f6e2; + afsStatus.ClientModTime = FakeFreelanceModTime; + afsStatus.ServerModTime = FakeFreelanceModTime; afsStatus.Group = 0; afsStatus.SyncCounter = 0; afsStatus.dataVersionHigh = 0; @@ -1337,7 +1345,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up, osi_Log0(afsd_logp, "CALL EndCall returns RXKADUNKNOWNKEY"); osi_Log0(afsd_logp, "CALL FetchData DONE"); - } while (cm_Analyze(connp, up, reqp, &scp->fid, &volSync, NULL, code)); + } while (cm_Analyze(connp, up, reqp, &scp->fid, &volSync, NULL, NULL, code)); fetchingcompleted: code = cm_MapRPCError(code, reqp); diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index b3ed545f7..ddbd0e6a6 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -3,6 +3,7 @@ #ifndef DJGPP #include +#include #include #else #include @@ -29,28 +30,75 @@ cm_localMountPoint_t* cm_localMountPoints; osi_mutex_t cm_Freelance_Lock; int cm_localMountPointChangeFlag = 0; int cm_freelanceEnabled = 0; +afs_uint32 FakeFreelanceModTime = 0x3b49f6e2; void cm_InitFakeRootDir(); -void cm_InitFreelance() { - -#ifdef COMMENT - while ( !IsDebuggerPresent() ) { - Sleep(1000); +#if !defined(DJGPP) +void cm_FreelanceChangeNotifier(void * parmp) { + HANDLE hFreelanceChangeEvent = 0; + HKEY hkFreelance = 0; + + if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Freelance", + 0, + KEY_NOTIFY, + &hkFreelance) == ERROR_SUCCESS) { + + hFreelanceChangeEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + if (hFreelanceChangeEvent == NULL) { + RegCloseKey(hkFreelance); + return; + } + } + + while ( TRUE ) { + /* check hFreelanceChangeEvent to see if it is set. + * if so, call cm_noteLocalMountPointChange() + */ + if (RegNotifyChangeKeyValue( hkFreelance, /* hKey */ + FALSE, /* bWatchSubtree */ + REG_NOTIFY_CHANGE_LAST_SET, /* dwNotifyFilter */ + hFreelanceChangeEvent, /* hEvent */ + TRUE /* fAsynchronous */ + ) != ERROR_SUCCESS) { + RegCloseKey(hkFreelance); + CloseHandle(hFreelanceChangeEvent); + return; + } + + if (WaitForSingleObject(hFreelanceChangeEvent, INFINITE) == WAIT_OBJECT_0) + { + cm_noteLocalMountPointChange(); + } } +} +#endif + +void cm_InitFreelance() { +#if !defined(DJGPP) + thread_t phandle; + int lpid; #endif lock_InitializeMutex(&cm_Freelance_Lock, "Freelance Lock"); - + // yj: first we make a call to cm_initLocalMountPoints // to read all the local mount points from an ini file cm_InitLocalMountPoints(); - + // then we make a call to InitFakeRootDir to create // a fake root directory based on the local mount points cm_InitFakeRootDir(); - // --- end of yj code + +#if !defined(DJGPP) + /* Start the registry monitor */ + phandle = thrd_Create(NULL, 65536, (ThreadFunc) cm_FreelanceChangeNotifier, + NULL, 0, &lpid, "cm_FreelanceChangeNotifier"); + osi_assert(phandle != NULL); + thrd_CloseHandle(phandle); +#endif } /* yj: Initialization of the fake root directory */ @@ -231,37 +279,36 @@ void cm_InitFakeRootDir() { int cm_FakeRootFid(cm_fid_t *fidp) { - fidp->cell = 0x1; /* root cell */ + fidp->cell = AFS_FAKE_ROOT_CELL_ID; /* root cell */ fidp->volume = AFS_FAKE_ROOT_VOL_ID; /* root.afs ? */ fidp->vnode = 0x1; fidp->unique = 0x1; return 0; } -int cm_getLocalMountPointChange() { - return cm_localMountPointChangeFlag; +/* called directly from ioctl */ +/* called while not holding freelance lock */ +int cm_noteLocalMountPointChange() { + lock_ObtainMutex(&cm_Freelance_Lock); + cm_fakeDirVersion++; + cm_localMountPointChangeFlag = 1; + lock_ReleaseMutex(&cm_Freelance_Lock); + return 1; } -int cm_clearLocalMountPointChange() { - cm_localMountPointChangeFlag = 0; - return 0; +int cm_getLocalMountPointChange() { + return cm_localMountPointChangeFlag; } -/* called directly from ioctl */ -/* called while not holding freelance lock */ -int cm_noteLocalMountPointChange() { - lock_ObtainMutex(&cm_Freelance_Lock); - cm_fakeDirVersion++; - cm_localMountPointChangeFlag = 1; - lock_ReleaseMutex(&cm_Freelance_Lock); - return 1; +int cm_clearLocalMountPointChange() { + cm_localMountPointChangeFlag = 0; + return 0; } int cm_reInitLocalMountPoints() { cm_fid_t aFid; int i, hash; cm_scache_t *scp, **lscpp, *tscp; - osi_Log0(afsd_logp,"----- freelance reinitialization starts ----- "); @@ -270,7 +317,7 @@ int cm_reInitLocalMountPoints() { osi_Log0(afsd_logp,"Invalidating local mount point scp... "); - aFid.cell = 0x1; + aFid.cell = AFS_FAKE_ROOT_CELL_ID; aFid.volume=AFS_FAKE_ROOT_VOL_ID; aFid.unique=0x1; aFid.vnode=0x2; @@ -344,14 +391,113 @@ int cm_reInitLocalMountPoints() { // process for the freelance client. /* to be called while holding freelance lock unless during init. */ long cm_InitLocalMountPoints() { - FILE *fp; - char line[200]; - int i; + int i; + char line[512]; char* t; cm_localMountPoint_t* aLocalMountPoint; char hdir[120]; + long code; + char rootCellName[256]; +#if !defined(DJGPP) + HKEY hkFreelance = 0; + DWORD dwType, dwSize; + DWORD dwMountPoints; + DWORD dwIndex; + FILETIME ftLastWriteTime; + afs_uint32 unixTime; +#endif + +#if !defined(DJGPP) + if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Freelance", + 0, + KEY_READ|KEY_WRITE|KEY_QUERY_VALUE, + &hkFreelance) == ERROR_SUCCESS) { + + RegQueryInfoKey( hkFreelance, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwMountPoints, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + &ftLastWriteTime /* lpftLastWriteTime */ + ); + + smb_UnixTimeFromLargeSearchTime(&FakeFreelanceModTime, &ftLastWriteTime); + + if ( dwMountPoints == 0 ) { + sprintf(line,"%s#%s:root.cell.\n",rootCellName,rootCellName); + dwType = REG_SZ; + dwSize = strlen(line) + 1; + RegSetValueEx( hkFreelance, "0", 0, dwType, line, dwSize); + sprintf(line,".%s%%%s:root.cell.\n",rootCellName,rootCellName); + dwSize = strlen(line) + 1; + RegSetValueEx( hkFreelance, "1", 0, dwType, line, dwSize); + dwMountPoints = 2; + } + + // get the number of entries there are from the first line + // that we read + cm_noLocalMountPoints = dwMountPoints; + + // create space to store the local mount points + cm_localMountPoints = malloc(sizeof(cm_localMountPoint_t) * cm_noLocalMountPoints); + aLocalMountPoint = cm_localMountPoints; + + // now we read n lines and parse them into local mount points + // where n is the number of local mount points there are, as + // determined above. + // Each line in the ini file represents 1 local mount point and + // is in the format xxx#yyy:zzz, where xxx is the directory + // entry name, yyy is the cell name and zzz is the volume name. + // #yyy:zzz together make up the mount point. + for ( dwIndex = 0 ; dwIndex < dwMountPoints; dwIndex++ ) { + TCHAR szValueName[16]; + DWORD dwValueSize = 16; + dwSize = sizeof(line); + RegEnumValue( hkFreelance, dwIndex, szValueName, &dwValueSize, NULL, + &dwType, line, &dwSize); + + // line is not empty, so let's parse it + t = strchr(line, '#'); + if (!t) + t = strchr(line, '%'); + // make sure that there is a '#' or '%' separator in the line + if (!t) { + afsi_log("error occurred while parsing entry in %s: no # or %% separator in line %d", AFS_FREELANCE_INI, dwIndex); + fprintf(stderr, "error occurred while parsing entry in afs_freelance.ini: no # or %% separator in line %d", dwIndex); + cm_noLocalMountPoints--; + continue; + } + aLocalMountPoint->namep=malloc(t-line+1); + memcpy(aLocalMountPoint->namep, line, t-line); + *(aLocalMountPoint->namep + (t-line)) = 0; + + aLocalMountPoint->mountPointStringp=malloc(strlen(line) - (t-line) + 1); + memcpy(aLocalMountPoint->mountPointStringp, t, strlen(line)-(t-line)-2); + *(aLocalMountPoint->mountPointStringp + (strlen(line)-(t-line)-2)) = 0; + + osi_Log2(afsd_logp,"found mount point: name %s, string %s", + osi_LogSaveString(afsd_logp,aLocalMountPoint->namep), + osi_LogSaveString(afsd_logp,aLocalMountPoint->mountPointStringp)); + + aLocalMountPoint++; + } + + RegCloseKey(hkFreelance); + return 0; + } +#endif + /* What follows is the old code to read freelance mount points + * out of a text file modified to copy the data into the registry + */ cm_GetConfigDir(hdir); strcat(hdir, AFS_FREELANCE_INI); // open the ini file for reading @@ -359,18 +505,40 @@ long cm_InitLocalMountPoints() { // if we fail to open the file, create an empty one if (!fp) { - fp = fopen(hdir, "w"); - fputs("0\n", fp); - fclose(fp); - return 0; /* success */ + fp = fopen(hdir, "w"); + code = cm_GetRootCellName(rootCellName); + if (code == 0) { + fputs("1\n", fp); + fprintf(fp,"%s#%s:root.cell.\n",rootCellName,rootCellName); + fprintf(fp,".%s%%%s:root.cell.\n",rootCellName,rootCellName); + fclose(fp); + fopen(hdir, "r"); + } else { + fputs("0\n", fp); + fclose(fp); + return 0; /* success */ + } } // we successfully opened the file osi_Log0(afsd_logp,"opened afs_freelance.ini"); +#if !defined(DJGPP) + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Freelance", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE, + NULL, + &hkFreelance, + NULL); + dwIndex = 0; +#endif + // now we read the first line to see how many entries // there are - fgets(line, 200, fp); + fgets(line, sizeof(line), fp); // if the line is empty at any point when we're reading // we're screwed. report error and return. @@ -396,39 +564,59 @@ long cm_InitLocalMountPoints() { // entry name, yyy is the cell name and zzz is the volume name. // #yyy:zzz together make up the mount point. for (i=0; inamep=malloc(t-line+1); memcpy(aLocalMountPoint->namep, line, t-line); *(aLocalMountPoint->namep + (t-line)) = 0; - aLocalMountPoint->mountPointStringp=malloc(strlen(line) - (t-line) + 1); + + aLocalMountPoint->mountPointStringp=malloc(strlen(line) - (t-line) + 1); memcpy(aLocalMountPoint->mountPointStringp, t, strlen(line)-(t-line)-2); *(aLocalMountPoint->mountPointStringp + (strlen(line)-(t-line)-2)) = 0; osi_Log2(afsd_logp,"found mount point: name %s, string %s", - aLocalMountPoint->namep, - aLocalMountPoint->mountPointStringp); + aLocalMountPoint->namep, + aLocalMountPoint->mountPointStringp); aLocalMountPoint++; } fclose(fp); +#if !defined(DJGPP) + if ( hkFreelance ) { + RegCloseKey(hkFreelance); + DeleteFile(hdir); + } +#endif return 0; } - int cm_getNoLocalMountPoints() { return cm_noLocalMountPoints; } @@ -437,114 +625,222 @@ cm_localMountPoint_t* cm_getLocalMountPoint(int vnode) { return 0; } -long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, cm_fid_t *fidp) +long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_fid_t *fidp) { FILE *fp; char hfile[120]; - char line[200]; + char line[512]; char fullname[200]; int n; int alias = 0; +#if !defined(DJGPP) + HKEY hkFreelance = 0; + DWORD dwType, dwSize; + DWORD dwMountPoints; + DWORD dwIndex; +#endif /* before adding, verify the cell name; if it is not a valid cell, don't add the mount point. allow partial matches as a means of poor man's alias. */ /* major performance issue? */ - osi_Log3(afsd_logp,"Freelance Add Mount request: filename=%s cellname=%s volume=%s", - filename, cellname, volume); + osi_Log4(afsd_logp,"Freelance Add Mount request: filename=%s cellname=%s volume=%s %s", + osi_LogSaveString(afsd_logp,filename), + osi_LogSaveString(afsd_logp,cellname), + osi_LogSaveString(afsd_logp,volume), + rw ? "rw" : "ro"); if (cellname[0] == '.') { - if (!cm_GetCell_Gen(&cellname[1], &fullname[1], CM_FLAG_CREATE)) + if (!cm_GetCell_Gen(&cellname[1], fullname, CM_FLAG_CREATE)) return -1; - fullname[0]='.'; } else { if (!cm_GetCell_Gen(cellname, fullname, CM_FLAG_CREATE)) return -1; } - osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s", cellname); + osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s", + osi_LogSaveString(afsd_logp,cellname)); lock_ObtainMutex(&cm_Freelance_Lock); - cm_GetConfigDir(hfile); - strcat(hfile, AFS_FREELANCE_INI); - fp = fopen(hfile, "r+"); - if (!fp) - return CM_ERROR_INVAL; - fgets(line, 200, fp); - n = atoi(line); - n++; - fseek(fp, 0, SEEK_SET); - fprintf(fp, "%d", n); - fseek(fp, 0, SEEK_END); - fprintf(fp, "%s#%s:%s\n", filename, fullname, volume); - fclose(fp); - lock_ReleaseMutex(&cm_Freelance_Lock); - - /* cm_reInitLocalMountPoints(); */ - if (fidp) { - fidp->unique = 1; - fidp->vnode = cm_noLocalMountPoints + 1; /* vnode value of last mt pt */ - } - cm_noteLocalMountPointChange(); - - return 0; +#if !defined(DJGPP) + if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Freelance", + 0, + KEY_READ|KEY_WRITE|KEY_QUERY_VALUE, + &hkFreelance) == ERROR_SUCCESS) { + + RegQueryInfoKey( hkFreelance, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwMountPoints, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + if (rw) + sprintf(line, "%s%%%s:%s\n", filename, fullname, volume); + else + sprintf(line, "%s#%s:%s\n", filename, fullname, volume); + + /* If we are adding a new value, there must be an unused name + * within the range 0 to dwMountPoints + */ + for ( dwIndex = 0; dwIndex <= dwMountPoints; dwIndex++ ) { + char szIndex[16]; + sprintf(szIndex, "%d", dwIndex); + if (RegQueryValueEx( hkFreelance, szIndex, 0, &dwType, NULL, &dwSize) != ERROR_SUCCESS) { + /* found an unused value */ + dwType = REG_SZ; + dwSize = strlen(line) + 1; + RegSetValueEx( hkFreelance, szIndex, 0, dwType, line, dwSize); + break; + } + } + RegCloseKey(hkFreelance); + } else +#endif + { + cm_GetConfigDir(hfile); + strcat(hfile, AFS_FREELANCE_INI); + fp = fopen(hfile, "r+"); + if (!fp) + return CM_ERROR_INVAL; + fgets(line, sizeof(line), fp); + n = atoi(line); + n++; + fseek(fp, 0, SEEK_SET); + fprintf(fp, "%d", n); + fseek(fp, 0, SEEK_END); + if (rw) + fprintf(fp, "%s%%%s:%s\n", filename, fullname, volume); + else + fprintf(fp, "%s#%s:%s\n", filename, fullname, volume); + fclose(fp); + } + lock_ReleaseMutex(&cm_Freelance_Lock); + + /* cm_reInitLocalMountPoints(); */ + if (fidp) { + fidp->unique = 1; + fidp->vnode = cm_noLocalMountPoints + 1; /* vnode value of last mt pt */ + } + cm_noteLocalMountPointChange(); + return 0; } long cm_FreelanceRemoveMount(char *toremove) { - int i, n; - char* cp; - char line[200]; - char shortname[200]; - char hfile[120], hfile2[120]; - FILE *fp1, *fp2; - int found=0; + int i, n; + char* cp; + char line[512]; + char shortname[200]; + char hfile[120], hfile2[120]; + FILE *fp1, *fp2; + int found=0; +#if !defined(DJGPP) + HKEY hkFreelance = 0; + DWORD dwType, dwSize; + DWORD dwMountPoints; + DWORD dwIndex; +#endif lock_ObtainMutex(&cm_Freelance_Lock); - cm_GetConfigDir(hfile); - strcat(hfile, AFS_FREELANCE_INI); - strcpy(hfile2, hfile); - strcat(hfile2, "2"); - fp1=fopen(hfile, "r+"); - if (!fp1) - return CM_ERROR_INVAL; - fp2=fopen(hfile2, "w+"); - if (!fp2) { - fclose(fp1); - return CM_ERROR_INVAL; - } - - fgets(line, 200, fp1); - n=atoi(line); - fprintf(fp2, "%d\n", n-1); - - for (i=0; icallp, &fid, &acl, &fileStatus, &volSync); - } while (cm_Analyze(connp, userp, &req, &scp->fid, - &volSync, NULL, code)); + } while (cm_Analyze(connp, userp, &req, &scp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, &req); cm_ReleaseSCache(scp); @@ -485,8 +484,7 @@ long cm_IoctlSetACL(struct smb_ioctl *ioctlp, struct cm_user *userp) if (code) continue; code = RXAFS_StoreACL(connp->callp, &fid, &acl, &fileStatus, &volSync); - } while (cm_Analyze(connp, userp, &req, &scp->fid, - &volSync, NULL, code)); + } while (cm_Analyze(connp, userp, &req, &scp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, &req); /* invalidate cache info, since we just trashed the ACL cache */ @@ -611,7 +609,7 @@ long cm_IoctlSetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp) code = RXAFS_SetVolumeStatus(tcp->callp, scp->fid.volume, &storeStat, volName, offLineMsg, motd); - } while (cm_Analyze(tcp, userp, &req, &scp->fid, NULL, NULL, code)); + } while (cm_Analyze(tcp, userp, &req, &scp->fid, NULL, NULL, NULL, code)); code = cm_MapRPCError(code, &req); /* return on failure */ @@ -669,7 +667,7 @@ long cm_IoctlGetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp) code = RXAFS_GetVolumeStatus(tcp->callp, scp->fid.volume, &volStat, &Name, &OfflineMsg, &MOTD); - } while (cm_Analyze(tcp, userp, &req, &scp->fid, NULL, NULL, code)); + } while (cm_Analyze(tcp, userp, &req, &scp->fid, NULL, NULL, NULL, code)); code = cm_MapRPCError(code, &req); cm_ReleaseSCache(scp); @@ -695,43 +693,43 @@ long cm_IoctlGetVolumeStatus(struct smb_ioctl *ioctlp, struct cm_user *userp) long cm_IoctlWhereIs(struct smb_ioctl *ioctlp, struct cm_user *userp) { long code; - cm_scache_t *scp; - cm_cell_t *cellp; - cm_volume_t *tvp; - cm_serverRef_t *tsrp; - cm_server_t *tsp; - unsigned long volume; - char *cp; - cm_req_t req; + cm_scache_t *scp; + cm_cell_t *cellp; + cm_volume_t *tvp; + cm_serverRef_t **tsrpp, *current; + cm_server_t *tsp; + unsigned long volume; + char *cp; + cm_req_t req; cm_InitReq(&req); - code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp); - if (code) return code; + code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp); + if (code) return code; volume = scp->fid.volume; cellp = cm_FindCellByID(scp->fid.cell); - osi_assert(cellp); + osi_assert(cellp); - cm_ReleaseSCache(scp); + cm_ReleaseSCache(scp); code = cm_GetVolumeByID(cellp, volume, userp, &req, &tvp); - if (code) return code; + if (code) return code; - cp = ioctlp->outDatap; + cp = ioctlp->outDatap; lock_ObtainMutex(&tvp->mx); - tsrp = cm_GetVolServers(tvp, volume); + tsrpp = cm_GetVolServers(tvp, volume); lock_ObtainRead(&cm_serverLock); - while(tsrp) { - tsp = tsrp->server; + for (current = *tsrpp; current; current = current->next) { + tsp = current->server; memcpy(cp, (char *)&tsp->addr.sin_addr.s_addr, sizeof(long)); cp += sizeof(long); - tsrp = tsrp->next; } lock_ReleaseRead(&cm_serverLock); - lock_ReleaseMutex(&tvp->mx); + cm_FreeServerList(tsrpp); + lock_ReleaseMutex(&tvp->mx); /* still room for terminating NULL, add it on */ volume = 0; /* reuse vbl */ @@ -1007,14 +1005,14 @@ long cm_IoctlGetCacheParms(struct smb_ioctl *ioctlp, struct cm_user *userp) long cm_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp) { long whichCell; - long magic = 0; + long magic = 0; cm_cell_t *tcellp; cm_serverRef_t *serverRefp; - cm_server_t *serverp; + cm_server_t *serverp; long i; - char *cp; - char *tp; - char *basep; + char *cp; + char *tp; + char *basep; cm_SkipIoctlPath(ioctlp); @@ -1028,7 +1026,7 @@ long cm_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp) memcpy((char *)&magic, tp, sizeof(long)); } - lock_ObtainRead(&cm_cellLock); + lock_ObtainRead(&cm_cellLock); for(tcellp = cm_allCellsp; tcellp; tcellp = tcellp->nextp) { if (whichCell == 0) break; whichCell--; @@ -1044,15 +1042,16 @@ long cm_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp) max = 13; } memset(cp, 0, max * sizeof(long)); - basep = cp; + basep = cp; lock_ObtainRead(&cm_serverLock); /* for going down server list */ + /* jaltman - do the reference counts to serverRefp contents need to be increased? */ serverRefp = tcellp->vlServersp; for(i=0; iserver; memcpy(cp, &serverp->addr.sin_addr.s_addr, sizeof(long)); cp += sizeof(long); - serverRefp = serverRefp->next; + serverRefp = serverRefp->next; } lock_ReleaseRead(&cm_serverLock); cp = basep + max * sizeof(afs_int32); @@ -1435,7 +1434,8 @@ long cm_IoctlCreateMountPoint(struct smb_ioctl *ioctlp, struct cm_user *userp) /* we are adding the mount point to the root dir., so call the freelance code to do the add. */ osi_Log0(afsd_logp,"IoctlCreateMountPoint within Freelance root dir"); - code = cm_FreelanceAddMount(leaf, fullCell, volume, NULL); + code = cm_FreelanceAddMount(leaf, fullCell, volume, + *ioctlp->inDatap == '%', NULL); return code; } #endif @@ -1690,8 +1690,13 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) if (flags & PIOCTL_LOGON) { /* SMB user name with which to associate tokens */ smbname = tp; - fprintf(stderr, "SMB name = %s\n", smbname); + osi_Log2(smb_logp,"cm_IoctlSetToken for user [%s] smbname [%s]", + osi_LogSaveString(smb_logp,uname), osi_LogSaveString(smb_logp,smbname)); + fprintf(stderr, "SMB name = %s\n", smbname); tp += strlen(tp) + 1; + } else { + osi_Log1(smb_logp,"cm_IoctlSetToken for user [%s]", + osi_LogSaveString(smb_logp,uname)); } #ifndef DJGPP /* for win95, session key is back in pioctl */ @@ -1700,8 +1705,10 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) if (!cm_FindTokenEvent(uuid, sessionKey)) return CM_ERROR_INVAL; #endif /* !DJGPP */ - } else + } else { cellp = cm_rootCellp; + osi_Log0(smb_logp,"cm_IoctlSetToken - no name specified"); + } if (flags & PIOCTL_LOGON) { userp = smb_FindCMUserByName(smbname, ioctlp->fidp->vcp->rname); @@ -1710,6 +1717,7 @@ long cm_IoctlSetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) /* store the token */ lock_ObtainMutex(&userp->mx); ucellp = cm_GetUCell(userp, cellp); + osi_Log1(smb_logp,"cm_IoctlSetToken ucellp %lx", ucellp); ucellp->ticketLen = ticketLen; if (ucellp->ticketp) free(ucellp->ticketp); /* Discard old token if any */ @@ -1944,6 +1952,8 @@ long cm_IoctlDelToken(struct smb_ioctl *ioctlp, struct cm_user *userp) return CM_ERROR_NOMORETOKENS; } + osi_Log1(smb_logp,"cm_IoctlDelToken ucellp %lx", ucellp); + if (ucellp->ticketp) { free(ucellp->ticketp); ucellp->ticketp = NULL; @@ -1964,7 +1974,8 @@ long cm_IoctlDelAllToken(struct smb_ioctl *ioctlp, struct cm_user *userp) lock_ObtainMutex(&userp->mx); - for (ucellp = userp->cellInfop; ucellp; ucellp = ucellp->nextp) { + for (ucellp = userp->cellInfop; ucellp; ucellp = ucellp->nextp) { + osi_Log1(smb_logp,"cm_IoctlDelAllToken ucellp %lx", ucellp); ucellp->flags &= ~CM_UCELLFLAG_RXKAD; ucellp->gen++; } @@ -1980,11 +1991,12 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) { char afspath[MAX_PATH]; char *submountreqp; - int iteration; - int submountDataSize; - char *submountData; - char *submountName; int nextAutoSubmount; + HKEY hkSubmounts; + DWORD dwType, dwSize; + DWORD status; + DWORD dwIndex; + DWORD dwSubmounts; cm_SkipIoctlPath(ioctlp); @@ -2003,33 +2015,44 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) * that submount name is in use... if so, the submount's path * has to match our path. */ - if (submountreqp && *submountreqp) { + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE|KEY_QUERY_VALUE, + NULL, + &hkSubmounts, + NULL ); + + if (submountreqp && *submountreqp) { char submountPathNormalized[MAX_PATH]; char submountPath[MAX_PATH]; - int submountPathLen; - submountPathLen = GetPrivateProfileString("AFS Submounts", - submountreqp, "", submountPath, - sizeof(submountPath), "afsdsbmt.ini"); + dwSize = sizeof(submountPath); + status = RegQueryValueEx( hkSubmounts, submountreqp, 0, + &dwType, submountPath, &dwSize); - if ((submountPathLen == 0) || - (submountPathLen == sizeof(submountPath) - 1)) { + if (status != ERROR_SUCCESS) { /* The suggested submount name isn't in use now-- * so we can safely map the requested submount name * to the supplied path. Remember not to write the * leading "/afs" when writing out the submount. */ - WritePrivateProfileString("AFS Submounts", - submountreqp, - (strlen(&afspath[strlen(cm_mountRoot)])) ? - &afspath[strlen(cm_mountRoot)]:"/", - "afsdsbmt.ini"); - + RegSetValueEx( hkSubmounts, submountreqp, 0, + REG_SZ, + (strlen(&afspath[strlen(cm_mountRoot)])) ? + &afspath[strlen(cm_mountRoot)]:"/", + (strlen(&afspath[strlen(cm_mountRoot)])) ? + strlen(&afspath[strlen(cm_mountRoot)])+1:2); + + RegCloseKey( hkSubmounts ); strcpy(ioctlp->outDatap, submountreqp); ioctlp->outDatap += strlen(ioctlp->outDatap) +1; lock_ReleaseMutex(&cm_Afsdsbmt_Lock); - return 0; + return 0; } /* The suggested submount name is already in use--if the @@ -2040,35 +2063,26 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) if (!strcmp (submountPathNormalized, afspath)) { strcpy(ioctlp->outDatap, submountreqp); ioctlp->outDatap += strlen(ioctlp->outDatap) +1; + RegCloseKey( hkSubmounts ); lock_ReleaseMutex(&cm_Afsdsbmt_Lock); - return 0; + return 0; } } - /* At this point, the user either didn't request a particular - * submount name, or that submount name couldn't be used. - * Look through afsdsbmt.ini to see if there are any submounts - * already associated with the specified path. The first - * step in doing that search is to load the AFS Submounts - * section of afsdsbmt.ini into memory. - */ - - submountDataSize = 1024; - submountData = malloc (submountDataSize); - - for (iteration = 0; iteration < 5; ++iteration) { + RegQueryInfoKey( hkSubmounts, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwSubmounts, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); - int sectionSize; - sectionSize = GetPrivateProfileString("AFS Submounts", - NULL, "", submountData, - submountDataSize, "afsdsbmt.ini"); - if (sectionSize < submountDataSize-2) - break; - - free (submountData); - submountDataSize *= 2; - submountData = malloc (submountDataSize); - } /* Having obtained a list of all available submounts, start * searching that list for a path which matches the requested @@ -2078,13 +2092,15 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) nextAutoSubmount = 1; - for (submountName = submountData; - submountName && *submountName; - submountName += 1+strlen(submountName)) { - + for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) { char submountPathNormalized[MAX_PATH]; char submountPath[MAX_PATH] = ""; - int submountPathLen; + DWORD submountPathLen = sizeof(submountPath); + char submountName[256]; + DWORD submountNameLen = sizeof(submountName); + + RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL, + &dwType, submountPath, &submountPathLen); /* If this is an Auto### submount, remember its ### value */ @@ -2096,14 +2112,6 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) thisAutoSubmount+1); } - /* We have the name of a submount in the AFS Submounts - * section; read that entry to find out what path it - * maps to. - */ - submountPathLen = GetPrivateProfileString("AFS Submounts", - submountName, "", submountPath, - sizeof(submountPath), "afsdsbmt.ini"); - if ((submountPathLen == 0) || (submountPathLen == sizeof(submountPath) - 1)) { continue; @@ -2115,18 +2123,15 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) */ cm_NormalizeAfsPath (submountPathNormalized, submountPath); if (!strcmp (submountPathNormalized, afspath)) { - strcpy(ioctlp->outDatap, submountName); ioctlp->outDatap += strlen(ioctlp->outDatap) +1; - free (submountData); + RegCloseKey(hkSubmounts); lock_ReleaseMutex(&cm_Afsdsbmt_Lock); - return 0; + return 0; } } - free (submountData); - /* We've been through the entire list of existing submounts, and * didn't find any which matched the specified path. So, we'll * just have to add one. Remember not to write the leading "/afs" @@ -2135,12 +2140,17 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp) sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount); - WritePrivateProfileString("AFS Submounts", ioctlp->outDatap, - (strlen(&afspath[lstrlen(cm_mountRoot)])) ? - &afspath[lstrlen(cm_mountRoot)]:"/", - "afsdsbmt.ini"); + RegSetValueEx( hkSubmounts, + ioctlp->outDatap, + 0, + REG_SZ, + (strlen(&afspath[strlen(cm_mountRoot)])) ? + &afspath[strlen(cm_mountRoot)]:"/", + (strlen(&afspath[strlen(cm_mountRoot)])) ? + strlen(&afspath[strlen(cm_mountRoot)])+1:2); ioctlp->outDatap += strlen(ioctlp->outDatap) +1; + RegCloseKey(hkSubmounts); lock_ReleaseMutex(&cm_Afsdsbmt_Lock); return 0; } diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index c934ade45..54d6e75a7 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -272,10 +272,12 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, // because we have to fill in the status stuff 'coz we // don't want trybulkstat to fill it in for us #ifdef AFS_FREELANCE_CLIENT - special = (fidp->cell==0x1 && fidp->volume==AFS_FAKE_ROOT_VOL_ID && + special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && + fidp->volume==AFS_FAKE_ROOT_VOL_ID && !(fidp->vnode==0x1 && fidp->unique==0x1)); - isRoot = (fidp->cell==0x1 && fidp->volume==AFS_FAKE_ROOT_VOL_ID && - fidp->vnode==0x1 && fidp->unique==0x1); + isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && + fidp->volume==AFS_FAKE_ROOT_VOL_ID && + fidp->vnode==0x1 && fidp->unique==0x1); if (cm_freelanceEnabled && isRoot) { osi_Log0(afsd_logp,"cm_getSCache Freelance and isRoot"); /* freelance: if we are trying to get the root scp for the first @@ -295,7 +297,7 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, scp->volp = cm_rootSCachep->volp; if (scp->dotdotFidp == (cm_fid_t *) NULL) scp->dotdotFidp = (cm_fid_t *) malloc (sizeof(cm_fid_t)); - scp->dotdotFidp->cell=0x1; + scp->dotdotFidp->cell=AFS_FAKE_ROOT_CELL_ID; scp->dotdotFidp->volume=AFS_FAKE_ROOT_VOL_ID; scp->dotdotFidp->unique=1; scp->dotdotFidp->vnode=1; @@ -314,8 +316,8 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, scp->owner=0x0; scp->unixModeBits=0x1ff; - scp->clientModTime=0x3b49f6e2; - scp->serverModTime=0x3b49f6e2; + scp->clientModTime=FakeFreelanceModTime; + scp->serverModTime=FakeFreelanceModTime; scp->parentUnique = 0x1; scp->parentVnode=0x1; scp->group=0; @@ -592,7 +594,7 @@ long cm_SyncOp(cm_scache_t *scp, cm_buf_t *bufp, cm_user_t *up, cm_req_t *reqp, #ifdef AFS_FREELANCE_CLIENT && (!cm_freelanceEnabled || !(!(scp->fid.vnode==0x1 && scp->fid.unique==0x1) && - scp->fid.cell==0x1 && + scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID)) #endif /* AFS_FREELANCE_CLIENT */ ) { @@ -648,6 +650,8 @@ sleep: osi_Log1(afsd_logp, "CM SyncOp sleeping scp %x", (long) scp); if ( scp->flags & CM_SCACHEFLAG_WAITING ) osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING already set for 0x%x", scp); + else + osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING set for 0x%x", scp); scp->flags |= CM_SCACHEFLAG_WAITING; if (bufLocked) lock_ReleaseMutex(&bufp->mx); osi_SleepM((long) &scp->flags, &scp->mx); @@ -775,8 +779,9 @@ void cm_SyncOpDone(cm_scache_t *scp, cm_buf_t *bufp, long flags) /* and wakeup anyone who is waiting */ if (scp->flags & CM_SCACHEFLAG_WAITING) { - scp->flags &= ~CM_SCACHEFLAG_WAITING; - osi_Wakeup((long) &scp->flags); + osi_Log1(afsd_logp, "CM SyncOp CM_SCACHEFLAG_WAITING reset for 0x%x", scp); + scp->flags &= ~CM_SCACHEFLAG_WAITING; + osi_Wakeup((long) &scp->flags); } } @@ -814,8 +819,8 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp, statusp->ParentVnode = 0x1; statusp->ParentUnique = 0x1; statusp->ResidencyMask = 0; - statusp->ClientModTime = 0x3b49f6e2; - statusp->ServerModTime = 0x3b49f6e2; + statusp->ClientModTime = FakeFreelanceModTime; + statusp->ServerModTime = FakeFreelanceModTime; statusp->Group = 0; statusp->SyncCounter = 0; statusp->dataVersionHigh = 0; diff --git a/src/WINNT/afsd/cm_scache.h b/src/WINNT/afsd/cm_scache.h index aec2f970e..d259dc1d0 100644 --- a/src/WINNT/afsd/cm_scache.h +++ b/src/WINNT/afsd/cm_scache.h @@ -136,10 +136,10 @@ typedef struct cm_scache { #define CM_SCACHETYPE_MOUNTPOINT 4 /* a mount point */ /* flag bits */ -#define CM_SCACHEFLAG_STATD 1 /* status info is valid */ -#define CM_SCACHEFLAG_DELETED 2 /* file has been deleted */ -#define CM_SCACHEFLAG_CALLBACK 4 /* have a valid callback */ -#define CM_SCACHEFLAG_STORING 8 /* status being stored back */ +#define CM_SCACHEFLAG_STATD 0x01 /* status info is valid */ +#define CM_SCACHEFLAG_DELETED 0x02 /* file has been deleted */ +#define CM_SCACHEFLAG_CALLBACK 0x04 /* have a valid callback */ +#define CM_SCACHEFLAG_STORING 0x08 /* status being stored back */ #define CM_SCACHEFLAG_FETCHING 0x10 /* status being fetched */ #define CM_SCACHEFLAG_SIZESTORING 0x20 /* status being stored that * changes the data; typically, @@ -171,10 +171,10 @@ typedef struct cm_scache { * These flags correspond to individual RPCs that we may be making, and at most * one can be set in any one call to SyncOp. */ -#define CM_SCACHESYNC_FETCHSTATUS 1 /* fetching status info */ -#define CM_SCACHESYNC_STORESTATUS 2 /* storing status info */ -#define CM_SCACHESYNC_FETCHDATA 4 /* fetch data */ -#define CM_SCACHESYNC_STOREDATA 8 /* store data */ +#define CM_SCACHESYNC_FETCHSTATUS 0x01 /* fetching status info */ +#define CM_SCACHESYNC_STORESTATUS 0x02 /* storing status info */ +#define CM_SCACHESYNC_FETCHDATA 0x04 /* fetch data */ +#define CM_SCACHESYNC_STOREDATA 0x08 /* store data */ #define CM_SCACHESYNC_STORESIZE 0x10 /* store new file size */ #define CM_SCACHESYNC_GETCALLBACK 0x20 /* fetching a callback */ #define CM_SCACHESYNC_STOREDATA_EXCL 0x40 /* store data */ diff --git a/src/WINNT/afsd/cm_server.c b/src/WINNT/afsd/cm_server.c index be349d495..fa1a72a6e 100644 --- a/src/WINNT/afsd/cm_server.c +++ b/src/WINNT/afsd/cm_server.c @@ -142,6 +142,11 @@ void cm_PutServer(cm_server_t *serverp) lock_ReleaseWrite(&cm_serverLock); } +void cm_PutServerNoLock(cm_server_t *serverp) +{ + osi_assert(serverp->refCount-- > 0); +} + void cm_SetServerPrefs(cm_server_t * serverp) { unsigned long serverAddr; /* in host byte order */ @@ -243,13 +248,14 @@ cm_serverRef_t *cm_NewServerRef(cm_server_t *serverp) { cm_serverRef_t *tsrp; - lock_ObtainWrite(&cm_serverLock); + lock_ObtainWrite(&cm_serverLock); serverp->refCount++; - lock_ReleaseWrite(&cm_serverLock); + lock_ReleaseWrite(&cm_serverLock); tsrp = malloc(sizeof(*tsrp)); tsrp->server = serverp; tsrp->status = not_busy; tsrp->next = NULL; + tsrp->refCount = 1; return tsrp; } @@ -261,7 +267,6 @@ long cm_ChecksumServerList(cm_serverRef_t *serversp) cm_serverRef_t *tsrp; lock_ObtainWrite(&cm_serverLock); - for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (first) first = 0; @@ -277,6 +282,8 @@ long cm_ChecksumServerList(cm_serverRef_t *serversp) /* ** Insert a server into the server list keeping the list sorted in ** asending order of ipRank. +** +** The refCount of the cm_serverRef_t is increased */ void cm_InsertServerList(cm_serverRef_t** list, cm_serverRef_t* element) { @@ -284,8 +291,9 @@ void cm_InsertServerList(cm_serverRef_t** list, cm_serverRef_t* element) unsigned short ipRank = element->server->ipRank; lock_ObtainWrite(&cm_serverLock); + element->refCount++; /* increase refCount */ - /* insertion into empty list or at the beginning of the list */ + /* insertion into empty list or at the beginning of the list */ if ( !current || (current->server->ipRank > ipRank) ) { element->next = *list; @@ -338,6 +346,11 @@ long cm_ChangeRankServer(cm_serverRef_t** list, cm_server_t* server) /* re-insert deleted element into the list with modified rank*/ cm_InsertServerList(list, element); + + /* reduce refCount which was increased by cm_InsertServerList */ + lock_ObtainWrite(&cm_serverLock); + element->refCount--; + lock_ReleaseWrite(&cm_serverLock); return 0; } /* @@ -399,7 +412,7 @@ void cm_FreeServer(cm_server_t* server) * for this server have a 0 refCount; otherwise, they will * not be garbage collected */ - cm_GCConnections(&server); /* connsp */ + cm_GCConnections(server); /* connsp */ lock_FinalizeMutex(&server->mx); if ( cm_allServersp == server ) @@ -419,17 +432,23 @@ void cm_FreeServer(cm_server_t* server) void cm_FreeServerList(cm_serverRef_t** list) { - cm_serverRef_t *current = *list; - cm_serverRef_t *next = 0; + cm_serverRef_t **current = list; + cm_serverRef_t **nextp = 0; + cm_serverRef_t * next = 0; lock_ObtainWrite(&cm_serverLock); - while (current) + while (*current) { - next = current->next; - cm_FreeServer(current->server); - free(current); - current = next; + nextp = &(*current)->next; + if (--((*current)->refCount) == 0) { + next = *nextp; + cm_FreeServer((*current)->server); + free(*current); + *current = next; + } else { + current = nextp; + } } lock_ReleaseWrite(&cm_serverLock); diff --git a/src/WINNT/afsd/cm_server.h b/src/WINNT/afsd/cm_server.h index 114a3782a..cabaf7c16 100644 --- a/src/WINNT/afsd/cm_server.h +++ b/src/WINNT/afsd/cm_server.h @@ -22,22 +22,23 @@ */ typedef struct cm_server { struct cm_server *allNextp; /* locked by cm_serverLock */ - struct sockaddr_in addr; /* by mx */ - int type; /* by mx */ + struct sockaddr_in addr; /* by mx */ + int type; /* by mx */ struct cm_conn *connsp; /* locked by cm_connLock */ - long flags; /* by mx */ - struct cm_cell *cellp; /* cell containing this server */ + long flags; /* by mx */ + struct cm_cell *cellp; /* cell containing this server */ int refCount; /* locked by cm_serverLock */ - osi_mutex_t mx; + osi_mutex_t mx; unsigned short ipRank; /* server priority */ } cm_server_t; enum repstate {not_busy, busy, offline}; typedef struct cm_serverRef { - struct cm_serverRef *next; - struct cm_server *server; - enum repstate status; + struct cm_serverRef *next; /* locked by cm_serverLock */ + struct cm_server *server; /* locked by cm_serverLock */ + enum repstate status; /* locked by cm_serverLock */ + int refCount; /* locked by cm_serverLock */ } cm_serverRef_t; /* types */ @@ -75,6 +76,8 @@ extern long cm_ChecksumServerList(cm_serverRef_t *serversp); extern void cm_PutServer(cm_server_t *); +extern void cm_PutServerNoLock(cm_server_t *); + extern cm_server_t *cm_FindServer(struct sockaddr_in *addrp, int type); extern osi_rwlock_t cm_serverLock; diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index d04aa2907..ae00d3109 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -1010,9 +1010,9 @@ long cm_Lookup(cm_scache_t *dscp, char *namep, long flags, cm_user_t *userp, return CM_ERROR_NOSUCHFILE; } else { /* nonexistent dir on freelance root, so add it */ - osi_Log1(afsd_logp,"cm_Lookup adding mount for non-existent directory: %s", namep); - code = cm_FreelanceAddMount(namep, namep, "root.cell.", - &rock.fid); + osi_Log1(afsd_logp,"cm_Lookup adding mount for non-existent directory: %s", + osi_LogSaveString(afsd_logp,namep)); + code = cm_FreelanceAddMount(namep, namep, "root.cell.", namep[0] == '.', &rock.fid); if (code < 0) { /* add mount point failed, so give up */ if (flags & CM_FLAG_CHECKPATH) return CM_ERROR_NOSUCHPATH; @@ -1114,8 +1114,7 @@ long cm_Unlink(cm_scache_t *dscp, char *namep, cm_user_t *userp, cm_req_t *reqp) code = RXAFS_RemoveFile(connp->callp, &afsFid, namep, &newDirStatus, &volSync); - } while (cm_Analyze(connp, userp, reqp, - &dscp->fid, &volSync, NULL, code)); + } while (cm_Analyze(connp, userp, reqp, &dscp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); lock_ObtainMutex(&dscp->mx); @@ -1275,6 +1274,9 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, tp = pathp; phase = 2; } + if (tp == NULL) { + tp = ""; + } haveComponent = 0; psp = NULL; tscp = rootSCachep; @@ -1548,9 +1550,10 @@ long cm_TryBulkProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp, // yj: if this is a mountpoint under root.afs then we don't want it // to be bulkstat-ed, instead, we call getSCache directly and under // getSCache, it is handled specially. - if (cm_freelanceEnabled && - tfid.cell==0x1 && tfid.volume==AFS_FAKE_ROOT_VOL_ID && - !(tfid.vnode==0x1 && tfid.unique==0x1) ) + if ( cm_freelanceEnabled && + tfid.cell==AFS_FAKE_ROOT_CELL_ID && + tfid.volume==AFS_FAKE_ROOT_VOL_ID && + !(tfid.vnode==0x1 && tfid.unique==0x1) ) { osi_Log0(afsd_logp, "cm_TryBulkProc Freelance calls cm_SCache on root.afs mountpoint"); return cm_GetSCache(&tfid, &tscp, NULL, NULL); @@ -1626,7 +1629,7 @@ void cm_TryBulkStat(cm_scache_t *dscp, osi_hyper_t *offsetp, cm_user_t *userp, &statStruct, &callbackStruct, &volSync); } while (cm_Analyze(connp, userp, reqp, &dscp->fid, - &volSync, &cbReq, code)); + &volSync, NULL, &cbReq, code)); code = cm_MapRPCError(code, reqp); osi_Log0(afsd_logp, "CALL BulkStatus DONE"); @@ -1846,7 +1849,7 @@ long cm_SetAttr(cm_scache_t *scp, cm_attr_t *attrp, cm_user_t *userp, &afsInStatus, &afsOutStatus, &volSync); } while (cm_Analyze(connp, userp, reqp, - &scp->fid, &volSync, NULL, code)); + &scp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); osi_Log1(afsd_logp, "CALL StoreStatus DONE, code %d", code); @@ -1919,7 +1922,7 @@ long cm_Create(cm_scache_t *dscp, char *namep, long flags, cm_attr_t *attrp, &updatedDirStatus, &newFileCallback, &volSync); } while (cm_Analyze(connp, userp, reqp, - &dscp->fid, &volSync, &cbReq, code)); + &dscp->fid, &volSync, NULL, &cbReq, code)); code = cm_MapRPCError(code, reqp); lock_ObtainMutex(&dscp->mx); @@ -2035,7 +2038,7 @@ long cm_MakeDir(cm_scache_t *dscp, char *namep, long flags, cm_attr_t *attrp, &updatedDirStatus, &newDirCallback, &volSync); } while (cm_Analyze(connp, userp, reqp, - &dscp->fid, &volSync, &cbReq, code)); + &dscp->fid, &volSync, NULL, &cbReq, code)); code = cm_MapRPCError(code, reqp); lock_ObtainMutex(&dscp->mx); @@ -2117,7 +2120,7 @@ long cm_SymLink(cm_scache_t *dscp, char *namep, char *contentsp, long flags, &inStatus, &newAFSFid, &newLinkStatus, &updatedDirStatus, &volSync); } while (cm_Analyze(connp, userp, reqp, - &dscp->fid, &volSync, NULL, code)); + &dscp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); lock_ObtainMutex(&dscp->mx); @@ -2186,7 +2189,7 @@ long cm_RemoveDir(cm_scache_t *dscp, char *namep, cm_user_t *userp, code = RXAFS_RemoveDir(connp->callp, &dirAFSFid, namep, &updatedDirStatus, &volSync); } while (cm_Analyze(connp, userp, reqp, - &dscp->fid, &volSync, NULL, code)); + &dscp->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCErrorRmdir(code, reqp); lock_ObtainMutex(&dscp->mx); @@ -2326,7 +2329,7 @@ long cm_Rename(cm_scache_t *oldDscp, char *oldNamep, cm_scache_t *newDscp, &updatedOldDirStatus, &updatedNewDirStatus, &volSync); } while (cm_Analyze(connp, userp, reqp, &oldDscp->fid, - &volSync, NULL, code)); + &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, reqp); /* update the individual stat cache entries for the directories */ @@ -2398,7 +2401,7 @@ long cm_Lock(cm_scache_t *scp, unsigned char LockType, code = RXAFS_SetLock(connp->callp, &tfid, Which, &volSync); } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, - NULL, code)); + NULL, NULL, code)); lock_ObtainMutex(&scp->mx); code = cm_MapRPCError(code, reqp); } @@ -2489,7 +2492,7 @@ long cm_Unlock(cm_scache_t *scp, unsigned char LockType, break; code = RXAFS_ReleaseLock(connp->callp, &tfid, &volSync); } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync, - NULL, code)); + NULL, NULL, code)); code = cm_MapRPCError(code, reqp); lock_ObtainMutex(&scp->mx); } @@ -2530,7 +2533,7 @@ void cm_CheckLocks() code = RXAFS_ExtendLock(connp->callp, &tfid, &volSync); } while (cm_Analyze(connp, fileLock->userp, &req, - &fileLock->fid, &volSync, NULL, + &fileLock->fid, &volSync, NULL, NULL, code)); code = cm_MapRPCError(code, &req); lock_ObtainWrite(&cm_scacheLock); @@ -2598,7 +2601,7 @@ long cm_RetryLock(cm_file_lock_t *oldFileLock, int vcp_is_dead) &volSync); } while (cm_Analyze(connp, oldFileLock->userp, &req, &oldFileLock->fid, &volSync, - NULL, code)); + NULL, NULL, code)); code = cm_MapRPCError(code, &req); } diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 723dcf72a..2e35b362c 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -55,21 +55,9 @@ long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp, long code; /* clear out old bindings */ - while (tsrp = volp->rwServersp) { - volp->rwServersp = tsrp->next; - cm_PutServer(tsrp->server); - free(tsrp); - } - while (tsrp = volp->roServersp) { - volp->roServersp = tsrp->next; - cm_PutServer(tsrp->server); - free(tsrp); - } - while (tsrp = volp->bkServersp) { - volp->bkServersp = tsrp->next; - cm_PutServer(tsrp->server); - free(tsrp); - } + cm_FreeServerList(&volp->rwServersp); + cm_FreeServerList(&volp->roServersp); + cm_FreeServerList(&volp->bkServersp); /* now we have volume structure locked and held; make RPC to fill it */ do { @@ -79,7 +67,7 @@ long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp, osi_Log1(afsd_logp, "CALL VL_GetEntryByNameO name %s", volp->namep); code = VL_GetEntryByNameO(connp->callp, volp->namep, &vldbEntry); - } while (cm_Analyze(connp, userp, reqp, NULL, NULL, NULL, code)); + } while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp->vlServersp, NULL, code)); code = cm_MapVLRPCError(code, reqp); if (code == 0) { @@ -126,21 +114,28 @@ long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp, if ((tflags & VLSF_RWVOL) && (vldbEntry.flags & VLF_RWEXISTS)) { tsrp = cm_NewServerRef(tsp); - tsrp->next = volp->rwServersp; - volp->rwServersp = tsrp; + cm_InsertServerList(&volp->rwServersp, tsrp); + lock_ObtainWrite(&cm_serverLock); + tsrp->refCount--; /* drop allocation reference */ + lock_ReleaseWrite(&cm_serverLock); } if ((tflags & VLSF_ROVOL) && (vldbEntry.flags & VLF_ROEXISTS)) { tsrp = cm_NewServerRef(tsp); cm_InsertServerList(&volp->roServersp, tsrp); + lock_ObtainWrite(&cm_serverLock); + tsrp->refCount--; /* drop allocation reference */ + lock_ReleaseWrite(&cm_serverLock); ROcount++; } /* We don't use VLSF_BACKVOL !?! */ if ((tflags & VLSF_RWVOL) && (vldbEntry.flags & VLF_BACKEXISTS)) { tsrp = cm_NewServerRef(tsp); - tsrp->next = volp->bkServersp; - volp->bkServersp = tsrp; + cm_InsertServerList(&volp->bkServersp, tsrp); + lock_ObtainWrite(&cm_serverLock); + tsrp->refCount--; /* drop allocation reference */ + lock_ReleaseWrite(&cm_serverLock); } /* Drop the reference obtained by cm_FindServer() */ cm_PutServer(tsp); @@ -287,28 +282,48 @@ void cm_ForceUpdateVolume(cm_fid_t *fidp, cm_user_t *userp, cm_req_t *reqp) cm_mountRootGen++; lock_ObtainMutex(&volp->mx); volp->flags |= CM_VOLUMEFLAG_RESET; +#ifdef COMMENT + /* Mark the volume to be updated but don't update it now. + * This function is called only from within cm_Analyze + * when cm_ConnByMServers has failed with all servers down + * The problem is that cm_UpdateVolume is going to call + * cm_ConnByMServers which may cause a recursive chain + * of calls each returning a retry on failure. + * Instead, set the flag so the next time the volume is + * accessed by Name or ID the UpdateVolume call will + * occur. + */ code = cm_UpdateVolume(cellp, userp, reqp, volp); if (code == 0) volp->flags &= ~CM_VOLUMEFLAG_RESET; +#endif lock_ReleaseMutex(&volp->mx); cm_PutVolume(volp); } /* find the appropriate servers from a volume */ -cm_serverRef_t *cm_GetVolServers(cm_volume_t *volp, unsigned long volume) +cm_serverRef_t **cm_GetVolServers(cm_volume_t *volp, unsigned long volume) { - cm_serverRef_t *serversp; + cm_serverRef_t **serverspp; + cm_serverRef_t *current;; + + lock_ObtainWrite(&cm_serverLock); if (volume == volp->rwID) - serversp = volp->rwServersp; + serverspp = &volp->rwServersp; else if (volume == volp->roID) - serversp = volp->roServersp; + serverspp = &volp->roServersp; else if (volume == volp->bkID) - serversp = volp->bkServersp; + serverspp = &volp->bkServersp; else osi_panic("bad volume ID in cm_GetVolServers", __FILE__, __LINE__); - return serversp; + for (current = *serverspp; current; current = current->next) + current->refCount++; + + lock_ReleaseWrite(&cm_serverLock); + + return serverspp; } void cm_PutVolume(cm_volume_t *volp) diff --git a/src/WINNT/afsd/cm_volume.h b/src/WINNT/afsd/cm_volume.h index d3f92e499..89547d7f9 100644 --- a/src/WINNT/afsd/cm_volume.h +++ b/src/WINNT/afsd/cm_volume.h @@ -12,18 +12,18 @@ typedef struct cm_volume { struct cm_cell *cellp; /* never changes */ - char *namep; /* by cm_volumeLock */ + char *namep; /* by cm_volumeLock */ unsigned long rwID; /* by cm_volumeLock */ unsigned long roID; /* by cm_volumeLock */ unsigned long bkID; /* by cm_volumeLock */ - struct cm_volume *nextp; /* by cm_volumeLock */ + struct cm_volume *nextp; /* by cm_volumeLock */ struct cm_fid *dotdotFidp; /* parent of volume root */ - osi_mutex_t mx; - long flags; /* by mx */ - int refCount; /* by cm_volumeLock */ - cm_serverRef_t *rwServersp; /* by mx */ - cm_serverRef_t *roServersp; /* by mx */ - cm_serverRef_t *bkServersp; /* by mx */ + osi_mutex_t mx; + long flags; /* by mx */ + int refCount; /* by cm_volumeLock */ + cm_serverRef_t *rwServersp; /* by mx */ + cm_serverRef_t *roServersp; /* by mx */ + cm_serverRef_t *bkServersp; /* by mx */ } cm_volume_t; #define CM_VOLUMEFLAG_RESET 1 /* reload this info on next use */ @@ -43,7 +43,7 @@ extern long cm_GetVolumeByID(struct cm_cell *cellp, long volumeID, extern void cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp, cm_req_t *reqp); -extern cm_serverRef_t *cm_GetVolServers(cm_volume_t *volp, unsigned long volume); +extern cm_serverRef_t **cm_GetVolServers(cm_volume_t *volp, unsigned long volume); extern void cm_ChangeRankVolume(cm_server_t *tsp); diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index cae83b664..ac32533db 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -3241,9 +3241,8 @@ static CSCPolicyCmd(struct cmd_syndesc *asp) { struct cmd_item *ti; char *share = NULL; - char sbmtpath[256]; - char *policy; - + HKEY hkCSCPolicy; + for(ti=asp->parms[0].items; ti;ti=ti->next) { share = ti->data; if (share) @@ -3251,20 +3250,27 @@ static CSCPolicyCmd(struct cmd_syndesc *asp) break; } } - + if (share) { -#ifdef WIN32 - if ( !IsAdmin() ) { + char *policy; + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hkCSCPolicy, + NULL ); + + if ( !IsAdmin() || hkCSCPolicy == NULL ) { fprintf (stderr,"Permission denied: requires Administrator access.\n"); + if ( hkCSCPolicy ) + RegCloseKey(hkCSCPolicy); return EACCES; } -#else /* WIN32 */ - if (geteuid()) { - fprintf (stderr,"Permission denied: requires root access.\n"); - return EACCES; - } -#endif /* WIN32 */ policy = "manual"; @@ -3277,30 +3283,58 @@ static CSCPolicyCmd(struct cmd_syndesc *asp) if (asp->parms[4].items) policy = "disable"; - strcpy(sbmtpath, "afsdsbmt.ini"); - WritePrivateProfileString("CSC Policy", share, policy, sbmtpath); + RegSetValueEx( hkCSCPolicy, share, 0, REG_SZ, policy, strlen(policy)+1); printf("CSC policy on share \"%s\" changed to \"%s\".\n\n", share, policy); printf("Close all applications that accessed files on this share or restart AFS Client for the change to take effect.\n"); } else { - char policies[1024]; - DWORD len = sizeof(policies); + DWORD dwIndex, dwPolicies; + char policyName[256]; + DWORD policyNameLen; + char policy[256]; + DWORD policyLen; + DWORD dwType; /* list current csc policies */ - strcpy(sbmtpath, "afsdsbmt.ini"); - - GetPrivateProfileSection("CSC Policy", policies, len, sbmtpath); + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_QUERY_VALUE, + NULL, + &hkCSCPolicy, + NULL ); + + RegQueryInfoKey( hkCSCPolicy, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwPolicies, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); printf("Current CSC policies:\n"); - policy = policies; - while (policy[0]) - { - printf(" %s\n", policy); - policy += strlen(policy) + 1; + for ( dwIndex = 0; dwIndex < dwPolicies; dwIndex ++ ) { + + policyNameLen = sizeof(policyName); + policyLen = sizeof(policy); + RegEnumValue( hkCSCPolicy, dwIndex, policyName, &policyNameLen, NULL, + &dwType, policy, &policyLen); + + printf(" %s = %s\n", policyName, policy); } } + RegCloseKey(hkCSCPolicy); return (0); } diff --git a/src/WINNT/afsd/lanahelper.cpp b/src/WINNT/afsd/lanahelper.cpp index 625102730..d704adac6 100644 --- a/src/WINNT/afsd/lanahelper.cpp +++ b/src/WINNT/afsd/lanahelper.cpp @@ -1,3 +1,28 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + #include #include #include diff --git a/src/WINNT/afsd/lanahelper.h b/src/WINNT/afsd/lanahelper.h index 6a44a7263..d6ba0ed85 100644 --- a/src/WINNT/afsd/lanahelper.h +++ b/src/WINNT/afsd/lanahelper.h @@ -1,3 +1,28 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + #ifndef __LANAHELPER_H__ #define __LANAHELPER_H__ diff --git a/src/WINNT/afsd/libafsconf.def b/src/WINNT/afsd/libafsconf.def index 08c2d1e65..79a756aa2 100644 --- a/src/WINNT/afsd/libafsconf.def +++ b/src/WINNT/afsd/libafsconf.def @@ -21,3 +21,4 @@ EXPORTS getAFSServer @14 cm_InitDNS @15 cm_GetConfigDir @16 + \ No newline at end of file diff --git a/src/WINNT/afsd/logon_ad.cpp b/src/WINNT/afsd/logon_ad.cpp new file mode 100644 index 000000000..204147150 --- /dev/null +++ b/src/WINNT/afsd/logon_ad.cpp @@ -0,0 +1,392 @@ +/* + +Copyright 2004 by the Massachusetts Institute of Technology + +All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the Massachusetts +Institute of Technology (M.I.T.) not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + + +//#pragma keyword("interface",on) +#define interface struct +#define SECURITY_WIN32 +#include "afslogon.h" + +/**/ +#include +#include +#include +#include +#include +#include +#include +/**/ + +#define SEC_ERR_VALUE(v) if (status==v) return #v + +char * _get_sec_err_text(SECURITY_STATUS status) { + SEC_ERR_VALUE(SEC_E_OK); + SEC_ERR_VALUE(SEC_I_CONTINUE_NEEDED); + SEC_ERR_VALUE(SEC_I_COMPLETE_NEEDED); + SEC_ERR_VALUE(SEC_I_COMPLETE_AND_CONTINUE); + SEC_ERR_VALUE(SEC_E_INCOMPLETE_MESSAGE); + SEC_ERR_VALUE(SEC_I_INCOMPLETE_CREDENTIALS); + SEC_ERR_VALUE(SEC_E_INVALID_HANDLE); + SEC_ERR_VALUE(SEC_E_TARGET_UNKNOWN); + SEC_ERR_VALUE(SEC_E_LOGON_DENIED); + SEC_ERR_VALUE(SEC_E_INTERNAL_ERROR); + SEC_ERR_VALUE(SEC_E_NO_CREDENTIALS); + SEC_ERR_VALUE(SEC_E_NO_AUTHENTICATING_AUTHORITY); + SEC_ERR_VALUE(SEC_E_INSUFFICIENT_MEMORY); + SEC_ERR_VALUE(SEC_E_INVALID_TOKEN); + SEC_ERR_VALUE(SEC_E_UNSUPPORTED_FUNCTION); + SEC_ERR_VALUE(SEC_E_WRONG_PRINCIPAL); + return "Unknown"; +} + +#undef SEC_ERR_VALUE + +DWORD LogonSSP(PLUID lpLogonId, PCtxtHandle outCtx) { + DWORD code = 1; + SECURITY_STATUS status; + CredHandle creds; + CtxtHandle ctxclient,ctxserver; + TimeStamp expiry; + BOOL cont = TRUE; + BOOL first = TRUE; + SecBufferDesc sdescc,sdescs; + SecBuffer stokc,stoks; + ULONG cattrs,sattrs; + int iters = 10; + + outCtx->dwLower = 0; + outCtx->dwUpper = 0; + + cattrs = 0; + sattrs = 0; + + status = AcquireCredentialsHandle( + NULL, + "Negotiate", + SECPKG_CRED_BOTH, + lpLogonId, + NULL, + NULL, + NULL, + &creds, + &expiry); + + if (status != SEC_E_OK) { + DebugEvent("AcquireCredentialsHandle failed: %lX", status); + goto ghp_0; + } + + sdescc.cBuffers = 1; + sdescc.pBuffers = &stokc; + sdescc.ulVersion = SECBUFFER_VERSION; + + stokc.BufferType = SECBUFFER_TOKEN; + stokc.cbBuffer = 0; + stokc.pvBuffer = NULL; + + sdescs.cBuffers = 1; + sdescs.pBuffers = &stoks; + sdescs.ulVersion = SECBUFFER_VERSION; + + stoks.BufferType = SECBUFFER_TOKEN; + stoks.cbBuffer = 0; + stoks.pvBuffer = NULL; + + do { + status = InitializeSecurityContext( + &creds, + ((first)? NULL:&ctxclient), + NULL, + ISC_REQ_DELEGATE | ISC_REQ_ALLOCATE_MEMORY, + 0, + SECURITY_NATIVE_DREP, + ((first)?NULL:&sdescs), + 0, + &ctxclient, + &sdescc, + &cattrs, + &expiry + ); + + DebugEvent("InitializeSecurityContext returns status[%lX](%s)",status,_get_sec_err_text(status)); + + if (!first) FreeContextBuffer(stoks.pvBuffer); + + if (status == SEC_I_COMPLETE_NEEDED || status == SEC_I_COMPLETE_AND_CONTINUE) { + CompleteAuthToken(&ctxclient, &sdescc); + } + + if (status != SEC_I_CONTINUE_NEEDED && status != SEC_I_COMPLETE_AND_CONTINUE) { + cont = FALSE; + } + + if (!stokc.cbBuffer && !cont) { + DebugEvent("Breaking out after InitializeSecurityContext"); + break; + } + + status = AcceptSecurityContext( + &creds, + ((first)?NULL:&ctxserver), + &sdescc, + ASC_REQ_DELEGATE | ASC_REQ_ALLOCATE_MEMORY, + SECURITY_NATIVE_DREP, + &ctxserver, + &sdescs, + &sattrs, + &expiry); + + DebugEvent("AcceptSecurityContext returns status[%lX](%s)", status, _get_sec_err_text(status)); + + FreeContextBuffer(stokc.pvBuffer); + + if (status == SEC_I_COMPLETE_NEEDED || status == SEC_I_COMPLETE_AND_CONTINUE) { + CompleteAuthToken(&ctxserver,&sdescs); + } + + if (status == SEC_I_CONTINUE_NEEDED || status == SEC_I_COMPLETE_AND_CONTINUE) { + cont = TRUE; + } + + if (!cont) + FreeContextBuffer(stoks.pvBuffer); + + first = FALSE; + iters--; /* just in case, hard limit on loop */ + } while (cont && iters); + + if (sattrs & ASC_RET_DELEGATE) { + DebugEvent("Received delegate context"); + *outCtx = ctxserver; + code = 0; + } else { + DebugEvent("Didn't receive delegate context"); + outCtx->dwLower = 0; + outCtx->dwUpper = 0; + DeleteSecurityContext(&ctxserver); + } + + DeleteSecurityContext(&ctxclient); + FreeCredentialsHandle(&creds); +ghp_0: + return code; +} + +DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain) { + DWORD code = 1; /* default is failure */ + NTSTATUS rv = 0; + HRESULT hr = S_OK; + LPWSTR p = NULL; + WCHAR adsPath[MAX_PATH] = L""; + BOOL coInitialized = FALSE; + CHAR ansidomain[256], *a; + + homePath[0] = '\0'; + + /* I trust this is an ASCII domain name */ + for ( p=domain, a=ansidomain; *a = (CHAR)*p; p++, a++); + DebugEvent("Domain: %s", ansidomain); + + if (ConvertSidToStringSidW(psid,&p)) { + IADsNameTranslate *pNto; + + DebugEvent("Got SID string [%S]", p); + + hr = CoInitialize(NULL); + if (SUCCEEDED(hr)) + coInitialized = TRUE; + + hr = CoCreateInstance( CLSID_NameTranslate, + NULL, + CLSCTX_INPROC_SERVER, + IID_IADsNameTranslate, + (void**)&pNto); + + if (FAILED(hr)) { DebugEvent("Can't create nametranslate object"); } + else { + hr = pNto->Init(ADS_NAME_INITTYPE_GC,L""); + if (FAILED(hr)) { + DebugEvent("NameTranslate Init GC failed [%ld]", hr); + if ( domain ) { + hr = pNto->Init(ADS_NAME_INITTYPE_DOMAIN,domain); + if (FAILED(hr)) { + DebugEvent("NameTranslate Init Domain failed [%ld]", hr); + } + } + } + + if (!FAILED(hr)) { + hr = pNto->Set(ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME, p); + if (FAILED(hr)) { DebugEvent("Can't set sid string"); } + else { + BSTR bstr; + + hr = pNto->Get(ADS_NAME_TYPE_1779, &bstr); + if(SUCCEEDED(hr)) { + hr = StringCchCopyW(adsPath, MAX_PATH, bstr); + if(FAILED(hr)) { + DebugEvent("Overflow while copying ADS path"); + adsPath[0] = L'\0'; + } + + SysFreeString(bstr); + } + } + } + pNto->Release(); + } + + LocalFree(p); + + } else { + DebugEvent("Can't convert sid to string"); + } + + if (adsPath[0]) { + WCHAR fAdsPath[MAX_PATH]; + IADsUser *pAdsUser; + BSTR bstHomeDir = NULL; + + hr = StringCchPrintfW(fAdsPath, MAX_PATH, L"LDAP://%s", adsPath); + if (hr != S_OK) { + DebugEvent("Can't format full adspath"); + goto cleanup; + } + + DebugEvent("Trying adsPath=[%S]", fAdsPath); + + hr = ADsGetObject( fAdsPath, IID_IADsUser, (LPVOID *) &pAdsUser); + if (hr != S_OK) { + DebugEvent("Can't open IADs object"); + goto cleanup; + } + + hr = pAdsUser->get_Profile(&bstHomeDir); + if (hr != S_OK) { + DebugEvent("Can't get profile directory"); + goto cleanup_homedir_section; + } + + wcstombs(homePath, bstHomeDir, homePathLen); + + DebugEvent("Got homepath [%s]", homePath); + + SysFreeString(bstHomeDir); + + code = 0; + +cleanup_homedir_section: + pAdsUser->Release(); + } + +cleanup: + if (coInitialized) + CoUninitialize(); + + return code; +} + +/* Try to determine the user's AD home path. *homePath is assumed to be at least MAXPATH bytes. + If successful, opt.flags is updated with LOGON_FLAG_AD_REALM to indicate that we are dealing with + an AD realm. */ +DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt) { + CtxtHandle ctx; + DWORD code = 0; + SECURITY_STATUS status; + + homePath[0] = '\0'; + + if (LogonSSP(lpLogonId,&ctx)) { + DebugEvent("Failed LogonSSP"); + return 1; + } else { + status = ImpersonateSecurityContext(&ctx); + if (status == SEC_E_OK) { + PSECURITY_LOGON_SESSION_DATA plsd; + NTSTATUS rv; + + rv = LsaGetLogonSessionData(lpLogonId, &plsd); + if (rv == 0) { + PWSTR domain; + + domain = (PWSTR)malloc(sizeof(WCHAR) * (plsd->LogonDomain.Length+1)); + memcpy(domain, plsd->LogonDomain.Buffer, sizeof(WCHAR) * (plsd->LogonDomain.Length)); + domain[plsd->LogonDomain.Length] = 0; + + if (!QueryAdHomePathFromSid(homePath,homePathLen,plsd->Sid,domain)) { + DebugEvent("Returned home path [%s]",homePath); + opt->flags |= LOGON_FLAG_AD_REALM; + } + free(domain); + LsaFreeReturnBuffer(plsd); + } else { + DebugEvent("LsaGetLogonSessionData failed [%lX]", rv); + } + RevertSecurityContext(&ctx); + } else { + DebugEvent("Can't impersonate context [%lX]",status); + code = 1; + } + + DeleteSecurityContext(&ctx); + return code; + } +} + +BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain) +{ + HRESULT hr; + IADsADSystemInfo *pADsys; + BOOL coInitialized = FALSE; + BOOL retval = FALSE; + + hr = CoInitialize(NULL); + if (SUCCEEDED(hr)) + coInitialized = TRUE; + + hr = CoCreateInstance(CLSID_ADSystemInfo, + NULL, + CLSCTX_INPROC_SERVER, + IID_IADsADSystemInfo, + (void**)&pADsys); + if ( !FAILED(hr) ) { + BSTR bstr; + + hr = pADsys->get_DomainShortName(&bstr); + if ( !FAILED(hr) ) { + hr = StringCbCopyW( Domain, cbDomain, bstr ); + if(SUCCEEDED(hr)) { + retval = TRUE; + } + SysFreeString(bstr); + } + pADsys->Release(); + } + + if (coInitialized) + CoUninitialize(); + + return retval; +} diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 46df33ed6..2dc856ffb 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -9,8 +9,6 @@ //#define NOSERVICE 1 -#define NOMOREFILESFIX 1 - #include #include @@ -28,6 +26,7 @@ #include #include +#include #include "afsd.h" @@ -87,6 +86,11 @@ int numNCBs, numSessions, numVCs; int smb_maxVCPerServer; int smb_maxMpxRequests; +int smb_authType = SMB_AUTH_EXTENDED; /* type of SMB auth to use. One of SMB_AUTH_* */ +HANDLE smb_lsaHandle; +ULONG smb_lsaSecPackage; +LSA_STRING smb_lsaLogonOrigin; + #define NCBmax MAXIMUM_WAIT_OBJECTS EVENT_HANDLE NCBavails[NCBmax], NCBevents[NCBmax]; EVENT_HANDLE **NCBreturns; @@ -94,7 +98,7 @@ DWORD NCBsessions[NCBmax]; NCB *NCBs[NCBmax]; struct smb_packet *bufs[NCBmax]; -#define Sessionmax MAXIMUM_WAIT_OBJECTS +#define Sessionmax MAXIMUM_WAIT_OBJECTS - 4 EVENT_HANDLE SessionEvents[Sessionmax]; unsigned short LSNs[Sessionmax]; int lanas[Sessionmax]; @@ -152,7 +156,7 @@ extern HANDLE WaitToTerminate; * Time in Unix format of midnight, 1/1/1970 local time. * When added to dosUTime, gives Unix (AFS) time. */ -long smb_localZero; +long smb_localZero = 0; /* Time difference for converting to kludge-GMT */ int smb_NowTZ; @@ -187,6 +191,16 @@ extern char cm_confDir[]; extern char AFSConfigKeyName[]; +char smb_ServerDomainName[MAX_COMPUTERNAME_LENGTH + 1] = ""; /* domain name */ +int smb_ServerDomainNameLength = 0; +char smb_ServerOS[] = "Windows 5.0"; /* Faux OS String */ +int smb_ServerOSLength = sizeof(smb_ServerOS); +char smb_ServerLanManager[] = "Windows 2000 LAN Manager"; /* Faux LAN Manager string */ +int smb_ServerLanManagerLength = sizeof(smb_ServerLanManager); + +/* Faux server GUID. This is never checked. */ +GUID smb_ServerGUID = { 0x40015cb8, 0x058a, 0x44fc, { 0xae, 0x7e, 0xbb, 0x29, 0x52, 0xee, 0x7e, 0xff }}; + /* * Demo expiration * @@ -251,6 +265,10 @@ char * myCrt_Dispatch(int i) return "(23)ReceiveV3GetAttributes"; case 0x24: return "(24)ReceiveV3LockingX"; + case 0x25: + return "(25)ReceiveV3Trans"; + case 0x26: + return "(26)ReceiveV3Trans[aux]"; case 0x29: return "(29)SendCoreBadOp"; case 0x2b: @@ -262,7 +280,7 @@ char * myCrt_Dispatch(int i) case 0x32: return "(32)ReceiveV3Tran2A"; case 0x33: - return "(33)ReceiveV3Tran2A"; + return "(33)ReceiveV3Tran2A[aux]"; case 0x34: return "(34)ReceiveV3FindClose"; case 0x35: @@ -337,6 +355,23 @@ char * myCrt_2Dispatch(int i) } } +char * myCrt_RapDispatch(int i) +{ + switch(i) + { + default: + return "unknown RAP OP"; + case 0: + return "RAP(0)NetShareEnum"; + case 1: + return "RAP(1)NetShareGetInfo"; + case 13: + return "RAP(13)NetServerGetInfo"; + case 63: + return "RAP(63)NetWkStaGetInfo"; + } +} + /* scache must be locked */ unsigned int smb_Attributes(cm_scache_t *scp) { @@ -397,7 +432,7 @@ static int ExtractBits(WORD bits, short start, short len) } #ifndef DJGPP -void ShowUnixTime(char *FuncName, long unixTime) +void ShowUnixTime(char *FuncName, afs_uint32 unixTime) { FILETIME ft; WORD wDate, wTime; @@ -548,7 +583,7 @@ smb_CalculateNowTZ() } #ifndef DJGPP -void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime) +void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime) { struct tm *ltp; SYSTEMTIME stm; @@ -588,7 +623,7 @@ void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime) SystemTimeToFileTime(&stm, largeTimep); } #else /* DJGPP */ -void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime) +void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime) { /* unixTime: seconds since 1/1/1970 00:00:00 GMT */ /* FILETIME: 100ns intervals since 1/1/1601 00:00:00 ??? */ @@ -610,7 +645,7 @@ void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime) #endif /* !DJGPP */ #ifndef DJGPP -void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep) +void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep) { SYSTEMTIME stm; struct tm lt; @@ -633,7 +668,7 @@ void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep) _timezone = save_timezone; } #else /* DJGPP */ -void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep) +void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep) { /* unixTime: seconds since 1/1/1970 00:00:00 GMT */ /* FILETIME: 100ns intervals since 1/1/1601 00:00:00 GMT? */ @@ -654,7 +689,7 @@ void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep) } #endif /* !DJGPP */ -void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime) +void smb_SearchTimeFromUnixTime(long *dosTimep, afs_uint32 unixTime) { struct tm *ltp; int dosDate; @@ -679,7 +714,7 @@ void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime) *dosTimep = (dosDate<<16) | dosTime; } -void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime) +void smb_UnixTimeFromSearchTime(afs_uint32 *unixTimep, long searchTime) { unsigned short dosDate; unsigned short dosTime; @@ -699,12 +734,12 @@ void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime) *unixTimep = mktime(&localTm); } -void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime) +void smb_DosUTimeFromUnixTime(afs_uint32 *dosUTimep, afs_uint32 unixTime) { *dosUTimep = unixTime - smb_localZero; } -void smb_UnixTimeFromDosUTime(long *unixTimep, long dosTime) +void smb_UnixTimeFromDosUTime(afs_uint32 *unixTimep, afs_uint32 dosTime) { #ifndef DJGPP *unixTimep = dosTime + smb_localZero; @@ -738,6 +773,33 @@ smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana) lock_InitializeMutex(&vcp->mx, "vc_t mutex"); vcp->lsn = lsn; vcp->lana = lana; + vcp->secCtx = NULL; + + if (smb_authType == SMB_AUTH_NTLM || smb_authType == SMB_AUTH_EXTENDED) { + /* We must obtain a challenge for extended auth + * in case the client negotiates smb v3 + */ + NTSTATUS nts,ntsEx; + MSV1_0_LM20_CHALLENGE_REQUEST lsaReq; + PMSV1_0_LM20_CHALLENGE_RESPONSE lsaResp; + ULONG lsaRespSize; + + lsaReq.MessageType = MsV1_0Lm20ChallengeRequest; + + nts = LsaCallAuthenticationPackage( smb_lsaHandle, + smb_lsaSecPackage, + &lsaReq, + sizeof(lsaReq), + &lsaResp, + &lsaRespSize, + &ntsEx); + osi_assert(nts == STATUS_SUCCESS); /* this had better work! */ + + memcpy(vcp->encKey, lsaResp->ChallengeToClient, MSV1_0_CHALLENGE_LENGTH); + LsaFreeReturnBuffer(lsaResp); + } + else + memset(vcp->encKey, 0, MSV1_0_CHALLENGE_LENGTH); } lock_ReleaseWrite(&smb_rctLock); return vcp; @@ -834,7 +896,9 @@ smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags) for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) { if (uid == uidp->userID) { uidp->refCount++; - osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",(int)vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : ""); + osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]", + (int)vcp, uidp->userID, + osi_LogSaveString(smb_logp, (uidp->unp) ? uidp->unp->name : "")); break; } } @@ -963,17 +1027,23 @@ cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp) * Return a pointer to a pathname extracted from a TID structure. The * TID structure is not held; assume it won't go away. */ -char *smb_GetTIDPath(smb_vc_t *vcp, unsigned short tid) +long smb_LookupTIDPath(smb_vc_t *vcp, unsigned short tid, char ** treepath) { smb_tid_t *tidp; - char *tpath; + long code = 0; tidp = smb_FindTID(vcp, tid, 0); - if (!tidp) - return NULL; - tpath = tidp->pathname; + if (!tidp) { + *treepath = NULL; + } else { + if(tidp->flags & SMB_TIDFLAG_IPC) { + code = CM_ERROR_TIDIPC; + /* tidp->pathname would be NULL, but that's fine */ + } + *treepath = tidp->pathname; smb_ReleaseTID(tidp); - return tpath; + } + return code; } /* check to see if we have a chained fid, that is, a fid that comes from an @@ -1033,7 +1103,7 @@ retry: sprintf(eventName,"fid_t event vcp=%d fid=%d", vcp->vcID, fid); event = thrd_CreateEvent(NULL, FALSE, TRUE, eventName); if ( GetLastError() == ERROR_ALREADY_EXISTS ) { - afsi_log("Event Object Already Exists: %s", eventName); + osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName)); thrd_CloseHandle(event); fid++; if (fid == 0) @@ -1136,6 +1206,7 @@ char VNLCUserName[] = "%LCUSERNAME%"; char VNComputerName[] = "%COMPUTERNAME%"; char VNLCComputerName[] = "%LCCOMPUTERNAME%"; +#ifdef DJGPP /* List available shares */ int smb_ListShares() { @@ -1199,6 +1270,37 @@ int smb_ListShares() return num_shares; } +#endif /* DJGPP */ + +typedef struct smb_findShare_rock { + char * shareName; + char * match; + int matchType; +} smb_findShare_rock_t; + +#define SMB_FINDSHARE_EXACT_MATCH 1 +#define SMB_FINDSHARE_PARTIAL_MATCH 2 + +long smb_FindShareProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp, + osi_hyper_t *offp) +{ + int matchType = 0; + smb_findShare_rock_t * vrock = (smb_findShare_rock_t *) rockp; + if(!strnicmp(dep->name, vrock->shareName, 12)) { + if(!stricmp(dep->name, vrock->shareName)) + matchType = SMB_FINDSHARE_EXACT_MATCH; + else + matchType = SMB_FINDSHARE_PARTIAL_MATCH; + if(vrock->match) free(vrock->match); + vrock->match = strdup(dep->name); + vrock->matchType = matchType; + + if(matchType == SMB_FINDSHARE_EXACT_MATCH) + return CM_ERROR_STOPNOW; + } + return 0; +} + /* find a shareName in the table of submounts */ int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, @@ -1209,17 +1311,14 @@ int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, char *var; char temp[1024]; DWORD sizeTemp; +#ifdef DJGPP char sbmtpath[MAX_PATH]; +#endif char *p, *q; HKEY parmKey; DWORD code; DWORD allSubmount = 1; - if (strcmp(shareName, "IPC$") == 0) { - *pathNamep = NULL; - return 0; - } - /* if allSubmounts == 0, only return the //mountRoot/all share * if in fact it has been been created in the subMounts table. * This is to allow sites that want to restrict access to the @@ -1250,14 +1349,33 @@ int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, return 1; } + if (_stricmp(shareName, "IPC$") == 0 || + _stricmp(shareName, SMB_IOCTL_FILENAME_NOSLASH) == 0 || + _stricmp(shareName, "DESKTOP.INI") == 0 + ) { + *pathNamep = NULL; + return 0; + } + #ifndef DJGPP - strcpy(sbmtpath, "afsdsbmt.ini"); + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, KEY_QUERY_VALUE, &parmKey); + if (code == ERROR_SUCCESS) { + len = sizeof(pathName); + code = RegQueryValueEx(parmKey, shareName, NULL, NULL, + (BYTE *) pathName, &len); + if (code != ERROR_SUCCESS) + len = 0; + RegCloseKey (parmKey); + } else { + len = 0; + } #else /* DJGPP */ strcpy(sbmtpath, cm_confDir); strcat(sbmtpath, "/afsdsbmt.ini"); -#endif /* !DJGPP */ len = GetPrivateProfileString("AFS Submounts", shareName, "", pathName, sizeof(pathName), sbmtpath); +#endif /* !DJGPP */ if (len != 0 && len != sizeof(pathName) - 1) { /* We can accept either unix or PC style AFS pathnames. Convert * Unix-style to PC style here for internal use. @@ -1307,11 +1425,40 @@ int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, *pathNamep = strdup(p); return 1; } - else /* create \\\ */ + else { + /* First lookup shareName in root.afs */ + cm_req_t req; + smb_findShare_rock_t vrock; + osi_hyper_t thyper; char * p = shareName; int rw = 0; + /* attempt to locate a partial match in root.afs. This is because + when using the ANSI RAP calls, the share name is limited to 13 chars + and hence is truncated. Of course we prefer exact matches. */ + cm_InitReq(&req); + thyper.HighPart = 0; + thyper.LowPart = 0; + + vrock.shareName = shareName; + vrock.match = NULL; + vrock.matchType = 0; + + cm_HoldSCache(cm_rootSCachep); + code = cm_ApplyDir(cm_rootSCachep, smb_FindShareProc, &vrock, &thyper, + (uidp? (uidp->unp ? uidp->unp->userp : NULL) : NULL), &req, NULL); + cm_ReleaseSCache(cm_rootSCachep); + + if(vrock.matchType) { + sprintf(pathName,"/%s/",vrock.match); + *pathNamep = strdup(strlwr(pathName)); + free(vrock.match); + return 1; + } + + /* if we get here, there was no match for the share in root.afs */ + /* so try to create \\\ */ if ( *p == '.' ) { p++; rw = 1; @@ -1346,36 +1493,40 @@ int smb_FindShareCSCPolicy(char *shareName) { DWORD len; char policy[1024]; - char sbmtpath[256]; - -#ifndef DJGPP - strcpy(sbmtpath, "afsdsbmt.ini"); -#else /* DJGPP */ - strcpy(sbmtpath, cm_confDir); - strcat(sbmtpath, "/afsdsbmt.ini"); -#endif /* !DJGPP */ - len = GetPrivateProfileString("CSC Policy", shareName, "", - policy, sizeof(policy), sbmtpath); - if (len == 0 || len == sizeof(policy) - 1) { - return CSC_POLICY_MANUAL; - } - - if (stricmp(policy, "documents") == 0) + DWORD dwType; + HKEY hkCSCPolicy; + int retval = CSC_POLICY_MANUAL; + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkCSCPolicy, + NULL ); + + len = sizeof(policy); + if ( RegQueryValueEx( hkCSCPolicy, shareName, 0, &dwType, policy, &len ) || + len == 0) { + retval = CSC_POLICY_MANUAL; + } + else if (stricmp(policy, "documents") == 0) { - return CSC_POLICY_DOCUMENTS; + retval = CSC_POLICY_DOCUMENTS; } - - if (stricmp(policy, "programs") == 0) + else if (stricmp(policy, "programs") == 0) { - return CSC_POLICY_PROGRAMS; + retval = CSC_POLICY_PROGRAMS; } - - if (stricmp(policy, "disable") == 0) + else if (stricmp(policy, "disable") == 0) { - return CSC_POLICY_DISABLE; + retval = CSC_POLICY_DISABLE; } - return CSC_POLICY_MANUAL; + RegCloseKey(hkCSCPolicy); + return retval; } /* find a dir search structure by cookie value, and return it held. @@ -1587,12 +1738,12 @@ static smb_packet_t *GetPacket(void) signed int retval = __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */ if (retval == -1) { - afsi_log("Cannot allocate %d paragraphs of DOS memory", + osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS memory", npar); osi_panic("",__FILE__,__LINE__); } else { - afsi_log("Allocated %d paragraphs of DOS mem at 0x%X", + osi_Log2(smb_logp, "Allocated %d paragraphs of DOS mem at 0x%X", npar, retval); seg = retval; } @@ -1638,11 +1789,11 @@ static NCB *GetNCB(void) signed int retval = __dpmi_allocate_dos_memory(npar, &tb_sel); /* DOS segment */ if (retval == -1) { - afsi_log("Cannot allocate %d paragraphs of DOS mem in GetNCB", + osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS mem in GetNCB", npar); osi_panic("",__FILE__,__LINE__); } else { - afsi_log("Allocated %d paragraphs of DOS mem at 0x%X in GetNCB", + osi_Log2(smb_logp, "Allocated %d paragraphs of DOS mem at 0x%X in GetNCB", npar, retval); seg = retval; } @@ -1739,24 +1890,21 @@ unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm) parmCount = *smbp->wctp; if (parm >= parmCount) { + char s[100]; #ifndef DJGPP HANDLE h; char *ptbuf[1]; - char s[100]; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); +#endif sprintf(s, "Bad SMB param %d out of %d, ncb len %d", parm, parmCount, smbp->ncb_length); +#ifndef DJGPP ptbuf[0] = s; ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL, 1, smbp->ncb_length, ptbuf, smbp); DeregisterEventSource(h); -#else /* DJGPP */ - char s[100]; - - sprintf(s, "Bad SMB param %d out of %d, ncb len %d", - parm, parmCount, smbp->ncb_length); - osi_Log0(smb_logp, s); -#endif /* !DJGPP */ +#endif + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); osi_panic(s, __FILE__, __LINE__); } parmDatap = smbp->wctp + (2*parm) + 1; @@ -1773,26 +1921,21 @@ unsigned int smb_GetSMBOffsetParm(smb_packet_t *smbp, int parm, int offset) parmCount = *smbp->wctp; if (parm * 2 + offset >= parmCount * 2) { + char s[100]; #ifndef DJGPP HANDLE h; char *ptbuf[1]; - char s[100]; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); +#endif sprintf(s, "Bad SMB param %d offset %d out of %d, ncb len %d", parm, offset, parmCount, smbp->ncb_length); - ptbuf[0] = s; +#ifndef DJGPP + ptbuf[0] = s; ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL, 1, smbp->ncb_length, ptbuf, smbp); DeregisterEventSource(h); -#else /* DJGPP */ - char s[100]; - - sprintf(s, "Bad SMB param %d offset %d out of %d, " - "ncb len %d", - parm, offset, parmCount, smbp->ncb_length); - osi_Log0(smb_logp, s); -#endif /* !DJGPP */ - +#endif + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); osi_panic(s, __FILE__, __LINE__); } parmDatap = smbp->wctp + (2*parm) + 1 + offset; @@ -2097,12 +2240,21 @@ void smb_MapNTError(long code, unsigned long *NTStatusp) else if (code == CM_ERROR_AMBIGUOUS_FILENAME) { NTStatus = 0xC0000035L; /* Object name collision */ } + else if (code == CM_ERROR_BADPASSWORD) { + NTStatus = 0xC000006DL; /* unknown username or bad password */ + } + else if (code == CM_ERROR_BADLOGONTYPE) { + NTStatus = 0xC000015BL; /* logon type not granted */ + } + else if (code == CM_ERROR_GSSCONTINUE) { + NTStatus = 0xC0000016L; /* more processing required */ + } else { NTStatus = 0xC0982001L; /* SMB non-specific error */ } *NTStatusp = NTStatus; - osi_Log2(smb_logp, "SMB SEND code %x as NT %x", code, NTStatus); + osi_Log2(smb_logp, "SMB SEND code %lX as NT %lX", code, NTStatus); } void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep, @@ -2248,6 +2400,11 @@ void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep, class = 1; error = 183; /* Samba uses this */ } + else if (code == CM_ERROR_BADPASSWORD || code == CM_ERROR_BADLOGONTYPE) { + /* we don't have a good way of reporting CM_ERROR_BADLOGONTYPE */ + class = 2; + error = 2; /* bad password */ + } else { class = 2; error = 1; @@ -2255,7 +2412,7 @@ void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep, *scodep = error; *classp = class; - osi_Log3(smb_logp, "SMB SEND code %x as SMB %d: %d", code, class, error); + osi_Log3(smb_logp, "SMB SEND code %lX as SMB %d: %d", code, class, error); } long smb_SendCoreBadOp(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) @@ -2423,18 +2580,22 @@ long smb_ReceiveCoreUnlockRecord(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) { char *namep; + char *datap; int coreProtoIndex; int v3ProtoIndex; int NTProtoIndex; - int protoIndex; /* index we're using */ + int protoIndex; /* index we're using */ int namex; int dbytes; int entryLength; int tcounter; - char protocol_array[10][1024]; /* protocol signature of the client */ + char protocol_array[10][1024]; /* protocol signature of the client */ + int caps; /* capabilities */ + time_t unixTime; + long dosTime; + TIME_ZONE_INFORMATION tzi; - - osi_Log1(smb_logp, "SMB receive negotiate; %d + 1 ongoing ops", + osi_Log1(smb_logp, "SMB receive negotiate; %d + 1 ongoing ops", ongoingOps - 1); if (!isGateway) { if (active_vcp) { @@ -2490,43 +2651,6 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) namep += entryLength; tcounter++; /* which proto entry we're looking at */ } -#ifndef NOMOREFILESFIX - /* - * NOTE: We can determine what OS (NT4.0, W2K, W9X, etc) - * the client is running by reading the protocol signature. - * ie. the order in which it sends us the protocol list. - * - * Special handling for Windows 2000 clients (defect 11765 ) - * Proto signature is the same for Win XP. - */ - if (tcounter == 6) { - int i = 0; - smb_t *ip = (smb_t *) inp; - smb_t *op = (smb_t *) outp; - - if ((strcmp("PC NETWORK PROGRAM 1.0", protocol_array[0]) == 0) && - (strcmp("LANMAN1.0", protocol_array[1]) == 0) && - (strcmp("Windows for Workgroups 3.1a", protocol_array[2]) == 0) && - (strcmp("LM1.2X002", protocol_array[3]) == 0) && - (strcmp("LANMAN2.1", protocol_array[4]) == 0) && - (strcmp("NT LM 0.12", protocol_array[5]) == 0)) { - isWindows2000 = TRUE; - osi_Log0(smb_logp, "Looks like a Windows 2000 client"); - /* - * HACK: for now - just negotiate a lower protocol till we - * figure out which flag/flag2 or some other field - * (capabilities maybe?) to set in order for this to work - * correctly with Windows 2000 clients (defect 11765) - */ - NTProtoIndex = -1; - /* Things to try (after looking at tcpdump output could be - * setting flags and flags2 to 0x98 and 0xc853 like this - * op->reb = 0x98; op->flg2 = 0xc853; - * osi_Log2(smb_logp, "Flags:0x%x Flags2:0x%x", ip->reb, ip->flg2); - */ - } - } -#endif /* NOMOREFILESFIX */ if (NTProtoIndex != -1) { protoIndex = NTProtoIndex; @@ -2545,12 +2669,23 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (protoIndex == -1) return CM_ERROR_INVAL; else if (NTProtoIndex != -1) { - smb_SetSMBParm(outp, 0, protoIndex); - smb_SetSMBParmByte(outp, 1, 0); /* share level security, no passwd encrypt */ + smb_SetSMBParm(outp, 0, protoIndex); + if (smb_authType != SMB_AUTH_NONE) { + smb_SetSMBParmByte(outp, 1, + NEGOTIATE_SECURITY_USER_LEVEL | + NEGOTIATE_SECURITY_CHALLENGE_RESPONSE); /* user level security, challenge response */ + } else { + smb_SetSMBParmByte(outp, 1, 0); /* share level auth with plaintext password. */ + } smb_SetSMBParm(outp, 1, smb_maxMpxRequests); /* max multiplexed requests */ smb_SetSMBParm(outp, 2, smb_maxVCPerServer); /* max VCs per consumer/server connection */ - smb_SetSMBParmLong(outp, 3, SMB_PACKETSIZE); /* xmit buffer size */ - smb_SetSMBParmLong(outp, 5, 65536); /* raw buffer size */ + smb_SetSMBParmLong(outp, 3, SMB_PACKETSIZE); /* xmit buffer size */ + smb_SetSMBParmLong(outp, 5, SMB_MAXRAWSIZE); /* raw buffer size */ + /* The session key is not a well documented field however most clients + * will echo back the session key to the server. Currently we are using + * the same value for all sessions. We should generate a random value + * and store it into the vcp + */ smb_SetSMBParm(outp, 7, 1); /* next 2: session key */ smb_SetSMBParm(outp, 8, 1); /* @@ -2568,30 +2703,100 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * and NT Find * * and NT SMB's * * and raw mode */ - smb_SetSMBParmLong(outp, 9, 0x251); - smb_SetSMBParmLong(outp, 11, 0);/* XXX server time: do we need? */ - smb_SetSMBParmLong(outp, 13, 0);/* XXX server date: do we need? */ - smb_SetSMBParm(outp, 15, 0); /* XXX server tzone: do we need? */ - smb_SetSMBParmByte(outp, 16, 0);/* Encryption key length */ - smb_SetSMBDataLength(outp, 0); /* perhaps should specify 8 bytes anyway */ + caps = NTNEGOTIATE_CAPABILITY_NTSTATUS | + NTNEGOTIATE_CAPABILITY_NTFIND | + NTNEGOTIATE_CAPABILITY_RAWMODE | + NTNEGOTIATE_CAPABILITY_NTSMB; + + if ( smb_authType == SMB_AUTH_EXTENDED ) + caps |= NTNEGOTIATE_CAPABILITY_EXTENDED_SECURITY; + + smb_SetSMBParmLong(outp, 9, caps); + time(&unixTime); + smb_SearchTimeFromUnixTime(&dosTime, unixTime); + smb_SetSMBParmLong(outp, 11, LOWORD(dosTime));/* server time */ + smb_SetSMBParmLong(outp, 13, HIWORD(dosTime));/* server date */ + + GetTimeZoneInformation(&tzi); + smb_SetSMBParm(outp, 15, (unsigned short) tzi.Bias); /* server tzone */ + + if (smb_authType == SMB_AUTH_NTLM) { + smb_SetSMBParmByte(outp, 16, MSV1_0_CHALLENGE_LENGTH);/* Encryption key length */ + smb_SetSMBDataLength(outp, MSV1_0_CHALLENGE_LENGTH + smb_ServerDomainNameLength); + /* paste in encryption key */ + datap = smb_GetSMBData(outp, NULL); + memcpy(datap,vcp->encKey,MSV1_0_CHALLENGE_LENGTH); + /* and the faux domain name */ + strcpy(datap + MSV1_0_CHALLENGE_LENGTH,smb_ServerDomainName); + } else if ( smb_authType == SMB_AUTH_EXTENDED ) { + void * secBlob; + int secBlobLength; + + smb_SetSMBParmByte(outp, 16, 0); /* Encryption key length */ + + smb_NegotiateExtendedSecurity(&secBlob, &secBlobLength); + + smb_SetSMBDataLength(outp, secBlobLength + sizeof(smb_ServerGUID)); + + datap = smb_GetSMBData(outp, NULL); + memcpy(datap, &smb_ServerGUID, sizeof(smb_ServerGUID)); + + if (secBlob) { + datap += sizeof(smb_ServerGUID); + memcpy(datap, secBlob, secBlobLength); + free(secBlob); + } + } else { + smb_SetSMBParmByte(outp, 16, 0); /* Encryption key length */ + smb_SetSMBDataLength(outp, 0); /* Perhaps we should specify 8 bytes anyway */ + } } else if (v3ProtoIndex != -1) { smb_SetSMBParm(outp, 0, protoIndex); - smb_SetSMBParm(outp, 1, 0); /* share level security, no passwd encrypt */ + + /* NOTE: Extended authentication cannot be negotiated with v3 + * therefore we fail over to NTLM + */ + if (smb_authType == SMB_AUTH_NTLM || smb_authType == SMB_AUTH_EXTENDED) { + smb_SetSMBParm(outp, 1, + NEGOTIATE_SECURITY_USER_LEVEL | + NEGOTIATE_SECURITY_CHALLENGE_RESPONSE); /* user level security, challenge response */ + } else { + smb_SetSMBParm(outp, 1, 0); /* share level auth with clear password */ + } smb_SetSMBParm(outp, 2, SMB_PACKETSIZE); smb_SetSMBParm(outp, 3, smb_maxMpxRequests); /* max multiplexed requests */ smb_SetSMBParm(outp, 4, smb_maxVCPerServer); /* max VCs per consumer/server connection */ smb_SetSMBParm(outp, 5, 0); /* no support of block mode for read or write */ smb_SetSMBParm(outp, 6, 1); /* next 2: session key */ smb_SetSMBParm(outp, 7, 1); - smb_SetSMBParm(outp, 8, 0); /* XXX server time: do we need? */ - smb_SetSMBParm(outp, 9, 0); /* XXX server date: do we need? */ - smb_SetSMBParm(outp, 10, 0); /* XXX server tzone: do we need? */ - smb_SetSMBParm(outp, 11, 0); /* resvd */ - smb_SetSMBParm(outp, 12, 0); /* resvd */ - smb_SetSMBDataLength(outp, 0); /* perhaps should specify 8 bytes anyway */ + time(&unixTime); + smb_SearchTimeFromUnixTime(&dosTime, unixTime); + smb_SetSMBParm(outp, 8, LOWORD(dosTime)); /* server time */ + smb_SetSMBParm(outp, 9, HIWORD(dosTime)); /* server date */ + + GetTimeZoneInformation(&tzi); + smb_SetSMBParm(outp, 10, (unsigned short) tzi.Bias); /* server tzone */ + + /* NOTE: Extended authentication cannot be negotiated with v3 + * therefore we fail over to NTLM + */ + if (smb_authType == SMB_AUTH_NTLM || smb_authType == SMB_AUTH_EXTENDED) { + smb_SetSMBParm(outp, 11, MSV1_0_CHALLENGE_LENGTH); /* encryption key length */ + smb_SetSMBParm(outp, 12, 0); /* resvd */ + smb_SetSMBDataLength(outp, MSV1_0_CHALLENGE_LENGTH + smb_ServerDomainNameLength); /* perhaps should specify 8 bytes anyway */ + datap = smb_GetSMBData(outp, NULL); + /* paste in a new encryption key */ + memcpy(datap, vcp->encKey, MSV1_0_CHALLENGE_LENGTH); + /* and the faux domain name */ + strcpy(datap + MSV1_0_CHALLENGE_LENGTH, smb_ServerDomainName); + } else { + smb_SetSMBParm(outp, 11, 0); /* encryption key length */ + smb_SetSMBParm(outp, 12, 0); /* resvd */ + smb_SetSMBDataLength(outp, 0); + } } - else if (coreProtoIndex != -1) { + else if (coreProtoIndex != -1) { /* not really supported anymore */ smb_SetSMBParm(outp, 0, protoIndex); smb_SetSMBDataLength(outp, 0); } @@ -2600,13 +2805,32 @@ long smb_ReceiveNegotiate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) void smb_Daemon(void *parmp) { - int count = 0; + afs_uint32 count = 0; while(1) { count++; thrd_Sleep(10000); - if ((count % 360) == 0) /* every hour */ - smb_CalculateNowTZ(); + if ((count % 72) == 0) { /* every five minutes */ + struct tm myTime; + long old_localZero = smb_localZero; + + /* Initialize smb_localZero */ + myTime.tm_isdst = -1; /* compute whether on DST or not */ + myTime.tm_year = 70; + myTime.tm_mon = 0; + myTime.tm_mday = 1; + myTime.tm_hour = 0; + myTime.tm_min = 0; + myTime.tm_sec = 0; + smb_localZero = mktime(&myTime); + + smb_CalculateNowTZ(); + +#ifdef AFS_FREELANCE + if ( smb_localZero != old_localZero ) + cm_noteLocalMountPointChange(); +#endif + } /* XXX GC dir search entries */ } } @@ -2953,17 +3177,25 @@ long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp, for(patchp = *dirPatchespp; patchp; patchp = (smb_dirListPatch_t *) osi_QNext(&patchp->q)) { - code = cm_GetSCache(&patchp->fid, &scp, userp, reqp); - if (code) continue; + + dptr = patchp->dptr; + + code = cm_GetSCache(&patchp->fid, &scp, userp, reqp); + if (code) { + if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + *dptr++ = SMB_ATTR_HIDDEN; + continue; + } lock_ObtainMutex(&scp->mx); code = cm_SyncOp(scp, NULL, userp, reqp, 0, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); + if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + *dptr++ = SMB_ATTR_HIDDEN; continue; } - dptr = patchp->dptr; attr = smb_Attributes(scp); /* check hidden attribute (the flag is only ON when dot file hiding is on ) */ @@ -2971,7 +3203,7 @@ long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp, attr |= SMB_ATTR_HIDDEN; *dptr++ = attr; - /* get dos time */ + /* get dos time */ smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime); /* copy out time */ @@ -3140,7 +3372,14 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou spacep = inp->spacep; smb_StripLastComponent(spacep->data, NULL, pathp); lock_ReleaseMutex(&dsp->mx); - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + lock_ReleaseMutex(&dsp->mx); + cm_ReleaseUser(userp); + smb_DeleteDirSearch(dsp); + smb_ReleaseDirSearch(dsp); + return CM_ERROR_NOFILES; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &scp); lock_ObtainMutex(&dsp->mx); @@ -3365,7 +3604,7 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou fid.unique = ntohl(dep->fid.unique); fileType = cm_FindFileType(&fid); osi_Log2(smb_logp, "smb_ReceiveCoreSearchDir: file %s " - "has filetype %d", dep->name, + "has filetype %d", osi_LogSaveString(smb_logp, dep->name), fileType); if (fileType == CM_SCACHETYPE_DIRECTORY) goto nextEntry; @@ -3517,7 +3756,11 @@ long smb_ReceiveCoreCheckPath(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(rootScp, pathp, caseFold | CM_FLAG_FOLLOW | CM_FLAG_CHECKPATH, userp, tidPathp, &req, &newScp); @@ -3586,7 +3829,11 @@ long smb_ReceiveCoreSetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHFILE; + } code = cm_NameI(rootScp, pathp, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &newScp); @@ -3684,7 +3931,11 @@ long smb_ReceiveCoreGetFileAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_pack /* we shouldn't need this for V3 requests, but we seem to */ caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHFILE; + } /* * XXX Strange hack XXX @@ -3862,7 +4113,11 @@ long smb_ReceiveCoreOpen(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, pathp, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &scp); @@ -4012,7 +4267,11 @@ long smb_ReceiveCoreUnlink(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) caseFold = CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold, userp, tidPathp, &req, &dscp); @@ -4162,7 +4421,11 @@ long smb_ReceiveCoreRename(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) */ caseFold = CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold, userp, tidPathp, &req, &oldDscp); @@ -4212,7 +4475,7 @@ long smb_ReceiveCoreRename(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* Check if the file already exists; if so return error */ code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&req,&tmpscp); if ((code != CM_ERROR_NOSUCHFILE) && (code != CM_ERROR_NOSUCHPATH) && (code != CM_ERROR_NOSUCHVOLUME) ) { - osi_Log2(afsd_logp, " lookup returns %ld for [%s]", code, + osi_Log2(smb_logp, " lookup returns %ld for [%s]", code, osi_LogSaveString(afsd_logp, newLastNamep)); /* Check if the old and the new names differ only in case. If so return @@ -4234,7 +4497,7 @@ long smb_ReceiveCoreRename(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) } } else { /* file exist, do not rename, also fixes move */ - osi_Log0(afsd_logp, "Can't rename. Target already exists"); + osi_Log0(smb_logp, "Can't rename. Target already exists"); code = CM_ERROR_EXISTS; } @@ -4361,7 +4624,11 @@ long smb_ReceiveCoreRemoveDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &dscp); @@ -4758,6 +5025,9 @@ long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op, DWORD filter = 0; cm_req_t req; + osi_Log3(smb_logp, "smb_WriteData fid %d, off 0x%x, size 0x%x", + fidp->fid, offsetp->LowPart, count); + cm_InitReq(&req); bufferp = NULL; @@ -4769,10 +5039,14 @@ long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op, lock_ObtainMutex(&scp->mx); /* start by looking up the file's end */ + osi_Log1(smb_logp, "smb_WriteData fid %d calling cm_SyncOp NEEDCALLBACK|SETSTATUS|GETSTATUS", + fidp->fid); code = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_SETSTATUS | CM_SCACHESYNC_GETSTATUS); + osi_Log2(smb_logp, "smb_WriteData fid %d calling cm_SyncOp NEEDCALLBACK|SETSTATUS|GETSTATUS returns %d", + fidp->fid,code); if (code) goto done; @@ -4850,10 +5124,14 @@ long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op, /* now get the data in the cache */ while (1) { + osi_Log1(smb_logp, "smb_WriteData fid %d calling cm_SyncOp NEEDCALLBACK|WRITE|BUFLOCKED", + fidp->fid); code = cm_SyncOp(scp, bufferp, userp, &req, 0, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_WRITE | CM_SCACHESYNC_BUFLOCKED); + osi_Log2(smb_logp, "smb_WriteData fid %d calling cm_SyncOp NEEDCALLBACK|WRITE|BUFLOCKED returns %d", + fidp->fid,code); if (code) goto done; @@ -4956,13 +5234,20 @@ long smb_WriteData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count, char *op, } if (code == 0 && doWriteBack) { + long code2; lock_ObtainMutex(&scp->mx); - cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE); + osi_Log1(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE", + fidp->fid); + code2 = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE); + osi_Log2(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE returns %d", + fidp->fid,code2); lock_ReleaseMutex(&scp->mx); cm_QueueBKGRequest(scp, cm_BkgStore, writeBackOffset.LowPart, writeBackOffset.HighPart, cm_chunkSize, 0, userp); } + osi_Log2(smb_logp, "smb_WriteData fid %d returns %d", + fidp->fid, code); return code; } @@ -4986,7 +5271,7 @@ long smb_ReceiveCoreWrite(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) op = smb_GetSMBData(inp, NULL); op = smb_ParseDataBlock(op, NULL, &inDataBlockCount); - osi_Log3(smb_logp, "smb_ReceiveCoreWrite fd %d, off 0x%x, size 0x%x", + osi_Log3(smb_logp, "smb_ReceiveCoreWrite fid %d, off 0x%x, size 0x%x", fd, offset.LowPart, count); fd = smb_ChainFID(fd, inp); @@ -5346,7 +5631,11 @@ long smb_ReceiveCoreMakeDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW | CM_FLAG_CHECKPATH, @@ -5453,7 +5742,11 @@ long smb_ReceiveCoreCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) caseFold = CM_FLAG_CASEFOLD; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, spacep->data, caseFold | CM_FLAG_FOLLOW, userp, tidPathp, &req, &dscp); @@ -5671,10 +5964,8 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, 1, ncbp->ncb_length, ptbuf, inp); DeregisterEventSource(h); #else /* DJGPP */ - osi_Log1(smb_logp, "SMB message too short, len %d", - ncbp->ncb_length); + osi_Log1(smb_logp, "SMB message too short, len %d", ncbp->ncb_length); #endif /* !DJGPP */ - return; } @@ -5755,10 +6046,9 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1005, NULL, 1, ncbp->ncb_length, ptbuf, smbp); DeregisterEventSource(h); -#else /* DJGPP */ +#endif /* !DJGPP */ osi_Log1(smb_logp, "Pkt straddled session startup, " "ncb length %d", ncbp->ncb_length); -#endif /* !DJGPP */ } } else { @@ -5799,10 +6089,9 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, #ifdef NOTSERVICE smb_LogPacket(inp); #endif /* NOTSERVICE */ -#else /* DJGPP */ +#endif /* !DJGPP */ osi_Log1(smb_logp, "Invalid SMB message, length %d", ncbp->ncb_length); -#endif /* !DJGPP */ code = CM_ERROR_INVAL; } @@ -5822,9 +6111,11 @@ void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp, outWctp = outp->wctp; smbp = (smb_t *) &outp->data; if (code != CM_ERROR_PARTIALWRITE - && code != CM_ERROR_BUFFERTOOSMALL) { + && code != CM_ERROR_BUFFERTOOSMALL + && code != CM_ERROR_GSSCONTINUE) { /* nuke wct and bcc. For a partial - * write, assume they're OK. + * write or an in-process authentication handshake, + * assume they're OK. */ *outWctp++ = 0; *outWctp++ = 0; @@ -5954,23 +6245,23 @@ void smb_ClientWaiter(void *parmp) if (code >= WAIT_ABANDONED_0 && code < (WAIT_ABANDONED_0 + numNCBs)) { int abandonIdx = code - WAIT_ABANDONED_0; - afsi_log("Error: smb_ClientWaiter event %d abandoned, errno %d\n", abandonIdx, GetLastError()); + osi_Log2(smb_logp, "Error: smb_ClientWaiter event %d abandoned, errno %d\n", abandonIdx, GetLastError()); } if (code == WAIT_IO_COMPLETION) { - afsi_log("Error: smb_ClientWaiter WAIT_IO_COMPLETION\n"); + osi_Log0(smb_logp, "Error: smb_ClientWaiter WAIT_IO_COMPLETION\n"); continue; } if (code == WAIT_TIMEOUT) { - afsi_log("Error: smb_ClientWaiter WAIT_TIMEOUT, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ClientWaiter WAIT_TIMEOUT, errno %d\n", GetLastError()); } if (code == WAIT_FAILED) { - afsi_log("Error: smb_ClientWaiter WAIT_FAILED, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ClientWaiter WAIT_FAILED, errno %d\n", GetLastError()); } idx = code - WAIT_OBJECT_0; @@ -5979,7 +6270,7 @@ void smb_ClientWaiter(void *parmp) if (idx < 0 || idx > (sizeof(NCBevents) / sizeof(NCBevents[0]))) { /* this is fatal - log as much as possible */ - afsi_log("Fatal: NCBevents idx [ %d ] out of range.\n", idx); + osi_Log1(smb_logp, "Fatal: NCBevents idx [ %d ] out of range.\n", idx); osi_assert(0); } @@ -6012,23 +6303,23 @@ void smb_ServerWaiter(void *parmp) if (code >= WAIT_ABANDONED_0 && code < (WAIT_ABANDONED_0 + numSessions)) { int abandonIdx = code - WAIT_ABANDONED_0; - afsi_log("Error: smb_ServerWaiter (SessionEvents) event %d abandoned, errno %d\n", abandonIdx, GetLastError()); + osi_Log2(smb_logp, "Error: smb_ServerWaiter (SessionEvents) event %d abandoned, errno %d\n", abandonIdx, GetLastError()); } if (code == WAIT_IO_COMPLETION) { - afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_IO_COMPLETION\n"); + osi_Log0(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_IO_COMPLETION\n"); continue; } if (code == WAIT_TIMEOUT) { - afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_TIMEOUT, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_TIMEOUT, errno %d\n", GetLastError()); } if (code == WAIT_FAILED) { - afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_FAILED, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_FAILED, errno %d\n", GetLastError()); } idx_session = code - WAIT_OBJECT_0; @@ -6037,7 +6328,7 @@ void smb_ServerWaiter(void *parmp) if (idx_session < 0 || idx_session > (sizeof(SessionEvents) / sizeof(SessionEvents[0]))) { /* this is fatal - log as much as possible */ - afsi_log("Fatal: session idx [ %d ] out of range.\n", idx_session); + osi_Log1(smb_logp, "Fatal: session idx [ %d ] out of range.\n", idx_session); osi_assert(0); } @@ -6052,23 +6343,23 @@ void smb_ServerWaiter(void *parmp) if (code >= WAIT_ABANDONED_0 && code < (WAIT_ABANDONED_0 + numNCBs)) { int abandonIdx = code - WAIT_ABANDONED_0; - afsi_log("Error: smb_ClientWaiter (NCBavails) event %d abandoned, errno %d\n", abandonIdx, GetLastError()); + osi_Log2(smb_logp, "Error: smb_ClientWaiter (NCBavails) event %d abandoned, errno %d\n", abandonIdx, GetLastError()); } if (code == WAIT_IO_COMPLETION) { - afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_IO_COMPLETION\n"); + osi_Log0(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_IO_COMPLETION\n"); continue; } if (code == WAIT_TIMEOUT) { - afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_TIMEOUT, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_TIMEOUT, errno %d\n", GetLastError()); } if (code == WAIT_FAILED) { - afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_FAILED, errno %d\n", GetLastError()); + osi_Log1(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_FAILED, errno %d\n", GetLastError()); } idx_NCB = code - WAIT_OBJECT_0; @@ -6077,7 +6368,7 @@ void smb_ServerWaiter(void *parmp) if (idx_NCB < 0 || idx_NCB > (sizeof(NCBsessions) / sizeof(NCBsessions[0]))) { /* this is fatal - log as much as possible */ - afsi_log("Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB); + osi_Log1(smb_logp, "Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB); osi_assert(0); } @@ -6161,23 +6452,23 @@ void smb_Server(VOID *parmp) if (code >= WAIT_ABANDONED_0 && code < (WAIT_ABANDONED_0 + numNCBs)) { int abandonIdx = code - WAIT_ABANDONED_0; - afsi_log("Error: smb_Server ( NCBreturns[%d] ) event %d abandoned, errno %d\n", myIdx, abandonIdx, GetLastError()); + osi_Log3(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) event %d abandoned, errno %d\n", myIdx, abandonIdx, GetLastError()); } if (code == WAIT_IO_COMPLETION) { - afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_IO_COMPLETION\n", myIdx); + osi_Log1(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_IO_COMPLETION\n", myIdx); continue; } if (code == WAIT_TIMEOUT) { - afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_TIMEOUT, errno %d\n", myIdx, GetLastError()); + osi_Log2(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_TIMEOUT, errno %d\n", myIdx, GetLastError()); } if (code == WAIT_FAILED) { - afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_FAILED, errno %d\n", myIdx, GetLastError()); + osi_Log2(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_FAILED, errno %d\n", myIdx, GetLastError()); } idx_NCB = code - WAIT_OBJECT_0; @@ -6186,7 +6477,7 @@ void smb_Server(VOID *parmp) if (idx_NCB < 0 || idx_NCB > (sizeof(NCBs) / sizeof(NCBs[0]))) { /* this is fatal - log as much as possible */ - afsi_log("Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB); + osi_Log1(smb_logp, "Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB); osi_assert(0); } @@ -6214,7 +6505,7 @@ void smb_Server(VOID *parmp) /* Client closed session */ if (reportSessionStartups) { - afsi_log("session [ %d ] closed", idx_session); + osi_Log1(smb_logp, "session [ %d ] closed", idx_session); } dead_sessions[idx_session] = TRUE; if (vcp) @@ -6261,8 +6552,6 @@ void smb_Server(VOID *parmp) char *ptbuf[1]; char s[100]; - osi_Log1(smb_logp, "dispatch smb recv failed, message incomplete, ncb_length %d", - ncbp->ncb_length); h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); sprintf(s, "SMB message incomplete, length %d", ncbp->ncb_length); @@ -6272,14 +6561,13 @@ void smb_Server(VOID *parmp) ncbp->ncb_length, ptbuf, bufp); DeregisterEventSource(h); -#else /* DJGPP */ +#endif /* !DJGPP */ osi_Log1(smb_logp, "dispatch smb recv failed, message incomplete, ncb_length %d", ncbp->ncb_length); osi_Log1(smb_logp, "SMB message incomplete, " "length %d", ncbp->ncb_length); -#endif /* !DJGPP */ /* * We used to discard the packet. @@ -6294,7 +6582,7 @@ void smb_Server(VOID *parmp) /* A weird error code. Log it, sleep, and * continue. */ if (vcp && vcp->errorCount++ > 3) { - afsi_log("session [ %d ] closed, vcp->errorCount = %d", idx_session, vcp->errorCount); + osi_Log2(smb_logp, "session [ %d ] closed, vcp->errorCount = %d", idx_session, vcp->errorCount); dead_sessions[idx_session] = TRUE; } else { @@ -6394,7 +6682,7 @@ void smb_Server(VOID *parmp) if (rwc.code == 0) { rwevent = thrd_CreateEvent(NULL, FALSE, FALSE, TEXT("smb_Server() rwevent")); if ( GetLastError() == ERROR_ALREADY_EXISTS ) - afsi_log("Event Object Already Exists: %s", eventName); + osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName)); ncbp->ncb_command = NCBRECV | ASYNCH; ncbp->ncb_lsn = (unsigned char) vcp->lsn; ncbp->ncb_lana_num = vcp->lana; @@ -6486,17 +6774,17 @@ void InitNCBslot(int idx) sprintf(eventName,"NCBavails[%d]", idx); NCBavails[idx] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName); if ( GetLastError() == ERROR_ALREADY_EXISTS ) - afsi_log("Event Object Already Exists: %s", eventName); + osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName)); #ifndef DJGPP sprintf(eventName,"NCBevents[%d]", idx); NCBevents[idx] = thrd_CreateEvent(NULL, TRUE, FALSE, eventName); if ( GetLastError() == ERROR_ALREADY_EXISTS ) - afsi_log("Event Object Already Exists: %s", eventName); + osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName)); #endif /* !DJGPP */ sprintf(eventName,"NCBReturns[0<=incb_lsn,ncbp->ncb_lana_num, rname); #endif - afsi_log("New session(ncb_lsn,ncb_lana_num) (%d,%d) starting from host %s, %d ongoing ops", - ncbp->ncb_lsn,ncbp->ncb_lana_num, rname, ongoingOps); + osi_Log4(smb_logp, "New session(ncb_lsn,ncb_lana_num) (%d,%d) starting from host %s, %d ongoing ops", + ncbp->ncb_lsn,ncbp->ncb_lana_num, osi_LogSaveString(smb_logp, rname), ongoingOps); if (reportSessionStartups) { #ifndef DJGPP @@ -6657,15 +6945,15 @@ void smb_Listener(void *parmp) 1, 0, ptbuf, NULL); DeregisterEventSource(h); #else /* DJGPP */ - afsi_log("NCBLISTEN completed, call from %s",rname); - osi_Log1(smb_logp, "SMB session startup, %d ongoing ops", - ongoingOps); time(&now); fprintf(stderr, "%s: New session %d starting from host %s\n", asctime(localtime(&now)), ncbp->ncb_lsn, rname); fflush(stderr); #endif /* !DJGPP */ } + osi_Log1(smb_logp, "NCBLISTEN completed, call from %s", osi_LogSaveString(smb_logp, rname)); + osi_Log1(smb_logp, "SMB session startup, %d ongoing ops", + ongoingOps); /* now ncbp->ncb_lsn is the connection ID */ vcp = smb_FindVC(ncbp->ncb_lsn, SMB_FLAG_CREATE, ncbp->ncb_lana_num); @@ -6677,7 +6965,7 @@ void smb_Listener(void *parmp) /* But don't look at session[0], it is reserved */ for (i = 1; i < numSessions; i++) { if (dead_sessions[i]) { - afsi_log("connecting to dead session [ %d ]", i); + osi_Log1(smb_logp, "connecting to dead session [ %d ]", i); dead_sessions[i] = FALSE; break; } @@ -6710,9 +6998,9 @@ void smb_Listener(void *parmp) sprintf(eventName, "SessionEvents[%d]", i); SessionEvents[i] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName); if ( GetLastError() == ERROR_ALREADY_EXISTS ) - afsi_log("Event Object Already Exists: %s", eventName); + osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName)); numSessions++; - afsi_log("increasing numNCBs [ %d ] numSessions [ %d ]", numNCBs, numSessions); + osi_Log2(smb_logp, "increasing numNCBs [ %d ] numSessions [ %d ]", numNCBs, numSessions); thrd_SetEvent(SessionEvents[0]); } else { thrd_SetEvent(SessionEvents[i]); @@ -6760,7 +7048,7 @@ void smb_NetbiosInit() code = Netbios(ncbp); if (code != 0) { sprintf(s, "Netbios NCBENUM error code %d", code); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); osi_panic(s, __FILE__, __LINE__); } } @@ -6782,11 +7070,11 @@ void smb_NetbiosInit() code = ncbp->ncb_retcode; if (code != 0) { sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); lana_list.lana[i] = 255; /* invalid lana */ } else { sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); } } #else @@ -6809,7 +7097,7 @@ void smb_NetbiosInit() memset(smb_sharename,' ',NCBNAMSZ); memcpy(smb_sharename,smb_localNamep,len); sprintf(s, "lana_list.length %d", lana_list.length); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); /* Keep the name so we can unregister it later */ for (l = 0; l < lana_list.length; l++) { @@ -6824,18 +7112,18 @@ void smb_NetbiosInit() code = Netbios(ncbp, dos_ncb); #endif /* !DJGPP */ - afsi_log("Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d", - lana, code, ncbp->ncb_retcode,ncbp->ncb_cmd_cplt); + osi_Log4(smb_logp, "Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d", + lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt); { char name[NCBNAMSZ+1]; name[NCBNAMSZ]=0; memcpy(name,ncbp->ncb_name,NCBNAMSZ); - afsi_log("Netbios NCBADDNAME added new name >%s<",name); + osi_Log1(smb_logp, "Netbios NCBADDNAME added new name >%s<",osi_LogSaveString(smb_logp, name)); } if (code == 0) code = ncbp->ncb_retcode; if (code == 0) { - afsi_log("Netbios NCBADDNAME succeeded on lana %d\n", lana); + osi_Log1(smb_logp, "Netbios NCBADDNAME succeeded on lana %d\n", lana); #ifdef DJGPP /* we only use one LANA with djgpp */ lana_list.lana[0] = lana; @@ -6844,13 +7132,13 @@ void smb_NetbiosInit() } else { sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); if (code == NRC_BRIDGE) { /* invalid LANA num */ lana_list.lana[l] = 255; continue; } else if (code == NRC_DUPNAME) { - afsi_log("Name already exists; try to delete it"); + osi_Log0(smb_logp, "Name already exists; try to delete it"); memset(ncbp, 0, sizeof(*ncbp)); ncbp->ncb_command = NCBDELNAME; memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ); @@ -6863,7 +7151,7 @@ void smb_NetbiosInit() if (code == 0) code = ncbp->ncb_retcode; else { sprintf(s, "Netbios NCBDELNAME lana %d error code %d\n", lana, code); - afsi_log(s); + osi_Log0(smb_logp, s); } if (code != 0 || delname_tried) { lana_list.lana[l] = 255; @@ -6878,7 +7166,7 @@ void smb_NetbiosInit() } else { sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code); - afsi_log(s); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s)); lana_list.lana[l] = 255; /* invalid lana */ osi_panic(s, __FILE__, __LINE__); } @@ -6958,6 +7246,11 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, /* Initialize kludge-GMT */ smb_CalculateNowTZ(); +#ifdef AFS_FREELANCE_CLIENT + /* Make sure the root.afs volume has the correct time */ + cm_noteLocalMountPointChange(); +#endif + /* initialize the remote debugging log */ smb_logp = logp; @@ -7084,6 +7377,10 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, smb_dispatchTable[0x23].procp = smb_ReceiveV3GetAttributes; smb_dispatchTable[0x24].procp = smb_ReceiveV3LockingX; smb_dispatchTable[0x24].flags |= SMB_DISPATCHFLAG_CHAINED; + smb_dispatchTable[0x25].procp = smb_ReceiveV3Trans; + smb_dispatchTable[0x25].flags |= SMB_DISPATCHFLAG_NORESPONSE; + smb_dispatchTable[0x26].procp = smb_ReceiveV3Trans; + smb_dispatchTable[0x26].flags |= SMB_DISPATCHFLAG_NORESPONSE; smb_dispatchTable[0x29].procp = smb_SendCoreBadOp; /* copy file */ smb_dispatchTable[0x2b].procp = smb_ReceiveCoreEcho; /* Set NORESPONSE because smb_ReceiveCoreEcho() does the responses itself */ @@ -7138,8 +7435,87 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, smb_tran2DispatchTable[12].procp = smb_ReceiveTran2FindNotifyNext; smb_tran2DispatchTable[13].procp = smb_ReceiveTran2MKDir; + /* setup the rap dispatch table */ + memset(smb_rapDispatchTable, 0, sizeof(smb_rapDispatchTable)); + smb_rapDispatchTable[0].procp = smb_ReceiveRAPNetShareEnum; + smb_rapDispatchTable[1].procp = smb_ReceiveRAPNetShareGetInfo; + smb_rapDispatchTable[63].procp = smb_ReceiveRAPNetWkstaGetInfo; + smb_rapDispatchTable[13].procp = smb_ReceiveRAPNetServerGetInfo; + smb3_Init(); + /* if we are doing SMB authentication we have register outselves as a logon process */ + if (smb_authType != SMB_AUTH_NONE) { + NTSTATUS nts; + LSA_STRING afsProcessName; + LSA_OPERATIONAL_MODE dummy; /*junk*/ + + afsProcessName.Buffer = "OpenAFSClientDaemon"; + afsProcessName.Length = strlen(afsProcessName.Buffer); + afsProcessName.MaximumLength = afsProcessName.Length + 1; + + nts = LsaRegisterLogonProcess(&afsProcessName, &smb_lsaHandle, &dummy); + + if (nts == STATUS_SUCCESS) { + LSA_STRING packageName; + /* we are registered. Find out the security package id */ + packageName.Buffer = MSV1_0_PACKAGE_NAME; + packageName.Length = strlen(packageName.Buffer); + packageName.MaximumLength = packageName.Length + 1; + nts = LsaLookupAuthenticationPackage(smb_lsaHandle, &packageName , &smb_lsaSecPackage); + if (nts == STATUS_SUCCESS) { + smb_lsaLogonOrigin.Buffer = "OpenAFS"; + smb_lsaLogonOrigin.Length = strlen(smb_lsaLogonOrigin.Buffer); + smb_lsaLogonOrigin.MaximumLength = smb_lsaLogonOrigin.Length + 1; + } else { + afsi_log("Can't determine security package name for NTLM!! NTSTATUS=[%l]",nts); + } + } else { + afsi_log("Can't register logon process!! NTSTATUS=[%l]",nts); + } + + if (nts != STATUS_SUCCESS) { + /* something went wrong. We report the error and revert back to no authentication + because we can't perform any auth requests without a successful lsa handle + or sec package id. */ + afsi_log("Reverting to NO SMB AUTH"); + smb_authType = SMB_AUTH_NONE; + } +#ifdef COMMENT + /* Don't fallback to SMB_AUTH_NTLM. Apparently, allowing SPNEGO to be used each + * time prevents the failure of authentication when logged into Windows with an + * external Kerberos principal mapped to a local account. + */ + else if ( smb_authType == SMB_AUTH_EXTENDED) { + /* Test to see if there is anything to negotiate. If SPNEGO is not going to be used + * then the only option is NTLMSSP anyway; so just fallback. + */ + void * secBlob; + int secBlobLength; + + smb_NegotiateExtendedSecurity(&secBlob, &secBlobLength); + if (secBlobLength == 0) { + smb_authType = SMB_AUTH_NTLM; + afsi_log("Reverting to SMB AUTH NTLM"); + } else + free(secBlob); + } +#endif + } + + { + DWORD bufsize; + /* Now get ourselves a domain name. */ + /* For now we are using the local computer name as the domain name. + * It is actually the domain for local logins, and we are acting as + * a local SMB server. + */ + bufsize = sizeof(smb_ServerDomainName) - 1; + GetComputerName(smb_ServerDomainName, &bufsize); + smb_ServerDomainNameLength = bufsize + 1; /* bufsize doesn't include terminator */ + afsi_log("Setting SMB server domain name to [%s]", smb_ServerDomainName); + } + /* Start listeners, waiters, servers, and daemons */ for (i = 0; i < lana_list.length; i++) { diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index 6396ad0e0..0f72f37c2 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -14,6 +14,8 @@ #include "netbios95.h" #endif /* DJGPP */ +#include + /* basic core protocol SMB structure */ typedef struct smb { unsigned char id[4]; @@ -43,7 +45,35 @@ typedef struct smb { #define SMB_FLAG_CREATE 1 /* create the structure if necessary */ /* max # of bytes we'll receive in an incoming SMB message */ -#define SMB_PACKETSIZE 8400 +/* the maximum is 2^18-1 for NBT and 2^25-1 for Raw transport messages */ +/* we will use something smaller but large enough to be efficient */ +#define SMB_PACKETSIZE 32768 /* was 8400 */ +/* raw mode is considered obsolete and cannot be used with message signing */ +#define SMB_MAXRAWSIZE 65536 + +/* Negotiate protocol constants */ +/* Security */ +#define NEGOTIATE_SECURITY_USER_LEVEL 0x01 +#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02 +#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 +#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 + +/* Capabilities */ +#define NTNEGOTIATE_CAPABILITY_RAWMODE 0x00000001L +#define NTNEGOTIATE_CAPABILITY_MPXMODE 0x00000002L +#define NTNEGOTIATE_CAPABILITY_UNICODE 0x00000004L +#define NTNEGOTIATE_CAPABILITY_LARGEFILES 0x00000008L +#define NTNEGOTIATE_CAPABILITY_NTSMB 0x00000010L +#define NTNEGOTIATE_CAPABILITY_RPCAPI 0x00000020L +#define NTNEGOTIATE_CAPABILITY_NTSTATUS 0x00000040L +#define NTNEGOTIATE_CAPABILITY_LEVEL_II_OPLOCKS 0x00000080L +#define NTNEGOTIATE_CAPABILITY_LOCK_AND_READ 0x00000100L +#define NTNEGOTIATE_CAPABILITY_NTFIND 0x00000200L +#define NTNEGOTIATE_CAPABILITY_DFS 0x00001000L +#define NTNEGOTIATE_CAPABILITY_NT_INFO_PASSTHRU 0x00002000L +#define NTNEGOTIATE_CAPABILITY_BULK_TRANSFER 0x20000000L +#define NTNEGOTIATE_CAPABILITY_COMPRESSED 0x40000000L +#define NTNEGOTIATE_CAPABILITY_EXTENDED_SECURITY 0x80000000L /* a packet structure for receiving SMB messages; locked by smb_globalLock. * Most of the work involved is in handling chained requests and responses. @@ -111,23 +141,27 @@ typedef struct myncb { /* one per virtual circuit */ typedef struct smb_vc { struct smb_vc *nextp; /* not used */ - int refCount; /* the reference count */ - long flags; /* the flags, if any; locked by mx */ - osi_mutex_t mx; /* the mutex */ + int refCount; /* the reference count */ + long flags; /* the flags, if any; locked by mx */ + osi_mutex_t mx; /* the mutex */ long vcID; /* VC id */ - unsigned short lsn; /* the NCB LSN associated with this */ + unsigned short lsn; /* the NCB LSN associated with this */ unsigned short uidCounter; /* session ID counter */ - unsigned short tidCounter; /* tree ID counter */ - unsigned short fidCounter; /* file handle ID counter */ - struct smb_tid *tidsp; /* the first child in the tid list */ - struct smb_user *usersp; /* the first child in the user session list */ - struct smb_fid *fidsp; /* the first child in the open file list */ + unsigned short tidCounter; /* tree ID counter */ + unsigned short fidCounter; /* file handle ID counter */ + struct smb_tid *tidsp; /* the first child in the tid list */ + struct smb_user *usersp; /* the first child in the user session list */ + struct smb_fid *fidsp; /* the first child in the open file list */ struct smb_user *justLoggedOut; /* ready for profile upload? */ unsigned long logoffTime; /* tick count when logged off */ /*struct cm_user *logonDLLUser; /* integrated logon user */ unsigned char errorCount; - char rname[17]; + char rname[17]; int lana; + char encKey[MSV1_0_CHALLENGE_LENGTH]; /* MSV1_0_CHALLENGE_LENGTH is 8 */ + void * secCtx; /* security context when negotiating SMB extended auth + * valid when SMB_VCFLAG_AUTH_IN_PROGRESS is set + */ } smb_vc_t; /* have we negotiated ... */ @@ -137,6 +171,8 @@ typedef struct smb_vc { #define SMB_VCFLAG_STATUS32 8 /* use 32-bit NT status codes */ #define SMB_VCFLAG_REMOTECONN 0x10 /* bad: remote conns not allowed */ #define SMB_VCFLAG_ALREADYDEAD 0x20 /* do not get tokens from this vc */ +#define SMB_VCFLAG_SESSX_RCVD 0x40 /* we received at least one session setups on this vc */ +#define SMB_VCFLAG_AUTH_IN_PROGRESS 0x80 /* a SMB NT extended authentication is in progress */ /* one per user session */ typedef struct smb_user { @@ -161,6 +197,8 @@ typedef struct smb_username { #define SMB_USERFLAG_DELETE 1 /* delete struct when ref count zero */ +#define SMB_MAX_USERNAME_LENGTH 256 + /* one per tree-connect */ typedef struct smb_tid { struct smb_tid *nextp; /* next sibling */ @@ -175,6 +213,7 @@ typedef struct smb_tid { } smb_tid_t; #define SMB_TIDFLAG_DELETE 1 /* delete struct when ref count zero */ +#define SMB_TIDFLAG_IPC 2 /* IPC$ */ /* one per process ID */ typedef struct smb_pid { @@ -339,17 +378,17 @@ extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt, #endif ); -extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime); +extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime); -extern void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep); +extern void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep); -extern void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime); +extern void smb_SearchTimeFromUnixTime(long *dosTimep, afs_uint32 unixTime); -extern void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime); +extern void smb_UnixTimeFromSearchTime(afs_uint32 *unixTimep, long searchTime); -extern void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime); +extern void smb_DosUTimeFromUnixTime(afs_uint32 *dosUTimep, afs_uint32 unixTime); -extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime); +extern void smb_UnixTimeFromDosUTime(afs_uint32 *unixTimep, afs_uint32 dosUTime); extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana); @@ -373,7 +412,7 @@ extern void smb_ReleaseUID(smb_user_t *uidp); extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp); -extern char *smb_GetTIDPath(smb_vc_t *vcp, unsigned short tid); +extern long smb_LookupTIDPath(smb_vc_t *vcp, unsigned short tid, char ** tidPathp); extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags); @@ -433,6 +472,7 @@ extern void smb_MapNTError(long code, unsigned long *NTStatusp); extern void smb_HoldVC(smb_vc_t *vcp); /* some globals, too */ +extern char *smb_localNamep; extern int loggedOut; extern unsigned long loggedOutTime; extern char *loggedOutName; @@ -453,13 +493,48 @@ extern int smb_maxMpxRequests; /* max # of mpx requests */ extern int smb_hideDotFiles; extern unsigned int smb_IsDotFile(char *lastComp); +/* the following are used for smb auth */ +extern int smb_authType; /* Type of SMB authentication to be used. One from below. */ + +#define SMB_AUTH_NONE 0 +#define SMB_AUTH_NTLM 1 +#define SMB_AUTH_EXTENDED 2 + +extern HANDLE smb_lsaHandle; /* LSA handle obtained during smb_init if using SMB auth */ +extern ULONG smb_lsaSecPackage; /* LSA security package id. Set during smb_init */ +extern char smb_ServerDomainName[]; +extern int smb_ServerDomainNameLength; +extern char smb_ServerOS[]; +extern int smb_ServerOSLength; +extern char smb_ServerLanManager[]; +extern int smb_ServerLanManagerLength; +extern GUID smb_ServerGUID; +extern LSA_STRING smb_lsaLogonOrigin; + +/* used for getting a challenge for SMB auth */ +typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST { + MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; +} MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST; + +typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE { + MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; + UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH]; +} MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE; +/**/ + +extern long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDomain, char * ciPwd, unsigned ciPwdLength, char * csPwd, unsigned csPwdLength); + +extern long smb_GetNormalizedUsername(char * usern, const char * accountName, const char * domainName); + extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *op); -extern char *myCrt_2Dispatch(int i); +extern char *myCrt_Dispatch(int i); extern char *myCrt_2Dispatch(int i); +extern char *myCrt_RapDispatch(int i); + extern unsigned int smb_Attributes(cm_scache_t *scp); extern int smb_ChainFID(int fid, smb_packet_t *inp); diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 8d3669e73..396859821 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -12,6 +12,9 @@ #ifndef DJGPP #include +#define SECURITY_WIN32 +#include +#include #endif /* !DJGPP */ #include #include @@ -32,6 +35,8 @@ osi_mutex_t smb_Dir_Watch_Lock; smb_tran2Dispatch_t smb_tran2DispatchTable[SMB_TRAN2_NOPCODES]; +smb_tran2Dispatch_t smb_rapDispatchTable[SMB_RAP_NOPCODES]; + /* protected by the smb_globalLock */ smb_tran2Packet_t *smb_tran2AssemblyQueuep; @@ -106,35 +111,680 @@ unsigned char *smb_ParseString(unsigned char *inp, char **chainpp) return inp; } +/*DEBUG do not checkin*/ +void OutputDebugF(char * format, ...) { + va_list args; + int len; + char * buffer; + + va_start( args, format ); + len = _vscprintf( format, args ) // _vscprintf doesn't count + + 3; // terminating '\0' + '\n' + buffer = malloc( len * sizeof(char) ); + vsprintf( buffer, format, args ); + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, buffer)); + strcat(buffer, "\n"); + OutputDebugString(buffer); + free( buffer ); +} + +void OutputDebugHexDump(unsigned char * buffer, int len) { + int i,j,k; + char buf[256]; + static char tr[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + + OutputDebugF("Hexdump length [%d]",len); + + for(i=0;i7)?1:0); + k = buffer[i]; + + buf[j] = tr[k / 16]; buf[j+1] = tr[k % 16]; + + j = (i%16); + j = j + 56 + ((j>7)?1:0); + + buf[j] = (k>32 && k<127)?k:'.'; + } + if(i) { + osi_Log0(smb_logp, osi_LogSaveString(smb_logp, buf)); + strcat(buf,"\n"); + OutputDebugString(buf); +} +} +/**/ + +#define SMB_EXT_SEC_PACKAGE_NAME "Negotiate" +void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength){ + SECURITY_STATUS status, istatus; + CredHandle creds = {0,0}; + TimeStamp expiry; + SecBufferDesc secOut; + SecBuffer secTok; + CtxtHandle ctx; + ULONG flags; + + *secBlob = NULL; + *secBlobLength = 0; + + OutputDebugF("Negotiating Extended Security"); + + status = AcquireCredentialsHandle( + NULL, + SMB_EXT_SEC_PACKAGE_NAME, + SECPKG_CRED_INBOUND, + NULL, + NULL, + NULL, + NULL, + &creds, + &expiry); + + if (status != SEC_E_OK) { + /* Really bad. We return an empty security blob */ + OutputDebugF("AcquireCredentialsHandle failed with %lX", status); + goto nes_0; + } + + secOut.cBuffers = 1; + secOut.pBuffers = &secTok; + secOut.ulVersion = SECBUFFER_VERSION; + + secTok.BufferType = SECBUFFER_TOKEN; + secTok.cbBuffer = 0; + secTok.pvBuffer = NULL; + + ctx.dwLower = ctx.dwUpper = 0; + + status = AcceptSecurityContext( + &creds, + NULL, + NULL, + ASC_REQ_CONNECTION | ASC_REQ_EXTENDED_ERROR | ASC_REQ_ALLOCATE_MEMORY, + SECURITY_NETWORK_DREP, + &ctx, + &secOut, + &flags, + &expiry + ); + + if (status == SEC_I_COMPLETE_NEEDED || status == SEC_I_COMPLETE_AND_CONTINUE) { + OutputDebugF("Completing token..."); + istatus = CompleteAuthToken(&ctx, &secOut); + if ( istatus != SEC_E_OK ) + OutputDebugF("Token completion failed: %x", istatus); + } + + if (status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) { + if (secTok.pvBuffer) { + *secBlobLength = secTok.cbBuffer; + *secBlob = malloc( secTok.cbBuffer ); + memcpy(*secBlob, secTok.pvBuffer, secTok.cbBuffer ); + } + } else { + if ( status != SEC_E_OK ) + OutputDebugF("AcceptSecurityContext status != CONTINUE %lX", status); + } + + /* Discard partial security context */ + DeleteSecurityContext(&ctx); + + if (secTok.pvBuffer) FreeContextBuffer( secTok.pvBuffer ); + + /* Discard credentials handle. We'll reacquire one when we get the session setup X */ + FreeCredentialsHandle(&creds); + + nes_0: + return; +} + +struct smb_ext_context { + CredHandle creds; + CtxtHandle ctx; + int partialTokenLen; + void * partialToken; +}; + +long smb_AuthenticateUserExt(smb_vc_t * vcp, char * usern, char * secBlobIn, int secBlobInLength, char ** secBlobOut, int * secBlobOutLength) { + SECURITY_STATUS status, istatus; + CredHandle creds; + TimeStamp expiry; + long code = 0; + SecBufferDesc secBufIn; + SecBuffer secTokIn; + SecBufferDesc secBufOut; + SecBuffer secTokOut; + CtxtHandle ctx; + struct smb_ext_context * secCtx = NULL; + struct smb_ext_context * newSecCtx = NULL; + void * assembledBlob = NULL; + int assembledBlobLength = 0; + ULONG flags; + + OutputDebugF("In smb_AuthenticateUserExt"); + + *secBlobOut = NULL; + *secBlobOutLength = 0; + + if (vcp->flags & SMB_VCFLAG_AUTH_IN_PROGRESS) { + secCtx = vcp->secCtx; + lock_ObtainMutex(&vcp->mx); + vcp->flags &= ~SMB_VCFLAG_AUTH_IN_PROGRESS; + vcp->secCtx = NULL; + lock_ReleaseMutex(&vcp->mx); + } + + if (secBlobIn) { + OutputDebugF("Received incoming token:"); + OutputDebugHexDump(secBlobIn,secBlobInLength); + } + + if (secCtx) { + OutputDebugF("Continuing with existing context."); + creds = secCtx->creds; + ctx = secCtx->ctx; + + if (secCtx->partialToken) { + assembledBlobLength = secCtx->partialTokenLen + secBlobInLength; + assembledBlob = malloc(assembledBlobLength); + memcpy(assembledBlob,secCtx->partialToken, secCtx->partialTokenLen); + memcpy(((BYTE *)assembledBlob) + secCtx->partialTokenLen, secBlobIn, secBlobInLength); + } + } else { + status = AcquireCredentialsHandle( + NULL, + SMB_EXT_SEC_PACKAGE_NAME, + SECPKG_CRED_INBOUND, + NULL, + NULL, + NULL, + NULL, + &creds, + &expiry); + + if (status != SEC_E_OK) { + OutputDebugF("Can't acquire Credentials handle [%lX]", status); + code = CM_ERROR_BADPASSWORD; /* means "try again when I'm sober" */ + goto aue_0; + } + + ctx.dwLower = 0; + ctx.dwUpper = 0; + } + + secBufIn.cBuffers = 1; + secBufIn.pBuffers = &secTokIn; + secBufIn.ulVersion = SECBUFFER_VERSION; + + secTokIn.BufferType = SECBUFFER_TOKEN; + if (assembledBlob) { + secTokIn.cbBuffer = assembledBlobLength; + secTokIn.pvBuffer = assembledBlob; + } else { + secTokIn.cbBuffer = secBlobInLength; + secTokIn.pvBuffer = secBlobIn; + } + + secBufOut.cBuffers = 1; + secBufOut.pBuffers = &secTokOut; + secBufOut.ulVersion = SECBUFFER_VERSION; + + secTokOut.BufferType = SECBUFFER_TOKEN; + secTokOut.cbBuffer = 0; + secTokOut.pvBuffer = NULL; + + status = AcceptSecurityContext( + &creds, + ((secCtx)?&ctx:NULL), + &secBufIn, + ASC_REQ_CONNECTION | ASC_REQ_EXTENDED_ERROR | ASC_REQ_ALLOCATE_MEMORY, + SECURITY_NETWORK_DREP, + &ctx, + &secBufOut, + &flags, + &expiry + ); + + if (status == SEC_I_COMPLETE_NEEDED || status == SEC_I_COMPLETE_AND_CONTINUE) { + OutputDebugF("Completing token..."); + istatus = CompleteAuthToken(&ctx, &secBufOut); + if ( istatus != SEC_E_OK ) + OutputDebugF("Token completion failed: %lX", istatus); + } + + if (status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) { + OutputDebugF("Continue needed"); + + newSecCtx = malloc(sizeof(*newSecCtx)); + + newSecCtx->creds = creds; + newSecCtx->ctx = ctx; + newSecCtx->partialToken = NULL; + newSecCtx->partialTokenLen = 0; + + lock_ObtainMutex( &vcp->mx ); + vcp->flags |= SMB_VCFLAG_AUTH_IN_PROGRESS; + vcp->secCtx = newSecCtx; + lock_ReleaseMutex( &vcp->mx ); + + code = CM_ERROR_GSSCONTINUE; + } + + if ((status == SEC_I_COMPLETE_NEEDED || status == SEC_E_OK || + status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) && + secTokOut.pvBuffer) { + OutputDebugF("Need to send token back to client"); + + *secBlobOutLength = secTokOut.cbBuffer; + *secBlobOut = malloc(secTokOut.cbBuffer); + memcpy(*secBlobOut, secTokOut.pvBuffer, secTokOut.cbBuffer); + + OutputDebugF("Outgoing token:"); + OutputDebugHexDump(*secBlobOut,*secBlobOutLength); + } else if (status == SEC_E_INCOMPLETE_MESSAGE) { + OutputDebugF("Incomplete message"); + + newSecCtx = malloc(sizeof(*newSecCtx)); + + newSecCtx->creds = creds; + newSecCtx->ctx = ctx; + newSecCtx->partialToken = malloc(secTokOut.cbBuffer); + memcpy(newSecCtx->partialToken, secTokOut.pvBuffer, secTokOut.cbBuffer); + newSecCtx->partialTokenLen = secTokOut.cbBuffer; + + lock_ObtainMutex( &vcp->mx ); + vcp->flags |= SMB_VCFLAG_AUTH_IN_PROGRESS; + vcp->secCtx = newSecCtx; + lock_ReleaseMutex( &vcp->mx ); + + code = CM_ERROR_GSSCONTINUE; + } + + if (status == SEC_E_OK || status == SEC_I_COMPLETE_NEEDED) { + /* woo hoo! */ + SecPkgContext_Names names; + + OutputDebugF("Authentication completed"); + OutputDebugF("Returned flags : [%lX]", flags); + + if (!QueryContextAttributes(&ctx, SECPKG_ATTR_NAMES, &names)) { + OutputDebugF("Received name [%s]", names.sUserName); + strcpy(usern, names.sUserName); + strlwr(usern); /* in tandem with smb_GetNormalizedUsername */ + FreeContextBuffer(names.sUserName); + } else { + /* Force the user to retry if the context is invalid */ + OutputDebugF("QueryContextAttributes Names failed [%x]", GetLastError()); + code = CM_ERROR_BADPASSWORD; + } + } else if (!code) { + switch ( status ) { + case SEC_E_INVALID_TOKEN: + OutputDebugF("Returning bad password :: INVALID_TOKEN"); + break; + case SEC_E_INVALID_HANDLE: + OutputDebugF("Returning bad password :: INVALID_HANDLE"); + break; + case SEC_E_LOGON_DENIED: + OutputDebugF("Returning bad password :: LOGON_DENIED"); + break; + case SEC_E_UNKNOWN_CREDENTIALS: + OutputDebugF("Returning bad password :: UNKNOWN_CREDENTIALS"); + break; + case SEC_E_NO_CREDENTIALS: + OutputDebugF("Returning bad password :: NO_CREDENTIALS"); + break; + case SEC_E_CONTEXT_EXPIRED: + OutputDebugF("Returning bad password :: CONTEXT_EXPIRED"); + break; + case SEC_E_INCOMPLETE_CREDENTIALS: + OutputDebugF("Returning bad password :: INCOMPLETE_CREDENTIALS"); + break; + case SEC_E_WRONG_PRINCIPAL: + OutputDebugF("Returning bad password :: WRONG_PRINCIPAL"); + break; + case SEC_E_TIME_SKEW: + OutputDebugF("Returning bad password :: TIME_SKEW"); + break; + default: + OutputDebugF("Returning bad password :: Status == %lX", status); + } + code = CM_ERROR_BADPASSWORD; + } + + if (secCtx) { + if (secCtx->partialToken) free(secCtx->partialToken); + free(secCtx); + } + + if (assembledBlob) { + free(assembledBlob); + } + + if (secTokOut.pvBuffer) + FreeContextBuffer(secTokOut.pvBuffer); + + if (code != CM_ERROR_GSSCONTINUE) { + DeleteSecurityContext(&ctx); + FreeCredentialsHandle(&creds); + } + + aue_0: + return code; +} + +#define P_LEN 256 +#define P_RESP_LEN 128 + +/* LsaLogonUser expects input parameters to be in a contiguous block of memory. + So put stuff in a struct. */ +struct Lm20AuthBlob { + MSV1_0_LM20_LOGON lmlogon; + BYTE ciResponse[P_RESP_LEN]; /* Unicode representation */ + BYTE csResponse[P_RESP_LEN]; /* ANSI representation */ + WCHAR accountNameW[P_LEN]; + WCHAR primaryDomainW[P_LEN]; + WCHAR workstationW[MAX_COMPUTERNAME_LENGTH + 1]; + TOKEN_GROUPS tgroups; + TOKEN_SOURCE tsource; +}; + +long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDomain, char * ciPwd, unsigned ciPwdLength, char * csPwd, unsigned csPwdLength) { + + NTSTATUS nts, ntsEx; + struct Lm20AuthBlob lmAuth; + PMSV1_0_LM20_LOGON_PROFILE lmprofilep; + QUOTA_LIMITS quotaLimits; + DWORD size; + ULONG lmprofilepSize; + LUID lmSession; + HANDLE lmToken; + + OutputDebugF("In smb_AuthenticateUser for user [%s] domain [%s]", accountName, primaryDomain); + OutputDebugF("ciPwdLength is %d and csPwdLength is %d", ciPwdLength, csPwdLength); + + if (ciPwdLength > P_RESP_LEN || csPwdLength > P_RESP_LEN) { + OutputDebugF("ciPwdLength or csPwdLength is too long"); + return CM_ERROR_BADPASSWORD; + } + + memset(&lmAuth,0,sizeof(lmAuth)); + + lmAuth.lmlogon.MessageType = MsV1_0NetworkLogon; + + lmAuth.lmlogon.LogonDomainName.Buffer = lmAuth.primaryDomainW; + mbstowcs(lmAuth.primaryDomainW, primaryDomain, P_LEN); + lmAuth.lmlogon.LogonDomainName.Length = wcslen(lmAuth.primaryDomainW) * sizeof(WCHAR); + lmAuth.lmlogon.LogonDomainName.MaximumLength = P_LEN * sizeof(WCHAR); + + lmAuth.lmlogon.UserName.Buffer = lmAuth.accountNameW; + mbstowcs(lmAuth.accountNameW, accountName, P_LEN); + lmAuth.lmlogon.UserName.Length = wcslen(lmAuth.accountNameW) * sizeof(WCHAR); + lmAuth.lmlogon.UserName.MaximumLength = P_LEN * sizeof(WCHAR); + + lmAuth.lmlogon.Workstation.Buffer = lmAuth.workstationW; + lmAuth.lmlogon.Workstation.MaximumLength = (MAX_COMPUTERNAME_LENGTH + 1) * sizeof(WCHAR); + size = MAX_COMPUTERNAME_LENGTH + 1; + GetComputerNameW(lmAuth.workstationW, &size); + lmAuth.lmlogon.Workstation.Length = wcslen(lmAuth.workstationW) * sizeof(WCHAR); + + memcpy(lmAuth.lmlogon.ChallengeToClient, vcp->encKey, MSV1_0_CHALLENGE_LENGTH); + + lmAuth.lmlogon.CaseInsensitiveChallengeResponse.Buffer = lmAuth.ciResponse; + lmAuth.lmlogon.CaseInsensitiveChallengeResponse.Length = ciPwdLength; + lmAuth.lmlogon.CaseInsensitiveChallengeResponse.MaximumLength = P_RESP_LEN; + memcpy(lmAuth.ciResponse, ciPwd, ciPwdLength); + + lmAuth.lmlogon.CaseSensitiveChallengeResponse.Buffer = lmAuth.csResponse; + lmAuth.lmlogon.CaseSensitiveChallengeResponse.Length = csPwdLength; + lmAuth.lmlogon.CaseSensitiveChallengeResponse.MaximumLength = P_RESP_LEN; + memcpy(lmAuth.csResponse, csPwd, csPwdLength); + + lmAuth.lmlogon.ParameterControl = 0; + + lmAuth.tgroups.GroupCount = 0; + lmAuth.tgroups.Groups[0].Sid = NULL; + lmAuth.tgroups.Groups[0].Attributes = 0; + + lmAuth.tsource.SourceIdentifier.HighPart = 0; + lmAuth.tsource.SourceIdentifier.LowPart = (DWORD) vcp; + strcpy(lmAuth.tsource.SourceName,"OpenAFS"); /* 8 char limit */ + + nts = LsaLogonUser( + smb_lsaHandle, + &smb_lsaLogonOrigin, + Network, /*3*/ + smb_lsaSecPackage, + &lmAuth, + sizeof(lmAuth), + &lmAuth.tgroups, + &lmAuth.tsource, + &lmprofilep, + &lmprofilepSize, + &lmSession, + &lmToken, + "aLimits, + &ntsEx); + + OutputDebugF("Return from LsaLogonUser is 0x%lX", nts); + OutputDebugF("Extended status is 0x%lX", ntsEx); + + if (nts == ERROR_SUCCESS) { + /* free the token */ + LsaFreeReturnBuffer(lmprofilep); + CloseHandle(lmToken); + return 0; + } else { + /* No AFS for you */ + if (nts == 0xC000015BL) + return CM_ERROR_BADLOGONTYPE; + else /* our catchall is a bad password though we could be more specific */ + return CM_ERROR_BADPASSWORD; + } +} + +/* The buffer pointed to by usern is assumed to be at least SMB_MAX_USERNAME_LENGTH bytes */ +long smb_GetNormalizedUsername(char * usern, const char * accountName, const char * domainName) { + + char * atsign; + const char * domain; + + /* check if we have sane input */ + if ((strlen(accountName) + strlen(domainName) + 1) > SMB_MAX_USERNAME_LENGTH) + return 1; + + /* we could get : [accountName][domainName] + [user][domain] + [user@domain][] + [user][]/[user][?] + [][]/[][?] */ + + atsign = strchr(accountName, '@'); + + if (atsign) /* [user@domain][] -> [user@domain][domain] */ + domain = atsign + 1; + else + domain = domainName; + + /* if for some reason the client doesn't know what domain to use, + it will either return an empty string or a '?' */ + if (!domain[0] || domain[0] == '?') + /* Empty domains and empty usernames are usually sent from tokenless contexts. + This way such logins will get an empty username (easy to check). I don't know + when a non-empty username would be supplied with an anonymous domain, but *shrug* */ + strcpy(usern,accountName); + else { + /* TODO: what about WIN.MIT.EDU\user vs. WIN\user? */ + strcpy(usern,domain); + strcat(usern,"\\"); + if (atsign) + strncat(usern,accountName,atsign - accountName); + else + strcat(usern,accountName); + } + + strlwr(usern); + + return 0; +} + +/* When using SMB auth, all SMB sessions have to pass through here first to + * authenticate the user. + * Caveat: If not use the SMB auth the protocol does not require sending a + * session setup packet, which means that we can't rely on a UID in subsequent + * packets. Though in practice we get one anyway. + */ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) { char *tp; - char *usern, *pwd, *pwdx; smb_user_t *uidp; unsigned short newUid; - unsigned long caps; + unsigned long caps = 0; cm_user_t *userp; smb_username_t *unp; char *s1 = " "; + long code = 0; + char usern[SMB_MAX_USERNAME_LENGTH]; + char *secBlobOut = NULL; + int secBlobOutLength = 0; /* Check for bad conns */ if (vcp->flags & SMB_VCFLAG_REMOTECONN) return CM_ERROR_REMOTECONN; - /* For NT LM 0.12 and up, get capabilities */ if (vcp->flags & SMB_VCFLAG_USENT) { - caps = smb_GetSMBParm(inp, 11); - if (caps & 0x40) + if (smb_authType == SMB_AUTH_EXTENDED) { + /* extended authentication */ + char *secBlobIn; + int secBlobInLength; + + if (!(vcp->flags & SMB_VCFLAG_SESSX_RCVD)) { + caps = smb_GetSMBParm(inp,10) | (((unsigned long) smb_GetSMBParm(inp,11)) << 16); + } + + secBlobInLength = smb_GetSMBParm(inp, 7); + secBlobIn = smb_GetSMBData(inp, NULL); + + code = smb_AuthenticateUserExt(vcp, usern, secBlobIn, secBlobInLength, &secBlobOut, &secBlobOutLength); + + if (code == CM_ERROR_GSSCONTINUE) { + smb_SetSMBParm(outp, 2, 0); + smb_SetSMBParm(outp, 3, secBlobOutLength); + smb_SetSMBDataLength(outp, secBlobOutLength + smb_ServerOSLength + smb_ServerLanManagerLength + smb_ServerDomainNameLength); + tp = smb_GetSMBData(outp, NULL); + if (secBlobOutLength) { + memcpy(tp, secBlobOut, secBlobOutLength); + free(secBlobOut); + tp += secBlobOutLength; + } + memcpy(tp,smb_ServerOS,smb_ServerOSLength); + tp += smb_ServerOSLength; + memcpy(tp,smb_ServerLanManager,smb_ServerLanManagerLength); + tp += smb_ServerLanManagerLength; + memcpy(tp,smb_ServerDomainName,smb_ServerDomainNameLength); + tp += smb_ServerDomainNameLength; + } + + /* TODO: handle return code and continue auth. Also free secBlobOut if applicable. */ + } else { + unsigned ciPwdLength, csPwdLength; + char *ciPwd, *csPwd; + char *accountName; + char *primaryDomain; + int datalen; + + /* TODO: parse for extended auth as well */ + ciPwdLength = smb_GetSMBParm(inp, 7); /* case insensitive password length */ + csPwdLength = smb_GetSMBParm(inp, 8); /* case sensitive password length */ + + tp = smb_GetSMBData(inp, &datalen); + + OutputDebugF("Session packet data size [%d]",datalen); + + ciPwd = tp; + tp += ciPwdLength; + csPwd = tp; + tp += csPwdLength; + + accountName = smb_ParseString(tp, &tp); + primaryDomain = smb_ParseString(tp, NULL); + + if (smb_GetNormalizedUsername(usern, accountName, primaryDomain)) { + /* shouldn't happen */ + code = CM_ERROR_BADSMB; + goto after_read_packet; + } + + /* capabilities are only valid for first session packet */ + if (!(vcp->flags & SMB_VCFLAG_SESSX_RCVD)) { + caps = smb_GetSMBParm(inp, 11) | (((unsigned long)smb_GetSMBParm(inp, 12)) << 16); + } + + if (smb_authType == SMB_AUTH_NTLM) { + code = smb_AuthenticateUserLM(vcp, accountName, primaryDomain, ciPwd, ciPwdLength, csPwd, csPwdLength); + } + } + } else { /* V3 */ + unsigned ciPwdLength; + char *ciPwd; + char *accountName; + char *primaryDomain; + + ciPwdLength = smb_GetSMBParm(inp, 7); + tp = smb_GetSMBData(inp, NULL); + ciPwd = tp; + tp += ciPwdLength; + + accountName = smb_ParseString(tp, &tp); + primaryDomain = smb_ParseString(tp, NULL); + + if ( smb_GetNormalizedUsername(usern, accountName, primaryDomain)) { + /* shouldn't happen */ + code = CM_ERROR_BADSMB; + goto after_read_packet; + } + + /* even if we wanted extended auth, if we only negotiated V3, we have to fallback + * to NTLM. + */ + if (smb_authType == SMB_AUTH_NTLM || smb_authType == SMB_AUTH_EXTENDED) { + code = smb_AuthenticateUserLM(vcp,accountName,primaryDomain,ciPwd,ciPwdLength,"",0); + } + } + + after_read_packet: + /* note down that we received a session setup X and set the capabilities flag */ + if (!(vcp->flags & SMB_VCFLAG_SESSX_RCVD)) { + lock_ObtainMutex(&vcp->mx); + vcp->flags |= SMB_VCFLAG_SESSX_RCVD; + /* for the moment we can only deal with NTSTATUS */ + if (caps & NTNEGOTIATE_CAPABILITY_NTSTATUS) { vcp->flags |= SMB_VCFLAG_STATUS32; - /* for now, ignore other capability bits */ - } + } + lock_ReleaseMutex(&vcp->mx); + } - /* Parse the data */ - tp = smb_GetSMBData(inp, NULL); - if (vcp->flags & SMB_VCFLAG_USENT) - pwdx = smb_ParseString(tp, &tp); - pwd = smb_ParseString(tp, &tp); - usern = smb_ParseString(tp, &tp); + /* code would be non-zero if there was an authentication failure. + Ideally we would like to invalidate the uid for this session or break + early to avoid accidently stealing someone else's tokens. */ + + if (code) { + return code; + } + + OutputDebugF("Received username=[%s]", usern); /* On Windows 2000, this function appears to be called more often than it is expected to be called. This resulted in multiple smb_user_t @@ -150,7 +800,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * unp = uidp->unp; userp = unp->userp; newUid = (unsigned short)uidp->userID; /* For some reason these are different types!*/ - osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"FindUserByName:Lana[%d],lsn[%d],userid[%d],name[%s]",vcp->lana,vcp->lsn,newUid,usern); + osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"FindUserByName:Lana[%d],lsn[%d],userid[%d],name[%s]",vcp->lana,vcp->lsn,newUid,osi_LogSaveString(smb_logp, usern)); osi_Log3(smb_logp,"smb_ReceiveV3SessionSetupX FindUserByName:Lana[%d],lsn[%d],userid[%d]",vcp->lana,vcp->lsn,newUid); smb_ReleaseUID(uidp); } @@ -176,7 +826,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE); lock_ObtainMutex(&uidp->mx); uidp->unp = unp; - osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp->lana,vcp->lsn,newUid,usern); + osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp->lana,vcp->lsn,newUid,osi_LogSaveString(smb_logp, usern)); osi_Log4(smb_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp->lana,vcp->lsn,newUid); lock_ReleaseMutex(&uidp->mx); smb_ReleaseUID(uidp); @@ -189,8 +839,43 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * osi_Log3(smb_logp, "SMB3 session setup name %s creating ID %d%s", osi_LogSaveString(smb_logp, usern), newUid, osi_LogSaveString(smb_logp, s1)); + smb_SetSMBParm(outp, 2, 0); - smb_SetSMBDataLength(outp, 0); + + if (vcp->flags & SMB_VCFLAG_USENT) { + if (smb_authType == SMB_AUTH_EXTENDED) { + smb_SetSMBParm(outp, 3, secBlobOutLength); + smb_SetSMBDataLength(outp, secBlobOutLength + smb_ServerOSLength + smb_ServerLanManagerLength + smb_ServerDomainNameLength); + tp = smb_GetSMBData(outp, NULL); + if (secBlobOutLength) { + memcpy(tp, secBlobOut, secBlobOutLength); + free(secBlobOut); + tp += secBlobOutLength; + } + memcpy(tp,smb_ServerOS,smb_ServerOSLength); + tp += smb_ServerOSLength; + memcpy(tp,smb_ServerLanManager,smb_ServerLanManagerLength); + tp += smb_ServerLanManagerLength; + memcpy(tp,smb_ServerDomainName,smb_ServerDomainNameLength); + tp += smb_ServerDomainNameLength; + } else { + smb_SetSMBDataLength(outp, 0); + } + } else { + if (smb_authType == SMB_AUTH_EXTENDED) { + smb_SetSMBDataLength(outp, smb_ServerOSLength + smb_ServerLanManagerLength + smb_ServerDomainNameLength); + tp = smb_GetSMBData(outp, NULL); + memcpy(tp,smb_ServerOS,smb_ServerOSLength); + tp += smb_ServerOSLength; + memcpy(tp,smb_ServerLanManager,smb_ServerLanManagerLength); + tp += smb_ServerLanManagerLength; + memcpy(tp,smb_ServerDomainName,smb_ServerDomainNameLength); + tp += smb_ServerDomainNameLength; + } else { + smb_SetSMBDataLength(outp, 0); + } + } + return 0; } @@ -212,10 +897,8 @@ long smb_ReceiveV3UserLogoffX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou if (s2 == NULL) s2 = " "; if (s1 == NULL) {s1 = s2; s2 = " ";} - osi_Log4(smb_logp, "SMB3 user logoffX uid %d name %s%s%s", - uidp->userID, - osi_LogSaveString(smb_logp, - (uidp->unp) ? uidp->unp->name: " "), s1, s2); + osi_Log4(smb_logp, "SMB3 user logoffX uid %d name %s%s%s", uidp->userID, + osi_LogSaveString(smb_logp, (uidp->unp) ? uidp->unp->name: " "), s1, s2); lock_ObtainMutex(&uidp->mx); uidp->flags |= SMB_USERFLAG_DELETE; @@ -247,6 +930,7 @@ long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *o char *passwordp; char *servicep; cm_user_t *userp; + int ipc = 0; osi_Log0(smb_logp, "SMB3 receive tree connect"); @@ -262,8 +946,18 @@ long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *o } strcpy(shareName, tp+1); - if (strcmp(servicep, "IPC") == 0 || strcmp(shareName, "IPC$") == 0) + osi_Log2(smb_logp, "Tree connect pathp[%s] shareName[%s]", + osi_LogSaveString(smb_logp, pathp), + osi_LogSaveString(smb_logp, shareName)); + + if (strcmp(servicep, "IPC") == 0 || strcmp(shareName, "IPC$") == 0) { +#ifndef NO_IPC + osi_Log0(smb_logp, "TreeConnectX connecting to IPC$"); + ipc = 1; +#else return CM_ERROR_NOIPC; +#endif + } userp = smb_GetUser(vcp, inp); @@ -272,6 +966,8 @@ long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *o lock_ReleaseMutex(&vcp->mx); tidp = smb_FindTID(vcp, newTid, SMB_FLAG_CREATE); + + if(!ipc) { uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0); shareFound = smb_FindShare(vcp, uidp, shareName, &sharePath); if (uidp) @@ -280,25 +976,36 @@ long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *o smb_ReleaseTID(tidp); return CM_ERROR_BADSHARENAME; } - lock_ObtainMutex(&tidp->mx); - tidp->userp = userp; - tidp->pathname = sharePath; - lock_ReleaseMutex(&tidp->mx); - smb_ReleaseTID(tidp); if (vcp->flags & SMB_VCFLAG_USENT) { int policy = smb_FindShareCSCPolicy(shareName); smb_SetSMBParm(outp, 2, SMB_SUPPORT_SEARCH_BITS | (policy << 2)); } + } else { + smb_SetSMBParm(outp, 2, 0); + sharePath = NULL; + } + + lock_ObtainMutex(&tidp->mx); + tidp->userp = userp; + tidp->pathname = sharePath; + if(ipc) tidp->flags |= SMB_TIDFLAG_IPC; + lock_ReleaseMutex(&tidp->mx); + smb_ReleaseTID(tidp); ((smb_t *)outp)->tid = newTid; ((smb_t *)inp)->tid = newTid; tp = smb_GetSMBData(outp, NULL); + if(!ipc) { *tp++ = 'A'; *tp++ = ':'; *tp++ = 0; smb_SetSMBDataLength(outp, 3); + } else { + strcpy(tp, "IPC"); + smb_SetSMBDataLength(outp, 4); + } osi_Log1(smb_logp, "SMB3 tree connect created ID %d", newTid); return 0; @@ -338,11 +1045,16 @@ smb_tran2Packet_t *smb_NewTran2Packet(smb_vc_t *vcp, smb_packet_t *inp, tp->pid = smbp->pid; tp->res[0] = smbp->res[0]; osi_QAdd((osi_queue_t **)&smb_tran2AssemblyQueuep, &tp->q); - tp->opcode = smb_GetSMBParm(inp, 14); if (totalParms != 0) tp->parmsp = malloc(totalParms); if (totalData != 0) tp->datap = malloc(totalData); + if (smbp->com == 0x25 || smbp->com == 0x26) + tp->com = 0x25; + else { + tp->opcode = smb_GetSMBParm(inp, 14); + tp->com = 0x32; + } tp->flags |= SMB_TRAN2PFLAG_ALLOC; return tp; } @@ -369,6 +1081,7 @@ smb_tran2Packet_t *smb_GetTran2ResponsePacket(smb_vc_t *vcp, tp->pid = inp->pid; tp->res[0] = inp->res[0]; tp->opcode = inp->opcode; + tp->com = inp->com; /* * We calculate where the parameters and data will start. @@ -425,7 +1138,7 @@ void smb_SendTran2Error(smb_vc_t *vcp, smb_tran2Packet_t *t2p, smbp->flg2 |= 0x40; /* IS_LONG_NAME */ /* now copy important fields from the tran 2 packet */ - smbp->com = 0x32; /* tran 2 response */ + smbp->com = t2p->com; smbp->tid = t2p->tid; smbp->mid = t2p->mid; smbp->pid = t2p->pid; @@ -465,7 +1178,7 @@ void smb_SendTran2Packet(smb_vc_t *vcp, smb_tran2Packet_t *t2p, smb_packet_t *tp smbp->flg2 |= 0x40; /* IS_LONG_NAME */ /* now copy important fields from the tran 2 packet */ - smbp->com = 0x32; /* tran 2 response */ + smbp->com = t2p->com; smbp->tid = t2p->tid; smbp->mid = t2p->mid; smbp->pid = t2p->pid; @@ -503,6 +1216,647 @@ void smb_SendTran2Packet(smb_vc_t *vcp, smb_tran2Packet_t *t2p, smb_packet_t *tp smb_SendPacket(vcp, tp); } +long smb_ReceiveV3Trans(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) +{ + smb_tran2Packet_t *asp; + int totalParms; + int totalData; + int parmDisp; + int dataDisp; + int parmOffset; + int dataOffset; + int parmCount; + int dataCount; + int firstPacket; + int rapOp; + long code = 0; + + /* We sometimes see 0 word count. What to do? */ + if (*inp->wctp == 0) { +#ifndef DJGPP + HANDLE h; + char *ptbuf[1]; + + osi_Log0(smb_logp, "TRANSACTION word count = 0"); + + h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); + ptbuf[0] = "Transaction2 word count = 0"; + ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1003, NULL, + 1, inp->ncb_length, ptbuf, inp); + DeregisterEventSource(h); +#else /* DJGPP */ + osi_Log0(smb_logp, "TRANSACTION word count = 0"); +#endif /* !DJGPP */ + + smb_SetSMBDataLength(outp, 0); + smb_SendPacket(vcp, outp); + return 0; + } + + totalParms = smb_GetSMBParm(inp, 0); + totalData = smb_GetSMBParm(inp, 1); + + firstPacket = (inp->inCom == 0x25); + + /* find the packet we're reassembling */ + lock_ObtainWrite(&smb_globalLock); + asp = smb_FindTran2Packet(vcp, inp); + if (!asp) { + asp = smb_NewTran2Packet(vcp, inp, totalParms, totalData); + } + lock_ReleaseWrite(&smb_globalLock); + + /* now merge in this latest packet; start by looking up offsets */ + if (firstPacket) { + parmDisp = dataDisp = 0; + parmOffset = smb_GetSMBParm(inp, 10); + dataOffset = smb_GetSMBParm(inp, 12); + parmCount = smb_GetSMBParm(inp, 9); + dataCount = smb_GetSMBParm(inp, 11); + asp->maxReturnParms = smb_GetSMBParm(inp, 2); + asp->maxReturnData = smb_GetSMBParm(inp, 3); + + osi_Log3(smb_logp, "SMB3 received Trans init packet total data %d, cur data %d, max return data %d", + totalData, dataCount, asp->maxReturnData); + } + else { + parmDisp = smb_GetSMBParm(inp, 4); + parmOffset = smb_GetSMBParm(inp, 3); + dataDisp = smb_GetSMBParm(inp, 7); + dataOffset = smb_GetSMBParm(inp, 6); + parmCount = smb_GetSMBParm(inp, 2); + dataCount = smb_GetSMBParm(inp, 5); + + osi_Log2(smb_logp, "SMB3 received Trans aux packet parms %d, data %d", + parmCount, dataCount); + } + + /* now copy the parms and data */ + if ( asp->totalParms > 0 && parmCount != 0 ) + { + memcpy(((char *)asp->parmsp) + parmDisp, inp->data + parmOffset, parmCount); + } + if ( asp->totalData > 0 && dataCount != 0 ) { + memcpy(asp->datap + dataDisp, inp->data + dataOffset, dataCount); + } + + /* account for new bytes */ + asp->curData += dataCount; + asp->curParms += parmCount; + + /* finally, if we're done, remove the packet from the queue and dispatch it */ + if (asp->totalParms > 0 && + asp->curParms > 0 && + asp->totalData <= asp->curData && + asp->totalParms <= asp->curParms) { + /* we've received it all */ + lock_ObtainWrite(&smb_globalLock); + osi_QRemove((osi_queue_t **) &smb_tran2AssemblyQueuep, &asp->q); + lock_ReleaseWrite(&smb_globalLock); + + /* now dispatch it */ + rapOp = asp->parmsp[0]; + + if ( rapOp >= 0 && rapOp < SMB_RAP_NOPCODES && smb_rapDispatchTable[rapOp].procp) { + osi_LogEvent("AFS-Dispatch-RAP[%s]",myCrt_RapDispatch(rapOp),"vcp[%x] lana[%d] lsn[%d]",(int)vcp,vcp->lana,vcp->lsn); + osi_Log4(smb_logp,"AFS Server - Dispatch-RAP %s vcp[%x] lana[%d] lsn[%d]",myCrt_RapDispatch(rapOp),vcp,vcp->lana,vcp->lsn); + code = (*smb_rapDispatchTable[rapOp].procp)(vcp, asp, outp); + } + else { + osi_LogEvent("AFS-Dispatch-RAP [invalid]", NULL, "op[%x] vcp[%x] lana[%d] lsn[%d]", rapOp, vcp, vcp->lana, vcp->lsn); + osi_Log4(smb_logp,"AFS Server - Dispatch-RAP [INVALID] op[%x] vcp[%x] lana[%d] lsn[%d]", rapOp, vcp, vcp->lana, vcp->lsn); + code = CM_ERROR_BADOP; + } + + /* if an error is returned, we're supposed to send an error packet, + * otherwise the dispatched function already did the data sending. + * We give dispatched proc the responsibility since it knows how much + * space to allocate. + */ + if (code != 0) { + smb_SendTran2Error(vcp, asp, outp, code); + } + + /* free the input tran 2 packet */ + lock_ObtainWrite(&smb_globalLock); + smb_FreeTran2Packet(asp); + lock_ReleaseWrite(&smb_globalLock); + } + else if (firstPacket) { + /* the first packet in a multi-packet request, we need to send an + * ack to get more data. + */ + smb_SetSMBDataLength(outp, 0); + smb_SendPacket(vcp, outp); + } + + return 0; +} + +/* ANSI versions. The unicode versions support arbitrary length + share names, but we don't support unicode yet. */ + +typedef struct smb_rap_share_info_0 { + char shi0_netname[13]; +} smb_rap_share_info_0_t; + +typedef struct smb_rap_share_info_1 { + char shi1_netname[13]; + char shi1_pad; + WORD shi1_type; + DWORD shi1_remark; /* char *shi1_remark; data offset */ +} smb_rap_share_info_1_t; + +typedef struct smb_rap_share_info_2 { + char shi2_netname[13]; + char shi2_pad; + unsigned short shi2_type; + DWORD shi2_remark; /* char *shi2_remark; data offset */ + unsigned short shi2_permissions; + unsigned short shi2_max_uses; + unsigned short shi2_current_uses; + DWORD shi2_path; /* char *shi2_path; data offset */ + unsigned short shi2_passwd[9]; + unsigned short shi2_pad2; +} smb_rap_share_info_2_t; + +#define SMB_RAP_MAX_SHARES 512 + +typedef struct smb_rap_share_list { + int cShare; + int maxShares; + smb_rap_share_info_0_t * shares; +} smb_rap_share_list_t; + +int smb_rapCollectSharesProc(cm_scache_t *dscp, cm_dirEntry_t *dep, void *vrockp, osi_hyper_t *offp) { + smb_rap_share_list_t * sp; + char * name; + + name = dep->name; + + if(name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2]))) + return 0; /* skip over '.' and '..' */ + + sp = (smb_rap_share_list_t *) vrockp; + + strncpy(sp->shares[sp->cShare].shi0_netname, name, 12); + sp->shares[sp->cShare].shi0_netname[12] = 0; + + sp->cShare++; + + if(sp->cShare >= sp->maxShares) + return CM_ERROR_STOPNOW; + else + return 0; +} + +long smb_ReceiveRAPNetShareEnum(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) +{ + smb_tran2Packet_t *outp; + unsigned short * tp; + int len; + int infoLevel; + int bufsize; + int outParmsTotal; /* total parameter bytes */ + int outDataTotal; /* total data bytes */ + int code = 0; + DWORD rv; + DWORD allSubmount; + USHORT nShares; + DWORD nRegShares; + DWORD nSharesRet; + HKEY hkParam; + HKEY hkSubmount = NULL; + smb_rap_share_info_1_t * shares; + USHORT cshare = 0; + char * cstrp; + char thisShare[256]; + int i,j; + int nonrootShares; + smb_rap_share_list_t rootShares; + cm_req_t req; + cm_user_t * userp; + osi_hyper_t thyper; + + tp = p->parmsp + 1; /* skip over function number (always 0) */ + (void) smb_ParseString((char *) tp, (char **) &tp); /* skip over parm descriptor */ + (void) smb_ParseString((char *) tp, (char **) &tp); /* skip over data descriptor */ + infoLevel = tp[0]; + bufsize = tp[1]; + + if(infoLevel != 1) { + return CM_ERROR_INVAL; + } + + /* first figure out how many shares there are */ + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, + KEY_QUERY_VALUE, &hkParam); + if (rv == ERROR_SUCCESS) { + len = sizeof(allSubmount); + rv = RegQueryValueEx(hkParam, "AllSubmount", NULL, NULL, + (BYTE *) &allSubmount, &len); + if (rv != ERROR_SUCCESS || allSubmount != 0) { + allSubmount = 1; + } + RegCloseKey (hkParam); + } + + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, KEY_QUERY_VALUE, &hkSubmount); + if (rv == ERROR_SUCCESS) { + rv = RegQueryInfoKey(hkSubmount, NULL, NULL, NULL, NULL, + NULL, NULL, &nRegShares, NULL, NULL, NULL, NULL); + if (rv != ERROR_SUCCESS) + nRegShares = 0; + } else { + hkSubmount = NULL; + } + + /* fetch the root shares */ + rootShares.maxShares = SMB_RAP_MAX_SHARES; + rootShares.cShare = 0; + rootShares.shares = malloc( sizeof(smb_rap_share_info_0_t) * SMB_RAP_MAX_SHARES ); + + cm_InitReq(&req); + + userp = smb_GetTran2User(vcp,p); + + thyper.HighPart = 0; + thyper.LowPart = 0; + + cm_HoldSCache(cm_rootSCachep); + cm_ApplyDir(cm_rootSCachep, smb_rapCollectSharesProc, &rootShares, &thyper, userp, &req, NULL); + cm_ReleaseSCache(cm_rootSCachep); + + cm_ReleaseUser(userp); + + nShares = rootShares.cShare + nRegShares + allSubmount; + +#define REMARK_LEN 1 + outParmsTotal = 8; /* 4 dwords */ + outDataTotal = (sizeof(smb_rap_share_info_1_t) + REMARK_LEN) * nShares ; + if(outDataTotal > bufsize) { + nSharesRet = bufsize / (sizeof(smb_rap_share_info_1_t) + REMARK_LEN); + outDataTotal = (sizeof(smb_rap_share_info_1_t) + REMARK_LEN) * nSharesRet; + } + else { + nSharesRet = nShares; + } + + outp = smb_GetTran2ResponsePacket(vcp, p, op, outParmsTotal, outDataTotal); + + /* now for the submounts */ + shares = (smb_rap_share_info_1_t *) outp->datap; + cstrp = outp->datap + sizeof(smb_rap_share_info_1_t) * nSharesRet; + + memset(outp->datap, 0, (sizeof(smb_rap_share_info_1_t) + REMARK_LEN) * nSharesRet); + + if(allSubmount) { + strcpy( shares[cshare].shi1_netname, "all" ); + shares[cshare].shi1_remark = cstrp - outp->datap; + /* type and pad are zero already */ + cshare++; + cstrp+=REMARK_LEN; + } + + if(hkSubmount) { + for(i=0; i < nRegShares && cshare < nSharesRet; i++) { + len = sizeof(thisShare); + rv = RegEnumValue(hkSubmount, i, thisShare, &len, NULL, NULL, NULL, NULL); + if(rv == ERROR_SUCCESS && strlen(thisShare) && (!allSubmount || stricmp(thisShare,"all"))) { + strncpy(shares[cshare].shi1_netname, thisShare, sizeof(shares->shi1_netname)-1); + shares[cshare].shi1_netname[sizeof(shares->shi1_netname)-1] = 0; /* unfortunate truncation */ + shares[cshare].shi1_remark = cstrp - outp->datap; + cshare++; + cstrp+=REMARK_LEN; + } + else + nShares--; /* uncount key */ + } + + RegCloseKey(hkSubmount); + } + + nonrootShares = cshare; + + for(i=0; i < rootShares.cShare && cshare < nSharesRet; i++) { + /* in case there are collisions with submounts, submounts have higher priority */ + for(j=0; j < nonrootShares; j++) + if(!stricmp(shares[j].shi1_netname, rootShares.shares[i].shi0_netname)) + break; + + if(j < nonrootShares) { + nShares--; /* uncount */ + continue; + } + + strcpy(shares[cshare].shi1_netname, rootShares.shares[i].shi0_netname); + shares[cshare].shi1_remark = cstrp - outp->datap; + cshare++; + cstrp+=REMARK_LEN; + } + + outp->parmsp[0] = ((cshare == nShares)? ERROR_SUCCESS : ERROR_MORE_DATA); + outp->parmsp[1] = 0; + outp->parmsp[2] = cshare; + outp->parmsp[3] = nShares; + + outp->totalData = cstrp - outp->datap; + outp->totalParms = outParmsTotal; + + smb_SendTran2Packet(vcp, outp, op); + smb_FreeTran2Packet(outp); + + free(rootShares.shares); + + return code; +} + +long smb_ReceiveRAPNetShareGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) +{ + smb_tran2Packet_t *outp; + unsigned short * tp; + char * shareName; + BOOL shareFound = FALSE; + unsigned short infoLevel; + unsigned short bufsize; + int totalData; + int totalParam; + DWORD len; + HKEY hkParam; + HKEY hkSubmount; + DWORD allSubmount; + LONG rv; + long code = 0; + + tp = p->parmsp + 1; /* skip over function number (always 1) */ + (void) smb_ParseString( (char *) tp, (char **) &tp); /* skip over param descriptor */ + (void) smb_ParseString( (char *) tp, (char **) &tp); /* skip over data descriptor */ + shareName = smb_ParseString( (char *) tp, (char **) &tp); + infoLevel = *tp++; + bufsize = *tp++; + + totalParam = 6; + + if(infoLevel == 0) + totalData = sizeof(smb_rap_share_info_0_t); + else if(infoLevel == 1) + totalData = sizeof(smb_rap_share_info_1_t) + 1; /* + empty string */ + else if(infoLevel == 2) + totalData = sizeof(smb_rap_share_info_2_t) + 2; /* + two empty strings */ + else + return CM_ERROR_INVAL; + + outp = smb_GetTran2ResponsePacket(vcp, p, op, totalParam, totalData); + + if(!stricmp(shareName,"all")) { + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, 0, + KEY_QUERY_VALUE, &hkParam); + if (rv == ERROR_SUCCESS) { + len = sizeof(allSubmount); + rv = RegQueryValueEx(hkParam, "AllSubmount", NULL, NULL, + (BYTE *) &allSubmount, &len); + if (rv != ERROR_SUCCESS || allSubmount != 0) { + allSubmount = 1; + } + RegCloseKey (hkParam); + } + + if(allSubmount) + shareFound = TRUE; + + } else { + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\OpenAFS\\Client\\Submounts", 0, + KEY_QUERY_VALUE, &hkSubmount); + if(rv == ERROR_SUCCESS) { + rv = RegQueryValueEx(hkSubmount, shareName, NULL, NULL, NULL, NULL); + if(rv == ERROR_SUCCESS) { + shareFound = TRUE; + } + RegCloseKey(hkSubmount); + } + } + + if(!shareFound) { + smb_FreeTran2Packet(outp); + return CM_ERROR_BADSHARENAME; + } + + memset(outp->datap, 0, totalData); + + outp->parmsp[0] = 0; + outp->parmsp[1] = 0; + outp->parmsp[2] = totalData; + + if(infoLevel == 0) { + smb_rap_share_info_0_t * info = (smb_rap_share_info_0_t *) outp->datap; + strncpy(info->shi0_netname, shareName, sizeof(info->shi0_netname)-1); + info->shi0_netname[sizeof(info->shi0_netname)-1] = 0; + } else if(infoLevel == 1) { + smb_rap_share_info_1_t * info = (smb_rap_share_info_1_t *) outp->datap; + strncpy(info->shi1_netname, shareName, sizeof(info->shi1_netname)-1); + info->shi1_netname[sizeof(info->shi1_netname)-1] = 0; + info->shi1_remark = ((unsigned char *) (info + 1)) - outp->datap; + /* type and pad are already zero */ + } else { /* infoLevel==2 */ + smb_rap_share_info_2_t * info = (smb_rap_share_info_2_t *) outp->datap; + strncpy(info->shi2_netname, shareName, sizeof(info->shi2_netname)-1); + info->shi2_netname[sizeof(info->shi2_netname)-1] = 0; + info->shi2_remark = ((unsigned char *) (info + 1)) - outp->datap; + info->shi2_permissions = ACCESS_ALL; + info->shi2_max_uses = (unsigned short) -1; + info->shi2_path = 1 + (((unsigned char *) (info + 1)) - outp->datap); + } + + outp->totalData = totalData; + outp->totalParms = totalParam; + + smb_SendTran2Packet(vcp, outp, op); + smb_FreeTran2Packet(outp); + + return code; +} + +typedef struct smb_rap_wksta_info_10 { + DWORD wki10_computername; /*char *wki10_computername;*/ + DWORD wki10_username; /* char *wki10_username; */ + DWORD wki10_langroup; /* char *wki10_langroup;*/ + unsigned char wki10_ver_major; + unsigned char wki10_ver_minor; + DWORD wki10_logon_domain; /*char *wki10_logon_domain;*/ + DWORD wki10_oth_domains; /* char *wki10_oth_domains;*/ +} smb_rap_wksta_info_10_t; + + +long smb_ReceiveRAPNetWkstaGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) +{ + smb_tran2Packet_t *outp; + long code = 0; + int infoLevel; + int bufsize; + unsigned short * tp; + int totalData; + int totalParams; + smb_rap_wksta_info_10_t * info; + char * cstrp; + smb_user_t *uidp; + + tp = p->parmsp + 1; /* Skip over function number */ + (void) smb_ParseString((unsigned char*) tp, (char **) &tp); /* skip over param descriptor */ + (void) smb_ParseString((unsigned char*) tp, (char **) &tp); /* skip over data descriptor */ + infoLevel = *tp++; + bufsize = *tp++; + + if(infoLevel != 10) { + return CM_ERROR_INVAL; + } + + totalParams = 6; + + /* infolevel 10 */ + totalData = sizeof(*info) + /* info */ + MAX_COMPUTERNAME_LENGTH + /* wki10_computername */ + SMB_MAX_USERNAME_LENGTH + /* wki10_username */ + MAX_COMPUTERNAME_LENGTH + /* wki10_langroup */ + MAX_COMPUTERNAME_LENGTH + /* wki10_logon_domain */ + 1; /* wki10_oth_domains (null)*/ + + outp = smb_GetTran2ResponsePacket(vcp, p, op, totalParams, totalData); + + memset(outp->parmsp,0,totalParams); + memset(outp->datap,0,totalData); + + info = (smb_rap_wksta_info_10_t *) outp->datap; + cstrp = (char *) (info + 1); + + info->wki10_computername = (DWORD) (cstrp - outp->datap); + strcpy(cstrp, smb_localNamep); + cstrp += strlen(cstrp) + 1; + + info->wki10_username = (DWORD) (cstrp - outp->datap); + uidp = smb_FindUID(vcp, p->uid, 0); + if(uidp) { + lock_ObtainMutex(&uidp->mx); + if(uidp->unp && uidp->unp->name) + strcpy(cstrp, uidp->unp->name); + lock_ReleaseMutex(&uidp->mx); + smb_ReleaseUID(uidp); + } + cstrp += strlen(cstrp) + 1; + + info->wki10_langroup = (DWORD) (cstrp - outp->datap); + strcpy(cstrp, "WORKGROUP"); + cstrp += strlen(cstrp) + 1; + + /* TODO: Not sure what values these should take, but these work */ + info->wki10_ver_major = 5; + info->wki10_ver_minor = 1; + + info->wki10_logon_domain = (DWORD) (cstrp - outp->datap); + strcpy(cstrp, smb_ServerDomainName); + cstrp += strlen(cstrp) + 1; + + info->wki10_oth_domains = (DWORD) (cstrp - outp->datap); + cstrp ++; /* no other domains */ + + outp->totalData = (unsigned short) (cstrp - outp->datap); /* actual data size */ + outp->parmsp[2] = outp->totalData; + outp->totalParms = totalParams; + + smb_SendTran2Packet(vcp,outp,op); + smb_FreeTran2Packet(outp); + + return code; +} + +typedef struct smb_rap_server_info_0 { + char sv0_name[16]; +} smb_rap_server_info_0_t; + +typedef struct smb_rap_server_info_1 { + char sv1_name[16]; + char sv1_version_major; + char sv1_version_minor; + unsigned long sv1_type; + DWORD *sv1_comment_or_master_browser; /* char *sv1_comment_or_master_browser;*/ +} smb_rap_server_info_1_t; + +char smb_ServerComment[] = "OpenAFS Client"; +int smb_ServerCommentLen = sizeof(smb_ServerComment); + +#define SMB_SV_TYPE_SERVER 0x00000002L +#define SMB_SV_TYPE_NT 0x00001000L +#define SMB_SV_TYPE_SERVER_NT 0x00008000L + +long smb_ReceiveRAPNetServerGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) +{ + smb_tran2Packet_t *outp; + long code = 0; + int infoLevel; + int bufsize; + unsigned short * tp; + int totalData; + int totalParams; + smb_rap_server_info_0_t * info0; + smb_rap_server_info_1_t * info1; + char * cstrp; + + tp = p->parmsp + 1; /* Skip over function number */ + (void) smb_ParseString((unsigned char*) tp, (char **) &tp); /* skip over param descriptor */ + (void) smb_ParseString((unsigned char*) tp, (char **) &tp); /* skip over data descriptor */ + infoLevel = *tp++; + bufsize = *tp++; + + if(infoLevel != 0 && infoLevel != 1) { + return CM_ERROR_INVAL; + } + + totalParams = 6; + + totalData = + (infoLevel == 0) ? sizeof(smb_rap_server_info_0_t) + : (sizeof(smb_rap_server_info_1_t) + smb_ServerCommentLen); + + outp = smb_GetTran2ResponsePacket(vcp, p, op, totalParams, totalData); + + memset(outp->parmsp,0,totalParams); + memset(outp->datap,0,totalData); + + if(infoLevel == 0) { + info0 = (smb_rap_server_info_0_t *) outp->datap; + cstrp = (char *) (info0 + 1); + strcpy(info0->sv0_name, "AFS"); + } else { /* infoLevel == 1 */ + info1 = (smb_rap_server_info_1_t *) outp->datap; + cstrp = (char *) (info1 + 1); + strcpy(info1->sv1_name, "AFS"); + + info1->sv1_type = + SMB_SV_TYPE_SERVER | + SMB_SV_TYPE_NT | + SMB_SV_TYPE_SERVER_NT; + + info1->sv1_version_major = 5; + info1->sv1_version_minor = 1; + info1->sv1_comment_or_master_browser = (DWORD *) (cstrp - outp->datap); + + strcpy(cstrp, smb_ServerComment); + + cstrp += smb_ServerCommentLen; + } + + totalData = cstrp - outp->datap; + outp->totalData = min(bufsize,totalData); /* actual data size */ + outp->parmsp[0] = (outp->totalData == totalData)? 0 : ERROR_MORE_DATA; + outp->parmsp[2] = totalData; + outp->totalParms = totalParams; + + smb_SendTran2Packet(vcp,outp,op); + smb_FreeTran2Packet(outp); + + return code; +} + long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) { smb_tran2Packet_t *asp; @@ -578,11 +1932,11 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) } /* now copy the parms and data */ - if ( parmCount != 0 ) + if ( asp->totalParms > 0 && parmCount != 0 ) { memcpy(((char *)asp->parmsp) + parmDisp, inp->data + parmOffset, parmCount); } - if ( dataCount != 0 ) { + if ( asp->totalData > 0 && dataCount != 0 ) { memcpy(asp->datap + dataDisp, inp->data + dataOffset, dataCount); } @@ -591,7 +1945,10 @@ long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) asp->curParms += parmCount; /* finally, if we're done, remove the packet from the queue and dispatch it */ - if (asp->totalData <= asp->curData && asp->totalParms <= asp->curParms) { + if (asp->totalParms > 0 && + asp->curParms > 0 && + asp->totalData <= asp->curData && + asp->totalParms <= asp->curParms) { /* we've received it all */ lock_ObtainWrite(&smb_globalLock); osi_QRemove((osi_queue_t **) &smb_tran2AssemblyQueuep, &asp->q); @@ -742,13 +2099,22 @@ long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op) userp = smb_GetTran2User(vcp, p); /* In the off chance that userp is NULL, we log and abandon */ - if(!userp) { + if (!userp) { osi_Log1(smb_logp, "ReceiveTran2Open user [%d] not resolvable", p->uid); smb_FreeTran2Packet(outp); return CM_ERROR_BADSMB; } - tidPathp = smb_GetTIDPath(vcp, p->tid); + code = smb_LookupTIDPath(vcp, p->tid, &tidPathp); + if(code == CM_ERROR_TIDIPC) { + /* Attempt to use TID allocated for IPC. The client is + probably trying to locate DCE RPC end points, which + we don't support. */ + osi_Log0(smb_logp, "Tran2Open received IPC TID"); + cm_ReleaseUser(userp); + smb_FreeTran2Packet(outp); + return CM_ERROR_NOSUCHPATH; + } dscp = NULL; code = cm_NameI(cm_rootSCachep, pathp, @@ -1165,13 +2531,19 @@ long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t } userp = smb_GetTran2User(vcp, p); - if(!userp) { + if (!userp) { osi_Log1(smb_logp, "ReceiveTran2QPathInfo unable to resolve user [%d]", p->uid); smb_FreeTran2Packet(outp); return CM_ERROR_BADSMB; } - tidPathp = smb_GetTIDPath(vcp, p->tid); + code = smb_LookupTIDPath(vcp, p->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOSUCHPATH); + smb_FreeTran2Packet(outp); + return 0; + } /* * XXX Strange hack XXX @@ -1366,7 +2738,7 @@ long smb_ReceiveTran2QFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t outp->totalData = nbytesRequired; userp = smb_GetTran2User(vcp, p); - if(!userp) { + if (!userp) { osi_Log1(smb_logp, "ReceiveTran2QFileInfo unable to resolve user [%d]", p->uid); code = CM_ERROR_BADSMB; goto done; @@ -1480,7 +2852,7 @@ long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet outp->totalData = 0; userp = smb_GetTran2User(vcp, p); - if(!userp) { + if (!userp) { osi_Log1(smb_logp,"ReceiveTran2SetFileInfo unable to resolve user [%d]", p->uid); code = CM_ERROR_BADSMB; goto done; @@ -1626,6 +2998,80 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp, if (code) { lock_ReleaseMutex(&scp->mx); cm_ReleaseSCache(scp); + + dptr = patchp->dptr; + + /* Plug in fake timestamps. A time stamp of 0 causes 'invalid parameter' + errors in the client. */ + if (infoLevel >= 0x101) { + /* 1969-12-31 23:59:59 +00 */ + ft.dwHighDateTime = 0x19DB200; + ft.dwLowDateTime = 0x5BB78980; + + /* copy to Creation Time */ + *((FILETIME *)dptr) = ft; + dptr += 8; + + /* copy to Last Access Time */ + *((FILETIME *)dptr) = ft; + dptr += 8; + + /* copy to Last Write Time */ + *((FILETIME *)dptr) = ft; + dptr += 8; + + /* copy to Change Time */ + *((FILETIME *)dptr) = ft; + dptr += 24; + + /* merge in hidden attribute */ + if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) { + *((u_long *)dptr) = SMB_ATTR_HIDDEN; + } + dptr += 4; + + } else { + /* 1969-12-31 23:59:58 +00*/ + dosTime = 0xEBBFBF7D; + + /* and copy out date */ + shortTemp = (dosTime>>16) & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 2; + + /* copy out creation time */ + shortTemp = dosTime & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 2; + + /* and copy out date */ + shortTemp = (dosTime>>16) & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 2; + + /* copy out access time */ + shortTemp = dosTime & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 2; + + /* and copy out date */ + shortTemp = (dosTime>>16) & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 2; + + /* copy out mod time */ + shortTemp = dosTime & 0xffff; + *((u_short *)dptr) = shortTemp; + dptr += 10; + + /* merge in hidden (dot file) attribute */ + if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) { + attr == SMB_ATTR_HIDDEN; + *dptr++ = attr & 0xff; + *dptr++ = (attr >> 8) & 0xff; + } + + } continue; } @@ -1677,7 +3123,7 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp, /* Copy attributes */ lattr = smb_ExtAttributes(scp); /* merge in hidden (dot file) attribute */ - if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) lattr |= SMB_ATTR_HIDDEN; *((u_long *)dptr) = lattr; dptr += 4; @@ -1727,7 +3173,7 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp, /* finally copy out attributes as short */ attr = smb_Attributes(scp); /* merge in hidden (dot file) attribute */ - if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) + if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) attr |= SMB_ATTR_HIDDEN; *dptr++ = attr & 0xff; *dptr++ = (attr >> 8) & 0xff; @@ -1760,6 +3206,10 @@ VOID initUpperCaseTable(VOID) mapCaseTable[i] = toupper(i); // make '"' match '.' mapCaseTable[(int)'"'] = toupper('.'); + // make '<' match '*' + mapCaseTable[(int)'<'] = toupper('*'); + // make '>' match '?' + mapCaseTable[(int)'>'] = toupper('?'); } // Compare 'pattern' (containing metacharacters '*' and '?') with the file @@ -1778,15 +3228,19 @@ BOOL szWildCardMatchFileName(PSZ pattern, PSZ name) { while (*name) { switch (*pattern) { case '?': + case '>': if (*(++pattern) != '<' || *(++pattern) != '*') { - if (*name == '.') return FALSE; + if (*name == '.') + return FALSE; ++name; break; } /* endif */ case '<': case '*': - while ((*pattern == '<') || (*pattern == '*') || (*pattern == '?')) ++pattern; - if (!*pattern) return TRUE; + while ((*pattern == '<') || (*pattern == '*') || (*pattern == '?') || (*pattern == '>')) + ++pattern; + if (!*pattern) + return TRUE; for (p = pename; p >= name; --p) { if ((mapCaseTable[*p] == mapCaseTable[*pattern]) && szWildCardMatchFileName(pattern + 1, p + 1)) @@ -1794,11 +3248,13 @@ BOOL szWildCardMatchFileName(PSZ pattern, PSZ name) { } /* endfor */ return FALSE; default: - if (mapCaseTable[*name] != mapCaseTable[*pattern]) return FALSE; + if (mapCaseTable[*name] != mapCaseTable[*pattern]) + return FALSE; ++pattern, ++name; break; } /* endswitch */ - } /* endwhile */ return !*pattern; + } /* endwhile */ + return !*pattern; } /* do a case-folding search of the star name mask with the name in namep. @@ -2100,7 +3556,15 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t smb_StripLastComponent(spacep->data, NULL, pathp); lock_ReleaseMutex(&dsp->mx); - tidPathp = smb_GetTIDPath(vcp, p->tid); + code = smb_LookupTIDPath(vcp, p->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOFILES); + smb_FreeTran2Packet(outp); + smb_DeleteDirSearch(dsp); + smb_ReleaseDirSearch(dsp); + return 0; + } code = cm_NameI(cm_rootSCachep, spacep->data, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp); @@ -2469,7 +3933,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t } } /* if we're including this name */ - else if(!NeedShortName && + else if (!NeedShortName && !starPattern && !foundInexact && dep->fid.vnode != 0 && @@ -2690,7 +4154,11 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) userp = smb_GetUser(vcp, inp); dscp = NULL; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } code = cm_NameI(cm_rootSCachep, pathp, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp); @@ -3278,6 +4746,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) osi_Log1(smb_logp,"NTCreateX for [%s]",osi_LogSaveString(smb_logp,realPathp)); osi_Log4(smb_logp,"NTCreateX da=[%x] ea=[%x] cd=[%x] co=[%x]", desiredAccess, extAttributes, createDisp, createOptions); + osi_Log1(smb_logp,"NTCreateX lastNamep=[%s]",osi_LogSaveString(smb_logp,(lastNamep?lastNamep:"null"))); if (lastNamep && strcmp(lastNamep, SMB_IOCTL_FILENAME) == 0) { /* special case magic file name for receiving IOCTL requests @@ -3285,6 +4754,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) */ fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE); smb_SetupIoctlFid(fidp, spacep); + osi_Log1(smb_logp,"NTCreateX Setting up IOCTL on fid[%d]",fidp->fid); /* set inp->fid so that later read calls in same msg can find fid */ inp->fid = fidp->fid; @@ -3333,7 +4803,16 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (baseFid == 0) { baseDirp = cm_rootSCachep; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code == CM_ERROR_TIDIPC) { + /* Attempt to use a TID allocated for IPC. The client + is probably looking for DCE RPC end points which we + don't support. */ + osi_Log0(smb_logp, "NTCreateX received IPC TID"); + free(realPathp); + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHFILE; + } } else { baseFidp = smb_FindFID(vcp, baseFid, 0); @@ -3411,7 +4890,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) treeStartp = realPathp + (tp - spacep->data); if (*tp && !smb_IsLegalFilename(tp)) { - if(baseFid != 0) + if (baseFid != 0) smb_ReleaseFID(baseFidp); cm_ReleaseUser(userp); free(realPathp); @@ -3455,7 +4934,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) } if (!foundscp && !treeCreate) { - if(createDisp == 2 || createDisp == 4) + if (createDisp == 2 || createDisp == 4) code = cm_Lookup(dscp, lastNamep, CM_FLAG_FOLLOW, userp, &req, &scp); else @@ -3571,9 +5050,9 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cp = spacep->data; tscp = dscp; - while(pp && *pp) { + while (pp && *pp) { tp = strchr(pp, '\\'); - if(!tp) { + if (!tp) { strcpy(cp,pp); clen = strlen(cp); isLast = 1; /* indicate last component. the supplied path never ends in a slash */ @@ -3586,7 +5065,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) } pp = tp; - if(clen == 0) continue; /* the supplied path can't have consecutive slashes either , but */ + if (clen == 0) continue; /* the supplied path can't have consecutive slashes either , but */ /* cp is the next component to be created. */ code = cm_MakeDir(tscp, cp, 0, &setAttr, userp, &req); @@ -3605,9 +5084,9 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) code = cm_Lookup(tscp, cp, CM_FLAG_CASEFOLD, userp, &req, &scp); } - if(code) break; + if (code) break; - if(!isLast) { /* for anything other than dscp, release it unless it's the last one */ + if (!isLast) { /* for anything other than dscp, release it unless it's the last one */ cm_ReleaseSCache(tscp); tscp = scp; /* Newly created directory will be next parent */ } @@ -3840,7 +5319,7 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out #endif userp = smb_GetUser(vcp, inp); - if(!userp) { + if (!userp) { osi_Log1(smb_logp, "NTTranCreate invalid user [%d]", ((smb_t *) inp)->uid); free(realPathp); return CM_ERROR_INVAL; @@ -3848,11 +5327,20 @@ long smb_ReceiveNTTranCreate(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *out if (baseFid == 0) { baseDirp = cm_rootSCachep; - tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); + if(code == CM_ERROR_TIDIPC) { + /* Attempt to use TID allocated for IPC. The client is + probably trying to locate DCE RPC endpoints, which we + don't support. */ + osi_Log0(smb_logp, "NTTranCreate received IPC TID"); + free(realPathp); + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } } else { baseFidp = smb_FindFID(vcp, baseFid, 0); - if(!baseFidp) { + if (!baseFidp) { osi_Log1(smb_logp, "NTTranCreate Invalid fid [%d]", baseFid); free(realPathp); cm_ReleaseUser(userp); @@ -4393,6 +5881,9 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, otherAction = FILE_ACTION_RENAMED_NEW_NAME; } + osi_Log2(smb_logp,"in smb_NotifyChange for file [%s] dscp [%x]", + osi_LogSaveString(smb_logp,filename),dscp); + lock_ObtainMutex(&smb_Dir_Watch_Lock); watch = smb_Directory_Watches; while (watch) { @@ -4413,6 +5904,7 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, fidp = smb_FindFID(vcp, fid, 0); if (!fidp) { + osi_Log1(smb_logp," no fidp for fid[%d]",fid); lastWatch = watch; watch = watch->nextp; continue; @@ -4420,7 +5912,8 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, if (fidp->scp != dscp || (filter & notifyFilter) == 0 || (!isDirectParent && !wtree)) { - smb_ReleaseFID(fidp); + osi_Log1(smb_logp," passing fidp->scp[%x]", fidp->scp); + smb_ReleaseFID(fidp); lastWatch = watch; watch = watch->nextp; continue; @@ -4627,9 +6120,11 @@ cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine) lock_ObtainMutex(&unp->mx); unp->userp = cm_NewUser(); lock_ReleaseMutex(&unp->mx); - osi_LogEvent("AFS smb_FindCMUserByName : New User",NULL,"name[%s] machine[%s]",usern,machine); + osi_Log2(smb_logp,"smb_FindCMUserByName New user name[%s] machine[%s]",osi_LogSaveString(smb_logp,usern),osi_LogSaveString(smb_logp,machine)); + osi_LogEvent("AFS smb_FindCMUserByName : New User",NULL,"name[%s] machine[%s]",usern,machine); } else { - osi_LogEvent("AFS smb_FindCMUserByName : Found",NULL,"name[%s] machine[%s]",usern,machine); + osi_Log2(smb_logp,"smb_FindCMUserByName Not found name[%s] machine[%s]",osi_LogSaveString(smb_logp,usern),osi_LogSaveString(smb_logp,machine)); + osi_LogEvent("AFS smb_FindCMUserByName : Found",NULL,"name[%s] machine[%s]",usern,machine); } return unp->userp; } diff --git a/src/WINNT/afsd/smb3.h b/src/WINNT/afsd/smb3.h index 72b945a3f..03f3a5aa9 100644 --- a/src/WINNT/afsd/smb3.h +++ b/src/WINNT/afsd/smb3.h @@ -12,6 +12,7 @@ typedef struct smb_tran2Packet { osi_queue_t q; /* queue of all packets */ + int com; /* Trans or Trans2 (0x25 or 0x32) */ int totalData; /* total # of expected data bytes */ int totalParms; /* total # of expected parm bytes */ int oldTotalParms; /* initial estimate of parm bytes */ @@ -86,12 +87,26 @@ typedef struct smb_tran2QFSInfo { extern smb_tran2Dispatch_t smb_tran2DispatchTable[SMB_TRAN2_NOPCODES]; +#define SMB_RAP_NOPCODES 64 + +extern smb_tran2Dispatch_t smb_rapDispatchTable[SMB_RAP_NOPCODES]; + extern long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp); extern long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp); +extern long smb_ReceiveV3Trans(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp); + extern long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp); +extern long smb_ReceiveRAPNetShareEnum(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op); + +extern long smb_ReceiveRAPNetShareGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op); + +extern long smb_ReceiveRAPNetWkstaGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op); + +extern long smb_ReceiveRAPNetServerGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op); + extern long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *outp); @@ -168,6 +183,9 @@ extern int smb_V3MatchMask(char *namep, char *maskp, int flags); extern void smb3_Init(); extern cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine); +/* SMB auth related functions */ +extern void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength); + #ifdef DJGPP #define DELETE (0x00010000) #define READ_CONTROL (0x00020000) diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 32d2bebc0..c35849dd4 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -181,7 +181,11 @@ long smb_IoctlRead(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, userp = smb_GetUser(vcp, inp); /* Identify tree */ - iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &iop->tidPathp); + if(code) { + cm_ReleaseUser(userp); + return CM_ERROR_NOSUCHPATH; + } /* turn the connection around, if required */ code = smb_IoctlPrepareRead(fidp, iop, userp); @@ -294,7 +298,13 @@ long smb_IoctlV3Read(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, smb_pack userp); } - iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &iop->tidPathp); + if(code) { + smb_ReleaseUID(uidp); + cm_ReleaseUser(userp); + smb_ReleaseFID(fidp); + return CM_ERROR_NOSUCHPATH; + } code = smb_IoctlPrepareRead(fidp, iop, userp); if (uidp) { @@ -392,7 +402,12 @@ long smb_IoctlReadRaw(smb_fid_t *fidp, smb_vc_t *vcp, smb_packet_t *inp, if (uidp) smb_ReleaseUID(uidp); } - iop->tidPathp = smb_GetTIDPath(vcp, ((smb_t *)inp)->tid); + code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &iop->tidPathp); + if(code) { + cm_ReleaseUser(userp); + smb_ReleaseFID(fidp); + return CM_ERROR_NOSUCHPATH; + } code = smb_IoctlPrepareRead(fidp, iop, userp); if (code) { diff --git a/src/WINNT/afsd/smb_ioctl.h b/src/WINNT/afsd/smb_ioctl.h index db157b95b..bce9e849a 100644 --- a/src/WINNT/afsd/smb_ioctl.h +++ b/src/WINNT/afsd/smb_ioctl.h @@ -12,6 +12,7 @@ /* magic file name for ioctl opens */ #define SMB_IOCTL_FILENAME "\\_._AFS_IOCTL_._" /* double backslashes for C compiler */ +#define SMB_IOCTL_FILENAME_NOSLASH "_._AFS_IOCTL_._" /* max parms for ioctl, in either direction */ #define SMB_IOCTL_MAXDATA 8192 diff --git a/src/WINNT/afsreg/afsreg.h b/src/WINNT/afsreg/afsreg.h index 0d4096a51..ad051f22e 100644 --- a/src/WINNT/afsreg/afsreg.h +++ b/src/WINNT/afsreg/afsreg.h @@ -168,8 +168,8 @@ /* AFSREG_CLT_SVC_PARAM_KEY values */ #define AFSREG_CLT_SVC_PARAM_CELL_VALUE "Cell" - - +#define AFSREG_CLT_OPENAFS_KEY "HKEY_LOCAL_MACHINE\\Software\\OpenAFS\\Client" +#define AFSREG_CLT_OPENAFS_CELLSERVDB_DIR_VALUE "CellServDBDir" /* Extended (alternative) versions of registry access functions */ diff --git a/src/WINNT/afsreg/afssw.c b/src/WINNT/afsreg/afssw.c index c0e45ff99..ffe63508e 100644 --- a/src/WINNT/afsreg/afssw.c +++ b/src/WINNT/afsreg/afssw.c @@ -63,6 +63,20 @@ afssw_GetClientInstallDir(char **bufPP) /* [out] data buffer */ bufPP); } +/* + * afssw_GetClientCellServDBDir() -- Get directory in which AFS client CellServDB + * file is installed. Sets *bufPP to point to allocated buffer containing string. + * + * RETURN CODES: 0 success, -1 failed (errno set) + */ +int +afssw_GetClientCellServDBDir(char **bufPP) /* [out] data buffer */ +{ + return StringDataRead(AFSREG_CLT_OPENAFS_KEY, + AFSREG_CLT_OPENAFS_CELLSERVDB_DIR_VALUE, + bufPP); +} + /* * afssw_GetClientCellName() -- Get name of cell in which AFS client is diff --git a/src/WINNT/afsreg/afssw.h b/src/WINNT/afsreg/afssw.h index 2b04ff25c..5eaecbe73 100644 --- a/src/WINNT/afsreg/afssw.h +++ b/src/WINNT/afsreg/afssw.h @@ -20,7 +20,10 @@ extern int afssw_GetServerInstallDir(char **bufPP); extern int -afssw_GetClientInstallDir(char **bufPP); +afssw_GetClientCellServDBDir(char **bufPP); + +extern int +afssw_GetClientCellDir(char **bufPP); extern int afssw_GetClientCellName(char **bufPP); diff --git a/src/WINNT/afssvrcfg/services_page.cpp b/src/WINNT/afssvrcfg/services_page.cpp index 091ca903d..50457394d 100644 --- a/src/WINNT/afssvrcfg/services_page.cpp +++ b/src/WINNT/afssvrcfg/services_page.cpp @@ -394,10 +394,10 @@ static void CheckEnableBak() static void CheckEnableSc() { - BOOL bSccEnable; + BOOL bSccEnable = TRUE; UINT uiSccStatusMsg; UINT uiSccActionMsg; - BOOL bScsEnable; + BOOL bScsEnable = TRUE; UINT uiScsStatusMsg; UINT uiScsActionMsg; diff --git a/src/WINNT/aklog/NTMakefile b/src/WINNT/aklog/NTMakefile index 8bb646214..20d12cfb9 100644 --- a/src/WINNT/aklog/NTMakefile +++ b/src/WINNT/aklog/NTMakefile @@ -29,7 +29,7 @@ EXELIBS = \ OTHERLIBS = \ ..\kfw\lib\i386\krbv4w32.lib \ ..\kfw\lib\i386\krb5_32.lib \ - dnsapi.lib + dnsapi.lib mpr.lib afscflags = -I..\kfw\inc\krb5 -I..\kfw\inc\krb4 $(afscflags) @@ -38,8 +38,8 @@ $(EXEOBJS): $$(@B).c ############################################################################ -$(EXEFILE) : $(EXEOBJS) $(OUT)\aklog.res $(EXELIBS) - $(EXECONLINK) $(OTHERLIBS) +$(EXEFILE) : $(EXEOBJS) $(EXELIBS) $(OUT)\aklog.res + $(EXECONLINK) $(EXELIBS) $(OTHERLIBS) $(EXEPREP) install : $(COPYHEADERS) $(EXEFILE) diff --git a/src/WINNT/aklog/aklog.c b/src/WINNT/aklog/aklog.c index 00a5cdb3a..e8409e92b 100644 --- a/src/WINNT/aklog/aklog.c +++ b/src/WINNT/aklog/aklog.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -172,16 +173,50 @@ void CloseConf(struct afsconf_dir **pconfigdir) (void) afsconf_Close(*pconfigdir); } -void ViceIDToUsername(char *username, int *status, -struct ktc_principal *aserver) +#define ALLOW_REGISTER 1 +void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, + char * cell_to_use, CREDENTIALS *c, + int *status, + struct ktc_principal *aclient, struct ktc_principal *aserver, struct ktc_token *atoken) { -#ifndef WIN32 + static char lastcell[MAXCELLCHARS+1] = { 0 }; + static char confname[512] = { 0 }; long viceId; /* AFS uid of user */ +#ifdef ALLOW_REGISTER + afs_int32 id; +#endif /* ALLOW_REGISTER */ + + if (confname[0] == '\0') { + strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname)); + confname[sizeof(confname) - 2] = '\0'; + } if (dflag) printf("About to resolve name %s to id\n", username); - if (!pr_Initialize (0, AFSDIR_CLIENT_ETC_DIRPATH, aserver->cell)) + /* + * Talk about DUMB! It turns out that there is a bug in + * pr_Initialize -- even if you give a different cell name + * to it, it still uses a connection to a previous AFS server + * if one exists. The way to fix this is to change the + * _filename_ argument to pr_Initialize - that forces it to + * re-initialize the connection. We do this by adding and + * removing a "/" on the end of the configuration directory name. + */ + + if (lastcell[0] != '\0' && (strcmp(lastcell, aserver->cell) != 0)) { + int i = strlen(confname); + if (confname[i - 1] == '/') { + confname[i - 1] = '\0'; + } else { + confname[i] = '/'; + confname[i + 1] = '\0'; + } + } + + strcpy(lastcell, aserver->cell); + + if (!pr_Initialize (0, confname, aserver->cell)) *status = pr_SNameToId (username, &viceId); if (dflag) @@ -201,9 +236,58 @@ struct ktc_principal *aserver) * the code for tokens, this hack (AFS ID %d) will * not work if you change %d to something else. */ - if ((*status == 0) && (viceId != ANONYMOUSID)) - sprintf (username, "AFS ID %d", viceId); -#endif + + /* + * This code is taken from cklog -- it lets people + * automatically register with the ptserver in foreign cells + */ + +#ifdef ALLOW_REGISTER + if (*status == 0) { + if (viceId != ANONYMOUSID) { +#else /* ALLOW_REGISTER */ + if ((*status == 0) && (viceId != ANONYMOUSID)) +#endif /* ALLOW_REGISTER */ + sprintf (username, "AFS ID %d", (int) viceId); +#ifdef ALLOW_REGISTER + } else if (strcmp(realm_of_user, realm_of_cell) != 0) { + if (dflag) { + printf("doing first-time registration of %s " + "at %s\n", username, cell_to_use); + } + id = 0; + strncpy(aclient->name, username, MAXKTCNAMELEN - 1); + strcpy(aclient->instance, ""); + strncpy(aclient->cell, c->realm, MAXKTCREALMLEN - 1); + if ((*status = ktc_SetToken(aserver, atoken, aclient, 0))) { + printf("%s: unable to obtain tokens for cell %s " + "(status: %d).\n", progname, cell_to_use, status); + *status = AKLOG_TOKEN; + } + + /* + * In case you're wondering, we don't need to change the + * filename here because we're still connecting to the + * same cell -- we're just using a different authentication + * level + */ + + if ((*status = pr_Initialize(1L, confname, aserver->cell, 0))) { + printf("Error %d\n", status); + } + + if ((*status = pr_CreateUser(username, &id))) { + printf("%s: unable to create remote PTS " + "user %s in cell %s (status: %d).\n", progname, + username, cell_to_use, *status); + } else { + printf("created cross-cell entry for %s at %s\n", + username, cell_to_use); + sprintf(username, "AFS ID %d", (int) id); + } + } + } +#endif /* ALLOW_REGISTER */ } char *LastComponent(char *str) @@ -355,7 +439,7 @@ static char *afs_realm_of_cell(struct afsconf_cell *cellconfig) static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellconfig) { - char ** krbrlms; + char ** krbrlms = 0; static char krbrlm[REALM_SZ+1]; krb5_error_code status; @@ -364,14 +448,14 @@ static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellc status = krb5_get_host_realm( context, cellconfig->hostName[0], &krbrlms ); - if(krbrlms && krbrlms[0]) + if (status == 0 && krbrlms && krbrlms[0]) { strcpy(krbrlm, krbrlms[0]); - else { + } else { strcpy(krbrlm, cellconfig->name); strupr(krbrlm); } - if(krbrlms) + if (krbrlms) krb5_free_host_realm( context, krbrlms ); return krbrlm; @@ -469,6 +553,7 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) struct ktc_principal aclient; struct ktc_token atoken, btoken; + /* try to avoid an expensive call to get_cellconfig */ if (cell && ll_string_check(&authedcells, cell)) { @@ -665,7 +750,7 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) strcat(username, realm_of_user); } - ViceIDToUsername(username, &status, &aserver); + ViceIDToUsername(username, realm_of_user, realm_of_cell, cell_to_use, &c, &status, &aclient, &aserver, &atoken); } if (dflag) @@ -990,7 +1075,7 @@ int main(int argc, char *argv[]) linked_list paths; /* List of paths to log to */ ll_node *cur_node; - krb5_context context; + krb5_context context = 0; memset(&cellinfo, 0, sizeof(cellinfo)); diff --git a/src/WINNT/bosctlsvc/NTMakefile b/src/WINNT/bosctlsvc/NTMakefile index fa75d211e..1d0197fa6 100644 --- a/src/WINNT/bosctlsvc/NTMakefile +++ b/src/WINNT/bosctlsvc/NTMakefile @@ -22,10 +22,15 @@ EXELIBS =\ $(DESTDIR)\lib\afs\afsutil.lib \ $(DESTDIR)\lib\afs\afseventlog.lib \ $(DESTDIR)\lib\afs\afsreg.lib \ - $(DESTDIR)\lib\afs\afsprocmgmt.lib + $(DESTDIR)\lib\afs\afsprocmgmt.lib \ + $(DESTDIR)\lib\afsicf.obj + +EXESDKLIBS=\ + ole32.lib \ + oleaut32.lib $(EXEFILE): $(EXEOBJS) $(EXELIBS) - $(EXECONLINK) + $(EXECONLINK) $(EXESDKLIBS) $(EXEPREP) ############################################################################ diff --git a/src/WINNT/bosctlsvc/bosctlsvc.c b/src/WINNT/bosctlsvc/bosctlsvc.c index d2fd605e5..583dd5964 100644 --- a/src/WINNT/bosctlsvc/bosctlsvc.c +++ b/src/WINNT/bosctlsvc/bosctlsvc.c @@ -30,7 +30,7 @@ #include #include #include - +#include /* Define globals */ @@ -273,6 +273,9 @@ BosCtlMain(DWORD argc, LPTSTR *argv) return; } + /* For XP SP2 and above, open required ports */ + icf_CheckAndAddAFSPorts(AFS_PORTSET_SERVER); + /* Initialize the dirpath package so can access local bosserver binary */ if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) { /* sw install directory probably not in registry; can not continue */ diff --git a/src/WINNT/client_config/NTMakefile b/src/WINNT/client_config/NTMakefile index 08051d79d..1fce523fc 100644 --- a/src/WINNT/client_config/NTMakefile +++ b/src/WINNT/client_config/NTMakefile @@ -63,7 +63,8 @@ EXELIBS = \ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libosi.lib \ $(DESTDIR)\lib\libafsconf.lib \ - $(DESTDIR)\lib\lanahelper.lib + $(DESTDIR)\lib\lanahelper.lib \ + $(DESTDIR)\lib\afs\afsreg.lib ############################################################################ # diff --git a/src/WINNT/client_config/cellservdb.c b/src/WINNT/client_config/cellservdb.c index 642c89992..a8a130539 100644 --- a/src/WINNT/client_config/cellservdb.c +++ b/src/WINNT/client_config/cellservdb.c @@ -23,6 +23,7 @@ #include #endif +char AFSLocalMachineKeyName[] = "SOFTWARE\\OpenAFS\\Client"; /* * PROTOTYPES _________________________________________________________________ @@ -67,13 +68,34 @@ static void strzcpy (char *pszTarget, const char *pszSource, size_t cch) void CSDB_GetFileName (char *pszFilename) { #ifdef AFS_NT40_ENV - /* Find the appropriate AFSDCELL.INI */ - GetWindowsDirectory (pszFilename, MAX_CSDB_PATH); - - if (pszFilename[ strlen(pszFilename)-1 ] != '\\') + /* Find the appropriate CellServDB */ + char * clientdir = 0; + DWORD code, dummyLen; + HKEY parmKey; + int tlen; + + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLocalMachineKeyName, + 0, KEY_QUERY_VALUE, &parmKey); + if (code != ERROR_SUCCESS) + goto dirpath; + + dummyLen = MAX_CSDB_PATH; + code = RegQueryValueEx(parmKey, "CellServDBDir", NULL, NULL, + pszFilename, &dummyLen); + RegCloseKey (parmKey); + + dirpath: + if (code != ERROR_SUCCESS || pszFilename[0] == 0) { + afssw_GetClientInstallDir(&clientdir); + if (clientdir) { + strncpy(pszFilename, clientdir, MAX_CSDB_PATH); + pszFilename[MAX_CSDB_PATH - 1] = '\0'; + } + } + if (pszFilename[ strlen(pszFilename)-1 ] != '\\') strcat (pszFilename, "\\"); - strcat (pszFilename, "AFSDCELL.INI"); + strcat (pszFilename, "CellServDB"); #else strcpy (pszFilename, "/usr/vice/etc/CellServDB"); #endif diff --git a/src/WINNT/client_config/drivemap.cpp b/src/WINNT/client_config/drivemap.cpp index e5afd9ed2..350004bbe 100644 --- a/src/WINNT/client_config/drivemap.cpp +++ b/src/WINNT/client_config/drivemap.cpp @@ -21,7 +21,9 @@ extern "C" { #include "drivemap.h" #include #include +#ifdef DEBUG #define DEBUG_VERBOSE +#endif #include #include @@ -43,15 +45,82 @@ const TCHAR sAFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\Tra #define cREALLOC_SUBMOUNTS 4 -static TCHAR cszINIFILE[] = TEXT("afsdsbmt.ini"); -static TCHAR cszSECTION_SUBMOUNTS[] = TEXT("AFS Submounts"); -static TCHAR cszSECTION_MAPPINGS[] = TEXT("AFS Mappings"); -static TCHAR cszSECTION_ACTIVE[] = TEXT("AFS Active"); +static TCHAR cszSECTION_SUBMOUNTS[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Submounts"); +static TCHAR cszSECTION_MAPPINGS[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Mappings"); +static TCHAR cszSECTION_ACTIVE[] = TEXT("SOFTWARE\\OpenAFS\\Client\\Active Maps"); static TCHAR cszAUTOSUBMOUNT[] = TEXT("Auto"); static TCHAR cszLANMANDEVICE[] = TEXT("\\Device\\LanmanRedirector\\"); +static BOOL +WriteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs) +{ + HKEY hkSub = NULL; + RegCreateKeyEx( key, + subkey, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hkSub, + NULL); + + DWORD status = RegSetValueEx( hkSub, lhs, 0, REG_SZ, (const BYTE *)rhs, strlen(rhs)+1 ); + + if ( hkSub ) + RegCloseKey( hkSub ); + + return (status == ERROR_SUCCESS); +} + +static BOOL +ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * size) +{ + HKEY hkSub = NULL; + RegCreateKeyEx( key, + subkey, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkSub, + NULL); + + DWORD dwType; + DWORD status = RegQueryValueEx( hkSub, lhs, 0, &dwType, (LPBYTE)rhs, size ); + + if ( hkSub ) + RegCloseKey( hkSub ); + + return (status == ERROR_SUCCESS); +} + +static BOOL +DeleteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs) +{ + HKEY hkSub = NULL; + RegCreateKeyEx( key, + subkey, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkSub, + NULL); + + DWORD dwType; + DWORD status = RegDeleteValue( hkSub, lhs ); + + if ( hkSub ) + RegCloseKey( hkSub ); + + return (status == ERROR_SUCCESS); +} + /* * STRINGS ____________________________________________________________________ * @@ -237,14 +306,18 @@ BOOL IsValidSubmountName (LPTSTR pszSubmount) return FALSE; for ( ; *pszSubmount; ++pszSubmount) - { - if (!isprint(*pszSubmount)) - return FALSE; - if (*pszSubmount == TEXT(' ')) - return FALSE; - if (*pszSubmount == TEXT('\t')) - return FALSE; - } + { + if (!isprint(*pszSubmount)) + return FALSE; + if (*pszSubmount == TEXT(' ')) + return FALSE; + if (*pszSubmount == TEXT('/')) + return FALSE; + if (*pszSubmount == TEXT('\\')) + return FALSE; + if (*pszSubmount == TEXT('\t')) + return FALSE; + } return TRUE; } @@ -307,92 +380,128 @@ BOOL fCanIssuePIOCTL (void) void QueryDriveMapList_ReadSubmounts (PDRIVEMAPLIST pList) { - if (IsWindowsNT()) - { - size_t cchLHS = 1024; - LPTSTR mszLHS = AllocateStringMemory (cchLHS); - - for (int iRetry = 0; iRetry < 5; ++iRetry) - { - DWORD rc = GetPrivateProfileString (cszSECTION_SUBMOUNTS, NULL, TEXT(""), mszLHS, cchLHS, cszINIFILE); - if ((rc != cchLHS-1) && (rc != cchLHS-2)) - break; - - FreeStringMemory (mszLHS); - cchLHS *= 2; - mszLHS = AllocateStringMemory (cchLHS); - } - - for (LPTSTR psz = mszLHS; psz && *psz; psz += 1+lstrlen(psz)) - { - SUBMOUNT Submount; - memset (&Submount, 0x00, sizeof(SUBMOUNT)); - lstrcpy (Submount.szSubmount, psz); - - TCHAR szMapping[ MAX_PATH ] = TEXT(""); - GetPrivateProfileString (cszSECTION_SUBMOUNTS, Submount.szSubmount, TEXT(""), szMapping, MAX_PATH, cszINIFILE); - if (szMapping[0] != TEXT('\0')) - { - AdjustAfsPath (Submount.szMapping, szMapping, FALSE, TRUE); - - for (size_t ii = 0; ii < pList->cSubmounts; ++ii) - { - if (!pList->aSubmounts[ii].szSubmount[0]) - break; - } - if (REALLOC (pList->aSubmounts, pList->cSubmounts, 1+ii, cREALLOC_SUBMOUNTS)) - { - memcpy (&pList->aSubmounts[ii], &Submount, sizeof(SUBMOUNT)); - } + if (IsWindowsNT()) + { + HKEY hkSubmounts; + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_QUERY_VALUE, + NULL, + &hkSubmounts, + NULL ); + + DWORD dwSubmounts; + RegQueryInfoKey( hkSubmounts, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwSubmounts, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + for ( DWORD dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) { + TCHAR submountPath[MAX_PATH] = ""; + DWORD submountPathLen = MAX_PATH; + TCHAR submountName[MAX_PATH]; + DWORD submountNameLen = MAX_PATH; + DWORD dwType; + + RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL, + &dwType, (LPBYTE)submountPath, &submountPathLen); + + SUBMOUNT Submount; + memset (&Submount, 0x00, sizeof(SUBMOUNT)); + lstrcpy (Submount.szSubmount, submountName); + + if ( submountPath[0] != TEXT('\0') ) { + AdjustAfsPath (Submount.szMapping, submountPath, FALSE, TRUE); + + for (size_t ii = 0; ii < pList->cSubmounts; ++ii) + { + if (!pList->aSubmounts[ii].szSubmount[0]) + break; + } + if (REALLOC (pList->aSubmounts, pList->cSubmounts, 1+ii, cREALLOC_SUBMOUNTS)) + { + memcpy (&pList->aSubmounts[ii], &Submount, sizeof(SUBMOUNT)); + } } - } - FreeStringMemory (mszLHS); - } + } + RegCloseKey(hkSubmounts); + } } void QueryDriveMapList_ReadMappings (PDRIVEMAPLIST pList) { - size_t cchLHS = 1024; - LPTSTR mszLHS = AllocateStringMemory (cchLHS); - - for (int iRetry = 0; iRetry < 5; ++iRetry) - { - DWORD rc = GetPrivateProfileString (cszSECTION_MAPPINGS, NULL, TEXT(""), mszLHS, cchLHS, cszINIFILE); - if ((rc != cchLHS-1) && (rc != cchLHS-2)) - break; - - FreeStringMemory (mszLHS); - cchLHS *= 2; - mszLHS = AllocateStringMemory (cchLHS); - } - - for (LPTSTR psz = mszLHS; psz && *psz; psz += 1+lstrlen(psz)) - { - DRIVEMAP DriveMap; - memset (&DriveMap, 0x00, sizeof(DRIVEMAP)); - DriveMap.chDrive = toupper(*psz); - DriveMap.fPersistent = TRUE; - if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z)) - continue; - - TCHAR szMapping[ MAX_PATH ] = TEXT(""); - GetPrivateProfileString (cszSECTION_MAPPINGS, psz, TEXT(""), szMapping, MAX_PATH, cszINIFILE); - if (szMapping[0] != TEXT('\0')) - { - AdjustAfsPath (DriveMap.szMapping, szMapping, TRUE, TRUE); - if (DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] == TEXT('*')) - { - DriveMap.fPersistent = FALSE; - DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] = TEXT('\0'); - } - size_t iDrive = DriveMap.chDrive - chDRIVE_A; - memcpy (&pList->aDriveMap[ iDrive ], &DriveMap, sizeof(DRIVEMAP)); - } - } + HKEY hkMappings; + RegCreateKeyEx( HKEY_CURRENT_USER, + "SOFTWARE\\OpenAFS\\Client\\Mappings", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_QUERY_VALUE, + NULL, + &hkMappings, + NULL ); + + DWORD dwMappings; + RegQueryInfoKey( hkMappings, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwMappings, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + for ( DWORD dwIndex = 0; dwIndex < dwMappings; dwIndex ++ ) { + TCHAR mapping[MAX_PATH] = ""; + DWORD mappingLen = MAX_PATH; + TCHAR drive[MAX_PATH]; + DWORD driveLen = MAX_PATH; + DWORD dwType; + + RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL, + &dwType, (LPBYTE)mapping, &mappingLen); + + DRIVEMAP DriveMap; + memset (&DriveMap, 0x00, sizeof(DRIVEMAP)); + DriveMap.chDrive = toupper(*drive); + DriveMap.fPersistent = TRUE; + if ((DriveMap.chDrive < chDRIVE_A) || (DriveMap.chDrive > chDRIVE_Z)) + continue; + + if (mapping[0] != TEXT('\0')) + { + AdjustAfsPath (DriveMap.szMapping, mapping, TRUE, TRUE); + if (DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] == TEXT('*')) + { + DriveMap.fPersistent = FALSE; + DriveMap.szMapping[ lstrlen(DriveMap.szMapping)-1 ] = TEXT('\0'); + } + size_t iDrive = DriveMap.chDrive - chDRIVE_A; + memcpy (&pList->aDriveMap[ iDrive ], &DriveMap, sizeof(DRIVEMAP)); + } + } - FreeStringMemory (mszLHS); + RegCloseKey(hkMappings); } BOOL ForceMapActive (TCHAR chDrive) @@ -403,7 +512,8 @@ BOOL ForceMapActive (TCHAR chDrive) szDrive[0] = chDrive; szDrive[1] = 0; - GetPrivateProfileString (cszSECTION_ACTIVE, szDrive, TEXT("0"), szActive, sizeof(szActive), cszINIFILE); + DWORD len = sizeof(szActive); + ReadRegistryString( HKEY_CURRENT_USER, cszSECTION_ACTIVE, szDrive, szActive, &len); if ( !lstrcmp(szActive,"1") || !lstrcmpi(szActive,"true") || !lstrcmpi(szActive,"on") || !lstrcmpi(szActive,"yes") ) return TRUE; @@ -418,34 +528,69 @@ void WriteActiveMap (TCHAR chDrive, BOOL on) szDrive[0] = chDrive; szDrive[1] = 0; - WritePrivateProfileString (cszSECTION_ACTIVE, szDrive, on ? "1" : "0", cszINIFILE); + WriteRegistryString(HKEY_CURRENT_USER, cszSECTION_ACTIVE, szDrive, on ? "1" : "0"); } void QueryDriveMapList_WriteMappings (PDRIVEMAPLIST pList) { - WriteDriveMappings (pList); + WriteDriveMappings (pList); } void WriteDriveMappings (PDRIVEMAPLIST pList) { - WritePrivateProfileString (cszSECTION_MAPPINGS, NULL, NULL, cszINIFILE); + HKEY hkMappings; + RegCreateKeyEx( HKEY_CURRENT_USER, + "SOFTWARE\\OpenAFS\\Client\\Mappings", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_QUERY_VALUE|KEY_WRITE, + NULL, + &hkMappings, + NULL ); + + DWORD dwMappings; + RegQueryInfoKey( hkMappings, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwMappings, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + if ( dwMappings > 0 ) { + for ( long dwIndex = dwMappings - 1; dwIndex >= 0; dwIndex-- ) { + TCHAR drive[MAX_PATH]; + DWORD driveLen = MAX_PATH; + + RegEnumValue( hkMappings, dwIndex, drive, &driveLen, NULL, NULL, NULL, NULL); + RegDeleteValue( hkMappings, drive ); + } + } for (size_t iDrive = 0; iDrive < 26; ++iDrive) - { - if (pList->aDriveMap[iDrive].szMapping[0] != TEXT('\0')) - { - TCHAR szLHS[] = TEXT("*"); - szLHS[0] = pList->aDriveMap[iDrive].chDrive; - - TCHAR szRHS[MAX_PATH]; - AdjustAfsPath (szRHS, pList->aDriveMap[iDrive].szMapping, TRUE, TRUE); - if (!pList->aDriveMap[iDrive].fPersistent) - lstrcat (szRHS, TEXT("*")); - - WritePrivateProfileString (cszSECTION_MAPPINGS, szLHS, szRHS, cszINIFILE); - } - } + { + if (pList->aDriveMap[iDrive].szMapping[0] != TEXT('\0')) + { + TCHAR szLHS[] = TEXT("*"); + szLHS[0] = pList->aDriveMap[iDrive].chDrive; + + TCHAR szRHS[MAX_PATH]; + AdjustAfsPath (szRHS, pList->aDriveMap[iDrive].szMapping, TRUE, TRUE); + if (!pList->aDriveMap[iDrive].fPersistent) + lstrcat (szRHS, TEXT("*")); + + RegSetValueEx( hkMappings, szLHS, 0, REG_SZ, (const BYTE *)szRHS, lstrlen(szRHS) + 1); + } + } + RegCloseKey( hkMappings ); } BOOL DriveIsGlobalAfsDrive(TCHAR chDrive) @@ -636,29 +781,30 @@ BOOL ActivateDriveMap (TCHAR chDrive, LPTSTR pszMapping, LPTSTR pszSubmountReq, BOOL InactivateDriveMap (TCHAR chDrive, DWORD *pdwStatus) { - DWORD rc = DisMountDOSDrive(chDrive, FALSE); - if (rc == NO_ERROR) - return TRUE; + DWORD rc = DisMountDOSDrive(chDrive, FALSE); + if (rc == NO_ERROR) + return TRUE; - if (pdwStatus) - *pdwStatus = rc; - return FALSE; + if (pdwStatus) + *pdwStatus = rc; + return FALSE; } void AddSubMount (LPTSTR pszSubmount, LPTSTR pszMapping) { - TCHAR szRHS[ MAX_PATH ]; - AdjustAfsPath (szRHS, pszMapping, FALSE, TRUE); - if (!szRHS[0]) - lstrcpy (szRHS, TEXT("/")); - WritePrivateProfileString (cszSECTION_SUBMOUNTS, pszSubmount, szRHS, cszINIFILE); + TCHAR szRHS[ MAX_PATH ]; + AdjustAfsPath (szRHS, pszMapping, FALSE, TRUE); + if (!szRHS[0]) + lstrcpy (szRHS, TEXT("/")); + + WriteRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount, szRHS); } void RemoveSubMount (LPTSTR pszSubmount) { - WritePrivateProfileString (cszSECTION_SUBMOUNTS, pszSubmount, NULL, cszINIFILE); + DeleteRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount); } @@ -826,7 +972,7 @@ DWORD RWLogonOption(BOOL read,DWORD value) if (read) { rval=0; - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLogonOptionName,0, KEY_QUERY_VALUE, &hk)==ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLogonOptionName, 0, KEY_QUERY_VALUE, &hk)==ERROR_SUCCESS) { LSPsize=sizeof(rval); RegQueryValueEx(hk, "LogonOptions", NULL, @@ -1177,7 +1323,7 @@ DWORD MountDOSDrive(char chDrive,const char *szSubmount,BOOL bPersistent,const c nr.dwType=RESOURCETYPE_DISK; nr.lpLocalName=szDrive; nr.lpRemoteName=szPath; - nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; + nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE; /* ignored parameter */ DWORD res=WNetAddConnection2(&nr,NULL,pUsername,(bPersistent)?CONNECT_UPDATE_PROFILE:0); DEBUG_EVENT5("AFS DriveMap","Mount %s Local[%s] Remote[%s] User[%s]=%x", (bPersistent)?"Persistant" : "NonPresistant", diff --git a/src/WINNT/client_config/lang/en_US/afs_config.rc b/src/WINNT/client_config/lang/en_US/afs_config.rc index cdc0fae85..5907a2e54 100644 --- a/src/WINNT/client_config/lang/en_US/afs_config.rc +++ b/src/WINNT/client_config/lang/en_US/afs_config.rc @@ -199,7 +199,7 @@ BEGIN IDC_STATIC,4,4,226,8 LTEXT "&AFS Cell:",IDC_STATIC,4,24,30,8 EDITTEXT IDC_CELL,50,22,105,13,ES_LOWERCASE | ES_AUTOHSCROLL - LTEXT "&Description:",IDC_STATIC,4,41,38,8 + LTEXT "&Submount:",IDC_STATIC,4,41,38,8 EDITTEXT IDC_COMMENT,50,39,181,13,ES_AUTOHSCROLL GROUPBOX "Servers",IDC_STATIC,4,61,236,158 CONTROL "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x1b,13, @@ -244,7 +244,7 @@ BEGIN WS_VSCROLL | WS_TABSTOP LTEXT "AFS &Path:",IDC_STATIC,30,77,33,8 EDITTEXT IDC_PATH,77,75,168,13,ES_AUTOHSCROLL - LTEXT "D&escription:",IDC_STATIC,29,96,38,8 + LTEXT "&Submount:",IDC_STATIC,29,96,38,8 EDITTEXT IDC_DESC,77,94,72,13,ES_AUTOHSCROLL CONTROL "&Restore this mapping whenever I logon",IDC_PERSISTENT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,112,188,10 @@ -442,7 +442,7 @@ BEGIN PUSHBUTTON "Help",9,190,96,50,14 LTEXT "&Drive Letter:",IDC_STATIC,16,25,40,8 LTEXT "AFS &Path:",IDC_STATIC,16,44,33,8 - LTEXT "D&escription:",IDC_STATIC,15,64,38,8 + LTEXT "&Submount:",IDC_STATIC,15,64,38,8 GROUPBOX "Global AFS Drive",IDC_STATIC,7,7,232,80 END @@ -710,8 +710,8 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_BADLOOKUP_DESC "Windows could not find a network address for %1. Check to make sure you typed the name of the machine correctly." - IDS_NEWSUB_DESC "AFS was unable to use the description you specified when connecting the network drive.\n\nThe specified description is already used for a different AFS path." - IDS_BADSUB_DESC "The drive letter description you entered cannot be used.\n\nA drive letter description may have no more than 12 characters, and may not contain spaces or tabs." + IDS_NEWSUB_DESC "AFS was unable to use the submount name you specified when connecting the network drive.\n\nThe specified submount is already used for a different AFS path." + IDS_BADSUB_DESC "The drive letter submount you entered cannot be used.\n\nA submount may have no more than 12 characters, and may not contain spaces or tabs." IDS_BADGATEWAY_DESC "AFS was unable to contact the gateway machine that you specified.\n\nCheck to make sure that you typed the name of the gateway machine correctly." IDS_BADGWCELL_DESC "No configuration information could be found for the AFS cell used by the specified gateway machine.\n\nIf you want to configure the AFS Client into a new cell, you must use the AFS Cells tab to add configuration information for that cell.\n\nCell: %1" IDS_TITLE_CAUTION_NT "Caution - AFS Client Configuration" diff --git a/src/WINNT/client_config/tab_general.cpp b/src/WINNT/client_config/tab_general.cpp index 8ec755eb2..450ad7d70 100644 --- a/src/WINNT/client_config/tab_general.cpp +++ b/src/WINNT/client_config/tab_general.cpp @@ -11,6 +11,7 @@ extern "C" { #include #include #include +#include } #include "afs_config.h" @@ -657,15 +658,27 @@ BOOL GeneralTab_AskIfStopped (HWND hDlg) BOOL fIsCellInCellServDB (LPCTSTR pszCell) { BOOL fFound = FALSE; - CELLSERVDB CellServDB; - if (CSDB_ReadFile (&CellServDB, NULL)) - { - if (CSDB_FindCell (&CellServDB, pszCell)) - fFound = TRUE; - CSDB_FreeFile (&CellServDB); - } + if (CSDB_ReadFile (&CellServDB, NULL)) + { + if (CSDB_FindCell (&CellServDB, pszCell)) + fFound = TRUE; + CSDB_FreeFile (&CellServDB); + } +#ifdef AFS_AFSDB_ENV + if ( fFound == FALSE ) { + int ttl; + char cellname[128], i; + + /* we pray for all ascii cellnames */ + for ( i=0 ; pszCell[i] && i < (sizeof(cellname)-1) ; i++ ) + cellname[i] = pszCell[i]; + cellname[i] = '\0'; + + fFound = !cm_SearchCellByDNS(cellname, NULL, &ttl, NULL, NULL); + } +#endif return fFound; } diff --git a/src/WINNT/client_config/tab_hosts.cpp b/src/WINNT/client_config/tab_hosts.cpp index 3b2600e18..4f270535d 100644 --- a/src/WINNT/client_config/tab_hosts.cpp +++ b/src/WINNT/client_config/tab_hosts.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include +#include } #include "afs_config.h" @@ -181,8 +182,21 @@ BOOL HostsTab_OnApply (HWND hDlg) if (!CSDB_FindCell (&g.Configuration.CellServDB, szCell)) { - Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_BADCELL_DESC_CC); - return FALSE; +#ifdef AFS_AFSDB_ENV + int ttl; + char cellname[128], i; + + /* we pray for all ascii cellnames */ + for ( i=0 ; szCell[i] && i < (sizeof(cellname)-1) ; i++ ) + cellname[i] = szCell[i]; + cellname[i] = '\0'; + + if (cm_SearchCellByDNS(cellname, NULL, &ttl, NULL, NULL)) +#endif + { + Message (MB_ICONASTERISK | MB_OK, GetErrorTitle(), IDS_BADCELL_DESC_CC); + return FALSE; + } } if (!Config_SetCellName (szCell)) diff --git a/src/WINNT/client_cpa/afs_cpa_stub.rc b/src/WINNT/client_cpa/afs_cpa_stub.rc index 8da96f17f..e8ca29bb6 100644 --- a/src/WINNT/client_cpa/afs_cpa_stub.rc +++ b/src/WINNT/client_cpa/afs_cpa_stub.rc @@ -16,3 +16,4 @@ #include "..\..\config\NTVersioninfo.rc" IDI_AFSD ICON DISCARDABLE "afs_conf.ico" +IDI_CCENTER ICON DISCARDABLE "afs_ccenter.ico" diff --git a/src/WINNT/client_cpa/cpl_interface.cpp b/src/WINNT/client_cpa/cpl_interface.cpp index abf53800f..848a31625 100644 --- a/src/WINNT/client_cpa/cpl_interface.cpp +++ b/src/WINNT/client_cpa/cpl_interface.cpp @@ -69,6 +69,7 @@ static BOOL IsClientInstalled (void) extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG lParam2) { LPNEWCPLINFO lpNewCPlInfo; + LPCPLINFO lpCPlInfo; switch (uMsg) { case CPL_INIT: /* first message, sent once */ @@ -80,6 +81,14 @@ extern "C" LONG APIENTRY CPlApplet(HWND hwndCPl, UINT uMsg, LONG lParam1, LONG l return 1; break; + case CPL_INQUIRE: /* in case we receive this we should indicate that we like NEWINQUIRE better. */ + lpCPlInfo = (CPLINFO *) lParam2; + lpCPlInfo->idIcon = ((IsClientInstalled() || !IsWindowsNT())? IDI_AFSD : IDI_CCENTER); + lpCPlInfo->idName = CPL_DYNAMIC_RES; + lpCPlInfo->idInfo = CPL_DYNAMIC_RES; + lpCPlInfo->lData = 0; + break; + case CPL_NEWINQUIRE: /* third message, sent once per app */ lpNewCPlInfo = (LPNEWCPLINFO) lParam2; diff --git a/src/WINNT/client_creds/advtab.cpp b/src/WINNT/client_creds/advtab.cpp index 108972b20..c0d18b43a 100644 --- a/src/WINNT/client_creds/advtab.cpp +++ b/src/WINNT/client_creds/advtab.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include +#include } #include "afscreds.h" @@ -214,6 +215,12 @@ void Advanced_OnChangeService (HWND hDlg, WORD wCmd) if (StartService (hService, 0, 0)) { TestAndDoMapShare(SERVICE_START_PENDING); + if ( KFW_is_available() && KFW_AFS_wait_for_service_start() ) { +#ifdef USE_MS2MIT + KFW_import_windows_lsa(); +#endif /* USE_MS2MIT */ + KFW_AFS_renew_tokens_for_all_cells(); + } fSuccess = TRUE; } CloseServiceHandle (hService); diff --git a/src/WINNT/client_creds/afswiz.cpp b/src/WINNT/client_creds/afswiz.cpp index 43390d591..876302aa0 100644 --- a/src/WINNT/client_creds/afswiz.cpp +++ b/src/WINNT/client_creds/afswiz.cpp @@ -231,7 +231,7 @@ void WizStarting_OnInitDialog (HWND hDlg) SERVICE_QUERY_STATUS | SERVICE_START)) != NULL) { if (StartService (hService, 0, 0)) - TestAndDoMapShare(SERVICE_START_PENDING); + TestAndDoMapShare(SERVICE_START_PENDING); CloseServiceHandle (hService); } @@ -345,7 +345,6 @@ void WizCreds_OnInitDialog (HWND hDlg) HKEY hk; TCHAR szCell[ cchRESOURCE ] = TEXT(""); - (void)GetDefaultCell (szCell); SetDlgItemText (hDlg, IDC_NEWCREDS_CELL, szCell); TCHAR szUser[ cchRESOURCE ] = TEXT(""); diff --git a/src/WINNT/client_creds/creds.cpp b/src/WINNT/client_creds/creds.cpp index 59cca63b1..ff568ca18 100644 --- a/src/WINNT/client_creds/creds.cpp +++ b/src/WINNT/client_creds/creds.cpp @@ -437,22 +437,35 @@ int ObtainNewCredentials (LPCTSTR pszCell, LPCTSTR pszUser, LPCTSTR pszPassword, int GetDefaultCell (LPTSTR pszCell) { - int rc = KTC_NOCM; - *pszCell = TEXT('\0'); - - if (!Creds_OpenLibraries()) - { - rc = ERROR_DLL_INIT_FAILED; - } - else if (IsServiceRunning()) - { - char szCellA[ 256 ]; - - int rc; - if ((rc = cm_GetRootCellName (szCellA)) == 0) - CopyAnsiToString (pszCell, szCellA); - } - - return rc; + int rc = KTC_NOCM; + *pszCell = TEXT('\0'); + + if (!Creds_OpenLibraries()) + { + rc = ERROR_DLL_INIT_FAILED; + } + else if (IsServiceRunning()) + { + char szCellA[ 256 ] = ""; + int rc; + HKEY hk; + + if (RegOpenKey (HKEY_CURRENT_USER, REGSTR_PATH_OPENAFS_CLIENT, &hk) == 0) + { + DWORD dwSize = sizeof(szCellA); + DWORD dwType = REG_SZ; + RegQueryValueEx (hk, TEXT("Authentication Cell"), NULL, &dwType, (PBYTE)szCellA, &dwSize); + RegCloseKey (hk); + } + + if (szCellA[0] == '\0') { + rc = cm_GetRootCellName (szCellA); + } else { + rc = 0; + } + if (rc == 0) + CopyAnsiToString(pszCell, szCellA); + } + return rc; } diff --git a/src/WINNT/client_creds/credstab.cpp b/src/WINNT/client_creds/credstab.cpp index f6bfc444c..2ab0949fb 100644 --- a/src/WINNT/client_creds/credstab.cpp +++ b/src/WINNT/client_creds/credstab.cpp @@ -329,19 +329,20 @@ void NewCreds_OnInitDialog (HWND hDlg) void NewCreds_OnEnable (HWND hDlg) { - BOOL fEnable = TRUE; - - TCHAR szUser[ cchRESOURCE ]; - GetDlgItemText (hDlg, IDC_NEWCREDS_USER, szUser, cchRESOURCE); - if (!szUser[0]) - fEnable = FALSE; - - TCHAR szPassword[ cchRESOURCE ]; - GetDlgItemText (hDlg, IDC_NEWCREDS_PASSWORD, szPassword, cchRESOURCE); - if (!szPassword[0]) - fEnable = FALSE; - - EnableWindow (GetDlgItem (hDlg, IDOK), fEnable); + BOOL fEnable = TRUE; + + TCHAR szUser[ cchRESOURCE ]; + GetDlgItemText (hDlg, IDC_NEWCREDS_USER, szUser, cchRESOURCE); + if (!szUser[0]) + fEnable = FALSE; + + if ( !strchr(szUser, '@') ) { + TCHAR szPassword[ cchRESOURCE ]; + GetDlgItemText (hDlg, IDC_NEWCREDS_PASSWORD, szPassword, cchRESOURCE); + if (!szPassword[0]) + fEnable = FALSE; + } + EnableWindow (GetDlgItem (hDlg, IDOK), fEnable); } diff --git a/src/WINNT/client_creds/lang/de_DE/afscreds.rc b/src/WINNT/client_creds/lang/de_DE/afscreds.rc index 517e42480..973ad06f5 100644 --- a/src/WINNT/client_creds/lang/de_DE/afscreds.rc +++ b/src/WINNT/client_creds/lang/de_DE/afscreds.rc @@ -479,7 +479,7 @@ BEGIN MENUITEM "Token an&zeigen...", M_ACTIVATE MENUITEM "Vor Ablauf &warnen", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "Symbol entfe&rnen", M_TERMINATE + MENUITEM "Symbol entfe&rnen...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/en_US/afscreds.rc b/src/WINNT/client_creds/lang/en_US/afscreds.rc index 271da75b4..5c62516c7 100644 --- a/src/WINNT/client_creds/lang/en_US/afscreds.rc +++ b/src/WINNT/client_creds/lang/en_US/afscreds.rc @@ -272,7 +272,7 @@ BEGIN WS_VSCROLL | WS_TABSTOP LTEXT "AFS &Path:",IDC_STATIC,34,76,33,8 EDITTEXT IDC_MAP_PATH,77,74,96,14,ES_AUTOHSCROLL - LTEXT "D&escription:",IDC_STATIC,34,94,38,8 + LTEXT "&Submount:",IDC_STATIC,34,94,38,8 EDITTEXT IDC_MAP_DESC,77,92,60,14,ES_AUTOHSCROLL END @@ -355,7 +355,7 @@ BEGIN WS_VSCROLL | WS_TABSTOP LTEXT "AFS &Path:",IDC_STATIC,23,70,33,8 EDITTEXT IDC_MAP_PATH,73,68,178,13,ES_AUTOHSCROLL - LTEXT "D&escription:",IDC_STATIC,23,88,38,8 + LTEXT "&Submount:",IDC_STATIC,23,88,38,8 EDITTEXT IDC_MAP_DESC,73,86,60,13,ES_AUTOHSCROLL CONTROL "&Restore this mapping whenever I logon", IDC_MAP_PERSISTENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, @@ -475,7 +475,7 @@ BEGIN MENUITEM "&Show Tokens...", M_ACTIVATE MENUITEM "&Warn Before Expiration", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "&Remove Icon", M_TERMINATE + MENUITEM "&Remove Icon...", M_TERMINATE END @@ -549,7 +549,7 @@ BEGIN IDS_UNCONFIG_DESC "The AFS Client cannot be used because it is not yet configured.\n\nTo configure the AFS Client, open the Control Panel and double-click on the AFS Client icon." IDS_NEWSUB_TITLE "Caution - AFS Client" IDS_NEWSUB_TITLE_95 "Caution - AFS Light" - IDS_NEWSUB_DESC "AFS was unable to use the description you specified when connecting the network drive.\n\nThe specified description is already used for a different AFS path." + IDS_NEWSUB_DESC "AFS was unable to use the submount you specified when connecting the network drive.\n\nThe specified submount is already used for a different AFS path." IDS_BADSUB_TITLE "Error - AFS Client" END diff --git a/src/WINNT/client_creds/lang/es_ES/afscreds.rc b/src/WINNT/client_creds/lang/es_ES/afscreds.rc index 61e762ca9..8aa918147 100644 --- a/src/WINNT/client_creds/lang/es_ES/afscreds.rc +++ b/src/WINNT/client_creds/lang/es_ES/afscreds.rc @@ -503,7 +503,7 @@ BEGIN MENUITEM "&Mostrar señales...", M_ACTIVATE MENUITEM "A&visar antes de la caducidad", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "&Eliminar icono", M_TERMINATE + MENUITEM "&Eliminar icono...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/ja_JP/afscreds.rc b/src/WINNT/client_creds/lang/ja_JP/afscreds.rc index 878b985ba..b5142bb04 100644 --- a/src/WINNT/client_creds/lang/ja_JP/afscreds.rc +++ b/src/WINNT/client_creds/lang/ja_JP/afscreds.rc @@ -489,7 +489,7 @@ BEGIN MENUITEM "ƒg[ƒNƒ“‚Ì•\ަ(&S)...", M_ACTIVATE MENUITEM "ŠúŒÀØ‚ê‘O‚ÉŒx(&W)", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "ƒAƒCƒRƒ“‚̍폜(&R)", M_TERMINATE + MENUITEM "ƒAƒCƒRƒ“‚̍폜(&R)...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/ko_KR/afscreds.rc b/src/WINNT/client_creds/lang/ko_KR/afscreds.rc index 76426c871..519d795d2 100644 --- a/src/WINNT/client_creds/lang/ko_KR/afscreds.rc +++ b/src/WINNT/client_creds/lang/ko_KR/afscreds.rc @@ -471,7 +471,7 @@ BEGIN MENUITEM "ÅäÅ« Ç¥½Ã(&S)...", M_ACTIVATE MENUITEM "¸¸±â Àü °æ°í(&W)", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "¾ÆÀÌÄÜ Á¦°Å(&R)", M_TERMINATE + MENUITEM "¾ÆÀÌÄÜ Á¦°Å(&R)...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/pt_BR/afscreds.rc b/src/WINNT/client_creds/lang/pt_BR/afscreds.rc index 586ea2a66..2e5e07576 100644 --- a/src/WINNT/client_creds/lang/pt_BR/afscreds.rc +++ b/src/WINNT/client_creds/lang/pt_BR/afscreds.rc @@ -478,7 +478,7 @@ BEGIN MENUITEM "&Mostrar Tokens...", M_ACTIVATE MENUITEM "&Avisar Antes do Vencimento", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "&Remover Ícone", M_TERMINATE + MENUITEM "&Remover Ícone...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/zh_CN/afscreds.rc b/src/WINNT/client_creds/lang/zh_CN/afscreds.rc index c88bf0c5c..64115963d 100644 --- a/src/WINNT/client_creds/lang/zh_CN/afscreds.rc +++ b/src/WINNT/client_creds/lang/zh_CN/afscreds.rc @@ -468,7 +468,7 @@ BEGIN MENUITEM "ÏÔʾÁîÅÆ(&S)...", M_ACTIVATE MENUITEM "µ½ÆÚǰ¾¯¸æ(&W)", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "³ýȥͼ±ê(&R)", M_TERMINATE + MENUITEM "³ýȥͼ±ê(&R)...", M_TERMINATE END diff --git a/src/WINNT/client_creds/lang/zh_TW/afscreds.rc b/src/WINNT/client_creds/lang/zh_TW/afscreds.rc index ce94ea11b..972b0c71b 100644 --- a/src/WINNT/client_creds/lang/zh_TW/afscreds.rc +++ b/src/WINNT/client_creds/lang/zh_TW/afscreds.rc @@ -482,7 +482,7 @@ BEGIN MENUITEM "Åã¥Ü°O¸¹(&S)...", M_ACTIVATE MENUITEM "¹L´Á«e¥ýĵ§i(&W)", M_REMIND, CHECKED MENUITEM SEPARATOR - MENUITEM "²¾°£¹Ï¥Ü(&R)", M_TERMINATE + MENUITEM "²¾°£¹Ï¥Ü(&R)...", M_TERMINATE END diff --git a/src/WINNT/client_creds/shortcut.cpp b/src/WINNT/client_creds/shortcut.cpp index 6bce0c72b..da0f39262 100644 --- a/src/WINNT/client_creds/shortcut.cpp +++ b/src/WINNT/client_creds/shortcut.cpp @@ -115,9 +115,6 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart) code = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_OPENAFS_CLIENT, 0, KEY_QUERY_VALUE, &hk); - if (code != ERROR_SUCCESS) - code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT, - 0, KEY_QUERY_VALUE, &hk); if (code == ERROR_SUCCESS) { len = sizeof(szParams); type = REG_SZ; @@ -125,6 +122,17 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart) (BYTE *) &szParams, &len); RegCloseKey (hk); } + if (code != ERROR_SUCCESS) { + code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT, + 0, KEY_QUERY_VALUE, &hk); + if (code == ERROR_SUCCESS) { + len = sizeof(szParams); + type = REG_SZ; + code = RegQueryValueEx(hk, "AfscredsShortcutParams", NULL, &type, + (BYTE *) &szParams, &len); + RegCloseKey (hk); + } + } Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams); } else // (!g.fAutoStart) diff --git a/src/WINNT/client_creds/window.cpp b/src/WINNT/client_creds/window.cpp index 73ae6daaf..d788d9f0b 100644 --- a/src/WINNT/client_creds/window.cpp +++ b/src/WINNT/client_creds/window.cpp @@ -208,6 +208,9 @@ BOOL CALLBACK Main_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) if (StartService (hService, 0, 0)) TestAndDoMapShare(SERVICE_START_PENDING); if ( KFW_is_available() && KFW_AFS_wait_for_service_start() ) { +#ifdef USE_MS2MIT + KFW_import_windows_lsa(); +#endif /* USE_MS2MIT */ KFW_AFS_renew_tokens_for_all_cells(); } @@ -243,34 +246,35 @@ void Main_Show (BOOL fShow) void Main_OnInitDialog (HWND hDlg) { - if (!g.fIsWinNT) - { - TCHAR szTitle[256]; - GetString (szTitle, IDS_TITLE_95); - SetWindowText (hDlg, szTitle); - } + if (!g.fIsWinNT) + { + TCHAR szTitle[256]; + GetString (szTitle, IDS_TITLE_95); + SetWindowText (hDlg, szTitle); + } - TCHAR szVersion[256]; - DWORD dwPatch = 0; - TCHAR szUser[256]; - GetString (szVersion, IDS_UNKNOWN); - GetString (szUser, IDS_UNKNOWN); + TCHAR szVersion[256]; + DWORD dwPatch = 0; + TCHAR szUser[256]; + GetString (szVersion, IDS_UNKNOWN); + GetString (szUser, IDS_UNKNOWN); - HKEY hk; - if (RegOpenKey (HKEY_LOCAL_MACHINE, REGSTR_PATH_AFS, &hk) == 0) - { - DWORD dwSize = sizeof(szVersion); - DWORD dwType = REG_SZ; - RegQueryValueEx (hk, REGVAL_AFS_VERSION, NULL, &dwType, (PBYTE)szVersion, &dwSize); + HKEY hk; + if (RegOpenKey (HKEY_LOCAL_MACHINE, REGSTR_PATH_AFS, &hk) == 0) + { + DWORD dwSize = sizeof(szVersion); + DWORD dwType = REG_SZ; + RegQueryValueEx (hk, REGVAL_AFS_VERSION, NULL, &dwType, (PBYTE)szVersion, &dwSize); - dwSize = sizeof(dwPatch); - dwType = REG_DWORD; - RegQueryValueEx (hk, REGVAL_AFS_PATCH, NULL, &dwType, (PBYTE)&dwPatch, &dwSize); - RegCloseKey (hk); - } + dwSize = sizeof(dwPatch); + dwType = REG_DWORD; + RegQueryValueEx (hk, REGVAL_AFS_PATCH, NULL, &dwType, (PBYTE)&dwPatch, &dwSize); + RegCloseKey (hk); + } - BOOL fFoundUserName = FALSE; - if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Explorer"), &hk) == 0) + /* We should probably be using GetUserNameEx() for this */ + BOOL fFoundUserName = FALSE; + if (RegOpenKey (HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &hk) == 0) { DWORD dwSize = sizeof(szUser); DWORD dwType = REG_SZ; @@ -279,6 +283,17 @@ void Main_OnInitDialog (HWND hDlg) RegCloseKey (hk); } if (!fFoundUserName ) + { + if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Explorer"), &hk) == 0) + { + DWORD dwSize = sizeof(szUser); + DWORD dwType = REG_SZ; + if (RegQueryValueEx (hk, TEXT("Logon User Name"), NULL, &dwType, (PBYTE)szUser, &dwSize) == 0) + fFoundUserName = TRUE; + RegCloseKey (hk); + } + } + if (!fFoundUserName ) { if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hk) == 0) { @@ -288,29 +303,29 @@ void Main_OnInitDialog (HWND hDlg) fFoundUserName = TRUE; RegCloseKey (hk); } + } + if (!fFoundUserName) + { + if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Network\\Logon"), &hk) == 0) + { + DWORD dwSize = sizeof(szUser); + DWORD dwType = REG_SZ; + if (RegQueryValueEx (hk, TEXT("UserName"), NULL, &dwType, (PBYTE)szUser, &dwSize) == 0) + fFoundUserName = TRUE; + RegCloseKey (hk); + } } - if (!fFoundUserName) - { - if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Network\\Logon"), &hk) == 0) - { - DWORD dwSize = sizeof(szUser); - DWORD dwType = REG_SZ; - if (RegQueryValueEx (hk, TEXT("UserName"), NULL, &dwType, (PBYTE)szUser, &dwSize) == 0) - fFoundUserName = TRUE; - RegCloseKey (hk); - } - } - TCHAR szSource[ cchRESOURCE ]; - TCHAR szTarget[ cchRESOURCE ]; + TCHAR szSource[ cchRESOURCE ]; + TCHAR szTarget[ cchRESOURCE ]; - GetString (szSource, (dwPatch) ? IDS_TITLE_VERSION : IDS_TITLE_VERSION_NOPATCH); - wsprintf (szTarget, szSource, szVersion, dwPatch); - SetDlgItemText (hDlg, IDC_TITLE_VERSION, szTarget); + GetString (szSource, (dwPatch) ? IDS_TITLE_VERSION : IDS_TITLE_VERSION_NOPATCH); + wsprintf (szTarget, szSource, szVersion, dwPatch); + SetDlgItemText (hDlg, IDC_TITLE_VERSION, szTarget); - GetDlgItemText (hDlg, IDC_TITLE_NT, szSource, cchRESOURCE); - wsprintf (szTarget, szSource, szUser); - SetDlgItemText (hDlg, IDC_TITLE_NT, szTarget); + GetDlgItemText (hDlg, IDC_TITLE_NT, szSource, cchRESOURCE); + wsprintf (szTarget, szSource, szUser); + SetDlgItemText (hDlg, IDC_TITLE_NT, szTarget); } diff --git a/src/WINNT/client_exp/gui2fs.cpp b/src/WINNT/client_exp/gui2fs.cpp index f0b72680b..6865a63c5 100644 --- a/src/WINNT/client_exp/gui2fs.cpp +++ b/src/WINNT/client_exp/gui2fs.cpp @@ -1478,7 +1478,7 @@ BOOL GetTokenInfo(CStringArray& tokenInfo) int cellNum; int rc; int current_time; - long tokenExpireTime; + time_t tokenExpireTime; char *expireString; char userName[100]; // char s[100]; diff --git a/src/WINNT/client_exp/stdafx.h b/src/WINNT/client_exp/stdafx.h index ea5853f1e..b9921cd7c 100644 --- a/src/WINNT/client_exp/stdafx.h +++ b/src/WINNT/client_exp/stdafx.h @@ -16,6 +16,10 @@ #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +// Don't include stuff we don't need. +#define _AFX_NO_DB_SUPPORT +#define _AFX_NO_DAO_SUPPORT + #include // MFC core and standard components #include // MFC extensions diff --git a/src/WINNT/client_exp/submounts_dlg.cpp b/src/WINNT/client_exp/submounts_dlg.cpp index 5e5302e22..dae6c571d 100644 --- a/src/WINNT/client_exp/submounts_dlg.cpp +++ b/src/WINNT/client_exp/submounts_dlg.cpp @@ -44,12 +44,25 @@ static CSubmountInfo *ReadSubmtInfo(const CString& strShareName) char pathName[1024]; - len = GetPrivateProfileString("AFS Submounts", - PCCHAR(strShareName), - "", pathName, sizeof(pathName), - "afsdsbmt.ini"); - - if (len == 0 || len == sizeof(pathName) - 1) + HKEY hkSubmounts; + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hkSubmounts, + NULL ); + + DWORD dwType; + DWORD status; + len = sizeof(pathName); + status = RegQueryValueEx( hkSubmounts, (LPCSTR)PCCHAR(strShareName), 0, + &dwType, (LPBYTE)pathName, &len); + RegCloseKey( hkSubmounts ); + + if (status || len == 0) return pInfo; pInfo = new CSubmountInfo(); @@ -148,32 +161,47 @@ BOOL CSubmountsDlg::FillSubmtList() { HOURGLASS hourglass; - DWORD lsize, size = 500; - char *buf = NULL, *next; - - /* - * We don't know how large a buffer we need. Keep doubling it until - * we're sure we have enough. - */ - do { - size *= 2; - if (buf != NULL) free(buf); - buf = (char *)malloc(size); - lsize = GetPrivateProfileSection("AFS Submounts", buf, size, - "afsdsbmt.ini"); - } - while (lsize >= size - 2); - - if (lsize != 0) { - next = buf; - do { - m_SubmtList.AddString(next); - next += (strlen(next) + 1); - } - while (*next); - } - - free(buf); + HKEY hkSubmounts; + DWORD dwType; + DWORD dwIndex; + DWORD dwSubmounts; + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_WRITE|KEY_QUERY_VALUE, + NULL, + &hkSubmounts, + NULL ); + + RegQueryInfoKey( hkSubmounts, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwSubmounts, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + + for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) { + char submountName[256]; + DWORD submountNameLen = sizeof(submountName); + + RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL, + &dwType, NULL, NULL); + + m_SubmtList.AddString(submountName); + } + + RegCloseKey( hkSubmounts ); return TRUE; } @@ -219,25 +247,43 @@ static BOOL AddSubmt(CSubmountInfo *pInfo) { HOURGLASS hourglass; - BOOL written = - WritePrivateProfileString("AFS Submounts", - PCCHAR(pInfo->GetShareName()), - PCCHAR(pInfo->GetPathName()), - "afsdsbmt.ini"); - - return written; + HKEY hkSubmounts; + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hkSubmounts, + NULL ); + + DWORD status = RegSetValueEx( hkSubmounts, PCCHAR(pInfo->GetShareName()), 0, REG_SZ, + (const BYTE *)PCCHAR(pInfo->GetPathName()), strlen(PCCHAR(pInfo->GetPathName())) + 1); + + RegCloseKey(hkSubmounts); + return (status == ERROR_SUCCESS); } static BOOL DeleteSubmt(CSubmountInfo *pInfo) { HOURGLASS hourglass; - BOOL written = - WritePrivateProfileString("AFS Submounts", - PCCHAR(pInfo->GetShareName()), - NULL, - "afsdsbmt.ini"); - return written; + HKEY hkSubmounts; + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\Submounts", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hkSubmounts, + NULL ); + + DWORD status = RegDeleteValue( hkSubmounts, PCCHAR(pInfo->GetShareName())); + + RegCloseKey(hkSubmounts); + return (status == ERROR_SUCCESS); } void CSubmountsDlg::OnAdd() diff --git a/src/WINNT/client_osi/osilog.c b/src/WINNT/client_osi/osilog.c index 72fbecbd1..c9af7a38f 100644 --- a/src/WINNT/client_osi/osilog.c +++ b/src/WINNT/client_osi/osilog.c @@ -342,8 +342,8 @@ void osi_LogDisable(osi_log_t *logp) } #define REG_CLIENT_PARMS_KEY "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters" -#define TRACE_OPTION_EVENT 1 -#define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) +#define TRACE_OPTION_EVENT 2 +#define ISCLIENTTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT) DWORD osi_TraceOption=0; @@ -364,7 +364,7 @@ void osi_LogEvent0(char *a,char *b) { HANDLE h; char *ptbuf[1]; - if (!ISLOGONTRACE(osi_TraceOption)) + if (!ISCLIENTTRACE(osi_TraceOption)) return; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); ptbuf[0] = b; @@ -377,7 +377,7 @@ void osi_LogEvent(char *a,char *b,char *c,...) { HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; va_list marker; - if (!ISLOGONTRACE(osi_TraceOption)) + if (!ISCLIENTTRACE(osi_TraceOption)) return; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); va_start(marker,c); diff --git a/src/WINNT/client_osi/osilog.h b/src/WINNT/client_osi/osilog.h index 2a0183e76..6eefb0f8e 100644 --- a/src/WINNT/client_osi/osilog.h +++ b/src/WINNT/client_osi/osilog.h @@ -19,7 +19,7 @@ #include "osiqueue.h" #define OSI_LOG_DEFAULTSIZE 1000 -#define OSI_LOG_STRINGSIZE 30 +#define OSI_LOG_STRINGSIZE 128 #define OSI_LOG_MAXPARMS 4 /* max # of int parms */ typedef struct osi_logEntry { diff --git a/src/WINNT/install/NSIS/AFSCell.ini b/src/WINNT/install/NSIS/AFSCell.ini index e410d6f0a..9c09ef138 100644 --- a/src/WINNT/install/NSIS/AFSCell.ini +++ b/src/WINNT/install/NSIS/AFSCell.ini @@ -1,5 +1,5 @@ [Settings] -NumFields=13 +NumFields=11 [Field 1] Type=label @@ -49,15 +49,15 @@ Right=-1 Top=65 Bottom=75 -[Field 11] +[Field 9] Type=Checkbox -State=0 +State=1 Left=50 Right=60 Top=75 Bottom=85 -[Field 12] +[Field 10] Type=label Text=Use DNS to Search for Cell Servers Left=65 @@ -81,23 +81,7 @@ Right=-1 Top=85 Bottom=95 -[Field 9] -Type=Checkbox -State=0 -Left=50 -Right=60 -Top=95 -Bottom=105 - -[Field 10] -Type=label -Text=Enable Integrated Logon high security -Left=65 -Right=-1 -Top=95 -Bottom=105 - -[Field 13] +[Field 11] Type=label Text=You may now configure some installation options that control how the AFS Client behaves. Left=35 diff --git a/src/WINNT/install/NSIS/CellServDB b/src/WINNT/install/NSIS/CellServDB new file mode 100644 index 000000000..7b320be66 --- /dev/null +++ b/src/WINNT/install/NSIS/CellServDB @@ -0,0 +1,498 @@ +>grand.central.org #GCO Public CellServDB 29 Jun 2004 +18.7.14.88 #grand-opening.mit.edu +128.2.191.224 #penn.central.org +>wu-wien.ac.at #University of Economics, Vienna, Austria +137.208.3.33 #afsdb1.wu-wien.ac.at +137.208.7.4 #afsdb2.wu-wien.ac.at +137.208.7.7 #afsdb3.wu-wien.ac.at +>hephy.at #hephy-vienna +193.170.243.10 #mowgli.oeaw.ac.at +193.170.243.12 #baloo.oeaw.ac.at +193.170.243.14 #akela.oeaw.ac.at +>itp.tugraz.at #Institute for Theoretical Physics, TU Graz, Austria +129.27.157.6 #fubphsv2.tu-graz.ac.at +129.27.161.7 #faepsv01.tu-graz.ac.at +129.27.161.15 #faepsv02.tu-graz.ac.at +>cern.ch #European Laboratory for Particle Physics, Geneva +137.138.128.148 #afsdb1.cern.ch +137.138.246.50 #afsdb3.cern.ch +137.138.246.51 #afsdb2.cern.ch +>ams.cern.ch #AMS Experiment +137.138.206.77 #pcamsf2.cern.ch +137.138.206.123 #pcamsf4.cern.ch +>ethz.ch #Swiss Federal Inst. of Tech. - Zurich, Switzerland +129.132.97.19 #amalthea.ethz.ch +129.132.97.27 #nethzafs-001.ethz.ch +129.132.115.3 #himalia.ethz.ch +129.132.115.37 #nethzafs-005.ethz.ch +129.132.115.38 #nethzafs-006.ethz.ch +>psi.ch #Paul Scherrer Institut - Villigen, Switzerland +129.129.16.10 #afs1.psi.ch +129.129.16.11 #afs2.psi.ch +>extundo.com #Simon Josefsson's cell +195.42.214.241 #slipsten.extundo.com +>mekinok.com #Mekinok, Inc. +4.36.43.98 #loggerhead.mekinok.com +>membrain.com #membrain.com +66.93.118.125 #stormy +130.85.24.11 #weasel +130.85.24.13 #straykitten +>midnightlinux.com #Midnight Linux, Pittsburgh PA +66.93.62.18 #romulus.midnihtlinux.com +66.93.62.20 #yar.midnightlinux.com +>setfilepointer.com #SetFilePointer.com +63.224.10.2 #hamlet.SetFilePointer.com +63.224.10.4 #troilus.SetFilePointer.com +>sodre.cx #Sodre.cx +128.8.140.165 #greed.sodre.cx +>desy.de #Deutsches Elektronen-Synchrotron +131.169.40.62 #vayu.desy.de +131.169.244.60 #solar00.desy.de +>gppc.de #GPP Chemnitz mbH +213.187.92.33 #gpp1.gppc.de +213.187.92.34 #paulchen.gppc.de +213.187.92.35 #lotus.gppc.de +>ifh.de #DESY Zeuthen +141.34.22.10 #romulus.ifh.de +141.34.22.11 #remus.ifh.de +141.34.22.29 #hekate.ifh.de +>lrz-muenchen.de #Leibniz Computing Centre, Germany +129.187.10.36 #afs1.lrz-muenchen.de +129.187.10.56 #afs3.lrz-muenchen.de +129.187.10.57 #afs2.lrz-muenchen.de +>ipp-garching.mpg.de #Institut fuer Plasmaphysik +130.183.9.5 #afs-db1.rzg.mpg.de +130.183.100.10 #afs-db2.aug.ipp-garching.mpg.de +130.183.100.23 #afs-db3.aug.ipp-garching.mpg.de +>mpe.mpg.de #MPE cell +130.183.130.7 #irafs1.mpe-garching.mpg.de +130.183.134.20 #irafs2.mpe-garching.mpg.de +>i1.informatik.rwth-aachen.de #Informatik I, RWTH Aachen +137.226.244.79 #remus.informatik.rwth-aachen.de +>tu-chemnitz.de #Technische Universitaet Chemnitz, Germany +134.109.2.1 #zuse.hrz.tu-chemnitz.de +134.109.2.15 #phoenix.hrz.tu-chemnitz.de +134.109.200.7 #aetius.hrz.tu-chemnitz.de +>e18.ph.tum.de #Experimental Physics, TU Munich, Germany +129.187.154.223 #hamlet.e18.physik.tu-muenchen.de +>uni-bonn.de #University of Bonn, Computing Center +131.220.14.198 #work15-eth.rhrz.uni-bonn.de +131.220.14.205 #node05.rhrz.uni-bonn.de +131.220.15.197 #afs-db1.rhrz.uni-bonn.de +>atlass01.physik.uni-bonn.de #Bonn ATLAS +131.220.165.43 #atlass01.physik.uni-bonn.de +>uni-freiburg.de #Albert-Ludwigs-Universitat Freiburg +132.230.6.235 #sv6.ruf.uni-freiburg.de +132.230.6.236 #sv7.ruf.uni-freiburg.de +132.230.6.237 #sv8.ruf.uni-freiburg.de +>physik.uni-freiburg.de #institute of physics, university Freiburg, Germany +132.230.77.16 #hepafs.physik.uni-freiburg.de +>urz.uni-heidelberg.de #Uni Heidelberg (Rechenzentrum) +129.206.119.10 #afsdb.urz.uni-heidelberg.de +129.206.119.16 #afsdb1.urz.uni-heidelberg.de +129.206.119.17 #afsdb2.urz.uni-heidelberg.de +>uni-hohenheim.de #University of Hohenheim +144.41.2.2 #rs13.serv.uni-hohenheim.de +144.41.2.3 #rs14.serv.uni-hohenheim.de +144.41.2.4 #rs15.serv.uni-hohenheim.de +>rz.uni-jena.de #Rechenzentrum University of Jena, Germany +141.35.2.160 #lc00.rz.uni-jena.de +141.35.7.9 #fsuj01.rz.uni-jena.de +141.35.7.10 #zaphod.rz.uni-jena +>meteo.uni-koeln.de #Univ. of Cologne - Inst. for Geophysics & Meteorology +134.95.144.22 #afs1.meteo.uni-koeln.de +134.95.144.24 #afs2.meteo.uni-koeln.de +>rrz.uni-koeln.de #University of Cologne - Reg Comp Center +134.95.19.3 #afsdb1.rrz.uni-koeln.de +134.95.19.30 #fileserv3.rrz.uni-koeln.de +134.95.67.97 #afs.thp.uni-koeln.de +134.95.140.190 #rzkbserv.rrz.uni-koeln.de +>physik.uni-mainz.de #institute of physics, university Mainz, Germany +134.93.130.93 #hardy.physik.uni-mainz.de +>uni-mannheim.de #Uni Mannheim (Rechenzentrum) +134.155.97.204 #afsdb1.uni-mannheim.de +134.155.97.205 #afsdb2.uni-mannheim.de +134.155.97.206 #afsdb3.uni-mannheim.de +>physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal +132.195.104.3 #afs1.physik.uni-wuppertal.de +132.195.104.230 #afs2.physik.uni-wuppertal.de +>ies.auc.dk #Aalborg Univ., Inst. of Electronic Systems, Denmark +130.225.51.73 #afsdb1.kom.auc.dk +130.225.51.74 #afsdb2.kom.auc.dk +130.225.51.85 #afsdb3.kom.auc.dk +>asu.edu #Arizona State University +129.219.10.69 #authen2.asu.edu +129.219.10.70 #authen1.asu.edu +129.219.10.72 #authen3.asu.edu +129.219.100.16 #authen4.asu.edu +>hep.caltech.edu #CalTech High Energy Physics +131.215.126.150 #afs.hep.caltech.edu +>andrew.cmu.edu #Carnegie Mellon University - Computing Services Cell +128.2.10.2 #vice2.fs.andrew.cmu.edu +128.2.10.7 #vice7.fs.andrew.cmu.edu +128.2.10.11 #vice11.fs.andrew.cmu.edu +128.2.10.28 #vice28.fs.andrew.cmu.edu +128.2.32.44 #new-vice12.fs.andrew.cmu.edu +>club.cc.cmu.edu #Carnegie Mellon University Computer Club +128.2.4.131 #yttrium.club.cc.cmu.edu +128.2.4.132 #zirconium.club.cc.cmu.edu +>chem.cmu.edu #Carnegie Mellon University - Chemistry Dept. +128.2.40.134 #afs.chem.cmu.edu +128.2.40.140 #afs2.chem.cmu.edu +>cs.cmu.edu #Carnegie Mellon University - School of Comp. Sci. +128.2.194.178 #cherry.srv.cs.cmu.edu +128.2.194.179 #pumpkin.srv.cs.cmu.edu +128.2.194.180 #strawberry.srv.cs.cmu.edu +>ece.cmu.edu #Carnegie Mellon University - Elec. Comp. Eng. Dept. +128.2.129.7 #porok.ece.cmu.edu +128.2.129.8 #vicio.ece.cmu.edu +128.2.129.9 #e-xing.ece.cmu.edu +>scotch.ece.cmu.edu #CMU ECE CALCM research group +128.2.134.82 #lagavulin.ece.cmu.edu +>qatar.cmu.edu #Carnegie Mellon University - Qatar Campus Cell +204.194.25.7 #afs1.qatar.cmu.edu +204.194.25.8 #afs2.qatar.cmu.edu +>msc.cornell.edu #Cornell University Materials Science Center +128.84.231.242 #miranda.ccmr.cornell.edu +128.84.241.35 #co.ccmr.cornell.edu +128.84.249.78 #dax.ccmr.cornell.edu +>dbic.dartmouth.edu #Dartmouth Brain Imaging Center +129.170.30.143 #dbicafs1.dartmouth.edu +129.170.30.144 #dbicafs2.dartmouth.edu +129.170.30.145 #dbicafs3.dartmouth.edu +>northstar.dartmouth.edu #Dartmouth College Research Computing +129.170.16.22 #halley.dartmouth.edu +129.170.16.42 #oort.dartmouth.edu +129.170.16.43 #cygnusx1.dartmouth.edu +>iastate.edu #Iowa State University +129.186.1.243 #afsdb-1.iastate.edu +129.186.6.243 #afsdb-2.iastate.edu +129.186.142.243 #afsdb-3.iastate.edu +>athena.mit.edu #MIT/Athena cell +18.7.1.66 #paris.mit.edu. +18.7.1.74 #chimera.mit.edu. +18.158.0.37 #prill.mit.edu. +>dev.mit.edu #MIT/IS Development cell +18.7.1.70 #wham.mit.edu. +18.7.15.89 #rattle.mit.edu. +18.7.15.93 #hum.mit.edu. +>net.mit.edu #MIT/Network Group cell +18.7.7.73 #gracie.mit.edu +18.7.21.95 #george.mit.edu +>sipb.mit.edu #MIT/SIPB cell +18.181.0.19 #reynelda.mit.edu. +18.181.0.22 #rosebud.mit.edu. +18.181.0.23 #ronald-ann.mit.edu. +>msu.edu #Michigan State University Main Cell +35.9.7.10 #afsdb0.cl.msu.edu +>nd.edu #University of Notre Dame +129.74.223.17 #john.helios.nd.edu +129.74.223.33 #lizardo.helios.nd.edu +129.74.223.65 #buckaroo.helios.nd.edu +>pitt.edu #University of Pittsburgh +136.142.8.15 #afs09.srv.cis.pitt.edu +136.142.8.20 #afs10.srv.cis.pitt.edu +136.142.8.21 #afs11.srv.cis.pitt.edu +>cs.pitt.edu #University of Pittsburgh - Computer Science +130.49.220.11 #afs01.cs.pitt.edu +130.49.220.12 #afs02.cs.pitt.edu +130.49.220.13 #afs03.cs.pitt.edu +>psc.edu #PSC (Pittsburgh Supercomputing Center) +128.182.59.182 #shaggy.psc.edu +128.182.66.184 #velma.psc.edu +128.182.66.185 #daphne.psc.edu +>scoobydoo.psc.edu #PSC Test Cell +128.182.59.181 #scooby.psc.edu +>cede.psu.edu #Penn State - Center for Engr. Design & Entrepeneurship +146.186.218.10 #greenly.cede.psu.edu +146.186.218.60 #b50.cede.psu.edu +146.186.218.246 #stalin.cede.psu.edu +>rose-hulman.edu #Rose-Hulman Institute of Technology +137.112.7.11 #afs1.rose-hulman.edu +137.112.7.12 #afs2.rose-hulman.edu +137.112.7.13 #afs3.rose-hulman.edu +>cs.rose-hulman.edu #Rose-Hulman CS Department +137.112.40.10 #galaxy.cs.rose-hulman.edu +>rpi.edu #Rensselaer Polytechnic Institute +128.113.22.11 #saul.server.rpi.edu +128.113.22.12 #joab.server.rpi.edu +128.113.22.13 #korah.server.rpi.edu +128.113.22.14 #achan.server.rpi.edu +>hep.sc.edu #University of South Carolina, Dept. of Physics +129.252.78.77 #cpeven.physics.sc.edu +>cs.stanford.edu #Stanford University Computer Science Department +171.64.64.10 #cs-afs-1.Stanford.EDU +171.64.64.66 #cs-afs-2.stanford.edu +171.64.64.69 #cs-afs-3.stanford.edu +>ir.stanford.edu #Stanford University +171.64.7.222 #afsdb1.stanford.edu +171.64.7.234 #afsdb2.stanford.edu +171.64.7.246 #afsdb3.stanford.edu +>slac.stanford.edu #Stanford Linear Accelerator Center +134.79.18.25 #afsdb1.slac.stanford.edu +134.79.18.26 #afsdb2.slac.stanford.edu +134.79.18.27 #afsdb3.slac.stanford.edu +>cats.ucsc.edu #UC Santa Cruz, Comm. and Tech. Services, California U.S.A +128.114.129.14 #elan.ucsc.edu +128.114.129.15 #ichabod.ucsc.edu +128.114.129.18 #maneki.ucsc.edu +>acm.uiuc.edu #ACM at the University of Illinois +128.174.251.8 #alnitak.acm.uiuc.edu +128.174.251.9 #alnilam.acm.uiuc.edu +128.174.251.10 #mintaka.acm.uiuc.edu +>ncsa.uiuc.edu #University of Illinois +141.142.3.5 #congo.ncsa.uiuc.edu +141.142.3.8 #nile.ncsa.uiuc.edu +141.142.3.9 #kaskaskia.ncsa.uiuc.edu +>umbc.edu #University of Maryland, Baltimore County +130.85.24.23 #db2.afs.umbc.edu +130.85.24.87 #db3.afs.umbc.edu +130.85.24.101 #db1.afs.umbc.edu +>glue.umd.edu #University of Maryland - Project Glue +128.8.70.11 #olmec.umd.edu +128.8.73.3 #babylon.umd.edu +129.2.128.53 #egypt.umd.edu +>wam.umd.edu #University of Maryland Network WAM Project +128.8.70.9 #csc-srv.wam.umd.edu +128.8.73.9 #pg2-srv.wam.umd.edu +129.2.128.54 #avw-srv.wam.umd.edu +>umich.edu #University of Michigan - Campus +141.211.1.32 #fear.ifs.umich.edu +141.211.1.33 #surprise.ifs.umich.edu +141.211.1.34 #ruthless.ifs.umich.edu +>atlas.umich.edu #ATLAS group cell in physics at University of Michigan +141.211.43.102 #linat02.grid.umich.edu +141.211.43.106 #linat06.grid.umich.edu +141.211.43.109 #atgrid.grid.umich.edu +>citi.umich.edu #Center for Information Technology Integration +141.211.133.5 #babylon.citi.umich.edu +>lsa.umich.edu #University of Michigan - College of LS&A +141.211.54.132 #curtis.admin.lsa.umich.edu +141.211.211.53 #gerow.lsa.umich.edu +141.211.211.72 #collines.lsa.umich.edu +141.211.211.153 #hodges.lsa.umich.edu +>math.lsa.umich.edu #University of Michigan - Math Department +141.211.61.40 #ike.math.lsa.umich.edu +141.211.61.41 #clark.math.lsa.umich.edu +141.211.61.42 #nimitz.math.lsa.umich.edu +>umr.edu #University of Missouri - Rolla +131.151.1.59 #afsdb1.umr.edu +131.151.1.70 #afsdb3.umr.edu +131.151.1.146 #afsdb2.umr.edu +>physics.unc.edu #Univ. of NC at Chapel Hill, Dept. of Physics +152.2.5.2 #valerian.physics.unc.edu +152.2.5.3 #augustus.physics.unc.edu +152.2.7.67 #nerva.astro.unc.edu +>uncc.edu #University of NC at Charlotte Mosaic AFS Cell +152.15.10.70 #as-sm1.uncc.edu +152.15.13.7 #as-sm2.uncc.edu +152.15.30.27 #fs-kenn3.uncc.edu +>eng.utah.edu #University of Utah - Engineering +155.99.222.9 #lenny.eng.utah.edu +155.99.222.10 #carl.eng.utah.edu +>cs.uwm.edu #University of Wisconsin--Milwaukee +129.89.38.124 #solomons.cs.uwm.edu +>cs.wisc.edu #Univ. of Wisconsin-Madison, Computer Sciences Dept. +128.105.132.14 #timon.cs.wisc.edu +128.105.132.15 #pumbaa.cs.wisc.edu +128.105.132.16 #zazu.cs.wisc.edu +>engr.wisc.edu #University of Wisconsin-Madison, College of Engineering +144.92.13.14 #larry.cae.wisc.edu +144.92.13.15 #curly.cae.wisc.edu +144.92.13.16 #moe.cae.wisc.edu +>hep.wisc.edu #University of Wisconsin -- High Energy Physics +128.104.28.219 #anise.physics.wisc.edu +>physics.wisc.edu #Univ. of Wisconsin-Madison, Physics Department +128.104.220.51 #bubbles.physics.wisc.edu +128.104.220.52 #buttercup.physics.wisc.edu +128.104.220.53 #blossom.physics.wisc.edu +>ifca.unican.es #Instituto de Fisica de Cantabria (IFCA), Santander, Spain +193.144.209.20 #gridwall.ifca.unican.es +>ific.uv.es #Instituto de Fisica Corpuscular, Valencia, Spain +147.156.163.11 #alpha.ific.uv.es +>biocenter.helsinki.fi #University of Helsinki, Institute of Biotechnology +128.214.58.174 #afsdb1.biocenter.helsinki.fi +128.214.88.114 #afsdb2.biocenter.helsinki.fi +>dapnia.saclay.cea.fr #CEA DAPNIA +132.166.32.7 #dphrsg.saclay.cea.fr +132.166.32.12 #dphrsl.saclay.cea.fr +>in2p3.fr #IN2P3 production cell +134.158.232.11 #ccafsdb1.in2p3.fr +134.158.232.12 #ccafsdb2.in2p3.fr +134.158.232.13 #ccafsdb3.in2p3.fr +>anl.gov #Argonne National Laboratory +146.137.96.33 #arteus.ctd.anl.gov +146.137.162.88 #agamemnon.ctd.anl.gov +146.137.194.80 #antenor.ctd.anl.gov +>rhic.bnl.gov #Relativistic Heavy Ion Collider +130.199.6.51 #rafs03.rcf.bnl.gov +130.199.6.52 #rafs02.rcf.bnl.gov +130.199.6.69 #rafs01.rcf.bnl.gov +>usatlas.bnl.gov #US Atlas Tier 1 Facility at BNL +130.199.48.32 #aafs01.usatlas.bnl.gov +130.199.48.33 #aafs02.usatlas.bnl.gov +130.199.48.34 #aafs03.usatlas.bnl.gov +>fnal.gov #Fermi National Acclerator Laboratory +131.225.68.1 #fsus01.fnal.gov +131.225.68.4 #fsus03.fnal.gov +131.225.68.14 #fsus04.fnal.gov +>ic-afs.arc.nasa.gov #Code IC, Ames Research Center +128.102.105.62 #udanax.arc.nasa.gov +>nersc.gov #National Energy Research Supercomputer Center +128.55.128.250 #mars.nersc.gov +128.55.128.252 #alfred.nersc.gov +128.55.128.254 #lurch.nersc.gov +>caspur.it #CASPUR Inter-University Computing Consortium, Rome +193.204.5.45 #pomodoro.caspur.it +193.204.5.46 #banana.caspur.it +193.204.5.50 #maslo.caspur.it +>fusione.it #Assoz. FUSIONE/Euratom, ENEA, Frascati-Italy +192.107.90.2 #fusafs1.frascati.enea.it +192.107.90.3 #fusafs2.frascati.enea.it +192.107.90.4 #fusafs3.frascati.enea.it +>icemb.it #ICEMB, Universita' La Sapienza - Rome - Italy +193.204.6.130 #icembfs.caspur.it +>infn.it #Istituto Nazionale di Fisica Nucleare (INFN), Italia +131.154.1.7 #afs3.infn.it +141.108.3.252 #afs1.infn.it +192.84.134.75 #afs2.infn.it +>kloe.infn.it #INFN, KLOE experiment at Laboratori di Frascati +192.135.25.111 #kloeafs1.lnf.infn.it +192.135.25.112 #kloeafs2.lnf.infn.it +>le.infn.it #INFN, Sezione di Lecce +192.84.152.40 #afs01.le.infn.it +192.84.152.148 #afs02.le.infn.it +>lnf.infn.it #INFN, Laboratori Nazionali di Frascati +193.206.84.121 #afs1.lnf.infn.it +193.206.84.122 #afs2.lnf.infn.it +193.206.84.123 #afs3.lnf.infn.it +>lngs.infn.it #INFN, Laboratori Nazionali di Gran Sasso +192.84.135.21 #rsgs05.lngs.infn.it +>pi.infn.it #INFN, Sezione di Pisa +131.114.134.26 #unknownhost.pi.infn.it +192.84.133.50 #aix1.pi.infn.it +>psm.it #Progetto San Marco, Universita' di Roma-1 +151.100.1.65 #atlante.psm.uniroma1.it +>tgrid.it #CASPUR-CILEA-CINECA Grid Cell +193.204.5.33 #cccgrid.caspur.it +>ictp.trieste.it #The Abdus Salam International Centre for Theoretical Physics (IC +140.105.16.8 #fs1.ictp.trieste.it +140.105.16.9 #fs2.ictp.trieste.it +>ing.uniroma1.it #Universita' La Sapienza, Fac. Ingeneria +151.100.85.253 #alfa.ing.uniroma1.it +>vn.uniroma3.it #University of Rome 3, Area Vasca Navale +193.204.161.136 #alfa.dia.uniroma3.it +193.204.161.137 #beta.dia.uniroma3.it +193.204.161.138 #gamma.dia.uniroma3.it +>italia #Italian public AFS cell +193.204.5.9 #afs.caspur.it +>cmf.nrl.navy.mil #Naval Research Lab - CCS +134.207.10.68 #picard.cmf.nrl.navy.mil +134.207.10.69 #riker.cmf.nrl.navy.mil +134.207.10.70 #kirk.cmf.nrl.navy.mil +>lcp.nrl.navy.mil #Naval Research Lab - Lab for Computational Physics +132.250.114.2 #afs1.lcp.nrl.navy.mil +132.250.114.4 #afs2.lcp.nrl.navy.mil +132.250.114.6 #afs3.lcp.nrl.navy.mil +>es.net #Energy Sciences Net +198.128.3.21 #fs1.es.net +198.128.3.22 #fs2.es.net +198.128.3.23 #fs3.es.net +>laroia.net #Laroia Networks +66.66.102.254 #supercore.laroia.net +>sinenomine.net #Sine Nomine Associates +66.92.236.139 #afs.sinenomine.net +>slackers.net #The Slackers' Network +63.201.48.27 #alexandria.slackers.net +>nikhef.nl #The Dutch National Institute for High Energy Physics +192.16.185.26 #afs1.nikhef.nl +192.16.185.27 #afs2.nikhef.nl +>1ts.org #KCR/private Karl Ramm, Cambridge, MA +4.36.43.102 #dol-guldur.1ts.org +>bazquux.org #Baz Quux Organization +66.207.142.196 #baxquux.org +>coed.org #Adam Pennington's Cell +66.93.61.184 #vice1.coed.org +128.2.4.163 #vice3.coed.org +>dementia.org #Dementia Unlimited +128.2.12.45 #alycia.dementia.org +128.2.120.216 #meredith.dementia.org +>hackish.org #Hackish.org +24.167.65.213 #avatar.sys.hackish.org +128.2.120.138 #kurma.sys.hackish.org +>idahofuturetruck.org #University of Idaho hybrid vehicle development +12.18.238.210 #dsle210.fsr.net +>nimlabs.org #Nimlabs, Ink. Cell. +18.238.1.103 #olfin.nimlabs.org +18.238.1.105 #caerbanog.nimlabs.org +>nomh.org #nomh.org +204.29.154.12 #iota.nomh.org +204.29.154.32 #adversity.xi.nomh.org +>oc7.org #The OC7 Project +128.2.6.107 #vice3.oc7.org +128.2.122.140 #vice2.oc7.org +>openafs.org #OpenAFS Project +128.2.13.199 #new-virtue.openafs.org +128.2.121.218 #virtue.openafs.org +130.237.48.87 #andrew.e.kth.se +130.237.48.107 #onyx.e.kth.se +>e.kth.se #Royal Institute of Technology, Elektro +130.237.32.145 #sonen.e.kth.se +130.237.48.7 #anden.e.kth.se +130.237.48.244 #fadern.e.kth.se +>hallf.kth.se #Royal Institute of Technology, HALLF +130.237.24.141 #rasmus13.hallf.kth.se +130.237.24.152 #rasmus3.hallf.kth.se +130.237.24.177 #rasmus29.hallf.kth.se +>isk.kth.se #Royal Institute of Technology, ISK +130.237.202.12 #afsdb2.isk.kth.se +130.237.206.13 #afsdb1.isk.kth.se +130.237.209.141 #afsdb3.isk.kth.se +>it.kth.se #Royal Institute of Technology, IT +130.237.212.15 #ptah.it.kth.se +130.237.212.16 #toth.it.kth.se +130.237.215.7 #isis.it.kth.se +>md.kth.se #Royal Institute of Technology, MMK +130.237.57.68 #trinity.md.kth.se +130.237.57.72 #morpheus.md.kth.se +130.237.67.230 #neo.speech.kth.se +>mech.kth.se #Royal Institute of Technology, MECH +130.237.233.143 #castor.mech.kth.se +130.237.233.144 #pollux.mech.kth.se +>nada.kth.se #Royal Institute of Technology, NADA +130.237.222.20 #kosmos.nada.kth.se +130.237.223.12 #sputnik.nada.kth.se +130.237.224.78 #mir.nada.kth.se +130.237.227.23 #gagarin.nada.kth.se +130.237.228.28 #laika.nada.kth.se +>pdc.kth.se #Royal Institute of Technology, PDC +130.237.232.29 #crab.pdc.kth.se +130.237.232.112 #anna.pdc.kth.se +130.237.232.114 #hokkigai.pdc.kth.se +>stacken.kth.se #Stacken Computer Club +130.237.234.3 #milko.stacken.kth.se +130.237.234.43 #hot.stacken.kth.se +130.237.237.230 #fishburger.stacken.kth.se +>syd.kth.se #Royal Institute of Technology, KTH-Syd +130.237.83.23 #afs.haninge.kth.se +>physto.se #Physics department Stockholm University +130.237.205.36 #sysafs1.physto.se +130.237.205.72 #sysafs2.physto.se +>sanchin.se #Sanchin Consulting AB, Sweden +192.195.148.10 #sesan.sanchin.se +>su.se #Stockholm University +130.237.162.81 #afsdb1.su.se +130.237.162.82 #afsdb2.su.se +130.237.162.230 #afsdb3.su.se +>f9.ijs.si #F9, Jozef Stefan Institue +194.249.156.1 #brenta.ijs.si +>p-ng.si #Nova Gorica Polytechnic +193.2.120.2 #solkan.p-ng.si +>phy.bris.ac.uk #Bristol University - phyics +137.222.58.9 #afs1.phy.bris.ac.uk +>hep.man.ac.uk #Manchester HEP +194.36.2.3 #afs1.hep.man.ac.uk +194.36.2.4 #afs2.hep.man.ac.uk +194.36.2.5 #afs3.hep.man.ac.uk +>rl.ac.uk #Rutherford Appleton Lab, England +130.246.183.164 #wallace.cc.rl.ac.uk diff --git a/src/WINNT/install/NSIS/OpenAFS.nsi b/src/WINNT/install/NSIS/OpenAFS.nsi index bf4bb790b..658a9e68d 100644 --- a/src/WINNT/install/NSIS/OpenAFS.nsi +++ b/src/WINNT/install/NSIS/OpenAFS.nsi @@ -530,7 +530,6 @@ Section "AFS Client" secClient File "${AFS_CLIENT_BUILDDIR}\afscreds.exe" !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll" "$INSTDIR\Client\Program\afs_shl_ext.dll" "$INSTDIR" File "${AFS_CLIENT_BUILDDIR}\afsd_service.exe" - !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afslogon.dll" "$INSTDIR\Client\Program\afslogon.dll" "$INSTDIR" File "${AFS_CLIENT_BUILDDIR}\symlink.exe" File "${AFS_DESTDIR}\bin\kpasswd.exe" File "${AFS_SERVER_BUILDDIR}\pts.exe" @@ -541,17 +540,13 @@ Section "AFS Client" secClient File "${AFS_DESTDIR}\bin\translate_et.exe" File "${AFS_DESTDIR}\etc\rxdebug.exe" File "${AFS_DESTDIR}\etc\backup.exe" + !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa.cpl" "$INSTDIR\Client\Program\afs_cpa.cpl" "$INSTDIR" - Call AFSLangFiles + SetOutPath "$SYSDIR" + !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afslogon.dll" "$SYSDIR\afslogon.dll" "$INSTDIR" + Call AFSLangFiles - - ; Do WINDOWSDIR components - - ; Do Windows SYSDIR (Control panel) - SetOutPath "$SYSDIR" - !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_cpa.cpl" "$SYSDIR\afs_cpa.cpl" "$INSTDIR" - ; Get AFS CellServDB file Call afs.GetCellServDB @@ -574,6 +569,7 @@ Section "AFS Client" secClient WriteRegStr HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}\InprocServer32" "ThreadingModel" "Apartment" WriteRegStr HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" "" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" "AFS Client Shell Extension" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" "afs_cpa" "$INSTDIR\Client\Program\afs_cpa.cpl" ; AFS Reg entries DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" @@ -630,14 +626,14 @@ Section "AFS Client" secClient StrCmp $R1 "1" +1 +2 StrCpy $R2 "$R2-S" + WriteRegStr HKLM "SOFTWARE\OpenAFS\Client" "AfscredsShortcutParams" "$R2" + CreateShortCut "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk" "$INSTDIR\Client\Program\afscreds.exe" "$R2" ReadINIStr $R1 $2 "Field 1" "State" StrCmp $R1 "1" +1 +2 CreateShortCut "$SMSTARTUP\AFS Credentials.lnk" "$INSTDIR\Client\Program\afscreds.exe" "$R2" - - Push "$INSTDIR\Client\Program" Call AddToUniquePath Push "$INSTDIR\Common" @@ -665,9 +661,8 @@ skipremove: ; Daemon entries WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon" "" "" - WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "ProviderPath" "$INSTDIR\Client\Program\afslogon.dll" - WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll" - WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$INSTDIR\Client\Program\afslogon.dll" + WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "ProviderPath" "$SYSDIR\afslogon.dll" + WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "AuthentProviderPath" "$SYSDIR\afslogon.dll" WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Class" 2 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "VerboseLogging" 10 @@ -676,11 +671,7 @@ skipremove: ; to also include the service name. Call AddProvider ReadINIStr $R0 $1 "Field 7" "State" - ReadINIStr $R1 $1 "Field 9" "State" - ; Complicated way to do $R1 = ($R1 *2) + $R0 - IntOp $R2 $R1 * 2 - IntOp $R1 $R2 + $R0 - WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonOptions" $R1 + WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonOptions" $R0 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "LogonScript" "$INSTDIR\Client\Program\afscreds.exe -:%s -x -a -m -n -q" WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" "Name" "OpenAFSDaemon" @@ -692,7 +683,7 @@ skipremove: WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "SecurityLevel" $R0 ReadINIStr $R0 $1 "Field 5" "State" WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "FreelanceClient" $R0 - ReadINIStr $R0 $1 "Field 11" "State" + ReadINIStr $R0 $1 "Field 9" "State" WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "UseDNS" $R0 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "NetbiosName" "AFS" WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" "MountRoot" "/afs" @@ -717,6 +708,13 @@ skipremove: strcpy $REG_DATA_3 "RpcSs" Call RegWriteMultiStr + ; WinLogon Event Notification + WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Asynchronous" 0 + WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Impersonate" 1 + WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "DLLName" "afslogon.dll" + WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Logoff" "AFS_Logoff_Event" + WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Startup" "AFS_Startup_Event" + SetRebootFlag true WriteUninstaller "$INSTDIR\Uninstall.exe" @@ -794,8 +792,6 @@ skipCheck: File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll" File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll" -!ifdef DEBUG -!endif SetOutPath "$INSTDIR\Common" Call AFSLangFiles @@ -880,76 +876,6 @@ Section "AFS Control Center" secControl Call AFSLangFiles SetOutPath "$INSTDIR\Common" - SetOutPath "$INSTDIR\Common" -!IFDEF DEBUG -!IFDEF CL_1310 - File "${SYSTEMDIR}\msvcr71d.dll" - File "${SYSTEMDIR}\msvcp71d.dll" - File "${SYSTEMDIR}\mfc71d.dll" - File "${SYSTEMDIR}\MFC71CHS.DLL" - File "${SYSTEMDIR}\MFC71CHT.DLL" - File "${SYSTEMDIR}\MFC71DEU.DLL" - File "${SYSTEMDIR}\MFC71ENU.DLL" - File "${SYSTEMDIR}\MFC71ESP.DLL" - File "${SYSTEMDIR}\MFC71FRA.DLL" - File "${SYSTEMDIR}\MFC71ITA.DLL" - File "${SYSTEMDIR}\MFC71JPN.DLL" - File "${SYSTEMDIR}\MFC71KOR.DLL" -!ELSE -!IFDEF CL_1300 - File "${SYSTEMDIR}\msvcr70d.dll" - File "${SYSTEMDIR}\msvcp70d.dll" - File "${SYSTEMDIR}\mfc70d.dll" - File "${SYSTEMDIR}\MFC70CHS.DLL" - File "${SYSTEMDIR}\MFC70CHT.DLL" - File "${SYSTEMDIR}\MFC70DEU.DLL" - File "${SYSTEMDIR}\MFC70ENU.DLL" - File "${SYSTEMDIR}\MFC70ESP.DLL" - File "${SYSTEMDIR}\MFC70FRA.DLL" - File "${SYSTEMDIR}\MFC70ITA.DLL" - File "${SYSTEMDIR}\MFC70JPN.DLL" - File "${SYSTEMDIR}\MFC70KOR.DLL" -!ELSE - File "${SYSTEMDIR}\mfc42d.dll" - File "${SYSTEMDIR}\msvcp60d.dll" - File "${SYSTEMDIR}\msvcrtd.dll" -!ENDIF -!ENDIF -!ELSE -!IFDEF CL_1310 - File "${SYSTEMDIR}\mfc71.dll" - File "${SYSTEMDIR}\msvcr71.dll" - File "${SYSTEMDIR}\msvcp71.dll" - File "${SYSTEMDIR}\MFC71CHS.DLL" - File "${SYSTEMDIR}\MFC71CHT.DLL" - File "${SYSTEMDIR}\MFC71DEU.DLL" - File "${SYSTEMDIR}\MFC71ENU.DLL" - File "${SYSTEMDIR}\MFC71ESP.DLL" - File "${SYSTEMDIR}\MFC71FRA.DLL" - File "${SYSTEMDIR}\MFC71ITA.DLL" - File "${SYSTEMDIR}\MFC71JPN.DLL" - File "${SYSTEMDIR}\MFC71KOR.DLL" -!ELSE -!IFDEF CL_1300 - File "${SYSTEMDIR}\mfc70.dll" - File "${SYSTEMDIR}\msvcr70.dll" - File "${SYSTEMDIR}\msvcp70.dll" - File "${SYSTEMDIR}\MFC70CHS.DLL" - File "${SYSTEMDIR}\MFC70CHT.DLL" - File "${SYSTEMDIR}\MFC70DEU.DLL" - File "${SYSTEMDIR}\MFC70ENU.DLL" - File "${SYSTEMDIR}\MFC70ESP.DLL" - File "${SYSTEMDIR}\MFC70FRA.DLL" - File "${SYSTEMDIR}\MFC70ITA.DLL" - File "${SYSTEMDIR}\MFC70JPN.DLL" - File "${SYSTEMDIR}\MFC70KOR.DLL" -!ELSE - File "${SYSTEMDIR}\mfc42.dll" - File "${SYSTEMDIR}\msvcp60.dll" - File "${SYSTEMDIR}\msvcrt.dll" -!ENDIF -!ENDIF -!ENDIF ;Store install folder WriteRegStr HKCU "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "PathName" $INSTDIR WriteRegStr HKLM "${AFS_REGKEY_ROOT}\AFS Control Center\CurrentVersion" "VersionString" ${AFS_VERSION} @@ -1185,7 +1111,6 @@ Section "Debug symbols" secDebug File "${AFS_CLIENT_BUILDDIR}\afscreds.pdb" File "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.pdb" File "${AFS_CLIENT_BUILDDIR}\afsd_service.pdb" - File "${AFS_CLIENT_BUILDDIR}\afslogon.pdb" File "${AFS_CLIENT_BUILDDIR}\symlink.pdb" File "${AFS_DESTDIR}\bin\kpasswd.pdb" File "${AFS_DESTDIR}\bin\pts.pdb" @@ -1196,9 +1121,10 @@ Section "Debug symbols" secDebug File "${AFS_DESTDIR}\bin\translate_et.pdb" File "${AFS_DESTDIR}\etc\rxdebug.pdb" File "${AFS_DESTDIR}\etc\backup.pdb" + File "${AFS_CLIENT_BUILDDIR}\afs_cpa.pdb" SetOutPath "$SYSDIR" - File "${AFS_CLIENT_BUILDDIR}\afs_cpa.pdb" + File "${AFS_CLIENT_BUILDDIR}\afslogon.pdb" DoServer: SectionGetFlags ${secServer} $R0 @@ -1700,7 +1626,7 @@ StartRemove: Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb" Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb" Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb" - +!IFDEF DEBUG !IFDEF CL_1310 Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll" Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.pdb" @@ -1724,6 +1650,7 @@ StartRemove: Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.dll" Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.pdb" !ENDIF +!ENDIF !ELSE !IFDEF CL_1310 Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll" @@ -1761,18 +1688,16 @@ StartRemove: !ENDIF IfSilent SkipDel -; IfFileExists "$WINDIR\afsdcell.ini" CellExists SkipDelAsk +; IfFileExists "$INSTDIR\Client\CellServDB" CellExists SkipDelAsk ; CellExists: MessageBox MB_YESNO "Would you like to keep your configuration files?" IDYES SkipDel - Delete "$WINDIR\afsdcell.ini" + Delete "$INSTDIR\Client\CellServDB" - Delete "$WINDIR\afsdsbmt.ini" ; Only remove krb5.ini if KfW was installed !IFDEF INSTALL_KFW Delete "$WINDIR\krb5.ini" !ENDIF - Delete "$WINDIR\afsdns.ini" - Delete "$WINDIR\afs_freelance.ini" + Delete "$INSTDIR\Client\afsdns.ini" SkipDel: Delete "$WINDIR\afsd_init.log" @@ -1826,10 +1751,12 @@ StartRemove: Delete /REBOOTOK "$SYSDIR\afsserver.cpl" Delete /REBOOTOK "$SYSDIR\afs_cpa.cpl" + Delete /REBOOTOK "$SYSDIR\afslogon.dll" Delete /REBOOTOK "$SYSDIR\afsserver.pdb" Delete /REBOOTOK "$SYSDIR\afs_cpa.pdb" - + Delete /REBOOTOK "$SYSDIR\afslogon.pdb" + RMDir /r "$INSTDIR\Documentation\html\CmdRef" RMDir /r "$INSTDIR\Documentation\html\InstallGd" RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes" @@ -1958,6 +1885,10 @@ StartRemove: DeleteRegKey HKCR "CLSID\{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" DeleteRegKey HKCR "FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" + DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" "afs_cpa" + + ; WinLogon Event Notification + DeleteRegKey HKLM "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\AfsLogon" DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client\CurrentVersion" DeleteRegKey HKLM "${AFS_REGKEY_ROOT}\AFS Client" @@ -2017,21 +1948,21 @@ goto UsePackaged DoDownload: ReadINIStr $R0 $0 "Field 5" "State" - NSISdl::download $R0 "$WINDIR\afsdcell.ini" + NSISdl::download $R0 "$INSTDIR\Client\CellServDB" Pop $R0 ;Get the return value StrCmp $R0 "success" +2 MessageBox MB_OK|MB_ICONSTOP "Download failed: $R0" goto done UsePackaged: - SetOutPath "$WINDIR" - File "afsdcell.ini" + SetOutPath "$INSTDIR\Client" + File "CellServDB" goto done CheckOther: ReadINIStr $R0 $0 "Field 7" "State" StrCmp $R0 "" done - CopyFiles $R0 "$WINDIR\afsdcell.ini" + CopyFiles $R0 "$INSTDIR\Client\CellServDB" done: @@ -2182,8 +2113,12 @@ startOver: WriteINISTR $0 "Field 4" "State" "0" WriteINIStr $0 "Field 6" "State" "0" - ; If there is an existing afsdcell.ini file, allow the user to choose it and make it default - IfFileExists "$WINDIR\afsdcell.ini" +1 notpresent + ; If there is an existing afsdcell.ini file, migrate it to CellServDB + IfFileExists "$WINDIR\afsdcell.ini" +1 +3 + CopyFiles /SILENT "$WINDIR\afsdcell.ini" "$INSTDIR\Client\CellServDB" + Delete "$WINDIR\afsdcell.ini" + ; If there is an existing CellServDB file, allow the user to choose it and make it default + IfFileExists "$INSTDIR\Client\CellServDB" +1 notpresent WriteINIStr $0 "Field 2" "Flags" "ENABLED" WriteINIStr $0 "Field 2" "State" "1" WriteINIStr $0 "Field 3" "State" "0" @@ -2637,98 +2572,91 @@ Function AFSLangFiles ; Common files SetOutPath "$INSTDIR\Common" File "${AFS_CLIENT_BUILDDIR}\afs_config.exe" - File "${AFS_SERVER_BUILDDIR}\afsadminutil.dll" !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsauthent.dll" "$INSTDIR\Common\afsauthent.dll" "$INSTDIR" !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afspthread.dll" "$INSTDIR\Common\afspthread.dll" "$INSTDIR" !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsrpc.dll" "$INSTDIR\Common\afsrpc.dll" "$INSTDIR" - File "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll" - File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll" - File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll" - File "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll" - File "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll" - File "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll" - File "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll" - File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll" - File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsadminutil.dll" "$INSTDIR\Common\afsadminutil.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll" "$INSTDIR\Common\afsclientadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll" "$INSTDIR\Common\afsprocmgmt.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll" "$INSTDIR\Common\afsvosadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\TaAfsAppLib.dll" "$INSTDIR\Common\TaAfsAppLib.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsvosadmin.dll" "$INSTDIR\Common\afsvosadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsbosadmin.dll" "$INSTDIR\Common\afsbosadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afscfgadmin.dll" "$INSTDIR\Common\afscfgadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afskasadmin.dll" "$INSTDIR\Common\afskasadmin.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll" "$INSTDIR\Common\afsptsadmin.dll" "$INSTDIR" + + SetOutPath "$INSTDIR\Common" !IFDEF DEBUG !IFDEF CL_1310 - File "${SYSTEMDIR}\msvcr71d.dll" - File "${SYSTEMDIR}\msvcr71d.pdb" - File "${SYSTEMDIR}\msvcp71d.dll" - File "${SYSTEMDIR}\msvcp71d.pdb" - File "${SYSTEMDIR}\mfc71d.dll" - File "${SYSTEMDIR}\mfc71d.pdb" - File "${SYSTEMDIR}\MFC71CHS.DLL" - File "${SYSTEMDIR}\MFC71CHT.DLL" - File "${SYSTEMDIR}\MFC71DEU.DLL" - File "${SYSTEMDIR}\MFC71ENU.DLL" - File "${SYSTEMDIR}\MFC71ESP.DLL" - File "${SYSTEMDIR}\MFC71FRA.DLL" - File "${SYSTEMDIR}\MFC71ITA.DLL" - File "${SYSTEMDIR}\MFC71JPN.DLL" - File "${SYSTEMDIR}\MFC71KOR.DLL" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\Common\msvcr71d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71d.dll" "$INSTDIR\Common\msvcp71d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71d.dll" "$INSTDIR\Common\mfc71d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR" !ELSE !IFDEF CL_1300 - File "${SYSTEMDIR}\msvcr70d.dll" - File "${SYSTEMDIR}\msvcr70d.pdb" - File "${SYSTEMDIR}\msvcp70d.dll" - File "${SYSTEMDIR}\msvcp70d.pdb" - File "${SYSTEMDIR}\mfc70d.dll" - File "${SYSTEMDIR}\mfc70d.pdb" - File "${SYSTEMDIR}\MFC70CHS.DLL" - File "${SYSTEMDIR}\MFC70CHT.DLL" - File "${SYSTEMDIR}\MFC70DEU.DLL" - File "${SYSTEMDIR}\MFC70ENU.DLL" - File "${SYSTEMDIR}\MFC70ESP.DLL" - File "${SYSTEMDIR}\MFC70FRA.DLL" - File "${SYSTEMDIR}\MFC70ITA.DLL" - File "${SYSTEMDIR}\MFC70JPN.DLL" - File "${SYSTEMDIR}\MFC70KOR.DLL" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70d.dll" "$INSTDIR\Common\msvcr70d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70d.dll" "$INSTDIR\Common\msvcp70d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70d.dll" "$INSTDIR\Common\mfc70d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR" !ELSE - File "${SYSTEMDIR}\mfc42d.dll" - File "${SYSTEMDIR}\mfc42d.pdb" - File "${SYSTEMDIR}\msvcp60d.dll" - File "${SYSTEMDIR}\msvcp60d.pdb" - File "${SYSTEMDIR}\msvcrtd.dll" - File "${SYSTEMDIR}\msvcrtd.pdb" + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42d.dll" "$INSTDIR\Common\mfc42d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60d.dll" "$INSTDIR\Common\msvcp60d.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrtd.dll" "$INSTDIR\Common\msvcrtd.dll" "$INSTDIR" !ENDIF !ENDIF !ELSE !IFDEF CL_1310 - File "${SYSTEMDIR}\mfc71.dll" - File "${SYSTEMDIR}\msvcr71.dll" - File "${SYSTEMDIR}\msvcp71.dll" - File "${SYSTEMDIR}\MFC71CHS.DLL" - File "${SYSTEMDIR}\MFC71CHT.DLL" - File "${SYSTEMDIR}\MFC71DEU.DLL" - File "${SYSTEMDIR}\MFC71ENU.DLL" - File "${SYSTEMDIR}\MFC71ESP.DLL" - File "${SYSTEMDIR}\MFC71FRA.DLL" - File "${SYSTEMDIR}\MFC71ITA.DLL" - File "${SYSTEMDIR}\MFC71JPN.DLL" - File "${SYSTEMDIR}\MFC71KOR.DLL" + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\Common\mfc71.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71.dll" "$INSTDIR\Common\msvcr71.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp71.dll" "$INSTDIR\Common\msvcp71.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHS.DLL" "$INSTDIR\Common\MFC71CHS.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71CHT.DLL" "$INSTDIR\Common\MFC71CHT.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71DEU.DLL" "$INSTDIR\Common\MFC71DEU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ENU.DLL" "$INSTDIR\Common\MFC71ENU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ESP.DLL" "$INSTDIR\Common\MFC71ESP.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71FRA.DLL" "$INSTDIR\Common\MFC71FRA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71ITA.DLL" "$INSTDIR\Common\MFC71ITA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71JPN.DLL" "$INSTDIR\Common\MFC71JPN.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC71KOR.DLL" "$INSTDIR\Common\MFC71KOR.DLL" "$INSTDIR" !ELSE !IFDEF CL_1300 - File "${SYSTEMDIR}\mfc70.dll" - File "${SYSTEMDIR}\msvcr70.dll" - File "${SYSTEMDIR}\msvcp70.dll" - File "${SYSTEMDIR}\MFC70CHS.DLL" - File "${SYSTEMDIR}\MFC70CHT.DLL" - File "${SYSTEMDIR}\MFC70DEU.DLL" - File "${SYSTEMDIR}\MFC70ENU.DLL" - File "${SYSTEMDIR}\MFC70ESP.DLL" - File "${SYSTEMDIR}\MFC70FRA.DLL" - File "${SYSTEMDIR}\MFC70ITA.DLL" - File "${SYSTEMDIR}\MFC70JPN.DLL" - File "${SYSTEMDIR}\MFC70KOR.DLL" + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc70.dll" "$INSTDIR\Common\mfc70.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr70.dll" "$INSTDIR\Common\msvcr70.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp70.dll" "$INSTDIR\Common\msvcp70.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHS.DLL" "$INSTDIR\Common\MFC70CHS.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70CHT.DLL" "$INSTDIR\Common\MFC70CHT.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70DEU.DLL" "$INSTDIR\Common\MFC70DEU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ENU.DLL" "$INSTDIR\Common\MFC70ENU.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ESP.DLL" "$INSTDIR\Common\MFC70ESP.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70FRA.DLL" "$INSTDIR\Common\MFC70FRA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70ITA.DLL" "$INSTDIR\Common\MFC70ITA.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70JPN.DLL" "$INSTDIR\Common\MFC70JPN.DLL" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC70KOR.DLL" "$INSTDIR\Common\MFC70KOR.DLL" "$INSTDIR" !ELSE - File "${SYSTEMDIR}\mfc42.dll" - File "${SYSTEMDIR}\msvcp60.dll" - File "${SYSTEMDIR}\msvcrt.dll" -!ENDIF + !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc42.dll" "$INSTDIR\Common\mfc42.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp60.dll" "$INSTDIR\Common\msvcp60.dll" "$INSTDIR" + !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcrt.dll" "$INSTDIR\Common\msvcrt.dll" "$INSTDIR" !ENDIF !ENDIF +!ENDIF StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman diff --git a/src/WINNT/install/NSIS/afsdcell.ini b/src/WINNT/install/NSIS/afsdcell.ini deleted file mode 100644 index 6d43dc846..000000000 --- a/src/WINNT/install/NSIS/afsdcell.ini +++ /dev/null @@ -1,483 +0,0 @@ ->grand.central.org #GCO Public CellServDB 11 May 2004 -18.7.14.88 #grand-opening.mit.edu -128.2.191.224 #penn.central.org ->wu-wien.ac.at #University of Economics, Vienna, Austria -137.208.3.33 #afsdb1.wu-wien.ac.at -137.208.7.4 #afsdb2.wu-wien.ac.at -137.208.7.7 #afsdb3.wu-wien.ac.at ->hephy.at #hephy-vienna -193.170.243.10 #mowgli.oeaw.ac.at -193.170.243.12 #baloo.oeaw.ac.at -193.170.243.14 #akela.oeaw.ac.at ->itp.tugraz.at #Institute for Theoretical Physics, TU Graz, Austria -129.27.157.6 #fubphsv2.tu-graz.ac.at -129.27.161.7 #faepsv01.tu-graz.ac.at -129.27.161.15 #faepsv02.tu-graz.ac.at ->cern.ch #European Laboratory for Particle Physics, Geneva -137.138.128.148 #afsdb1.cern.ch -137.138.246.50 #afsdb3.cern.ch -137.138.246.51 #afsdb2.cern.ch ->ams.cern.ch #AMS Experiment -137.138.206.77 #pcamsf2.cern.ch -137.138.206.123 #pcamsf4.cern.ch ->ethz.ch #Swiss Federal Inst. of Tech. - Zurich, Switzerland -129.132.97.19 #amalthea.ethz.ch -129.132.97.27 #nethzafs-001.ethz.ch -129.132.115.3 #himalia.ethz.ch -129.132.115.37 #nethzafs-005.ethz.ch -129.132.115.38 #nethzafs-006.ethz.ch ->psi.ch #Paul Scherrer Institut - Villigen, Switzerland -129.129.16.10 #afs1.psi.ch -129.129.16.11 #afs2.psi.ch ->extundo.com #Simon Josefsson's cell -195.42.214.241 #slipsten.extundo.com ->mekinok.com #Mekinok, Inc. -4.36.43.98 #loggerhead.mekinok.com ->membrain.com #membrain.com -66.93.118.125 #stormy -130.85.24.11 #weasel -130.85.24.13 #straykitten ->midnightlinux.com #Midnight Linux, Pittsburgh PA -66.93.62.18 #romulus.midnihtlinux.com -66.93.62.20 #yar.midnightlinux.com ->setfilepointer.com #SetFilePointer.com -63.224.10.2 #hamlet.SetFilePointer.com -63.224.10.4 #troilus.SetFilePointer.com ->sodre.cx #Sodre.cx -128.8.140.165 #greed.sodre.cx ->desy.de #Deutsches Elektronen-Synchrotron -131.169.40.62 #vayu.desy.de -131.169.244.60 #solar00.desy.de ->gppc.de #GPP Chemnitz mbH -213.187.92.33 #gpp1.gppc.de -213.187.92.34 #paulchen.gppc.de -213.187.92.35 #lotus.gppc.de ->ifh.de #DESY Zeuthen -141.34.22.10 #romulus.ifh.de -141.34.22.11 #remus.ifh.de -141.34.22.29 #hekate.ifh.de ->lrz-muenchen.de #Leibniz Computing Centre, Germany -129.187.10.36 #afs1.lrz-muenchen.de -129.187.10.56 #afs3.lrz-muenchen.de -129.187.10.57 #afs2.lrz-muenchen.de ->ipp-garching.mpg.de #Institut fuer Plasmaphysik -130.183.9.5 #afs-db1.rzg.mpg.de -130.183.100.10 #afs-db2.aug.ipp-garching.mpg.de -130.183.100.23 #afs-db3.aug.ipp-garching.mpg.de ->mpe.mpg.de #MPE cell -130.183.130.7 #irafs1.mpe-garching.mpg.de -130.183.134.20 #irafs2.mpe-garching.mpg.de ->i1.informatik.rwth-aachen.de #Informatik I, RWTH Aachen -137.226.244.79 #remus.informatik.rwth-aachen.de ->tu-chemnitz.de #Technische Universitaet Chemnitz, Germany -134.109.2.1 #zuse.hrz.tu-chemnitz.de -134.109.2.15 #phoenix.hrz.tu-chemnitz.de -134.109.200.7 #aetius.hrz.tu-chemnitz.de ->e18.ph.tum.de #Experimental Physics, TU Munich, Germany -129.187.154.223 #hamlet.e18.physik.tu-muenchen.de ->uni-bonn.de #Cell name -131.220.14.198 #work15-eth.rhrz.uni-bonn.de -131.220.14.203 #node03-en2.rhrz.uni-bonn.de -131.220.14.205 #node05.rhrz.uni-bonn.de ->uni-freiburg.de #Albert-Ludwigs-Universitat Freiburg -132.230.6.235 #sv6.ruf.uni-freiburg.de -132.230.6.236 #sv7.ruf.uni-freiburg.de -132.230.6.237 #sv8.ruf.uni-freiburg.de ->physik.uni-freiburg.de #institute of physics, university Freiburg, Germany -132.230.77.16 #hepafs.physik.uni-freiburg.de ->urz.uni-heidelberg.de #Uni Heidelberg (Rechenzentrum) -129.206.119.10 #afsdb.urz.uni-heidelberg.de -129.206.119.16 #afsdb1.urz.uni-heidelberg.de -129.206.119.17 #afsdb2.urz.uni-heidelberg.de ->uni-hohenheim.de #University of Hohenheim -144.41.2.2 #rs13.serv.uni-hohenheim.de -144.41.2.3 #rs14.serv.uni-hohenheim.de -144.41.2.4 #rs15.serv.uni-hohenheim.de ->rz.uni-jena.de #Rechenzentrum University of Jena, Germany -141.35.2.160 #lc00.rz.uni-jena.de -141.35.7.9 #fsuj01.rz.uni-jena.de -141.35.7.10 #zaphod.rz.uni-jena ->meteo.uni-koeln.de #Univ. of Cologne - Inst. for Geophysics & Meteorology -134.95.144.22 #afs1.meteo.uni-koeln.de -134.95.144.24 #afs2.meteo.uni-koeln.de ->rrz.uni-koeln.de #University of Cologne - Reg Comp Center -134.95.19.3 #afsdb1.rrz.uni-koeln.de -134.95.19.30 #fileserv3.rrz.uni-koeln.de -134.95.67.97 #afs.thp.uni-koeln.de -134.95.140.190 #rzkbserv.rrz.uni-koeln.de ->physik.uni-mainz.de #institute of physics, university Mainz, Germany -134.93.130.93 #hardy.physik.uni-mainz.de ->uni-mannheim.de #Uni Mannheim (Rechenzentrum) -134.155.50.165 #afsdbx.uni-mannheim.de -134.155.50.166 #afsdby.uni-mannheim.de -134.155.50.167 #afsdbz.uni-mannheim.de ->physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal -132.195.104.3 #afs1.physik.uni-wuppertal.de -132.195.104.230 #afs2.physik.uni-wuppertal.de ->ies.auc.dk #Aalborg Univ., Inst. of Electronic Systems, Denmark -130.225.51.73 #afsdb1.kom.auc.dk -130.225.51.74 #afsdb2.kom.auc.dk -130.225.51.85 #afsdb3.kom.auc.dk ->hep.caltech.edu #CalTech High Energy Physics -131.215.126.150 #afs.hep.caltech.edu ->andrew.cmu.edu #Carnegie Mellon University - Computing Services Cell -128.2.10.2 #vice2.fs.andrew.cmu.edu -128.2.10.7 #vice7.fs.andrew.cmu.edu -128.2.10.11 #vice11.fs.andrew.cmu.edu -128.2.10.28 #vice28.fs.andrew.cmu.edu -128.2.32.44 #new-vice12.fs.andrew.cmu.edu ->club.cc.cmu.edu #Carnegie Mellon University Computer Club -128.2.4.131 #yttrium.club.cc.cmu.edu -128.2.4.132 #zirconium.club.cc.cmu.edu ->chem.cmu.edu #Carnegie Mellon University - Chemistry Dept. -128.2.40.134 #afs.chem.cmu.edu -128.2.40.140 #afs2.chem.cmu.edu ->cs.cmu.edu #Carnegie Mellon University - School of Comp. Sci. -128.2.194.178 #cherry.srv.cs.cmu.edu -128.2.194.179 #pumpkin.srv.cs.cmu.edu -128.2.194.180 #strawberry.srv.cs.cmu.edu ->ece.cmu.edu #Carnegie Mellon University - Elec. Comp. Eng. Dept. -128.2.129.7 #porok.ece.cmu.edu -128.2.129.8 #vicio.ece.cmu.edu -128.2.129.9 #e-xing.ece.cmu.edu ->scotch.ece.cmu.edu #CMU ECE CALCM research group -128.2.134.82 #lagavulin.ece.cmu.edu ->msc.cornell.edu #Cornell University Materials Science Center -128.84.231.242 #miranda.ccmr.cornell.edu -128.84.241.35 #co.ccmr.cornell.edu -128.84.249.78 #dax.ccmr.cornell.edu ->dbic.dartmouth.edu #Dartmouth Brain Imaging Center -129.170.30.143 #dbicafs1.dartmouth.edu -129.170.30.144 #dbicafs2.dartmouth.edu -129.170.30.145 #dbicafs3.dartmouth.edu ->northstar.dartmouth.edu #Dartmouth College Research Computing -129.170.16.22 #halley.dartmouth.edu -129.170.16.42 #oort.dartmouth.edu -129.170.16.43 #cygnusx1.dartmouth.edu ->iastate.edu #Iowa State University -129.186.1.243 #afsdb-1.iastate.edu -129.186.6.243 #afsdb-2.iastate.edu -129.186.142.243 #afsdb-3.iastate.edu ->athena.mit.edu #MIT/Athena cell -18.7.1.66 #paris.mit.edu. -18.7.1.74 #chimera.mit.edu. -18.158.0.37 #prill.mit.edu. ->dev.mit.edu #MIT/IS Development cell -18.7.1.70 #wham.mit.edu. -18.7.15.89 #rattle.mit.edu. -18.7.15.93 #hum.mit.edu. ->net.mit.edu #MIT/Network Group cell -18.7.7.73 #gracie.mit.edu -18.7.21.95 #george.mit.edu ->sipb.mit.edu #MIT/SIPB cell -18.181.0.19 #reynelda.mit.edu. -18.181.0.22 #rosebud.mit.edu. -18.181.0.23 #ronald-ann.mit.edu. ->msu.edu #Michigan State University Main Cell -35.9.7.10 #afsdb0.cl.msu.edu ->nd.edu #University of Notre Dame -129.74.223.17 #john.helios.nd.edu -129.74.223.33 #lizardo.helios.nd.edu -129.74.223.65 #buckaroo.helios.nd.edu ->pitt.edu #University of Pittsburgh -136.142.8.15 #afs09.srv.cis.pitt.edu -136.142.8.20 #afs10.srv.cis.pitt.edu -136.142.8.21 #afs11.srv.cis.pitt.edu ->cs.pitt.edu #University of Pittsburgh - Computer Science -130.49.220.11 #afs01.cs.pitt.edu -130.49.220.12 #afs02.cs.pitt.edu -130.49.220.13 #afs03.cs.pitt.edu ->psc.edu #PSC (Pittsburgh Supercomputing Center) -128.182.59.182 #shaggy.psc.edu -128.182.66.184 #velma.psc.edu -128.182.66.185 #daphne.psc.edu ->scoobydoo.psc.edu #PSC Test Cell -128.182.59.181 #scooby.psc.edu ->cede.psu.edu #Penn State - Center for Engr. Design & Entrepeneurship -146.186.218.10 #greenly.cede.psu.edu -146.186.218.60 #b50.cede.psu.edu -146.186.218.246 #stalin.cede.psu.edu ->rose-hulman.edu #Rose-Hulman Institute of Technology -137.112.7.11 #afs1.rose-hulman.edu -137.112.7.12 #afs2.rose-hulman.edu -137.112.7.13 #afs3.rose-hulman.edu ->cs.rose-hulman.edu #Rose-Hulman CS Department -137.112.40.10 #galaxy.cs.rose-hulman.edu ->rpi.edu #Rensselaer Polytechnic Institute -128.113.22.11 #saul.server.rpi.edu -128.113.22.12 #joab.server.rpi.edu -128.113.22.13 #korah.server.rpi.edu -128.113.22.14 #achan.server.rpi.edu ->hep.sc.edu #University of South Carolina, Dept. of Physics -129.252.78.77 #cpeven.physics.sc.edu ->cs.stanford.edu #Stanford University Computer Science Department -171.64.64.10 #cs-afs-1.Stanford.EDU -171.64.64.66 #cs-afs-2.stanford.edu -171.64.64.69 #cs-afs-3.stanford.edu ->ir.stanford.edu #Stanford University -171.64.7.222 #afsdb1.stanford.edu -171.64.7.234 #afsdb2.stanford.edu -171.64.7.246 #afsdb3.stanford.edu ->slac.stanford.edu #Stanford Linear Accelerator Center -134.79.18.25 #afsdb1.slac.stanford.edu -134.79.18.26 #afsdb2.slac.stanford.edu -134.79.18.27 #afsdb3.slac.stanford.edu ->cats.ucsc.edu #UC Santa Cruz, Comm. and Tech. Services, California U.S.A -128.114.129.14 #elan.ucsc.edu -128.114.129.15 #ichabod.ucsc.edu -128.114.129.18 #maneki.ucsc.edu ->acm.uiuc.edu #ACM at the University of Illinois -128.174.251.8 #alnitak.acm.uiuc.edu -128.174.251.9 #alnilam.acm.uiuc.edu -128.174.251.10 #mintaka.acm.uiuc.edu ->ncsa.uiuc.edu #University of Illinois -141.142.3.5 #congo.ncsa.uiuc.edu -141.142.3.8 #nile.ncsa.uiuc.edu -141.142.230.19 #jinx.ncsa.uiuc.edu ->umbc.edu #University of Maryland, Baltimore County -130.85.24.23 #db2.afs.umbc.edu -130.85.24.87 #db3.afs.umbc.edu -130.85.24.101 #db1.afs.umbc.edu ->glue.umd.edu #University of Maryland - Project Glue -128.8.70.11 #olmec.umd.edu -128.8.73.3 #babylon.umd.edu -129.2.128.53 #egypt.umd.edu ->wam.umd.edu #University of Maryland Network WAM Project -128.8.70.9 #csc-srv.wam.umd.edu -128.8.73.9 #pg2-srv.wam.umd.edu -129.2.128.54 #avw-srv.wam.umd.edu ->umich.edu #University of Michigan - Campus -141.211.1.32 #fear.ifs.umich.edu -141.211.1.33 #surprise.ifs.umich.edu -141.211.1.34 #ruthless.ifs.umich.edu ->atlas.umich.edu #ATLAS group cell in physics at University of Michigan -141.211.43.102 #linat02.grid.umich.edu -141.211.43.106 #linat06.grid.umich.edu -141.211.43.109 #atgrid.grid.umich.edu ->citi.umich.edu #Center for Information Technology Integration -141.211.133.5 #babylon.citi.umich.edu ->lsa.umich.edu #University of Michigan - College of LS&A -141.211.54.132 #curtis.admin.lsa.umich.edu -141.211.61.23 #zee.admin.lsa.umich.edu -141.211.68.15 #marshall.lsa.umich.edu ->math.lsa.umich.edu #University of Michigan - Math Department -141.211.61.40 #ike.math.lsa.umich.edu -141.211.61.41 #clark.math.lsa.umich.edu -141.211.61.42 #nimitz.math.lsa.umich.edu ->umr.edu #University of Missouri - Rolla -131.151.1.59 #afsdb1.umr.edu -131.151.1.70 #afsdb3.umr.edu -131.151.1.146 #afsdb2.umr.edu ->physics.unc.edu #Univ. of NC at Chapel Hill, Dept. of Physics -152.2.5.2 #valerian.physics.unc.edu -152.2.5.3 #augustus.physics.unc.edu -152.2.7.67 #nerva.astro.unc.edu ->uncc.edu #University of NC at Charlotte Mosaic AFS Cell -152.15.10.70 #as-sm1.uncc.edu -152.15.13.7 #as-sm2.uncc.edu -152.15.30.27 #fs-kenn3.uncc.edu ->eng.utah.edu #University of Utah - Engineering -155.99.222.9 #lenny.eng.utah.edu -155.99.222.10 #carl.eng.utah.edu ->cs.uwm.edu #University of Wisconsin--Milwaukee -129.89.38.124 #solomons.cs.uwm.edu ->cs.wisc.edu #Univ. of Wisconsin-Madison, Computer Sciences Dept. -128.105.132.14 #timon.cs.wisc.edu -128.105.132.15 #pumbaa.cs.wisc.edu -128.105.132.16 #zazu.cs.wisc.edu ->engr.wisc.edu #University of Wisconsin-Madison, College of Engineering -144.92.13.14 #larry.cae.wisc.edu -144.92.13.15 #curly.cae.wisc.edu -144.92.13.16 #moe.cae.wisc.edu ->hep.wisc.edu #University of Wisconsin -- High Energy Physics -128.104.28.219 #anise.physics.wisc.edu ->physics.wisc.edu #Univ. of Wisconsin-Madison, Physics Department -128.104.220.51 #bubbles.physics.wisc.edu -128.104.220.52 #buttercup.physics.wisc.edu -128.104.220.53 #blossom.physics.wisc.edu ->ifca.unican.es #Instituto de Fisica de Cantabria (IFCA), Santander, Spain -193.144.209.20 #gridwall.ifca.unican.es ->ific.uv.es #Instituto de Fisica Corpuscular, Valencia, Spain -147.156.163.11 #alpha.ific.uv.es ->biocenter.helsinki.fi #University of Helsinki, Institute of Biotechnology -128.214.58.174 #afsdb1.biocenter.helsinki.fi -128.214.88.114 #afsdb2.biocenter.helsinki.fi ->dapnia.saclay.cea.fr #CEA DAPNIA -132.166.32.7 #dphrsg.saclay.cea.fr -132.166.32.12 #dphrsl.saclay.cea.fr ->in2p3.fr #IN2P3 production cell -134.158.232.11 #ccafsdb1.in2p3.fr -134.158.232.12 #ccafsdb2.in2p3.fr -134.158.232.13 #ccafsdb3.in2p3.fr ->anl.gov #Argonne National Laboratory -146.137.96.33 #arteus.ctd.anl.gov -146.137.162.88 #agamemnon.ctd.anl.gov -146.137.194.80 #antenor.ctd.anl.gov ->rhic.bnl.gov #Relativistic Heavy Ion Collider -130.199.6.51 #rafs03.rcf.bnl.gov -130.199.6.52 #rafs02.rcf.bnl.gov -130.199.6.69 #rafs01.rcf.bnl.gov ->usatlas.bnl.gov #US Atlas Tier 1 Facility at BNL -130.199.48.32 #aafs01.usatlas.bnl.gov -130.199.48.33 #aafs02.usatlas.bnl.gov -130.199.48.34 #aafs03.usatlas.bnl.gov ->fnal.gov #Fermi National Acclerator Laboratory -131.225.68.1 #fsus01.fnal.gov -131.225.68.4 #fsus03.fnal.gov -131.225.68.14 #fsus04.fnal.gov ->ic-afs.arc.nasa.gov #Code IC, Ames Research Center -128.102.105.62 #udanax.arc.nasa.gov ->nersc.gov #National Energy Research Supercomputer Center -128.55.128.250 #mars.nersc.gov -128.55.128.252 #alfred.nersc.gov -128.55.128.254 #lurch.nersc.gov ->caspur.it #CASPUR Inter-University Computing Consortium, Rome -193.204.5.45 #pomodoro.caspur.it -193.204.5.46 #banana.caspur.it -193.204.5.50 #maslo.caspur.it ->fusione.it #Assoz. FUSIONE/Euratom, ENEA, Frascati-Italy -192.107.90.2 #fusafs1.frascati.enea.it -192.107.90.3 #fusafs2.frascati.enea.it -192.107.90.4 #fusafs3.frascati.enea.it ->icemb.it #ICEMB, Universita' La Sapienza - Rome - Italy -193.204.6.130 #icembfs.caspur.it ->infn.it #Istituto Nazionale di Fisica Nucleare (INFN), Italia -131.154.1.7 #afs3.infn.it -141.108.3.252 #afs1.infn.it -192.84.134.75 #afs2.infn.it ->kloe.infn.it #INFN, KLOE experiment at Laboratori di Frascati -192.135.25.111 #kloeafs1.lnf.infn.it -192.135.25.112 #kloeafs2.lnf.infn.it ->le.infn.it #INFN, Sezione di Lecce -192.84.152.40 #afs01.le.infn.it -192.84.152.148 #afs02.le.infn.it ->lnf.infn.it #INFN, Laboratori Nazionali di Frascati -193.206.84.121 #afs1.lnf.infn.it -193.206.84.122 #afs2.lnf.infn.it -193.206.84.123 #afs3.lnf.infn.it ->lngs.infn.it #INFN, Laboratori Nazionali di Gran Sasso -192.84.135.21 #rsgs05.lngs.infn.it ->pi.infn.it #INFN, Sezione di Pisa -131.114.134.26 #unknownhost.pi.infn.it -192.84.133.50 #aix1.pi.infn.it ->psm.it #Progetto San Marco, Universita' di Roma-1 -151.100.1.65 #atlante.psm.uniroma1.it ->tgrid.it #CASPUR-CILEA-CINECA Grid Cell -193.204.5.33 #cccgrid.caspur.it ->ictp.trieste.it #The Abdus Salam International Centre for Theoretical Physics (IC -140.105.16.8 #fs1.ictp.trieste.it -140.105.16.9 #fs2.ictp.trieste.it ->ing.uniroma1.it #Universita' La Sapienza, Fac. Ingeneria -151.100.85.253 #alfa.ing.uniroma1.it ->vn.uniroma3.it #University of Rome 3, Area Vasca Navale -193.204.161.136 #alfa.dia.uniroma3.it -193.204.161.137 #beta.dia.uniroma3.it -193.204.161.138 #gamma.dia.uniroma3.it ->italia #Italian public AFS cell -193.204.5.9 #afs.caspur.it ->cmf.nrl.navy.mil #Naval Research Lab - CCS -134.207.10.68 #picard.cmf.nrl.navy.mil -134.207.10.69 #riker.cmf.nrl.navy.mil -134.207.10.70 #kirk.cmf.nrl.navy.mil ->lcp.nrl.navy.mil #Naval Research Lab - Lab for Computational Physics -132.250.114.2 #afs1.lcp.nrl.navy.mil -132.250.114.4 #afs2.lcp.nrl.navy.mil -132.250.114.6 #afs3.lcp.nrl.navy.mil ->es.net #Energy Sciences Net -198.128.3.21 #fs1.es.net -198.128.3.22 #fs2.es.net -198.128.3.23 #fs3.es.net ->laroia.net #Laroia Networks -66.66.102.254 #supercore.laroia.net ->sinenomine.net #Sine Nomine Associates -66.92.236.139 #afs.sinenomine.net ->slackers.net #The Slackers' Network -63.201.48.27 #alexandria.slackers.net ->nikhef.nl #The Dutch National Institute for High Energy Physics -192.16.185.26 #afs1.nikhef.nl -192.16.185.27 #afs2.nikhef.nl ->1ts.org #KCR/private Karl Ramm, Cambridge, MA -4.36.43.102 #dol-guldur.1ts.org ->bazquux.org #Baz Quux Organization -66.207.142.196 #baxquux.org ->coed.org #Adam Pennington's Cell -66.93.61.184 #vice1.coed.org -128.2.4.163 #vice3.coed.org ->dementia.org #Dementia Unlimited -128.2.12.45 #alycia.dementia.org -128.2.120.216 #meredith.dementia.org ->idahofuturetruck.org #University of Idaho hybrid vehicle development -12.18.238.210 #dsle210.fsr.net ->nimlabs.org #Nimlabs, Ink. Cell. -18.238.1.103 #olfin.nimlabs.org -18.238.1.105 #caerbanog.nimlabs.org ->nomh.org #nomh.org -204.29.154.12 #iota.nomh.org ->oc7.org #The OC7 Project -128.2.6.107 #vice3.oc7.org -128.2.122.140 #vice2.oc7.org ->openafs.org #OpenAFS Project -128.2.13.199 #new-virtue.openafs.org -128.2.121.218 #virtue.openafs.org -130.237.48.87 #andrew.e.kth.se -130.237.48.107 #onyx.e.kth.se ->e.kth.se #Royal Institute of Technology, Elektro -130.237.32.145 #sonen.e.kth.se -130.237.48.7 #anden.e.kth.se -130.237.48.244 #fadern.e.kth.se ->hallf.kth.se #Royal Institute of Technology, HALLF -130.237.24.141 #rasmus13.hallf.kth.se -130.237.24.152 #rasmus3.hallf.kth.se -130.237.24.177 #rasmus29.hallf.kth.se ->isk.kth.se #Royal Institute of Technology, ISK -130.237.202.12 #afsdb2.isk.kth.se -130.237.206.13 #afsdb1.isk.kth.se -130.237.209.141 #afsdb3.isk.kth.se ->it.kth.se #Royal Institute of Technology, IT -130.237.212.15 #ptah.it.kth.se -130.237.212.16 #toth.it.kth.se -130.237.215.7 #isis.it.kth.se ->md.kth.se #Royal Institute of Technology, MMK -130.237.57.68 #trinity.md.kth.se -130.237.57.72 #morpheus.md.kth.se -130.237.67.230 #neo.speech.kth.se ->mech.kth.se #Royal Institute of Technology, MECH -130.237.233.142 #matterhorn.mech.kth.se -130.237.233.143 #castor.mech.kth.se -130.237.233.144 #pollux.mech.kth.se ->nada.kth.se #Royal Institute of Technology, NADA -130.237.222.20 #kosmos.nada.kth.se -130.237.223.12 #sputnik.nada.kth.se -130.237.224.78 #mir.nada.kth.se -130.237.227.23 #gagarin.nada.kth.se -130.237.228.28 #laika.nada.kth.se ->pdc.kth.se #Royal Institute of Technology, PDC -130.237.232.29 #crab.pdc.kth.se -130.237.232.112 #anna.pdc.kth.se -130.237.232.114 #hokkigai.pdc.kth.se ->stacken.kth.se #Stacken Computer Club -130.237.234.3 #milko.stacken.kth.se -130.237.234.43 #hot.stacken.kth.se -130.237.237.230 #fishburger.stacken.kth.se ->syd.kth.se #Royal Institute of Technology, KTH-Syd -130.237.83.23 #afs.haninge.kth.se ->physto.se #Physics department Stockholm University -130.237.205.36 #sysafs1.physto.se -130.237.205.72 #sysafs2.physto.se ->sanchin.se #Sanchin Consulting AB, Sweden -192.195.148.10 #sesan.sanchin.se ->su.se #Stockholm University -130.237.162.81 #afsdb1.su.se -130.237.162.82 #afsdb2.su.se ->f9.ijs.si #F9, Jozef Stefan Institue -194.249.156.1 #brenta.ijs.si ->p-ng.si #Nova Gorica Polytechnic -193.2.120.2 #solkan.p-ng.si ->phy.bris.ac.uk #Bristol University - phyics -137.222.58.9 #afs1.phy.bris.ac.uk ->hep.man.ac.uk #Manchester HEP -194.36.2.3 #afs1.hep.man.ac.uk -194.36.2.4 #afs2.hep.man.ac.uk -194.36.2.5 #afs3.hep.man.ac.uk ->rl.ac.uk #Rutherford Appleton Lab, England -130.246.183.164 #wallace.cc.rl.ac.uk diff --git a/src/WINNT/install/loopback/loopbackutils.cpp b/src/WINNT/install/loopback/loopbackutils.cpp index 7ec3e4ba9..b3eebe3eb 100644 --- a/src/WINNT/install/loopback/loopbackutils.cpp +++ b/src/WINNT/install/loopback/loopbackutils.cpp @@ -696,14 +696,17 @@ extern "C" void SetMsiReporter(LPCSTR strAction, LPCSTR strDesc,DWORD h) { dwReporterType = REPORT_MSI; hMsiHandle = h; +#ifdef DONT_NEED + /* this is performed in the Wix installer */ MSIHANDLE hRec = MsiCreateRecord(4); - - MsiRecordClearData(hRec); + + MsiRecordClearData(hRec); MsiRecordSetStringA(hRec,1,strAction); MsiRecordSetStringA(hRec,2,strDesc); MsiRecordSetStringA(hRec,3,"[1]:([2])([3])([4])"); MsiProcessMessage(h,INSTALLMESSAGE_ACTIONSTART, hRec); - - MsiCloseHandle(hRec); + + MsiCloseHandle(hRec); +#endif } diff --git a/src/WINNT/install/loopback/wmi.cpp b/src/WINNT/install/loopback/wmi.cpp index 80cfaa627..a9fa2ea2a 100644 --- a/src/WINNT/install/loopback/wmi.cpp +++ b/src/WINNT/install/loopback/wmi.cpp @@ -739,26 +739,44 @@ BOOL UpdateHostsFile( LPCWSTR swName, LPCWSTR swIp, LPCSTR szFilename, BOOL bPre strcpy(buffer, etcPath); strcat(buffer, ".old"); - errno = 0; - - if ((unlink( buffer ) != 0) && (errno == EACCES)) - { - ReportMessage(0,"FAILED : Can't delete file",buffer,0,errno); - return FALSE; - + if(!DeleteFileA(buffer)) { + DWORD status; + int i; + char * eos; + + status = GetLastError(); + if(status == ERROR_ACCESS_DENIED) { + /* try changing the file attribtues. */ + if(SetFileAttributesA(buffer, FILE_ATTRIBUTE_NORMAL) && + DeleteFileA(buffer)) { + status = 0; + ReportMessage(0,"Changed attributes and deleted back host file", buffer, 0, 0); + } + } + if(status && status != ERROR_FILE_NOT_FOUND) { + /* we can't delete the file. Try to come up with + a different name that's not already taken. */ + srand(GetTickCount()); + eos = buffer + strlen(buffer); + for(i=0; i < 50; i++) { + itoa(rand(), eos, 16); + if(GetFileAttributesA(buffer) == INVALID_FILE_ATTRIBUTES && + GetLastError() == ERROR_FILE_NOT_FOUND) + break; + } + /* At this point if we don't have a unique name, we just let the rename + fail. Too bad. */ + } } - - if ((errno) && (errno != ENOENT)) ReportMessage(0,"WEIRD : errno after unlink ",0,0,errno); - if(rename( etcPath, buffer) != 0) - { - ReportMessage(0,"FAILED : Can't rename old file",etcPath,0,errno); - return FALSE; - } + if(!MoveFileA( etcPath, buffer )) { + ReportMessage(0,"FAILED: Can't rename old file", etcPath, 0, GetLastError()); + return FALSE; + } - if(rename( tempPath, etcPath ) != 0) + if(!MoveFileA( tempPath, etcPath ) != 0) { - ReportMessage(0,"FAILED : Can't rename new file",tempPath,0,errno); + ReportMessage(0,"FAILED : Can't rename new file", tempPath, 0, GetLastError()); return FALSE; } diff --git a/src/WINNT/install/wix/CellServDB b/src/WINNT/install/wix/CellServDB index 6d43dc846..7b320be66 100644 --- a/src/WINNT/install/wix/CellServDB +++ b/src/WINNT/install/wix/CellServDB @@ -1,4 +1,4 @@ ->grand.central.org #GCO Public CellServDB 11 May 2004 +>grand.central.org #GCO Public CellServDB 29 Jun 2004 18.7.14.88 #grand-opening.mit.edu 128.2.191.224 #penn.central.org >wu-wien.ac.at #University of Economics, Vienna, Austria @@ -75,10 +75,12 @@ 134.109.200.7 #aetius.hrz.tu-chemnitz.de >e18.ph.tum.de #Experimental Physics, TU Munich, Germany 129.187.154.223 #hamlet.e18.physik.tu-muenchen.de ->uni-bonn.de #Cell name +>uni-bonn.de #University of Bonn, Computing Center 131.220.14.198 #work15-eth.rhrz.uni-bonn.de -131.220.14.203 #node03-en2.rhrz.uni-bonn.de 131.220.14.205 #node05.rhrz.uni-bonn.de +131.220.15.197 #afs-db1.rhrz.uni-bonn.de +>atlass01.physik.uni-bonn.de #Bonn ATLAS +131.220.165.43 #atlass01.physik.uni-bonn.de >uni-freiburg.de #Albert-Ludwigs-Universitat Freiburg 132.230.6.235 #sv6.ruf.uni-freiburg.de 132.230.6.236 #sv7.ruf.uni-freiburg.de @@ -108,9 +110,9 @@ >physik.uni-mainz.de #institute of physics, university Mainz, Germany 134.93.130.93 #hardy.physik.uni-mainz.de >uni-mannheim.de #Uni Mannheim (Rechenzentrum) -134.155.50.165 #afsdbx.uni-mannheim.de -134.155.50.166 #afsdby.uni-mannheim.de -134.155.50.167 #afsdbz.uni-mannheim.de +134.155.97.204 #afsdb1.uni-mannheim.de +134.155.97.205 #afsdb2.uni-mannheim.de +134.155.97.206 #afsdb3.uni-mannheim.de >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal 132.195.104.3 #afs1.physik.uni-wuppertal.de 132.195.104.230 #afs2.physik.uni-wuppertal.de @@ -118,6 +120,11 @@ 130.225.51.73 #afsdb1.kom.auc.dk 130.225.51.74 #afsdb2.kom.auc.dk 130.225.51.85 #afsdb3.kom.auc.dk +>asu.edu #Arizona State University +129.219.10.69 #authen2.asu.edu +129.219.10.70 #authen1.asu.edu +129.219.10.72 #authen3.asu.edu +129.219.100.16 #authen4.asu.edu >hep.caltech.edu #CalTech High Energy Physics 131.215.126.150 #afs.hep.caltech.edu >andrew.cmu.edu #Carnegie Mellon University - Computing Services Cell @@ -142,6 +149,9 @@ 128.2.129.9 #e-xing.ece.cmu.edu >scotch.ece.cmu.edu #CMU ECE CALCM research group 128.2.134.82 #lagavulin.ece.cmu.edu +>qatar.cmu.edu #Carnegie Mellon University - Qatar Campus Cell +204.194.25.7 #afs1.qatar.cmu.edu +204.194.25.8 #afs2.qatar.cmu.edu >msc.cornell.edu #Cornell University Materials Science Center 128.84.231.242 #miranda.ccmr.cornell.edu 128.84.241.35 #co.ccmr.cornell.edu @@ -233,7 +243,7 @@ >ncsa.uiuc.edu #University of Illinois 141.142.3.5 #congo.ncsa.uiuc.edu 141.142.3.8 #nile.ncsa.uiuc.edu -141.142.230.19 #jinx.ncsa.uiuc.edu +141.142.3.9 #kaskaskia.ncsa.uiuc.edu >umbc.edu #University of Maryland, Baltimore County 130.85.24.23 #db2.afs.umbc.edu 130.85.24.87 #db3.afs.umbc.edu @@ -258,8 +268,9 @@ 141.211.133.5 #babylon.citi.umich.edu >lsa.umich.edu #University of Michigan - College of LS&A 141.211.54.132 #curtis.admin.lsa.umich.edu -141.211.61.23 #zee.admin.lsa.umich.edu -141.211.68.15 #marshall.lsa.umich.edu +141.211.211.53 #gerow.lsa.umich.edu +141.211.211.72 #collines.lsa.umich.edu +141.211.211.153 #hodges.lsa.umich.edu >math.lsa.umich.edu #University of Michigan - Math Department 141.211.61.40 #ike.math.lsa.umich.edu 141.211.61.41 #clark.math.lsa.umich.edu @@ -406,6 +417,9 @@ >dementia.org #Dementia Unlimited 128.2.12.45 #alycia.dementia.org 128.2.120.216 #meredith.dementia.org +>hackish.org #Hackish.org +24.167.65.213 #avatar.sys.hackish.org +128.2.120.138 #kurma.sys.hackish.org >idahofuturetruck.org #University of Idaho hybrid vehicle development 12.18.238.210 #dsle210.fsr.net >nimlabs.org #Nimlabs, Ink. Cell. @@ -413,6 +427,7 @@ 18.238.1.105 #caerbanog.nimlabs.org >nomh.org #nomh.org 204.29.154.12 #iota.nomh.org +204.29.154.32 #adversity.xi.nomh.org >oc7.org #The OC7 Project 128.2.6.107 #vice3.oc7.org 128.2.122.140 #vice2.oc7.org @@ -442,7 +457,6 @@ 130.237.57.72 #morpheus.md.kth.se 130.237.67.230 #neo.speech.kth.se >mech.kth.se #Royal Institute of Technology, MECH -130.237.233.142 #matterhorn.mech.kth.se 130.237.233.143 #castor.mech.kth.se 130.237.233.144 #pollux.mech.kth.se >nada.kth.se #Royal Institute of Technology, NADA @@ -469,6 +483,7 @@ >su.se #Stockholm University 130.237.162.81 #afsdb1.su.se 130.237.162.82 #afsdb2.su.se +130.237.162.230 #afsdb3.su.se >f9.ijs.si #F9, Jozef Stefan Institue 194.249.156.1 #brenta.ijs.si >p-ng.si #Nova Gorica Polytechnic diff --git a/src/WINNT/install/wix/NTMakefile b/src/WINNT/install/wix/NTMakefile index ce69def93..8b2c50145 100644 --- a/src/WINNT/install/wix/NTMakefile +++ b/src/WINNT/install/wix/NTMakefile @@ -57,7 +57,7 @@ $(WIXOBJ): openafs.wxs $(WIXINCLUDES) -dCellDbFile=CellServDB \ -v0 \ -w0 \ - openafs.wxs + $(AFSDEV_AUXWIXDEFINES) openafs.wxs # Cleanup clean:: diff --git a/src/WINNT/install/wix/config.wxi b/src/WINNT/install/wix/config.wxi index e2d8b81e9..e4702b09d 100644 --- a/src/WINNT/install/wix/config.wxi +++ b/src/WINNT/install/wix/config.wxi @@ -63,7 +63,10 @@ - + + + + diff --git a/src/WINNT/install/wix/feature.wxi b/src/WINNT/install/wix/feature.wxi index 7a5653755..431741e73 100644 --- a/src/WINNT/install/wix/feature.wxi +++ b/src/WINNT/install/wix/feature.wxi @@ -31,6 +31,7 @@ + CREDSSTARTUP = 0 @@ -39,15 +40,20 @@ + + + + - + + diff --git a/src/WINNT/install/wix/files.wxi b/src/WINNT/install/wix/files.wxi index c87a2d828..041187751 100644 --- a/src/WINNT/install/wix/files.wxi +++ b/src/WINNT/install/wix/files.wxi @@ -1,9 +1,21 @@ - - - + + + + + + + + + + + + + + + @@ -719,6 +731,15 @@ + + + OLDCELLSERVDB = "" + + + + + OLDCELLSERVDB <> "" + @@ -761,8 +782,8 @@ - - + + @@ -1223,7 +1240,7 @@ - + @@ -1265,9 +1282,11 @@ + - - + + + diff --git a/src/WINNT/install/wix/lang/en_US/ui.wxi b/src/WINNT/install/wix/lang/en_US/ui.wxi index c5ffea7c1..feade4053 100644 --- a/src/WINNT/install/wix/lang/en_US/ui.wxi +++ b/src/WINNT/install/wix/lang/en_US/ui.wxi @@ -750,14 +750,14 @@ - - - - - - - - + + + + + + + + 0 @@ -772,9 +772,8 @@ 1 - 0 - 1 - 3 + 0 + 1 @@ -801,7 +800,7 @@ - + @@ -820,7 +819,7 @@ {\VerdanaBold13}[ProductName] [Wizard] was interrupted - [ProductName] setup was interrupted. Your system has not been modified. To install this program at a later time, please run the installation again. + [ProductName] setup was interrupted. Your system has not been modified. To install or modify this program at a later time, please run the installation again. Click the Finish button to exit the [Wizard]. @@ -911,8 +910,8 @@ - - [DlgTitleFont]Remove [ProductName] + + [DlgTitleFont]Remove OpenAFS for Windows @@ -940,8 +939,8 @@ - - [DlgTitleFont]Repair [ProductName] + + [DlgTitleFont]Repair OpenAFS for Windows diff --git a/src/WINNT/install/wix/openafs.wxs b/src/WINNT/install/wix/openafs.wxs index dc4eb00ff..df94cd505 100644 --- a/src/WINNT/install/wix/openafs.wxs +++ b/src/WINNT/install/wix/openafs.wxs @@ -23,6 +23,7 @@ Id="$(var.PackageCode)" --> $(var.RxMaxMTU) $(var.HideDotFiles) $(var.SecurityLevel) - 1 -a -m -n -q + $(var.SMBAuthType) + + $(var.ProductComments) @@ -109,4 +115,10 @@ $(loc.StrNsisAbortReason) + + + + + + diff --git a/src/WINNT/install/wix/registry.wxi b/src/WINNT/install/wix/registry.wxi index 3f50ea557..9266497db 100644 --- a/src/WINNT/install/wix/registry.wxi +++ b/src/WINNT/install/wix/registry.wxi @@ -4,173 +4,185 @@ This file will be included as a child of the root Directory tag. --> - + - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - + - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - + - - - - - - - + + + + + + + + + + + - - - - + + + + - + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + + + + + + AFSCACHEPATH <> "" + + + + AFSCACHESIZE <> "" - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + @@ -184,7 +196,7 @@ being removed when the product is uninstalled. This is just a flag component to add to the loopback feature so that it is not empty. --> - + diff --git a/src/WINNT/kfw/inc/krb4/krb.h b/src/WINNT/kfw/inc/krb4/krb.h index e1deac108..796b375e7 100644 --- a/src/WINNT/kfw/inc/krb4/krb.h +++ b/src/WINNT/kfw/inc/krb4/krb.h @@ -452,4 +452,7 @@ int krb_save_credentials(char *service, char *instance, char *realm, int krb_in_tkt(char *pname, char *pinst, char *prealm); +/* lifetime.c */ +int krb_life_to_time(int start, int life); +int krb_time_to_life(int start, int end); #endif /* KRB_DEFS */ diff --git a/src/WINNT/kfw/inc/leash/leashwin.h b/src/WINNT/kfw/inc/leash/leashwin.h index f3ac7429d..0d6211c0d 100644 --- a/src/WINNT/kfw/inc/leash/leashwin.h +++ b/src/WINNT/kfw/inc/leash/leashwin.h @@ -42,7 +42,8 @@ typedef struct { } out; } LSH_DLGINFO_EX, FAR *LPLSH_DLGINFO_EX; -#define LSH_DLGINFO_EX_V1_SZ (sizeof(DWORD) + 3 * sizeof(LPSTR) * 8 * sizeof(int)) +#define LSH_DLGINFO_EX_V1_SZ (sizeof(DWORD) + 3 * sizeof(LPSTR) + 8 * sizeof(int)) +#define LSH_DLGINFO_EX_V2_SZ (sizeof(DWORD) + 3 * sizeof(LPSTR) + 8 * sizeof(int) + max(LEASH_USERNAME_SZ,LEASH_REALM_SZ)) typedef struct { char principal[MAX_K_NAME_SZ]; /* Principal name/instance/realm */ @@ -129,5 +130,11 @@ DWORD Leash_reset_lock_file_locations(); DWORD Leash_get_default_uppercaserealm(); DWORD Leash_set_default_uppercaserealm(DWORD onoff); DWORD Leash_reset_default_uppercaserealm(); +DWORD Leash_get_default_mslsa_import(); +DWORD Leash_set_default_mslsa_import(DWORD onoffmatch); +DWORD Leash_reset_default_mslsa_import(); +DWORD Leash_get_default_preserve_kinit_settings(); +DWORD Leash_set_default_preserve_kinit_settings(DWORD onoff); +DWORD Leash_reset_default_preserve_kinit_settings(); #endif /* LEASHWIN */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h index 5ba4578ee..fb9b63fe7 100644 --- a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb.h @@ -302,5 +302,16 @@ TYPEDEF_FUNC( lsh_LoadKrb4LeashErrorTables, (HMODULE hLeashDll, INT useCallBackFunction) ); - +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_life_to_time, + (int start, int life) + ); +TYPEDEF_FUNC( + int, + CALLCONV_C, + krb_time_to_life, + (int start, int end) + ); #endif /* __LOADFUNCS_KRB_H__ */ diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h index 46827f64c..070735a11 100644 --- a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-krb5.h @@ -876,6 +876,14 @@ TYPEDEF_FUNC( const char * ) ); +TYPEDEF_FUNC( + krb5_error_code, + KRB5_CALLCONV, + krb5_free_default_realm, + (krb5_context, + const char * ) + ); + TYPEDEF_FUNC( krb5_error_code, KRB5_CALLCONV, diff --git a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h index 4222245d8..f05386b5b 100644 --- a/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h +++ b/src/WINNT/kfw/inc/loadfuncs/loadfuncs-leash.h @@ -344,6 +344,42 @@ TYPEDEF_FUNC( Leash_reset_default_uppercaserealm, (void) ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_mslsa_import, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_mslsa_import, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_mslsa_import, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_get_default_preserve_kinit_settings, + (void) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_set_default_preserve_kinit_settings, + (DWORD) + ); +TYPEDEF_FUNC( + DWORD, + CALLCONV_C, + Leash_reset_default_preserve_kinit_settings, + (void) + ); TYPEDEF_FUNC( BOOL, CALLCONV_C, diff --git a/src/WINNT/kfw/lib/i386/comerr32.lib b/src/WINNT/kfw/lib/i386/comerr32.lib index be521f5b6..ce925ccef 100644 Binary files a/src/WINNT/kfw/lib/i386/comerr32.lib and b/src/WINNT/kfw/lib/i386/comerr32.lib differ diff --git a/src/WINNT/kfw/lib/i386/delaydlls.lib b/src/WINNT/kfw/lib/i386/delaydlls.lib index a39ff4ac7..7ada8e7cd 100644 Binary files a/src/WINNT/kfw/lib/i386/delaydlls.lib and b/src/WINNT/kfw/lib/i386/delaydlls.lib differ diff --git a/src/WINNT/kfw/lib/i386/getopt.lib b/src/WINNT/kfw/lib/i386/getopt.lib index 1aef84fb3..724bf04fa 100644 Binary files a/src/WINNT/kfw/lib/i386/getopt.lib and b/src/WINNT/kfw/lib/i386/getopt.lib differ diff --git a/src/WINNT/kfw/lib/i386/gssapi32.lib b/src/WINNT/kfw/lib/i386/gssapi32.lib index 3a7de5595..d4338ff30 100644 Binary files a/src/WINNT/kfw/lib/i386/gssapi32.lib and b/src/WINNT/kfw/lib/i386/gssapi32.lib differ diff --git a/src/WINNT/kfw/lib/i386/kclnt32.lib b/src/WINNT/kfw/lib/i386/kclnt32.lib index 085dbd36e..3decebab2 100644 Binary files a/src/WINNT/kfw/lib/i386/kclnt32.lib and b/src/WINNT/kfw/lib/i386/kclnt32.lib differ diff --git a/src/WINNT/kfw/lib/i386/krb524.lib b/src/WINNT/kfw/lib/i386/krb524.lib index b43d494f7..8dd8f71a1 100644 Binary files a/src/WINNT/kfw/lib/i386/krb524.lib and b/src/WINNT/kfw/lib/i386/krb524.lib differ diff --git a/src/WINNT/kfw/lib/i386/krb5_32.lib b/src/WINNT/kfw/lib/i386/krb5_32.lib index 7fcfa8496..a5865073e 100644 Binary files a/src/WINNT/kfw/lib/i386/krb5_32.lib and b/src/WINNT/kfw/lib/i386/krb5_32.lib differ diff --git a/src/WINNT/kfw/lib/i386/krbcc32.lib b/src/WINNT/kfw/lib/i386/krbcc32.lib index 03bbcdcba..38ad9934a 100644 Binary files a/src/WINNT/kfw/lib/i386/krbcc32.lib and b/src/WINNT/kfw/lib/i386/krbcc32.lib differ diff --git a/src/WINNT/kfw/lib/i386/krbv4w32.lib b/src/WINNT/kfw/lib/i386/krbv4w32.lib index 31e0a6352..f086662da 100644 Binary files a/src/WINNT/kfw/lib/i386/krbv4w32.lib and b/src/WINNT/kfw/lib/i386/krbv4w32.lib differ diff --git a/src/WINNT/kfw/lib/i386/leashw32.lib b/src/WINNT/kfw/lib/i386/leashw32.lib index ff059831d..0b3a6c79d 100644 Binary files a/src/WINNT/kfw/lib/i386/leashw32.lib and b/src/WINNT/kfw/lib/i386/leashw32.lib differ diff --git a/src/WINNT/kfw/lib/i386/loadfuncs.lib b/src/WINNT/kfw/lib/i386/loadfuncs.lib index 979f351f6..0d512c3f2 100644 Binary files a/src/WINNT/kfw/lib/i386/loadfuncs.lib and b/src/WINNT/kfw/lib/i386/loadfuncs.lib differ diff --git a/src/WINNT/kfw/lib/i386/wshelp32.lib b/src/WINNT/kfw/lib/i386/wshelp32.lib index 7bdc3132d..56bcecbe4 100644 Binary files a/src/WINNT/kfw/lib/i386/wshelp32.lib and b/src/WINNT/kfw/lib/i386/wshelp32.lib differ diff --git a/src/WINNT/kfw/lib/i386/xpprof32.lib b/src/WINNT/kfw/lib/i386/xpprof32.lib index 47166293e..37a41cb7b 100644 Binary files a/src/WINNT/kfw/lib/i386/xpprof32.lib and b/src/WINNT/kfw/lib/i386/xpprof32.lib differ diff --git a/src/afs/AIX/osi_misc.c b/src/afs/AIX/osi_misc.c index b89229c3e..ba4a0d695 100644 --- a/src/afs/AIX/osi_misc.c +++ b/src/afs/AIX/osi_misc.c @@ -20,7 +20,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/AIX/osi_misc.c,v 1.7 2003/07/15 23:14:17 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/AIX/osi_misc.c,v 1.8 2004/07/29 03:13:41 shadow Exp $"); #include "h/systm.h" #include "h/types.h" @@ -167,7 +167,7 @@ aix_gnode_rele(vp) * Note that it must NOT set errno. */ -afs_suser() +afs_suser(void *credp) { register rc; char err; diff --git a/src/afs/DARWIN/osi_inode.c b/src/afs/DARWIN/osi_inode.c index a219f59d7..2e1dc00ce 100644 --- a/src/afs/DARWIN/osi_inode.c +++ b/src/afs/DARWIN/osi_inode.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.6 2003/07/15 23:14:17 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.7 2004/07/29 03:13:44 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -167,7 +167,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval) AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = getinode(0, (dev_t) dev, 2, &ip, &dummy); @@ -241,7 +241,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval) AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); @@ -280,7 +280,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; register int code; - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); diff --git a/src/afs/DARWIN/osi_misc.c b/src/afs/DARWIN/osi_misc.c index f5afaec76..2f7a6d89f 100644 --- a/src/afs/DARWIN/osi_misc.c +++ b/src/afs/DARWIN/osi_misc.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DARWIN/osi_misc.c,v 1.5 2003/07/15 23:14:17 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DARWIN/osi_misc.c,v 1.6 2004/07/29 03:13:44 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -49,7 +49,7 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink, * Note that it must NOT set errno. */ -afs_suser() +afs_suser(void *credp) { int error; struct proc *p = current_proc(); diff --git a/src/afs/DARWIN/osi_prototypes.h b/src/afs/DARWIN/osi_prototypes.h index 012036e4d..4ed7b0411 100644 --- a/src/afs/DARWIN/osi_prototypes.h +++ b/src/afs/DARWIN/osi_prototypes.h @@ -20,6 +20,11 @@ extern afs_rwlock_t afs_xosi; /* osi_misc.c */ extern int osi_lookupname(char *aname, enum uio_seg seg, int followlink, struct vnode **dirvpp, struct vnode **vpp); + +/* osi_sleep.c */ +extern void afs_osi_fullSigMask(void); +extern void afs_osi_fullSigRestore(void); + /* osi_vm.c */ extern void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size); extern int osi_VM_Setup(struct vcache *avc, int force); diff --git a/src/afs/DARWIN/osi_sleep.c b/src/afs/DARWIN/osi_sleep.c index c9788a2f2..03b5835cf 100644 --- a/src/afs/DARWIN/osi_sleep.c +++ b/src/afs/DARWIN/osi_sleep.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.9 2003/07/15 23:14:18 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.10 2004/07/29 03:33:00 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -150,6 +150,34 @@ afs_osi_Sleep(void *event) relevent(evp); } +void +afs_osi_fullSigMask() +{ + struct uthread *user_thread = (struct uthread *)get_bsdthread_info(current_act()); + + /* Protect original sigmask */ + if (!user_thread->uu_oldmask) { + /* Back up current sigmask */ + user_thread->uu_oldmask = user_thread->uu_sigmask; + /* Mask all signals */ + user_thread->uu_sigmask = ~(sigset_t)0; + } +} + +void +afs_osi_fullSigRestore() +{ + struct uthread *user_thread = (struct uthread *)get_bsdthread_info(current_act()); + + /* Protect original sigmask */ + if (user_thread->uu_oldmask) { + /* Restore original sigmask */ + user_thread->uu_sigmask = user_thread->uu_oldmask; + /* Clear the oldmask */ + user_thread->uu_oldmask = (sigset_t)0; + } +} + int afs_osi_SleepSig(void *event) { diff --git a/src/afs/DUX/osi_inode.c b/src/afs/DUX/osi_inode.c index 128a962fd..9e121eb93 100644 --- a/src/afs/DUX/osi_inode.c +++ b/src/afs/DUX/osi_inode.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DUX/osi_inode.c,v 1.12 2003/07/15 23:14:18 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DUX/osi_inode.c,v 1.13 2004/07/29 03:13:44 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -185,7 +185,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval) AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = getinode(0, (dev_t) dev, 2, &ip, &dummy); @@ -262,7 +262,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval) AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); @@ -312,7 +312,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; register int code; - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); diff --git a/src/afs/DUX/osi_misc.c b/src/afs/DUX/osi_misc.c index bd3208bd5..d1f50009c 100644 --- a/src/afs/DUX/osi_misc.c +++ b/src/afs/DUX/osi_misc.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DUX/osi_misc.c,v 1.6 2003/07/15 23:14:19 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DUX/osi_misc.c,v 1.7 2004/07/29 03:13:44 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -27,7 +27,7 @@ RCSID * Note that it must NOT set errno. */ -afs_suser() +afs_suser(void *credp) { int error; diff --git a/src/afs/FBSD/osi_inode.c b/src/afs/FBSD/osi_inode.c index 3179c32f7..10ec8af11 100644 --- a/src/afs/FBSD/osi_inode.c +++ b/src/afs/FBSD/osi_inode.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/FBSD/osi_inode.c,v 1.9 2004/03/10 23:01:51 rees Exp $"); + ("$Header: /cvs/openafs/src/afs/FBSD/osi_inode.c,v 1.10 2004/07/29 03:13:45 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -141,7 +141,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval) AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = getinode(0, (dev_t) dev, 2, &ip, &dummy); @@ -219,7 +219,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval) AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); @@ -258,7 +258,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; register int code; - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); diff --git a/src/afs/FBSD/osi_machdep.h b/src/afs/FBSD/osi_machdep.h index 3e0cb3999..83e7c83f4 100644 --- a/src/afs/FBSD/osi_machdep.h +++ b/src/afs/FBSD/osi_machdep.h @@ -71,7 +71,7 @@ extern struct simplelock afs_rxglobal_lock; #define VROOT VV_ROOT #define v_flag v_vflag #define osi_curcred() (curthread->td_ucred) -#define afs_suser() (!suser(curthread)) +#define afs_suser(x) (!suser(curthread)) #define simple_lock(x) mtx_lock(x) #define simple_unlock(x) mtx_unlock(x) #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \ @@ -85,7 +85,7 @@ extern struct mtx afs_global_mtx; extern struct lock afs_global_lock; #define osi_curcred() (curproc->p_cred->pc_ucred) -#define afs_suser() (!suser(curproc)) +#define afs_suser(x) (!suser(curproc)) #define getpid() curproc #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \ vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc) diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index b66f76061..fdec53501 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -2,7 +2,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.15 2004/03/10 23:01:51 rees Exp $"); + ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.16 2004/07/27 16:24:40 rees Exp $"); #include /* Standard vendor system headers */ #include /* Afs-based standard headers */ @@ -74,7 +74,11 @@ afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC) * the root vnode (this is just a guess right now). * This has to be done outside the global lock. */ +#ifdef AFS_FBSD53_ENV + vflush(mp, 1, (flags & MNT_FORCE) ? FORCECLOSE : 0, p); +#else vflush(mp, 1, (flags & MNT_FORCE) ? FORCECLOSE : 0); +#endif AFS_GLOCK(); AFS_STATCNT(afs_unmount); afs_globalVFS = 0; diff --git a/src/afs/HPUX/osi_inode.c b/src/afs/HPUX/osi_inode.c index ea5fbf205..f519b8c22 100644 --- a/src/afs/HPUX/osi_inode.c +++ b/src/afs/HPUX/osi_inode.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/HPUX/osi_inode.c,v 1.7 2003/07/15 23:14:21 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/HPUX/osi_inode.c,v 1.8 2004/07/29 03:13:47 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -86,7 +86,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4) AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) { + if (!afs_suser(NULL)) { u.u_error = EPERM; goto out; } @@ -131,7 +131,7 @@ afs_syscall_iopen(dev, inode, usrmod) AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) { + if (!afs_suser(NULL)) { u.u_error = EPERM; goto out; } @@ -190,7 +190,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; register afs_int32 code; - if (!afs_suser()) { + if (!afs_suser(NULL)) { u.u_error = EPERM; goto out; } diff --git a/src/afs/HPUX/osi_misc.c b/src/afs/HPUX/osi_misc.c index ca1821a55..870c48691 100644 --- a/src/afs/HPUX/osi_misc.c +++ b/src/afs/HPUX/osi_misc.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/HPUX/osi_misc.c,v 1.6 2003/07/15 23:14:21 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/HPUX/osi_misc.c,v 1.7 2004/07/29 03:13:47 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -29,7 +29,7 @@ RCSID * Here we have to save and restore errno since the HP-UX suser() sets errno. */ -afs_suser() +afs_suser(void *credp) { int save_errno; int code; diff --git a/src/afs/IRIX/osi_file.c b/src/afs/IRIX/osi_file.c index a71f1c555..ba95181cc 100644 --- a/src/afs/IRIX/osi_file.c +++ b/src/afs/IRIX/osi_file.c @@ -11,12 +11,13 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/IRIX/osi_file.c,v 1.10 2003/07/15 23:14:23 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/IRIX/osi_file.c,v 1.11 2004/08/09 03:25:45 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* afs statistics */ +struct AFS_UCRED afs_osi_cred; int afs_osicred_initialized = 0; afs_lock_t afs_xosi; /* lock is for tvattr */ extern struct osi_dev cacheDev; diff --git a/src/afs/IRIX/osi_inode.c b/src/afs/IRIX/osi_inode.c index 45741b2af..bf760993a 100644 --- a/src/afs/IRIX/osi_inode.c +++ b/src/afs/IRIX/osi_inode.c @@ -43,7 +43,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/IRIX/osi_inode.c,v 1.11 2003/07/15 23:14:23 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/IRIX/osi_inode.c,v 1.12 2004/07/29 03:13:47 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -314,7 +314,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp) int error; AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; if (error = getinode(0, (dev_t) dev, 2, &ip)) @@ -567,7 +567,7 @@ afs_syscall_icreatename64(int dev, int datap, int datalen, int paramp, ino_t ino; - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; #ifdef AFS_SGI65_ENV @@ -638,7 +638,7 @@ afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp) struct vnode *vp; AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; vfsp = vfs_devsearch(dev, xfs_fstype); if (!vfsp) @@ -689,7 +689,7 @@ afs_syscall_iopen(int dev, ino_t inode, int usrmod, rval_t * rvp) struct vfs *vfsp; AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; vfsp = vfs_devsearch(dev); if (!vfsp) { @@ -764,7 +764,7 @@ afs_syscall_iopen(dev, inode, usrmod, rvp) int error; AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; if (error = igetinode(0, (dev_t) dev, inode, &ip)) return error; @@ -971,7 +971,7 @@ iincdec64(int dev, int inode_hi, int inode_lo, int inode_p1, int amount) { struct vfs *vfsp; - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; #ifdef AFS_SGI65_ENV vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY); @@ -1044,7 +1044,7 @@ iincdec(dev, inode, inode_p1, amount) { struct vfs *vfsp; - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; vfsp = vfs_devsearch(dev); if (!vfsp) { @@ -1083,7 +1083,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; int error = 0; - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; if (error = igetinode(0, (dev_t) dev, inode, &ip)) return error; @@ -1146,7 +1146,7 @@ afs_syscall_ilistinode64(int dev, int inode_hi, int inode_lo, int datap, i_list_inode_t data; int idatalen; - if (!afs_suser()) + if (!afs_suser(NULL)) return EPERM; #ifdef AFS_SGI65_ENV vfsp = vfs_devsearch(dev, xfs_fstype); diff --git a/src/afs/IRIX/osi_machdep.h b/src/afs/IRIX/osi_machdep.h index fb6b59876..c17eeb158 100644 --- a/src/afs/IRIX/osi_machdep.h +++ b/src/afs/IRIX/osi_machdep.h @@ -205,11 +205,9 @@ extern long afs_global_owner; #ifdef AFS_SGI64_ENV #undef suser -#define suser() cap_able(CAP_DEVICE_MGT) -#define afs_suser() suser() -#else -#define afs_suser suser +#define suser() cap_able(CAP_DEVICE_MGT) #endif +#define afs_suser(x) suser() #define afs_hz HZ diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 2a6440713..0ee694840 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_alloc.c,v 1.21 2004/04/12 16:04:32 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_alloc.c,v 1.22 2004/07/14 04:14:31 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -335,9 +335,7 @@ osi_linux_alloc(unsigned int asize, int drop_glock) free_error: if (new) { - up(&afs_linux_alloc_sem); linux_free(new); - down(&afs_linux_alloc_sem); } new = NULL; goto error; diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 02d4023f3..4b729d695 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.23 2004/06/02 06:15:45 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25 2004/07/14 04:09:12 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -94,10 +94,13 @@ static int afs_getgroups(cred_t *cr, gid_t *groups) { int i; + int n; + gid_t *gp; + AFS_STATCNT(afs_getgroups); - gid_t *gp = cr->cr_groups; - int n = cr->cr_ngroups; + gp = cr->cr_groups; + n = cr->cr_ngroups; for (i = 0; (i < n) && (*gp != (gid_t) NOGROUP); i++) *groups++ = *gp++; diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 5e9f30d8b..be8418d52 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.27 2004/04/21 02:20:23 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29 2004/07/29 03:08:48 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -138,12 +138,14 @@ afs_read_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = MAX_NON_LFS; #endif code = afs_root(sb); - if (code) + if (code) { + afs_globalVFS = NULL; #if defined(AFS_LINUX26_ENV) - module_put(THIS_MODULE); + module_put(THIS_MODULE); #else - MOD_DEC_USE_COUNT; + MOD_DEC_USE_COUNT; #endif + } #if !defined(AFS_LINUX24_ENV) unlock_super(sb); @@ -374,6 +376,8 @@ afs_statfs(struct super_block *sbp, struct statfs *__statp, int size) memset(&stat, 0, size); statp = &stat; +#else + memset(statp, 0, sizeof(*statp)); #endif AFS_STATCNT(afs_statfs); diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index f64c21573..d6db79dfd 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -22,7 +22,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.78 2004/06/24 17:28:03 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81 2004/07/21 22:23:38 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -270,10 +270,10 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) cred_t *credp = crref(); struct afs_fakestat_state fakestat; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); AFS_STATCNT(afs_readdir); code = afs_InitReq(&treq, credp); @@ -407,10 +407,10 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) out: afs_PutFakeStat(&fakestat); out1: + AFS_GUNLOCK(); #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); return code; } @@ -567,15 +567,15 @@ afs_linux_open(struct inode *ip, struct file *fp) int code; cred_t *credp = crref(); - AFS_GLOCK(); #ifdef AFS_LINUX24_ENV lock_kernel(); #endif + AFS_GLOCK(); code = afs_open((struct vcache **)&ip, fp->f_flags, credp); + AFS_GUNLOCK(); #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; @@ -595,19 +595,19 @@ afs_linux_release(struct inode *ip, struct file *fp) cred_t *credp = crref(); struct vcache *vcp = ITOAFS(ip); - AFS_GLOCK(); #ifdef AFS_LINUX24_ENV lock_kernel(); #endif + AFS_GLOCK(); if (vcp->flushcnt) { vcp->flushcnt--; /* protected by AFS global lock. */ } else { code = afs_close(vcp, fp->f_flags, credp); } + AFS_GUNLOCK(); #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; @@ -625,15 +625,15 @@ afs_linux_fsync(struct file *fp, struct dentry *dp) struct inode *ip = FILE_INODE(fp); cred_t *credp = crref(); - AFS_GLOCK(); #ifdef AFS_LINUX24_ENV lock_kernel(); #endif + AFS_GLOCK(); code = afs_fsync(ITOAFS(ip), credp); + AFS_GUNLOCK(); #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; @@ -777,6 +777,9 @@ afs_linux_revalidate(struct dentry *dp) struct vcache *vcp = ITOAFS(dp->d_inode); struct vcache *rootvp = NULL; +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif AFS_GLOCK(); if (afs_fakestat_enable && vcp->mvstat == 1 && vcp->mvid @@ -785,9 +788,6 @@ afs_linux_revalidate(struct dentry *dp) rootvp = afs_FindVCache(vcp->mvid, 0, 0); ReleaseSharedLock(&afs_xvcache); } -#ifdef AFS_LINUX24_ENV - lock_kernel(); -#endif /* Make this a fast path (no crref), since it's called so often. */ if (vcp->states & CStatd) { @@ -797,12 +797,12 @@ afs_linux_revalidate(struct dentry *dp) vcache2fakeinode(rootvp, vcp); else vcache2inode(vcp); -#ifdef AFS_LINUX24_ENV - unlock_kernel(); -#endif if (rootvp) afs_PutVCache(rootvp); AFS_GUNLOCK(); +#ifdef AFS_LINUX24_ENV + unlock_kernel(); +#endif return 0; } @@ -811,10 +811,10 @@ afs_linux_revalidate(struct dentry *dp) if (!code) code = afs_VerifyVCache(vcp, &treq); + AFS_GUNLOCK(); #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; @@ -856,8 +856,10 @@ afs_linux_dentry_revalidate(struct dentry *dp) sysState.allocked = 0; - AFS_GLOCK(); +#ifdef AFS_LINUX24_ENV lock_kernel(); +#endif + AFS_GLOCK(); vcp = ITOAFS(dp->d_inode); parentvcp = ITOAFS(dp->d_parent->d_inode); @@ -911,13 +913,16 @@ afs_linux_dentry_revalidate(struct dentry *dp) if (sysState.allocked) osi_FreeLargeSpace(name); + AFS_GUNLOCK(); + if (bad_dentry) { shrink_dcache_parent(dp); d_drop(dp); } +#ifdef AFS_LINUX24_ENV unlock_kernel(); - AFS_GUNLOCK(); +#endif crfree(credp); return !bad_dentry; @@ -928,12 +933,15 @@ afs_linux_dentry_revalidate(struct dentry *dp) static void afs_dentry_iput(struct dentry *dp, struct inode *ip) { + int isglock; + if (ICL_SETACTIVE(afs_iclSetp)) { - AFS_GLOCK(); + isglock = ISAFS_GLOCK(); + if (!isglock) AFS_GLOCK(); afs_Trace3(afs_iclSetp, CM_TRACE_DENTRYIPUT, ICL_TYPE_POINTER, ip, ICL_TYPE_STRING, dp->d_parent->d_name.name, ICL_TYPE_STRING, dp->d_name.name); - AFS_GUNLOCK(); + if (!isglock) AFS_GUNLOCK(); } osi_iput(ip); @@ -943,12 +951,14 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip) static int afs_dentry_delete(struct dentry *dp) { + int isglock; if (ICL_SETACTIVE(afs_iclSetp)) { - AFS_GLOCK(); + isglock = ISAFS_GLOCK(); + if (!isglock) AFS_GLOCK(); afs_Trace3(afs_iclSetp, CM_TRACE_DENTRYDELETE, ICL_TYPE_POINTER, dp->d_inode, ICL_TYPE_STRING, dp->d_parent->d_name.name, ICL_TYPE_STRING, dp->d_name.name); - AFS_GUNLOCK(); + if (!isglock) AFS_GUNLOCK(); } if (dp->d_inode && (ITOAFS(dp->d_inode)->states & CUnlinked)) @@ -990,10 +1000,10 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) VATTR_NULL(&vattr); vattr.va_mode = mode; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); code = afs_create(ITOAFS(dip), name, &vattr, NONEXCL, mode, (struct vcache **)&ip, credp); @@ -1027,10 +1037,10 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) d_instantiate(dp, ip); } + AFS_GUNLOCK(); #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; } @@ -1049,11 +1059,12 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) struct vcache *vcp = NULL; const char *comp = dp->d_name.name; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); code = afs_lookup(ITOAFS(dip), comp, &vcp, credp); + AFS_GUNLOCK(); if (vcp) { struct inode *ip = AFSTOI(vcp); @@ -1088,7 +1099,6 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); /* It's ok for the file to not be found. That's noted by the caller by @@ -1134,17 +1144,17 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp) cred_t *credp = crref(); const char *name = dp->d_name.name; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); code = afs_remove(ITOAFS(dip), name, credp); + AFS_GUNLOCK(); if (!code) d_drop(dp); #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; } @@ -1180,14 +1190,15 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) struct vattr vattr; const char *name = dp->d_name.name; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); VATTR_NULL(&vattr); vattr.va_mask = ATTR_MODE; vattr.va_mode = mode; code = afs_mkdir(ITOAFS(dip), name, &vattr, &tvcp, credp); + AFS_GUNLOCK(); if (tvcp) { tvcp->v.v_op = &afs_dir_iops; @@ -1202,7 +1213,6 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; } @@ -1214,11 +1224,12 @@ afs_linux_rmdir(struct inode *dip, struct dentry *dp) cred_t *credp = crref(); const char *name = dp->d_name.name; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif + AFS_GLOCK(); code = afs_rmdir(ITOAFS(dip), name, credp); + AFS_GUNLOCK(); /* Linux likes to see ENOTEMPTY returned from an rmdir() syscall * that failed because a directory is not empty. So, we map @@ -1235,7 +1246,6 @@ afs_linux_rmdir(struct inode *dip, struct dentry *dp) #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; } @@ -1251,7 +1261,6 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, const char *oldname = olddp->d_name.name; const char *newname = newdp->d_name.name; - AFS_GLOCK(); #if defined(AFS_LINUX26_ENV) lock_kernel(); #endif @@ -1271,7 +1280,9 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, if (!list_empty(&newdp->d_hash)) d_drop(newdp); #endif + AFS_GLOCK(); code = afs_rename(ITOAFS(oldip), oldname, ITOAFS(newip), newname, credp); + AFS_GUNLOCK(); if (!code) { /* update time so it doesn't expire immediately */ @@ -1282,7 +1293,6 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, #if defined(AFS_LINUX26_ENV) unlock_kernel(); #endif - AFS_GUNLOCK(); crfree(credp); return -code; @@ -1387,13 +1397,10 @@ afs_linux_readpage(struct file *fp, struct page *pp) int cnt = page_count(pp); struct vcache *avc = ITOAFS(ip); - AFS_GLOCK(); - afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip, ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, cnt, ICL_TYPE_INT32, 99999); /* not a possible code value */ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) address = kmap(pp); ClearPageError(pp); - - lock_kernel(); #else atomic_add(1, &pp->count); set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */ @@ -1402,8 +1409,17 @@ afs_linux_readpage(struct file *fp, struct page *pp) setup_uio(&tuio, &iovec, (char *)address, offset, PAGESIZE, UIO_READ, AFS_UIOSYS); +#ifdef AFS_LINUX24_ENV + lock_kernel(); +#endif + AFS_GLOCK(); + afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip, ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, cnt, ICL_TYPE_INT32, 99999); /* not a possible code value */ code = afs_rdwr(avc, &tuio, UIO_READ, 0, credp); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip, + ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, cnt, ICL_TYPE_INT32, + code); + AFS_GUNLOCK(); +#ifdef AFS_LINUX24_ENV unlock_kernel(); #endif @@ -1418,6 +1434,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) set_bit(PG_uptodate, &pp->flags); #endif } + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) kunmap(pp); UnlockPage(pp); @@ -1431,6 +1448,7 @@ afs_linux_readpage(struct file *fp, struct page *pp) struct dcache *tdc; struct vrequest treq; + AFS_GLOCK(); code = afs_InitReq(&treq, credp); if (!code && !NBObtainWriteLock(&avc->lock, 534)) { tdc = afs_FindDCache(avc, offset); @@ -1441,13 +1459,10 @@ afs_linux_readpage(struct file *fp, struct page *pp) } ReleaseWriteLock(&avc->lock); } + AFS_GUNLOCK(); } crfree(credp); - afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE, ICL_TYPE_POINTER, ip, - ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, cnt, ICL_TYPE_INT32, - code); - AFS_GUNLOCK(); return -code; } @@ -1620,11 +1635,11 @@ afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, { int code; - AFS_GLOCK(); lock_kernel(); + AFS_GLOCK(); code = afs_linux_updatepage(file, page, offset, to - offset); - unlock_kernel(); AFS_GUNLOCK(); + unlock_kernel(); kunmap(page); return code; @@ -1705,15 +1720,15 @@ afs_symlink_filler(struct file *file, struct page *page) char *p = (char *)kmap(page); int code; - AFS_GLOCK(); lock_kernel(); + AFS_GLOCK(); code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS); + AFS_GUNLOCK(); if (code < 0) goto fail; p[code] = '\0'; /* null terminate? */ unlock_kernel(); - AFS_GUNLOCK(); SetPageUptodate(page); kunmap(page); @@ -1722,7 +1737,6 @@ afs_symlink_filler(struct file *file, struct page *page) fail: unlock_kernel(); - AFS_GUNLOCK(); SetPageError(page); kunmap(page); diff --git a/src/afs/NBSD/osi_inode.c b/src/afs/NBSD/osi_inode.c index e22d07eb5..f8a628a7b 100644 --- a/src/afs/NBSD/osi_inode.c +++ b/src/afs/NBSD/osi_inode.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/NBSD/osi_inode.c,v 1.4 2003/07/15 23:14:25 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/NBSD/osi_inode.c,v 1.5 2004/07/29 03:13:48 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -148,7 +148,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval) AFS_STATCNT(afs_syscall_icreate); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = getinode(0, (dev_t) dev, 2, &ip, &dummy); @@ -225,7 +225,7 @@ afs_syscall_iopen(dev, inode, usrmod, retval) AFS_STATCNT(afs_syscall_iopen); - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); @@ -263,7 +263,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount) struct inode *ip; register int code; - if (!afs_suser()) + if (!afs_suser(NULL)) return (EPERM); code = igetinode(0, (dev_t) dev, (ino_t) inode, &ip, &dummy); diff --git a/src/afs/NBSD/osi_misc.c b/src/afs/NBSD/osi_misc.c index bb467eabc..4d7841ce7 100644 --- a/src/afs/NBSD/osi_misc.c +++ b/src/afs/NBSD/osi_misc.c @@ -18,7 +18,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/NBSD/osi_misc.c,v 1.3 2003/07/15 23:14:25 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/NBSD/osi_misc.c,v 1.4 2004/07/29 03:13:49 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -29,7 +29,7 @@ RCSID * Note that it must NOT set errno. */ -afs_suser() +afs_suser(void *credp) { int error; diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index b01e6653c..bd8e5ccc4 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -16,7 +16,7 @@ * afs_osi.h. */ -/* $Id: osi_machdep.h,v 1.15 2004/03/25 17:04:44 rees Exp $ */ +/* $Id: osi_machdep.h,v 1.16 2004/07/29 03:13:49 shadow Exp $ */ #ifndef _OSI_MACHDEP_H_ #define _OSI_MACHDEP_H_ @@ -67,7 +67,7 @@ extern struct simplelock afs_rxglobal_lock; /* proc, cred */ #define AFS_PROC struct proc #define AFS_UCRED ucred -#define afs_suser() afs_osi_suser(osi_curcred()) +#define afs_suser(x) afs_osi_suser(osi_curcred()) #define getpid() curproc #define osi_curcred() (curproc->p_cred->pc_ucred) #define osi_curproc() curproc diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 9413bfb0b..440a3da79 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -3,7 +3,7 @@ * Original NetBSD version for Transarc afs by John Kohl * OpenBSD version by Jim Rees * - * $Id: osi_vnodeops.c,v 1.17 2004/03/19 16:38:29 rees Exp $ + * $Id: osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $ */ /* @@ -99,7 +99,7 @@ NONINFRINGEMENT. #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.17 2004/03/19 16:38:29 rees Exp $"); + ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afs/afsincludes.h" /* Afs-based standard headers */ @@ -107,6 +107,9 @@ RCSID #include #include +#ifdef AFS_OBSD36_ENV +#include +#endif #include "afs/afs_cbqueue.h" #include "afs/nfsclient.h" @@ -210,6 +213,12 @@ struct vnodeopv_desc afs_vnodeop_opv_desc = #define DROPNAME() FREE(name, M_TEMP) +#ifdef AFS_OBSD36_ENV +#define DROPCNP(cnp) pool_put(&namei_pool, (cnp)->cn_pnbuf) +#else +#define DROPCNP(cnp) FREE((cnp)->cn_pnbuf, M_NAMEI) +#endif + int afs_debug; int @@ -331,7 +340,7 @@ afs_nbsd_create(void *v) *ap->a_vpp = 0; if ((cnp->cn_flags & SAVESTART) == 0) - FREE(cnp->cn_pnbuf, M_NAMEI); + DROPCNP(cnp); vput(dvp); DROPNAME(); if (afs_debug & AFSDEB_VNLAYER) @@ -348,7 +357,7 @@ afs_nbsd_mknod(void *v) * struct componentname *a_cnp; * struct vattr *a_vap; * } */ *ap = v; - free(ap->a_cnp->cn_pnbuf, M_NAMEI); + DROPCNP(ap->a_cnp); vput(ap->a_dvp); return (ENODEV); } @@ -561,7 +570,7 @@ afs_nbsd_remove(void *v) else vput(vp); vput(dvp); - FREE(cnp->cn_pnbuf, M_NAMEI); + DROPCNP(cnp); DROPNAME(); return code; } @@ -597,7 +606,7 @@ afs_nbsd_link(void *v) AFS_GLOCK(); code = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred); AFS_GUNLOCK(); - FREE(cnp->cn_pnbuf, M_NAMEI); + DROPCNP(cnp); if (dvp != vp) VOP_UNLOCK(vp, 0, curproc); @@ -741,8 +750,8 @@ afs_nbsd_mkdir(void *v) vn_lock(AFSTOV(vcp), LK_EXCLUSIVE | LK_RETRY, curproc); } else *ap->a_vpp = 0; + DROPCNP(cnp); DROPNAME(); - FREE(cnp->cn_pnbuf, M_NAMEI); vput(dvp); return code; } @@ -763,7 +772,7 @@ afs_nbsd_rmdir(void *v) if (dvp == vp) { vrele(dvp); vput(vp); - FREE(cnp->cn_pnbuf, M_NAMEI); + DROPCNP(cnp); DROPNAME(); return (EINVAL); } @@ -796,8 +805,8 @@ afs_nbsd_symlink(void *v) code = afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target, cnp->cn_cred); AFS_GUNLOCK(); + DROPCNP(cnp); DROPNAME(); - FREE(cnp->cn_pnbuf, M_NAMEI); vput(dvp); return code; } diff --git a/src/afs/SOLARIS/osi_machdep.h b/src/afs/SOLARIS/osi_machdep.h index a7d051b1a..304d40022 100644 --- a/src/afs/SOLARIS/osi_machdep.h +++ b/src/afs/SOLARIS/osi_machdep.h @@ -60,7 +60,7 @@ extern void *afs_osi_Alloc_NoSleep(size_t size); #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \ vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid)) -#define afs_suser suser +#define afs_suser(x) suser(x) #ifdef KERNEL diff --git a/src/afs/UKERNEL/osi_machdep.h b/src/afs/UKERNEL/osi_machdep.h index be85d6f61..97cc6c584 100644 --- a/src/afs/UKERNEL/osi_machdep.h +++ b/src/afs/UKERNEL/osi_machdep.h @@ -37,7 +37,7 @@ #define osi_Time() (time(NULL)) #define osi_vnhold(avc, r) do { VN_HOLD(AFSTOV(avc)); } while(0) -#define afs_suser suser +#define afs_suser(x) suser(x) /* * Global lock support. diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 3320b0442..52ec79012 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -23,7 +23,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.23 2003/11/27 01:17:40 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.24 2004/08/09 00:54:05 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -172,12 +172,11 @@ struct min_direct { /* miniature direct structure */ #else #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV) afs_int32 d_off; - afs_uint32 d_fileno; #endif #if defined(AFS_HPUX100_ENV) unsigned long long d_off; - afs_uint32 d_fileno; #endif + afs_uint32 d_fileno; u_short d_reclen; u_short d_namlen; #endif diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index b387709d4..26295a815 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.69 2004/06/24 17:38:22 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74 2004/07/29 03:32:56 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -46,6 +46,7 @@ char afs_zeros[AFS_ZEROS]; char afs_rootVolumeName[64] = ""; struct afs_icl_set *afs_iclSetp = (struct afs_icl_set *)0; struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set *)0; +afs_uint32 rx_bindhost; #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) kmutex_t afs_global_lock; @@ -128,7 +129,7 @@ afs_InitSetup(int preallocs) /* start RX */ rx_extraPackets = AFS_NRXPACKETS; /* smaller # of packets */ - code = rx_Init(htons(7001)); + code = rx_InitHost(rx_bindhost, htons(7001)); if (code) { printf("AFS: RX failed to initialize %d).\n", code); return code; @@ -354,7 +355,7 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) /* only root can run this code */ return (EACCES); #else - if (!afs_suser() && (parm != AFSOP_GETMTU) + if (!afs_suser(NULL) && (parm != AFSOP_GETMTU) && (parm != AFSOP_GETMASK)) { /* only root can run this code */ #if defined(KERNEL_HAVE_UERROR) @@ -700,6 +701,7 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) cacheNumEntries : 1)); } else if (parm == AFSOP_ADVISEADDR) { /* pass in the host address to the rx package */ + int rxbind = 0; afs_int32 count = parm2; afs_int32 *buffer = afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); @@ -709,6 +711,13 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); int i; + /* Bind, but only if there's only one address configured */ + if ( count & 0x80000000) { + count &= ~0x80000000; + if (count == 1) + rxbind=1; + } + if (count > AFS_MAX_INTERFACE_ADDR) { code = ENOMEM; count = AFS_MAX_INTERFACE_ADDR; @@ -743,6 +752,11 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) } afs_uuid_create(&afs_cb_interface.uuid); rxi_setaddr(buffer[0]); + if (rxbind) + rx_bindhost = buffer[0]; + else + rx_bindhost = htonl(INADDR_ANY); + afs_osi_Free(buffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); afs_osi_Free(maskbuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); afs_osi_Free(mtubuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); @@ -775,7 +789,7 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) #endif /* AFS_SGI53_ENV */ else if (parm == AFSOP_SHUTDOWN) { afs_cold_shutdown = 0; - if (parm == 1) + if (parm2 == 1) afs_cold_shutdown = 1; #ifndef AFS_DARWIN_ENV if (afs_globalVFS != 0) { @@ -861,7 +875,7 @@ afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6) char *cellname = afs_osi_Alloc(cellLen); #ifndef UKERNEL - afs_osi_MaskSignals(); + afs_osi_MaskUserLoop(); #endif AFS_COPYIN((afs_int32 *) parm2, cellname, cellLen, code); AFS_COPYIN((afs_int32 *) parm3, kmsg, kmsgLen, code); @@ -1496,6 +1510,11 @@ afs_shutdown(void) extern struct osi_file *afs_cacheInodep; AFS_STATCNT(afs_shutdown); + if (afs_initState == 0) { + afs_warn("AFS not initialized - not shutting down\n"); + return; + } + if (afs_shuttingdown) return; afs_shuttingdown = 1; @@ -1680,7 +1699,7 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval) return (EACCES); } #else - if (!afs_suser()) { /* only root can run this code */ + if (!afs_suser(NULL)) { /* only root can run this code */ #if defined(KERNEL_HAVE_UERROR) setuerror(EACCES); return EACCES; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index 6066c82f3..b45a5312e 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.45 2004/06/21 20:01:50 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48 2004/08/09 00:17:33 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -310,6 +310,26 @@ afs_osi_UnmaskRxkSignals(void) { } +/* Two hacks to try and fix afsdb */ +void +afs_osi_MaskUserLoop() +{ +#ifdef AFS_DARWIN_ENV + afs_osi_Invisible(); + afs_osi_fullSigMask(); +#else + afs_osi_MaskSignals(); +#endif +} + +void +afs_osi_UnmaskUserLoop() +{ +#ifdef AFS_DARWIN_ENV + afs_osi_fullSigRestore(); +#endif +} + /* register rxk listener proc info */ void afs_osi_RxkRegister(void) @@ -617,7 +637,7 @@ afs_osi_suser(void *credp) #if defined(AFS_SUN5_ENV) return afs_suser(credp); #else - return afs_suser(); + return afs_suser(NULL); #endif } #endif @@ -786,6 +806,12 @@ afs_osi_TraverseProcTable(void) #endif #if defined(AFS_OSF_ENV) + +#ifdef AFS_DUX50_ENV +extern struct pid_entry *pidtab; +extern int npid; +#endif + void afs_osi_TraverseProcTable(void) { diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index 036d33e89..9ed4b9181 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -23,7 +23,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.20 2004/04/21 02:20:21 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.21 2004/07/29 03:13:37 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -161,7 +161,7 @@ afs_setpag(void) #elif defined(AFS_OBSD_ENV) if (!afs_osi_suser(p->p_ucred)) #else - if (!afs_suser()) + if (!afs_suser(NULL)) #endif { while (osi_Time() - pag_epoch < pagCounter) { @@ -251,7 +251,7 @@ afs_setpag_val(int pagval) #ifdef AFS_SUN5_ENV if (!afs_suser(*credpp)) #else - if (!afs_suser()) + if (!afs_suser(NULL)) #endif { while (osi_Time() - pag_epoch < pagCounter) { diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 84e787b2c..c08265e4c 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -464,6 +464,7 @@ extern void afs_osi_Invisible(void); extern void afs_osi_RxkRegister(void); extern void afs_osi_MaskSignals(void); extern void afs_osi_UnmaskRxkSignals(void); +extern void afs_osi_MaskUserLoop(void); extern void *afs_osi_Alloc_debug(size_t x, char *func, int line); #ifndef afs_osi_Alloc_NoSleep extern void *afs_osi_Alloc_NoSleep(size_t x); @@ -1084,7 +1085,7 @@ extern afs_int32 RXSTATS_ExecuteRequest(struct rx_call *acall); -#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV) +#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV) || defined(AFS_OSF_ENV) #include "osi_prototypes.h" #endif diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 9d067e91e..fd0693d3f 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -39,7 +39,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.64 2004/06/23 18:34:45 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65 2004/07/14 04:21:54 shadow Exp $"); #include "afs/sysincludes.h" /*Standard vendor system headers */ #include "afsincludes.h" /*AFS-based standard headers */ @@ -656,10 +656,14 @@ afs_TryFlushDcacheChildren(struct vcache *tvc) while ((cur = cur->next) != head) { dentry = list_entry(cur, struct dentry, d_alias); - afs_Trace3(afs_iclSetp, CM_TRACE_TRYFLUSHDCACHECHILDREN, + if (ICL_SETACTIVE(afs_iclSetp)) { + AFS_GLOCK(); + afs_Trace3(afs_iclSetp, CM_TRACE_TRYFLUSHDCACHECHILDREN, ICL_TYPE_POINTER, ip, ICL_TYPE_STRING, dentry->d_parent->d_name.name, ICL_TYPE_STRING, dentry->d_name.name); + AFS_GUNLOCK(); + } if (!list_empty(&dentry->d_hash) && !list_empty(&dentry->d_subdirs)) __shrink_dcache_parent(dentry); diff --git a/src/afsd/afs.rc.darwin b/src/afsd/afs.rc.darwin index 269734e11..dc7e6775a 100644 --- a/src/afsd/afs.rc.darwin +++ b/src/afsd/afs.rc.darwin @@ -7,20 +7,24 @@ # directory or online at http://www.openafs.org/dl/license10.html # # Portions Copyright (c) 2003 Apple Computer, Inc. +# +# Updated to match standard service scripts +# Phil Holland 6/11/04 . /etc/rc.common -CheckForNetwork - -if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi +# +# Variable Definition Section +# +CheckForNetwork +VICEETC=/usr/vice/etc +AFSD=$VICEETC/afsd if [ -r /var/db/openafs ]; then - VICEETC=/var/db/openafs/etc - AFSD=/usr/sbin/afsd -else - VICEETC=/usr/vice/etc - AFSD=$VICEETC/afsd + VICEETC=/var/db/openafs/etc + AFSD=/usr/sbin/afsd fi + CONFIG=$VICEETC/config AFSDOPT=$CONFIG/afsd.options PACKAGE=$CONFIG/package.options @@ -29,114 +33,138 @@ LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128" MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70" SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50" -if [ -f $AFSDOPT ]; then - OPTIONS=`cat $AFSDOPT` -else - OPTIONS="$MEDIUM -fakestat" -fi +if [ -x /usr/sbin/kextstat ]; then KMODSTAT=/usr/sbin/kextstat; fi +if [ -x /usr/sbin/kmodstat ]; then KMODSTAT=/usr/sbin/kmodstat; fi -if [ -x /usr/sbin/kmodstat ]; then - KMODSTAT=/usr/sbin/kmodstat -else - if [ -x /usr/sbin/kextstat ]; then - KMODSTAT=/usr/sbin/kextstat -fi -fi + +StartService() +{ + echo "Starting OpenAFS" + + if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi + + if [ -f $AFSDOPT ]; then + OPTIONS=`cat $AFSDOPT` + else + OPTIONS="$MEDIUM -fakestat" + fi # Need the commands ps, awk, kill, sleep -PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin -if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then -: -else -if [ -d $VICEETC/afs.kext ]; then + PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin + + if [ -d $VICEETC/afs.kext ]; then echo "Loading AFS kernel extensions" kextload $VICEETC/afs.kext -else + else echo "$VICEETC/afs.kext does not exist. Skipping AFS startup." exit 1 -fi -fi -if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then -: -else - echo "AFS kernel extensions failed to initialize. Skipping AFS startup." + fi + + if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then + : + else + echo "AFS kernel extensions failed to initialize. Skipping AFS startup." exit 1 -fi + fi # # Start the AFS server processes if a bosserver exists # -if [ -x /usr/afs/bin/bosserver ]; then + if [ -x /usr/afs/bin/bosserver ]; then echo "Starting AFS Server processes" /usr/afs/bin/bosserver OPTIONS="$OPTIONS -nosettime" sleep 30 -fi + fi # # Check that all of the client configuration files exist # -for file in $AFSD $VICEETC/cacheinfo \ - $VICEETC/ThisCell $VICEETC/CellServDB -do - if [ ! -f ${file} ]; then - echo "${file} does not exist. Not starting AFS client." - exit 1 - fi -done + for file in $AFSD $VICEETC/cacheinfo \ + $VICEETC/ThisCell $VICEETC/CellServDB + do + if [ ! -f ${file} ]; then + echo "${file} does not exist. Not starting AFS client." + exit 1 + fi + done # # Check that the root directory for AFS (/afs) # and the cache directory (/usr/vice/cache) both exist # -for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo` -do - if [ ! -d ${dir} ]; then - echo "${dir} does not exist. Not starting AFS client." - exit 2 - fi -done + for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo` + do + if [ ! -d ${dir} ]; then + echo "${dir} does not exist. Not starting AFS client." + exit 2 + fi + done -echo "Starting afsd" -$AFSD $OPTIONS + echo "Starting afsd" + $AFSD $OPTIONS # # Call afssettings (if it exists) to set customizable parameters # -if [ -x $VICEETC/config/afssettings ]; then - sleep 2 - $VICEETC/config/afssettings -fi + if [ -x $CONFIG/afssettings ]; then + sleep 2 + $CONFIG/afssettings + fi # # Run package to update the disk # -if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then + if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1 -case $? in -0) - (echo "Package completed successfully") > /dev/console 2>&1 - date > /dev/console 2>&1 - ;; -4) - (echo "Rebooting to restart system") > /dev/console 2>&1 - sync - /sbin/reboot - ;; -*) - (echo "Package update failed; continuing") > /dev/console 2>&1 - ;; -esac - -fi + case $? in + 0) + (echo "Package completed successfully") > /dev/console 2>&1 + date > /dev/console 2>&1 + ;; + 4) + (echo "Rebooting to restart system") > /dev/console 2>&1 + sync + /sbin/reboot + ;; + *) + (echo "Package update failed; continuing") > /dev/console 2>&1 + ;; + esac + fi # # Start AFS inetd services # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs) # -if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then - /usr/sbin/inetd.afs /etc/inetd.conf.afs -fi + if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then + /usr/sbin/inetd.afs /etc/inetd.conf.afs + fi +} + +StopService() +{ + echo "Stopping AFS" + + if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then + echo "Unmounting /afs" + umount -f /afs 2>&1 > /dev/console + + echo "Shutting down afsd processes" + $AFSD -shutdown 2>&1 > /dev/console + + echo "Unloading AFS kernel extensions" + kextunload $VICEETC/afs.kext 2>&1 > /dev/console + fi +} + +RestartService() +{ + StopService + StartService +} + +RunService "$1" diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 8529cc3f2..7b99f84c1 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -56,7 +56,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.41 2004/05/08 04:12:27 shadow Exp $"); + ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43 2004/07/28 22:47:58 shadow Exp $"); #define VFS 1 @@ -221,6 +221,7 @@ struct in_addr_42 { /* * Global configuration variables. */ +afs_int32 enable_rxbind = 0; afs_int32 afs_shutdown = 0; afs_int32 cacheBlocks; /*Num blocks in the cache */ afs_int32 cacheFiles = 1000; /*Optimal # of files in workstation cache */ @@ -1049,6 +1050,8 @@ CheckCacheBaseDir(char *dir) } if (statfsbuf.f_type == 0x52654973) { /* REISERFS_SUPER_MAGIC */ return "cannot use reiserfs as cache partition"; + } else if (statfsbuf.f_type == 0x58465342) { /* XFS_SUPER_MAGIC */ + return "cannot use xfs as cache partition"; } } #endif @@ -1494,7 +1497,12 @@ mainproc(as, arock) /* -backuptree */ enable_backuptree = 1; } + if (as->parms[31].items) { + /* -rxbind */ + enable_rxbind = 1; + } + /* * Pull out all the configuration info for the workstation's AFS cache and * the cellular community we're willing to let our users see. @@ -1638,7 +1646,7 @@ mainproc(as, arock) sprintf(fullpn_VFile, "%s/", cacheBaseDir); vFilePtr = fullpn_VFile + strlen(fullpn_VFile); - if ((fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) { + if (!(cacheFlags & AFSCALL_INIT_MEMCACHE) && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) { printf("%s: WARNING: Cache dir check failed (%s)\n", rn, fsTypeMsg); } #if 0 @@ -1665,9 +1673,11 @@ mainproc(as, arock) parseNetFiles(addrbuf, maskbuf, mtubuf, MAXIPADDRS, reason, AFSDIR_CLIENT_NETINFO_FILEPATH, AFSDIR_CLIENT_NETRESTRICT_FILEPATH); - if (code > 0) + if (code > 0) { + if (enable_rxbind) + code = code | 0x80000000; call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf); - else + } else printf("ADVISEADDR: Error in specifying interface addresses:%s\n", reason); } @@ -2166,6 +2176,7 @@ main(argc, argv) cmd_AddParm(ts, "-nomount", CMD_FLAG, CMD_OPTIONAL, "Do not mount AFS"); cmd_AddParm(ts, "-backuptree", CMD_FLAG, CMD_OPTIONAL, "Prefer backup volumes for mointpoints in backup volumes"); + cmd_AddParm(ts, "-rxbind", CMD_FLAG, CMD_OPTIONAL, "Bind the Rx socket (one interface only)"); return (cmd_Dispatch(argc, argv)); } @@ -2269,7 +2280,8 @@ call_syscall(param1, param2, param3, param4, param5, param6, param7) long eparm[4]; struct afsprocdata syscall_data; int fd = open(PROC_SYSCALL_FNAME,O_RDWR); - + if (fd < 0) + fd = open(PROC_SYSCALL_ARLA_FNAME,O_RDWR); eparm[0] = param4; eparm[1] = param5; eparm[2] = param6; diff --git a/src/afsinstall/lib/InstallGuides/GENERIC/clientconfig b/src/afsinstall/lib/InstallGuides/GENERIC/clientconfig index 0b1f200fa..984168f5a 100644 --- a/src/afsinstall/lib/InstallGuides/GENERIC/clientconfig +++ b/src/afsinstall/lib/InstallGuides/GENERIC/clientconfig @@ -67,7 +67,7 @@ sub clientconfig { close CELL; } if (($replaced && $different) || !$replaced) { - &VPrint("Creating new $cellfile"); + &VPvint("Creating new $cellfile"); unlink($replaced) if ($replaced); rename($cellfile, $replaced) if ($replaced); open(CELLNEW, ">$cellfile") || &ErrorMsg("Can't open cell file", diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index 92d41027c..8976cb2af 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -19,7 +19,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.15 2003/10/24 06:26:06 shadow Exp $"); + ("$Header: /cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.18 2004/08/06 21:48:28 shadow Exp $"); #include #include @@ -277,7 +277,7 @@ extern char *cm_categories[]; /* cache manager data category names */ -#if !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN70_ENV) +#if !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN70_ENV) && !defined(AFS_NBSD20_ENV) /* strcasestr(): Return first occurence of pattern s2 in s1, case insensitive. @@ -898,7 +898,7 @@ parse_threshEntry(a_line) fprintf(stderr, "[ %s ] Programming error 2\n", rn); return (-1); } - } else if ((strcasecmp(arg1, "cm")) != 0 && (strcasecmp(arg1, "cm")) != 0) { + } else { fprintf(stderr, "[ %s ] Syntax error. Second argument should be \"fs\" or \"cm\" \n", rn); @@ -2624,7 +2624,7 @@ cm_Results_ltoa(a_cmData, a_cmResults) fullP = (struct afs_stats_CMFullPerf *) - (xstat_cm_Results.data.AFSCB_CollData_val); + (a_cmResults->data.AFSCB_CollData_val); /* There are 4 parts to CM statistics * - Overall performance statistics (including up/down statistics) @@ -3615,7 +3615,7 @@ quit_signal(sig) /*----------------------------------------------------------------------- - * afsmon_execut() + * afsmon_execute() * * Description: * This is where we start it all. Initialize an array of sockets for diff --git a/src/afsmonitor/afsmonitor.h b/src/afsmonitor/afsmonitor.h index 3561432d8..00d544d53 100644 --- a/src/afsmonitor/afsmonitor.h +++ b/src/afsmonitor/afsmonitor.h @@ -78,8 +78,8 @@ other. Hence we should update only the one that completed. */ /* Data is categorized into sections and groups to enable to user to choose what he wants displayed. */ -#define FS_NUM_DATA_CATEGORIES 8 /* # of fs categories */ -#define CM_NUM_DATA_CATEGORIES 14 /* # of cm categories */ +#define FS_NUM_DATA_CATEGORIES 9 /* # of fs categories */ +#define CM_NUM_DATA_CATEGORIES 16 /* # of cm categories */ /* Set this enable detailed debugging with the -debug switch */ #define DETAILED_DEBUG 0 diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index 4fd0792b3..cf44199ed 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.37 2004/05/29 23:48:05 jaltman Exp $"); + ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.40 2004/07/22 09:42:40 jaltman Exp $"); #include #include @@ -204,15 +204,27 @@ IsClientConfigDirectory(const char *path) static int afsconf_Check(register struct afsconf_dir *adir) { - char tbuffer[256]; + char tbuffer[256], *p; struct stat tstat; register afs_int32 code; #ifdef AFS_NT40_ENV /* NT client CellServDB has different file name than NT server or Unix */ if (IsClientConfigDirectory(adir->name)) { - strcompose(tbuffer, 256, adir->name, "/", - AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + if ( !afssw_GetClientCellServDBDir(&p) ) { + strcompose(tbuffer, sizeof(tbuffer), p, "/", + AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + free(p); + } else { + int len; + strncpy(tbuffer, adir->name, sizeof(tbuffer)); + len = strlen(tbuffer); + if ( tbuffer[len-1] != '\\' && tbuffer[len-1] != '/' ) { + strncat(tbuffer, "\\", sizeof(tbuffer)); + } + strncat(tbuffer, AFSDIR_CELLSERVDB_FILE_NTCLIENT, sizeof(tbuffer)); + tbuffer[sizeof(tbuffer)-1] = '\0'; + } } else { strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL); @@ -237,7 +249,7 @@ afsconf_Check(register struct afsconf_dir *adir) static int afsconf_Touch(register struct afsconf_dir *adir) { - char tbuffer[256]; + char tbuffer[256], *p; #ifndef AFS_NT40_ENV struct timeval tvp[2]; #endif @@ -248,8 +260,18 @@ afsconf_Touch(register struct afsconf_dir *adir) /* NT client CellServDB has different file name than NT server or Unix */ if (IsClientConfigDirectory(adir->name)) { - strcompose(tbuffer, 256, adir->name, "/", - AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + if ( !afssw_GetClientCellServDBDir(&p) ) { + strcompose(tbuffer, sizeof(tbuffer), p, "/", + AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + free(p); + } else { + int len = strlen(tbuffer); + if ( tbuffer[len-1] != '\\' && tbuffer[len-1] != '/' ) { + strncat(tbuffer, "\\", sizeof(tbuffer)); + } + strncat(tbuffer, AFSDIR_CELLSERVDB_FILE_NTCLIENT, sizeof(tbuffer)); + tbuffer[sizeof(tbuffer)-1] = '\0'; + } } else { strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, NULL); @@ -412,8 +434,21 @@ afsconf_OpenInternal(register struct afsconf_dir *adir, char *cell, */ if (IsClientConfigDirectory(adir->name)) { /* NT client config dir */ - strcompose(tbuffer, 256, adir->name, "/", - AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + char * p; + if ( !afssw_GetClientCellServDBDir(&p) ) { + strcompose(tbuffer, sizeof(tbuffer), p, "/", + AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL); + free(p); + } else { + int len; + strncpy(tbuffer, adir->name, sizeof(tbuffer)); + len = strlen(tbuffer); + if ( tbuffer[len-1] != '\\' && tbuffer[len-1] != '/' ) { + strncat(tbuffer, "\\", sizeof(tbuffer)); + } + strncat(tbuffer, AFSDIR_CELLSERVDB_FILE_NTCLIENT, sizeof(tbuffer)); + tbuffer[sizeof(tbuffer)-1] = '\0'; + } } else { /* NT server config dir */ strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLSERVDB_FILE, diff --git a/src/auth/ktc_nt.c b/src/auth/ktc_nt.c index 7b5aa5a50..f25528db3 100644 --- a/src/auth/ktc_nt.c +++ b/src/auth/ktc_nt.c @@ -13,7 +13,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/auth/ktc_nt.c,v 1.16 2004/04/04 02:35:47 jaltman Exp $"); + ("$Header: /cvs/openafs/src/auth/ktc_nt.c,v 1.17 2004/07/08 13:24:00 jaltman Exp $"); #include #include @@ -116,9 +116,9 @@ send_key(afs_uuid_t uuid, char sessionKey[8]) if (!strcmpi(encrypt, "OFF")) encryptionOff = TRUE; - /* Protocol sequence is named pipe by default */ + /* Protocol sequence is local by default */ if (!GetEnvironmentVariable("AFS_RPC_PROTSEQ", protseq, sizeof(protseq))) - strcpy(protseq, "ncacn_np"); + strcpy(protseq, "ncalrpc"); /* Server name */ getservername(&serverNamep, sizeof(serverName)); @@ -189,9 +189,9 @@ receive_key(afs_uuid_t uuid, char sessionKey[8]) if (!strcmpi(encrypt, "OFF")) encryptionOff = TRUE; - /* Protocol sequence is named pipe by default */ + /* Protocol sequence is local by default */ if (!GetEnvironmentVariable("AFS_RPC_PROTSEQ", protseq, sizeof(protseq))) - strcpy(protseq, "ncacn_np"); + strcpy(protseq, "ncalrpc"); /* Server name */ getservername(&serverNamep, sizeof(serverName)); diff --git a/src/bozo/NTMakefile b/src/bozo/NTMakefile index 8d7b8a72b..dd5f8ae32 100644 --- a/src/bozo/NTMakefile +++ b/src/bozo/NTMakefile @@ -70,7 +70,7 @@ BOSSERVER_EXELIBS =\ $(DESTDIR)\lib\cm_dns.obj $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) @@ -106,7 +106,7 @@ BOS_EXELIBS =\ $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) $(CL_BOS_EXEFILE): $(RS_BOS_EXEFILE) diff --git a/src/bucoord/NTMakefile b/src/bucoord/NTMakefile index 71bf0ceab..27574c24e 100644 --- a/src/bucoord/NTMakefile +++ b/src/bucoord/NTMakefile @@ -6,6 +6,7 @@ # directory or online at http://www.openafs.org/dl/license10.html RELDIR=bucoord +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN !INCLUDE ..\config\NTMakefile.$(SYS_NAME) !INCLUDE ..\config\NTMakefile.version @@ -90,7 +91,7 @@ EXELIBS =\ $(EXEFILE): $(EXEOBJS) $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) diff --git a/src/budb/NTMakefile b/src/budb/NTMakefile index e9b716082..7d1611021 100644 --- a/src/budb/NTMakefile +++ b/src/budb/NTMakefile @@ -6,6 +6,7 @@ # directory or online at http://www.openafs.org/dl/license10.html RELDIR=budb +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN !INCLUDE ..\config\NTMakefile.$(SYS_NAME) !INCLUDE ..\config\NTMakefile.version diff --git a/src/butc/Makefile.in b/src/butc/Makefile.in index d7bc516a6..51c7922ac 100644 --- a/src/butc/Makefile.in +++ b/src/butc/Makefile.in @@ -59,7 +59,7 @@ tdump: tdump.c AFS_component_version_number.c butc: ${SOBJS} ${LIBS} ${INCLS} ${HACKS} @case ${SYS_NAME} in \ - rs_aix4*) ${CC} ${CFLAGS} ${SOBJS} ${LIBS} ${XLIBS} /usr/lib/libc_r.a -o butc;; \ + rs_aix*) ${CC} ${CFLAGS} ${SOBJS} ${LIBS} ${XLIBS} /usr/lib/libc_r.a -o butc;; \ *) ${CC} ${CFLAGS} ${SOBJS} ${LIBS} ${XLIBS} -o butc;; \ esac @@ -84,7 +84,7 @@ clean: install: @case ${SYS_NAME} in \ - alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix4*|*linux*|hp_ux*) \ + alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux*) \ echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ *_darwin_[1-6][0-9]) \ echo ${INSTALL} butc ${DEST}/etc/butc ; \ @@ -100,7 +100,7 @@ install: include ../config/Makefile.version dest: @case ${SYS_NAME} in \ - alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix4*|*linux*|hp_ux*) \ + alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux*) \ echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ *_darwin_[1-6][0-9]) \ echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \ diff --git a/src/butc/NTMakefile b/src/butc/NTMakefile index a644f9ce2..99ad8e30c 100644 --- a/src/butc/NTMakefile +++ b/src/butc/NTMakefile @@ -6,6 +6,7 @@ # directory or online at http://www.openafs.org/dl/license10.html RELDIR=butc +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN !INCLUDE ..\config\NTMakefile.$(SYS_NAME) !INCLUDE ..\config\NTMakefile.version @@ -53,7 +54,7 @@ EXELIBS =\ $(DESTDIR)\lib\cm_dns.obj $(EXEFILE): $(EXEOBJS) $(EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) ############################################################################ diff --git a/src/butc/butc_xbsa.c b/src/butc/butc_xbsa.c index 2b6d2f00a..eba630d81 100644 --- a/src/butc/butc_xbsa.c +++ b/src/butc/butc_xbsa.c @@ -13,7 +13,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/butc/butc_xbsa.c,v 1.6 2003/12/07 22:49:21 jaltman Exp $"); + ("$Header: /cvs/openafs/src/butc/butc_xbsa.c,v 1.8 2004/07/14 04:46:48 shadow Exp $"); #include #include @@ -24,6 +24,7 @@ RCSID #include #include "butc_xbsa.h" #include +#include #include "error_macros.h" @@ -258,8 +259,8 @@ xbsa_Initialize(struct butx_transactionInfo * info, char *bsaObjectOwner, { char envStrs[XBSA_NUM_ENV_STRS][BSA_MAX_DESC]; char *envP[XBSA_NUM_ENV_STRS + 1]; - char *ADSMMaxObject = "MAXOBJ="; - char *ADSMServer = "DSMSRVR="; + char *ADSMMaxObject = "TSMMAXOBJ="; + char *ADSMServer = "TSMSRVR="; char *tempStrPtr; int i; int rc; @@ -305,6 +306,7 @@ xbsa_Initialize(struct butx_transactionInfo * info, char *bsaObjectOwner, tempStrPtr = tempStrPtr + strlen(ADSMServer); strcat(tempStrPtr, serverName); envP[1] = NULL; + envP[0] = NULL; /* Hack for TSM V5 */ } else { envP[0] = NULL; ELog(0, "xbsa_Initialize: The serverName was not specified\n"); @@ -376,6 +378,8 @@ xbsa_Initialize(struct butx_transactionInfo * info, char *bsaObjectOwner, return (BUTX_GETENVFAIL); } + info->maxObjects = 255; /* Hack for ADSM V5: unclear what this actually means... */ + switch (XBSA_GET_SERVER_TYPE(info->serverType)) { case XBSA_SERVER_TYPE_ADSM: for (i = 0; i < XBSA_NUM_ENV_STRS; i++) { diff --git a/src/butc/tcprocs.c b/src/butc/tcprocs.c index b6927fd3e..1e814ab4a 100644 --- a/src/butc/tcprocs.c +++ b/src/butc/tcprocs.c @@ -13,7 +13,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/butc/tcprocs.c,v 1.11 2003/12/07 22:49:23 jaltman Exp $"); + ("$Header: /cvs/openafs/src/butc/tcprocs.c,v 1.12 2004/07/13 05:52:46 shadow Exp $"); #include #include @@ -51,6 +51,20 @@ callPermitted(call) return 1; } +/* XBSA Global Parameters */ +afs_int32 xbsaType; +#ifdef xbsa +struct butx_transactionInfo butxInfo; + +#define rpc_c_protect_level_default 0 +afs_uint32 dumpRestAuthnLevel = rpc_c_protect_level_default; +char *xbsaObjectOwner; +char *appObjectOwner; +char *adsmServerName; +char *xbsaSecToken; +char *xbsalGName; +#endif + /* ------------------------- * butc - interface routines - alphabetic order * ------------------------- diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 75d5ce4e1..8d6373181 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -748,6 +748,27 @@ case $AFS_SYSNAME in SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" ;; + sunx86_59) + CC="/opt/SUNWspro/bin/cc" + CCOBJ="/opt/SUNWspro/bin/cc" + LEX="lex" + LD="/usr/ccs/bin/ld" + MT_CC="/opt/SUNWspro/bin/cc" + MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}' + MT_LIBS="-lpthread -lsocket" + PAM_CFLAGS="-KPIC" + PAM_LIBS="-lc -lpam -lsocket -lnsl -lm" + SHLIB_CFLAGS="-KPIC" + SHLIB_LDFLAGS="-G -Bsymbolic" + TXLIBS="-lcurses" + XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS="-dy -Bdynamic" + XLIBELFA="-lelf" + XLIBKVM="-lkvm" + XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl" + SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text" + ;; + sunx86_510) CC="/opt/SUNWspro/bin/cc" CCOBJ="/opt/SUNWspro/bin/cc" diff --git a/src/config/NTLang.bat b/src/config/NTLang.bat index b9def0687..547e7c9e7 100644 --- a/src/config/NTLang.bat +++ b/src/config/NTLang.bat @@ -143,55 +143,48 @@ set LANGID=1041 set LANGNAME=ja_JP set LANGCP=932 echo Building Japanese resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :ko_KR set LANGID=1042 set LANGNAME=ko_KR set LANGCP=949 echo Building Korean resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :zh_CN set LANGID=2052 set LANGNAME=zh_CN set LANGCP=936 echo Building Chinese (Simplified: PR China) resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :zh_TW set LANGID=1028 set LANGNAME=zh_TW set LANGCP=950 echo Building Chinese (Traditional: Taiwan) resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :pt_BR set LANGID=1046 set LANGNAME=pt_BR set LANGCP=1252 echo Building Brazilian Portuguese resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :es_ES set LANGID=1034 set LANGNAME=es_ES set LANGCP=1252 echo Building Spanish resources (%LANGID%, %LANGNAME%) -goto arg2_warn +goto arg2 :de_DE set LANGID=1032 set LANGNAME=de_DE set LANGCP=1252 echo Building German resources (%LANGID%, %LANGNAME%) -goto arg2_warn - -############################################################################### -# Warn the user that ntlang.reg is required to build non-us languages - -:arg2_warn -echo NOTE: If you have not already run WINNT/docs/NTLang.reg, do so now! goto arg2 ############################################################################### diff --git a/src/config/NTMakefile.i386_nt40 b/src/config/NTMakefile.i386_nt40 index 7ab2fe65a..1bb9000a2 100644 --- a/src/config/NTMakefile.i386_nt40 +++ b/src/config/NTMakefile.i386_nt40 @@ -79,7 +79,7 @@ LIB = $(AFSDEV_LIB) #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=3 -AFSPRODUCT_VER_PATCH=6500 +AFSPRODUCT_VER_PATCH=7000 AFSPRODUCT_VER_BUILD=0 AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH) AFSPRODUCT_FILE_VERSION=$(AFSPRODUCT_VER_MAJOR),$(AFSPRODUCT_VER_MINOR),$(AFSPRODUCT_VER_PATCH),$(AFSPRODUCT_VER_BUILD) @@ -234,11 +234,19 @@ afscflags =\ /GF \ /Gd \ /Gy \ - /GX \ /Os +!IF ("$(AFSVER_CL)"=="1400") +afscflags = $(afscflags) /EHsc /wd4996 +!ELSE +afscflags = $(afscflags) /GX +!ENDIF + !IF ("$(AFSVER_CL)"!="1200") -afscdefs = $(afscdefs) /G7 /GT /GS +afscdefs = $(afscdefs) /GT /GS +!IF ("$(AFSVER_CL)"!="1400") +afscdefs = $(afscdefs) /G7 +!ENDIF !ENDIF !IF ("$(AFSDEV_BUILDTYPE)" == "FREE") diff --git a/src/config/afs_args.h b/src/config/afs_args.h index d2c21f370..6e0cd5505 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -179,6 +179,7 @@ typedef struct cm_initparams_v1 { #define PROC_FSDIRNAME "openafs" #define PROC_SYSCALL_NAME "afs_ioctl" #define PROC_SYSCALL_FNAME "/proc/fs/openafs/afs_ioctl" +#define PROC_SYSCALL_ARLA_FNAME "/proc/fs/nnpfs/afs_ioctl" #define VIOC_SYSCALL_TYPE 'C' #define VIOC_SYSCALL _IOW(VIOC_SYSCALL_TYPE,1,void *) diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index ceda90e57..e6ae7ebd1 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -164,6 +164,7 @@ #define SYS_NAME_ID_i386_fbsd_50 2105 #define SYS_NAME_ID_i386_fbsd_51 2106 #define SYS_NAME_ID_i386_fbsd_52 2107 +#define SYS_NAME_ID_i386_fbsd_53 2108 #define SYS_NAME_ID_ia64_linux2 2200 #define SYS_NAME_ID_ia64_linux22 2201 @@ -197,6 +198,7 @@ #define SYS_NAME_ID_i386_obsd33 2602 #define SYS_NAME_ID_i386_obsd34 2603 #define SYS_NAME_ID_i386_obsd35 2604 +#define SYS_NAME_ID_i386_obsd36 2605 #define SYS_NAME_ID_amd64_linux2 2700 #define SYS_NAME_ID_amd64_linux22 2701 diff --git a/src/config/config.c b/src/config/config.c index 0967126f8..5512d67e8 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "AFS_component_version_number.c" @@ -24,8 +25,9 @@ main(int argc, char **argv) { register FILE *infile; register FILE *outfile; - char *alist[3]; + char *alist[5]; register int code; + char *sysname; if (argc != 4) { printf @@ -42,9 +44,20 @@ main(int argc, char **argv) printf("config: output file %s not found.\n", argv[2]); exit(1); } + memset (alist, 0, sizeof (alist)); alist[0] = argv[3]; alist[1] = "all"; - alist[2] = NULL; + + /* This allows JUST arch or JUST OS/version, + * Linux 2.6 uses the in-kernel build system, so + * just 'linux26' is enough. */ + sysname = strdup (alist[0]); + alist[2] = strchr (sysname, '_'); + if (alist[2]) { + alist[3] = sysname; + *alist[2] = 0; + alist[2]++; + } code = mc_copy(infile, outfile, alist); if (code) { printf("config: failed to correctly write makefile '%s', code %d\n", diff --git a/src/config/param.alpha_dux50.h b/src/config/param.alpha_dux50.h index d48b64103..c5de5083e 100644 --- a/src/config/param.alpha_dux50.h +++ b/src/config/param.alpha_dux50.h @@ -24,6 +24,7 @@ #define AFS_ALPHA_ENV 1 #define AFS_DECOSF_ENV 1 #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #include diff --git a/src/config/param.alpha_dux51.h b/src/config/param.alpha_dux51.h index de3a26dec..e042e39df 100644 --- a/src/config/param.alpha_dux51.h +++ b/src/config/param.alpha_dux51.h @@ -25,6 +25,7 @@ #define AFS_ALPHA_ENV 1 #define AFS_DECOSF_ENV 1 #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #include diff --git a/src/config/param.amd64_linux24.h b/src/config/param.amd64_linux24.h index b0d3251c0..16e5a9c96 100644 --- a/src/config/param.amd64_linux24.h +++ b/src/config/param.amd64_linux24.h @@ -36,6 +36,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ diff --git a/src/config/param.hp_ux11i.h b/src/config/param.hp_ux11i.h index e5bd9377f..57730f2d4 100644 --- a/src/config/param.hp_ux11i.h +++ b/src/config/param.hp_ux11i.h @@ -24,6 +24,7 @@ #define AFS_HPUX1111_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ #include diff --git a/src/config/param.i386_fbsd_50.h b/src/config/param.i386_fbsd_50.h index 4e18c1985..14bb1f8b9 100644 --- a/src/config/param.i386_fbsd_50.h +++ b/src/config/param.i386_fbsd_50.h @@ -13,6 +13,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.i386_fbsd_51.h b/src/config/param.i386_fbsd_51.h index da1fc487b..96f6202df 100644 --- a/src/config/param.i386_fbsd_51.h +++ b/src/config/param.i386_fbsd_51.h @@ -13,6 +13,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.i386_fbsd_52.h b/src/config/param.i386_fbsd_52.h index be37ce029..1234efc8e 100644 --- a/src/config/param.i386_fbsd_52.h +++ b/src/config/param.i386_fbsd_52.h @@ -13,6 +13,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.i386_fbsd_53.h b/src/config/param.i386_fbsd_53.h new file mode 100644 index 000000000..86cc371d7 --- /dev/null +++ b/src/config/param.i386_fbsd_53.h @@ -0,0 +1,201 @@ +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +#ifndef IGNORE_STDS_H +#include +#endif + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_X86_XBSD_ENV 1 + +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_FBSD_ENV 1 +#define AFS_FBSD40_ENV 1 +#define AFS_FBSD42_ENV 1 +#define AFS_FBSD43_ENV 1 +#define AFS_FBSD44_ENV 1 +#define AFS_FBSD45_ENV 1 +#define AFS_FBSD46_ENV 1 +#define AFS_FBSD47_ENV 1 +#define AFS_FBSD50_ENV 1 +#define AFS_FBSD51_ENV 1 +#define AFS_FBSD52_ENV 1 +#define AFS_FBSD53_ENV 1 +#define AFS_X86_FBSD_ENV 1 +#define AFS_X86_FBSD40_ENV 1 +#define AFS_X86_FBSD42_ENV 1 +#define AFS_X86_FBSD43_ENV 1 +#define AFS_X86_FBSD46_ENV 1 +#define AFS_X86_FBSD47_ENV 1 +#define AFS_X86_FBSD50_ENV 1 +#define AFS_X86_ENV 1 +#define AFS_NONFSTRANS 1 +#define FTRUNC O_TRUNC + +#define IUPD 0x0010 +#define IACC 0x0020 +#define ICHG 0x0040 +#define IMOD 0x0080 + +#define IN_LOCK(ip) lockmgr(&ip->i_lock, LK_EXCLUSIVE, \ + NULL, curproc) +#define IN_UNLOCK(ip) lockmgr(&ip->i_lock, LK_RELEASE, \ + NULL, curproc) + +#include + +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_VFSINCL_ENV 1 +#define AFS_GREEDY43_ENV 1 +#define AFS_ENV 1 + +#define AFS_SYSCALL 339 +#define AFS_MOUNT_AFS "afs" + +#ifndef MOUNT_UFS +#define MOUNT_UFS "ufs" +#endif + +#ifndef MOUNT_AFS +#define MOUNT_AFS AFS_MOUNT_AFS +#endif +#define SYS_NAME "i386_fbsd_53" +#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_53 + +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't supports statvfs */ + +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define AFSLITTLE_ENDIAN 1 + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_VFS34 1 /* What is VFS34??? */ +#define AFS_SHORTGID 0 /* are group id's short? */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES CLBYTES +#define osi_GetTime(x) microtime(x) +#define AFS_KALLOC(x) osi_fbsd_alloc((x), 1) +#undef AFS_KALLOC_NOSLEEP +#define AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0) +#define AFS_KFREE(x,y) osi_fbsd_free((x)) +#define v_count v_usecount +#define v_vfsp v_mount +#define vfs_bsize mnt_stat.f_bsize +#define vfs_fsid mnt_stat.f_fsid +#define va_nodeid va_fileid +#define vfs_vnodecovered mnt_vnodecovered +#define direct dirent +#define vnode_t struct vnode + +#ifndef MUTEX_DEFAULT +#define MUTEX_DEFAULT 0 +#endif /* MUTEX_DEFAULT */ + +#ifndef SSYS +#define SSYS 0x00002 +#endif /* SSYS */ + +#define p_rcred p_ucred + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) +enum vcexcl { NONEXCL, EXCL }; + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ +#endif /* _KERNEL */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_VFSINCL_ENV 1 +#define AFS_USR_FBSD40_ENV 1 +#define AFS_USR_FBSD42_ENV 1 +#define AFS_USR_FBSD43_ENV 1 +#define AFS_USR_FBSD44_ENV 1 +#define AFS_USR_FBSD45_ENV 1 +#define AFS_USR_FBSD46_ENV 1 +#define AFS_USR_FBSD47_ENV 1 +#define AFS_USR_FBSD50_ENV 1 +#define AFS_USR_FBSD51_ENV 1 +#define AFS_USR_FBSD52_ENV 1 +#define AFS_USR_FBSD53_ENV 1 +#define AFS_USR_FBSD_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 339 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +/* Machine / Operating system information */ +#include +#define SYS_NAME "i386_fbsd_53" +#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_53 + +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 1 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* !defined(UKERNEL) */ + +#endif /* AFS_PARAM_H */ diff --git a/src/config/param.i386_linux26.h b/src/config/param.i386_linux26.h index 392c469bc..696766711 100644 --- a/src/config/param.i386_linux26.h +++ b/src/config/param.i386_linux26.h @@ -33,13 +33,17 @@ #include #ifdef CONFIG_SMP -#undef CONFIG_SMP +#ifndef AFS_SMP +#define AFS_SMP 1 +#endif #endif /* Using "AFS_SMP" to map to however many #define's are required to get * MP to compile for Linux */ #ifdef AFS_SMP +#ifndef CONFIG_SMP #define CONFIG_SMP 1 +#endif #ifndef CONFIG_X86_LOCAL_APIC #define CONFIG_X86_LOCAL_APIC 1 #endif diff --git a/src/config/param.i386_nbsd20.h b/src/config/param.i386_nbsd20.h index 3bdd8351f..624858094 100644 --- a/src/config/param.i386_nbsd20.h +++ b/src/config/param.i386_nbsd20.h @@ -40,6 +40,8 @@ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ #define AFS_SYSCALL 210 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #include diff --git a/src/config/param.i386_obsd31.h b/src/config/param.i386_obsd31.h index 208607ac9..ec2b6d643 100644 --- a/src/config/param.i386_obsd31.h +++ b/src/config/param.i386_obsd31.h @@ -14,6 +14,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_OBSD_ENV 1 #define AFS_NONFSTRANS 1 diff --git a/src/config/param.i386_obsd32.h b/src/config/param.i386_obsd32.h index 40a31eaf2..ae1a65c96 100644 --- a/src/config/param.i386_obsd32.h +++ b/src/config/param.i386_obsd32.h @@ -14,6 +14,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_OBSD_ENV 1 #define AFS_NONFSTRANS 1 diff --git a/src/config/param.i386_obsd33.h b/src/config/param.i386_obsd33.h index 92bd31562..f31a16327 100644 --- a/src/config/param.i386_obsd33.h +++ b/src/config/param.i386_obsd33.h @@ -17,6 +17,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_OBSD_ENV 1 #define AFS_NONFSTRANS 1 diff --git a/src/config/param.i386_obsd34.h b/src/config/param.i386_obsd34.h index ff3249fd4..78016daf2 100644 --- a/src/config/param.i386_obsd34.h +++ b/src/config/param.i386_obsd34.h @@ -17,6 +17,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_OBSD_ENV 1 #define AFS_OBSD34_ENV 1 diff --git a/src/config/param.i386_obsd36.h b/src/config/param.i386_obsd36.h new file mode 100644 index 000000000..4fb745486 --- /dev/null +++ b/src/config/param.i386_obsd36.h @@ -0,0 +1,64 @@ +/* + * Jim Rees, University of Michigan CITI + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#ifndef IGNORE_STDS_H +#include +#endif + +#define SYS_NAME "i386_obsd36" +#define SYS_NAME_ID SYS_NAME_ID_i386_obsd36 + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_X86_XBSD_ENV 1 + +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_OBSD_ENV 1 +#define AFS_OBSD34_ENV 1 +#define AFS_OBSD35_ENV 1 +#define AFS_OBSD36_ENV 1 +#define AFS_NONFSTRANS 1 +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_VFSINCL_ENV 1 + +#define FTRUNC O_TRUNC + +#define AFS_SYSCALL 208 +#define AFS_MOUNT_AFS "afs" + +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define AFSLITTLE_ENDIAN 1 + +#ifndef IGNORE_STDS_H +#include +#endif + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_SHORTGID 0 /* are group id's short? */ + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) +enum vcexcl { NONEXCL, EXCL }; + +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ +#endif /* _KERNEL */ + +#endif /* AFS_PARAM_H */ diff --git a/src/config/param.ia64_hpux1122.h b/src/config/param.ia64_hpux1122.h index 8beef7fd8..598abe750 100644 --- a/src/config/param.ia64_hpux1122.h +++ b/src/config/param.ia64_hpux1122.h @@ -22,6 +22,7 @@ #define AFS_HPUX1122_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #if defined(__LP64__) #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ #endif diff --git a/src/config/param.ia64_hpux1123.h b/src/config/param.ia64_hpux1123.h index 7632fe594..adb9d0534 100644 --- a/src/config/param.ia64_hpux1123.h +++ b/src/config/param.ia64_hpux1123.h @@ -23,6 +23,7 @@ #define AFS_HPUX1123_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #if defined(__LP64__) #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ #endif diff --git a/src/config/param.ia64_linux24.h b/src/config/param.ia64_linux24.h index 14ee02d66..83f843392 100644 --- a/src/config/param.ia64_linux24.h +++ b/src/config/param.ia64_linux24.h @@ -36,6 +36,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ diff --git a/src/config/param.nbsd20.h b/src/config/param.nbsd20.h index 2d1fdd04c..fed9173d6 100644 --- a/src/config/param.nbsd20.h +++ b/src/config/param.nbsd20.h @@ -11,6 +11,7 @@ #define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_64BIT_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_NBSD_ENV 1 @@ -52,7 +53,7 @@ #endif #define AFS_HAVE_FFS 1 /* Use system's ffs. */ -#define AFS_HAVE_STATVFS 1 /* System supports statvfs */ +#define AFS_HAVE_STATVFS 0 /* System supports statvfs */ #define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ #define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ diff --git a/src/config/param.parisc_linux24.h b/src/config/param.parisc_linux24.h index c8fdd239f..a4d71afb3 100644 --- a/src/config/param.parisc_linux24.h +++ b/src/config/param.parisc_linux24.h @@ -19,6 +19,8 @@ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ #define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ diff --git a/src/config/param.ppc64_linux24.h b/src/config/param.ppc64_linux24.h index f947013e1..a207e8957 100644 --- a/src/config/param.ppc64_linux24.h +++ b/src/config/param.ppc64_linux24.h @@ -24,6 +24,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ diff --git a/src/config/param.ppc_darwin_70.h b/src/config/param.ppc_darwin_70.h index 82d695c32..d3a1e6cb1 100644 --- a/src/config/param.ppc_darwin_70.h +++ b/src/config/param.ppc_darwin_70.h @@ -6,6 +6,7 @@ #define AFS_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 #define AFS_PPC_ENV 1 #define AFS_VFSINCL_ENV 1 diff --git a/src/config/param.ppc_linux24.h b/src/config/param.ppc_linux24.h index 350a89850..3ee2508c4 100644 --- a/src/config/param.ppc_linux24.h +++ b/src/config/param.ppc_linux24.h @@ -21,6 +21,8 @@ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ #define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ diff --git a/src/config/param.s390_linux24.h b/src/config/param.s390_linux24.h index 8a8f78155..986abb73f 100644 --- a/src/config/param.s390_linux24.h +++ b/src/config/param.s390_linux24.h @@ -31,6 +31,8 @@ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ #define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ diff --git a/src/config/param.sgi_65.h b/src/config/param.sgi_65.h index 433f81df7..3f50fafa5 100644 --- a/src/config/param.sgi_65.h +++ b/src/config/param.sgi_65.h @@ -38,6 +38,7 @@ #define _ANSI_C_SOURCE 1 /* rx_user.h */ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 1 /* System supports statvfs */ diff --git a/src/config/param.sparc64_linux24.h b/src/config/param.sparc64_linux24.h index b230627f6..654a0848b 100644 --- a/src/config/param.sparc64_linux24.h +++ b/src/config/param.sparc64_linux24.h @@ -36,6 +36,7 @@ #define AFS_NAMEI_ENV 1 /* User space interface to file system */ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_32BIT_USR_ENV 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ diff --git a/src/config/param.sparc_linux24.h b/src/config/param.sparc_linux24.h index 2d008815d..015500c07 100644 --- a/src/config/param.sparc_linux24.h +++ b/src/config/param.sparc_linux24.h @@ -30,6 +30,8 @@ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ #define AFS_SYSCALL 227 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #define AFS_64BIT_IOPS_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ diff --git a/src/config/param.sun4x_510.h b/src/config/param.sun4x_510.h index 840314185..cc2e73d71 100644 --- a/src/config/param.sun4x_510.h +++ b/src/config/param.sun4x_510.h @@ -23,6 +23,7 @@ #define AFS_SUN510_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_HAVE_FLOCK_SYSID 1 diff --git a/src/config/param.sun4x_58.h b/src/config/param.sun4x_58.h index 9abb5f448..48655381a 100644 --- a/src/config/param.sun4x_58.h +++ b/src/config/param.sun4x_58.h @@ -21,6 +21,7 @@ #define AFS_SUN58_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_HAVE_FLOCK_SYSID 1 diff --git a/src/config/param.sun4x_59.h b/src/config/param.sun4x_59.h index 8ecd9b147..79279df3a 100644 --- a/src/config/param.sun4x_59.h +++ b/src/config/param.sun4x_59.h @@ -22,6 +22,7 @@ #define AFS_SUN59_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_HAVE_FLOCK_SYSID 1 diff --git a/src/config/param.sunx86_510.h b/src/config/param.sunx86_510.h index 102a96f2f..95be22342 100644 --- a/src/config/param.sunx86_510.h +++ b/src/config/param.sunx86_510.h @@ -33,6 +33,7 @@ #define AFS_X86_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_HAVE_FLOCK_SYSID 1 diff --git a/src/config/param.sunx86_58.h b/src/config/param.sunx86_58.h index 3849c2950..5e6a9f928 100644 --- a/src/config/param.sunx86_58.h +++ b/src/config/param.sunx86_58.h @@ -31,6 +31,7 @@ #define AFS_X86_ENV 1 #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 #define AFS_HAVE_FLOCK_SYSID 1 diff --git a/src/config/param.sunx86_59.h b/src/config/param.sunx86_59.h new file mode 100644 index 000000000..d051d7874 --- /dev/null +++ b/src/config/param.sunx86_59.h @@ -0,0 +1,207 @@ +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define AFS_VFS_ENV 1 +/* Used only in vfsck code; is it needed any more???? */ + +#define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ +#define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ +#define AFS_ENV 1 +#define AFS_SUN_ENV 1 +#define AFS_SUN5_ENV 1 +#define AFS_SUN52_ENV 1 +#define AFS_SUN53_ENV 1 +#define AFS_SUN54_ENV 1 +#define AFS_SUN55_ENV 1 +#define AFS_SUN56_ENV 1 +#define AFS_SUN57_ENV 1 +#define AFS_SUN58_ENV 1 +#define AFS_SUN59_ENV 1 +#define AFS_X86_ENV 1 + +#define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_CLIENT 1 + +#define AFS_HAVE_FLOCK_SYSID 1 + +#include + +#define AFS_GLOBAL_SUNLOCK 1 /* For global locking */ +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */ + +#ifdef AFS_NAMEI_ENV +#define AFS_64BIT_IOPS_ENV 1 /* needed for NAMEI... */ +#else /* AFS_NAMEI_ENV */ +#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ +#endif /* AFS_NAMEI_ENV */ + +#define AFS_SYSCALL 65 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS "afs" + +/* Machine / Operating system information */ +#define sys_sunx86_59 1 +#define SYS_NAME "sunx86_59" +#define SYS_NAME_ID SYS_NAME_ID_sunx86_59 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_VXFS 1 /* Support cache on Veritas vxfs file system */ +#define AFS_HAVE_STATVFS 1 /* System supports statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define NEARINODE_HINT 1 /* hint to ufs module to scatter inodes on disk */ +#define nearInodeHash(volid, hval) { \ + unsigned char* ts = (unsigned char*)&(volid)+sizeof(volid)-1;\ + for ( (hval)=0; ts >= (unsigned char*)&(volid); ts--){\ + (hval) *= 173; \ + (hval) += *ts; \ + } \ + } + +/* Extra kernel definitions (from kdefs file) */ +#ifdef KERNEL +/* sun definitions here */ +#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ +#define AFS_SYSVLOCK 1 /* sys v locking supported */ +/*#define AFS_USEBUFFERS 1*/ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define osi_GetTime(x) uniqtime(x) + +/** + * These defines are for the 64 bit Solaris 7 port + * AFS_SYSCALL32 is used to protect the ILP32 syscall interface + * AFS_64BIT_ENV is for use of 64 bit inode numbers + */ +#if defined(__sparcv9) +#define AFS_SUN57_64BIT_ENV 1 +#define AFS_64BIT_INO 1 +#endif + +/** + * Solaris 7 64 bit has two versions of uniqtime. Since we consistently + * use 32 bit quantities for time in afs, we now use uniqtime32 + */ +#if defined(AFS_SUN57_64BIT_ENV) +#undef osi_GetTime +#define osi_GetTime(x) uniqtime32(x) +#endif + + + +#define AFS_KALLOC(n) kmem_alloc(n, KM_SLEEP) +#define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) +#define AFS_KFREE kmem_free +#define VATTR_NULL vattr_null +#define memset(A, B, S) bzero(A, S) +#define memcpy(B, A, S) bcopy(A, B, S) +#define memcmp(A, B, S) bcmp(A, B, S) +#endif /* KERNEL */ +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif +#define ROOTINO UFSROOTINO + +#endif /* AFS_PARAM_H */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define AFS_VFS_ENV 1 +/* Used only in vfsck code; is it needed any more???? */ +#define RXK_LISTENER_ENV 1 +#define AFS_USERSPACE_IP_ADDR 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */ +#define AFS_ENV 1 +#define AFS_USR_SUN5_ENV 1 +#define AFS_USR_SUN6_ENV 1 +#define AFS_USR_SUN7_ENV 1 +#define AFS_USR_SUN8_ENV 1 +#define AFS_USR_SUN9_ENV 1 + +#include + +#if 0 +#define AFS_GLOBAL_SUNLOCK 1 /* For global locking */ +#endif + +#define AFS_3DISPARES 1 /* Utilize the 3 available disk inode 'spares' */ +#define AFS_SYSCALL 65 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS 1 + +/* Machine / Operating system information */ +#define sys_sunx86_59 1 +#define SYS_NAME "sunx86_59" +#define SYS_NAME_ID SYS_NAME_ID_sunx86_59 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ + +/* Extra kernel definitions (from kdefs file) */ +#ifdef KERNEL +#define AFS_UIOFMODE 1 /* Only in afs/afs_vnodeops.c (afs_ustrategy) */ +#define AFS_SYSVLOCK 1 /* sys v locking supported */ +/*#define AFS_USEBUFFERS 1*/ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null +#endif /* KERNEL */ +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif +#define ROOTINO UFSROOTINO + +#endif /* AFS_PARAM_H */ + +#endif /* !defined(UKERNEL) */ diff --git a/src/kauth/NTMakefile b/src/kauth/NTMakefile index d89b5a842..e7f722a18 100644 --- a/src/kauth/NTMakefile +++ b/src/kauth/NTMakefile @@ -125,7 +125,7 @@ KASERVER_EXELIBS =\ $(DESTDIR)\lib\afs\afsprocmgmt.lib $(KASERVER): $(KASERVER_OBJS) $(AFSLIBS) $(KASERVER_EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) #build $(OUT)\kadatabase.obj @@ -149,7 +149,7 @@ KAS_OBJS =\ $(OUT)\kas.res $(KAS): $(KAS_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) ########### Misc Exes ####################################################### @@ -162,20 +162,20 @@ KPASSWD_OBJS =\ $(OUT)\kpasswd.res $(KPASSWD_EXEFILE): $(KPASSWD_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) #kpwvalid.exe $(OUT)\kpwvalid.exe: $(OUT)\kpwvalid.obj $(AFSLIBS) $(KAUTH_LIBFILE) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib #kdb.exe - Not implemented for NT - because dbm not available on NT #kdb.exe: $(OUT)\kdb.obj $(AFSLIBS) $(KAUTH_LIBFILE) -# $(EXECONLINK) dnsapi.lib +# $(EXECONLINK) dnsapi.lib mpr.lib #rebuild.exe $(OUT)\rebuild.exe: $(OUT)\rebuild.obj $(OUT)\kautils.obj $(AFSLIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib ############################################################################ # Definitions for generating versioninfo resources diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in index 45360b330..553e83f45 100644 --- a/src/libafs/MakefileProto.DARWIN.in +++ b/src/libafs/MakefileProto.DARWIN.in @@ -4,7 +4,7 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html -# $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.20 2003/10/24 06:26:11 shadow Exp $ +# $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.21 2004/08/08 23:12:57 shadow Exp $ # # MakefileProto for Digital Unix systems # @@ -98,7 +98,7 @@ dest_libafs: $(LIBAFSNONFS) ; ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS) - $(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} + $(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext ${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS) - $(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} + $(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index 620de5095..e82875044 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -35,7 +35,7 @@ COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@ # System specific build commands and flags - + # All the platform-specific and kernel-related things are provided by # the kernel build system. So we should _not_ use COMMON_KERN_CFLAGS! CCFLAGS = -Wno-strict-prototypes @@ -104,9 +104,9 @@ DESTDIRS=linux_destdirs include Makefile.common - + LINUX_MODULE_EXT=ko - + LINUX_MODULE_EXT=o @@ -229,7 +229,7 @@ libafs.ep: $(LIBAFS_EP) libafs.bm: $(LIBAFS_BM) echo BM Build Complete - + ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: libafs.ko cp libafs.ko $@ @@ -239,7 +239,7 @@ libafs.ko: .FORCE @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common $(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules - + ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS) $(RM) -f $@ $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS) diff --git a/src/libafsauthent/NTMakefile b/src/libafsauthent/NTMakefile index 2942eb53a..0e65c5eaf 100644 --- a/src/libafsauthent/NTMakefile +++ b/src/libafsauthent/NTMakefile @@ -141,7 +141,7 @@ DLLLIBS =\ $(DESTDIR)\lib\lanahelper.lib $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS) - $(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib + $(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib mpr.lib $(DLLPREP) # Definitions for generating versioninfo resources diff --git a/src/libafsauthent/afsauthent.def b/src/libafsauthent/afsauthent.def index 20fd1192d..a82298592 100644 --- a/src/libafsauthent/afsauthent.def +++ b/src/libafsauthent/afsauthent.def @@ -78,8 +78,8 @@ EXPORTS pioctl @77 rx_Init @78 ka_UserAuthenticateGeneral2 @79 - - + pr_CreateUser @80 + pr_SNameToId @81 DISK_function_names @83 DATA diff --git a/src/libafsrpc/NTMakefile b/src/libafsrpc/NTMakefile index 32ec9c070..52ff80e66 100644 --- a/src/libafsrpc/NTMakefile +++ b/src/libafsrpc/NTMakefile @@ -6,6 +6,7 @@ # directory or online at http://www.openafs.org/dl/license10.html RELDIR=libafsrpc +AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DNOGDI -DWIN32_LEAN_AND_MEAN !include ..\config\NTMakefile.$(SYS_NAME) !include ..\config\NTMakefile.version diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index 903903f4f..cce0257e6 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -27,15 +27,16 @@ liblwp.a: ${LIBOBJS} $(AR) crv $@ ${LIBOBJS} $(RANLIB) $@ +# This is required so sgi_64+ does not try to build this file. process.s: echo Nothing to be done for process.s - # This is required so sgi_64+ does not try to build this file. +# Making process.o for $(SYS_NAME) process.o : process.s process.i386.s process.c @case "$(SYS_NAME)" in \ pmax_he1) \ $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -c -I${TOP_INCDIR} process.s;; \ - sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5?) \ + sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5* ) \ /usr/ccs/lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s process.ss; \ ${AS} process.ss -o process.o; \ $(RM) process.ss ;; \ @@ -50,7 +51,6 @@ process.o : process.s process.i386.s process.c *_darwin* ) \ $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} -I${TOP_INCDIR} ${srcdir}/process.s;; \ i386_*bsd*) \ - echo foo ; \ cp ${srcdir}/process.i386.s process.S ; \ ${CCOBJ} -E -I${srcdir} -I${TOP_INCDIR} process.S >process.ss ; \ ${AS} process.ss -o process.o ; \ diff --git a/src/lwp/fasttime.c b/src/lwp/fasttime.c index 8b4ee1050..9700108e1 100644 --- a/src/lwp/fasttime.c +++ b/src/lwp/fasttime.c @@ -27,7 +27,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/lwp/fasttime.c,v 1.8 2003/12/07 22:49:33 jaltman Exp $"); + ("$Header: /cvs/openafs/src/lwp/fasttime.c,v 1.9 2004/07/19 15:25:16 shadow Exp $"); #include #include @@ -118,6 +118,12 @@ FT_AGetTimeOfDay(struct timeval *tv, struct timezone *tz) return FT_GetTimeOfDay(tv, tz); } +#ifdef AFS_PTHREAD_ENV +unsigned int FT_ApproxTime(void) +{ + return time(0); +} +#else unsigned int FT_ApproxTime(void) { @@ -126,3 +132,4 @@ FT_ApproxTime(void) } return FT_LastTime.tv_sec; } +#endif diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index 22b89769f..0d0b65a4f 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -21,10 +21,22 @@ IO Manager routines & server process for VICE server. */ +/* This controls the size of an fd_set; it must be defined early before + * the system headers define that type and the macros that operate on it. + * Its value should be as large as the maximum file descriptor limit we + * are likely to run into on any platform. Right now, that is 65536 + * which is the default hard fd limit on Solaris 9 */ +/* We don't do this on Windows because on that platform there is code + * which allocates fd_set's on the stack (IOMGR_Sleep on Win9x, and + * FDSetAnd on WinNT) */ +#ifndef _WIN32 +#define FD_SETSIZE 65536 +#endif + #include #include -RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.12 2003/11/29 22:08:14 jaltman Exp $"); +RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.13 2004/07/08 05:16:57 shadow Exp $"); #include #include @@ -177,7 +189,7 @@ static _go32_dpmi_seginfo callback_info; /* fd_set pool managment. * Use the pool instead of creating fd_set's on the stack. fd_set's can be - * 2K in size, so making three could put 6K in the limited space of an LWP + * 8K in size, so making three could put 24K in the limited space of an LWP * stack. */ struct IOMGR_fd_set { diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 16b57c9c8..20170c2f3 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.25 2003/09/24 19:02:05 shadow Exp $"); +RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.27 2004/07/28 20:59:58 shadow Exp $"); #include #include @@ -116,7 +116,7 @@ static purge_dead_pcbs(); struct QUEUE { PROCESS head; int count; -} runnable[MAX_PRIORITIES], blocked; +} runnable[MAX_PRIORITIES], blocked, qwaiting; /* Invariant for runnable queues: The head of each queue points to the currently running process if it is in that queue, or it points to the next process in that queue that should run. */ /* Offset of stack field within pcb -- used by stack checking stuff */ @@ -237,7 +237,7 @@ LWP_QWait(void) { register PROCESS tp; (tp = lwp_cpptr)->status = QWAITING; - lwp_remove(tp, &runnable[tp->priority]); + move(tp, &runnable[tp->priority], &qwaiting); Set_LWP_RC(); return LWP_SUCCESS; } @@ -248,7 +248,7 @@ LWP_QSignal(pid) { if (pid->status == QWAITING) { pid->status = READY; - insert(pid, &runnable[pid->priority]); + move(pid, &qwaiting, &runnable[pid->priority]); return LWP_SUCCESS; } else return LWP_ENOWAIT; @@ -556,6 +556,9 @@ Dump_Processes(void) for_all_elts(x, blocked, { Dump_One_Process(x);} ) + for_all_elts(x, qwaiting, { + Dump_One_Process(x);} + ) } else printf("***LWP: LWP support not initialized\n"); return 0; @@ -596,6 +599,8 @@ LWP_InitializeProcessSupport(int priority, PROCESS * pid) } blocked.head = NULL; blocked.count = 0; + qwaiting.head = NULL; + qwaiting.count = 0; lwp_init = (struct lwp_ctl *)malloc(sizeof(struct lwp_ctl)); temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); if (lwp_init == NULL || temp == NULL) @@ -654,6 +659,9 @@ LWP_TerminateProcessSupport(void) ) for_all_elts(cur, blocked, { Free_PCB(cur);} + ) + for_all_elts(cur, qwaiting, { + Free_PCB(cur);} ) free(lwp_init); lwp_init = NULL; @@ -779,7 +787,9 @@ Delete_PCB(register PROCESS pid) lwp_remove(pid, (pid->blockflag || pid->status == WAITING || pid->status == - DESTROYED ? &blocked : &runnable[pid->priority])); + DESTROYED ? &blocked : + (pid->status == QWAITING) ? &qwaiting : + &runnable[pid->priority])); LWPANCHOR.processcnt--; return 0; } @@ -806,6 +816,9 @@ Dump_One_Process(PROCESS pid) case DESTROYED: printf("DESTROYED"); break; + case QWAITING: + printf("QWAITING"); + break; default: printf("unknown"); } @@ -865,7 +878,13 @@ Dispatcher(void) printf(" \"%s\"", p->name); } ) - puts("]"); + puts("]"); + printf("[Qwaiting (%d):", qwaiting.count); + for_all_elts(p, qwaiting, { + printf(" \"%s\"", p->name); + } + ) + puts("]"); } #endif diff --git a/src/lwp/lwp_elf.h b/src/lwp/lwp_elf.h index 3b88ef70a..4fd9513cc 100644 --- a/src/lwp/lwp_elf.h +++ b/src/lwp/lwp_elf.h @@ -32,11 +32,11 @@ */ /* - * For common usage of elf platforms + * This file is mis-named. It is used by both a.out and elf platforms. + * It either adds the leading underscore or not as needed. * - * $Id: lwp_elf.h,v 1.2 2004/06/24 17:38:32 shadow Exp $ + * $Id: lwp_elf.h,v 1.3 2004/08/03 14:45:49 rees Exp $ */ -#include #ifndef _C_LABEL #if !defined(SYSV) && !defined(__ELF__) && !defined(AFS_SUN5_ENV) diff --git a/src/lwp/process.fbsd.s b/src/lwp/process.fbsd.s deleted file mode 100644 index 18dcacfe6..000000000 --- a/src/lwp/process.fbsd.s +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -#define IGNORE_STDS_H 1 -/* Sun 386i... I hope this does the right thing!!! - * - * Written by Derek Atkins - * (debugging help by Chris Provenzano ) - * 11/1991 - * - * "ojala que es correcto!" - */ - .file "process.s" - - .data - - .text - -/* - * struct savearea { - * char *topstack; - * } - */ - - .set topstack,0 - -/* - * savecontext(f, area1, newsp) - * int (*f)(); struct savearea *area1; char *newsp; - */ - -/* offsets, to make my life easier! */ - .set f,8 - .set area1,12 - .set newsp,16 - - -.globl PRE_Block -.globl savecontext - -savecontext: - pushl %ebp /* New Frame! */ - movl %esp,%ebp - pusha /* Push all registers */ - movl $1,PRE_Block /* Pre-emption code */ - movl area1(%ebp),%eax /* eax = base of savearea */ - movl %esp,(%eax) /* area->topstack = esp */ - movl newsp(%ebp),%eax /* get new sp into eax */ - cmpl $0,%eax - je L1 /* if new sp is 0 then dont change esp */ - movl %eax,%esp /* go ahead. make my day! */ -L1: - jmp *f(%ebp) /* ebx = &f */ - -/* Shouldnt be here....*/ - - call abort - -/* - * returnto(area2) - * struct savearea *area2; - */ - -/* stack offset */ - .set area2,8 - -.globl returnto - -returnto: - pushl %ebp - movl %esp, %ebp /* New frame, to get correct pointer */ - movl area2(%ebp),%eax /* eax = area2 */ - movl (%eax),%esp /* restore esp */ - popa - movl $0,PRE_Block /* clear it up... */ - popl %ebp - ret - -/* I see, said the blind man, as he picked up his hammer and saw! */ - pushl $1234 - call abort - - - diff --git a/src/lwp/process.i386.s b/src/lwp/process.i386.s index 951ca0d56..c3969c507 100644 --- a/src/lwp/process.i386.s +++ b/src/lwp/process.i386.s @@ -16,6 +16,8 @@ * "ojala que es correcto!" */ +#define IGNORE_STDS_H 1 +#include #include .file "process.s" diff --git a/src/ntbuild.bat b/src/ntbuild.bat index 81143e2ae..29418352f 100755 --- a/src/ntbuild.bat +++ b/src/ntbuild.bat @@ -11,11 +11,6 @@ REM Modify for local configuration; common defaults shown. REM ######################################################################## REM ######################################################################## -REM -REM NOTE: You should run NTLANG.REG before attempting to build localized -REM language files! Failure to do so will cause the resource compiler -REM and message-catalog compiler to choke when they hit unknown code pages. -REM REM NOTE: You will need to copy the NLS files into your windows\system32 REM directory prior to building non-english files. REM @@ -35,7 +30,7 @@ SET _WIN32_IE=0x400 REM ######################################################################## REM Location of base folder where source lies, build directory REM e.g. AFSROOT\SRC is source directory of the build tree (8.3 short name) -set AFSROOT=D:\Dev\AfsSorce\OpenAF~2.2 +set AFSROOT=C:\SRC\OpenAFS REM ######################################################################## REM NTMakefile required definitions: @@ -43,7 +38,8 @@ REM AFSVER_CL = version of the Microsoft compiler: REM "1200" for VC6 REM "1300" for VC7 (.NET) REM "1310" for .NET 2003 -set AFSVER_CL=1200 +REM "1400" for VC8 +set AFSVER_CL=1310 REM Location of Microsoft Visual C++ development folder (8.3 short name) set MSVCDIR=c:\progra~1\micros~2\vc98 @@ -106,12 +102,14 @@ REM AFSDEV_BIN = default build binary directories set AFSDEV_BUILDTYPE=%AFSBLD_TYPE% set AFSDEV_INCLUDE=%MSSDKDIR%\include;%MSVCDIR%\include +IF "%AFSVER_CL%" == "1400" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1310" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1300" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include IF "%AFSVER_CL%" == "1200" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atl\include;%MSVCDIR%\mfc\include set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%NTDDKDIR%\include;%W9XDDKDIR%\include set AFSDEV_LIB=%MSSDKDIR%\lib;%MSVCDIR%\lib +IF "%AFSVER_CL%" == "1400" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib IF "%AFSVER_CL%" == "1310" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib IF "%AFSVER_CL%" == "1300" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib IF "%AFSVER_CL%" == "1200" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\mfc\lib diff --git a/src/ptserver/NTMakefile b/src/ptserver/NTMakefile index ae2c058a9..78b75ea68 100644 --- a/src/ptserver/NTMakefile +++ b/src/ptserver/NTMakefile @@ -73,7 +73,7 @@ PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib !ENDIF $(PTSERVER): $(PTSERVER_EXEOBJS) $(RXKADOBJS) $(PTSERVER_EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) @@ -104,7 +104,7 @@ PTS_EXELIBS =\ $(DESTDIR)\lib\cm_dns.obj $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) @@ -180,16 +180,16 @@ clean:: TEST_LIBS = $(PTS_EXELIBS) $(OUT)\readgroup.exe: $(OUT)\readgroup.obj $(LIBFILE) $(TEST_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(OUT)\readpwd.exe: $(OUT)\readpwd.obj $(LIBFILE) $(TEST_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(OUT)\testpt.exe: $(OUT)\testpt.obj $(LIBFILE) $(TEST_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(OUT)\db_verify.exe: $(OUT)\db_verify.obj $(OUT)\pterror.obj $(OUT)\display.obj $(LIBFILE) $(TEST_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib mkdir: diff --git a/src/rx/DUX/rx_knet.c b/src/rx/DUX/rx_knet.c index 7b02b03fb..c82c2812d 100644 --- a/src/rx/DUX/rx_knet.c +++ b/src/rx/DUX/rx_knet.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.10 2003/07/15 23:16:15 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.11 2004/08/09 00:58:50 shadow Exp $"); #ifdef AFS_DUX40_ENV #include "rx/rx_kcommon.h" @@ -22,11 +22,12 @@ static void rxk_input(struct mbuf *am, int iphlen); static void rxk_fasttimo(void); /* start intercepting basic calls */ +void rxk_init() { register struct protosw *tpro, *last; if (rxk_initDone) - return 0; + return; last = inetdomain.dom_protoswNPROTOSW; for (tpro = inetdomain.dom_protosw; tpro < last; tpro++) @@ -42,7 +43,7 @@ rxk_init() * until we have something to do */ rxk_initDone = 1; - return 0; + return; } osi_Panic("inet:no udp"); } diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index d407e6905..ee15e7ea1 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.20 2004/06/21 20:06:26 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23 2004/07/29 02:46:48 shadow Exp $"); #include #ifdef AFS_LINUX22_ENV @@ -30,7 +30,7 @@ RCSID * open and bind RX socket */ struct osi_socket * -rxk_NewSocket(short aport) +rxk_NewSocketHost(afs_uint32 ahost, short aport) { struct socket *sockp; struct sockaddr_in myaddr; @@ -47,7 +47,7 @@ rxk_NewSocket(short aport) /* Bind socket */ myaddr.sin_family = AF_INET; - myaddr.sin_addr.s_addr = htonl(INADDR_ANY); + myaddr.sin_addr.s_addr = ahost; myaddr.sin_port = aport; code = sockp->ops->bind(sockp, (struct sockaddr *)&myaddr, sizeof(myaddr)); @@ -64,6 +64,11 @@ rxk_NewSocket(short aport) return (struct osi_socket *)sockp; } +struct osi_socket * +rxk_NewSocket(short aport) +{ + return rxk_NewSocketHost(htonl(INADDR_ANY), aport); +} /* free socket allocated by osi_NetSocket */ int diff --git a/src/rx/SOLARIS/rx_knet.c b/src/rx/SOLARIS/rx_knet.c index 678e2769f..8505fffc3 100644 --- a/src/rx/SOLARIS/rx_knet.c +++ b/src/rx/SOLARIS/rx_knet.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.17 2004/06/24 17:38:34 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.19 2004/07/28 22:34:13 shadow Exp $"); #ifdef AFS_SUN5_ENV #include "rx/rx_kcommon.h" @@ -222,7 +222,7 @@ struct sockaddr_in rx_sockaddr; /* Allocate a new socket at specified port in network byte order. */ struct osi_socket * -rxk_NewSocket(short aport) +rxk_NewSocketHost(afs_uint32 ahost, short aport) { vnode_t *accessvp; struct sonode *so; @@ -296,7 +296,8 @@ rxk_NewSocket(short aport) addr.sin_family = AF_INET; addr.sin_port = aport; - addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_addr.s_addr = ahost; /* I wonder what the odds are on + needing to unbyteswap this */ error = sockfs_sobind(so, (struct sockaddr *)&addr, sizeof(addr), 0, 0); if (error != 0) { return NULL; @@ -317,6 +318,12 @@ rxk_NewSocket(short aport) return (struct osi_socket *)so; } +struct osi_socket * +rxk_NewSocket(short aport) +{ + return rxk_NewSocketHost(htonl(INADDR_ANY), aport); +} + int osi_FreeSocket(register struct osi_socket *asocket) { @@ -341,14 +348,11 @@ osi_FreeSocket(register struct osi_socket *asocket) afs_osi_Sleep(&rxk_ListenerPid); } -#ifdef AFS_SUN510_ENV + /* Was sockfs_sounbind(so, 0); sockfs_sockfree(so); That's wrong */ vp = SOTOV(so); VOP_CLOSE(vp, FREAD|FWRITE, 1, (offset_t)0, CRED()); VN_RELE(vp); -#else - sockfs_sounbind(so, 0); - sockfs_sockfree(so); -#endif + return 0; } @@ -506,7 +510,7 @@ dev_t afs_udp_rdev = (dev_t) 0; /* Allocate a new socket at specified port in network byte order. */ struct osi_socket * -rxk_NewSocket(short aport) +rxk_NewSocketHost(afs_uint32 ahost, short aport) { TIUSER *udp_tiptr; struct t_bind *reqp, *rspp; @@ -537,7 +541,7 @@ rxk_NewSocket(short aport) myaddrp = (struct sockaddr_in *)reqp->addr.buf; myaddrp->sin_family = AF_INET; myaddrp->sin_port = aport; - myaddrp->sin_addr.s_addr = INADDR_ANY; /* XXX Was 0 XXX */ + myaddrp->sin_addr.s_addr = ahost; /* byteswap? */ code = t_kbind(udp_tiptr, reqp, rspp); if (code) { @@ -567,6 +571,11 @@ rxk_NewSocket(short aport) return (struct osi_socket *)udp_tiptr; } +struct osi_socket * +rxk_NewSocket(short aport) +{ + return rxk_NewSocketHost(htonl(INADDR_ANY), aport); +} int osi_FreeSocket(register struct osi_socket *asocket) diff --git a/src/rx/UKERNEL/rx_knet.c b/src/rx/UKERNEL/rx_knet.c index 80a2bcc84..3cc4db24d 100644 --- a/src/rx/UKERNEL/rx_knet.c +++ b/src/rx/UKERNEL/rx_knet.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.9 2004/04/18 06:10:35 kolya Exp $"); + ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.10 2004/07/28 22:34:14 shadow Exp $"); #include "rx/rx_kcommon.h" @@ -170,7 +170,7 @@ rx_ServerProc(void) * we start the receiver threads. */ struct osi_socket * -rxk_NewSocket(short aport) +rxk_NewSocketHost(afs_uint32 ahost, short aport) { struct usr_socket *usockp; @@ -182,6 +182,12 @@ rxk_NewSocket(short aport) return (struct osi_socket *)usockp; } +struct osi_socket * +rxk_NewSocket(short aport) +{ + return rxk_NewSocketHost(htonl(INADDR_ANY), aport); +} + /* * This routine is called from rxk_Listener. By this time rx_port * is set to 7001 and rx_socket points to the socket buffer diff --git a/src/rx/rx.c b/src/rx/rx.c index 6930ee4c1..805cf2fda 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -17,7 +17,7 @@ #endif RCSID - ("$Header: /cvs/openafs/src/rx/rx.c,v 1.56 2004/06/02 06:08:01 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58 2004/08/04 19:41:53 shadow Exp $"); #ifdef KERNEL #include "afs/sysincludes.h" @@ -370,8 +370,8 @@ static int rxinit_status = 1; #define UNLOCK_RX_INIT #endif -int -rx_Init(u_int port) +int +rx_InitHost(u_int host, u_int port) { #ifdef KERNEL osi_timeval_t tv; @@ -407,7 +407,7 @@ rx_Init(u_int port) /* Allocate and initialize a socket for client and perhaps server * connections. */ - rx_socket = rxi_GetUDPSocket((u_short) port); + rx_socket = rxi_GetHostUDPSocket(host, (u_short) port); if (rx_socket == OSI_NULLSOCKET) { UNLOCK_RX_INIT return RX_ADDRINUSE; } @@ -534,6 +534,11 @@ rx_Init(u_int port) UNLOCK_RX_INIT return tmp_status; } +int rx_Init(u_int port) +{ + return rx_InitHost(htonl(INADDR_ANY), port); +} + /* called with unincremented nRequestsRunning to see if it is OK to start * a new thread in this service. Could be "no" for two reasons: over the * max quota, or would prevent others from reaching their min quota. @@ -1247,7 +1252,7 @@ rx_NewService(u_short port, u_short serviceId, char *serviceName, if (socket == OSI_NULLSOCKET) { /* If we don't already have a socket (from another * service on same port) get a new one */ - socket = rxi_GetUDPSocket(port); + socket = rxi_GetHostUDPSocket(htonl(INADDR_ANY), port); if (socket == OSI_NULLSOCKET) { AFS_RXGUNLOCK(); USERPRI; @@ -2304,7 +2309,8 @@ rxi_FindConnection(osi_socket socket, register afs_int32 host, break; if (type == RX_CLIENT_CONNECTION && pp->port == port) break; - if (type == RX_CLIENT_CONNECTION && (conn->epoch & 0x80000000)) + /* So what happens when it's a callback connection? */ + if (/*type == RX_CLIENT_CONNECTION &&*/ (conn->epoch & 0x80000000)) break; } if (!flag) { diff --git a/src/rx/rx.h b/src/rx/rx.h index deaac980a..c4da3756a 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -96,6 +96,7 @@ #ifndef KERNEL typedef void (*rx_destructor_t) (void *); int rx_KeyCreate(rx_destructor_t); +osi_socket rxi_GetHostUDPSocket(u_int host, u_short port); osi_socket rxi_GetUDPSocket(u_short port); #endif /* KERNEL */ diff --git a/src/rx/rx_globals.c b/src/rx/rx_globals.c index ea23f8150..216e057a7 100644 --- a/src/rx/rx_globals.c +++ b/src/rx/rx_globals.c @@ -9,6 +9,15 @@ /* RX: Globals for internal use, basically */ +/* This controls the size of an fd_set; it must be defined early before + * the system headers define that type and the macros that operate on it. + * Its value should be as large as the maximum file descriptor limit we + * are likely to run into on any platform. Right now, that is 65536 + * which is the default hard fd limit on Solaris 9 */ +#ifndef _WIN32 +#define FD_SETSIZE 65536 +#endif + #include #ifdef KERNEL #include "afs/param.h" @@ -17,7 +26,7 @@ #endif RCSID - ("$Header: /cvs/openafs/src/rx/rx_globals.c,v 1.6 2003/07/15 23:16:09 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/rx_globals.c,v 1.8 2004/07/19 14:39:42 jaltman Exp $"); /* Enable data initialization when the header file is included */ #define INIT(stuff) = stuff diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 79f4e38af..f13670663 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.41 2004/03/10 23:01:54 rees Exp $"); + ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44 2004/08/08 19:17:05 shadow Exp $"); #include "rx/rx_kcommon.h" @@ -30,6 +30,7 @@ int (*rxk_PacketArrivalProc) (register struct rx_packet * ahandle, register stru int (*rxk_GetPacketProc) (char **ahandle, int asize); #endif +struct osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport); extern struct interfaceAddr afs_cb_interface; rxk_ports_t rxk_ports; @@ -102,16 +103,21 @@ rxk_shutdownPorts(void) } osi_socket -rxi_GetUDPSocket(u_short port) +rxi_GetHostUDPSocket(u_int host, u_short port) { struct osi_socket *sockp; - sockp = (struct osi_socket *)rxk_NewSocket(port); + sockp = (struct osi_socket *)rxk_NewSocketHost(host, port); if (sockp == (struct osi_socket *)0) return OSI_NULLSOCKET; rxk_AddPort(port, (char *)sockp); return (osi_socket) sockp; } +osi_socket +rxi_GetUDPSocket(u_short port) +{ + return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port); +} void osi_Panic(msg, a1, a2, a3) @@ -756,7 +762,7 @@ rxi_FindIfnet(afs_uint32 addr, afs_uint32 * maskp) * in network byte order. */ struct osi_socket * -rxk_NewSocket(short aport) +rxk_NewSocketHost(afs_uint32 ahost, short aport) { register afs_int32 code; struct socket *newSocket; @@ -816,7 +822,7 @@ rxk_NewSocket(short aport) memset(&myaddr, 0, sizeof myaddr); myaddr.sin_family = AF_INET; myaddr.sin_port = aport; - myaddr.sin_addr.s_addr = 0; + myaddr.sin_addr.s_addr = ahost; #ifdef STRUCT_SOCKADDR_HAS_SA_LEN myaddr.sin_len = sizeof(myaddr); #endif @@ -908,6 +914,11 @@ rxk_NewSocket(short aport) return (struct osi_socket *)0; } +struct osi_socket * +rxk_NewSocket(short aport) +{ + return rxk_NewSocketHost(0, aport); +} /* free socket allocated by rxk_NewSocket */ int diff --git a/src/rx/rx_lwp.c b/src/rx/rx_lwp.c index 8847d68c9..f2aead7e0 100644 --- a/src/rx/rx_lwp.c +++ b/src/rx/rx_lwp.c @@ -9,11 +9,20 @@ /* rx_user.c contains routines specific to the user space UNIX implementation of rx */ +/* This controls the size of an fd_set; it must be defined early before + * the system headers define that type and the macros that operate on it. + * Its value should be as large as the maximum file descriptor limit we + * are likely to run into on any platform. Right now, that is 65536 + * which is the default hard fd limit on Solaris 9 */ +#ifndef _WIN32 +#define FD_SETSIZE 65536 +#endif + #include #include RCSID - ("$Header: /cvs/openafs/src/rx/rx_lwp.c,v 1.15 2003/11/29 22:08:16 jaltman Exp $"); + ("$Header: /cvs/openafs/src/rx/rx_lwp.c,v 1.17 2004/07/19 14:39:42 jaltman Exp $"); # include /* fd_set on older platforms */ # include diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index a8f071fba..f06ec425d 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -313,6 +313,7 @@ extern int rxk_initDone; extern int rxk_DelPort(u_short aport); extern void rxk_shutdownPorts(void); extern osi_socket rxi_GetUDPSocket(u_short port); +extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port); extern void osi_Panic(); extern int osi_utoa(char *buf, size_t len, unsigned long val); extern void rxi_InitPeerParams(register struct rx_peer *pp); diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c index c87c9ba03..6a578a9c4 100644 --- a/src/rx/rx_user.c +++ b/src/rx/rx_user.c @@ -13,7 +13,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.16 2004/03/06 02:42:53 rees Exp $"); + ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.18 2004/08/06 20:04:07 shadow Exp $"); # include # include @@ -94,7 +94,7 @@ pthread_mutex_t rx_if_mutex; * failure. Port must be in network byte order. */ osi_socket -rxi_GetUDPSocket(u_short port) +rxi_GetHostUDPSocket(u_int ahost, u_short port) { int binds, code = 0; osi_socket socketFd = OSI_NULLSOCKET; @@ -121,7 +121,7 @@ rxi_GetUDPSocket(u_short port) goto error; } - taddr.sin_addr.s_addr = INADDR_ANY; + taddr.sin_addr.s_addr = ahost; taddr.sin_family = AF_INET; taddr.sin_port = (u_short) port; #ifdef STRUCT_SOCKADDR_HAS_SA_LEN @@ -201,6 +201,12 @@ rxi_GetUDPSocket(u_short port) return OSI_NULLSOCKET; } +osi_socket +rxi_GetUDPSocket(u_short port) +{ + return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port); +} + void osi_Panic(char *msg, int a1, int a2, int a3) { diff --git a/src/rx/test/NTMakefile b/src/rx/test/NTMakefile index c058e129d..9e255640c 100644 --- a/src/rx/test/NTMakefile +++ b/src/rx/test/NTMakefile @@ -5,7 +5,7 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html -AFSDEV_AUXCDEFINES = -DRXDEBUG +AFSDEV_AUXCDEFINES = -DRXDEBUG -DAFS_PTHREAD_ENV RELDIR=rx\test !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME) @@ -20,16 +20,27 @@ LIBS = \ RXTESTOBJS = $(OUT)\testclient.obj $(OUT)\testserver.obj - tests: $(OUT)\testclient.exe $(OUT)\testserver.exe $(OUT)\tableGen.exe $(OUT)\generator.exe -testclient.exe: $(OUT)\testclient.obj $(LIBS) +$(OUT)\testclient.exe: $(OUT)\testclient.obj $(LIBS) + $(EXECONLINK) + +$(OUT)\testserver.exe: $(OUT)\testserver.obj $(LIBS) $(EXECONLINK) -testserver.exe: $(OUT)\testserver.obj $(LIBS) +$(OUT)\tableGen.exe: $(OUT)\tableGen.obj $(LIBS) + $(EXECONLINK) + +$(OUT)\generator.exe: $(OUT)\generator.obj $(LIBS) $(EXECONLINK) $(RXTESTOBJS): ..\rx_clock.h ..\rx_queue.h ..\rx_event.h ..\rx.h mkdir: +install: tests + +install9x: tests + +clean:: + $(DEL) $(TESTS) diff --git a/src/rxgk/Makefile.am b/src/rxgk/Makefile.am new file mode 100644 index 000000000..faf2c50e2 --- /dev/null +++ b/src/rxgk/Makefile.am @@ -0,0 +1,80 @@ +# +# $Id: Makefile.am,v 1.1 2004/08/08 19:21:33 shadow Exp $ +# + +include $(top_srcdir)/Makefile.am.common + +noinst_LTLIBRARIES = librxgkclient.la librxgkserver.la + +noinst_PROGRAMS = test_client test_server + +INCLUDES += -I. \ + -I$(srcdir) \ + -I../include \ + -I$(srcdir)/../include \ + -I.. -I$(srcdir)/.. \ + $(INC_roken) \ + $(KRB5_INC_FLAGS) + +librxgkclient_la_SOURCES = \ + rxgk_locl.h \ + rxgk_proto.h \ + rxgk_clnt.c \ + rxgk_info.c \ + rxgk_crpc.c \ + rxgk_crkrb.c \ + rxgk_common.c \ + rxgk_proto.ydr.c \ + rxgk_proto.cs.c + +librxgkserver_la_SOURCES = \ + rxgk_locl.h \ + rxgk_proto.h \ + rxgk_serv.c \ + rxgk_info.c \ + rxgk_srpc.c \ + rxgk_crkrb.c \ + rxgk_common.c \ + rxgk_proto.ydr.c \ + rxgk_proto.ss.c + +LIBYDR = \ + rxgk_proto.cs.c \ + rxgk_proto.ss.c \ + rxgk_proto.ydr.c \ + rxgk_proto.h \ + rxgk_proto.cs.h \ + rxgk_proto.ss.h + +LIBTYDR = \ + test.cs.h \ + test.ss.h \ + test.ss.c \ + test.cs.c \ + test.ydr.c \ + test.h + +common_LDADD = \ + ../rx/librx.la \ + -L../lwp -llwp $(PLWP_LIB_FLAGS) \ + $(KRB5_LIB_FLAGS) + +test_client_SOURCES = test_client.c test.cs.c +test_server_SOURCES = test_server.c test.ss.c + +test_client_LDADD = librxgkclient.la $(common_LDADD) +test_server_LDADD = librxgkserver.la $(common_LDADD) + +$(librxgkclient_la_OBJECTS) $(librxgkserver_la_OBJECTS): $(LIBYDR) + +$(test_server_OBJECTS) $(test_client_OBJECTS): $(LIBTYDR) + +$(LIBYDR): rxgk_proto.xg + ../ydr/ydr $(srcdir)/rxgk_proto.xg + +$(LIBTYDR): test.xg + ../ydr/ydr $(srcdir)/test.xg + +CLEANFILES = $(LIBYDR) $(LIBTYDR) + +LDADD = $(KRB5_LIB_FLAGS) diff --git a/src/rxgk/Makefile.in b/src/rxgk/Makefile.in new file mode 100644 index 000000000..904406048 --- /dev/null +++ b/src/rxgk/Makefile.in @@ -0,0 +1,933 @@ +# Makefile.in generated by automake 1.8.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $ +# + +# $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $ + +# $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $ + + +SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) $(test_client_SOURCES) $(test_server_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.am.common \ + $(top_srcdir)/cf/Makefile.am.common +noinst_PROGRAMS = test_client$(EXEEXT) test_server$(EXEEXT) +subdir = rxgk +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/cf/__extentions__.m4 \ + $(top_srcdir)/cf/arla-canonical.m4 \ + $(top_srcdir)/cf/arla-openssl-compat.m4 \ + $(top_srcdir)/cf/broken-getaddrinfo.m4 \ + $(top_srcdir)/cf/broken-getnameinfo.m4 \ + $(top_srcdir)/cf/broken-glob.m4 \ + $(top_srcdir)/cf/broken-realloc.m4 \ + $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \ + $(top_srcdir)/cf/broken2.m4 \ + $(top_srcdir)/cf/bsd-func-lockmgr.m4 \ + $(top_srcdir)/cf/bsd-func-lockstatus.m4 \ + $(top_srcdir)/cf/bsd-func-selrecord.m4 \ + $(top_srcdir)/cf/bsd-func-suser.m4 \ + $(top_srcdir)/cf/bsd-func-vfs-getnewfsid.m4 \ + $(top_srcdir)/cf/bsd-header-vnode-if-h.m4 \ + $(top_srcdir)/cf/bsd-uvm-only.m4 \ + $(top_srcdir)/cf/bsd-vfs-busy.m4 \ + $(top_srcdir)/cf/bsd-vfs-object-create.m4 \ + $(top_srcdir)/cf/bsd-vget.m4 $(top_srcdir)/cf/bsd-vop-lock.m4 \ + $(top_srcdir)/cf/c-attribute.m4 $(top_srcdir)/cf/c-function.m4 \ + $(top_srcdir)/cf/check-declaration.m4 \ + $(top_srcdir)/cf/check-dirsiz.m4 \ + $(top_srcdir)/cf/check-glibc.m4 $(top_srcdir)/cf/check-kafs.m4 \ + $(top_srcdir)/cf/check-kerberos.m4 \ + $(top_srcdir)/cf/check-kernel-func.m4 \ + $(top_srcdir)/cf/check-kernel-funcs.m4 \ + $(top_srcdir)/cf/check-kernel-var.m4 \ + $(top_srcdir)/cf/check-kernel-vop-t.m4 \ + $(top_srcdir)/cf/check-kernel.m4 $(top_srcdir)/cf/check-lfs.m4 \ + $(top_srcdir)/cf/check-man.m4 \ + $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \ + $(top_srcdir)/cf/check-roken.m4 $(top_srcdir)/cf/check-sl.m4 \ + $(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \ + $(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/elf-object-format.m4 \ + $(top_srcdir)/cf/find-func-no-libs.m4 \ + $(top_srcdir)/cf/find-func-no-libs2.m4 \ + $(top_srcdir)/cf/find-func.m4 \ + $(top_srcdir)/cf/find-if-not-broken.m4 \ + $(top_srcdir)/cf/func-ntohl.m4 \ + $(top_srcdir)/cf/have-kernel-struct-field.m4 \ + $(top_srcdir)/cf/have-linux-kernel-type.m4 \ + $(top_srcdir)/cf/have-linux-kernel-types.m4 \ + $(top_srcdir)/cf/have-struct-field.m4 \ + $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/have-types.m4 \ + $(top_srcdir)/cf/header-dirent-dir-h.m4 \ + $(top_srcdir)/cf/kafs-settoken-rxkad.m4 \ + $(top_srcdir)/cf/kernel-have-def.m4 \ + $(top_srcdir)/cf/kernel-need-proto.m4 \ + $(top_srcdir)/cf/kernel.m4 $(top_srcdir)/cf/krb-bigendian.m4 \ + $(top_srcdir)/cf/krb-func-getlogin.m4 \ + $(top_srcdir)/cf/krb-ipv6.m4 \ + $(top_srcdir)/cf/krb-struct-spwd.m4 \ + $(top_srcdir)/cf/krb-struct-winsize.m4 \ + $(top_srcdir)/cf/krb-sys-aix.m4 \ + $(top_srcdir)/cf/krb-version.m4 \ + $(top_srcdir)/cf/linux-func-init-mutex.m4 \ + $(top_srcdir)/cf/linux-getattr-three-args.m4 \ + $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \ + $(top_srcdir)/cf/need-proto.m4 \ + $(top_srcdir)/cf/osf-func-ubc-lookup.m4 \ + $(top_srcdir)/cf/osf-func-vfs-name-hash.m4 \ + $(top_srcdir)/cf/prog-cc-flags.m4 \ + $(top_srcdir)/cf/proto-compat.m4 \ + $(top_srcdir)/cf/retsigtype.m4 $(top_srcdir)/cf/roken-frag.m4 \ + $(top_srcdir)/cf/subst-val.m4 $(top_srcdir)/cf/test-package.m4 \ + $(top_srcdir)/cf/try-compile-kernel.m4 \ + $(top_srcdir)/cf/try-cpp-kernel.m4 \ + $(top_srcdir)/cf/type-iovec.m4 $(top_srcdir)/cf/type-msghdr.m4 \ + $(top_srcdir)/cf/werror.m4 $(top_srcdir)/cf/wflags.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +librxgkclient_la_LIBADD = +am_librxgkclient_la_OBJECTS = rxgk_clnt.lo rxgk_info.lo rxgk_crpc.lo \ + rxgk_crkrb.lo rxgk_common.lo rxgk_proto.ydr.lo \ + rxgk_proto.cs.lo +librxgkclient_la_OBJECTS = $(am_librxgkclient_la_OBJECTS) +librxgkserver_la_LIBADD = +am_librxgkserver_la_OBJECTS = rxgk_serv.lo rxgk_info.lo rxgk_srpc.lo \ + rxgk_crkrb.lo rxgk_common.lo rxgk_proto.ydr.lo \ + rxgk_proto.ss.lo +librxgkserver_la_OBJECTS = $(am_librxgkserver_la_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_test_client_OBJECTS = test_client.$(OBJEXT) test.cs.$(OBJEXT) +test_client_OBJECTS = $(am_test_client_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = ../rx/librx.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +test_client_DEPENDENCIES = librxgkclient.la $(am__DEPENDENCIES_2) +am_test_server_OBJECTS = test_server.$(OBJEXT) test.ss.$(OBJEXT) +test_server_OBJECTS = $(am_test_server_OBJECTS) +test_server_DEPENDENCIES = librxgkserver.la $(am__DEPENDENCIES_2) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) \ + $(test_client_SOURCES) $(test_server_SOURCES) +DIST_SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) \ + $(test_client_SOURCES) $(test_server_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AFS_EXTRA_DEFS = @AFS_EXTRA_DEFS@ +AFS_EXTRA_LD = @AFS_EXTRA_LD@ +AFS_EXTRA_LIBS = @AFS_EXTRA_LIBS@ +AFS_EXTRA_OBJS = @AFS_EXTRA_OBJS@ +AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@ +AMTAR = @AMTAR@ +AR = @AR@ +ARLACACHEDIR = @ARLACACHEDIR@ +ARLACONFFILE = @ARLACONFFILE@ +ARLA_CONF_HIGHBYTES = @ARLA_CONF_HIGHBYTES@ +ARLA_CONF_HIGHVNODES = @ARLA_CONF_HIGHVNODES@ +ARLA_CONF_LOWBYTES = @ARLA_CONF_LOWBYTES@ +ARLA_CONF_LOWVNODES = @ARLA_CONF_LOWVNODES@ +ARLA_KNFS = @ARLA_KNFS@ +ARLA_LOCAL_ROKEN_FALSE = @ARLA_LOCAL_ROKEN_FALSE@ +ARLA_LOCAL_ROKEN_TRUE = @ARLA_LOCAL_ROKEN_TRUE@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BSDMAKE = @BSDMAKE@ +BSD_WERROR = @BSD_WERROR@ +CANONICAL_HOST = @CANONICAL_HOST@ +CATMAN = @CATMAN@ +CATMANEXT = @CATMANEXT@ +CATMAN_FALSE = @CATMAN_FALSE@ +CATMAN_TRUE = @CATMAN_TRUE@ +CC = @CC@ +CFLAGS = @CFLAGS@ +COMERR_CPPFLAGS = @COMERR_CPPFLAGS@ +COM_APPLE_KERNEL_BSD = @COM_APPLE_KERNEL_BSD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBLIB = @DBLIB@ +DCE_FALSE = @DCE_FALSE@ +DCE_TRUE = @DCE_TRUE@ +DEFS = @DEFS@ +DEPEND_sl = @DEPEND_sl@ +DIR_roken = @DIR_roken@ +DIR_sl = @DIR_sl@ +DVI2PS = @DVI2PS@ +DVIPS = @DVIPS@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FBSD5_FALSE = @FBSD5_FALSE@ +FBSD5_TRUE = @FBSD5_TRUE@ +FFLAGS = @FFLAGS@ +FREEBSD_GENSETDEFS = @FREEBSD_GENSETDEFS@ +GCC = @GCC@ +GROFF = @GROFF@ +GUILE_GTK = @GUILE_GTK@ +HAVE_DB1_FALSE = @HAVE_DB1_FALSE@ +HAVE_DB1_TRUE = @HAVE_DB1_TRUE@ +HAVE_DB3_FALSE = @HAVE_DB3_FALSE@ +HAVE_DB3_TRUE = @HAVE_DB3_TRUE@ +HAVE_NDBM_FALSE = @HAVE_NDBM_FALSE@ +HAVE_NDBM_TRUE = @HAVE_NDBM_TRUE@ +INCLUDES_roken = @INCLUDES_roken@ +INCLUDE_readline = @INCLUDE_readline@ +INC_roken = @INC_roken@ +INC_sl = @INC_sl@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KAFS_CPPFLAGS = @KAFS_CPPFLAGS@ +KAFS_LIBS = @KAFS_LIBS@ +KERNEL_CC = @KERNEL_CC@ +KERNEL_CFLAGS = @KERNEL_CFLAGS@ +KERNEL_CPPFLAGS = @KERNEL_CPPFLAGS@ +KERNEL_HDRS = @KERNEL_HDRS@ +KERNEL_INCLUDE = @KERNEL_INCLUDE@ +KERNEL_LD = @KERNEL_LD@ +KERNEL_LD_FLAGS = @KERNEL_LD_FLAGS@ +KERNEL_SRCS = @KERNEL_SRCS@ +KRB4_FALSE = @KRB4_FALSE@ +KRB4_INC_DIR = @KRB4_INC_DIR@ +KRB4_INC_FLAGS = @KRB4_INC_FLAGS@ +KRB4_LIB_DIR = @KRB4_LIB_DIR@ +KRB4_LIB_FLAGS = @KRB4_LIB_FLAGS@ +KRB4_LIB_LIBS = @KRB4_LIB_LIBS@ +KRB4_TRUE = @KRB4_TRUE@ +KRB5_FALSE = @KRB5_FALSE@ +KRB5_INC_DIR = @KRB5_INC_DIR@ +KRB5_INC_FLAGS = @KRB5_INC_FLAGS@ +KRB5_LIB_DIR = @KRB5_LIB_DIR@ +KRB5_LIB_FLAGS = @KRB5_LIB_FLAGS@ +KRB5_LIB_LIBS = @KRB5_LIB_LIBS@ +KRB5_TRUE = @KRB5_TRUE@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_NDBM = @LIB_NDBM@ +LIB_bswap16 = @LIB_bswap16@ +LIB_bswap32 = @LIB_bswap32@ +LIB_crypt = @LIB_crypt@ +LIB_db_create = @LIB_db_create@ +LIB_dbm_firstkey = @LIB_dbm_firstkey@ +LIB_dbopen = @LIB_dbopen@ +LIB_dn_expand = @LIB_dn_expand@ +LIB_el_init = @LIB_el_init@ +LIB_freeaddrinfo = @LIB_freeaddrinfo@ +LIB_gai_strerror = @LIB_gai_strerror@ +LIB_getaddrinfo = @LIB_getaddrinfo@ +LIB_gethostbyname = @LIB_gethostbyname@ +LIB_gethostbyname2 = @LIB_gethostbyname2@ +LIB_getnameinfo = @LIB_getnameinfo@ +LIB_getsockopt = @LIB_getsockopt@ +LIB_hstrerror = @LIB_hstrerror@ +LIB_pidfile = @LIB_pidfile@ +LIB_pthread_create = @LIB_pthread_create@ +LIB_readline = @LIB_readline@ +LIB_res_init = @LIB_res_init@ +LIB_res_nsearch = @LIB_res_nsearch@ +LIB_res_search = @LIB_res_search@ +LIB_roken = @LIB_roken@ +LIB_setsockopt = @LIB_setsockopt@ +LIB_sl = @LIB_sl@ +LIB_socket = @LIB_socket@ +LIB_syslog = @LIB_syslog@ +LIB_tgetent = @LIB_tgetent@ +LINUX_IA64_FALSE = @LINUX_IA64_FALSE@ +LINUX_IA64_TRUE = @LINUX_IA64_TRUE@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LWP_C = @LWP_C@ +LWP_H = @LWP_H@ +LWP_O = @LWP_O@ +LWP_PROCESS = @LWP_PROCESS@ +LWP_REDZONE_FALSE = @LWP_REDZONE_FALSE@ +LWP_REDZONE_TRUE = @LWP_REDZONE_TRUE@ +MACOSX_FALSE = @MACOSX_FALSE@ +MACOSX_TRUE = @MACOSX_TRUE@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MAKE_X_PROGS_BIN = @MAKE_X_PROGS_BIN@ +MILKO_ROOT = @MILKO_ROOT@ +MODLOAD = @MODLOAD@ +MODULE = @MODULE@ +MODUNLOAD = @MODUNLOAD@ +NNPFS_AFS_READDIR_FALSE = @NNPFS_AFS_READDIR_FALSE@ +NNPFS_AFS_READDIR_TRUE = @NNPFS_AFS_READDIR_TRUE@ +NNPFS_SRCS = @NNPFS_SRCS@ +NNPFS_SUBDIR = @NNPFS_SUBDIR@ +NROFF = @NROFF@ +OBJEXT = @OBJEXT@ +OSF1_FALSE = @OSF1_FALSE@ +OSF1_TRUE = @OSF1_TRUE@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PLWP_INC_FLAGS = @PLWP_INC_FLAGS@ +PLWP_LIB_FLAGS = @PLWP_LIB_FLAGS@ +RANLIB = @RANLIB@ +ROKEN_H = @ROKEN_H@ +RXKAD_FALSE = @RXKAD_FALSE@ +RXKAD_LIBS = @RXKAD_LIBS@ +RXKAD_TRUE = @RXKAD_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SL_H = @SL_H@ +STRIP = @STRIP@ +SYMORDER = @SYMORDER@ +SYS = @SYS@ +TEXI2DVI = @TEXI2DVI@ +TEXI2HTML = @TEXI2HTML@ +TEXI2PDF = @TEXI2PDF@ +VERSION = @VERSION@ +VNODE_IF_H = @VNODE_IF_H@ +VOID_RETSIGTYPE = @VOID_RETSIGTYPE@ +WFLAGS = @WFLAGS@ +WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@ +WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +YACC = @YACC@ +YDR_CPPFLAGS = @YDR_CPPFLAGS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_cv_prog_getconf = @ac_cv_prog_getconf@ +am__leading_dot = @am__leading_dot@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +chmod = @chmod@ +datadir = @datadir@ +do_roken_rename_FALSE = @do_roken_rename_FALSE@ +do_roken_rename_TRUE = @do_roken_rename_TRUE@ +editline_OBJS = @editline_OBJS@ +editline_dir = @editline_dir@ +exec_prefix = @exec_prefix@ +have_err_h_FALSE = @have_err_h_FALSE@ +have_err_h_TRUE = @have_err_h_TRUE@ +have_fnmatch_h_FALSE = @have_fnmatch_h_FALSE@ +have_fnmatch_h_TRUE = @have_fnmatch_h_TRUE@ +have_glob_h_FALSE = @have_glob_h_FALSE@ +have_glob_h_TRUE = @have_glob_h_TRUE@ +have_ifaddrs_h_FALSE = @have_ifaddrs_h_FALSE@ +have_ifaddrs_h_TRUE = @have_ifaddrs_h_TRUE@ +have_vis_h_FALSE = @have_vis_h_FALSE@ +have_vis_h_TRUE = @have_vis_h_TRUE@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUFFIXES = .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x +INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) $(INC_roken) -I. \ + -I$(srcdir) \ + -I../include \ + -I$(srcdir)/../include \ + -I.. -I$(srcdir)/.. \ + $(INC_roken) \ + $(KRB5_INC_FLAGS) + +@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME +AM_CFLAGS = $(WFLAGS) +CP = cp +buildinclude = $(top_builddir)/include +LIB_XauReadAuth = @LIB_XauReadAuth@ +LIB_dlopen = @LIB_dlopen@ +LIB_getattr = @LIB_getattr@ +LIB_getpwent_r = @LIB_getpwent_r@ +LIB_getpwnam_r = @LIB_getpwnam_r@ +LIB_logout = @LIB_logout@ +LIB_logwtmp = @LIB_logwtmp@ +LIB_odm_initialize = @LIB_odm_initialize@ +LIB_openpty = @LIB_openpty@ +LIB_setpcred = @LIB_setpcred@ +HESIODLIB = @HESIODLIB@ +HESIODINCLUDE = @HESIODINCLUDE@ +INCLUDE_hesiod = @INCLUDE_hesiod@ +LIB_hesiod = @LIB_hesiod@ +INCLUDE_krb4 = @INCLUDE_krb4@ +LIB_krb4 = @LIB_krb4@ +INCLUDE_openldap = @INCLUDE_openldap@ +LIB_openldap = @LIB_openldap@ +NROFF_MAN = groff -mandoc -Tascii +CHECK_LOCAL = $(PROGRAMS) +noinst_LTLIBRARIES = librxgkclient.la librxgkserver.la +librxgkclient_la_SOURCES = \ + rxgk_locl.h \ + rxgk_proto.h \ + rxgk_clnt.c \ + rxgk_info.c \ + rxgk_crpc.c \ + rxgk_crkrb.c \ + rxgk_common.c \ + rxgk_proto.ydr.c \ + rxgk_proto.cs.c + +librxgkserver_la_SOURCES = \ + rxgk_locl.h \ + rxgk_proto.h \ + rxgk_serv.c \ + rxgk_info.c \ + rxgk_srpc.c \ + rxgk_crkrb.c \ + rxgk_common.c \ + rxgk_proto.ydr.c \ + rxgk_proto.ss.c + +LIBYDR = \ + rxgk_proto.cs.c \ + rxgk_proto.ss.c \ + rxgk_proto.ydr.c \ + rxgk_proto.h \ + rxgk_proto.cs.h \ + rxgk_proto.ss.h + +LIBTYDR = \ + test.cs.h \ + test.ss.h \ + test.ss.c \ + test.cs.c \ + test.ydr.c \ + test.h + +common_LDADD = \ + ../rx/librx.la \ + -L../lwp -llwp $(PLWP_LIB_FLAGS) \ + $(KRB5_LIB_FLAGS) + +test_client_SOURCES = test_client.c test.cs.c +test_server_SOURCES = test_server.c test.ss.c +test_client_LDADD = librxgkclient.la $(common_LDADD) +test_server_LDADD = librxgkserver.la $(common_LDADD) +CLEANFILES = $(LIBYDR) $(LIBTYDR) +LDADD = $(KRB5_LIB_FLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps rxgk/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign --ignore-deps rxgk/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +librxgkclient.la: $(librxgkclient_la_OBJECTS) $(librxgkclient_la_DEPENDENCIES) + $(LINK) $(librxgkclient_la_LDFLAGS) $(librxgkclient_la_OBJECTS) $(librxgkclient_la_LIBADD) $(LIBS) +librxgkserver.la: $(librxgkserver_la_OBJECTS) $(librxgkserver_la_DEPENDENCIES) + $(LINK) $(librxgkserver_la_LDFLAGS) $(librxgkserver_la_OBJECTS) $(librxgkserver_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +test_client$(EXEEXT): $(test_client_OBJECTS) $(test_client_DEPENDENCIES) + @rm -f test_client$(EXEEXT) + $(LINK) $(test_client_LDFLAGS) $(test_client_OBJECTS) $(test_client_LDADD) $(LIBS) +test_server$(EXEEXT): $(test_server_OBJECTS) $(test_server_DEPENDENCIES) + @rm -f test_server$(EXEEXT) + $(LINK) $(test_server_LDFLAGS) $(test_server_OBJECTS) $(test_server_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. $(distdir)/../cf + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-exec-am: + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \ + clean clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-data-local install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +install-suid-programs: + @foo='$(bin_SUIDS)'; \ + for file in $$foo; do \ + x=$(DESTDIR)$(bindir)/$$file; \ + if chown 0:0 $$x && chmod u+s $$x; then :; else \ + echo "*"; \ + echo "* Failed to install $$x setuid root"; \ + echo "*"; \ + fi; done + +install-exec-hook: install-suid-programs + +install-build-headers:: $(include_HEADERS) $(build_HEADERZ) + @foo='$(include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \ + for f in $$foo; do \ + f=`basename $$f`; \ + if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \ + else file="$$f"; fi; \ + if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \ + : ; else \ + echo " $(CP) $$file $(buildinclude)/$$f"; \ + $(CP) $$file $(buildinclude)/$$f; \ + fi ; \ + done + +all-local: install-build-headers + +check-local:: + @if test '$(CHECK_LOCAL)'; then \ + foo='$(CHECK_LOCAL)'; else \ + foo='$(PROGRAMS)'; fi; \ + if test "$$foo"; then \ + failed=0; all=0; \ + for i in $$foo; do \ + all=`expr $$all + 1`; \ + if ./$$i --version > /dev/null 2>&1; then \ + echo "PASS: $$i"; \ + else \ + echo "FAIL: $$i"; \ + failed=`expr $$failed + 1`; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="$$failed of $$all tests failed"; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi + +.x.c: + @cmp -s $< $@ 2> /dev/null || cp $< $@ +#NROFF_MAN = nroff -man +.1.cat1: + $(NROFF_MAN) $< > $@ +.3.cat3: + $(NROFF_MAN) $< > $@ +.5.cat5: + $(NROFF_MAN) $< > $@ +.8.cat8: + $(NROFF_MAN) $< > $@ + +dist-cat1-mans: + @foo='$(man1_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.1) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat3-mans: + @foo='$(man3_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.3) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat5-mans: + @foo='$(man5_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.5) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat8-mans: + @foo='$(man8_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.8) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans + +install-cat-mans: install-man + $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) + +install-data-local: install-cat-mans + +.et.h: + $(COMPILE_ET) $< +.et.c: + $(COMPILE_ET) $< + +.x.c: + @cmp -s $< $@ 2> /dev/null || cp $< $@ + +check-local:: + @foo='$(CHECK_LOCAL)'; \ + if test "$$foo"; then \ + failed=0; all=0; \ + for i in $$foo; do \ + all=`expr $$all + 1`; \ + if ./$$i --version > /dev/null 2>&1; then \ + echo "PASS: $$i"; \ + else \ + echo "FAIL: $$i"; \ + failed=`expr $$failed + 1`; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="$$failed of $$all tests failed"; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi + +$(librxgkclient_la_OBJECTS) $(librxgkserver_la_OBJECTS): $(LIBYDR) + +$(test_server_OBJECTS) $(test_client_OBJECTS): $(LIBTYDR) + +$(LIBYDR): rxgk_proto.xg + ../ydr/ydr $(srcdir)/rxgk_proto.xg + +$(LIBTYDR): test.xg + ../ydr/ydr $(srcdir)/test.xg +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/rxgk/README b/src/rxgk/README new file mode 100644 index 000000000..73942dec4 --- /dev/null +++ b/src/rxgk/README @@ -0,0 +1,225 @@ +$Id: README,v 1.1 2004/08/08 19:21:33 shadow Exp $ + +Overview +======== + +- RX crypto class + + rxgk is a new crypto class, mostly since the interface need to + be changed in the ktc for openafs anyway (at least binary + interface). + + rxgk (krb5) can be used when the kdc returns a non des enctype. + +- Layers + + There are two layer, the transport layer that is authentiation + mechamism independent, and the authentiation layer. + + The glue between the authentiation layer and the transport + layer is the RXGK authenticator. + +- RXGK authenticator + + The only reson for the RXGK authenticator exists is that there + are not fragmentation in the Challange/Response protocol in + Rx. This limits the authentization in Rx to MTU sized packages. + +- RXGK authenticator lifetime + + The server has a local key that is used to encrypt the gk + authenticators. The local key is semi stateful, the + server need to remember the old keys al long as there are + valid RXGK authenticators held by any client. New RXGK + authenticators can be fetched at any time but might require + user input. + +- Getting RXGK authenticator + + the authenticator is fetched using a service rx_null on the + same port as the server the client wants to talk too. + +transport layer +=============== + +- Key derivation + + Each connection get separate key for each connection/epoch. + Each direction get a separate key for each direction. + + S = Session key + CN = connection key + counter = key generation (nonce) + K{server} = Key from server direction + K{client} = Key from client direction + + X{cn} = epoch{32} | cid{32} | key_counter{64} + + CN = random-to-key(pseudo-random(S, X{cn}) + + K{server} = KD(CN, 0) { key used on data from server } + K{client} = KD(CN, 1) { key used on data from client } + + Checksum field in the header (spare1) is always set to the + lower 4 bits of the key_counter field. Ie server may not + request rekeying faster the (4 * rc_max_seq_skew) packets. + + K depends on {S,epoch,cid,key_counter} + +- Rekeying + + Rekeing is needed since kcrypt assumes that data isn't + encrypted for the 2**48 messages with the same key. + +- Challenge/Response + + When the client is unknown to the server it sends a challenge + with opcode RXKG_OPCODE_CHALLENGE (nonce). + + The client the send back a rxgk authenticator and the + encrypted nounce. + +- Wire protocol + + crypt mode + + Each packet are encrypted as [KCRYPTO] specifies. The data is + prefixed with parts of the rx header that matter. + + auth mode + + Each packet are checksumed as [KCRYPTO] specifies. The data is + prefixed with parts of the rx header that matter [4]. In auth + mode the rx header subsitute is not sent over write to save + space. + + The part of the header that is checksumed are these fields: + + uint32_t callid + uint32_t seqno + uint32_t serialno + uint8_t userstatus + uint8_t someflags (RX_PRESET_FLAGS) + uint8_t serviceid + +Authentication RPCs +=================== + +- Information RPCs + + To be later specified. + + There is an information API to, with a RXGK authenticator, the + client can verify what authentiation mechamisms is supported, + both insecure and authenticated. + +- Kerberos 5 to rxgk authenticator RPCs + + key{KerbS} - kerberos session subkey key + + The mutual auth data in the RXGK_EstablishKrb5Context is + encrypted with the key{KerbS} key. + + Client sends acceptable enctypes and nonce to the server in + challenge. + + Server sends back key(auth-cred-key) and nonce + 1 to the + client together with a RXGK authenticator cred encrypted with + key{KerbS}. + + auth-cred is protected by key{gkkey} + + key{S} = key{auth-cred-key} + +- GSS-API to rxgk authenticator RPCs + + To be later specified. + +======== + +Code assumptions: + + L.NXS.SE realm + + gkkey@L.NXS.SE and afs@L.NXS.SE key exists in default keytab + +======== +implementation/higher level issues + + +- RXGK_AUTH_CRED needs checking + + [ 2. should we use the session key or the a random octet + string generatated by the server, the key(auth-cred-key) below ] + + [ 3. ac_principal: gss exported name ? this to make it idependant + of kerberos 5. Problem with gss name only specifed gss-mechs + can be used. Server local so it can really be anything the + server wants it to be. Need to be kept short so it will fit on + one MTU. Also see {{10}}. ] + + The RXGK authenticator is fetch by doing either the RXGK + GSSAPI rpc's or the RXGK_EstablishKrb5Context rpc to the RXGK + service on the same port as the service that rxgk + secures. Doing the RPC call gives you a gk authenticator and a + key(S) that is valid for one server. The input to GSSAPI rpc + and EstablishKrb5Context are mech specific. + + GSS-API + [ 11. see rxgss how this should me implemented ... ] + +exported auth name + + all mech's need to have a rxgk name to krb4 name function + until pts is changed to support rxgk names. + + [ 10. Proposal: the protection interface have GKNAME to + AFS/PTS named RPCs. + + In this proposal all names are mapped to one AFS username. + + For example, gss exported named KRB5:lha@SU.SE, krb5 native + lha@SU.SE and krb5 native krb5 lha@KTH.SE all map to the same + afs username `lha'. + + + Also see {{3}}. ] + + +TODO: + +- Auth mode + +- Pass length since krb encryption doesn't preserve length (some enctypes does) + + [ 8. Is this really needed, packets are always send full ] + +- More tests + + More the MTU since rpcs + Stored packets packets, compare generate packages + Check other checksum + + +DEPRICATED IDEAS + +- Diffrent keys for fileservers + + I think we should ignore this for rxgk/kerberos 5 or do + "fileserver groups" as discuss on Pittsburgh so this will + happen. For "fileserver groups" a get groups rpc should be + added to the vlserver (this will make non rx afslogs harder + to implement) and in the first version we just insert a rpc + stub that return one name only, "default", or something + equally silly. + + The reson you want to have diffrent keys for fileservers are + + - increased security (more keys, less data encrypted with the + same key, one server compromised doesn't compromise all servers) + + - give a fileserver to someone else that you not trust + to have the master key + + Depricated since we can get consensus, rxgk/gssapi will/must solve + the problem. diff --git a/src/rxgk/rxgk.h b/src/rxgk/rxgk.h new file mode 100644 index 000000000..bc138b70f --- /dev/null +++ b/src/rxgk/rxgk.h @@ -0,0 +1,91 @@ +/* -*- C -*- */ + +/* + * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id: rxgk.h,v 1.1 2004/08/08 19:21:33 shadow Exp $ */ + +#ifndef __RXGK_H +#define __RXGK_H + +/* Is this really large enough for a krb5 ticket? */ +#define MAXKRB5TICKETLEN 1024 + +typedef char rxgk_level; +#define rxgk_auth 0 /* rxgk_clear + protected packet length */ +#define rxgk_crypt 1 /* rxgk_crypt + encrypt packet payload */ + +int32_t +rxgk_GetServerInfo(struct rx_connection *, rxgk_level *, + uint32_t *, char *, size_t, char *, size_t, int32_t *); + +struct rx_securityClass * +rxgk_NewServerSecurityObject (/*rxgk_level*/ int min_level, + const char *princ, + void *appl_data, + int (*get_key)(void *data, const char *principal, + int enctype, int kvno, + krb5_keyblock *key), + int (*user_ok)(const char *name, + const char *realm, + int kvno), + uint32_t serviceId); + +struct rx_securityClass * +rxgk_k5_NewClientSecurityObject (/*rxgk_level*/ int level, + krb5_keyblock *sessionkey, + int32_t kvno, + int ticketLen, + void *ticket, + uint32_t serviceId, + krb5_context context); + +int +rxgk_default_get_key(void *, const char *, int, int, krb5_keyblock *); + +/* XXX these are not com_err error, MAKE THIS com_err's */ +#define RXGKINCONSISTENCY (19270400L) +#define RXGKPACKETSHORT (19270401L) +#define RXGKLEVELFAIL (19270402L) +#define RXGKTICKETLEN (19270403L) +#define RXGKOUTOFSEQUENCE (19270404L) +#define RXGKNOAUTH (19270405L) +#define RXGKBADKEY (19270406L) +#define RXGKBADTICKET (19270407L) +#define RXGKUNKNOWNKEY (19270408L) +#define RXGKEXPIRED (19270409L) +#define RXGKSEALEDINCON (19270410L) +#define RXGKDATALEN (19270411L) +#define RXGKILLEGALLEVEL (19270412L) + +#endif /* __RXGK_H */ diff --git a/src/rxgk/rxgk_clnt.c b/src/rxgk/rxgk_clnt.c new file mode 100644 index 000000000..aa348955c --- /dev/null +++ b/src/rxgk/rxgk_clnt.c @@ -0,0 +1,417 @@ +/* + * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_clnt.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +/* Security object specific client data */ +typedef struct rxgk_clnt_class { + struct rx_securityClass klass; + krb5_context context; + rxgk_level level; + krb5_keyblock krb_key; + key_stuff k; + int32_t kvno; + RXGK_Token ticket; + uint32_t serviceId; +#if 0 + RXGK_rxtransport_key contrib; +#endif +} rxgk_clnt_class; + +/* Per connection specific client data */ +typedef struct clnt_con_data { + RXGK_Token auth_token; + int32_t auth_token_kvno; + end_stuff e; +} clnt_con_data; + +static +int +client_NewConnection(struct rx_securityClass *obj_, struct rx_connection *con) +{ + rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_; + clnt_con_data *cdat; + int ret; + + assert(con->securityData == 0); + obj->klass.refCount++; + cdat = (clnt_con_data *) osi_Alloc(sizeof(clnt_con_data)); + cdat->e.bytesReceived = cdat->e.packetsReceived = 0; + cdat->e.bytesSent = cdat->e.packetsSent = 0; + + con->securityData = (char *) cdat; + rx_nextCid += RX_MAXCALLS; + con->epoch = rx_epoch; + con->cid = rx_nextCid; + cdat->auth_token.len = 0; + cdat->auth_token.val = NULL; + + ret = rxgk5_get_auth_token(obj->context, + rx_HostOf(con->peer), rx_PortOf(con->peer), + obj->serviceId, + &obj->ticket, &cdat->auth_token, + &obj->krb_key, + &obj->k.ks_key, + &cdat->auth_token_kvno); + if (ret) { + osi_Free(cdat, sizeof(clnt_con_data)); + return ret; + } + + /* XXX derive crypto key */ + + ret = krb5_crypto_init(obj->k.ks_context, + &obj->k.ks_key, obj->k.ks_key.keytype, + &obj->k.ks_crypto); + if (ret) + goto out; + +#if 0 + obj->contrib.server_keycontribution.val = ""; + obj->contrib.server_keycontribution.len = 0; + + obj->contrib.client_keycontribution.len = rxgk_key_contrib_size; + obj->contrib.client_keycontribution.val = malloc(rxgk_key_contrib_size); + if (obj->contrib.client_keycontribution.val == NULL) + goto out; + + { + int i; + + for (i = 0; i < rxgk_key_contrib_size; i++) + obj->contrib.client_keycontribution.val[i] = arc4random(); /*XXX*/ + } + + ret = rxgk_derive_transport_key(obj->k.ks_context, + &obj->k.ks_key, + &obj->contrib, + &obj->k.ks_skey); + if (ret) + return ret; +#endif + + ret = krb5_crypto_init (obj->context, &obj->k.ks_skey, + obj->k.ks_skey.keytype, + &obj->k.ks_scrypto); + if (ret) + return ret; + + ret = rxgk_set_conn(con, obj->k.ks_key.keytype, + obj->level == rxgk_crypt ? 1 : 0); + + out: + if (ret) { + if (obj->k.ks_crypto) + krb5_crypto_destroy(obj->k.ks_context, obj->k.ks_crypto); + obj->k.ks_crypto = NULL; + krb5_free_keyblock_contents(obj->k.ks_context, &obj->k.ks_skey); + memset(&obj->k.ks_skey, 0, sizeof(obj->k.ks_skey)); + osi_Free(cdat->auth_token.val, cdat->auth_token.len); + osi_Free(cdat, sizeof(clnt_con_data)); + return ret; + } + + return 0; +} + +static +int +client_Close(struct rx_securityClass *obj_) +{ + rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_; + obj->klass.refCount--; + if (obj->klass.refCount <= 0) + { + osi_Free(obj->ticket.val, obj->ticket.len); + osi_Free(obj, sizeof(rxgk_clnt_class)); + } + return 0; +} + +static +int +client_DestroyConnection(struct rx_securityClass *obj, + struct rx_connection *con) +{ + clnt_con_data *cdat = (clnt_con_data *)con->securityData; + + if (cdat) + osi_Free(cdat, sizeof(clnt_con_data)); + return client_Close(obj); +} + +/* + * Receive a challange and respond. + */ +static +int +client_GetResponse(const struct rx_securityClass *obj_, + const struct rx_connection *con, + struct rx_packet *pkt) +{ + rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_; + clnt_con_data *cdat = (clnt_con_data *)con->securityData; + key_stuff *k = &obj->k; + struct RXGK_Challenge c; + struct RXGK_Response r; + struct RXGK_Response_Crypt rc; + char bufrc[RXGK_RESPONSE_CRYPT_SIZE]; + char bufr[RXGK_RESPONSE_MAX_SIZE]; + krb5_data data; + size_t len; + int ret; + char *p; + + memset(&r, 0, sizeof(r)); + memset(&rc, 0, sizeof(rc)); + + /* Get challenge */ + if (rx_SlowReadPacket(pkt, 0, sizeof(c), &c) != sizeof(c)) + return RXGKPACKETSHORT; + + if (ntohl(c.rc_version) != RXGK_VERSION) + return RXGKINCONSISTENCY; + + if (ntohl(c.rc_min_level) > obj->level) + return RXGKLEVELFAIL; + + if (c.rc_opcode == htonl(RXKG_OPCODE_CHALLENGE)) { + ; + } else if (c.rc_opcode == htonl(RXKG_OPCODE_REKEY)) { + /* XXX decode ydr_encode_RXGK_ReKey_Crypt info */ + return RXGKINCONSISTENCY; +#if 0 + ret = rxgk_derive_transport_key(obj->k.ks_context, + &obj->k.ks_key, + &obj->contrib, + &obj->k.ks_skey); + if (ret) + return ret; + + ret = krb5_crypto_init (obj->context, &obj->k.ks_skey, + obj->k.ks_skey.keytype, + &obj->k.ks_scrypto); + if (ret) + return ret; +#endif + } else + return RXGKINCONSISTENCY; + + rc.nonce = ntohl(c.rc_nonce) + 1; + rc.epoch = con->epoch; + rc.cid = con->cid & RX_CIDMASK; + rxi_GetCallNumberVector(con, rc.call_numbers); +#if 0 + rc.security_index = con->securityIndex; +#endif + rc.level = obj->level; +#if 0 + rc.last_seq = 0; /* XXX */ +#endif + rc.key_version = 0; +#if 0 + rc.contrib = obj->contrib; /* XXX copy_RXGK_rxtransport_key */ +#endif + + { + int i; + for (i = 0; i < RX_MAXCALLS; i++) { + if (rc.call_numbers[i] < 0) + return RXGKINCONSISTENCY; + } + } + len = sizeof(bufrc); + p = ydr_encode_RXGK_Response_Crypt(&rc, bufrc, &len); + if (p == NULL) + return RXGKINCONSISTENCY; + len = sizeof(bufrc) - len; + + ret = krb5_encrypt(obj->context, k->ks_crypto, + RXGK_CLIENT_ENC_CHALLENGE, bufrc, len, &data); + if (ret) + return ret; + + r.rr_version = RXGK_VERSION; + r.rr_auth_token_kvno = cdat->auth_token_kvno; + r.rr_auth_token.val = cdat->auth_token.val; + r.rr_auth_token.len = cdat->auth_token.len; + r.rr_ctext.val = data.data; + r.rr_ctext.len = data.length; + + len = sizeof(bufr); + p = ydr_encode_RXGK_Response(&r, bufr, &len); + len = sizeof(bufr) - len; + krb5_data_free(&data); + + if (p == NULL) + return RXGKINCONSISTENCY; + + if (rx_SlowWritePacket(pkt, 0, len, bufr) != len) + return RXGKPACKETSHORT; + rx_SetDataSize(pkt, len); + + return 0; +} + +/* + * Checksum and/or encrypt packet. + */ +static +int +client_PreparePacket(struct rx_securityClass *obj_, + struct rx_call *call, + struct rx_packet *pkt) +{ + rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_; + key_stuff *k = &obj->k; + struct rx_connection *con = rx_ConnectionOf(call); + end_stuff *e = &((clnt_con_data *) con->securityData)->e; + + return rxgk_prepare_packet(pkt, con, obj->level, k, e); +} + +/* + * Verify checksums and/or decrypt packet. + */ +static +int +client_CheckPacket(struct rx_securityClass *obj_, + struct rx_call *call, + struct rx_packet *pkt) +{ + rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_; + key_stuff *k = &obj->k; + struct rx_connection *con = rx_ConnectionOf(call); + end_stuff *e = &((clnt_con_data *) con->securityData)->e; + + return rxgk_check_packet(pkt, con, obj->level, k, e); +} + +static +int +client_GetStats(const struct rx_securityClass *obj, + const struct rx_connection *con, + struct rx_securityObjectStats *st) +{ + clnt_con_data *cdat = (clnt_con_data *) con->securityData; + + st->type = rxgk_disipline; + st->level = ((rxgk_clnt_class *)obj)->level; + st->flags = rxgk_checksummed; + if (cdat == 0) + st->flags |= rxgk_unallocated; + { + st->bytesReceived = cdat->e.bytesReceived; + st->packetsReceived = cdat->e.packetsReceived; + st->bytesSent = cdat->e.bytesSent; + st->packetsSent = cdat->e.packetsSent; + } + return 0; +} + +static +struct rx_securityOps client_ops = { + client_Close, + client_NewConnection, + client_PreparePacket, + NULL, + NULL, + NULL, + NULL, + client_GetResponse, + NULL, + client_CheckPacket, + client_DestroyConnection, + client_GetStats, + NULL, + NULL, + NULL, +}; + +int rxgk_EpochWasSet = 0; + +int rxgk_min_level = rxgk_crypt; /* rxgk_{auth,crypt} */ /* XXX */ + +struct rx_securityClass * +rxgk_k5_NewClientSecurityObject(/*rxgk_level*/ int level, + krb5_keyblock *key, + int32_t kvno, + int ticket_len, + void *ticket, + uint32_t serviceId, + krb5_context context) +{ + rxgk_clnt_class *obj; + static int inited = 0; + int ret; + + if (level < rxgk_min_level) + level = rxgk_min_level; /* Boost security level */ + + if (!inited) { + rx_SetEpoch(arc4random()); + inited = 1; + } + + obj = (rxgk_clnt_class *) osi_Alloc(sizeof(rxgk_clnt_class)); + obj->klass.refCount = 1; + obj->klass.ops = &client_ops; + + obj->klass.privateData = (char *) obj; + + obj->context = context; + obj->level = level; + obj->kvno = kvno; + obj->serviceId = serviceId; + + ret = krb5_copy_keyblock_contents(context, key, &obj->krb_key); + if (ret) { + osi_Free(obj, sizeof(rxgk_clnt_class)); + return NULL; + } + + memset(&obj->k.ks_key, 0, sizeof(obj->k.ks_key)); + obj->k.ks_crypto = NULL; + + memset(&obj->k.ks_skey, 0, sizeof(obj->k.ks_skey)); + obj->k.ks_scrypto = NULL; + obj->k.ks_context = context; + + obj->ticket.len = ticket_len; + obj->ticket.val = osi_Alloc(ticket_len); + memcpy(obj->ticket.val, ticket, obj->ticket.len); + + return &obj->klass; +} diff --git a/src/rxgk/rxgk_common.c b/src/rxgk/rxgk_common.c new file mode 100644 index 000000000..144a4fdd6 --- /dev/null +++ b/src/rxgk/rxgk_common.c @@ -0,0 +1,392 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_common.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +#include + +#include +#include "rxgk_proto.h" + +/* + * + */ + +int rxgk_key_contrib_size = 16; + +/* + * + */ + +int +rxk5_mutual_auth_client_generate(krb5_context context, krb5_keyblock *key, + uint32_t number, + RXGK_Token *challage_token) +{ + krb5_crypto crypto; + krb5_data data; + RXGK_CHALLENGE_TOKEN ct; + char buf[RXGK_CHALLENGE_TOKEN_MAX_SIZE]; + size_t sz; + int ret; + + data.data = NULL; + + ret = krb5_crypto_init (context, key, key->keytype, &crypto); + if (ret) + return ret; + + ct.ct_version = RXGK_CR_TOKEN_VERSION; + ct.ct_nonce = number; + ct.ct_enctype.val = malloc(sizeof(ct.ct_enctype.val[0])); + ct.ct_enctype.len = 1; + if (ct.ct_enctype.val == NULL) { + ret = ENOMEM; + goto out; + } + ct.ct_enctype.val[0] = RXGK_CRYPTO_DES_CBC_CRC; + + sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE; + if (ydr_encode_RXGK_CHALLENGE_TOKEN(&ct, buf, &sz) == NULL) { + ret = ENOMEM; + goto out; + } + sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE - sz; + + ret = krb5_encrypt(context, crypto, 0, buf, sz, &data); + if (ret) + goto out; + + challage_token->val = malloc(data.length); + if (challage_token->val == NULL) { + ret = ENOMEM; + goto out; + } + + challage_token->len = data.length; + memcpy(challage_token->val, data.data, data.length); + + out: + ydr_free_RXGK_CHALLENGE_TOKEN(&ct); + if (data.data) + krb5_data_free(&data); + krb5_crypto_destroy(context, crypto); + return ret; +} + +/* + * + */ + +int +rxk5_mutual_auth_client_check(krb5_context context, krb5_keyblock *key, + uint32_t number, + const RXGK_Token *challage_token, + krb5_keyblock *rxsession_key) +{ + krb5_crypto crypto; + krb5_data data; + RXGK_REPLY_TOKEN rt; + size_t sz; + int ret; + + memset(&rt, 0, sizeof(rt)); + memset(rxsession_key, 0, sizeof(*rxsession_key)); + + ret = krb5_crypto_init (context, key, key->keytype, &crypto); + if (ret) + return ret; + + /* Decrypt ticket */ + data.data = NULL; + ret = krb5_decrypt(context, crypto, 0, + challage_token->val, challage_token->len, + &data); + if (ret) + goto out; + + sz = data.length; + if (ydr_decode_RXGK_REPLY_TOKEN(&rt, data.data, &sz) == NULL) { + ret = RXGKSEALEDINCON; + goto out; + } + + if (rt.rt_nonce != number + 1) { + ret = RXGKSEALEDINCON; + goto out2; + } + + if (rt.rt_error != 0) { + ret = rt.rt_error; + goto out2; + } + +#if 1 + /* XXX check rt_enctype */ + ret = rxgk_random_to_key(rt.rt_enctype, + rt.rt_key.val, rt.rt_key.len, + rxsession_key); +#else + ret = krb5_copy_keyblock_contents(context, key, rxsession_key); +#endif + + out2: + ydr_free_RXGK_REPLY_TOKEN(&rt); + out: + if (data.data) + krb5_data_free(&data); + krb5_crypto_destroy(context, crypto); + + return ret; +} + +/* + * + */ + +int +rxk5_mutual_auth_server(krb5_context context, krb5_keyblock *key, + const RXGK_Token *challage_token, + int *session_enctype, + void **session_key, size_t *session_key_size, + RXGK_Token *reply_token) +{ + krb5_crypto crypto; + krb5_data data; + krb5_keyblock keyblock; + RXGK_CHALLENGE_TOKEN ct; + RXGK_REPLY_TOKEN rt; + char buf[RXGK_REPLY_TOKEN_MAX_SIZE]; + size_t sz; + int ret; + + memset(&rt, 0, sizeof(rt)); + memset(&ct, 0, sizeof(ct)); + + *session_enctype = 0; + *session_key = NULL; + *session_key_size = 0; + + keyblock.keyvalue.data = NULL; + + sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE - sz; + + ret = krb5_crypto_init (context, key, key->keytype, &crypto); + if (ret) + return ret; + + /* Decrypt ticket */ + data.data = NULL; + ret = krb5_decrypt(context, crypto, 0, + challage_token->val, challage_token->len, + &data); + if (ret) + goto out; + + sz = data.length; + if (ydr_decode_RXGK_CHALLENGE_TOKEN(&ct, data.data, &sz) == NULL) { + memset(&ct, 0, sizeof(ct)); + ret = ENOMEM; + goto out; + } + sz = data.length - sz; + + krb5_data_free(&data); + data.data = NULL; + + if (ct.ct_version < RXGK_CR_TOKEN_VERSION) { + ret = RXGKSEALEDINCON; + goto out; + } else + ret = 0; + + /* XXX choose best enctype, not just the one we use now */ + { + int i; + + for (i = 0; i < ct.ct_enctype.len ; i++) { + if (ct.ct_enctype.val[i] == key->keytype) + break; + } + + if (i == ct.ct_enctype.len) + ret = RXGKSEALEDINCON; + } + + rt.rt_version = RXGK_CR_TOKEN_VERSION; + rt.rt_nonce = ct.ct_nonce + 1; + + rt.rt_key.len = 0; + rt.rt_key.val = NULL; + rt.rt_error = ret; + + if (ret == 0) { + ret = krb5_generate_random_keyblock(context, + key->keytype, + &keyblock); + if (ret == 0) { + rt.rt_enctype = keyblock.keytype; + rt.rt_key.len = keyblock.keyvalue.length; + rt.rt_key.val = keyblock.keyvalue.data; + + *session_enctype = keyblock.keytype; + *session_key_size = keyblock.keyvalue.length; + *session_key = malloc(keyblock.keyvalue.length); + if (*session_key == NULL) + abort(); + memcpy(*session_key, keyblock.keyvalue.data, + keyblock.keyvalue.length); + } else { + rt.rt_error = ret; + } + } + + sz = RXGK_REPLY_TOKEN_MAX_SIZE; + if (ydr_encode_RXGK_REPLY_TOKEN(&rt, buf, &sz) == 0) { + ret = ENOMEM; + goto out; + } + sz = RXGK_REPLY_TOKEN_MAX_SIZE - sz; + + memset(rt.rt_key.val, 0, rt.rt_key.len); + + data.data = NULL; + ret = krb5_encrypt(context, crypto, 0, buf, sz, &data); + if (ret) + goto out; + + reply_token->val = malloc(data.length); + if (reply_token->val == NULL) { + ret = ENOMEM; + goto out; + } + + reply_token->len = data.length; + memcpy(reply_token->val, data.data, data.length); + + out: + ydr_free_RXGK_CHALLENGE_TOKEN(&ct); + /* ydr_free_RXGK_REPLY_TOKEN(&rt); */ + + if (data.data) + krb5_data_free(&data); + if (keyblock.keyvalue.data) + krb5_free_keyblock_contents(context, &keyblock); + krb5_crypto_destroy(context, crypto); + return ret; +} + +/* + * + */ + +void +rxgk_getheader(struct rx_packet *pkt, struct rxgk_header_data *h) +{ + uint32_t t; + + /* Collect selected packet fields */ + h->call_number = htonl(pkt->header.callNumber); + t = ((pkt->header.cid & RX_CHANNELMASK) << (32 - RX_CIDSHIFT)) + | ((pkt->header.seq & 0x3fffffff)); + h->channel_and_seq = htonl(t); +} + +/* + * + */ + +#if 0 +int +rxgk_derive_transport_key(krb5_context context, + krb5_keyblock *rx_conn_key, + RXGK_rxtransport_key *keycontrib, + krb5_keyblock *rkey) +{ + krb5_error_code ret; + + /* XXX heimdal broken doesn't implement derive key for des encrypes */ + + switch (rx_conn_key->keytype) { + case RXGK_CRYPTO_DES_CBC_CRC: + case RXGK_CRYPTO_DES_CBC_MD4: + case RXGK_CRYPTO_DES_CBC_MD5: + ret = krb5_copy_keyblock_contents(context, rx_conn_key, rkey); + if (ret) + abort(); + + break; + default: { + char rxk_enc[RXGK_RXTRANSPORT_KEY_MAX_SIZE]; + size_t sz; + krb5_keyblock *key; + + sz = RXGK_RXTRANSPORT_KEY_MAX_SIZE; + if (ydr_encode_RXGK_rxtransport_key(keycontrib, rxk_enc, &sz) == NULL) + return EINVAL; + + sz = RXGK_RXTRANSPORT_KEY_MAX_SIZE - sz; + + ret = krb5_derive_key (context, + rx_conn_key, + rx_conn_key->keytype, + rxk_enc, + sz, + &key); + if (ret) + abort(); + + ret = krb5_copy_keyblock_contents(context, key, rkey); + if (ret) + abort(); + + krb5_free_keyblock(context, key); + break; + } + } + + return ret; +} +#endif + +/* + * + */ + + +/* XXX replace me */ + +int +rxgk_random_to_key(int enctype, + void *random_data, int random_sz, + krb5_keyblock *key) +{ + memset(key, 0, sizeof(*key)); + + switch (enctype) { + case RXGK_CRYPTO_DES_CBC_CRC: + case RXGK_CRYPTO_DES_CBC_MD4: + case RXGK_CRYPTO_DES_CBC_MD5: + if (random_sz != 8) + return RXGKINCONSISTENCY; + break; + default: + return RXGKINCONSISTENCY; + } + + key->keyvalue.data = malloc(random_sz); + if (key->keyvalue.data == NULL) + return ENOMEM; + memcpy(key->keyvalue.data, random_data, random_sz); + key->keyvalue.length = random_sz; + key->keytype = enctype; + + return 0; +} diff --git a/src/rxgk/rxgk_crkrb.c b/src/rxgk/rxgk_crkrb.c new file mode 100644 index 000000000..0f69dee91 --- /dev/null +++ b/src/rxgk/rxgk_crkrb.c @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the university nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Heimdal implementation of the rxgk wire encryption + */ + +#include "rxgk_locl.h" +#include + +RCSID("$Id: rxgk_crkrb.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +struct _rxg_key_type { + char *name; + int enctype; + int blocklen; + int checksumlen; + int confounderlen; +}; + +static struct _rxg_key_type ktypes[] = { + { "des-cbc-crc", RXGK_CRYPTO_DES_CBC_CRC, + 8, 4, 8, + }, + { "des-cbc-md5", RXGK_CRYPTO_DES_CBC_MD5, + 8, 24, 8, + } +}; + +static struct _rxg_key_type * +_rxg_find_enctype(int enctype) +{ + struct _rxg_key_type *key; + + for (key = ktypes; key->name != NULL; key++) + if (key->enctype == enctype) + return key; + return NULL; +} + +int +rxgk_set_conn(struct rx_connection *con, int enctype, int enc) +{ + struct _rxg_key_type *key; + + key = _rxg_find_enctype(enctype); + if (key == NULL) + return ENOENT; + + if (enc) { + rx_SetSecurityHeaderSize(con, key->checksumlen + key->confounderlen + + RXGK_HEADER_DATA_SIZE); + + rx_SetSecurityMaxTrailerSize(con, key->blocklen); + } else { + rx_SetSecurityHeaderSize(con, + key->checksumlen + RXGK_HEADER_DATA_SIZE); + rx_SetSecurityMaxTrailerSize(con, 0); + } + return 0; +} + +/* + * + */ + +static int +uiomove_to(struct rx_packet *pkt, u_int pre, u_int off, void **p, u_int *rlen) +{ + u_int len; + void *ptr; + + len = rx_GetDataSize(pkt); + *rlen = len + pre; + + ptr = malloc(*rlen); + if (ptr == NULL) + return ENOMEM; + + *p = ptr; + + ptr = (char *)ptr + pre; + + if (rx_SlowReadPacket(pkt, off, len, ptr) != len) { + free(p); + *p = NULL; + return RXGKPACKETSHORT; + } + + return 0; +} + +/* + * + */ + +static int +uiomove_from(struct rx_packet *pkt, u_int off, void *ptr, u_int len) +{ + if (rx_SlowWritePacket(pkt, off, len, ptr) != len) + return RXGKPACKETSHORT; + rx_SetDataSize(pkt, len + off); + + return 0; +} + +/* + * + */ +int +rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e) +{ + int ret, keyusage; + + + + if (k->ks_scrypto == NULL) + return RXGKSEALEDINCON; + + if (level == rxgk_crypt) { + krb5_data data; + struct rxgk_header_data hdr; + u_int len; + void *p; + + if (rx_IsClientConn(con)) + keyusage = RXGK_CLIENT_ENC_PACKETS; + else + keyusage = RXGK_SERVER_ENC_PACKETS; + + ret = uiomove_to(pkt, RXGK_HEADER_DATA_SIZE, + rx_GetSecurityHeaderSize(con), + &p, &len); + if (ret) + return ret; + + rxgk_getheader(pkt, &hdr); + memcpy(p, &hdr, sizeof(hdr)); + + ret = krb5_encrypt(k->ks_context, k->ks_scrypto, + keyusage, p, len, &data); + if (ret) { + free(p); + return ret; + } + + ret = uiomove_from(pkt, 0, data.data, data.length); + + krb5_data_free(&data); + free(p); + + } else if (level == rxgk_auth) { + if (rx_IsClientConn(con)) + keyusage = RXGK_CLIENT_CKSUM_PACKETS; + else + keyusage = RXGK_SERVER_CKSUM_PACKETS; + + abort(); + } else + abort(); + + return ret; +} + +/* + * + */ +int +rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e) +{ + int ret, keyusage; + + if (k->ks_scrypto == NULL) + return RXGKSEALEDINCON; + + ret = 0; + + if (level == rxgk_crypt) { + krb5_data data; + struct rxgk_header_data hdr; + u_int len; + void *p; + + if (rx_IsClientConn(con)) + keyusage = RXGK_SERVER_ENC_PACKETS; + else + keyusage = RXGK_CLIENT_ENC_PACKETS; + + ret = uiomove_to(pkt, 0, 0, &p, &len); + if (ret) + return ret; + + ret = krb5_decrypt(k->ks_context, k->ks_scrypto, + keyusage, p, len, &data); + if (ret) { + free(p); + return ret; + } + + ret = uiomove_from(pkt, rx_GetSecurityHeaderSize(con) - + RXGK_HEADER_DATA_SIZE, + data.data, data.length); + if (ret == 0) { + rxgk_getheader(pkt, &hdr); + if (memcmp(&hdr, data.data, sizeof(hdr)) != 0) + ret = RXGKSEALEDINCON; + } + + krb5_data_free(&data); + free(p); + } else if (level == rxgk_auth) { + if (rx_IsClientConn(con)) + keyusage = RXGK_SERVER_CKSUM_PACKETS; + else + keyusage = RXGK_CLIENT_CKSUM_PACKETS; + + + abort(); + } else + abort(); + + return ret; +} diff --git a/src/rxgk/rxgk_crlha.c b/src/rxgk/rxgk_crlha.c new file mode 100644 index 000000000..458a846a5 --- /dev/null +++ b/src/rxgk/rxgk_crlha.c @@ -0,0 +1,447 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the university nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_crlha.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +#include +#include + +#include + +/* + * krb5 non-des encrypting: + * + * +------------+----------+-------+---------+-----+ + * | confounder | checksum | rxhdr | msg-seq | pad | + * +------------+----------+-------+---------+-----+ + * + * krb5 non-des checksuming only: + * + * +----------+-------+---------+ + * | checksum | rxhdr | msg-seq | + * +----------+-------+---------+ + * + * XXX THIS SHOULD BE FIXED + * so, the checksuming only case includes unnessery data right + * now but I don't care since that makes it easier for me to + * share code between the two cases. + * + */ + +struct rxg_key_type; + +struct rxg_des_keystuff { + des_cblock key; + des_key_schedule sched; + des_key_schedule chksum; + des_cblock iv[RX_MAXCALLS]; +}; + +struct rxg_key { + struct rxg_key_type *type; + rxgk_level level; + union { + struct rxg_des_keystuff des; + } key; +}; + +#define RXG_MAX_CHECKSUM_SIZE 128 + +struct rxg_con { + struct rxg_key key; + struct rxg_key_type *type; +}; + +int +rxg_PacketCheckSum(struct rxg_key_type *, struct rx_packet *, + struct rxg_key *, void *, size_t, int); +int +rxg_check_packet(struct rx_packet *pkt, + struct rx_connection *con, + int clear, + struct rxg_con *kc); +int +rxg_prepare_packet(struct rx_packet *pkt, + struct rx_connection *con, + int clear, + struct rxg_con *kc); + +static void rxg_des_enc(void *, size_t, struct rxg_key *, void *, int); +static void des_setup_iv(struct rx_packet *, struct rxg_key *, void *); +static void des_prepare_key(struct rxg_key *, void *); +static int checksum_pkt_md5_des(struct rx_packet *, struct rxg_key *, + void *, size_t, int); +struct rxg_key_type * rxg_find_enctype(int); + +struct rxg_key_type { + char *name; + int enctype; + int keylen; + int blocklen; + int checksumlen; + int confounderlen; + int ivsize; + void (*prepare_key)(struct rxg_key *, void *key); + void (*setup_iv)(struct rx_packet *, struct rxg_key *, void *iv); + void (*encrypt)(void *, size_t, struct rxg_key *, void *, int); + int (*cksum_pkt)(struct rx_packet *, struct rxg_key *,void *,size_t,int); +}; + +static struct rxg_key_type ktypes[] = { + { "des-cbc-crc", RXGK_CRYPTO_DES_CBC_MD5, + 8, 8, 24, 8, 8, + des_prepare_key, des_setup_iv, rxg_des_enc, checksum_pkt_md5_des + } +}; + +struct rxg_key_type * +rxg_find_enctype(int enctype) +{ + struct rxg_key_type *key; + + for (key = ktypes; key->name != NULL; key++) + if (key->enctype == enctype) + return key; + return NULL; +} + +static void +rxg_des_enc(void *io, size_t sz, struct rxg_key *key, void *iv, int enc) +{ + struct rxg_des_keystuff *ks = &key->key.des; + + assert((sz % 8) == 0); + des_cbc_encrypt(io, io, sz, ks->sched, iv, enc); +} + +static void +des_prepare_key(struct rxg_key *key, void *keym) +{ + struct rxg_des_keystuff *ks; + des_cblock cksumkey; + int i; + + ks = &key->key.des; + + memset(ks, 0, sizeof(*ks)); + + memcpy(ks->key, keym, sizeof(des_cblock)); + des_set_key(&ks->key, ks->sched); + memset(ks->iv, 0, sizeof(ks->iv)); + + for (i = 0; i < 8; i++) + cksumkey[i] = ((char *)keym)[i] ^ 0xF0; + + des_set_key(&cksumkey, ks->chksum); +} + +static void +des_setup_iv(struct rx_packet *pkt, struct rxg_key *key, void *iv) +{ + memset(iv, 0, sizeof(des_cblock)); +} + +static void +rxg_random_data(void *ptr, size_t sz) +{ + memset(ptr, 0, sz); + abort(); +} + + +static int +encrypt_pkt(struct rxg_key_type *kt, struct rx_packet *pkt, + struct rxg_key *key, int encrypt) +{ + u_int len = rx_GetDataSize(pkt); + struct iovec *frag; + void *iv; + + if ((iv = malloc(kt->ivsize)) == NULL) + return ENOMEM; + + (kt->setup_iv)(pkt, key, iv); + + assert((len % kt->blocklen) == 0); + + for (frag = &pkt->wirevec[1]; len; frag++) + { + int iov_len = frag->iov_len; + uint32_t *iov_bas = (uint32_t *) frag->iov_base; + if (iov_len == 0) { + memset(iv, 0, kt->ivsize); + free(iv); + return RXGKPACKETSHORT; /* Length mismatch */ + } + if (len < iov_len) + iov_len = len; /* Don't process to much data */ + + assert((iov_len % kt->blocklen) == 0); + + (*kt->encrypt)(iov_bas, iov_len, key, iv, encrypt); + len -= iov_len; + } + memset(iv, 0, kt->ivsize); + free(iv); + return 0; +} + +#define MAXCONFOUNDER 50 + +struct variable_header_data { + /* Data that changes per packet */ + uint32_t call_number; + uint32_t channel_and_seq; +}; + +static void +getheader(struct rx_packet *pkt, struct variable_header_data *h) +{ + uint32_t t; + + /* Collect selected packet fields */ + h->call_number = htonl(pkt->header.callNumber); + t = ((pkt->header.cid & RX_CHANNELMASK) << (32 - RX_CIDSHIFT)) + | ((pkt->header.seq & 0x3fffffff)); + h->channel_and_seq = htonl(t); +} + + +/* des-cbc(key XOR 0xF0F0F0F0F0F0F0F0, conf | rsa-md5(conf | msg)) */ + +static int +checksum_pkt_md5_des(struct rx_packet *pkt, struct rxg_key *key, + void *checksum, size_t checksumlen, int encrypt) +{ + struct rxg_des_keystuff *ks; + u_int len = rx_GetDataSize(pkt); + struct iovec *frag; + des_cblock iv; + MD5_CTX c; + int cksumsz; + + ks = &key->key.des; + cksumsz = key->type->checksumlen; + + assert(cksumsz == 24); + + memset(&iv, 0, sizeof(iv)); + + MD5_Init(&c); + + for (frag = &pkt->wirevec[1]; len; frag++) + { + int iov_len = frag->iov_len; + char *iov_bas = (char *) frag->iov_base; + + if (iov_len == 0) + return RXGKPACKETSHORT; /* Length mismatch */ + if (len < iov_len) + iov_len = len; /* Don't process to much data */ + + MD5_Update(&c, iov_bas, iov_len); + len -= iov_len; + } + MD5_Final(checksum, &c); + + des_cbc_encrypt(checksum, checksum, cksumsz, ks->chksum, &iv, 1); + + return 0; +} + + +int +rxg_PacketCheckSum(struct rxg_key_type *kt, struct rx_packet *pkt, + struct rxg_key *key, void *cksum, size_t cksumsz, + int encrypt) +{ + (*kt->cksum_pkt)(pkt, key, cksum, cksumsz, encrypt); + return 0; +} + +int +rxg_check_packet(struct rx_packet *pkt, + struct rx_connection *con, + int encrypt, + struct rxg_con *kc) +{ + struct variable_header_data hd; + char sum[RXG_MAX_CHECKSUM_SIZE]; + char sum2[RXG_MAX_CHECKSUM_SIZE]; + char *base; + int ret; + + if (rx_GetPacketCksum(pkt) != 0) + return RXGKSEALEDINCON; + + if (encrypt) { + ret = encrypt_pkt(kc->type, pkt, &kc->key, 0); + if (ret) + return ret; + } + + base = pkt->wirevec[1].iov_base; + if (encrypt) + base += kc->type->confounderlen; + memcpy(sum, base, kc->type->checksumlen); + memset(base, 0, kc->type->checksumlen); + + ret = rxg_PacketCheckSum(kc->type, pkt, &kc->key, sum2, + kc->type->checksumlen, 0); + if (ret) + return ret; + + if (memcmp(sum2, sum, kc->type->checksumlen) != 0) + return RXGKSEALEDINCON; + + getheader(pkt, &hd); + + if (memcmp(base + kc->type->checksumlen, &hd, sizeof(hd)) != 0) + return RXGKSEALEDINCON; + + return 0; +} + +int +rxg_prepare_packet(struct rx_packet *pkt, + struct rx_connection *con, + int encrypt, + struct rxg_con *kc) +{ + char sum[RXG_MAX_CHECKSUM_SIZE]; + u_int len = rx_GetDataSize(pkt); + int diff, ret; + struct variable_header_data hd; + char *base; + + /* checksum in rx header is defined to 0 in rxgss */ + rx_SetPacketCksum(pkt, 0); + + /* + * First we fixup the packet size, its assumed that the checksum + * need to to the operation on blocklen too + */ + + len += rx_GetSecurityHeaderSize(con); /* Extended pkt len */ + + if (encrypt) { + if ((diff = (len % kc->type->blocklen)) != 0) { + rxi_RoundUpPacket(pkt, diff); + len += diff; + } + } + rx_SetDataSize(pkt, len); /* Set extended packet length */ + + diff = kc->type->checksumlen + RXGK_HEADER_DATA_SIZE; + if (encrypt) + diff += kc->type->confounderlen; + + if (pkt->wirevec[1].iov_len < diff) + return RXGKPACKETSHORT; + + base = pkt->wirevec[1].iov_base; + if (encrypt) { + rxg_random_data(base, kc->type->confounderlen); + base += kc->type->confounderlen; + } + memset(base, 0, kc->type->checksumlen); + base += kc->type->checksumlen; + getheader(pkt, &hd); + memcpy(base, &hd, sizeof(hd)); + + /* computer and store checksum of packet */ + ret = rxg_PacketCheckSum(kc->type, pkt, &kc->key, + sum, kc->type->checksumlen, 1); + if (ret) + return ret; + + base = pkt->wirevec[1].iov_base; + if (encrypt) + base += kc->type->confounderlen; + memcpy(base, sum, kc->type->checksumlen); + + if (!encrypt) + return 0; + + return encrypt_pkt(kc->type, pkt, &kc->key, 1); +} + +int +rxgk_set_conn(struct rx_connection *con, int enctype, int enc) +{ + struct rxg_key_type *key; + + key = rxg_find_enctype(enctype); + if (key) + return ENOENT; + + if (enc) { + rx_SetSecurityHeaderSize(con, key->checksumlen + key->confounderlen + + RXGK_HEADER_DATA_SIZE); + rx_SetSecurityMaxTrailerSize(con, key->blocklen); + } else { + rx_SetSecurityHeaderSize(con, + key->checksumlen + RXGK_HEADER_DATA_SIZE); + rx_SetSecurityMaxTrailerSize(con, 0); + } + return 0; +} + + +int +rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e) +{ + return 0; +} + +int +rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e) +{ + return 0; +} + + +#if 0 + +int +main(int argc, char **argv) +{ + krb5_encrypt(); + return 0; +} + +#endif diff --git a/src/rxgk/rxgk_crpc.c b/src/rxgk/rxgk_crpc.c new file mode 100644 index 000000000..4962cb3bb --- /dev/null +++ b/src/rxgk/rxgk_crpc.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_crpc.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +#include +#include "rxgk_proto.h" +#include "rxgk_proto.cs.h" + +#include + +int +rxgk5_get_auth_token(krb5_context context, uint32_t addr, int port, + uint32_t serviceId, + RXGK_Token *token, + RXGK_Token *auth_token, krb5_keyblock *key, + krb5_keyblock *skey, + int32_t *kvno) +{ + struct rx_securityClass *secobj; + struct rx_connection *conn; + RXGK_Token challange, reply_token; + uint32_t num; + int ret; + + memset(skey, 0, sizeof(*skey)); + + secobj = rxnull_NewClientSecurityObject(); + + conn = rx_NewConnection(addr, port, serviceId, secobj, 0); + if (conn == NULL) + return ENETDOWN; + + num = arc4random(); + + ret = rxk5_mutual_auth_client_generate(context, key, num, &challange); + if (ret) { + rx_DestroyConnection(conn); + return ret; + } + + ret = RXGK_EstablishKrb5Context(conn, token, &challange, + &reply_token, kvno, auth_token); + if (ret) { + rx_DestroyConnection(conn); + return ret; + } + + ret = rxk5_mutual_auth_client_check(context, key, num, &reply_token, skey); + + rx_DestroyConnection(conn); + + return ret; +} diff --git a/src/rxgk/rxgk_info.c b/src/rxgk/rxgk_info.c new file mode 100644 index 000000000..bfb30ff72 --- /dev/null +++ b/src/rxgk/rxgk_info.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_info.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +int32_t +rxgk_GetServerInfo(struct rx_connection *con, + rxgk_level *level, + uint32_t *expiration, + char *name, size_t name_size, + char *cell, size_t cell_size, + int32_t *kvno) +{ + serv_con_data *cdat = (serv_con_data *) con->securityData; + + if (cdat && cdat->authenticated + && (time(0) < cdat->expires)) + { + if (level) + *level = cdat->cur_level; + if (expiration) + *expiration = cdat->expires; + return 0; + } + else + return RXGKNOAUTH; +} diff --git a/src/rxgk/rxgk_locl.h b/src/rxgk/rxgk_locl.h new file mode 100644 index 000000000..b6f544bad --- /dev/null +++ b/src/rxgk/rxgk_locl.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id: rxgk_locl.h,v 1.1 2004/08/08 19:21:33 shadow Exp $ */ + +#ifndef __RXGK_LOCL_H +#define __RXGK_LOCL_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include +#include + +#include +#include "rxgk_proto.h" + +#ifdef NDEBUG +#ifndef assert +#define assert(e) ((void)0) +#endif +#else +#ifndef assert +#define assert(e) ((e) ? (void)0 : (void)osi_Panic("assert(%s) failed: file %s, line %d\n", #e, __FILE__, __LINE__, #e)) +#endif +#endif + +#undef RCSID +#include +#include +#undef RCSID +#define RCSID(msg) \ +static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } + +extern int rx_epoch, rx_nextCid; + +#include "rxgk.h" + +#define rxgk_disipline 3 + +#define rxgk_unallocated 1 +#define rxgk_authenticated 2 +#define rxgk_expired 4 +#define rxgk_checksummed 8 + +typedef struct key_stuff { + krb5_context ks_context; + krb5_keyblock ks_key; + uint32_t ks_recv_seqnum; + krb5_keyblock ks_skey; + krb5_crypto ks_crypto; /* rx session key */ + krb5_crypto ks_scrypto; /* rx stream key */ +} key_stuff; + +typedef struct end_stuff { + /* need 64 bit counters */ + uint32_t bytesReceived, packetsReceived, bytesSent, packetsSent; +} end_stuff; + +extern int rxgk_key_contrib_size; + +int +rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e); + +int +rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con, + int level, key_stuff *k, end_stuff *e); + +/* Per connection specific server data */ +typedef struct serv_con_data { + end_stuff e; + key_stuff k; + uint32_t expires; + uint32_t nonce; + rxgk_level cur_level; /* Starts at min_level and can only increase */ + char authenticated; +} serv_con_data; + +/* rxgk */ + +int +rxgk5_get_auth_token(krb5_context context, uint32_t addr, int port, + uint32_t serviceId, + RXGK_Token *token, + RXGK_Token *auth_token, krb5_keyblock *key, + krb5_keyblock *skey, + int32_t *kvno); + +int +rxk5_mutual_auth_client_generate(krb5_context context, krb5_keyblock *key, + uint32_t number, + RXGK_Token *challage_token); +int +rxk5_mutual_auth_client_check(krb5_context context, krb5_keyblock *key, + uint32_t number, + const RXGK_Token *reply_token, + krb5_keyblock *rxsession_key); +int +rxk5_mutual_auth_server(krb5_context context, krb5_keyblock *key, + const RXGK_Token *challage_token, + int *enctype, + void **session_key, size_t *session_key_size, + RXGK_Token *reply_token); + +int +rxgk_set_conn(struct rx_connection *, int, int); + +int +rxgk_decode_auth_token(void *data, size_t len, struct RXGK_AUTH_CRED *c); + +void +rxgk_getheader(struct rx_packet *pkt, struct rxgk_header_data *h); + +int +rxgk_server_init(void); + +#if 0 +int +rxgk_derive_transport_key(krb5_context context, + krb5_keyblock *rx_conn_key, + RXGK_rxtransport_key *keycontrib, + krb5_keyblock *rkey); +#endif + +int +rxgk_random_to_key(int, void *, int, krb5_keyblock *); + +#endif /* __RXGK_LOCL_H */ diff --git a/src/rxgk/rxgk_proto.xg b/src/rxgk/rxgk_proto.xg new file mode 100644 index 000000000..a7d78baf6 --- /dev/null +++ b/src/rxgk/rxgk_proto.xg @@ -0,0 +1,202 @@ +/* hej emacs det h{r {r en -*- c -*- fil */ + +/* + * Copyright (c) 2002 - 2004, Stockholms Universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +/* $Id: rxgk_proto.xg,v 1.1 2004/08/08 19:21:33 shadow Exp $ */ + +package RXGK_ + +const RXGK_MAX_TOKEN_LEN = 65536; +const RXGK_MAX_AUTHTOKEN = 256; + +/* ctext is limited by mtu since its part of responce */ +const RXGK_MAX_CTEXT = 768; + +const RXGK_SERVICE_ID = 34567; + +#define RXGK_ESTABLISH_KRB5_CONTEXT 1 +#define RXGK_ESTABLISH_GSS_CONTEXT 2 +#define RXGK_EXCHANGE_GSS_KEYS 3 + +typedef opaque RXGK_Token; + +/* + * + */ + +const RXGK_KEY_VERSION = 1; +const RXGK_KEY_MAXSIZE = 256; +const RXGK_KEY_MAXPRINCIPAL = 640; +const RXGK_KEY_ENCTYPES = 32; + +/* + * Challange token in the + */ + +const RXGK_CR_TOKEN_VERSION = 1; + +struct RXGK_CHALLENGE_TOKEN { + afs_int32 ct_version; + afs_uint32 ct_nonce; + afs_uint32 ct_enctype; /* listed in order of pref */ +}; + +/* + * Reply token in the EstablishKrb5Context + */ + +struct RXGK_REPLY_TOKEN { + afs_int32 rt_version; + afs_int32 rt_flags; /* other support ops */ + afs_int32 rt_error; + afs_uint32 rt_nonce; + afs_uint32 rt_enctype; + opaque rt_key; +}; + +/* + * Rx auth cred equivalent + */ + +struct RXGK_AUTH_CRED { + afs_int32 ac_version; /* version of format of RXGK_AUTH_CRED */ + string ac_principal; /* prefixed with mech */ + afs_int32 ac_starttime; + afs_int32 ac_endtime; + afs_int32 ac_enctype; + opaque ac_key; +}; + +/* + * This is part of the rxs challange/response exchange. Its somewhat + * complicated since it support rekeying of a data stream. + */ + +const RXGK_VERSION = 3; + +const RXKG_OPCODE_CHALLENGE = 1; +const RXKG_OPCODE_REKEY = 2; + +struct RXGK_Challenge { + afs_uint32 rc_version; + afs_uint32 rc_nonce; + afs_uint32 rc_opcode; + afs_uint32 rc_max_seq_skew; /* packets accepted when rekey */ + afs_uint32 rc_min_level; +}; + +/* is the auth_token EstablishKrb5Context returned */ +struct RXGK_Response { + afs_uint32 rr_version; + afs_uint32 rr_auth_token_kvno; + opaque rr_auth_token; + opaque rr_ctext; +}; + +struct RXGK_Response_Crypt { + afs_uint32 nonce; + afs_uint32 epoch; + afs_uint32 cid; + afs_uint32 call_numbers[4]; + afs_uint32 level; + afs_uint32 key_version; + afs_uint32 key_counter_hi; + afs_uint32 key_counter_lo; +}; + +/* + * Kerberos crypto framework enctypes + */ + +const RXGK_CRYPTO_NULL = 0; +const RXGK_CRYPTO_DES_CBC_CRC = 1; +const RXGK_CRYPTO_DES_CBC_MD4 = 2; +const RXGK_CRYPTO_DES_CBC_MD5 = 4; +const RXGK_CRYPTO_DES3_SHA1_KD = 16; + +const RXGK_CRYPTO_CKSUM_RSA_DES_MD5 = 8; + +const RXGK_CLIENT_TO_SERVER = 0; +const RXGK_SERVER_TO_CLIENT = 1; + +const RXGK_CLIENT_ENC_CHALLENGE = 1026; +const RXGK_SERVER_ENC_REKEY = 1026; +const RXGK_CLIENT_ENC_PACKETS = 1027; +const RXGK_CLIENT_CKSUM_PACKETS = 1028; +const RXGK_SERVER_ENC_PACKETS = 1029; +const RXGK_SERVER_CKSUM_PACKETS = 1030; + +/* + * In packet protection since header isn't checksum-ed + */ + +struct rxgk_header_data { + uint32_t call_number; + uint32_t channel_and_seq; +}; + +/* + * rx connection key + */ + +struct RXGK_rxconn_key { + afs_uint32 rxk_cid; + afs_uint32 rxk_epoch; +}; + +#if 0 + +const RXGK_MAX_KEYCONTRIB= 256; /* MUST only be used from server->client */ + +struct RXGK_ReKey { + opaque rk_ctext; +}; + +struct RXGK_ReKey_Crypt { + afs_int32 rkc_version; + afs_int32 rkc_max_seq_num; + afs_int32 rkc_kvno; /* 16 bit number */ + opaque rkc_keycontribution; +}; + +/* rx transport key */ + +struct RXGK_rxtransport_key { + opaque client_keycontribution; + opaque server_keycontribution; +}; + +#endif + +/* + * kerberos auth_token + */ + +EstablishKrb5Context(IN RXGK_Token *token, + IN RXGK_Token *challenge_token, + OUT RXGK_Token *reply_token, + OUT int32_t *auth_token_kvno, + OUT RXGK_Token *auth_token) = RXGK_ESTABLISH_KRB5_CONTEXT; + +/* + * Add gss stuff here + */ + +#if 0 + +EstablishGssContext(IN RXGK_Token *in_token, + OUT RXGK_Token *out_token) = RXGK_ESTABLISH_GSS_CONTEXT; + +ExchangeGSSKeys(IN RXGK_Token *challenge_token, + OUT RXGK_Token *reply_token, + OUT int32_t *auth_token_kvno, + OUT RXGK_Token *auth_token) = RXGK_EXCHANGE_GSS_KEYS; + +#endif + diff --git a/src/rxgk/rxgk_serv.c b/src/rxgk/rxgk_serv.c new file mode 100644 index 000000000..6f55768b6 --- /dev/null +++ b/src/rxgk/rxgk_serv.c @@ -0,0 +1,498 @@ +/* + * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_serv.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +#include + +#include "rxgk_proto.ss.h" + +/* Security object specific server data */ +typedef struct rxgk_serv_class { + struct rx_securityClass klass; + rxgk_level min_level; + char *principal; + char *service_principal; + void *appl_data; + int (*get_key)(void *, const char *, int, int, krb5_keyblock *); + int (*user_ok)(const char *name, const char *realm, int kvno); + uint32_t serviceId; +} rxgk_serv_class; + +extern krb5_context gk_context; +extern krb5_crypto gk_crypto; + +static int +server_NewConnection(struct rx_securityClass *obj, struct rx_connection *con) +{ + serv_con_data *cdat; + assert(con->securityData == 0); + assert(gk_context != NULL); + obj->refCount++; + con->securityData = (char *) osi_Alloc(sizeof(serv_con_data)); + memset(con->securityData, 0x0, sizeof(serv_con_data)); + cdat = (serv_con_data *)con->securityData; + cdat->k.ks_context = gk_context; + return 0; +} + +static int +server_Close(struct rx_securityClass *obj) +{ + obj->refCount--; + if (obj->refCount <= 0) + osi_Free(obj, sizeof(rxgk_serv_class)); + return 0; +} + +static +int +server_DestroyConnection(struct rx_securityClass *obj, + struct rx_connection *con) +{ + serv_con_data *cdat = (serv_con_data *)con->securityData; + + if (cdat) + osi_Free(cdat, sizeof(serv_con_data)); + return server_Close(obj); +} + +/* + * Check whether a connection authenticated properly. + * Zero is good (authentication succeeded). + */ +static int +server_CheckAuthentication(struct rx_securityClass *obj, + struct rx_connection *con) +{ + serv_con_data *cdat = (serv_con_data *) con->securityData; + + if (cdat) + return !cdat->authenticated; + else + return RXGKNOAUTH; +} + +/* + * Select a nonce for later use. + */ +static +int +server_CreateChallenge(struct rx_securityClass *obj_, + struct rx_connection *con) +{ + serv_con_data *cdat = (serv_con_data *) con->securityData; + + cdat->nonce = arc4random(); + cdat->authenticated = 0; + return 0; +} + +/* + * Wrap the nonce in a challenge packet. + */ +static int +server_GetChallenge(const struct rx_securityClass *obj_, + const struct rx_connection *con, + struct rx_packet *pkt) +{ + rxgk_serv_class *obj = (rxgk_serv_class *) obj_; + serv_con_data *cdat = (serv_con_data *) con->securityData; + struct RXGK_Challenge c; + int initial_challage = 1; + + c.rc_version = htonl(RXGK_VERSION); + c.rc_nonce = htonl(cdat->nonce); + c.rc_max_seq_skew = htonl(200); /* XXX */ + c.rc_min_level = htonl(obj->min_level); + + if (initial_challage) { + /* Make challenge */ + c.rc_opcode = htonl(RXKG_OPCODE_CHALLENGE); + + /* Stuff into packet */ + if (rx_SlowWritePacket(pkt, 0, sizeof(c), &c) != sizeof(c)) + return RXGKPACKETSHORT; + rx_SetDataSize(pkt, sizeof(c)); +#if 0 + } else { + RXGK_ReKey rk; + RXGK_ReKey_Crypt rkc; + char bufrk[RXGK_REKEY_MAX_SIZE]; + char bufrkc[RXGK_REKEY_CRYPT_MAX_SIZE]; + krb5_data data; + size_t sz; + int ret; + key_stuff *k = &cdat->k; + + memset(&rk, 0, sizeof(rk)); + memset(&rkc, 0, sizeof(rkc)); + + c.rc_opcode = htonl(RXKG_OPCODE_REKEY); + + if (rx_SlowWritePacket(pkt, 0, sizeof(c), &c) != sizeof(c)) + return RXGKPACKETSHORT; + + rkc.rkc_version = RXGK_VERSION; + rkc.rkc_max_seq_num = 200; /* XXX */ + rkc.rkc_kvno = /* current_key + 1 */ 1; + rkc.rkc_keycontribution.len = 0; /* XXX */ + rkc.rkc_keycontribution.val = NULL; + + sz = RXGK_REKEY_CRYPT_MAX_SIZE; + if (ydr_encode_RXGK_ReKey_Crypt(&rkc, bufrkc, &sz) == NULL) + return RXGKPACKETSHORT; + sz = RXGK_REKEY_CRYPT_MAX_SIZE - sz; + + ret = krb5_encrypt(k->ks_context, k->ks_crypto, + RXGK_SERVER_ENC_REKEY, bufrkc, sz, &data); + if (ret) + return ret; + + rk.rk_ctext.val = data.data; + rk.rk_ctext.len = data.length; + + sz = RXGK_REKEY_MAX_SIZE; + if (ydr_encode_RXGK_ReKey(&rk, bufrk, &sz) == NULL) { + krb5_data_free(&data); + return RXGKPACKETSHORT; + } + sz = RXGK_REKEY_MAX_SIZE - sz; + + krb5_data_free(&data); + + if (rx_SlowWritePacket(pkt, sizeof(c), sz, bufrk) != sz) + return RXGKPACKETSHORT; + + rx_SetDataSize(pkt, sizeof(c) + sz); +#endif + } + return 0; +} + +/* + * Process a response to a challange. + */ +static int +server_CheckResponse(struct rx_securityClass *obj_, + struct rx_connection *con, + struct rx_packet *pkt) +{ + serv_con_data *cdat = (serv_con_data *) con->securityData; + + struct RXGK_Response r; + struct RXGK_Response_Crypt rc; + struct RXGK_AUTH_CRED c; + char response[RXGK_RESPONSE_MAX_SIZE]; + size_t len, len2; + int ret; + krb5_context context = cdat->k.ks_context; + krb5_data data; + + memset(&r, 0, sizeof(r)); + memset(&c, 0, sizeof(r)); + + len = rx_SlowReadPacket(pkt, 0, sizeof(response), response); + if (len <= 0) + return RXGKPACKETSHORT; + + len2 = len; + if (ydr_decode_RXGK_Response(&r, response, &len2) == NULL) { + ret = RXGKPACKETSHORT; + goto out; + } + + ret = rxgk_decode_auth_token(r.rr_auth_token.val, r.rr_auth_token.len, &c); + if (ret) + goto out; + + ret = rxgk_random_to_key(c.ac_enctype, c.ac_key.val, c.ac_key.len, + &cdat->k.ks_key); + if (ret) + goto out; + + cdat->k.ks_crypto = NULL; /* XXX */ + ret = krb5_crypto_init(context, &cdat->k.ks_key, cdat->k.ks_key.keytype, + &cdat->k.ks_crypto); + if (ret) + goto out2; + + + ret = krb5_decrypt(context, cdat->k.ks_crypto, RXGK_CLIENT_ENC_CHALLENGE, + r.rr_ctext.val, r.rr_ctext.len, &data); + if (ret) + goto out2; + + len = data.length; + if (ydr_decode_RXGK_Response_Crypt(&rc, data.data, &len) == NULL) { + krb5_data_free(&data); + goto out2; + } + + krb5_data_free(&data); + + if (rc.epoch != con->epoch + || rc.cid != (con->cid & RX_CIDMASK) +#if 0 + || rc.security_index != con->securityIndex +#endif + ) { + ret = RXGKSEALEDINCON; + goto out2; + } + + { + int i; + for (i = 0; i < RX_MAXCALLS; i++) + { + if (rc.call_numbers[i] < 0) { + ret = RXGKSEALEDINCON; + goto out2; + } + } + + } + + if (rc.nonce != cdat->nonce + 1) { + ret = RXGKOUTOFSEQUENCE; + goto out2; + } + + /* XXX */ + if (rc.level != rxgk_crypt) { + ret = RXGKLEVELFAIL; + goto out2; + } + + if ((rc.level != rxgk_auth && rc.level != rxgk_crypt) || + rc.level < cdat->cur_level) + { + ret = RXGKLEVELFAIL; + goto out2; + } + +#if 0 + ret = rxgk_derive_transport_key(context, &cdat->k.ks_key, + &rc.contrib, &cdat->k.ks_skey); + if (ret) + goto out2; +#endif + + ret = krb5_crypto_init (context, &cdat->k.ks_skey, + cdat->k.ks_skey.keytype, + &cdat->k.ks_scrypto); + if (ret) + goto out2; + + rxi_SetCallNumberVector(con, rc.call_numbers); + + cdat->authenticated = 1; + cdat->expires = c.ac_endtime; + cdat->cur_level = rc.level; + + rxgk_set_conn(con, cdat->k.ks_key.keytype, + rc.level == rxgk_crypt ? 1 : 0); + + out2: + if (ret) { + krb5_free_keyblock_contents(context, &cdat->k.ks_key); + if (cdat->k.ks_crypto) + krb5_crypto_destroy(context, cdat->k.ks_crypto); + cdat->k.ks_crypto = NULL; + } + + out: + + ydr_free_RXGK_AUTH_CRED(&c); + ydr_free_RXGK_Response(&r); + + return ret; +} + +/* + * Checksum and/or encrypt packet + */ +static int +server_PreparePacket(struct rx_securityClass *obj_, + struct rx_call *call, + struct rx_packet *pkt) +{ + struct rx_connection *con = rx_ConnectionOf(call); + serv_con_data *cdat = (serv_con_data *) con->securityData; + key_stuff *k = &cdat->k; + end_stuff *e = &cdat->e; + + return rxgk_prepare_packet(pkt, con, cdat->cur_level, k, e); +} + +/* + * Verify checksum and/or decrypt packet. + */ +static int +server_CheckPacket(struct rx_securityClass *obj_, + struct rx_call *call, + struct rx_packet *pkt) +{ + struct rx_connection *con = rx_ConnectionOf(call); + serv_con_data *cdat = (serv_con_data *) con->securityData; + key_stuff *k = &cdat->k; + end_stuff *e = &cdat->e; + + if (time(0) > cdat->expires) /* Use fast time package instead??? */ + return RXGKEXPIRED; + + return rxgk_check_packet(pkt, con, cdat->cur_level, k, e); +} + +static int +server_GetStats(const struct rx_securityClass *obj_, + const struct rx_connection *con, + struct rx_securityObjectStats *st) +{ + rxgk_serv_class *obj = (rxgk_serv_class *) obj_; + serv_con_data *cdat = (serv_con_data *) con->securityData; + + st->type = rxgk_disipline; + st->level = obj->min_level; + st->flags = rxgk_checksummed; + if (cdat == 0) + st->flags |= rxgk_unallocated; + { + st->bytesReceived = cdat->e.bytesReceived; + st->packetsReceived = cdat->e.packetsReceived; + st->bytesSent = cdat->e.bytesSent; + st->packetsSent = cdat->e.packetsSent; + st->expires = cdat->expires; + st->level = cdat->cur_level; + if (cdat->authenticated) + st->flags |= rxgk_authenticated; + } + return 0; +} + +static +void +free_context(void) +{ + return; +} + +static +int +server_NewService(const struct rx_securityClass *obj_, + struct rx_service *service, + int reuse) +{ + rxgk_serv_class *obj = (rxgk_serv_class *) obj_; + + if (service->serviceId == obj->serviceId) + return 0; + + if (!reuse) { + struct rx_securityClass *sec[2]; + struct rx_service *secservice; + + sec[0] = rxnull_NewServerSecurityObject(); + sec[1] = NULL; + + secservice = rx_NewService (service->servicePort, + obj->serviceId, + "rxgk", + sec, 1, + RXGK_ExecuteRequest); + + secservice->destroyConnProc = free_context; + rx_setServiceRock(secservice, obj->principal); + } + return 0; +} + + +static struct rx_securityOps server_ops = { + server_Close, + server_NewConnection, + server_PreparePacket, + NULL, + server_CheckAuthentication, + server_CreateChallenge, + server_GetChallenge, + NULL, + server_CheckResponse, + server_CheckPacket, + server_DestroyConnection, + server_GetStats, + server_NewService, +}; + +struct rx_securityClass * +rxgk_NewServerSecurityObject(/*rxgk_level*/ int min_level, + const char *principal, + void *appl_data, + int (*get_key)(void *data, const char *principal, + int enctype, int kvno, + krb5_keyblock *key), + int (*user_ok)(const char *name, + const char *realm, + int kvno), + uint32_t serviceId) +{ + rxgk_serv_class *obj; + int ret; + + if (get_key == NULL || principal == NULL) + return NULL; + + ret = rxgk_server_init(); + if (ret) + return NULL; + + obj = (rxgk_serv_class *) osi_Alloc(sizeof(rxgk_serv_class)); + obj->klass.refCount = 1; + obj->klass.ops = &server_ops; + obj->klass.privateData = (char *) obj; + + obj->min_level = min_level; + obj->appl_data = appl_data; + obj->get_key = get_key; + obj->user_ok = user_ok; + obj->principal = strdup(principal); + if (obj->principal == NULL) { + osi_Free(obj, sizeof(rxgk_serv_class)); + return NULL; + } + obj->serviceId = serviceId; + + return &obj->klass; +} diff --git a/src/rxgk/rxgk_srpc.c b/src/rxgk/rxgk_srpc.c new file mode 100644 index 000000000..9567b26fb --- /dev/null +++ b/src/rxgk/rxgk_srpc.c @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +#include "rxgk_locl.h" + +RCSID("$Id: rxgk_srpc.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +#include + +#include +#include "rxgk_proto.h" +#include "rxgk_proto.ss.h" + +/* XXX need to pthread lock these */ +krb5_context gk_context; +static krb5_keyblock gk_key; +krb5_crypto gk_crypto; +static int gk_kvno; + +static int +get_key(const char *keytab_string, const char *p, int enctype, int kvno, + krb5_keyblock *key) +{ + krb5_error_code ret; + krb5_keytab keytab; + krb5_principal princ; + char keytab_buf[256]; + krb5_keytab_entry ktentry; + + ret = krb5_parse_name(gk_context, p, &princ); + if (ret) + return ret; + + if (keytab_string == NULL) { + ret = krb5_kt_default_name (gk_context, keytab_buf,sizeof(keytab_buf)); + if (ret) + krb5_err(gk_context, 1, ret, "resolving keytab %s", keytab_string); + keytab_string = keytab_buf; + } + ret = krb5_kt_resolve(gk_context, keytab_string, &keytab); + if (ret) + krb5_err(gk_context, 1, ret, "resolving keytab %s", keytab_string); + + ret = krb5_kt_get_entry (gk_context, keytab, princ, kvno, + enctype, &ktentry); + if (ret) + krb5_err(gk_context, 1, ret, "krb5_kt_get_entry %s", p); + + krb5_copy_keyblock_contents(gk_context, &ktentry.keyblock, key); + /* ktentry.vno */ + + krb5_kt_free_entry(gk_context, &ktentry); + + krb5_kt_close(gk_context, keytab); + + krb5_free_principal(gk_context, princ); + + return ret; +} + +int +rxgk_default_get_key(void *data, const char *p, int enctype, int kvno, + krb5_keyblock *key) +{ + int ret; + + ret = rxgk_server_init(); + if (ret) + return ret; + + return get_key(NULL, p, enctype, kvno, key); +} + + +int +rxgk_server_init(void) +{ + static int inited = 0; + int ret; + + if (inited) + return 0; + + if (krb5_init_context(&gk_context)) + return EINVAL; + + ret = get_key(NULL, "gkkey@L.NXS.SE", 0, 0, &gk_key); /* XXX */ + if (ret) { + krb5_free_context(gk_context); + gk_context = NULL; + return ret; + } + + ret = krb5_crypto_init(gk_context, &gk_key, gk_key.keytype, + &gk_crypto); + if (ret) { + krb5_free_keyblock_contents(gk_context, &gk_key); + krb5_free_context(gk_context); + gk_context = NULL; + return ret; + } + + + inited = 1; + + return 0; +} + +static int +build_auth_token(krb5_context context, const char *princ, + int32_t start, int32_t end, + krb5_keyblock *key, + int session_enctype, + void *session_key, size_t session_key_size, + int32_t *auth_token_kvno, RXGK_Token *auth_token) +{ + struct RXGK_AUTH_CRED cred; + krb5_data data; + void *ptr; + int sz, ret; + + sz = RXGK_AUTH_CRED_MAX_SIZE; + ptr = malloc(sz); + if (ptr == NULL) + return ENOMEM; + + cred.ac_version = RXGK_KEY_VERSION; + strlcpy(cred.ac_principal, princ, sizeof(cred.ac_principal)); + cred.ac_starttime = start; + cred.ac_endtime = end; + cred.ac_enctype = session_enctype; + cred.ac_key.len = session_key_size; + cred.ac_key.val = session_key; + + if (ydr_encode_RXGK_AUTH_CRED(&cred, ptr, &sz) == NULL) { + free(ptr); + return EINVAL; + } + sz = RXGK_AUTH_CRED_MAX_SIZE - sz; + + ret = krb5_encrypt(context, gk_crypto, 0, ptr, sz, &data); + if (ret) { + free(ptr); + return ret; + } + + if (data.length > RXGK_AUTH_CRED_MAX_SIZE) { + free(ptr); + return EINVAL; + } + + memcpy(ptr, data.data, data.length); + + auth_token->len = data.length; + auth_token->val = ptr; + *auth_token_kvno = gk_kvno; + + krb5_data_free(&data); + + return 0; +} + +int +rxgk_decode_auth_token(void *val, size_t len, RXGK_AUTH_CRED *c) +{ + krb5_data data; + size_t sz; + int ret; + + memset(c, 0, sizeof(*c)); + + ret = krb5_decrypt(gk_context, gk_crypto, 0, val, len, &data); + if (ret) + return ret; + + sz = data.length; + if (ydr_decode_RXGK_AUTH_CRED(c, data.data, &sz) == NULL) { + if (c->ac_key.val) + free(c->ac_key.val); + memset(c, 0, sizeof(*c)); + ret = RXGKBADTICKET; + } + + krb5_data_free(&data); + + return ret; +} + +/* XXX share */ + +static int +decode_v5(krb5_context context, + int (*get_key)(void *appl_data, const char *p, int enctype, + int kvno, krb5_keyblock *key), + void *appl_data, + const char *princ, + char *ticket, + int32_t ticket_len, + /* OUT parms */ + krb5_principal *p, + krb5_keyblock *key, + int32_t *starts, + int32_t *expires) +{ + krb5_keyblock serv_key; + int code; + size_t siz; + + Ticket t5; /* Must free */ + EncTicketPart decr_part; /* Must free */ + krb5_data plain; /* Must free */ + krb5_crypto crypto; /* Must free */ + + memset(&t5, 0x0, sizeof(t5)); + memset(&decr_part, 0x0, sizeof(decr_part)); + krb5_data_zero(&plain); + memset(&serv_key, 0, sizeof(serv_key)); + crypto = NULL; + + code = decode_Ticket(ticket, ticket_len, &t5, &siz); + if (code != 0) + goto bad_ticket; + + code = (*get_key)(appl_data, princ, + t5.enc_part.etype, t5.tkt_vno, &serv_key); + if (code) + goto unknown_key; + + code = krb5_crypto_init (context, &serv_key, t5.enc_part.etype, + &crypto); + krb5_free_keyblock_contents(context, &serv_key); + if (code) + goto bad_ticket; + + /* Decrypt ticket */ + code = krb5_decrypt(context, + crypto, + 0, + t5.enc_part.cipher.data, + t5.enc_part.cipher.length, + &plain); + + if (code) + goto bad_ticket; + + /* Decode ticket */ + code = decode_EncTicketPart(plain.data, plain.length, &decr_part, &siz); + if (code != 0) + goto bad_ticket; + + /* principal */ + code = principalname2krb5_principal(p, decr_part.cname, decr_part.crealm); + if (code) + goto bad_ticket; + + /* Extract session key */ + code = krb5_copy_keyblock_contents(context, &decr_part.key, key); + if (code) + goto bad_ticket; + + /* Check lifetimes and host addresses, flags etc */ + { + time_t now = time(0); /* Use fast time package instead??? */ + time_t start = decr_part.authtime; + if (decr_part.starttime) + start = *decr_part.starttime; + if (start - now > context->max_skew || decr_part.flags.invalid) + goto no_auth; + if (now > decr_part.endtime) + goto tkt_expired; + *starts = start; + *expires = decr_part.endtime; + } + +#if 0 + /* Check host addresses */ +#endif + + cleanup: + free_Ticket(&t5); + free_EncTicketPart(&decr_part); + krb5_data_free(&plain); + if (crypto) + krb5_crypto_destroy(context, crypto); + if (code) { + krb5_free_principal(context, *p); + *p = NULL; + } + return code; + + unknown_key: + code = RXGKUNKNOWNKEY; + goto cleanup; + no_auth: + code = RXGKNOAUTH; + goto cleanup; + tkt_expired: + code = RXGKEXPIRED; + goto cleanup; + bad_ticket: + code = RXGKBADTICKET; + goto cleanup; +} + +int +SRXGK_EstablishKrb5Context(struct rx_call *call, + const RXGK_Token *token, + const RXGK_Token *challage_token, + RXGK_Token *reply_token, + int32_t *auth_token_kvno, + RXGK_Token *auth_token) +{ + krb5_principal principal; + krb5_keyblock key; + int32_t starts, expires; + char *cprinc, *sprinc; + void *session_key; + size_t session_key_size; + int session_enctype; + int ret; + + ret = rxgk_server_init(); + if (ret) + return ret; + + if ((sprinc = rx_getServiceRock(call->conn->service)) == NULL) + return EINVAL; + + session_key = NULL; + + key.keyvalue.data = NULL; + + auth_token->len = reply_token->len = 0; + auth_token->val = reply_token->val = NULL; + + ret = decode_v5(gk_context, rxgk_default_get_key, NULL, sprinc, + token->val, token->len, + &principal, &key, &starts, &expires); + if (ret) + goto out; + + ret = rxk5_mutual_auth_server(gk_context, + &key, + challage_token, + &session_enctype, + &session_key, + &session_key_size, + reply_token); + if (ret) + goto out; + + ret = krb5_unparse_name(gk_context, principal, &cprinc); + if (ret) + goto out; + + ret = build_auth_token(gk_context, cprinc, starts, expires, &key, + session_enctype, session_key, session_key_size, + auth_token_kvno, auth_token); + + free(cprinc); + + out: + if (session_key) { + memset(session_key, 0, session_key_size); + free(session_key); + } + if (key.keyvalue.data != NULL) + krb5_free_keyblock_contents(gk_context, &key); + + if (ret) { + if (reply_token->val) + free(reply_token->val); + reply_token->len = 0; + reply_token->val = NULL; + + if (auth_token->val) + free(auth_token->val); + auth_token->len = 0; + auth_token->val = NULL; + } + + return ret; +} diff --git a/src/rxgk/test.xg b/src/rxgk/test.xg new file mode 100644 index 000000000..014b3de04 --- /dev/null +++ b/src/rxgk/test.xg @@ -0,0 +1,21 @@ +/* hej emacs det h{r {r en -*- c -*- fil */ + +/* + * Copyright (c) 2002, Stockholms Universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +/* $Id: test.xg,v 1.1 2004/08/08 19:21:33 shadow Exp $ */ + +package TEST_ + +const TEST_DEFAULT_PORT = 7009; + +const TEST_RXGK_SERVICE = 64000; + +const TEST_SERVICE_ID = 10; + +get_hundraelva(OUT afs_int32 *foo, OUT string bar<100>) = 18; diff --git a/src/rxgk/test_client.c b/src/rxgk/test_client.c new file mode 100644 index 000000000..ab51d2dde --- /dev/null +++ b/src/rxgk/test_client.c @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +#include +#include +#include + +#include +#include +#include + +#include "rxgk_locl.h" +#include "rxgk_proto.cs.h" +#include "test.cs.h" + +RCSID("$Id: test_client.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +/* + * + */ + +static u_long +str2addr (const char *s) +{ + struct in_addr server; + struct hostent *h; + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + if (inet_addr(s) != INADDR_NONE) + return inet_addr(s); + h = gethostbyname (s); + if (h != NULL) { + memcpy (&server, h->h_addr_list[0], sizeof(server)); + return server.s_addr; + } + return 0; +} + + +static int +get_krb5_token(krb5_context ctx, krb5_keyblock **key, RXGK_Token *token) +{ + krb5_error_code ret; + krb5_creds in_creds, *out_creds; + krb5_ccache id; + char *realm = "L.NXS.SE"; + int realm_len = strlen(realm); + + memset(token, 0, sizeof(*token)); + + ret = krb5_cc_default (ctx, &id); + if (ret) + return ret; + + memset(&in_creds, 0, sizeof(in_creds)); + ret = krb5_build_principal(ctx, &in_creds.server, + realm_len, realm, "afs", NULL); + if(ret) + return ret; + ret = krb5_build_principal(ctx, &in_creds.client, + realm_len, realm, "lha", NULL); + if(ret){ + krb5_free_principal(ctx, in_creds.server); + return ret; + } + in_creds.session.keytype = KEYTYPE_DES; /* XXX */ + ret = krb5_get_credentials(ctx, 0, id, &in_creds, &out_creds); + krb5_free_principal(ctx, in_creds.server); + krb5_free_principal(ctx, in_creds.client); + if(ret) + return ret; + + token->val = malloc(out_creds->ticket.length); + if (token->val == NULL) { + krb5_free_creds(ctx, out_creds); + return ENOMEM; + } + token->len = out_creds->ticket.length; + memcpy(token->val, out_creds->ticket.data, out_creds->ticket.length); + + ret = krb5_copy_keyblock(ctx, &out_creds->session, key); + + krb5_free_creds(ctx, out_creds); + + return ret; +} + +/* + * + */ + +static void +test_est_context(krb5_context context, uint32_t addr, int port, + RXGK_Token *ticket, krb5_keyblock *key) +{ + RXGK_Token auth_token; + krb5_keyblock skey; + int32_t kvno; + int ret; + + /* kernel */ + + ret = rxgk5_get_auth_token(context, addr, port, + TEST_RXGK_SERVICE, + ticket, &auth_token, key, &skey, &kvno); + if (ret) + errx(1, "rxgk5_get_auth_token: %d", ret); + + printf("EstablishKrb5Context succeeded " + "len: %d, version: %d, enctype: %d\n", + auth_token.len, kvno, skey.keytype); +} + +static void +test_rxgk_conn(krb5_context context, uint32_t addr, int port, + RXGK_Token *ticket, krb5_keyblock *key) +{ + struct rx_securityClass *secobj; + struct rx_connection *conn; + int ret; + char bar[100]; + int32_t a111; + + secobj = rxgk_k5_NewClientSecurityObject(rxgk_crypt, + key, + 0, + ticket->len, + ticket->val, + TEST_RXGK_SERVICE, + context); + + conn = rx_NewConnection(addr, port, TEST_SERVICE_ID, secobj, 4); + if (conn == NULL) + errx(1, "NewConnection"); + + ret = TEST_get_hundraelva(conn, &a111, bar); + + rx_DestroyConnection(conn); + + if (ret) + errx(1, "TEST_get_hundraelva: %d", ret); + + printf("get_hundraelva return %d (should be 111) (bar = \"%s\")\n", + (int)a111, bar); +} + + +/* + * + */ + +int +main(int argc, char **argv) +{ + RXGK_Token ticket; + krb5_context context; + krb5_keyblock *key; + int port, ret; + uint32_t addr; + char *saddr; + PROCESS pid; + + setprogname(argv[0]); + + port = htons(TEST_DEFAULT_PORT); + saddr = "127.0.0.1"; + + krb5_init_context(&context); + + LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid); + + ret = rx_Init (0); + if (ret) + errx (1, "rx_Init failed"); + + addr = str2addr(saddr); + + ret = get_krb5_token(context, &key, &ticket); + if (ret) + errx(1, "get_krb5_token: %d", ret); + + if (0) { + test_est_context(context, addr, port, &ticket, key); + } else { + test_rxgk_conn(context, addr, port, &ticket, key); + } + + rx_Finalize(); + + krb5_free_keyblock(context, key); + krb5_free_context(context); + + return 0; +} + diff --git a/src/rxgk/test_server.c b/src/rxgk/test_server.c new file mode 100644 index 000000000..5f280ef6b --- /dev/null +++ b/src/rxgk/test_server.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2002 - 2004, Stockholms universitet + * (Stockholm University, Stockholm Sweden) + * All rights reserved. + * + * Redistribution is not permitted + */ + +#include +#include +#include + +#include +#include + +#include "rxgk_locl.h" +#include "rxgk_proto.ss.h" +#include "test.ss.h" + +RCSID("$Id: test_server.c,v 1.1 2004/08/08 19:21:33 shadow Exp $"); + +/* + * + */ + +int +STEST_get_hundraelva(struct rx_call *call, int32_t *foo, char *bar) +{ + *foo = 111; + snprintf(bar, 100, "hej"); + return 0; +} + +/* + * + */ + +int +main(int argc, char **argv) +{ + struct rx_securityClass *secureobj[5]; + struct rx_service *service; + int secureindex; + PROCESS pid; + int port = htons(TEST_DEFAULT_PORT); + int ret; + + LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid); + + ret = rx_Init (port); + if (ret) + errx (1, "rx_Init failed"); + + secureindex = 5; + memset(secureobj, 0, sizeof(secureobj)); + secureobj[4] = + rxgk_NewServerSecurityObject(rxgk_auth, + "afs@L.NXS.SE", + NULL, + rxgk_default_get_key, + NULL, + TEST_RXGK_SERVICE); + + service = rx_NewService (0, + TEST_SERVICE_ID, + "rxgk-test", + secureobj, + secureindex, + TEST_ExecuteRequest); + if (service == NULL) + errx(1, "Cant create server"); + + rx_StartServer(1) ; + + return 0; +} diff --git a/src/rxkad/rxkad.p.h b/src/rxkad/rxkad.p.h index 06004bd4a..8e7204318 100644 --- a/src/rxkad/rxkad.p.h +++ b/src/rxkad/rxkad.p.h @@ -22,8 +22,10 @@ #define KTC_TIME_UNCERTAINTY (15*60) /* max skew bet. machines' clocks */ #define MAXRANDOMNAMELEN 16 /* length of random generated - * usernames used by afslog for high - * security must be < MAXKTCNAMELEN */ + * usernames used by afslog for high + * security must be < MAXKTCNAMELEN && < MAXSMBNAMELEN */ +#define MAXSMBNAMELEN 256 /* max length of an SMB name */ + #define LOGON_OPTION_INTEGRATED 1 #define LOGON_OPTION_HIGHSECURITY 2 @@ -56,7 +58,7 @@ struct ktc_principal { char instance[MAXKTCNAMELEN]; char cell[MAXKTCREALMLEN]; #ifdef AFS_NT40_ENV - char smbname[MAXRANDOMNAMELEN]; + char smbname[MAXSMBNAMELEN]; #endif }; diff --git a/src/sys/afssyscalls.c b/src/sys/afssyscalls.c index 882659434..09a7f9646 100644 --- a/src/sys/afssyscalls.c +++ b/src/sys/afssyscalls.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/sys/afssyscalls.c,v 1.9 2004/05/11 20:36:27 shadow Exp $"); + ("$Header: /cvs/openafs/src/sys/afssyscalls.c,v 1.10 2004/07/08 05:35:26 shadow Exp $"); #include #include @@ -319,7 +319,8 @@ int proc_afs_syscall(long syscall, long param1, long param2, long param3, long param4, int *rval) { struct afsprocdata syscall_data; int fd = open(PROC_SYSCALL_FNAME, O_RDWR); - + if(fd < 0) + fd = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR); if(fd < 0) return -1; diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index 0fd2dcab8..33af2dcf9 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.14 2004/06/04 06:00:38 jaltman Exp $"); + ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18 2004/08/05 16:28:10 jaltman Exp $"); #include #include @@ -122,7 +122,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) if ( tbuffer[i++] == '\\' ) count++; } - if (tbuffer[i] == 0) + if (fileNamep[i] == 0) tbuffer[i++] = '\\'; tbuffer[i] = 0; strcat(tbuffer, SMB_IOCTL_FILENAME); @@ -147,7 +147,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) if (tbuffer[i] == 0) tbuffer[i++] = '\\'; tbuffer[i] = 0; - strcat(tbuffer, SMB_IOCTL_FILENAME); + strcat(tbuffer, SMB_IOCTL_FILENAME_NOSLASH); } } } @@ -163,8 +163,45 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL); fflush(stdout); - if (fh == INVALID_HANDLE_VALUE) - return -1; + if (fh == INVALID_HANDLE_VALUE) { + HKEY hk; + char szUser[64] = ""; + char szClient[MAX_PATH] = ""; + char szPath[MAX_PATH] = ""; + NETRESOURCE nr; + DWORD res; + + if (GetLastError() != ERROR_DOWNGRADE_DETECTED) + return -1; + + lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL); + sprintf(szPath, "\\\\%s", szClient); + + /* We should probably be using GetUserNameEx() for this */ + if (RegOpenKey (HKEY_CURRENT_USER, + TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &hk) == 0) + { + DWORD dwSize = sizeof(szUser); + DWORD dwType = REG_SZ; + RegQueryValueEx (hk, TEXT("Logon User Name"), NULL, &dwType, (PBYTE)szUser, &dwSize); + RegCloseKey (hk); + } + + memset (&nr, 0x00, sizeof(NETRESOURCE)); + nr.dwType=RESOURCETYPE_DISK; + nr.lpLocalName=0; + nr.lpRemoteName=szPath; + res = WNetAddConnection2(&nr,NULL,szUser,0); + if (res) + return -1; + + fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_WRITE_THROUGH, NULL); + fflush(stdout); + if (fh == INVALID_HANDLE_VALUE) + return -1; + } /* return fh and success code */ *handlep = fh; @@ -267,10 +304,24 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize) pathHasDrive = 0; } - if (*firstp == '\\' || *firstp == '/') { - /* already an absolute pathname, just copy it back */ - strcpy(outPathp, firstp); - return 0; + if ( firstp[0] == '\\' && firstp[1] == '\\') { + /* UNC path - strip off the server and sharename */ + int i, count; + for ( i=2,count=2; count < 4 && firstp[i]; i++ ) { + if ( firstp[i] == '\\' || firstp[i] == '/' ) { + count++; + } + } + if ( firstp[i] == 0 ) { + strcpy(outPathp,"\\"); + } else { + strcpy(outPathp,&firstp[--i]); + } + return 0; + } else if (firstp[0] == '\\' || firstp[0] == '/') { + /* already an absolute pathname, just copy it back */ + strcpy(outPathp, firstp); + return 0; } GetCurrentDirectory(sizeof(origPath), origPath); @@ -295,8 +346,24 @@ fs_GetFullPath(char *pathp, char *outPathp, long outSize) GetCurrentDirectory(sizeof(tpath), tpath); if (tpath[1] == ':') strcpy(outPathp, tpath + 2); /* skip drive letter */ - else - strcpy(outPathp, tpath); /* copy entire UNC path */ + else if ( tpath[0] == '\\' && tpath[1] == '\\') { + /* UNC path - strip off the server and sharename */ + int i, count; + for ( i=2,count=2; count < 4 && tpath[i]; i++ ) { + if ( tpath[i] == '\\' || tpath[i] == '/' ) { + count++; + } + } + if ( tpath[i] == 0 ) { + strcpy(outPathp,"\\"); + } else { + strcpy(outPathp,&tpath[--i]); + } + } else { + /* this should never happen */ + strcpy(outPathp, tpath); + } + /* if there is a non-null name after the drive, append it */ if (*firstp != 0) { int len = strlen(outPathp); diff --git a/src/tbutc/NTMakefile b/src/tbutc/NTMakefile index 779059455..95555ba8b 100644 --- a/src/tbutc/NTMakefile +++ b/src/tbutc/NTMakefile @@ -5,7 +5,7 @@ # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html -AFSDEV_AUXCDEFINES = -DAFS_PTHREAD_ENV -DRXDEBUG +AFSDEV_AUXCDEFINES = -DAFS_PTHREAD_ENV -DRXDEBUG -DNOGDI -DWIN32_LEAN_AND_MEAN RELDIR=tbutc !INCLUDE ..\config\NTMakefile.$(SYS_NAME) @@ -111,7 +111,7 @@ BUTCLIBS=$(DESTDIR)\lib\afs\afsbudb.lib \ #----------------------------------------------- BUTC $(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) .c.$(OUT)\obj: diff --git a/src/ubik/ubik.c b/src/ubik/ubik.c index f9cf573d5..52b63d57b 100644 --- a/src/ubik/ubik.c +++ b/src/ubik/ubik.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.14 2003/07/15 23:17:05 shadow Exp $"); + ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15 2004/08/08 23:57:23 shadow Exp $"); #include #ifdef AFS_NT40_ENV @@ -185,31 +185,6 @@ ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4, Note that the host named by myHost should not also be listed in serverList. */ -int -ubik_ServerInitByInfo(afs_int32 myHost, short myPort, - struct afsconf_cell *info, char clones[], - char *pathName, struct ubik_dbase **dbase) -{ - afs_int32 code; - - code = - ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName, - dbase); - return code; -} - -int -ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[], - char *pathName, struct ubik_dbase **dbase) -{ - afs_int32 code; - - code = - ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0, - serverList, pathName, dbase); - return code; -} - int ubik_ServerInitCommon(afs_int32 myHost, short myPort, struct afsconf_cell *info, char clones[], @@ -321,6 +296,31 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort, return code; } +int +ubik_ServerInitByInfo(afs_int32 myHost, short myPort, + struct afsconf_cell *info, char clones[], + char *pathName, struct ubik_dbase **dbase) +{ + afs_int32 code; + + code = + ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName, + dbase); + return code; +} + +int +ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[], + char *pathName, struct ubik_dbase **dbase) +{ + afs_int32 code; + + code = + ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0, + serverList, pathName, dbase); + return code; +} + /* This routine begins a read or write transaction on the transaction identified by transPtr, in the dbase named by dbase. An open mode of ubik_READTRANS identifies this as a read transaction, while a mode of diff --git a/src/util/dirpath.c b/src/util/dirpath.c index 816e6f310..092271b29 100644 --- a/src/util/dirpath.c +++ b/src/util/dirpath.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/util/dirpath.c,v 1.14 2003/07/15 23:17:16 shadow Exp $"); + ("$Header: /cvs/openafs/src/util/dirpath.c,v 1.15 2004/07/14 03:28:45 jaltman Exp $"); #include #include @@ -135,12 +135,19 @@ initDirPathArray(void) FilepathNormalize(ntServerInstallDirShort); /* get the afs client configuration directory (/usr/vice/etc equivalent) */ - status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX); - if (status == 0 || status > AFSDIR_PATH_MAX) { - /* failed to get canonical Windows directory; use temp directory */ - strcpy(ntClientConfigDirLong, gettmpdir()); + if (afssw_GetClientInstallDir(&buf)) { + /* failed */ + status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX); + if (status == 0 || status > AFSDIR_PATH_MAX) { + /* failed to get canonical Windows directory; use temp directory */ + strcpy(ntClientConfigDirLong, gettmpdir()); + } else { + initStatus |= AFSDIR_CLIENT_PATHS_OK; + } } else { - initStatus |= AFSDIR_CLIENT_PATHS_OK; + strcpy(ntClientConfigDirLong, buf); + free(buf); + initStatus |= AFSDIR_CLIENT_PATHS_OK; } FilepathNormalize(ntClientConfigDirLong); @@ -187,7 +194,6 @@ initDirPathArray(void) /* now initialize various dir and file paths exported by dirpath module */ /* server dir paths */ - strcpy(dirPathArray[AFSDIR_SERVER_AFS_DIRPATH_ID], afsSrvDirPath); pathp = dirPathArray[AFSDIR_SERVER_ETC_DIRPATH_ID]; @@ -218,7 +224,6 @@ initDirPathArray(void) AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_BIN_FILE_DIR); /* client dir path */ - #ifdef AFS_NT40_ENV strcpy(dirPathArray[AFSDIR_CLIENT_VICE_DIRPATH_ID], "/NoUsrViceDirectoryOnWindows"); @@ -237,7 +242,6 @@ initDirPathArray(void) #endif /* AFS_NT40_ENV */ /* server file paths */ - pathp = dirPathArray[AFSDIR_SERVER_THISCELL_FILEPATH_ID]; AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_THISCELL_FILE); @@ -363,7 +367,6 @@ initDirPathArray(void) /* client file paths */ - #ifdef AFS_NT40_ENV strcpy(dirPathArray[AFSDIR_CLIENT_THISCELL_FILEPATH_ID], "/NoUsrViceEtcThisCellFileOnWindows"); diff --git a/src/util/dirpath_nt.h b/src/util/dirpath_nt.h index b70cf545a..230e0629d 100644 --- a/src/util/dirpath_nt.h +++ b/src/util/dirpath_nt.h @@ -145,7 +145,11 @@ extern int #define AFSDIR_FILELOG_FILE "FileLog" #define AFSDIR_MIGRATE_LOGNAME "wtlog." +#ifdef COMMENT #define AFSDIR_CELLSERVDB_FILE_NTCLIENT "afsdcell.ini" +#else +#define AFSDIR_CELLSERVDB_FILE_NTCLIENT AFSDIR_CELLSERVDB_FILE +#endif #define AFSDIR_NETINFO_FILE "NetInfo" #define AFSDIR_NETRESTRICT_FILE "NetRestrict" diff --git a/src/util/errmap_nt.h b/src/util/errmap_nt.h index d8f2ec7ee..c22d120cd 100644 --- a/src/util/errmap_nt.h +++ b/src/util/errmap_nt.h @@ -21,7 +21,9 @@ extern int nterr_nt2unix(long ntErr, int defaultErr); #define AFS_NT_ERRNO_BASE 100 /* Overloaded codes. */ +#ifndef EWOULDBLOCK #define EWOULDBLOCK EAGAIN +#endif /* New codes */ #define ELOOP (AFS_NT_ERRNO_BASE + 1) diff --git a/src/util/snprintf.c b/src/util/snprintf.c index 5b1911977..caef48c8d 100644 --- a/src/util/snprintf.c +++ b/src/util/snprintf.c @@ -4,7 +4,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/util/snprintf.c,v 1.21 2004/05/10 03:43:02 shadow Exp $"); + ("$Header: /cvs/openafs/src/util/snprintf.c,v 1.21.2.1 2004/08/09 20:57:10 shadow Exp $"); #include #include @@ -508,7 +508,7 @@ afs_snprintf(char *p, size_t avail, const char *fmt, ...) #if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF) -#ifdef AFS_AIX51_ENV +#if defined(AFS_AIX51_ENV) || defined(AFS_NT40_ENV) int vsnprintf(char *p, size_t avail, const char *fmt, va_list ap) #else diff --git a/src/venus/kdump.c b/src/venus/kdump.c index a028f8bfc..de11e58fc 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/venus/kdump.c,v 1.32 2004/05/11 19:52:28 shadow Exp $"); + ("$Header: /cvs/openafs/src/venus/kdump.c,v 1.33 2004/07/13 05:49:54 shadow Exp $"); #include #include @@ -27,6 +27,16 @@ RCSID #undef USE_UCONTEXT #endif +#ifdef AFS_LINUX26_ENV +/* For some reason, this doesn't get defined in linux/types.h + if __KERNEL_STRICT_NAMES is defined. But the definition of + struct inode uses it. +*/ +#ifndef pgoff_t +#define pgoff_t unsigned long +#endif +#endif + #include #ifdef __linux__ @@ -625,7 +635,11 @@ PrintIPAddr(int addr) #include #include +#ifdef AFS_LINUX26_ENV +#define KSYMS "/proc/kallsyms" +#else #define KSYMS "/proc/ksyms" +#endif /* symlist_t contains all the kernel symbols. Forcing a 64 byte array is * a bit wasteful, but simple. @@ -689,6 +703,13 @@ read_ksyms(void) } ksyms[nksyms].s_value = (int)strtoul(line, &p, 16); p++; +#ifdef AFS_LINUX26_ENV + /* Linux 2.6 /proc/kallsyms has a one-char symbol type + between address and name, so step over it and the following + blank. + */ + p += 2; +#endif q = strchr(p, '\t'); if (q) *q = '\0'; @@ -2779,8 +2800,13 @@ print_vnode(kmem, vep, ptr, pnt) vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version, vep->i_nrpages); #endif +#ifdef AFS_LINUX26_ENV + printf("\ti_op=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op, + vep->i_rdev, vep->i_sb); +#else /* AFS_LINUX26_ENV */ printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op, vep->i_dev, vep->i_rdev, vep->i_sb); +#endif /* AFS_LINUX26_ENV */ #ifdef AFS_LINUX24_ENV #ifdef AFS_PARISC_LINUX24_ENV printf("\ti_sem: count=%d, wait=0x%x\n", vep->i_sem.count, @@ -2793,9 +2819,15 @@ print_vnode(kmem, vep, ptr, pnt) printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count, vep->i_sem.waking, vep->i_sem.wait); #endif +#ifdef AFS_LINUX26_ENV + printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n", + vep->i_hash.pprev, vep->i_hash.next, vep->i_list.prev, + vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next); +#else /* AFS_LINUX26_ENV */ printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n", vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev, vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next); +#endif /* AFS_LINUX26_ENV */ #endif /* AFS_LINUX22_ENV */ } @@ -2830,7 +2862,7 @@ print_vcache(kmem, vep, ptr, pnt) #ifdef AFS_64BIT_CLIENT printf ("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ", - (int)vep->truncPos >> 32, (int)vep->truncPos & 0xffffffff, + (int)(vep->truncPos >> 32), (int)(vep->truncPos & 0xffffffff), vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters); #else /* AFS_64BIT_CLIENT */ printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ", @@ -2846,11 +2878,11 @@ print_vcache(kmem, vep, ptr, pnt) #ifdef AFS_64BIT_CLIENT printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=(0x%x, 0x%x)]\n", vep->quick.dc, vep->quick.stamp, vep->quick.f, - vep->quick.minLoc, (int)vep->quick.len >> 32, - (int)vep->quick.len & 0xffffffff); + vep->quick.minLoc, (int)(vep->quick.len >> 32), + (int)(vep->quick.len & 0xffffffff)); printf ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n", - (int)vep->m.Length >> 32, (int)vep->m.Length & 0xffffffff, + (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff), vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount); #else /* AFS_64BIT_CLIENT */ diff --git a/src/viced/host.c b/src/viced/host.c index 1a0b2676d..69a36eff6 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/viced/host.c,v 1.56 2003/12/08 01:45:34 jaltman Exp $"); + ("$Header: /cvs/openafs/src/viced/host.c,v 1.57 2004/08/05 14:48:09 shadow Exp $"); #include #include @@ -1545,6 +1545,9 @@ h_FindClient_r(struct rx_connection *tcon) oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key); if (oldClient && oldClient->tcon == tcon) { oldClient->tcon = (struct rx_connection *)0; + ViceLog(0, ("FindClient: client %x(%x) already had conn %x (host %x), stolen by client %x(%x)\n", + oldClient, oldClient->sid, tcon, + rx_HostOf(rx_PeerOf(tcon)), client, client->sid)); /* rx_SetSpecific will be done immediately below */ } client->tcon = tcon; diff --git a/src/vlserver/NTMakefile b/src/vlserver/NTMakefile index 86f6a3e0d..84be1a60c 100644 --- a/src/vlserver/NTMakefile +++ b/src/vlserver/NTMakefile @@ -89,7 +89,7 @@ VLSERVER_EXECLIBS = \ $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) ############################################################################ @@ -135,7 +135,7 @@ VLCLIENT_LIBS = \ $(DESTDIR)\lib\afs\afspioctl.lib $(OUT)\vlclient.exe: $(OUT)\vlclient.obj $(LIBFILE) $(VLSERVER_EXECLIBS) $(VLCLIENT_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib ############################################################################ diff --git a/src/vol/fssync.c b/src/vol/fssync.c index 9e0906407..068f76b82 100644 --- a/src/vol/fssync.c +++ b/src/vol/fssync.c @@ -21,6 +21,7 @@ int newVLDB; /* Compatibility flag */ #endif static int newVLDB = 1; + #ifndef AFS_PTHREAD_ENV #define USUAL_PRIORITY (LWP_MAX_PRIORITY - 2) @@ -35,11 +36,21 @@ static int newVLDB = 1; fsync.c File server synchronization with external volume utilities. */ + +/* This controls the size of an fd_set; it must be defined early before + * the system headers define that type and the macros that operate on it. + * Its value should be as large as the maximum file descriptor limit we + * are likely to run into on any platform. Right now, that is 65536 + * which is the default hard fd limit on Solaris 9 */ +#ifndef _WIN32 +#define FD_SETSIZE 65536 +#endif + #include #include RCSID - ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.23 2003/12/08 06:09:12 shadow Exp $"); + ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26 2004/07/28 21:49:18 shadow Exp $"); #include #include @@ -94,7 +105,7 @@ int (*V_BreakVolumeCallbacks) (); #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that * move = dump+restore can run on single server */ -#define MAXOFFLINEVOLUMES 30 /* This needs to be as big as the maximum +#define MAXOFFLINEVOLUMES 128 /* This needs to be as big as the maximum * number that would be offline for 1 operation. * Current winner is salvage, which needs all * cloned read-only copies offline when salvaging @@ -276,6 +287,8 @@ getport(struct sockaddr_in *addr) return sd; } +static fd_set FSYNC_readfds; + static void FSYNC_sync() { @@ -331,18 +344,17 @@ FSYNC_sync() InitHandler(); AcceptOn(); for (;;) { - fd_set readfds; int maxfd; - GetHandler(&readfds, &maxfd); + GetHandler(&FSYNC_readfds, &maxfd); /* Note: check for >= 1 below is essential since IOMGR_select * doesn't have exactly same semantics as select. */ #ifdef AFS_PTHREAD_ENV - if (select(maxfd + 1, &readfds, NULL, NULL, NULL) >= 1) + if (select(maxfd + 1, &FSYNC_readfds, NULL, NULL, NULL) >= 1) #else /* AFS_PTHREAD_ENV */ - if (IOMGR_Select(maxfd + 1, &readfds, NULL, NULL, NULL) >= 1) + if (IOMGR_Select(maxfd + 1, &FSYNC_readfds, NULL, NULL, NULL) >= 1) #endif /* AFS_PTHREAD_ENV */ - CallHandler(&readfds); + CallHandler(&FSYNC_readfds); } } diff --git a/src/vol/partition.c b/src/vol/partition.c index fce55e972..be7f0f350 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -21,7 +21,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/vol/partition.c,v 1.29 2003/10/24 06:26:19 shadow Exp $"); + ("$Header: /cvs/openafs/src/vol/partition.c,v 1.30 2004/08/08 23:59:51 shadow Exp $"); #include #ifdef AFS_NT40_ENV @@ -353,7 +353,7 @@ VCheckPartition(char *part, char *devname) #endif #if defined(AFS_DUX40_ENV) && !defined(AFS_NAMEI_ENV) - if (afs_status.st_ino != ROOTINO) { + if (status.st_ino != ROOTINO) { Log("%s is not a mounted file system; ignored.\n", part); return 0; } diff --git a/src/volser/Makefile.in b/src/volser/Makefile.in index 7833d7802..8a2fbff1d 100644 --- a/src/volser/Makefile.in +++ b/src/volser/Makefile.in @@ -148,7 +148,18 @@ ${DEST}/lib/afs/libvolser.a: libvolser.a ${INSTALL} $? $@ ${DEST}/root.server/usr/afs/bin/volserver: volserver - ${INSTALL} $? $@ + @case ${SYS_NAME} in \ + alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \ + echo "Don't install volserver for ${SYS_NAME}" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + *_darwin_*) \ + echo "Don't install volserver for ${SYS_NAME}" ;; \ + *) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + esac # # Misc targets @@ -184,7 +195,18 @@ ${DESTDIR}${afssrvsbindir}/vos: vos ${INSTALL} $? $@ ${DESTDIR}${afssrvlibexecdir}/volserver: volserver - ${INSTALL} $? $@ + @case ${SYS_NAME} in \ + alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \ + echo "Don't install volserver for ${SYS_NAME}" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + *_darwin_*) \ + echo "Don't install volserver for ${SYS_NAME}" ;; \ + *) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + esac ${DESTDIR}${libdir}/afs/libvolser.a: libvolser.a ${INSTALL} $? $@ diff --git a/src/volser/NTMakefile b/src/volser/NTMakefile index e86eb8d6a..8f0b2efe5 100644 --- a/src/volser/NTMakefile +++ b/src/volser/NTMakefile @@ -93,7 +93,7 @@ VOLSERVER_EXELIBS = \ $(DESTDIR)\lib\afs\afsprocmgmt.lib $(VOLSERVER_EXEFILE): $(VOLSERVER_EXEOBJS) $(VOLSERVER_EXELIBS) $(EXEC_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) ############################################################################ @@ -118,7 +118,7 @@ VOS_EXELIBS = \ $(DESTDIR)\lib\afs\afspioctl.lib $(RS_VOS_EXEFILE): $(VOS_EXEOBJS) $(VOS_EXELIBS) $(EXEC_LIBS) - $(EXECONLINK) dnsapi.lib + $(EXECONLINK) dnsapi.lib mpr.lib $(EXEPREP) $(CL_VOS_EXEFILE): $(RS_VOS_EXEFILE) diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 433a7a618..55079ea90 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.33 2004/01/01 06:22:31 shadow Exp $"); + ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.34 2004/07/29 03:44:08 shadow Exp $"); #include #include @@ -1540,6 +1540,10 @@ VolSetInfo(struct rx_call *acid, afs_int32 atrans, td->maxquota = astatus->maxquota; if (astatus->dayUse != -1) td->dayUse = astatus->dayUse; + if (astatus->creationDate != -1) + td->creationDate = astatus->creationDate; + if (astatus->updateDate != -1) + td->updateDate = astatus->updateDate; VUpdateVolume(&error, tv); tt->rxCallPtr = (struct rx_call *)0; if (TRELE(tt)) diff --git a/src/volser/volser.p.h b/src/volser/volser.p.h index 091b523b8..c55ab064d 100644 --- a/src/volser/volser.p.h +++ b/src/volser/volser.p.h @@ -157,12 +157,18 @@ struct partList { /*used by the backup system */ /* Values for the UV_RestoreVolume flags parameter */ /* Also used for UV_CopyVolume and UV_CloneVolume */ -#define RV_FULLRST 0x1 -#define RV_OFFLINE 0x2 -#define RV_RDONLY 0x10000 -#define RV_CPINCR 0x20000 -#define RV_NOVLDB 0x40000 -#define RV_NOCLONE 0x80000 +#define RV_FULLRST 0x00001 +#define RV_OFFLINE 0x00002 +#define RV_CRDUMP 0x00010 +#define RV_CRKEEP 0x00020 +#define RV_CRNEW 0x00040 +#define RV_LUDUMP 0x00100 +#define RV_LUKEEP 0x00200 +#define RV_LUNEW 0x00400 +#define RV_RDONLY 0x10000 +#define RV_CPINCR 0x20000 +#define RV_NOVLDB 0x40000 +#define RV_NOCLONE 0x80000 extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp); extern int vsu_ExtractName(char rname[], char name[]); diff --git a/src/volser/vos.c b/src/volser/vos.c index 23689f03c..fb9c277ff 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/volser/vos.c,v 1.38 2004/04/08 22:20:39 jaltman Exp $"); + ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40 2004/07/29 18:51:20 shadow Exp $"); #include #ifdef AFS_NT40_ENV @@ -499,12 +499,8 @@ DisplayFormat(pntr, server, part, totalOK, totalNotOK, totalBusy, fast, fprintf(STDOUT, " Last Access %s", ctime((time_t *) & pntr->accessDate)); #endif - if (pntr->updateDate < pntr->creationDate) - fprintf(STDOUT, " Last Update %s", - ctime((time_t *) & pntr->creationDate)); - else - fprintf(STDOUT, " Last Update %s", - ctime((time_t *) & pntr->updateDate)); + fprintf(STDOUT, " Last Update %s", + ctime((time_t *) & pntr->updateDate)); fprintf(STDOUT, " %d accesses in the past day (i.e., vnode references)\n", pntr->dayUse); @@ -656,12 +652,8 @@ XDisplayFormat(a_xInfoP, a_servID, a_partID, a_totalOKP, a_totalNotOKP, fprintf(STDOUT, " Last Access %s", ctime((time_t *) & a_xInfoP->accessDate)); #endif - if (a_xInfoP->updateDate < a_xInfoP->creationDate) - fprintf(STDOUT, " Last Update %s", - ctime((time_t *) & a_xInfoP->creationDate)); - else - fprintf(STDOUT, " Last Update %s", - ctime((time_t *) & a_xInfoP->updateDate)); + fprintf(STDOUT, " Last Update %s", + ctime((time_t *) & a_xInfoP->updateDate)); fprintf(STDOUT, " %d accesses in the past day (i.e., vnode references)\n", a_xInfoP->dayUse); @@ -2254,7 +2246,7 @@ ShadowVolume(as) MapPartIdIntoName(frompart, fromPartName); fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n", (unsigned long)volid, as->parms[1].items->data, fromPartName, - as->parms[4].items->data, toPartName); + as->parms[3].items->data, toPartName); return 0; } @@ -2575,6 +2567,10 @@ DumpVolume(as) #define FULL 2 #define INC 3 +#define TS_DUMP 1 +#define TS_KEEP 2 +#define TS_NEW 3 + static RestoreVolume(as) register struct cmd_syndesc *as; @@ -2582,6 +2578,7 @@ RestoreVolume(as) { afs_int32 avolid, aserver, apart, code, vcode, err; afs_int32 aoverwrite = ASK; + afs_int32 acreation = 0, alastupdate = 0; int restoreflags, readonly = 0, offline = 0, voltype = RWVOL; char prompt; char afilename[NameLen], avolname[VOLSER_MAXVOLNAME + 1], apartName[10]; @@ -2628,6 +2625,40 @@ RestoreVolume(as) voltype = ROVOL; } + if (as->parms[8].items) { + if ((strcmp(as->parms[8].items->data, "d") == 0) + || (strcmp(as->parms[8].items->data, "dump") == 0)) { + acreation = TS_DUMP; + } else if ((strcmp(as->parms[8].items->data, "k") == 0) + || (strcmp(as->parms[8].items->data, "keep") == 0)) { + acreation = TS_KEEP; + } else if ((strcmp(as->parms[8].items->data, "n") == 0) + || (strcmp(as->parms[8].items->data, "new") == 0)) { + acreation = TS_NEW; + } else { + fprintf(STDERR, "vos: %s is not a valid argument to -creation\n", + as->parms[8].items->data); + exit(1); + } + } + + if (as->parms[9].items) { + if ((strcmp(as->parms[9].items->data, "d") == 0) + || (strcmp(as->parms[9].items->data, "dump") == 0)) { + alastupdate = TS_DUMP; + } else if ((strcmp(as->parms[9].items->data, "k") == 0) + || (strcmp(as->parms[9].items->data, "keep") == 0)) { + alastupdate = TS_KEEP; + } else if ((strcmp(as->parms[9].items->data, "n") == 0) + || (strcmp(as->parms[9].items->data, "new") == 0)) { + alastupdate = TS_NEW; + } else { + fprintf(STDERR, "vos: %s is not a valid argument to -lastupdate\n", + as->parms[9].items->data); + exit(1); + } + } + aserver = GetServer(as->parms[0].items->data); if (aserver == 0) { fprintf(STDERR, "vos: server '%s' not found in host table\n", @@ -2779,6 +2810,38 @@ RestoreVolume(as) restoreflags |= RV_OFFLINE; if (readonly) restoreflags |= RV_RDONLY; + + switch (acreation) { + case TS_DUMP: + restoreflags |= RV_CRDUMP; + break; + case TS_KEEP: + restoreflags |= RV_CRKEEP; + break; + case TS_NEW: + restoreflags |= RV_CRNEW; + break; + default: + if (aoverwrite == FULL) + restoreflags |= RV_CRNEW; + else + restoreflags |= RV_CRKEEP; + } + + switch (alastupdate) { + case TS_DUMP: + restoreflags |= RV_LUDUMP; + break; + case TS_KEEP: + restoreflags |= RV_LUKEEP; + break; + case TS_NEW: + restoreflags |= RV_LUNEW; + break; + default: + restoreflags |= RV_LUKEEP; + } + code = UV_RestoreVolume(aserver, apart, avolid, avolname, restoreflags, WriteData, afilename); @@ -5373,6 +5436,10 @@ main(argc, argv) "leave restored volume offline"); cmd_AddParm(ts, "-readonly", CMD_FLAG, CMD_OPTIONAL, "make restored volume read-only"); + cmd_AddParm(ts, "-creation", CMD_SINGLE, CMD_OPTIONAL, + "dump | keep | new"); + cmd_AddParm(ts, "-lastupdate", CMD_SINGLE, CMD_OPTIONAL, + "dump | keep | new"); COMMONPARMS; ts = cmd_CreateSyntax("unlock", LockReleaseCmd, 0, diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 544336e77..5ae87bc15 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.32 2004/06/02 08:39:34 shadow Exp $"); + ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33 2004/07/29 03:44:08 shadow Exp $"); #include #include @@ -4040,6 +4040,7 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, afs_int32 totid, code, rcode, vcode, terror = 0; afs_int32 rxError = 0; struct volser_status tstatus; + struct volintInfo vinfo; char partName[10]; afs_int32 pvolid; afs_int32 temptid; @@ -4049,7 +4050,8 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, int islocked; struct restoreCookie cookie; int reuseID; - afs_int32 newDate, volflag, voltype, volsertype; + afs_int32 volflag, voltype, volsertype; + afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate; int index, same, errcode; char apartName[10]; @@ -4129,6 +4131,13 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, EGOTO1(refail, code, "Failed to start transaction on %u\n", pvolid); + code = AFSVolGetStatus(toconn, totid, &tstatus); + EGOTO1(refail, code, "Could not get timestamp from volume %u\n", + pvolid); + + oldCreateDate = tstatus.creationDate; + oldUpdateDate = tstatus.updateDate; + code = AFSVolSetFlags(toconn, totid, VTDeleteOnSalvage | VTOutOfService); @@ -4150,8 +4159,6 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, AFSVolCreateVolume(toconn, topart, tovolname, volsertype, 0, &pvolid, &totid); EGOTO1(refail, code, "Could not create new volume %u\n", pvolid); - - newDate = 0; } else { code = AFSVolTransCreate(toconn, pvolid, topart, ITOffline, &totid); @@ -4161,9 +4168,15 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, code = AFSVolGetStatus(toconn, totid, &tstatus); EGOTO1(refail, code, "Could not get timestamp from volume %u\n", pvolid); - newDate = tstatus.creationDate; + + oldCreateDate = tstatus.creationDate; + oldUpdateDate = tstatus.updateDate; } + } else { + oldCreateDate = 0; + oldUpdateDate = 0; } + cookie.parent = pvolid; cookie.type = voltype; cookie.clone = 0; @@ -4204,12 +4217,35 @@ UV_RestoreVolume(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid, error = code; goto refail; } - if (!newDate) - newDate = time(0); - code = AFSVolSetDate(toconn, totid, newDate); + + if (flags & RV_CRDUMP) + newCreateDate = tstatus.creationDate; + else if (flags & RV_CRKEEP && oldCreateDate != 0) + newCreateDate = oldCreateDate; + else + newCreateDate = time(0); + if (flags & RV_LUDUMP) + newUpdateDate = tstatus.updateDate; + else if (flags & RV_LUKEEP) + newUpdateDate = oldUpdateDate; + else + newUpdateDate = time(0); + code = AFSVolSetDate(toconn,totid, newCreateDate); if (code) { - fprintf(STDERR, "Could not set the date on %lu\n", - (unsigned long)pvolid); + fprintf(STDERR, "Could not set the 'creation' date on %u\n", pvolid); + error = code; + goto refail; + } + + memset(&vinfo, 0, sizeof(struct volintInfo)); + vinfo.dayUse = -1; + vinfo.maxquota = -1; + vinfo.creationDate = newCreateDate; + vinfo.updateDate = newUpdateDate; + code = AFSVolSetInfo(toconn, totid, &vinfo); + if (code) { + fprintf(STDERR, "Could not set the 'last updated' date on %u\n", + pvolid); error = code; goto refail; }