Index: openafs/src/WINNT/afsd/afskfw-int.h
diff -c openafs/src/WINNT/afsd/afskfw-int.h:1.3.14.1 openafs/src/WINNT/afsd/afskfw-int.h:1.3.14.3
*** openafs/src/WINNT/afsd/afskfw-int.h:1.3.14.1	Mon Jul 24 10:13:17 2006
--- openafs/src/WINNT/afsd/afskfw-int.h	Tue Apr  3 10:50:40 2007
***************
*** 62,67 ****
--- 62,71 ----
  #ifdef USE_MS2MIT
  #define SECURITY_WIN32
  #include <security.h>
+ #if _WIN32_WINNT < 0x0501
+ #undef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0501
+ #endif
  #include <ntsecapi.h>
  #endif /* USE_MS2MIT */
  #include <stdio.h>
Index: openafs/src/WINNT/afsd/afskfw.c
diff -c openafs/src/WINNT/afsd/afskfw.c:1.28.4.3 openafs/src/WINNT/afsd/afskfw.c:1.28.4.4
*** openafs/src/WINNT/afsd/afskfw.c:1.28.4.3	Wed Jul 26 08:51:21 2006
--- openafs/src/WINNT/afsd/afskfw.c	Tue Apr  3 10:50:40 2007
***************
*** 61,66 ****
--- 61,67 ----
  #include "afskfw-int.h"
  #include "afskfw.h"
  #include <userenv.h>
+ 
  #include <Sddl.h>
  #include <Aclapi.h>
  
Index: openafs/src/WINNT/afsd/afslogon.c
diff -c openafs/src/WINNT/afsd/afslogon.c:1.45.2.7 openafs/src/WINNT/afsd/afslogon.c:1.45.2.9
*** openafs/src/WINNT/afsd/afslogon.c:1.45.2.7	Tue Dec 19 12:56:30 2006
--- openafs/src/WINNT/afsd/afslogon.c	Tue Apr  3 00:33:20 2007
***************
*** 715,720 ****
--- 715,729 ----
      int retryInterval;
      int sleepInterval;
  
+     /* Are we interactive? */
+     interactive = (wcscmp(lpStationName, L"WinSta0") == 0);
+ 
+ #ifdef DISABLE_NON_INTERACTIVE
+     /* Do not do anything if the logon session is not interactive. */
+     if (!interactive)
+ 	return 0;
+ #endif
+ 
      (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
                           0, KEY_QUERY_VALUE, &NPKey);
      LSPsize=sizeof(TraceOption);
***************
*** 744,752 ****
  
      IL = (MSV1_0_INTERACTIVE_LOGON *) lpAuthentInfo;
  
-     /* Are we interactive? */
-     interactive = (wcscmp(lpStationName, L"WinSta0") == 0);
- 
      /* Convert from Unicode to ANSI */
  
      /*TODO: Use SecureZeroMemory to erase passwords */
--- 753,758 ----
***************
*** 936,948 ****
  	}
      }
      DebugEvent("while loop exited");
      /* remove any kerberos 5 tickets currently held by the SYSTEM account
       * for this user 
       */
      if (ISLOGONINTEGRATED(opt.LogonOption) && KFW_is_available()) {
  	sprintf(szLogonId,"%d.%d",lpLogonId->HighPart, lpLogonId->LowPart);
  	KFW_AFS_copy_cache_to_system_file(uname, szLogonId);
! 
  	KFW_AFS_destroy_tickets_for_principal(uname);
      }
  
--- 942,957 ----
  	}
      }
      DebugEvent("while loop exited");
+ 
      /* remove any kerberos 5 tickets currently held by the SYSTEM account
       * for this user 
       */
+ 
      if (ISLOGONINTEGRATED(opt.LogonOption) && KFW_is_available()) {
+ #ifdef KFW_LOGON
  	sprintf(szLogonId,"%d.%d",lpLogonId->HighPart, lpLogonId->LowPart);
  	KFW_AFS_copy_cache_to_system_file(uname, szLogonId);
! #endif
  	KFW_AFS_destroy_tickets_for_principal(uname);
      }
  
***************
*** 991,996 ****
--- 1000,1014 ----
  	LPVOID StationHandle,
  	DWORD dwChangeInfo)
  {
+     BOOLEAN interactive;
+ 
+     /* Are we interactive? */
+     interactive = (wcscmp(lpStationName, L"WinSta0") == 0);
+ 
+     /* Do not do anything if the logon session is not interactive. */
+     if (!interactive)
+ 	return 0;
+ 
      /* Make sure the AFS Libraries are initialized */
      AfsLogonInit();
  
***************
*** 1294,1299 ****
--- 1312,1318 ----
  
  VOID KFW_Logon_Event( PWLX_NOTIFICATION_INFO pInfo )
  {
+ #ifdef KFW_LOGON
      WCHAR szUserW[128] = L"";
      char  szUserA[128] = "";
      char szPath[MAX_PATH] = "";
***************
*** 1408,1412 ****
--- 1427,1432 ----
      DeleteFile(filename);
  
      DebugEvent0("KFW_Logon_Event - End");
+ #endif
  }
  
Index: openafs/src/WINNT/afsd/afslogon.h
diff -c openafs/src/WINNT/afsd/afslogon.h:1.9 openafs/src/WINNT/afsd/afslogon.h:1.9.4.3
*** openafs/src/WINNT/afsd/afslogon.h:1.9	Wed Jul  6 20:23:23 2005
--- openafs/src/WINNT/afsd/afslogon.h	Tue Apr  3 10:50:40 2007
***************
*** 27,33 ****
--- 27,38 ----
  #pragma once
  
  #include <windows.h>
+ #include <objbase.h>
  #include <npapi.h>
+ #if (_WIN32_WINNT < 0x0501)
+ #undef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0501
+ #endif
  #include <ntsecapi.h>
  #include <tchar.h>
  #include <strsafe.h>
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.10 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.11
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.10	Sat Feb  3 21:46:25 2007
--- openafs/src/WINNT/afsd/cm_ioctl.c	Sat Mar 24 01:00:39 2007
***************
*** 939,948 ****
      volume = scp->fid.volume;
  
      cellp = cm_FindCellByID(scp->fid.cell);
-     osi_assert(cellp);
  
      cm_ReleaseSCache(scp);
  
      code = cm_GetVolumeByID(cellp, volume, userp, &req, &tvp);
      if (code) return code;
  	
--- 939,950 ----
      volume = scp->fid.volume;
  
      cellp = cm_FindCellByID(scp->fid.cell);
  
      cm_ReleaseSCache(scp);
  
+     if (!cellp)
+ 	return CM_ERROR_NOSUCHCELL;
+ 
      code = cm_GetVolumeByID(cellp, volume, userp, &req, &tvp);
      if (code) return code;
  	
Index: openafs/src/WINNT/afsd/logon_ad.cpp
diff -c openafs/src/WINNT/afsd/logon_ad.cpp:1.6 openafs/src/WINNT/afsd/logon_ad.cpp:1.6.14.2
*** openafs/src/WINNT/afsd/logon_ad.cpp:1.6	Wed Aug  4 15:30:03 2004
--- openafs/src/WINNT/afsd/logon_ad.cpp	Tue Apr  3 10:50:40 2007
***************
*** 25,37 ****
  
  
  //#pragma keyword("interface",on)
! #define interface struct
  #define SECURITY_WIN32
  #include "afslogon.h"
  
  /**/
  #include <security.h>
- #include <ntsecapi.h>
  #include <sddl.h>
  #include <unknwn.h>
  #include <oaidl.h>
--- 25,40 ----
  
  
  //#pragma keyword("interface",on)
! //#define interface struct
  #define SECURITY_WIN32
  #include "afslogon.h"
  
+ #if (_WIN32_WINNT < 0x0500)
+ #error _WIN32_WINNT < 0x0500
+ #endif
+ 
  /**/
  #include <security.h>
  #include <sddl.h>
  #include <unknwn.h>
  #include <oaidl.h>
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.41.2.13 openafs/src/WINNT/afsd/smb.h:1.41.2.15
*** openafs/src/WINNT/afsd/smb.h:1.41.2.13	Wed Mar  7 13:14:05 2007
--- openafs/src/WINNT/afsd/smb.h	Tue Apr  3 10:50:40 2007
***************
*** 14,19 ****
--- 14,23 ----
  #include "netbios95.h"
  #endif /* DJGPP */
  
+ #if _WIN32_WINNT < 0x0501
+ #undef _WIN32_WINNT
+ #define _WIN32_WINNT 0x0501
+ #endif
  #include <ntsecapi.h>
  
  /* Support largefiles by default */
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.11 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.12
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.11	Mon Mar 19 19:28:40 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm	Tue Apr  3 09:15:04 2007
***************
*** 198,204 ****
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.17</h2>
  
  <p class=MsoNormal><span style='mso-fareast-font-family:"MS Mincho"'>&nbsp; <o:p></o:p></span></p>
  
--- 198,204 ----
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.18</h2>
  
  <p class=MsoNormal><span style='mso-fareast-font-family:"MS Mincho"'>&nbsp; <o:p></o:p></span></p>
  
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.12 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.13
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.12	Mon Mar 19 19:28:44 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm	Tue Apr  3 09:15:08 2007
***************
*** 18,24 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.17 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
--- 18,24 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.18 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.14 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.15
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.14	Mon Mar 19 19:28:44 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm	Tue Apr  3 09:15:08 2007
***************
*** 8,14 ****
  <meta name=Generator content="Microsoft Word 11">
  <meta name=Originator content="Microsoft Word 11">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.17 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <w:WordDocument>
    <w:Zoom>0</w:Zoom>
--- 8,14 ----
  <meta name=Generator content="Microsoft Word 11">
  <meta name=Originator content="Microsoft Word 11">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.18 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <w:WordDocument>
    <w:Zoom>0</w:Zoom>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.15 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.16
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.15	Mon Mar 19 19:28:44 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm	Tue Apr  3 09:15:08 2007
***************
*** 19,25 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.17 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
--- 19,25 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.18 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
***************
*** 583,589 ****
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.17<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
--- 583,589 ----
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.18<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
***************
*** 1120,1133 ****
  passwords.</p>
  
  <p class=MsoNormal>When KFW is configured, Integrated Logon will use it to
! obtain tokens.&nbsp; The Kerberos 5 tickets obtained during the process of
! generating AFS tokens are preserved and stored into the default ccache within
! the user logon session (except on Windows Vista).<span
! style='mso-spacerun:yes'>   </span>Use of KFW for Integrated Logon can be
  disabled via the <a href="#_Value:_EnableKFW">EnableKFW</a> registry
  value.<span style='mso-spacerun:yes'>  </span>Use of the krb524 service can be
  configured via the <a href="#_Value:_Use524">Use524</a> registry value.</p>
  
  <p class=MsoNormal>Integrated Logon does not have the ability to cache the
  user's username and password for the purpose of obtaining tokens if the
  Kerberos KDC is inaccessible at logon time.</p>
--- 1120,1133 ----
  passwords.</p>
  
  <p class=MsoNormal>When KFW is configured, Integrated Logon will use it to
! obtain tokens.  Use of KFW for Integrated Logon can be
  disabled via the <a href="#_Value:_EnableKFW">EnableKFW</a> registry
  value.<span style='mso-spacerun:yes'>  </span>Use of the krb524 service can be
  configured via the <a href="#_Value:_Use524">Use524</a> registry value.</p>
  
+ <p class=MsoNormal>Integrated Logon will not preserve the Kerberos v5 tickets.
+ KFW 3.1 and above implements that functionality.</p>
+ 
  <p class=MsoNormal>Integrated Logon does not have the ability to cache the
  user's username and password for the purpose of obtaining tokens if the
  Kerberos KDC is inaccessible at logon time.</p>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.10 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.11
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.10	Mon Mar 19 19:28:44 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm	Tue Apr  3 09:15:09 2007
***************
*** 10,16 ****
  <meta name=Originator content="Microsoft Word 11">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.17 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
--- 10,16 ----
  <meta name=Originator content="Microsoft Word 11">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.18 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
Index: openafs/src/WINNT/install/NSIS/OpenAFS.nsi
diff -c openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.8 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.9
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.8	Fri Feb  2 10:40:08 2007
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Wed Mar 28 18:30:46 2007
***************
*** 780,789 ****
    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"
  
!   WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Asynchronous" 0
!   WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Impersonate"  0
!   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "DLLName" "afslogon.dll"
!   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Logon" "KFW_Logon_Event"
  
    SetRebootFlag true
    
--- 780,790 ----
    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"
  
! ; No longer install KFW Logon Handler - KFW 3.1 and above supports this functionality
! ;  WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Asynchronous" 0
! ;  WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Impersonate"  0
! ;  WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "DLLName" "afslogon.dll"
! ;  WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" "Logon" "KFW_Logon_Event"
  
    SetRebootFlag true
    
Index: openafs/src/WINNT/install/wix/files.wxi
diff -c openafs/src/WINNT/install/wix/files.wxi:1.22.2.9 openafs/src/WINNT/install/wix/files.wxi:1.22.2.10
*** openafs/src/WINNT/install/wix/files.wxi:1.22.2.9	Mon Dec 18 17:34:24 2006
--- openafs/src/WINNT/install/wix/files.wxi	Wed Mar 28 18:30:46 2007
***************
*** 12,21 ****
--- 12,23 ----
              <Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Type="string" Value="AFS_Logoff_Event" />
              <Registry Id="reg_afslogon07" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logon" Type="string" Value="AFS_Logon_Event" />
              <Registry Id="reg_afslogon08" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Startup" Type="string" Value="AFS_Startup_Event" />
+ 	    <!-- KFW includes this functionality - OpenAFS does not need to provide it
              <Registry Id="reg_afslogon09" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" Name="Asynchronous" Type="integer" Value="0" />
              <Registry Id="reg_afslogon10" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" Name="Impersonate" Type="integer" Value="0" />
              <Registry Id="reg_afslogon11" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" Name="DLLName" Type="string" Value="[#fileafslogon_DLL]" />
              <Registry Id="reg_afslogon13" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\KFWLogon" Name="Logon" Type="string" Value="KFW_Logon_Event" />
+ 	    -->
          </Component>
          <Component Win64="$(var.Win64)" Id="cmf_afscpcc_EXE" Guid="$(var.cmf_afscpcc_EXE_guid)">
              <File Id="fileafscpcc_EXE"  Name="afscpcc.exe"  LongName="afscpcc.exe"  DiskId="1" src="$(var.ClientDir)afscpcc.exe" KeyPath="yes"/>
Index: openafs/src/WINNT/netidmgr_plugin/afsfuncs.c
diff -c openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.4 openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.6
*** openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.4	Fri Feb  9 15:12:38 2007
--- openafs/src/WINNT/netidmgr_plugin/afsfuncs.c	Sat Mar 31 08:53:49 2007
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.4 2007/02/09 20:12:38 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.6 2007/03/31 12:53:49 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
***************
*** 811,817 ****
  
              memset((char *)&increds, 0, sizeof(increds));
  
!             (*pkrb5_cc_get_principal)(context, k5cc, &client_principal);
              i = krb5_princ_realm(context, client_principal)->length;
              if (i > REALM_SZ-1) 
                  i = REALM_SZ-1;
--- 811,817 ----
  
              memset((char *)&increds, 0, sizeof(increds));
  
!             pkrb5_cc_get_principal(context, k5cc, &client_principal);
              i = krb5_princ_realm(context, client_principal)->length;
              if (i > REALM_SZ-1) 
                  i = REALM_SZ-1;
***************
*** 824,830 ****
          }
  
          /* First try Service/Cell@REALM */
!         if (r = (*pkrb5_build_principal)(context, &increds.server,
                                           (int) strlen(RealmName),
                                           RealmName,
                                           ServiceName,
--- 824,830 ----
          }
  
          /* First try Service/Cell@REALM */
!         if (r = pkrb5_build_principal(context, &increds.server,
                                           (int) strlen(RealmName),
                                           RealmName,
                                           ServiceName,
***************
*** 843,848 ****
--- 843,849 ----
          flags = 0;
          r = pkrb5_cc_set_flags(context, k5cc, flags);
  #endif
+       retry_retcred:
          r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
  	if ((r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
  	      r == KRB5KRB_ERR_GENERIC /* Heimdal */) &&
***************
*** 851,857 ****
  			  afs_realm_of_cell(&ak_cellconfig, TRUE));
  
              pkrb5_free_principal(context, increds.server);
! 	    r = (*pkrb5_build_principal)(context, &increds.server,
  					 (int) strlen(RealmName),
  					 RealmName,
  					 ServiceName,
--- 852,858 ----
  			  afs_realm_of_cell(&ak_cellconfig, TRUE));
  
              pkrb5_free_principal(context, increds.server);
! 	    r = pkrb5_build_principal(context, &increds.server,
  					 (int) strlen(RealmName),
  					 RealmName,
  					 ServiceName,
***************
*** 865,871 ****
              r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
              /* Next try Service@REALM */
              pkrb5_free_principal(context, increds.server);
!             r = (*pkrb5_build_principal)(context, &increds.server,
                                           (int) strlen(RealmName),
                                           RealmName,
                                           ServiceName,
--- 866,872 ----
              r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
              /* Next try Service@REALM */
              pkrb5_free_principal(context, increds.server);
!             r = pkrb5_build_principal(context, &increds.server,
                                           (int) strlen(RealmName),
                                           RealmName,
                                           ServiceName,
***************
*** 875,880 ****
--- 876,892 ----
                                            &increds, &k5creds);
          }
  
+ 	/* Check to make sure we received a valid ticket; if not remove it
+ 	* and try again.  Perhaps there are two service tickets for the
+ 	* same service in the ccache.
+ 	*/
+ 	if (r == 0 && k5creds && k5creds->times.endtime < time(NULL)) {
+ 	    pkrb5_cc_remove_cred(context, k5cc, 0, k5creds);
+ 	    pkrb5_free_creds(context, k5creds);
+ 	    k5creds = NULL;
+ 	    goto retry_retcred;
+ 	}
+ 
          pkrb5_free_principal(context, increds.server);
          pkrb5_free_principal(context, client_principal);
          client_principal = 0;
Index: openafs/src/WINNT/netidmgr_plugin/dynimport.h
diff -c openafs/src/WINNT/netidmgr_plugin/dynimport.h:1.1.2.2 openafs/src/WINNT/netidmgr_plugin/dynimport.h:1.1.2.3
*** openafs/src/WINNT/netidmgr_plugin/dynimport.h:1.1.2.2	Thu Oct 12 17:19:43 2006
--- openafs/src/WINNT/netidmgr_plugin/dynimport.h	Tue Apr  3 01:41:24 2007
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: dynimport.h,v 1.1.2.2 2006/10/12 21:19:43 jaltman Exp $ */
  
  #ifndef __KHIMAIRA_DYNIMPORT_H
  #define __KHIMAIRA_DYNIMPORT_H
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: dynimport.h,v 1.1.2.3 2007/04/03 05:41:24 jaltman Exp $ */
  
  #ifndef __KHIMAIRA_DYNIMPORT_H
  #define __KHIMAIRA_DYNIMPORT_H
***************
*** 30,36 ****
--- 30,52 ----
  /* Dynamic imports */
  #include<khdefs.h>
  #include<tlhelp32.h>
+ 
+ #if defined(_WIN32_WINNT) 
+ #  if (_WIN32_WINNT < 0x0501)
+ #    define AFS_WIN32_WINNT _WIN32_WINNT
+ #    undef _WIN32_WINNT
+ #    define _WIN32_WINNT 0x0501
+ #  endif
+ #else 
+ #  define _WIN32_WINNT 0x0501
+ #endif
+ 
  #include<ntsecapi.h>
+ #if defined(AFS_WIN32_WINNT)
+ #undef _WIN32_WINNT
+ #define _WIN32_WINNT AFS_WIN32_WINNT
+ #undef AFS_WIN32_WINNT
+ #endif
  
  #ifndef FAR
  #define FAR
Index: openafs/src/afs/afs_nfsclnt.c
diff -c openafs/src/afs/afs_nfsclnt.c:1.13.6.4 openafs/src/afs/afs_nfsclnt.c:1.13.6.5
*** openafs/src/afs/afs_nfsclnt.c:1.13.6.4	Wed Dec 20 15:08:32 2006
--- openafs/src/afs/afs_nfsclnt.c	Tue Mar 20 15:21:52 2007
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsclnt.c,v 1.13.6.4 2006/12/20 20:08:32 shadow Exp $");
  
  #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsclnt.c,v 1.13.6.5 2007/03/20 19:21:52 shadow Exp $");
  
  #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 483,493 ****
  	MReleaseWriteLock(&afs_xnfspag);
      }
      if (inname) {
- 	if (np->sysname) {
  	    for(count=0; count < np->sysnamecount;++count) {
  		afs_osi_Free(np->sysname[count], MAXSYSNAME);
  	    }
- 	}
  	for(count=0; count < *num;++count) {
  	    np->sysname[count]= afs_osi_Alloc(MAXSYSNAME);
  	}
--- 483,492 ----
  	MReleaseWriteLock(&afs_xnfspag);
      }
      if (inname) {
  	    for(count=0; count < np->sysnamecount;++count) {
  		afs_osi_Free(np->sysname[count], MAXSYSNAME);
+ 		np->sysname[count] = NULL;
  	    }
  	for(count=0; count < *num;++count) {
  	    np->sysname[count]= afs_osi_Alloc(MAXSYSNAME);
  	}
***************
*** 498,505 ****
  	    cp += t+1;
  	}
  	np->sysnamecount = *num;
-     } else if (!np->sysnamecount) {
- 	return ENODEV;      /* XXX */
      }
      if (allpags >= 0) {
  	/* Don't touch our arguments when called recursively */
--- 497,502 ----
***************
*** 518,523 ****
--- 515,521 ----
  {
      register struct nfsclientpag *np, **tnp, *nnp;
      register afs_int32 i, delflag;
+ 	int count;
  
  #if defined(AFS_SGIMP_ENV)
      osi_Assert(ISAFS_GLOCK());
***************
*** 533,540 ****
  	    if ((pag == -1) || (!pag && delflag)
  		|| (pag && (np->refCount == 0) && (np->pag == pag))) {
  		*tnp = np->next;
! 		if (np->sysname)
! 		    afs_osi_Free(np->sysname, MAXSYSNAME);
  		afs_osi_Free(np, sizeof(struct nfsclientpag));
  	    } else {
  		tnp = &np->next;
--- 531,539 ----
  	    if ((pag == -1) || (!pag && delflag)
  		|| (pag && (np->refCount == 0) && (np->pag == pag))) {
  		*tnp = np->next;
! 		for(count=0; count < np->sysnamecount;++count) {
! 			afs_osi_Free(np->sysname[count], MAXSYSNAME);
! 		}
  		afs_osi_Free(np, sizeof(struct nfsclientpag));
  	    } else {
  		tnp = &np->next;
Index: openafs/src/afs/afs_osi_gcpags.c
diff -c openafs/src/afs/afs_osi_gcpags.c:1.1.2.5 openafs/src/afs/afs_osi_gcpags.c:1.1.2.6
*** openafs/src/afs/afs_osi_gcpags.c:1.1.2.5	Thu Feb  8 20:30:16 2007
--- openafs/src/afs/afs_osi_gcpags.c	Tue Apr  3 14:54:15 2007
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_gcpags.c,v 1.1.2.5 2007/02/09 01:30:16 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_gcpags.c,v 1.1.2.6 2007/04/03 18:54:15 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 226,239 ****
  #endif
  
  #if defined(AFS_LINUX22_ENV)
  void
  afs_osi_TraverseProcTable()
  {
  #if !defined(LINUX_KEYRING_SUPPORT)
      struct task_struct *p;
  #ifdef EXPORTED_TASKLIST_LOCK
-     extern rwlock_t tasklist_lock __attribute__((weak));
- 
      if (&tasklist_lock)
         read_lock(&tasklist_lock);
  #endif
--- 226,240 ----
  #endif
  
  #if defined(AFS_LINUX22_ENV)
+ #ifdef EXPORTED_TASKLIST_LOCK
+ extern rwlock_t tasklist_lock __attribute__((weak));
+ #endif
  void
  afs_osi_TraverseProcTable()
  {
  #if !defined(LINUX_KEYRING_SUPPORT)
      struct task_struct *p;
  #ifdef EXPORTED_TASKLIST_LOCK
      if (&tasklist_lock)
         read_lock(&tasklist_lock);
  #endif
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.1 openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.2
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.1	Wed Feb 14 19:28:26 2007
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Tue Mar 20 15:31:06 2007
***************
*** 5,11 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41.2.1 2007/02/15 00:28:26 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 5,11 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41.2.2 2007/03/20 19:31:06 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 1194,1201 ****
      cache_purge(vp);
      if (!error) {
  #ifdef AFS_DARWIN80_ENV
!         ubc_setsize(vp, (off_t)0);
!         vnode_recycle(vp);
  #else
          /* necessary so we don't deadlock ourselves in vclean */
          VOP_UNLOCK(vp, 0, cnp->cn_proc);
--- 1194,1205 ----
      cache_purge(vp);
      if (!error) {
  #ifdef AFS_DARWIN80_ENV
! 	struct vcache *tvc = VTOAFS(vp);
! 	
! 	if (!(tvc->states & CUnlinked)) {
!             ubc_setsize(vp, (off_t)0);
!             vnode_recycle(vp);
! 	}
  #else
          /* necessary so we don't deadlock ourselves in vclean */
          VOP_UNLOCK(vp, 0, cnp->cn_proc);
***************
*** 1626,1634 ****
  	vprint("afs_vop_inactive(): pushing active", vp);
  #endif
      if (tvc) {
!        AFS_GLOCK();
!        afs_InactiveVCache(tvc, 0);	/* decrs ref counts */
!        AFS_GUNLOCK();
      }
  #ifndef AFS_DARWIN80_ENV
      VOP_UNLOCK(vp, 0, ap->a_p);
--- 1630,1647 ----
  	vprint("afs_vop_inactive(): pushing active", vp);
  #endif
      if (tvc) {
! #ifdef AFS_DARWIN80_ENV
!         int unlinked = tvc->states & CUnlinked;
! #endif
! 	AFS_GLOCK();
! 	afs_InactiveVCache(tvc, 0);     /* decrs ref counts */
! 	AFS_GUNLOCK();
! #ifdef AFS_DARWIN80_ENV
! 	if (unlinked) {
! 	    vnode_recycle(vp);
! 	    cache_purge(vp);
! 	}
! #endif
      }
  #ifndef AFS_DARWIN80_ENV
      VOP_UNLOCK(vp, 0, ap->a_p);
Index: openafs/src/afs/LINUX/osi_groups.c
diff -c openafs/src/afs/LINUX/osi_groups.c:1.28.4.5 openafs/src/afs/LINUX/osi_groups.c:1.28.4.7
*** openafs/src/afs/LINUX/osi_groups.c:1.28.4.5	Mon Jan 15 10:51:02 2007
--- openafs/src/afs/LINUX/osi_groups.c	Tue Mar 20 14:47:22 2007
***************
*** 20,26 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.28.4.5 2007/01/15 15:51:02 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 20,26 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.28.4.7 2007/03/20 18:47:22 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 594,606 ****
--- 594,611 ----
  {
      afs_uint32 pag = key->payload.value;
      struct unixuser *pu;
+     int locked = ISAFS_GLOCK();
  
+     if (!locked)
+ 	AFS_GLOCK();
      pu = afs_FindUser(pag, -1, READ_LOCK);
      if (pu) {
  	pu->ct.EndTimestamp = 0;
  	pu->tokenTime = 0;
  	afs_PutUser(pu, READ_LOCK);
      }
+     if (!locked)
+ 	AFS_GUNLOCK();
  }
  
  struct key_type key_type_afs_pag =
***************
*** 612,624 ****
      .destroy     = afs_pag_destroy,
  };
  
  void osi_keyring_init(void)
  {
      struct task_struct *p;
! 
      p = find_task_by_pid(1);
      if (p && p->user->session_keyring)
  	__key_type_keyring = p->user->session_keyring->type;
  
      register_key_type(&key_type_afs_pag);
  }
--- 617,652 ----
      .destroy     = afs_pag_destroy,
  };
  
+ #ifdef EXPORTED_TASKLIST_LOCK
+ extern rwlock_t tasklist_lock __attribute__((weak));
+ #endif
+ 
  void osi_keyring_init(void)
  {
      struct task_struct *p;
! #ifdef EXPORTED_TASKLIST_LOCK
!     if (&tasklist_lock)
!       read_lock(&tasklist_lock);
! #endif
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
! #ifdef EXPORTED_TASKLIST_LOCK
!     else
! #endif
!       rcu_read_lock();
! #endif
      p = find_task_by_pid(1);
      if (p && p->user->session_keyring)
  	__key_type_keyring = p->user->session_keyring->type;
+ #ifdef EXPORTED_TASKLIST_LOCK
+     if (&tasklist_lock)
+        read_unlock(&tasklist_lock);
+ #endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ #ifdef EXPORTED_TASKLIST_LOCK
+     else
+ #endif
+       rcu_read_unlock();
+ #endif
  
      register_key_type(&key_type_afs_pag);
  }
Index: openafs/src/afs/LINUX/osi_syscall.c
diff -c openafs/src/afs/LINUX/osi_syscall.c:1.7.4.1 openafs/src/afs/LINUX/osi_syscall.c:1.7.4.2
*** openafs/src/afs/LINUX/osi_syscall.c:1.7.4.1	Fri Dec  1 13:50:51 2006
--- openafs/src/afs/LINUX/osi_syscall.c	Mon Mar 26 23:23:41 2007
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.7.4.1 2006/12/01 18:50:51 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.7.4.2 2007/03/27 03:23:41 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 56,64 ****
  
  #if defined(AFS_S390X_LINUX24_ENV) 
  #define INSERT_SYSCALL(SLOT, TMPPAGE, FUNC) \
! 	if (POINTER2SYSCALL FUNC > 0x7fffffff) { \
  	    TMPPAGE = kmalloc ( PAGE_SIZE, GFP_DMA|GFP_KERNEL );	\
! 	    if (POINTER2SYSCALL TMPPAGE > 0x7fffffff) { \
  		printf("Cannot allocate page for FUNC syscall jump vector\n"); \
  		return EINVAL; \
  	    } \
--- 56,64 ----
  
  #if defined(AFS_S390X_LINUX24_ENV) 
  #define INSERT_SYSCALL(SLOT, TMPPAGE, FUNC) \
! 	if (SYSCALL2POINTER FUNC > 0x7fffffff) { \
  	    TMPPAGE = kmalloc ( PAGE_SIZE, GFP_DMA|GFP_KERNEL );	\
! 	    if (SYSCALL2POINTER TMPPAGE > 0x7fffffff) { \
  		printf("Cannot allocate page for FUNC syscall jump vector\n"); \
  		return EINVAL; \
  	    } \
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.20 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.21
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.20	Mon Mar 19 19:25:27 2007
--- openafs/src/config/NTMakefile.amd64_w2k	Tue Apr  3 09:25:42 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1700
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1800
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.84.2.20 openafs/src/config/NTMakefile.i386_nt40:1.84.2.21
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.20	Mon Mar 19 19:25:27 2007
--- openafs/src/config/NTMakefile.i386_nt40	Tue Apr  3 09:25:42 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1700
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1800
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.23.2.20 openafs/src/config/NTMakefile.i386_w2k:1.23.2.21
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.20	Mon Mar 19 19:25:27 2007
--- openafs/src/config/NTMakefile.i386_w2k	Tue Apr  3 09:25:42 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1700
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1800
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/libadmin/vos/vosutils.c
diff -c openafs/src/libadmin/vos/vosutils.c:1.12 openafs/src/libadmin/vos/vosutils.c:1.12.4.1
*** openafs/src/libadmin/vos/vosutils.c:1.12	Tue Oct 25 02:30:52 2005
--- openafs/src/libadmin/vos/vosutils.c	Tue Apr  3 09:34:52 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/vos/vosutils.c,v 1.12 2005/10/25 06:30:52 shadow Exp $");
  
  #include "vosutils.h"
  #include "vsprocs.h"
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/vos/vosutils.c,v 1.12.4.1 2007/04/03 13:34:52 jaltman Exp $");
  
  #include "vosutils.h"
  #include "vsprocs.h"
***************
*** 619,625 ****
  
  #ifdef AFS_NT40_ENV
  
! #define cszREG_IGNORE_KEY "Software\\TransarcCorporation\\AFS Control Center"
  #define cszREG_IGNORE_VALUE "IgnoreBadAddrs"
  
      /*
--- 619,625 ----
  
  #ifdef AFS_NT40_ENV
  
! #define cszREG_IGNORE_KEY "Software\\OpenAFS\\AFS Control Center"
  #define cszREG_IGNORE_VALUE "IgnoreBadAddrs"
  
      /*
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.13 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.14
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.13	Mon Mar 19 21:30:29 2007
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Tue Apr  3 15:46:23 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.17</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.18</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/libafs/afs.ppc_darwin_80.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.13 openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.14
*** openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.13	Mon Mar 19 21:30:29 2007
--- openafs/src/libafs/afs.ppc_darwin_80.plist.in	Tue Apr  3 15:46:23 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.17</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.18</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.ppc_darwin_90.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.13 openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.14
*** openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.13	Mon Mar 19 21:30:29 2007
--- openafs/src/libafs/afs.ppc_darwin_90.plist.in	Tue Apr  3 15:46:23 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.17</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.18</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.x86_darwin_80.plist.in
diff -c openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.13 openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.14
*** openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.13	Mon Mar 19 21:30:29 2007
--- openafs/src/libafs/afs.x86_darwin_80.plist.in	Tue Apr  3 15:46:23 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.17</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.18</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.x86_darwin_90.plist.in
diff -c openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.13 openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.14
*** openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.13	Mon Mar 19 21:30:29 2007
--- openafs/src/libafs/afs.x86_darwin_90.plist.in	Tue Apr  3 15:46:23 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.17</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.18</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.14 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.15
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.14	Mon Mar 19 21:30:31 2007
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Tue Apr  3 15:46:23 2007
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.17</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.17</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.18</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.18</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.13 openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.14
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.13	Mon Mar 19 21:30:31 2007
--- openafs/src/packaging/MacOS/OpenAFS.info	Tue Apr  3 15:46:23 2007
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.5.17
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.5.18
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.97.2.6 openafs/src/rx/rx.c:1.97.2.7
*** openafs/src/rx/rx.c:1.97.2.6	Thu Feb 15 12:11:29 2007
--- openafs/src/rx/rx.c	Tue Apr  3 09:31:34 2007
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.6 2007/02/15 17:11:29 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.7 2007/04/03 13:31:34 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 1046,1052 ****
  /* Start a new rx remote procedure call, on the specified connection.
   * If wait is set to 1, wait for a free call channel; otherwise return
   * 0.  Maxtime gives the maximum number of seconds this call may take,
!  * after rx_MakeCall returns.  After this time interval, a call to any
   * of rx_SendData, rx_ReadData, etc. will fail with RX_CALL_TIMEOUT.
   * For fine grain locking, we hold the conn_call_lock in order to 
   * to ensure that we don't get signalle after we found a call in an active
--- 1046,1052 ----
  /* Start a new rx remote procedure call, on the specified connection.
   * If wait is set to 1, wait for a free call channel; otherwise return
   * 0.  Maxtime gives the maximum number of seconds this call may take,
!  * after rx_NewCall returns.  After this time interval, a call to any
   * of rx_SendData, rx_ReadData, etc. will fail with RX_CALL_TIMEOUT.
   * For fine grain locking, we hold the conn_call_lock in order to 
   * to ensure that we don't get signalle after we found a call in an active
***************
*** 1061,1067 ****
      SPLVAR;
  
      clock_NewTime();
!     dpf(("rx_MakeCall(conn %x)\n", conn));
  
      NETPRI;
      clock_GetTime(&queueTime);
--- 1061,1067 ----
      SPLVAR;
  
      clock_NewTime();
!     dpf(("rx_NewCall(conn %x)\n", conn));
  
      NETPRI;
      clock_GetTime(&queueTime);
***************
*** 1189,1194 ****
--- 1189,1195 ----
      MUTEX_EXIT(&call->lock);
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  
+     dpf(("rx_NewCall(call %x)\n", call));
      return call;
  }
  
***************
*** 2084,2089 ****
--- 2085,2092 ----
      register struct rx_call *nxp;	/* Next call pointer, for queue_Scan */
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  
+     dpf(("rxi_NewCall(conn %x, channel %d)\n", conn, channel));
+ 
      /* Grab an existing call structure, or allocate a new one.
       * Existing call structures are assumed to have been left reset by
       * rxi_FreeCall */
***************
*** 4467,4472 ****
--- 4470,4477 ----
      register struct rx_peer *peer;
      struct rx_packet *packet;
  
+     dpf(("rxi_ResetCall(call %x, newcall %d)\n", call, newcall));
+ 
      /* Notify anyone who is waiting for asynchronous packet arrival */
      if (call->arrivalProc) {
  	(*call->arrivalProc) (call, call->arrivalProcHandle,
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.32.2.3 openafs/src/rx/LINUX/rx_knet.c:1.32.2.4
*** openafs/src/rx/LINUX/rx_knet.c:1.32.2.3	Mon Feb 26 12:57:40 2007
--- openafs/src/rx/LINUX/rx_knet.c	Tue Mar 20 14:47:23 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.32.2.3 2007/02/26 17:57:40 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.32.2.4 2007/03/20 18:47:23 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
***************
*** 213,242 ****
      struct task_struct *listener;
      extern int rxk_ListenerPid;
  
  #ifdef EXPORTED_TASKLIST_LOCK
!     if (&tasklist_lock)
!       read_lock(&tasklist_lock);
  #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
  #ifdef EXPORTED_TASKLIST_LOCK
!     else
  #endif
!       rcu_read_lock();
  #endif
!     listener = find_task_by_pid(rxk_ListenerPid);
  #ifdef EXPORTED_TASKLIST_LOCK
!     if (&tasklist_lock)
!        read_unlock(&tasklist_lock);
  #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
  #ifdef EXPORTED_TASKLIST_LOCK
!     else
  #endif
!       rcu_read_unlock();
  #endif
!     while (rxk_ListenerPid) {
! 	flush_signals(listener);
! 	force_sig(SIGKILL, listener);
  	afs_osi_Sleep(&rxk_ListenerPid);
      }
      sock_release(rx_socket);
--- 213,246 ----
      struct task_struct *listener;
      extern int rxk_ListenerPid;
  
+     while (rxk_ListenerPid) {
  #ifdef EXPORTED_TASKLIST_LOCK
! 	if (&tasklist_lock)
! 	   read_lock(&tasklist_lock);
  #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
  #ifdef EXPORTED_TASKLIST_LOCK
! 	else
  #endif
! 	   rcu_read_lock();
  #endif
! 	listener = find_task_by_pid(rxk_ListenerPid);
!         if (listener) {
! 	    flush_signals(listener);
! 	    force_sig(SIGKILL, listener);
! 	}
  #ifdef EXPORTED_TASKLIST_LOCK
! 	if (&tasklist_lock)
! 	    read_unlock(&tasklist_lock);
  #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
  #ifdef EXPORTED_TASKLIST_LOCK
! 	else
  #endif
! 	   rcu_read_unlock();
  #endif
! 	if (!listener)
! 	    break;
  	afs_osi_Sleep(&rxk_ListenerPid);
      }
      sock_release(rx_socket);
Index: openafs/src/venus/kdump.c
diff -c openafs/src/venus/kdump.c:1.38.4.1 openafs/src/venus/kdump.c:1.38.4.2
*** openafs/src/venus/kdump.c:1.38.4.1	Wed Aug  2 15:01:23 2006
--- openafs/src/venus/kdump.c	Tue Mar 20 15:21:53 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/kdump.c,v 1.38.4.1 2006/08/02 19:01:23 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/kdump.c,v 1.38.4.2 2007/03/20 19:21:53 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 2515,2529 ****
       struct nfsclientpag *ep, *ptr;
  {
      char sysname[100];
  
-     if (ep->sysname) {
- 	kread(kmem, (off_t) ep->sysname, sysname, (KDUMP_SIZE_T) 30);
- 	Sum_nfssysnames += MAXSYSNAME;
-     }
      if (pnt)
! 	printf("%lx: uid=%d, host=%x, pag=%x, @sys=%s, lastt=%d, ref=%d\n",
  	       ptr, ep->uid, ep->host, ep->pag,
! 	       (ep->sysname ? sysname : "nil"), ep->lastcall, ep->refCount);
  }
  
  
--- 2515,2533 ----
       struct nfsclientpag *ep, *ptr;
  {
      char sysname[100];
+ 	int count;
  
      if (pnt)
! 	printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
  	       ptr, ep->uid, ep->host, ep->pag,
! 	       ep->lastcall, ep->refCount, ep->sysnamecount);
! 
! 	for(count = 0; count < ep->sysnamecount; count++){
! 		kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
! 		printf("   %lx: @sys[%d]=%s\n",
! 			ep->sysname[count], count, sysname);
! 		Sum_nfssysnames += MAXSYSNAME;
! 	}
  }
  
  
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.33 openafs/src/vol/partition.c:1.33.2.1
*** openafs/src/vol/partition.c:1.33	Fri Mar 17 14:54:51 2006
--- openafs/src/vol/partition.c	Tue Mar 20 15:00:43 2007
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/partition.c,v 1.33 2006/03/17 19:54:51 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/partition.c,v 1.33.2.1 2007/03/20 19:00:43 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
***************
*** 460,467 ****
      }
      while (!getmntent(mntfile, &mnt)) {
  	/* Ignore non ufs or non read/write partitions */
! 	if ((strcmp(mnt.mnt_fstype, "ufs") != 0)
! 	    || (strncmp(mnt.mnt_mntopts, "ro,ignore", 9) == 0))
  	    continue;
  
  	/* If we're going to always attach this partition, do it later. */
--- 460,474 ----
      }
      while (!getmntent(mntfile, &mnt)) {
  	/* Ignore non ufs or non read/write partitions */
! 	/* but allow zfs too if we're in the NAMEI environment */
! 	if (
! #ifdef AFS_NAMEI_ENV
! 	((!strcmp(mnt.mnt_fstype, "ufs") &&
! 	  !strcmp(mnt.mnt_fstype, "zfs")))
! #else
! 	(strcmp(mnt.mnt_fstype, "ufs") != 0)
! #endif
! 	|| (strncmp(mnt.mnt_mntopts, "ro,ignore", 9) == 0))
  	    continue;
  
  	/* If we're going to always attach this partition, do it later. */
Index: openafs/src/volser/voltrans.c
diff -c openafs/src/volser/voltrans.c:1.11.8.1 openafs/src/volser/voltrans.c:1.11.8.2
*** openafs/src/volser/voltrans.c:1.11.8.1	Thu Feb  8 20:00:23 2007
--- openafs/src/volser/voltrans.c	Thu Mar 22 11:59:52 2007
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/voltrans.c,v 1.11.8.1 2007/02/09 01:00:23 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <afs/afsutil.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/voltrans.c,v 1.11.8.2 2007/03/22 15:59:52 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <afs/afsutil.h>
***************
*** 137,157 ****
      register struct volser_trans *tt, **lt;
      afs_int32 error;
  
      if (atrans->refCount > 1) {
  	/* someone else is using it now */
  	atrans->refCount--;
  	atrans->tflags |= TTDeleted;
  	return 0;
      }
  
      /* otherwise we zap it ourselves */
-     if (lock) VTRANS_LOCK;
      lt = &allTrans;
      for (tt = *lt; tt; lt = &tt->next, tt = *lt) {
  	if (tt == atrans) {
  	    if (tt->volume)
  		VDetachVolume(&error, tt->volume);
  	    tt->volume = NULL;
  	    *lt = tt->next;
  	    free(tt);
  	    if (lock) VTRANS_UNLOCK;
--- 137,160 ----
      register struct volser_trans *tt, **lt;
      afs_int32 error;
  
+     if (lock) VTRANS_LOCK;
      if (atrans->refCount > 1) {
  	/* someone else is using it now */
  	atrans->refCount--;
  	atrans->tflags |= TTDeleted;
+ 	if (lock) VTRANS_UNLOCK;
  	return 0;
      }
  
      /* otherwise we zap it ourselves */
      lt = &allTrans;
      for (tt = *lt; tt; lt = &tt->next, tt = *lt) {
  	if (tt == atrans) {
  	    if (tt->volume)
  		VDetachVolume(&error, tt->volume);
  	    tt->volume = NULL;
+ 	    if (tt->rxCallPtr)
+ 		rxi_CallError(tt->rxCallPtr, RX_CALL_DEAD);
  	    *lt = tt->next;
  	    free(tt);
  	    if (lock) VTRANS_UNLOCK;
***************
*** 168,185 ****
  afs_int32 
  TRELE(register struct volser_trans *at)
  {
      if (at->refCount == 0) {
  	Log("TRELE: bad refcount\n");
  	return VOLSERTRELE_ERROR;
      }
  
      at->time = FT_ApproxTime();	/* we're still using it */
      if (at->refCount == 1 && (at->tflags & TTDeleted)) {
! 	DeleteTrans(at, 1);
  	return 0;
      }
      /* otherwise simply drop refcount */
      at->refCount--;
      return 0;
  }
  
--- 171,192 ----
  afs_int32 
  TRELE(register struct volser_trans *at)
  {
+     VTRANS_LOCK;
      if (at->refCount == 0) {
  	Log("TRELE: bad refcount\n");
+ 	VTRANS_UNLOCK;
  	return VOLSERTRELE_ERROR;
      }
  
      at->time = FT_ApproxTime();	/* we're still using it */
      if (at->refCount == 1 && (at->tflags & TTDeleted)) {
! 	DeleteTrans(at, 0);
! 	VTRANS_UNLOCK;
  	return 0;
      }
      /* otherwise simply drop refcount */
      at->refCount--;
+     VTRANS_UNLOCK;
      return 0;
  }
  
