Index: openafs/src/WINNT/afsapplib/afsapplib.cpp
diff -c openafs/src/WINNT/afsapplib/afsapplib.cpp:1.3 openafs/src/WINNT/afsapplib/afsapplib.cpp:1.3.4.1
*** openafs/src/WINNT/afsapplib/afsapplib.cpp:1.3	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/afsapplib.cpp	Fri Feb  2 23:53:04 2007
***************
*** 33,39 ****
  extern void OnExpiredCredentials (WPARAM wp, LPARAM lp);
  extern void OnCreateErrorDialog (WPARAM wp, LPARAM lp);
  
! BOOL CALLBACK AfsAppLib_MainHook (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
--- 33,39 ----
  extern void OnExpiredCredentials (WPARAM wp, LPARAM lp);
  extern void OnCreateErrorDialog (WPARAM wp, LPARAM lp);
  
! HRESULT CALLBACK AfsAppLib_MainHook (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
***************
*** 69,75 ****
  }
  
  
! BOOL CALLBACK AfsAppLib_MainHook (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hWnd, AfsAppLib_MainHook);
  
--- 69,75 ----
  }
  
  
! HRESULT CALLBACK AfsAppLib_MainHook (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hWnd, AfsAppLib_MainHook);
  
***************
*** 93,100 ****
        }
  
     if (oldProc)
!       return (CallWindowProc ((WNDPROC)oldProc, hWnd, msg, wp, lp)==NULL?FALSE:TRUE);
     else
!       return (DefWindowProc (hWnd, msg, wp, lp)==NULL?FALSE:TRUE);
  }
  
--- 93,100 ----
        }
  
     if (oldProc)
!       return (CallWindowProc ((WNDPROC)oldProc, hWnd, msg, wp, lp));
     else
!       return (DefWindowProc (hWnd, msg, wp, lp));
  }
  
Index: openafs/src/WINNT/afsapplib/al_browse.cpp
diff -c openafs/src/WINNT/afsapplib/al_browse.cpp:1.3 openafs/src/WINNT/afsapplib/al_browse.cpp:1.3.4.1
*** openafs/src/WINNT/afsapplib/al_browse.cpp:1.3	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/al_browse.cpp	Fri Feb  2 23:53:04 2007
***************
*** 58,64 ****
  } BROWSEDIALOGPARAMS, *LPBROWSEDIALOGPARAMS;
  
  
! BOOL CALLBACK DlgProc_Browse (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void DlgProc_Browse_OnInitDialog (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
  void DlgProc_Browse_OnNone (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
  void DlgProc_Browse_SelectedEntry (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
--- 58,64 ----
  } BROWSEDIALOGPARAMS, *LPBROWSEDIALOGPARAMS;
  
  
! HRESULT CALLBACK DlgProc_Browse (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void DlgProc_Browse_OnInitDialog (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
  void DlgProc_Browse_OnNone (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
  void DlgProc_Browse_SelectedEntry (HWND hDlg, BROWSEDIALOGPARAMS *pbdp);
***************
*** 135,141 ****
  #define WM_THREADSTART (WM_USER +101)
  #define WM_THREADDONE  (WM_USER +102)
  
! BOOL CALLBACK DlgProc_Browse (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     BROWSEDIALOGPARAMS *pbdp;
  
--- 135,141 ----
  #define WM_THREADSTART (WM_USER +101)
  #define WM_THREADDONE  (WM_USER +102)
  
! HRESULT CALLBACK DlgProc_Browse (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     BROWSEDIALOGPARAMS *pbdp;
  
Index: openafs/src/WINNT/afsapplib/al_browseset.cpp
diff -c openafs/src/WINNT/afsapplib/al_browseset.cpp:1.3 openafs/src/WINNT/afsapplib/al_browseset.cpp:1.3.4.1
*** openafs/src/WINNT/afsapplib/al_browseset.cpp:1.3	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/al_browseset.cpp	Fri Feb  2 23:53:04 2007
***************
*** 30,36 ****
   *
   */
  
! BOOL CALLBACK BrowseSet_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void BrowseSet_OnInitDialog (HWND hDlg, LPBROWSESETDLG_PARAMS pszFilename);
  void BrowseSet_OnDestroy (HWND hDlg);
  void BrowseSet_OnAddString (HWND hDlg, LPTSTR pszString);
--- 30,36 ----
   *
   */
  
! HRESULT CALLBACK BrowseSet_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void BrowseSet_OnInitDialog (HWND hDlg, LPBROWSESETDLG_PARAMS pszFilename);
  void BrowseSet_OnDestroy (HWND hDlg);
  void BrowseSet_OnAddString (HWND hDlg, LPTSTR pszString);
***************
*** 54,60 ****
  }
  
  
! BOOL CALLBACK BrowseSet_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (AfsAppLib_HandleHelp (IDD_APPLIB_BROWSE_FILESET, hDlg, msg, wp, lp))
        return TRUE;
--- 54,60 ----
  }
  
  
! HRESULT CALLBACK BrowseSet_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (AfsAppLib_HandleHelp (IDD_APPLIB_BROWSE_FILESET, hDlg, msg, wp, lp))
        return TRUE;
Index: openafs/src/WINNT/afsapplib/al_cover.cpp
diff -c openafs/src/WINNT/afsapplib/al_cover.cpp:1.4 openafs/src/WINNT/afsapplib/al_cover.cpp:1.4.4.1
*** openafs/src/WINNT/afsapplib/al_cover.cpp:1.4	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/al_cover.cpp	Fri Feb  2 23:53:04 2007
***************
*** 53,59 ****
  
  void OnCoverWindow (WPARAM wp, LPARAM lp);
  
! BOOL CALLBACK Cover_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
--- 53,59 ----
  
  void OnCoverWindow (WPARAM wp, LPARAM lp);
  
! HRESULT CALLBACK Cover_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
***************
*** 156,162 ****
  }
  
  
! BOOL CALLBACK Cover_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
--- 156,162 ----
  }
  
  
! HRESULT CALLBACK Cover_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
Index: openafs/src/WINNT/afsapplib/al_creds.cpp
diff -c openafs/src/WINNT/afsapplib/al_creds.cpp:1.6.4.1 openafs/src/WINNT/afsapplib/al_creds.cpp:1.6.4.2
*** openafs/src/WINNT/afsapplib/al_creds.cpp:1.6.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_creds.cpp	Fri Feb  2 23:53:04 2007
***************
*** 36,56 ****
  
  void OnExpiredCredentials (WPARAM wp, LPARAM lp);
  
! BOOL CALLBACK OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void OpenCell_OnInitDialog (HWND hDlg, LPOPENCELLDLG_PARAMS lpp);
  BOOL OpenCell_OnOK (HWND hDlg, LPOPENCELLDLG_PARAMS lpp);
  void OpenCell_OnCell (HWND hDlg);
  void OpenCell_Enable (HWND hDlg, BOOL fEnable);
  void OpenCell_OnGotCreds (HWND hDlg, LPARAM lp);
  
! BOOL CALLBACK NewCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void NewCreds_OnInitDialog (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  BOOL NewCreds_OnOK (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  void NewCreds_OnLogin (HWND hDlg);
  void NewCreds_Enable (HWND hDlg, BOOL fEnable);
  void NewCreds_GetOutParams (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  
! BOOL CALLBACK BadCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
--- 36,56 ----
  
  void OnExpiredCredentials (WPARAM wp, LPARAM lp);
  
! HRESULT CALLBACK OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void OpenCell_OnInitDialog (HWND hDlg, LPOPENCELLDLG_PARAMS lpp);
  BOOL OpenCell_OnOK (HWND hDlg, LPOPENCELLDLG_PARAMS lpp);
  void OpenCell_OnCell (HWND hDlg);
  void OpenCell_Enable (HWND hDlg, BOOL fEnable);
  void OpenCell_OnGotCreds (HWND hDlg, LPARAM lp);
  
! HRESULT CALLBACK NewCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void NewCreds_OnInitDialog (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  BOOL NewCreds_OnOK (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  void NewCreds_OnLogin (HWND hDlg);
  void NewCreds_Enable (HWND hDlg, BOOL fEnable);
  void NewCreds_GetOutParams (HWND hDlg, LPCREDENTIALSDLG_PARAMS lpp);
  
! HRESULT CALLBACK BadCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
***************
*** 183,189 ****
  }
  
  
! BOOL CALLBACK OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPOPENCELLDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
--- 183,189 ----
  }
  
  
! HRESULT CALLBACK OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPOPENCELLDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
***************
*** 486,492 ****
  }
  
  
! BOOL CALLBACK NewCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPCREDENTIALSDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
--- 486,492 ----
  }
  
  
! HRESULT CALLBACK NewCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPCREDENTIALSDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
***************
*** 848,854 ****
  }
  
  
! BOOL CALLBACK BadCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPREALBADCREDSDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
--- 848,854 ----
  }
  
  
! HRESULT CALLBACK BadCreds_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     LPREALBADCREDSDLG_PARAMS lpp;
     if (msg == WM_INITDIALOG)
Index: openafs/src/WINNT/afsapplib/al_error.cpp
diff -c openafs/src/WINNT/afsapplib/al_error.cpp:1.2.32.1 openafs/src/WINNT/afsapplib/al_error.cpp:1.2.32.2
*** openafs/src/WINNT/afsapplib/al_error.cpp:1.2.32.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_error.cpp	Fri Feb  2 23:53:04 2007
***************
*** 21,27 ****
  
  void cdecl vErrorDialog (BOOL fFatal, DWORD dwStatus, LONG idError, LPTSTR pszFmt, va_list arg);
  
! BOOL CALLBACK Error_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void OnCreateErrorDialog (WPARAM wp, LPARAM lp);
  
--- 21,27 ----
  
  void cdecl vErrorDialog (BOOL fFatal, DWORD dwStatus, LONG idError, LPTSTR pszFmt, va_list arg);
  
! HRESULT CALLBACK Error_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void OnCreateErrorDialog (WPARAM wp, LPARAM lp);
  
***************
*** 134,140 ****
  }
  
  
! BOOL CALLBACK Error_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
--- 134,140 ----
  }
  
  
! HRESULT CALLBACK Error_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
Index: openafs/src/WINNT/afsapplib/al_misc.cpp
diff -c openafs/src/WINNT/afsapplib/al_misc.cpp:1.5.4.1 openafs/src/WINNT/afsapplib/al_misc.cpp:1.5.4.2
*** openafs/src/WINNT/afsapplib/al_misc.cpp:1.5.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_misc.cpp	Fri Feb  2 23:53:04 2007
***************
*** 30,36 ****
   *
   */
  
! BOOL CALLBACK AfsAppLib_TranslateErrorFunc (LPTSTR pszText, ULONG code, LANGID idLanguage);
  
  
  /*
--- 30,36 ----
   *
   */
  
! HRESULT CALLBACK AfsAppLib_TranslateErrorFunc (LPTSTR pszText, ULONG code, LANGID idLanguage);
  
  
  /*
***************
*** 159,165 ****
  }
  
  
! BOOL CALLBACK AnimationHook (HWND hIcon, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hIcon, AnimationHook);
  
--- 159,165 ----
  }
  
  
! HRESULT CALLBACK AnimationHook (HWND hIcon, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hIcon, AnimationHook);
  
***************
*** 178,186 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hIcon, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hIcon, msg, wp, lp);
  }
  
  
--- 178,186 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hIcon, msg, wp, lp);
     else
!       return DefWindowProc (hIcon, msg, wp, lp);
  }
  
  
***************
*** 205,211 ****
   *
   */
  
! BOOL CALLBACK AfsAppLib_TranslateErrorFunc (LPTSTR pszText, ULONG code, LANGID idLanguage)
  {
     DWORD idClient;
     if ((idClient = (DWORD)AfsAppLib_GetAdminServerClientID()) != 0)
--- 205,211 ----
   *
   */
  
! HRESULT CALLBACK AfsAppLib_TranslateErrorFunc (LPTSTR pszText, ULONG code, LANGID idLanguage)
  {
     DWORD idClient;
     if ((idClient = (DWORD)AfsAppLib_GetAdminServerClientID()) != 0)
Index: openafs/src/WINNT/afsapplib/al_progress.cpp
diff -c openafs/src/WINNT/afsapplib/al_progress.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/al_progress.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/al_progress.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_progress.cpp	Fri Feb  2 23:53:04 2007
***************
*** 176,188 ****
  }
  
  
! BOOL CALLBACK PROGRESSDISPLAY::ProgressDisplay_StubProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     return FALSE;
  }
  
  
! BOOL CALLBACK PROGRESSDISPLAY::ProgressDisplay_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldproc = Subclass_FindNextHook (hWnd, PROGRESSDISPLAY::ProgressDisplay_HookProc);
  
--- 176,188 ----
  }
  
  
! HRESULT CALLBACK PROGRESSDISPLAY::ProgressDisplay_StubProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     return FALSE;
  }
  
  
! HRESULT CALLBACK PROGRESSDISPLAY::ProgressDisplay_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldproc = Subclass_FindNextHook (hWnd, PROGRESSDISPLAY::ProgressDisplay_HookProc);
  
***************
*** 204,212 ****
        }
  
     if (oldproc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldproc, hWnd, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hWnd, msg, wp, lp);
  }
  
  
--- 204,212 ----
        }
  
     if (oldproc)
!       return CallWindowProc ((WNDPROC)oldproc, hWnd, msg, wp, lp);
     else
!       return DefWindowProc (hWnd, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/al_progress.h
diff -c openafs/src/WINNT/afsapplib/al_progress.h:1.2 openafs/src/WINNT/afsapplib/al_progress.h:1.2.32.1
*** openafs/src/WINNT/afsapplib/al_progress.h:1.2	Sat Nov  4 05:01:20 2000
--- openafs/src/WINNT/afsapplib/al_progress.h	Fri Feb  2 23:53:04 2007
***************
*** 115,122 ****
        void Finish (DWORD dwStatus = 0);
        void PROGRESSDISPLAY::OnUpdate (void);
  
!       static BOOL CALLBACK ProgressDisplay_StubProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
!       static BOOL CALLBACK ProgressDisplay_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
        static DWORD WINAPI PROGRESSDISPLAY::ThreadProc (PVOID lp);
  
        BOOL m_fFinished;
--- 115,122 ----
        void Finish (DWORD dwStatus = 0);
        void PROGRESSDISPLAY::OnUpdate (void);
  
!       static HRESULT CALLBACK ProgressDisplay_StubProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
!       static HRESULT CALLBACK ProgressDisplay_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
        static DWORD WINAPI PROGRESSDISPLAY::ThreadProc (PVOID lp);
  
        BOOL m_fFinished;
Index: openafs/src/WINNT/afsapplib/al_pump.cpp
diff -c openafs/src/WINNT/afsapplib/al_pump.cpp:1.4.4.1 openafs/src/WINNT/afsapplib/al_pump.cpp:1.4.4.2
*** openafs/src/WINNT/afsapplib/al_pump.cpp:1.4.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_pump.cpp	Fri Feb  2 23:53:04 2007
***************
*** 64,70 ****
   *
   */
  
! BOOL CALLBACK Modeless_HookProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, Modeless_HookProc);
  
--- 64,70 ----
   *
   */
  
! HRESULT CALLBACK Modeless_HookProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, Modeless_HookProc);
  
***************
*** 81,89 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
--- 81,89 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
***************
*** 190,196 ****
   *
   */
  
! BOOL CALLBACK WindowData_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hWnd, WindowData_HookProc);
  
--- 190,196 ----
   *
   */
  
! HRESULT CALLBACK WindowData_HookProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hWnd, WindowData_HookProc);
  
***************
*** 211,219 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hWnd, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hWnd, msg, wp, lp);
  }
  
  
--- 211,219 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hWnd, msg, wp, lp);
     else
!       return DefWindowProc (hWnd, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/al_wizard.cpp
diff -c openafs/src/WINNT/afsapplib/al_wizard.cpp:1.5.4.1 openafs/src/WINNT/afsapplib/al_wizard.cpp:1.5.4.2
*** openafs/src/WINNT/afsapplib/al_wizard.cpp:1.5.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/al_wizard.cpp	Fri Feb  2 23:53:04 2007
***************
*** 646,652 ****
  }
  
  
! BOOL CALLBACK WIZARD::Template_DlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (msg == WM_INITDIALOG)
        SetWindowLongPtr (hWnd, DWLP_USER, lp);
--- 646,652 ----
  }
  
  
! HRESULT CALLBACK WIZARD::Template_DlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (msg == WM_INITDIALOG)
        SetWindowLongPtr (hWnd, DWLP_USER, lp);
***************
*** 673,679 ****
  }
  
  
! BOOL CALLBACK WIZARD::Template_LeftPaneHook (HWND hLHS, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hLHS, WIZARD::Template_LeftPaneHook);
  
--- 673,679 ----
  }
  
  
! HRESULT CALLBACK WIZARD::Template_LeftPaneHook (HWND hLHS, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hLHS, WIZARD::Template_LeftPaneHook);
  
***************
*** 925,931 ****
  }
  
  
! BOOL CALLBACK WIZARD::Background_DlgProc (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (msg == WM_INITDIALOG)
        SetWindowLongPtr (hBkg, DWLP_USER, lp);
--- 925,931 ----
  }
  
  
! HRESULT CALLBACK WIZARD::Background_DlgProc (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (msg == WM_INITDIALOG)
        SetWindowLongPtr (hBkg, DWLP_USER, lp);
***************
*** 972,978 ****
  }
  
  
! BOOL CALLBACK WIZARD::Background_PaintHook (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hBkg, WIZARD::Background_PaintHook);
  
--- 972,978 ----
  }
  
  
! HRESULT CALLBACK WIZARD::Background_PaintHook (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hBkg, WIZARD::Background_PaintHook);
  
***************
*** 993,1001 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hBkg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hBkg, msg, wp, lp);
  }
  
  
--- 993,1001 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hBkg, msg, wp, lp);
     else
!       return DefWindowProc (hBkg, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/al_wizard.h
diff -c openafs/src/WINNT/afsapplib/al_wizard.h:1.3 openafs/src/WINNT/afsapplib/al_wizard.h:1.3.30.1
*** openafs/src/WINNT/afsapplib/al_wizard.h:1.3	Thu Jan 11 01:41:23 2001
--- openafs/src/WINNT/afsapplib/al_wizard.h	Fri Feb  2 23:53:04 2007
***************
*** 96,111 ****
        void GeneratePalette (RGBQUAD *pargb = NULL);
        LPWIZARD_STATE FindState (int stFind);
  
!       static BOOL CALLBACK Background_DlgProc (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
!       static BOOL CALLBACK Background_PaintHook (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
        void Background_OnInitDialog (HWND hBkg);
        void Background_OnSize (void);
        void Background_OnDestroy (void);
        void Background_OnClose (void);
        BOOL Background_OnPaint (void);
  
!       static BOOL CALLBACK Template_DlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
!       static BOOL CALLBACK Template_LeftPaneHook (HWND hLHS, UINT msg, WPARAM wp, LPARAM lp);
        BOOL Template_ForwardMessage (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
        void Template_OnInitDialog (HWND hWnd);
        BOOL Template_OnPaintLHS (HWND hLHS);
--- 96,111 ----
        void GeneratePalette (RGBQUAD *pargb = NULL);
        LPWIZARD_STATE FindState (int stFind);
  
!       static HRESULT CALLBACK Background_DlgProc (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
!       static HRESULT CALLBACK Background_PaintHook (HWND hBkg, UINT msg, WPARAM wp, LPARAM lp);
        void Background_OnInitDialog (HWND hBkg);
        void Background_OnSize (void);
        void Background_OnDestroy (void);
        void Background_OnClose (void);
        BOOL Background_OnPaint (void);
  
!       static HRESULT CALLBACK Template_DlgProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
!       static HRESULT CALLBACK Template_LeftPaneHook (HWND hLHS, UINT msg, WPARAM wp, LPARAM lp);
        BOOL Template_ForwardMessage (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
        void Template_OnInitDialog (HWND hWnd);
        BOOL Template_OnPaintLHS (HWND hLHS);
Index: openafs/src/WINNT/afsapplib/checklist.cpp
diff -c openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.2 openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.3
*** openafs/src/WINNT/afsapplib/checklist.cpp:1.3.4.2	Tue Dec 12 15:40:52 2006
--- openafs/src/WINNT/afsapplib/checklist.cpp	Fri Feb  2 23:53:04 2007
***************
*** 57,65 ****
   *
   */
  
! BOOL CALLBACK CheckListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp);
  
! BOOL CALLBACK CheckList_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void CheckList_OnDrawItem (HWND hList, int id, LPDRAWITEMSTRUCT lpds);
  void CheckList_OnDrawCheckbox (HWND hList, int id, LPDRAWITEMSTRUCT lpds);
--- 57,65 ----
   *
   */
  
! HRESULT CALLBACK CheckListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp);
  
! HRESULT CALLBACK CheckList_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void CheckList_OnDrawItem (HWND hList, int id, LPDRAWITEMSTRUCT lpds);
  void CheckList_OnDrawCheckbox (HWND hList, int id, LPDRAWITEMSTRUCT lpds);
***************
*** 158,164 ****
  }
  
  
! BOOL CALLBACK CheckListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
      HRESULT hResult;
  
--- 158,164 ----
  }
  
  
! HRESULT CALLBACK CheckListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
      HRESULT hResult;
  
***************
*** 225,235 ****
     else
        hResult = (BOOL)DefWindowProc (hList, msg, wp, lp);
  
!     return (hResult?TRUE:FALSE);
  }
  
  
! BOOL CALLBACK CheckList_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID procOld = Subclass_FindNextHook (hDlg, CheckList_DialogProc);
  
--- 225,235 ----
     else
        hResult = (BOOL)DefWindowProc (hList, msg, wp, lp);
  
!     return (hResult);
  }
  
  
! HRESULT CALLBACK CheckList_DialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID procOld = Subclass_FindNextHook (hDlg, CheckList_DialogProc);
  
***************
*** 272,278 ****
        }
  
     if (procOld)
!       return (BOOL)CallWindowProc ((WNDPROC)procOld, hDlg, msg, wp, lp);
     else
        return FALSE;
  }
--- 272,278 ----
        }
  
     if (procOld)
!       return CallWindowProc ((WNDPROC)procOld, hDlg, msg, wp, lp);
     else
        return FALSE;
  }
Index: openafs/src/WINNT/afsapplib/ctl_date.cpp
diff -c openafs/src/WINNT/afsapplib/ctl_date.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/ctl_date.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/ctl_date.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/ctl_date.cpp	Fri Feb  2 23:53:04 2007
***************
*** 96,104 ****
  
  #define cszDATECLASS TEXT("Date")
  
! BOOL CALLBACK DateProc (HWND hDate, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK DateEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK DateDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Date_SendCallback (DateInfo *pdi, WORD eln, LPARAM lp);
  
--- 96,104 ----
  
  #define cszDATECLASS TEXT("Date")
  
! HRESULT CALLBACK DateProc (HWND hDate, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK DateEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK DateDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Date_SendCallback (DateInfo *pdi, WORD eln, LPARAM lp);
  
***************
*** 154,160 ****
  }
  
  
! BOOL CALLBACK DateProc (HWND hDate, UINT msg, WPARAM wp, LPARAM lp)
  {
     DateInfo *pdi = NULL;
  
--- 154,160 ----
  }
  
  
! HRESULT CALLBACK DateProc (HWND hDate, UINT msg, WPARAM wp, LPARAM lp)
  {
     DateInfo *pdi = NULL;
  
***************
*** 262,268 ****
           }
        }
  
!    return (BOOL)DefWindowProc (hDate, msg, wp, lp);
  }
  
  
--- 262,268 ----
           }
        }
  
!    return DefWindowProc (hDate, msg, wp, lp);
  }
  
  
***************
*** 532,538 ****
  }
  
  
! BOOL CALLBACK DateDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, DateDlgProc);
     size_t iDate;
--- 532,538 ----
  }
  
  
! HRESULT CALLBACK DateDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, DateDlgProc);
     size_t iDate;
***************
*** 582,594 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! BOOL CALLBACK DateEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     DateInfo *pdi = NULL;
  
--- 582,594 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! HRESULT CALLBACK DateEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     DateInfo *pdi = NULL;
  
***************
*** 618,626 ****
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, DateEditProc);
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
--- 618,626 ----
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, DateEditProc);
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/ctl_elapsed.cpp
diff -c openafs/src/WINNT/afsapplib/ctl_elapsed.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/ctl_elapsed.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/ctl_elapsed.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/ctl_elapsed.cpp	Fri Feb  2 23:53:04 2007
***************
*** 97,105 ****
  
  #define cszELAPSEDCLASS TEXT("Elapsed")
  
! BOOL CALLBACK ElapsedProc (HWND hElapsed, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK ElapsedEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK ElapsedDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Elapsed_SendCallback (ElapsedInfo *pei, WORD eln, LPARAM lp);
  
--- 97,105 ----
  
  #define cszELAPSEDCLASS TEXT("Elapsed")
  
! HRESULT CALLBACK ElapsedProc (HWND hElapsed, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK ElapsedEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK ElapsedDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Elapsed_SendCallback (ElapsedInfo *pei, WORD eln, LPARAM lp);
  
***************
*** 159,165 ****
  }
  
  
! BOOL CALLBACK ElapsedProc (HWND hElapsed, UINT msg, WPARAM wp, LPARAM lp)
  {
     ElapsedInfo *pei = NULL;
  
--- 159,165 ----
  }
  
  
! HRESULT CALLBACK ElapsedProc (HWND hElapsed, UINT msg, WPARAM wp, LPARAM lp)
  {
     ElapsedInfo *pei = NULL;
  
***************
*** 274,280 ****
           }
        }
  
!    return (BOOL)DefWindowProc (hElapsed, msg, wp, lp);
  }
  
  
--- 274,280 ----
           }
        }
  
!    return DefWindowProc (hElapsed, msg, wp, lp);
  }
  
  
***************
*** 490,496 ****
  }
  
  
! BOOL CALLBACK ElapsedDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, ElapsedDlgProc);
     size_t iElapsed;
--- 490,496 ----
  }
  
  
! HRESULT CALLBACK ElapsedDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, ElapsedDlgProc);
     size_t iElapsed;
***************
*** 515,521 ****
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (BOOL)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
--- 515,521 ----
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (HRESULT)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
***************
*** 540,552 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! BOOL CALLBACK ElapsedEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     ElapsedInfo *pei = NULL;
  
--- 540,552 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! HRESULT CALLBACK ElapsedEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     ElapsedInfo *pei = NULL;
  
***************
*** 576,584 ****
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, ElapsedEditProc);
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
--- 576,584 ----
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, ElapsedEditProc);
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/ctl_sockaddr.cpp
diff -c openafs/src/WINNT/afsapplib/ctl_sockaddr.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/ctl_sockaddr.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/ctl_sockaddr.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/ctl_sockaddr.cpp	Fri Feb  2 23:53:04 2007
***************
*** 97,105 ****
  
  #define cszSOCKADDRCLASS TEXT("SockAddr")
  
! BOOL CALLBACK SockAddrProc (HWND hSockAddr, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK SockAddrEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK SockAddrDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void SockAddr_SendCallback (SockAddrInfo *psai, WORD eln, LPARAM lp);
  
--- 97,105 ----
  
  #define cszSOCKADDRCLASS TEXT("SockAddr")
  
! HRESULT CALLBACK SockAddrProc (HWND hSockAddr, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK SockAddrEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK SockAddrDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void SockAddr_SendCallback (SockAddrInfo *psai, WORD eln, LPARAM lp);
  
***************
*** 156,162 ****
  }
  
  
! BOOL CALLBACK SockAddrProc (HWND hSockAddr, UINT msg, WPARAM wp, LPARAM lp)
  {
     SockAddrInfo *psai = NULL;
  
--- 156,162 ----
  }
  
  
! HRESULT CALLBACK SockAddrProc (HWND hSockAddr, UINT msg, WPARAM wp, LPARAM lp)
  {
     SockAddrInfo *psai = NULL;
  
***************
*** 236,242 ****
           }
        }
  
!    return (BOOL)DefWindowProc (hSockAddr, msg, wp, lp);
  }
  
  
--- 236,242 ----
           }
        }
  
!    return DefWindowProc (hSockAddr, msg, wp, lp);
  }
  
  
***************
*** 445,451 ****
  }
  
  
! BOOL CALLBACK SockAddrDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, SockAddrDlgProc);
     size_t iSockAddr;
--- 445,451 ----
  }
  
  
! HRESULT CALLBACK SockAddrDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, SockAddrDlgProc);
     size_t iSockAddr;
***************
*** 472,478 ****
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (BOOL)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
--- 472,478 ----
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (HRESULT)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
***************
*** 510,522 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! BOOL CALLBACK SockAddrEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     SockAddrInfo *psai = NULL;
  
--- 510,522 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! HRESULT CALLBACK SockAddrEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     SockAddrInfo *psai = NULL;
  
***************
*** 556,564 ****
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, SockAddrEditProc);
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
--- 556,564 ----
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, SockAddrEditProc);
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/ctl_spinner.cpp
diff -c openafs/src/WINNT/afsapplib/ctl_spinner.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/ctl_spinner.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/ctl_spinner.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/ctl_spinner.cpp	Fri Feb  2 23:53:04 2007
***************
*** 101,109 ****
  
  #define cszSPINNERCLASS TEXT("Spinner")
  
! BOOL CALLBACK SpinnerProc (HWND hSpin, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK SpinnerDialogProc (HWND hSpin, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK SpinnerBuddyProc (HWND hBuddy, UINT msg, WPARAM wp, LPARAM lp);
  
  void SpinnerSendCallback (SpinnerInfo *psi, WORD spm, LPARAM lp);
  
--- 101,109 ----
  
  #define cszSPINNERCLASS TEXT("Spinner")
  
! HRESULT CALLBACK SpinnerProc (HWND hSpin, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK SpinnerDialogProc (HWND hSpin, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK SpinnerBuddyProc (HWND hBuddy, UINT msg, WPARAM wp, LPARAM lp);
  
  void SpinnerSendCallback (SpinnerInfo *psi, WORD spm, LPARAM lp);
  
***************
*** 259,265 ****
  }
  
  
! BOOL CALLBACK SpinnerProc (HWND hSpinner, UINT msg, WPARAM wp, LPARAM lp)
  {
     EnterCriticalSection (&csSpinners);
  
--- 259,265 ----
  }
  
  
! HRESULT CALLBACK SpinnerProc (HWND hSpinner, UINT msg, WPARAM wp, LPARAM lp)
  {
     EnterCriticalSection (&csSpinners);
  
***************
*** 321,333 ****
        }
  
     if (oldSpinnerProc == 0)
!       return (BOOL)DefWindowProc (hSpinner, msg, wp, lp);
     else
!       return (BOOL)CallWindowProc ((WNDPROC)(LONG_PTR)oldSpinnerProc, hSpinner, msg, wp, lp);
  }
  
  
! BOOL CALLBACK SpinnerDialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, SpinnerDialogProc);
     SpinnerInfo *psi;
--- 321,333 ----
        }
  
     if (oldSpinnerProc == 0)
!       return DefWindowProc (hSpinner, msg, wp, lp);
     else
!       return CallWindowProc ((WNDPROC)(LONG_PTR)oldSpinnerProc, hSpinner, msg, wp, lp);
  }
  
  
! HRESULT CALLBACK SpinnerDialogProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, SpinnerDialogProc);
     SpinnerInfo *psi;
***************
*** 416,429 ****
        }
  
     if (oldProc == 0)
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
     else
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
  }
  
  
  
! BOOL CALLBACK SpinnerBuddyProc (HWND hBuddy, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hBuddy, SpinnerBuddyProc);
  
--- 416,429 ----
        }
  
     if (oldProc == 0)
!       return DefWindowProc (hDlg, msg, wp, lp);
     else
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
  }
  
  
  
! HRESULT CALLBACK SpinnerBuddyProc (HWND hBuddy, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hBuddy, SpinnerBuddyProc);
  
***************
*** 501,509 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hBuddy, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hBuddy, msg, wp, lp);
  }
  
  
--- 501,509 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hBuddy, msg, wp, lp);
     else
!       return DefWindowProc (hBuddy, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/ctl_time.cpp
diff -c openafs/src/WINNT/afsapplib/ctl_time.cpp:1.3.4.1 openafs/src/WINNT/afsapplib/ctl_time.cpp:1.3.4.2
*** openafs/src/WINNT/afsapplib/ctl_time.cpp:1.3.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/ctl_time.cpp	Fri Feb  2 23:53:04 2007
***************
*** 98,106 ****
  
  #define cszTIMECLASS TEXT("Time")
  
! BOOL CALLBACK TimeProc (HWND hTime, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK TimeEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK TimeDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Time_SendCallback (TimeInfo *pti, WORD eln, LPARAM lp);
  
--- 98,106 ----
  
  #define cszTIMECLASS TEXT("Time")
  
! HRESULT CALLBACK TimeProc (HWND hTime, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK TimeEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK TimeDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void Time_SendCallback (TimeInfo *pti, WORD eln, LPARAM lp);
  
***************
*** 158,164 ****
  }
  
  
! BOOL CALLBACK TimeProc (HWND hTime, UINT msg, WPARAM wp, LPARAM lp)
  {
     TimeInfo *pti = NULL;
  
--- 158,164 ----
  }
  
  
! HRESULT CALLBACK TimeProc (HWND hTime, UINT msg, WPARAM wp, LPARAM lp)
  {
     TimeInfo *pti = NULL;
  
***************
*** 271,277 ****
           }
        }
  
!    return (BOOL)DefWindowProc (hTime, msg, wp, lp);
  }
  
  
--- 271,277 ----
           }
        }
  
!    return DefWindowProc (hTime, msg, wp, lp);
  }
  
  
***************
*** 513,519 ****
  }
  
  
! BOOL CALLBACK TimeDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, TimeDlgProc);
     size_t iTime;
--- 513,519 ----
  }
  
  
! HRESULT CALLBACK TimeDlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, TimeDlgProc);
     size_t iTime;
***************
*** 539,545 ****
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (BOOL)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
--- 539,545 ----
                 else
                    clr = GetSysColor (COLOR_BTNFACE);
                 SetBkColor ((HDC)wp, clr);
!                return (HRESULT)(INT_PTR)CreateSolidBrush (clr);
                 }
              }
           break;
***************
*** 606,618 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! BOOL CALLBACK TimeEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     TimeInfo *pti = NULL;
  
--- 606,618 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hDlg, msg, wp, lp);
     else
!       return DefWindowProc (hDlg, msg, wp, lp);
  }
  
  
! HRESULT CALLBACK TimeEditProc (HWND hEdit, UINT msg, WPARAM wp, LPARAM lp)
  {
     TimeInfo *pti = NULL;
  
***************
*** 642,650 ****
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, TimeEditProc);
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
--- 642,650 ----
  
     PVOID oldProc = Subclass_FindNextHook (hEdit, TimeEditProc);
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hEdit, msg, wp, lp);
     else
!       return DefWindowProc (hEdit, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/dialog.cpp
diff -c openafs/src/WINNT/afsapplib/dialog.cpp:1.5.4.1 openafs/src/WINNT/afsapplib/dialog.cpp:1.5.4.2
*** openafs/src/WINNT/afsapplib/dialog.cpp:1.5.4.1	Sun Jun 25 13:54:47 2006
--- openafs/src/WINNT/afsapplib/dialog.cpp	Fri Feb  2 23:53:04 2007
***************
*** 130,136 ****
  static size_t cPropSheets = 0;
  
  
! BOOL CALLBACK PropTab_HookProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (PropSheet_HandleNotify (hDlg, msg, wp, lp))
        return TRUE;
--- 130,136 ----
  static size_t cPropSheets = 0;
  
  
! HRESULT CALLBACK PropTab_HookProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     if (PropSheet_HandleNotify (hDlg, msg, wp, lp))
        return TRUE;
***************
*** 194,200 ****
           }
        }
  
!    return (BOOL)DefWindowProc (hDlg, msg, wp, lp);
  
  }
  
--- 194,200 ----
           }
        }
  
!    return DefWindowProc (hDlg, msg, wp, lp);
  
  }
  
***************
*** 300,314 ****
  }
  
  
! BOOL CALLBACK PropSheet_HookProc (HWND hSheet, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldproc = Subclass_FindNextHook (hSheet, PropSheet_HookProc);
  
-    BOOL rc;
     if (oldproc)
!       rc = (BOOL)CallWindowProc ((WNDPROC)oldproc, hSheet, msg, wp, lp);
     else
!       rc = (BOOL)DefWindowProc (hSheet, msg, wp, lp);
  
     switch (msg)
        {
--- 300,314 ----
  }
  
  
! HRESULT CALLBACK PropSheet_HookProc (HWND hSheet, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldproc = Subclass_FindNextHook (hSheet, PropSheet_HookProc);
+    HRESULT rc;
  
     if (oldproc)
!       rc = CallWindowProc ((WNDPROC)oldproc, hSheet, msg, wp, lp);
     else
!       rc = DefWindowProc (hSheet, msg, wp, lp);
  
     switch (msg)
        {
***************
*** 1127,1133 ****
     BOOL fAscending;
     } VIEWSORTINFO, *LPVIEWSORTINFO;
  
! BOOL CALLBACK LV_SortView_Numeric (LPARAM lp1, LPARAM lp2, LPARAM lpSort)
  {
     LPVIEWSORTINFO lpvsi = (LPVIEWSORTINFO)lpSort;
     TCHAR szText[ cchRESOURCE ];
--- 1127,1133 ----
     BOOL fAscending;
     } VIEWSORTINFO, *LPVIEWSORTINFO;
  
! HRESULT CALLBACK LV_SortView_Numeric (LPARAM lp1, LPARAM lp2, LPARAM lpSort)
  {
     LPVIEWSORTINFO lpvsi = (LPVIEWSORTINFO)lpSort;
     TCHAR szText[ cchRESOURCE ];
***************
*** 1144,1156 ****
     d2 = atof (szText);
  
     if (lpvsi->fAscending)
!       return (d2 <  d1) ? ((BOOL)-1) : (d2 == d1) ? ((BOOL)0) : (BOOL)1;
     else
!       return (d1 <  d2) ? ((BOOL)-1) : (d1 == d2) ? ((BOOL)0) : (BOOL)1;
  }
  
  
! BOOL CALLBACK LV_SortView_Alphabetic (LPARAM lp1, LPARAM lp2, LPARAM lpSort)
  {
     LPVIEWSORTINFO lpvsi = (LPVIEWSORTINFO)lpSort;
     TCHAR szText1[ cchRESOURCE ];
--- 1144,1156 ----
     d2 = atof (szText);
  
     if (lpvsi->fAscending)
!       return (HRESULT)((d2 <  d1) ? -1 : (d2 == d1) ? 0 : 1);
     else
!       return (HRESULT)((d1 <  d2) ? -1 : (d1 == d2) ? 0 : 1);
  }
  
  
! HRESULT CALLBACK LV_SortView_Alphabetic (LPARAM lp1, LPARAM lp2, LPARAM lpSort)
  {
     LPVIEWSORTINFO lpvsi = (LPVIEWSORTINFO)lpSort;
     TCHAR szText1[ cchRESOURCE ];
***************
*** 1532,1538 ****
  }
  
  
! BOOL CALLBACK ListBox_HScrollHook (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hList, ListBox_HScrollHook);
  
--- 1532,1538 ----
  }
  
  
! HRESULT CALLBACK ListBox_HScrollHook (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hList, ListBox_HScrollHook);
  
***************
*** 1587,1595 ****
        }
  
     if (oldProc)
!       return (BOOL)CallWindowProc ((WNDPROC)oldProc, hList, msg, wp, lp);
     else
!       return (BOOL)DefWindowProc (hList, msg, wp, lp);
  }
  
  
--- 1587,1595 ----
        }
  
     if (oldProc)
!       return CallWindowProc ((WNDPROC)oldProc, hList, msg, wp, lp);
     else
!       return DefWindowProc (hList, msg, wp, lp);
  }
  
  
Index: openafs/src/WINNT/afsapplib/fastlist.cpp
diff -c openafs/src/WINNT/afsapplib/fastlist.cpp:1.5 openafs/src/WINNT/afsapplib/fastlist.cpp:1.5.4.1
*** openafs/src/WINNT/afsapplib/fastlist.cpp:1.5	Wed Jul  6 20:23:21 2005
--- openafs/src/WINNT/afsapplib/fastlist.cpp	Fri Feb  2 23:53:04 2007
***************
*** 220,227 ****
  BOOL OpenGlobalArray (size_t cObjects);
  void CloseGlobalArray (void);
  
! BOOL CALLBACK FastList_ControlProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp);
! BOOL CALLBACK FastList_ParentProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void FastList_OnCreate (HWND hList);
  void FastList_OnDestroy (HWND hList);
--- 220,227 ----
  BOOL OpenGlobalArray (size_t cObjects);
  void CloseGlobalArray (void);
  
! HRESULT CALLBACK FastList_ControlProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp);
! HRESULT CALLBACK FastList_ParentProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  
  void FastList_OnCreate (HWND hList);
  void FastList_OnDestroy (HWND hList);
***************
*** 447,453 ****
  }
  
  
! BOOL CALLBACK FastList_ControlProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
--- 447,453 ----
  }
  
  
! HRESULT CALLBACK FastList_ControlProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
  {
     switch (msg)
        {
***************
*** 681,687 ****
  }
  
  
! BOOL CALLBACK FastList_ParentProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, FastList_ParentProc);
  
--- 681,687 ----
  }
  
  
! HRESULT CALLBACK FastList_ParentProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID oldProc = Subclass_FindNextHook (hDlg, FastList_ParentProc);
  
Index: openafs/src/WINNT/afsapplib/resize.cpp
diff -c openafs/src/WINNT/afsapplib/resize.cpp:1.4 openafs/src/WINNT/afsapplib/resize.cpp:1.4.4.1
*** openafs/src/WINNT/afsapplib/resize.cpp:1.4	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/resize.cpp	Fri Feb  2 23:53:04 2007
***************
*** 96,102 ****
  
  void FindResizeLimits (HWND hWnd, LONG *pcxMin, LONG *pcxMax, LONG *pcyMin, LONG *pcyMax, rwWindowData * = 0);
  
! BOOL CALLBACK Resize_DialogProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
--- 96,102 ----
  
  void FindResizeLimits (HWND hWnd, LONG *pcxMin, LONG *pcxMax, LONG *pcyMin, LONG *pcyMax, rwWindowData * = 0);
  
! HRESULT CALLBACK Resize_DialogProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
***************
*** 894,900 ****
  }
  
  
! BOOL CALLBACK Resize_DialogProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID fnNext = Subclass_FindNextHook (hWnd, Resize_DialogProc);
  
--- 894,900 ----
  }
  
  
! HRESULT CALLBACK Resize_DialogProc (HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
  {
     PVOID fnNext = Subclass_FindNextHook (hWnd, Resize_DialogProc);
  
Index: openafs/src/WINNT/afsapplib/subclass.cpp
diff -c openafs/src/WINNT/afsapplib/subclass.cpp:1.6 openafs/src/WINNT/afsapplib/subclass.cpp:1.6.4.1
*** openafs/src/WINNT/afsapplib/subclass.cpp:1.6	Sat Nov  5 01:47:44 2005
--- openafs/src/WINNT/afsapplib/subclass.cpp	Fri Feb  2 23:53:04 2007
***************
*** 21,27 ****
   *
   */
  
! LONG CALLBACK Subclass_WndProc (HWND hTarget, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
--- 21,27 ----
   *
   */
  
! HRESULT CALLBACK Subclass_WndProc (HWND hTarget, UINT msg, WPARAM wp, LPARAM lp);
  
  
  /*
***************
*** 214,220 ****
  }
  
  
! LONG CALLBACK Subclass_WndProc (HWND hTarget, UINT msg, WPARAM wp, LPARAM lp)
  {
     size_t iTarget;
     for (iTarget = 0; iTarget < nTargets; ++iTarget)
--- 214,220 ----
  }
  
  
! HRESULT CALLBACK Subclass_WndProc (HWND hTarget, UINT msg, WPARAM wp, LPARAM lp)
  {
     size_t iTarget;
     for (iTarget = 0; iTarget < nTargets; ++iTarget)
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.9 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.10
*** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.9	Fri Jan  5 12:14:52 2007
--- openafs/src/WINNT/afsd/afsd_init.c	Sat Feb  3 12:49:33 2007
***************
*** 180,187 ****
  
      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");
!     StringCbCatA(u, sizeof(u), ": Created log file\n");
      WriteFile(afsi_file, t, (DWORD)strlen(t), &zilch, NULL);
      WriteFile(afsi_file, u, (DWORD)strlen(u), &zilch, NULL);
      p = "PATH=";
--- 180,187 ----
  
      SetFilePointer(afsi_file, 0, NULL, FILE_END);
      GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, u, sizeof(u));
!     StringCbCatA(t, sizeof(t), ": Create log file\r\n");
!     StringCbCatA(u, sizeof(u), ": Created log file\r\n");
      WriteFile(afsi_file, t, (DWORD)strlen(t), &zilch, NULL);
      WriteFile(afsi_file, u, (DWORD)strlen(u), &zilch, NULL);
      p = "PATH=";
***************
*** 190,196 ****
      code = GetEnvironmentVariable("PATH", path, code);
      WriteFile(afsi_file, p, (DWORD)strlen(p), &zilch, NULL);
      WriteFile(afsi_file, path, (DWORD)strlen(path), &zilch, NULL);
!     WriteFile(afsi_file, "\n", (DWORD)1, &zilch, NULL);
      free(path);
  
      /* Initialize C RTL Code Page conversion functions */
--- 190,196 ----
      code = GetEnvironmentVariable("PATH", path, code);
      WriteFile(afsi_file, p, (DWORD)strlen(p), &zilch, NULL);
      WriteFile(afsi_file, path, (DWORD)strlen(path), &zilch, NULL);
!     WriteFile(afsi_file, "\r\n", (DWORD)1, &zilch, NULL);
      free(path);
  
      /* Initialize C RTL Code Page conversion functions */
Index: openafs/src/WINNT/afsd/cm_access.c
diff -c openafs/src/WINNT/afsd/cm_access.c:1.7.2.9 openafs/src/WINNT/afsd/cm_access.c:1.7.2.14
*** openafs/src/WINNT/afsd/cm_access.c:1.7.2.9	Fri Jan  5 12:14:52 2007
--- openafs/src/WINNT/afsd/cm_access.c	Fri Feb  9 18:54:31 2007
***************
*** 42,48 ****
      cm_fid_t tfid;
      int didLock;
      long trights;
! 	
      didLock = 0;
      if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
          aclScp = scp;
--- 42,54 ----
      cm_fid_t tfid;
      int didLock;
      long trights;
! 
! #if 0
!     if (scp->flags & CM_SCACHEFLAG_EACCESS) {
!     	*outRightsp = 0;
! 	return 1;
!     }
! #endif
      didLock = 0;
      if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
          aclScp = scp;
***************
*** 63,69 ****
                  return 0;
              }
  
!             /* check that we have a callback, too */
              if (!cm_HaveCallback(aclScp)) {
                  /* can't use it */
                  lock_ReleaseMutex(&aclScp->mx);
--- 69,75 ----
                  return 0;
              }
  
! 	    /* check that we have a callback, too */
              if (!cm_HaveCallback(aclScp)) {
                  /* can't use it */
                  lock_ReleaseMutex(&aclScp->mx);
***************
*** 80,85 ****
--- 86,97 ----
       * Otherwise, if we an explicit acl entry, we're also in good shape,
       * and can definitively answer.
       */
+ #ifdef AFS_FREELANCE_CLIENT
+     if (cm_freelanceEnabled && aclScp == cm_data.rootSCachep)
+     {
+     	*outRightsp = aclScp->anyAccess;
+     } else
+ #endif
      if ((~aclScp->anyAccess & rights) == 0) {
          *outRightsp = rights;
      } else {
***************
*** 92,104 ****
          *outRightsp = trights;
      }
  
!     /* check mode bits */
!     if (!(scp->unixModeBits & 0400))
!         *outRightsp &= ~PRSFS_READ;
!     if (!(scp->unixModeBits & 0200) && !(rights == (PRSFS_WRITE | PRSFS_LOCK)))
!         *outRightsp &= ~PRSFS_WRITE;
!     if (!(scp->unixModeBits & 0200) && !cm_deleteReadOnly)
!         *outRightsp &= ~PRSFS_DELETE;
  
      /* if the user can obtain a write-lock, read-locks are implied */
      if (*outRightsp & PRSFS_WRITE)
--- 104,127 ----
          *outRightsp = trights;
      }
  
!     if (scp->fileType > 0 && scp->fileType != CM_SCACHETYPE_DIRECTORY) {
! 	/* check mode bits */
! 	if ((scp->unixModeBits & 0400) == 0) {
! 	    osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing READ scp 0x%p unix 0x%x", 
! 		      scp, scp->unixModeBits);
! 	    *outRightsp &= ~PRSFS_READ;
! 	}
! 	if ((scp->unixModeBits & 0200) == 0 && (rights != (PRSFS_WRITE | PRSFS_LOCK))) {
! 	    osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing WRITE scp 0x%p unix 0%o", 
! 		      scp, scp->unixModeBits);
! 	    *outRightsp &= ~PRSFS_WRITE;
! 	}
! 	if ((scp->unixModeBits & 0200) == 0 && !cm_deleteReadOnly) {
! 	    osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing DELETE scp 0x%p unix 0%o", 
! 		      scp, scp->unixModeBits);
! 	    *outRightsp &= ~PRSFS_DELETE;
! 	}
!     }
  
      /* if the user can obtain a write-lock, read-locks are implied */
      if (*outRightsp & PRSFS_WRITE)
Index: openafs/src/WINNT/afsd/cm_buf.c
diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.11 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.15
*** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.11	Tue Dec 12 12:04:41 2006
--- openafs/src/WINNT/afsd/cm_buf.c	Sun Feb  4 22:41:41 2007
***************
*** 313,319 ****
              cm_data.buf_nOrigBuffers = cm_data.buf_nbuffers;
   
              /* lower hash size to a prime number */
!             cm_data.buf_hashSize = osi_PrimeLessThan(CM_BUF_HASHSIZE);
   
              /* create hash table */
              memset((void *)cm_data.buf_hashTablepp, 0, cm_data.buf_hashSize * sizeof(cm_buf_t *));
--- 313,319 ----
              cm_data.buf_nOrigBuffers = cm_data.buf_nbuffers;
   
              /* lower hash size to a prime number */
! 	    cm_data.buf_hashSize = osi_PrimeLessThan((afs_uint32)(cm_data.buf_nbuffers/7 + 1));
   
              /* create hash table */
              memset((void *)cm_data.buf_hashTablepp, 0, cm_data.buf_hashSize * sizeof(cm_buf_t *));
***************
*** 548,554 ****
   */
  cm_buf_t *buf_FindLocked(struct cm_scache *scp, osi_hyper_t *offsetp)
  {
!     long i;
      cm_buf_t *bp;
  
      i = BUF_HASH(&scp->fid, offsetp);
--- 548,554 ----
   */
  cm_buf_t *buf_FindLocked(struct cm_scache *scp, osi_hyper_t *offsetp)
  {
!     afs_uint32 i;
      cm_buf_t *bp;
  
      i = BUF_HASH(&scp->fid, offsetp);
***************
*** 680,687 ****
       * have any lock conflicts, so we can grab the buffer lock out of
       * order in the locking hierarchy.
       */
!     osi_Log2( buf_logp, "buf_Recycle recycles 0x%p, off 0x%x",
!               bp, bp->offset.LowPart);
  
      osi_assert(bp->refCount == 0);
      osi_assert(!(bp->flags & (CM_BUF_READING | CM_BUF_WRITING | CM_BUF_DIRTY)));
--- 680,687 ----
       * have any lock conflicts, so we can grab the buffer lock out of
       * order in the locking hierarchy.
       */
!     osi_Log3( buf_logp, "buf_Recycle recycles 0x%p, off 0x%x:%08x",
!               bp, bp->offset.HighPart, bp->offset.LowPart);
  
      osi_assert(bp->refCount == 0);
      osi_assert(!(bp->flags & (CM_BUF_READING | CM_BUF_WRITING | CM_BUF_DIRTY)));
***************
*** 768,778 ****
  
  	/* does this fix the problem below?  it's a simple solution. */
  	if (!cm_data.buf_freeListEndp)
! 	    {
  	    lock_ReleaseWrite(&buf_globalLock);
  	    Sleep(200);
  	    goto retry;
! 	    }
  
          /* for debugging, assert free list isn't empty, although we
           * really should try waiting for a running tranasction to finish
--- 768,779 ----
  
  	/* does this fix the problem below?  it's a simple solution. */
  	if (!cm_data.buf_freeListEndp)
! 	{
  	    lock_ReleaseWrite(&buf_globalLock);
+ 	    osi_Log0(afsd_logp, "buf_GetNewLocked: Free Buffer List is empty - sleeping 200ms");
  	    Sleep(200);
  	    goto retry;
! 	}
  
          /* for debugging, assert free list isn't empty, although we
           * really should try waiting for a running tranasction to finish
***************
*** 874,890 ****
                  cm_data.buf_fileHashTablepp[i] = bp;
              }
  
!             /* prepare to return it.  Start by giving it a good
!              * refcount */
!             bp->refCount = 1;
!                         
!             /* and since it has a non-zero ref count, we should move
!              * it from the lru queue.  It better be still there,
!              * since we've held the global (big) lock since we found
!              * it there.
               */
              osi_assertx(bp->flags & CM_BUF_INLRU,
                           "buf_GetNewLocked: LRU screwup");
              if (cm_data.buf_freeListEndp == bp) {
                  /* we're the last guy in this queue, so maintain it */
                  cm_data.buf_freeListEndp = (cm_buf_t *) osi_QPrev(&bp->q);
--- 875,886 ----
                  cm_data.buf_fileHashTablepp[i] = bp;
              }
  
!             /* we should move it from the lru queue.  It better still be there,
!              * since we've held the global (big) lock since we found it there.
               */
              osi_assertx(bp->flags & CM_BUF_INLRU,
                           "buf_GetNewLocked: LRU screwup");
+ 
              if (cm_data.buf_freeListEndp == bp) {
                  /* we're the last guy in this queue, so maintain it */
                  cm_data.buf_freeListEndp = (cm_buf_t *) osi_QPrev(&bp->q);
***************
*** 892,904 ****
              osi_QRemove((osi_queue_t **) &cm_data.buf_freeListp, &bp->q);
              bp->flags &= ~CM_BUF_INLRU;
  
!             /* finally, grab the mutex so that people don't use it
               * before the caller fills it with data.  Again, no one	
               * should have been able to get to this dude to lock it.
               */
!             osi_assertx(lock_TryMutex(&bp->mx),
!                          "buf_GetNewLocked: TryMutex failed");
  
              lock_ReleaseWrite(&buf_globalLock);
              *bufpp = bp;
  
--- 888,906 ----
              osi_QRemove((osi_queue_t **) &cm_data.buf_freeListp, &bp->q);
              bp->flags &= ~CM_BUF_INLRU;
  
!             /* grab the mutex so that people don't use it
               * before the caller fills it with data.  Again, no one	
               * should have been able to get to this dude to lock it.
               */
! 	    if (!lock_TryMutex(&bp->mx)) {
! 	    	osi_Log2(afsd_logp, "buf_GetNewLocked bp 0x%p cannot be mutex locked.  refCount %d should be 0",
! 			 bp, bp->refCount);
! 		osi_panic("buf_GetNewLocked: TryMutex failed",__FILE__,__LINE__);
! 	    }
  
+ 	    /* prepare to return it.  Give it a refcount */
+             bp->refCount = 1;
+                         
              lock_ReleaseWrite(&buf_globalLock);
              *bufpp = bp;
  
***************
*** 908,914 ****
              return 0;
          } /* for all buffers in lru queue */
          lock_ReleaseWrite(&buf_globalLock);
! 		Sleep(100);		/* give some time for a buffer to be freed */
      }	/* while loop over everything */
      /* not reached */
  } /* the proc */
--- 910,917 ----
              return 0;
          } /* for all buffers in lru queue */
          lock_ReleaseWrite(&buf_globalLock);
! 	osi_Log0(afsd_logp, "buf_GetNewLocked: Free Buffer List has no buffers with a zero refcount - sleeping 100ms");
! 	Sleep(100);		/* give some time for a buffer to be freed */
      }	/* while loop over everything */
      /* not reached */
  } /* the proc */
***************
*** 961,968 ****
       */
      lock_ReleaseMutex(&bp->mx);
      *bufpp = bp;
!     osi_Log3(buf_logp, "buf_GetNew returning bp 0x%p for scp 0x%p, offset 0x%x",
!               bp, scp, offsetp->LowPart);
      return 0;
  }
  
--- 964,971 ----
       */
      lock_ReleaseMutex(&bp->mx);
      *bufpp = bp;
!     osi_Log4(buf_logp, "buf_GetNew returning bp 0x%p for scp 0x%p, offset 0x%x:%08x",
!               bp, scp, offsetp->HighPart, offsetp->LowPart);
      return 0;
  }
  
***************
*** 1109,1116 ****
      }
      lock_ReleaseWrite(&buf_globalLock);
  
!     osi_Log3(buf_logp, "buf_Get returning bp 0x%p for scp 0x%p, offset 0x%x",
!               bp, scp, offsetp->LowPart);
  #ifdef TESTING
      buf_ValidateBufQueues();
  #endif /* TESTING */
--- 1112,1119 ----
      }
      lock_ReleaseWrite(&buf_globalLock);
  
!     osi_Log4(buf_logp, "buf_Get returning bp 0x%p for scp 0x%p, offset 0x%x:%08x",
!               bp, scp, offsetp->HighPart, offsetp->LowPart);
  #ifdef TESTING
      buf_ValidateBufQueues();
  #endif /* TESTING */
***************
*** 1233,1239 ****
   */
  long buf_CleanAndReset(void)
  {
!     long i;
      cm_buf_t *bp;
      cm_req_t req;
  
--- 1236,1242 ----
   */
  long buf_CleanAndReset(void)
  {
!     afs_uint32 i;
      cm_buf_t *bp;
      cm_req_t req;
  
***************
*** 1349,1355 ****
  
      buf_HoldLocked(bufp);
      lock_ReleaseWrite(&buf_globalLock);
!     for(; bufp; bufp = nbufp) {
          lock_ObtainMutex(&bufp->mx);
  
          bufEnd.HighPart = 0;
--- 1352,1358 ----
  
      buf_HoldLocked(bufp);
      lock_ReleaseWrite(&buf_globalLock);
!     while (bufp) {
          lock_ObtainMutex(&bufp->mx);
  
          bufEnd.HighPart = 0;
***************
*** 1426,1431 ****
--- 1429,1435 ----
  	}
  	buf_ReleaseLocked(bufp);
  	lock_ReleaseWrite(&buf_globalLock);
+ 	bufp = nbufp;
      }
  
  #ifdef TESTING
***************
*** 1604,1610 ****
      int zilch;
      cm_buf_t *bp;
      char output[1024];
!     int i;
    
      if (cm_data.buf_hashTablepp == NULL)
          return -1;
--- 1608,1614 ----
      int zilch;
      cm_buf_t *bp;
      char output[1024];
!     afs_uint32 i;
    
      if (cm_data.buf_hashTablepp == NULL)
          return -1;
***************
*** 1612,1618 ****
      if (lock)
          lock_ObtainRead(&buf_globalLock);
    
!     StringCbPrintfA(output, sizeof(output), "%s - dumping buf_HashTable - buf_hashSize=%d\n", 
                      cookie, cm_data.buf_hashSize);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
--- 1616,1622 ----
      if (lock)
          lock_ObtainRead(&buf_globalLock);
    
!     StringCbPrintfA(output, sizeof(output), "%s - dumping buf_HashTable - buf_hashSize=%d\r\n", 
                      cookie, cm_data.buf_hashSize);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
***************
*** 1620,1636 ****
      {
          for (bp = cm_data.buf_hashTablepp[i]; bp; bp=bp->hashp) 
          {
!             if (bp->refCount)
!             {
!                 StringCbPrintfA(output, sizeof(output), "vnode=%d, unique=%d), size=%d refCount=%d\n", 
!                         cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume, 
!                         bp->fid.vnode, bp->fid.unique, bp->size, bp->refCount);
!                 WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!             }
          }
      }
    
!     StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_HashTable.\n", cookie);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      if (lock)
--- 1624,1674 ----
      {
          for (bp = cm_data.buf_hashTablepp[i]; bp; bp=bp->hashp) 
          {
! 	    StringCbPrintfA(output, sizeof(output), 
! 			    "%s bp=0x%08X, hash=%d, fid (cell=%d, volume=%d, "
! 			    "vnode=%d, unique=%d), offset=%x:%08x, dv=%d, "
! 			    "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
! 			     cookie, (void *)bp, i, bp->fid.cell, bp->fid.volume, 
! 			     bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
! 			     bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			     bp->cmFlags, bp->refCount);
! 	    WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
      }
    
!     StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_HashTable.\r\n", cookie);
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
! 
!     StringCbPrintfA(output, sizeof(output), "%s - dumping buf_freeListEndp\r\n", cookie);
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!     for(bp = cm_data.buf_freeListEndp; bp; bp=(cm_buf_t *) osi_QPrev(&bp->q)) {
! 	StringCbPrintfA(output, sizeof(output), 
! 			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
! 			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%d, "
! 			 "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
! 			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
! 			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
! 			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->refCount);
! 	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!     }
!     StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_FreeListEndp.\r\n", cookie);
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
! 
!     StringCbPrintfA(output, sizeof(output), "%s - dumping buf_dirtyListEndp\r\n", cookie);
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!     for(bp = cm_data.buf_dirtyListEndp; bp; bp=(cm_buf_t *) osi_QPrev(&bp->q)) {
! 	StringCbPrintfA(output, sizeof(output), 
! 			 "%s bp=0x%08X, fid (cell=%d, volume=%d, "
! 			 "vnode=%d, unique=%d), offset=%x:%08x, dv=%d, "
! 			 "flags=0x%x, cmFlags=0x%x, refCount=%d\r\n",
! 			 cookie, (void *)bp, bp->fid.cell, bp->fid.volume, 
! 			 bp->fid.vnode, bp->fid.unique, bp->offset.HighPart, 
! 			 bp->offset.LowPart, bp->dataVersion, bp->flags, 
! 			 bp->cmFlags, bp->refCount);
! 	WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!     }
!     StringCbPrintfA(output, sizeof(output), "%s - Done dumping buf_dirtyListEndp.\r\n", cookie);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      if (lock)
Index: openafs/src/WINNT/afsd/cm_buf.h
diff -c openafs/src/WINNT/afsd/cm_buf.h:1.12.4.3 openafs/src/WINNT/afsd/cm_buf.h:1.12.4.4
*** openafs/src/WINNT/afsd/cm_buf.h:1.12.4.3	Wed Nov 29 01:23:44 2006
--- openafs/src/WINNT/afsd/cm_buf.h	Sun Feb  4 22:41:41 2007
***************
*** 47,57 ****
  /* backup over pointer to the buffer */
  #define BUF_OVERTOBUF(op) ((cm_buf_t *)(((char *)op) - ((long)(&((cm_buf_t *)0)->over))))
  
- #ifdef notdef
- /* pretend we have logs, too */
- typedef char cm_log_t;
- #endif
- 
  #define CM_BUF_MAGIC    ('B' | 'U' <<8 | 'F'<<16 | 'F'<<24)
  
  /* represents a single buffer */
--- 47,52 ----
***************
*** 75,84 ****
      unsigned long refCount;	/* reference count (buf_globalLock) */
      long idCounter;		/* counter for softrefs; bumped at each recycle */
      long dirtyCounter;	        /* bumped at each dirty->clean transition */
- #ifdef notdef
-     cm_log_t *logp;	        /* log for this buffer, if any */
-     osi_hyper_t lsn;	        /* lsn to force to (last LSN changing this buffer) */
- #endif /* notdef */
      osi_hyper_t offset;	        /* offset */
      cm_fid_t fid;		/* file ID */
  #ifdef DEBUG
--- 70,75 ----
***************
*** 86,92 ****
                                  /* the fid at the time of fid assignment. */
  #endif
      long flags;		        /* flags we're using */
-     long size;		        /* size in bytes of this buffer */
      char *datap;		/* data in this buffer */
      unsigned long error;	/* last error code, if CM_BUF_ERROR is set */
      cm_user_t *userp;	        /* user who wrote to the buffer last */
--- 77,82 ----
***************
*** 159,168 ****
  
  extern cm_buf_t *buf_Find(struct cm_scache *, osi_hyper_t *);
  
- #ifndef DJGPP
- extern HANDLE buf_GetFileHandle(long);
- #endif /* !DJGPP */
- 
  extern long buf_GetNewLocked(struct cm_scache *, osi_hyper_t *, cm_buf_t **);
  
  extern long buf_Get(struct cm_scache *, osi_hyper_t *, cm_buf_t **);
--- 149,154 ----
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.10 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.11
*** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.10	Mon Dec 11 23:01:26 2006
--- openafs/src/WINNT/afsd/cm_callback.c	Wed Feb  7 12:35:16 2007
***************
*** 1651,1657 ****
              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);
--- 1651,1657 ----
              lock_ReleaseMutex(&cm_Freelance_Lock);
  
              // Fetch the status info 
!             cm_MergeStatus(NULL, scp, &afsStatus, &volSync, userp, 0);
  
              // Indicate that the callback is not done
              lock_ObtainMutex(&cm_Freelance_Lock);
***************
*** 1719,1725 ****
          lock_ObtainMutex(&scp->mx);
          if (code == 0) {
              cm_EndCallbackGrantingCall(scp, &cbr, &callback, 0);
!             cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0);
          } else {
              cm_EndCallbackGrantingCall(NULL, &cbr, NULL, 0);
          }
--- 1719,1725 ----
          lock_ObtainMutex(&scp->mx);
          if (code == 0) {
              cm_EndCallbackGrantingCall(scp, &cbr, &callback, 0);
!             cm_MergeStatus(NULL, scp, &afsStatus, &volSync, userp, 0);
          } else {
              cm_EndCallbackGrantingCall(NULL, &cbr, NULL, 0);
          }
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.10 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.11
*** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.10	Sun Dec 17 16:07:22 2006
--- openafs/src/WINNT/afsd/cm_conn.c	Sat Feb  3 21:46:25 2007
***************
*** 844,854 ****
      return 0;
  }
  
  long cm_Conn(struct cm_fid *fidp, struct cm_user *userp, cm_req_t *reqp,
               cm_conn_t **connpp)
  {
      long code;
- 
      cm_serverRef_t **serverspp;
  
      code = cm_GetServerList(fidp, userp, reqp, &serverspp);
--- 844,900 ----
      return 0;
  }
  
+ long cm_ServerAvailable(struct cm_fid *fidp, struct cm_user *userp)
+ {
+     long code;
+     cm_req_t req;
+     cm_serverRef_t **serverspp;
+     cm_serverRef_t *tsrp;
+     cm_server_t *tsp;
+     int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1;
+ 
+     cm_InitReq(&req);
+ 
+     code = cm_GetServerList(fidp, userp, &req, &serverspp);
+     if (code)
+         return 0;
+ 
+     lock_ObtainWrite(&cm_serverLock);
+     for (tsrp = *serverspp; tsrp; tsrp=tsrp->next) {
+         tsp = tsrp->server;
+         cm_GetServerNoLock(tsp);
+         if (!(tsp->flags & CM_SERVERFLAG_DOWN)) {
+ 	    allDown = 0;
+             if (tsrp->status == busy) {
+ 		allOffline = 0;
+                 someBusy = 1;
+             } else if (tsrp->status == offline) {
+ 		allBusy = 0;
+ 		someOffline = 1;
+             } else {
+ 		allOffline = 0;
+                 allBusy = 0;
+             }
+         }
+         cm_PutServerNoLock(tsp);
+     }   
+     lock_ReleaseWrite(&cm_serverLock);
+     cm_FreeServerList(serverspp);
+ 
+     if (allDown)
+ 	return 0;
+     else if (allBusy) 
+ 	return 0;
+     else if (allOffline || (someBusy && someOffline))
+ 	return 0;
+     else
+ 	return 1;
+ }
+ 
  long cm_Conn(struct cm_fid *fidp, struct cm_user *userp, cm_req_t *reqp,
               cm_conn_t **connpp)
  {
      long code;
      cm_serverRef_t **serverspp;
  
      code = cm_GetServerList(fidp, userp, reqp, &serverspp);
Index: openafs/src/WINNT/afsd/cm_conn.h
diff -c openafs/src/WINNT/afsd/cm_conn.h:1.13.4.5 openafs/src/WINNT/afsd/cm_conn.h:1.13.4.6
*** openafs/src/WINNT/afsd/cm_conn.h:1.13.4.5	Sun Dec 17 16:07:22 2006
--- openafs/src/WINNT/afsd/cm_conn.h	Sat Feb  3 21:46:25 2007
***************
*** 123,126 ****
--- 123,128 ----
  
  extern void cm_ForceNewConnections(cm_server_t *serverp);
  
+ extern long cm_ServerAvailable(struct cm_fid *fidp, struct cm_user *userp);
+ 
  #endif /*  __CM_CONN_H_ENV__ */
Index: openafs/src/WINNT/afsd/cm_daemon.c
diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.8 openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.10
*** openafs/src/WINNT/afsd/cm_daemon.c:1.16.4.8	Mon Dec 11 23:01:26 2006
--- openafs/src/WINNT/afsd/cm_daemon.c	Sun Feb  4 10:39:14 2007
***************
*** 71,76 ****
--- 71,77 ----
  void cm_BkgDaemon(long parm)
  {
      cm_bkgRequest_t *rp;
+     afs_int32 code;
  
      rx_StartClientThread();
  
***************
*** 83,106 ****
          }
                  
          /* we found a request */
!         rp = cm_bkgListEndp;
!         cm_bkgListEndp = (cm_bkgRequest_t *) osi_QPrev(&rp->q);
!         osi_QRemove((osi_queue_t **) &cm_bkgListp, &rp->q);
          osi_assert(cm_bkgQueueCount-- > 0);
          lock_ReleaseWrite(&cm_daemonLock);
  
  #ifdef DEBUG_REFCOUNT
  	osi_Log2(afsd_logp,"cm_BkgDaemon (before) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
  #endif
!         (*rp->procp)(rp->scp, rp->p1, rp->p2, rp->p3, rp->p4, rp->userp);
  #ifdef DEBUG_REFCOUNT                
  	osi_Log2(afsd_logp,"cm_BkgDaemon (after) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
  #endif
! 	cm_ReleaseUser(rp->userp);
!         cm_ReleaseSCache(rp->scp);
!         free(rp);
  
          lock_ObtainWrite(&cm_daemonLock);
      }
      lock_ReleaseWrite(&cm_daemonLock);
  }
--- 84,143 ----
          }
                  
          /* we found a request */
!         for (rp = cm_bkgListEndp; rp; rp = (cm_bkgRequest_t *) osi_QPrev(&rp->q))
! 	{
! 	    if (cm_ServerAvailable(&rp->scp->fid, rp->userp))
! 		break;
! 	}
! 	if (rp == NULL) {
! 	    /* we couldn't find a request that we could process at the current time */
! 	    lock_ReleaseWrite(&cm_daemonLock);
! 	    Sleep(1000);
! 	    lock_ObtainWrite(&cm_daemonLock);
! 	    continue;
! 	}
! 
!         osi_QRemoveHT((osi_queue_t **) &cm_bkgListp, (osi_queue_t **) &cm_bkgListEndp, &rp->q);
          osi_assert(cm_bkgQueueCount-- > 0);
          lock_ReleaseWrite(&cm_daemonLock);
  
+ 	osi_Log1(afsd_logp,"cm_BkgDaemon processing request 0x%p", rp);
+ 
  #ifdef DEBUG_REFCOUNT
  	osi_Log2(afsd_logp,"cm_BkgDaemon (before) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
  #endif
!         code = (*rp->procp)(rp->scp, rp->p1, rp->p2, rp->p3, rp->p4, rp->userp);
  #ifdef DEBUG_REFCOUNT                
  	osi_Log2(afsd_logp,"cm_BkgDaemon (after) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
  #endif
! 	if (code == 0) {
! 	    cm_ReleaseUser(rp->userp);
! 	    cm_ReleaseSCache(rp->scp);
! 	    free(rp);
! 	}
  
          lock_ObtainWrite(&cm_daemonLock);
+ 
+ 	switch ( code ) {
+ 	case 0: /* success */
+ 	    osi_Log1(afsd_logp,"cm_BkgDaemon SUCCESS: request 0x%p", rp);
+ 	    break;
+ 	case CM_ERROR_TIMEDOUT:	/* or server restarting */
+ 	case CM_ERROR_RETRY:
+ 	case CM_ERROR_WOULDBLOCK:
+ 	case CM_ERROR_ALLBUSY:
+ 	case CM_ERROR_ALLDOWN:
+ 	case CM_ERROR_ALLOFFLINE:
+ 	case CM_ERROR_PARTIALWRITE:
+ 	    osi_Log2(afsd_logp,"cm_BkgDaemon re-queueing failed request 0x%p code 0x%x",
+ 		     rp, code);
+ 	    cm_bkgQueueCount++;
+ 	    osi_QAddT((osi_queue_t **) &cm_bkgListp, (osi_queue_t **)&cm_bkgListEndp, &rp->q);
+ 	    break;
+ 	default:
+ 	    osi_Log2(afsd_logp,"cm_BkgDaemon FAILED: request dropped 0x%p code 0x%x",
+ 		     rp, code);
+ 	}
      }
      lock_ReleaseWrite(&cm_daemonLock);
  }
***************
*** 343,349 ****
  
          if (now > lastVolCheck + cm_daemonCheckVolInterval) {
              lastVolCheck = now;
!             cm_CheckVolumes();
  	    now = osi_Time();
          }
  
--- 380,386 ----
  
          if (now > lastVolCheck + cm_daemonCheckVolInterval) {
              lastVolCheck = now;
!             cm_RefreshVolumes();
  	    now = osi_Time();
          }
  
Index: openafs/src/WINNT/afsd/cm_daemon.h
diff -c openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.1 openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.2
*** openafs/src/WINNT/afsd/cm_daemon.h:1.4.4.1	Mon Oct  2 23:23:21 2006
--- openafs/src/WINNT/afsd/cm_daemon.h	Sat Feb  3 21:46:25 2007
***************
*** 24,30 ****
  
  void cm_InitDaemon(int nDaemons);
  
! typedef void (cm_bkgProc_t)(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3,
  	afs_uint32 p4, struct cm_user *up);
  
  typedef struct cm_bkgRequest {
--- 24,30 ----
  
  void cm_InitDaemon(int nDaemons);
  
! typedef afs_int32 (cm_bkgProc_t)(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3,
  	afs_uint32 p4, struct cm_user *up);
  
  typedef struct cm_bkgRequest {
Index: openafs/src/WINNT/afsd/cm_dcache.c
diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.8 openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.14
*** openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.8	Fri Oct  6 12:32:43 2006
--- openafs/src/WINNT/afsd/cm_dcache.c	Wed Feb  7 12:35:16 2007
***************
*** 101,107 ****
      if (biod.length == 0) {
          osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
          lock_ReleaseMutex(&scp->mx);
!         cm_ReleaseBIOD(&biod, 1);	/* should be a NOOP */
          return 0;
      }
  
--- 101,107 ----
      if (biod.length == 0) {
          osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
          lock_ReleaseMutex(&scp->mx);
!         cm_ReleaseBIOD(&biod, 1, 0);	/* should be a NOOP */
          return 0;
      }
  
***************
*** 160,191 ****
  
  #ifdef AFS_LARGEFILES
          if (SERVERHAS64BIT(connp)) {
!             osi_Log4(afsd_logp, "CALL StoreData64 scp 0x%p, offset 0x%x:%08x, length 0x%x",
                       scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
              code = StartRXAFS_StoreData64(callp, &tfid, &inStatus,
                                            biod.offset.QuadPart,
                                            nbytes,
                                            truncPos.QuadPart);
          } else {
- 
              if (require_64bit_ops) {
!                 osi_Log0(afsd_logp, "Skipping StoreData.  The operation requires StoreData64");
                  code = CM_ERROR_TOOBIG;
              } else {
!                 osi_Log4(afsd_logp, "CALL StoreData scp 0x%p, offset 0x%x:%08x, length 0x%x",
                           scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
                  code = StartRXAFS_StoreData(callp, &tfid, &inStatus,
                                              biod.offset.LowPart, nbytes, truncPos.LowPart);
              }
          }
  #else
!         osi_Log4(afsd_logp, "CALL StoreData scp 0x%p, offset 0x%x:%08x, length 0x%x",
                   scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
          code = StartRXAFS_StoreData(callp, &tfid, &inStatus,
                                      biod.offset.LowPart, nbytes, truncPos.LowPart);
  #endif
  
          if (code == 0) {
--- 160,202 ----
  
  #ifdef AFS_LARGEFILES
          if (SERVERHAS64BIT(connp)) {
!             osi_Log4(afsd_logp, "CALL StartRXAFS_StoreData64 scp 0x%p, offset 0x%x:%08x, length 0x%x",
                       scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
              code = StartRXAFS_StoreData64(callp, &tfid, &inStatus,
                                            biod.offset.QuadPart,
                                            nbytes,
                                            truncPos.QuadPart);
+ 	    if (code)
+ 		osi_Log1(afsd_logp, "CALL StartRXAFS_StoreData64 FAILURE, code 0x%x", code);
+ 	    else
+ 		osi_Log0(afsd_logp, "CALL StartRXAFS_StoreData64 SUCCESS");
          } else {
              if (require_64bit_ops) {
!                 osi_Log0(afsd_logp, "Skipping StartRXAFS_StoreData.  The operation requires large file support in the server.");
                  code = CM_ERROR_TOOBIG;
              } else {
!                 osi_Log4(afsd_logp, "CALL StartRXAFS_StoreData scp 0x%p, offset 0x%x:%08x, length 0x%x",
                           scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
                  code = StartRXAFS_StoreData(callp, &tfid, &inStatus,
                                              biod.offset.LowPart, nbytes, truncPos.LowPart);
+ 		if (code)
+ 		    osi_Log1(afsd_logp, "CALL StartRXAFS_StoreData FAILURE, code 0x%x", code);
+ 		else
+ 		    osi_Log0(afsd_logp, "CALL StartRXAFS_StoreData SUCCESS");
              }
          }
  #else
!         osi_Log4(afsd_logp, "CALL StartRXAFS_StoreData scp 0x%p, offset 0x%x:%08x, length 0x%x",
                   scp, biod.offset.HighPart, biod.offset.LowPart, nbytes);
  
          code = StartRXAFS_StoreData(callp, &tfid, &inStatus,
                                      biod.offset.LowPart, nbytes, truncPos.LowPart);
+ 	if (code)
+ 	    osi_Log1(afsd_logp, "CALL StartRXAFS_StoreData FAILURE, code 0x%x", code);
+ 	else
+ 	    osi_Log0(afsd_logp, "CALL StartRXAFS_StoreData SUCCESS");
  #endif
  
          if (code == 0) {
***************
*** 214,233 ****
                  }       
                  nbytes -= wbytes;
              }	/* while more bytes to write */
!         }		/* if RPC started successfully */
!         else {
!             osi_Log2(afsd_logp, "StartRXAFS_StoreData?? scp 0x%p failed (%lX)",scp,code);
!         }
  
          if (code == 0) {
              if (SERVERHAS64BIT(connp)) {
                  code = EndRXAFS_StoreData64(callp, &outStatus, &volSync);
                  if (code)
!                     osi_Log2(afsd_logp, "EndRXAFS_StoreData64 scp 0x%p failed (%lX)", scp, code);
              } else {
                  code = EndRXAFS_StoreData(callp, &outStatus, &volSync);
                  if (code)
!                     osi_Log2(afsd_logp, "EndRXAFS_StoreData scp 0x%p failed (%lX)",scp,code);
              }
          }
  
--- 225,245 ----
                  }       
                  nbytes -= wbytes;
              }	/* while more bytes to write */
!         }	/* if RPC started successfully */
  
          if (code == 0) {
              if (SERVERHAS64BIT(connp)) {
                  code = EndRXAFS_StoreData64(callp, &outStatus, &volSync);
                  if (code)
!                     osi_Log2(afsd_logp, "EndRXAFS_StoreData64 FAILURE scp 0x%p code %lX", scp, code);
! 		else
! 		    osi_Log0(afsd_logp, "EndRXAFS_StoreData64 SUCCESS");
              } else {
                  code = EndRXAFS_StoreData(callp, &outStatus, &volSync);
                  if (code)
!                     osi_Log2(afsd_logp, "EndRXAFS_StoreData FAILURE scp 0x%p code %lX",scp,code);
! 		else
! 		    osi_Log0(afsd_logp, "EndRXAFS_StoreData SUCCESS");
              }
          }
  
***************
*** 285,291 ****
          if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
              scp->mask &= ~CM_SCACHEMASK_LENGTH;
  
!         cm_MergeStatus(scp, &outStatus, &volSync, userp, 0);
      } else {
          if (code == CM_ERROR_SPACE)
              scp->flags |= CM_SCACHEFLAG_OUTOFSPACE;
--- 297,303 ----
          if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
              scp->mask &= ~CM_SCACHEMASK_LENGTH;
  
!         cm_MergeStatus(NULL, scp, &outStatus, &volSync, userp, CM_MERGEFLAG_STOREDATA);
      } else {
          if (code == CM_ERROR_SPACE)
              scp->flags |= CM_SCACHEFLAG_OUTOFSPACE;
***************
*** 293,299 ****
              scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
      }
      lock_ReleaseMutex(&scp->mx);
!     cm_ReleaseBIOD(&biod, 1);
  
      return code;
  }
--- 305,311 ----
              scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
      }
      lock_ReleaseMutex(&scp->mx);
!     cm_ReleaseBIOD(&biod, 1, code);
  
      return code;
  }
***************
*** 408,414 ****
  
          if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
              scp->mask &= ~CM_SCACHEMASK_LENGTH;
!         cm_MergeStatus(scp, &outStatus, &volSync, userp, 0);
      }
  
      return code;
--- 420,426 ----
  
          if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
              scp->mask &= ~CM_SCACHEMASK_LENGTH;
!         cm_MergeStatus(NULL, scp, &outStatus, &volSync, userp, CM_MERGEFLAG_STOREDATA);
      }
  
      return code;
***************
*** 591,611 ****
      return code;
  }
  
! void cm_BkgStore(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
!                  cm_user_t *userp)
  {
      osi_hyper_t toffset;
      long length;
      cm_req_t req;
!     long code;
  
      if (scp->flags & CM_SCACHEFLAG_DELETED) {
  	osi_Log4(afsd_logp, "Skipping BKG store - Deleted scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
      } else {
  	cm_InitReq(&req);
! #ifdef NO_BKG_RETRIES
  	req.flags |= CM_REQ_NORETRY;
- #endif
  
  	toffset.LowPart = p1;
  	toffset.HighPart = p2;
--- 603,624 ----
      return code;
  }
  
! afs_int32
! cm_BkgStore(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
! 	    cm_user_t *userp)
  {
      osi_hyper_t toffset;
      long length;
      cm_req_t req;
!     long code = 0;
  
      if (scp->flags & CM_SCACHEFLAG_DELETED) {
  	osi_Log4(afsd_logp, "Skipping BKG store - Deleted scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
      } else {
  	cm_InitReq(&req);
! 
! 	/* Retries will be performed by the BkgDaemon thread if appropriate */
  	req.flags |= CM_REQ_NORETRY;
  
  	toffset.LowPart = p1;
  	toffset.HighPart = p2;
***************
*** 614,624 ****
--- 627,641 ----
  	osi_Log4(afsd_logp, "Starting BKG store scp 0x%p, offset 0x%x:%08x, length 0x%x", scp, p2, p1, p3);
  
  	code = cm_BufWrite(scp, &toffset, length, /* flags */ 0, userp, &req);
+ 
+ 	osi_Log4(afsd_logp, "Finished BKG store scp 0x%p, offset 0x%x:%08x, code 0x%x", scp, p2, p1, code);
      }
  
      lock_ObtainMutex(&scp->mx);
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_ASYNCSTORE);
      lock_ReleaseMutex(&scp->mx);
+ 
+     return code;
  }
  
  /* Called with scp locked */
***************
*** 639,656 ****
      scp->flags &= ~CM_SCACHEFLAG_PREFETCHING;
  }
  
! /* do the prefetch */
! void cm_BkgPrefetch(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
!                     cm_user_t *userp)
  {
      long length;
      osi_hyper_t base;
      long code;
!     cm_buf_t *bp;
      int cpff = 0;			/* cleared prefetch flag */
      cm_req_t req;
  
      cm_InitReq(&req);
      req.flags |= CM_REQ_NORETRY;
          
      base.LowPart = p1;
--- 656,677 ----
      scp->flags &= ~CM_SCACHEFLAG_PREFETCHING;
  }
  
! /* do the prefetch.  if the prefetch fails, return 0 (success)
!  * because there is no harm done.  */
! afs_int32
! cm_BkgPrefetch(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
! 	       cm_user_t *userp)
  {
      long length;
      osi_hyper_t base;
      long code;
!     cm_buf_t *bp = NULL;
      int cpff = 0;			/* cleared prefetch flag */
      cm_req_t req;
  
      cm_InitReq(&req);
+ 
+     /* Retries will be performed by the BkgDaemon thread if appropriate */
      req.flags |= CM_REQ_NORETRY;
          
      base.LowPart = p1;
***************
*** 666,672 ****
      if (code || (bp->cmFlags & CM_BUF_CMFETCHING)) {
          scp->flags &= ~CM_SCACHEFLAG_PREFETCHING;
          lock_ReleaseMutex(&scp->mx);
!         return;
      }
  
      code = cm_GetBuffer(scp, bp, &cpff, userp, &req);
--- 687,695 ----
      if (code || (bp->cmFlags & CM_BUF_CMFETCHING)) {
          scp->flags &= ~CM_SCACHEFLAG_PREFETCHING;
          lock_ReleaseMutex(&scp->mx);
! 	if (bp)
! 	    buf_Release(bp);
!         return 0;
      }
  
      code = cm_GetBuffer(scp, bp, &cpff, userp, &req);
***************
*** 674,680 ****
          cm_ClearPrefetchFlag(code, scp, &base);
      lock_ReleaseMutex(&scp->mx);
      buf_Release(bp);
!     return;
  }
  
  /* a read was issued to offsetp, and we have to determine whether we should
--- 697,703 ----
          cm_ClearPrefetchFlag(code, scp, &base);
      lock_ReleaseMutex(&scp->mx);
      buf_Release(bp);
!     return code;
  }
  
  /* a read was issued to offsetp, and we have to determine whether we should
***************
*** 1188,1194 ****
  /* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
   * cm_SetupStoreBIOD
   */
! void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore)
  {
      cm_scache_t *scp;		/* do not release; not held in biop */
      cm_buf_t *bufp;
--- 1211,1217 ----
  /* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
   * cm_SetupStoreBIOD
   */
! void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed)
  {
      cm_scache_t *scp;		/* do not release; not held in biop */
      cm_buf_t *bufp;
***************
*** 1229,1235 ****
  		    osi_Log2(afsd_logp, "cm_ReleaseBIOD Waking [scp 0x%p] bp 0x%p", scp, bufp);
  		    osi_Wakeup((LONG_PTR) bufp);
  		}
! 		bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY);
  	    }
  
  	    lock_ReleaseMutex(&scp->mx);
--- 1252,1261 ----
  		    osi_Log2(afsd_logp, "cm_ReleaseBIOD Waking [scp 0x%p] bp 0x%p", scp, bufp);
  		    osi_Wakeup((LONG_PTR) bufp);
  		}
! 		if (failed)
! 		    bufp->flags &= ~CM_BUF_WRITING;
! 		else
! 		    bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY);
  	    }
  
  	    lock_ReleaseMutex(&scp->mx);
***************
*** 1319,1325 ****
              bufp->dataVersion = scp->dataVersion;
          }
          lock_ReleaseMutex(&scp->mx);
!         cm_ReleaseBIOD(&biod, 0);
          lock_ObtainMutex(&scp->mx);
          return 0;
      }
--- 1345,1351 ----
              bufp->dataVersion = scp->dataVersion;
          }
          lock_ReleaseMutex(&scp->mx);
!         cm_ReleaseBIOD(&biod, 0, 0);
          lock_ObtainMutex(&scp->mx);
          return 0;
      }
***************
*** 1626,1636 ****
  
      /* release scatter/gather I/O structure (buffers, locks) */
      lock_ReleaseMutex(&scp->mx);
!     cm_ReleaseBIOD(&biod, 0);
      lock_ObtainMutex(&scp->mx);
  
      if (code == 0) 
!         cm_MergeStatus(scp, &afsStatus, &volSync, up, 0);
      
      return code;
  }
--- 1652,1662 ----
  
      /* release scatter/gather I/O structure (buffers, locks) */
      lock_ReleaseMutex(&scp->mx);
!     cm_ReleaseBIOD(&biod, 0, code);
      lock_ObtainMutex(&scp->mx);
  
      if (code == 0) 
!         cm_MergeStatus(NULL, scp, &afsStatus, &volSync, up, 0);
      
      return code;
  }
Index: openafs/src/WINNT/afsd/cm_dcache.h
diff -c openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.1 openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.3
*** openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.1	Mon Oct  2 23:23:21 2006
--- openafs/src/WINNT/afsd/cm_dcache.h	Sun Feb  4 10:39:14 2007
***************
*** 37,51 ****
  extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
  	cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
  
! extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore);
  
  extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
  	long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);
  
! extern void cm_BkgPrefetch(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
  	struct cm_user *userp);
  
! extern void cm_BkgStore(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
  	struct cm_user *userp);
  
  extern void cm_ConsiderPrefetch(cm_scache_t *scp, osi_hyper_t *offsetp,
--- 37,51 ----
  extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
  	cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
  
! extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed);
  
  extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
  	long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);
  
! extern afs_int32 cm_BkgPrefetch(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
  	struct cm_user *userp);
  
! extern afs_int32 cm_BkgStore(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
  	struct cm_user *userp);
  
  extern void cm_ConsiderPrefetch(cm_scache_t *scp, osi_hyper_t *offsetp,
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.8 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.10
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.8	Mon Oct 16 20:21:36 2006
--- openafs/src/WINNT/afsd/cm_ioctl.c	Sat Feb  3 21:46:25 2007
***************
*** 746,751 ****
--- 746,752 ----
          cm_ReleaseSCache(scp);
          return code;
      }
+     cm_PutVolume(tvp);
  
      /* Copy the junk out, using cp as a roving pointer. */
      cp = ioctlp->inDatap;
***************
*** 1154,1160 ****
  
  long cm_IoctlCheckVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
!     cm_CheckVolumes();
      return 0;
  }       
  
--- 1155,1161 ----
  
  long cm_IoctlCheckVolumes(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
!     cm_RefreshVolumes();
      return 0;
  }       
  
***************
*** 2753,2763 ****
--- 2754,2766 ----
    
      /* dump all interesting data */
      cm_DumpSCache(hLogFile, cookie, 1);
+     cm_DumpVolumes(hLogFile, cookie, 1);
      cm_DumpBufHashTable(hLogFile, cookie, 1);
      smb_DumpVCP(hLogFile, cookie, 1);
  
      CloseHandle(hLogFile);                          
    
+     inValue = 0;	/* success */
      memcpy(ioctlp->outDatap, &inValue, sizeof(long));
      ioctlp->outDatap += sizeof(long);
    
Index: openafs/src/WINNT/afsd/cm_memmap.c
diff -c openafs/src/WINNT/afsd/cm_memmap.c:1.7.2.2 openafs/src/WINNT/afsd/cm_memmap.c:1.7.2.4
*** openafs/src/WINNT/afsd/cm_memmap.c:1.7.2.2	Wed Nov 29 01:23:44 2006
--- openafs/src/WINNT/afsd/cm_memmap.c	Sun Feb  4 22:41:41 2007
***************
*** 87,96 ****
  }
  
  afs_uint64 
! ComputeSizeOfDataHT(void)
  {
      afs_uint64 size;
!     size = osi_PrimeLessThan(CM_BUF_HASHSIZE) * sizeof(cm_buf_t *);
      return size;
  }
  
--- 87,96 ----
  }
  
  afs_uint64 
! ComputeSizeOfDataHT(afs_uint64 cacheBlocks)
  {
      afs_uint64 size;
!     size = osi_PrimeLessThan((afs_uint32)(cacheBlocks/7 + 1)) * sizeof(cm_buf_t *);
      return size;
  }
  
***************
*** 115,121 ****
                 +  ComputeSizeOfSCacheHT(stats)
                 +  ComputeSizeOfDNLCache()
                 +  ComputeSizeOfDataBuffers(cacheBlocks, blockSize) 
!                +  2 * ComputeSizeOfDataHT() 
                 +  ComputeSizeOfDataHeaders(cacheBlocks);
      return size;    
  }
--- 115,121 ----
                 +  ComputeSizeOfSCacheHT(stats)
                 +  ComputeSizeOfDNLCache()
                 +  ComputeSizeOfDataBuffers(cacheBlocks, blockSize) 
!                +  2 * ComputeSizeOfDataHT(cacheBlocks) 
                 +  ComputeSizeOfDataHeaders(cacheBlocks);
      return size;    
  }
***************
*** 214,219 ****
--- 214,234 ----
      cm_config_data_t * config_data_p = (cm_config_data_t *)cm_data.baseAddress;
      int dirty = 0;
  
+     afsi_log("Closing AFS Cache:");
+     afsi_log("  Base Address   = %p", config_data_p);
+     afsi_log("  stats          = %d", cm_data.stats);
+     afsi_log("  chunkSize      = %d", cm_data.chunkSize);
+     afsi_log("  blockSize      = %d", cm_data.blockSize);
+     afsi_log("  bufferSize     = %d", cm_data.bufferSize);
+     afsi_log("  cacheType      = %d", cm_data.cacheType);
+     afsi_log("  currentVolumes = %d", cm_data.currentVolumes);
+     afsi_log("  maxVolumes     = %d", cm_data.maxVolumes);
+     afsi_log("  currentCells   = %d", cm_data.currentCells);
+     afsi_log("  maxCells       = %d", cm_data.maxCells);
+     afsi_log("  hashTableSize  = %d", cm_data.hashTableSize);
+     afsi_log("  currentSCaches = %d", cm_data.currentSCaches);
+     afsi_log("  maxSCaches     = %d", cm_data.maxSCaches);
+ 
      cm_ShutdownDCache();
      cm_ShutdownSCache();
      cm_ShutdownACLCache();
***************
*** 393,399 ****
      fprintf(stderr,"  maxVolumes     = %d\n", config_data_p->maxVolumes);
      fprintf(stderr,"  currentCells   = %d\n", config_data_p->currentCells);
      fprintf(stderr,"  maxCells       = %d\n", config_data_p->maxCells);
!     fprintf(stderr,"  hashTableSize  = %d\n", config_data_p->hashTableSize );
      fprintf(stderr,"  currentSCaches = %d\n", config_data_p->currentSCaches);
      fprintf(stderr,"  maxSCaches     = %d\n", config_data_p->maxSCaches);
      cm_data = *config_data_p;      
--- 408,414 ----
      fprintf(stderr,"  maxVolumes     = %d\n", config_data_p->maxVolumes);
      fprintf(stderr,"  currentCells   = %d\n", config_data_p->currentCells);
      fprintf(stderr,"  maxCells       = %d\n", config_data_p->maxCells);
!     fprintf(stderr,"  hashTableSize  = %d\n", config_data_p->hashTableSize);
      fprintf(stderr,"  currentSCaches = %d\n", config_data_p->currentSCaches);
      fprintf(stderr,"  maxSCaches     = %d\n", config_data_p->maxSCaches);
      cm_data = *config_data_p;      
***************
*** 778,786 ****
      config_data_p = (cm_config_data_t *) baseAddress;
  
      if (!newFile) {
!         afsi_log("Reusing existing AFS Cache data: Base Address = %lX",baseAddress);
          cm_data = *config_data_p;      
  
          // perform validation of persisted data structures
          // if there is a failure, start from scratch
          if (cm_ValidateCache && !cm_IsCacheValid()) {
--- 793,815 ----
      config_data_p = (cm_config_data_t *) baseAddress;
  
      if (!newFile) {
!         afsi_log("Reusing existing AFS Cache data:");
          cm_data = *config_data_p;      
  
+ 	afsi_log("  Base Address   = %p",baseAddress);
+ 	afsi_log("  stats          = %d", config_data_p->stats);
+ 	afsi_log("  chunkSize      = %d", config_data_p->chunkSize);
+ 	afsi_log("  blockSize      = %d", config_data_p->blockSize);
+ 	afsi_log("  bufferSize     = %d", config_data_p->bufferSize);
+ 	afsi_log("  cacheType      = %d", config_data_p->cacheType);
+ 	afsi_log("  currentVolumes = %d", config_data_p->currentVolumes);
+ 	afsi_log("  maxVolumes     = %d", config_data_p->maxVolumes);
+ 	afsi_log("  currentCells   = %d", config_data_p->currentCells);
+ 	afsi_log("  maxCells       = %d", config_data_p->maxCells);
+ 	afsi_log("  hashTableSize  = %d", config_data_p->hashTableSize);
+ 	afsi_log("  currentSCaches = %d", config_data_p->currentSCaches);
+ 	afsi_log("  maxSCaches     = %d", config_data_p->maxSCaches);
+ 
          // perform validation of persisted data structures
          // if there is a failure, start from scratch
          if (cm_ValidateCache && !cm_IsCacheValid()) {
***************
*** 808,814 ****
          cm_data.buf_nbuffers = cacheBlocks;
          cm_data.buf_nOrigBuffers = 0;
          cm_data.buf_blockSize = CM_BUF_BLOCKSIZE;
!         cm_data.buf_hashSize = CM_BUF_HASHSIZE;
  
          cm_data.mountRootGen = time(NULL);
  
--- 837,843 ----
          cm_data.buf_nbuffers = cacheBlocks;
          cm_data.buf_nOrigBuffers = 0;
          cm_data.buf_blockSize = CM_BUF_BLOCKSIZE;
!         cm_data.buf_hashSize = osi_PrimeLessThan((afs_uint32)(cacheBlocks/7 + 1));
  
          cm_data.mountRootGen = time(NULL);
  
***************
*** 826,834 ****
          cm_data.dnlcBaseAddress = (cm_nc_t *) baseAddress;
          baseAddress += ComputeSizeOfDNLCache();
          cm_data.buf_hashTablepp = (cm_buf_t **) baseAddress;
!         baseAddress += ComputeSizeOfDataHT();
          cm_data.buf_fileHashTablepp = (cm_buf_t **) baseAddress;
!         baseAddress += ComputeSizeOfDataHT();
          cm_data.bufHeaderBaseAddress = (cm_buf_t *) baseAddress;
          baseAddress += ComputeSizeOfDataHeaders(cacheBlocks);
          cm_data.bufDataBaseAddress = (char *) baseAddress;
--- 855,863 ----
          cm_data.dnlcBaseAddress = (cm_nc_t *) baseAddress;
          baseAddress += ComputeSizeOfDNLCache();
          cm_data.buf_hashTablepp = (cm_buf_t **) baseAddress;
!         baseAddress += ComputeSizeOfDataHT(cacheBlocks);
          cm_data.buf_fileHashTablepp = (cm_buf_t **) baseAddress;
!         baseAddress += ComputeSizeOfDataHT(cacheBlocks);
          cm_data.bufHeaderBaseAddress = (cm_buf_t *) baseAddress;
          baseAddress += ComputeSizeOfDataHeaders(cacheBlocks);
          cm_data.bufDataBaseAddress = (char *) baseAddress;
Index: openafs/src/WINNT/afsd/cm_memmap.h
diff -c openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.1 openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.2
*** openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.1	Wed Nov 29 01:23:44 2006
--- openafs/src/WINNT/afsd/cm_memmap.h	Sun Feb  4 22:41:41 2007
***************
*** 95,101 ****
  afs_uint64 ComputeSizeOfSCacheHT(DWORD stats);
  afs_uint64 ComputeSizeOfDNLCache(void);
  afs_uint64 ComputeSizeOfDataBuffers(afs_uint64 cacheBlocks, DWORD blockSize);
! afs_uint64 ComputeSizeOfDataHT(void);
  afs_uint64 ComputeSizeOfDataHeaders(afs_uint64 cacheBlocks);
  afs_uint64 ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, DWORD blockSize);
  PSECURITY_ATTRIBUTES CreateCacheFileSA();
--- 95,101 ----
  afs_uint64 ComputeSizeOfSCacheHT(DWORD stats);
  afs_uint64 ComputeSizeOfDNLCache(void);
  afs_uint64 ComputeSizeOfDataBuffers(afs_uint64 cacheBlocks, DWORD blockSize);
! afs_uint64 ComputeSizeOfDataHT(afs_uint64 cacheBlocks);
  afs_uint64 ComputeSizeOfDataHeaders(afs_uint64 cacheBlocks);
  afs_uint64 ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, afs_uint64 cacheBlocks, DWORD blockSize);
  PSECURITY_ATTRIBUTES CreateCacheFileSA();
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.35.2.22 openafs/src/WINNT/afsd/cm_scache.c:1.35.2.32
*** openafs/src/WINNT/afsd/cm_scache.c:1.35.2.22	Mon Oct 16 20:32:57 2006
--- openafs/src/WINNT/afsd/cm_scache.c	Thu Feb  8 08:51:40 2007
***************
*** 149,154 ****
--- 149,155 ----
  
      /* invalidate so next merge works fine;
       * also initialize some flags */
+     scp->fileType = 0;
      scp->flags &= ~(CM_SCACHEFLAG_STATD
  		     | CM_SCACHEFLAG_DELETED
  		     | CM_SCACHEFLAG_RO
***************
*** 545,553 ****
      long hash;
      cm_scache_t *scp;
      long code;
!     cm_volume_t *volp = 0;
      cm_cell_t *cellp;
!     char* mp = 0;
      int special; // yj: boolean variable to test if file is on root.afs
      int isRoot;
      extern cm_fid_t cm_rootFid;
--- 546,554 ----
      long hash;
      cm_scache_t *scp;
      long code;
!     cm_volume_t *volp = NULL;
      cm_cell_t *cellp;
!     char* mp = NULL;
      int special; // yj: boolean variable to test if file is on root.afs
      int isRoot;
      extern cm_fid_t cm_rootFid;
***************
*** 579,585 ****
              return 0;
          }
      }
!         
      // yj: when we get here, it means we don't have an scp
      // so we need to either load it or fake it, depending
      // on whether the file is "special", see below.
--- 580,586 ----
              return 0;
          }
      }
! 
      // yj: when we get here, it means we don't have an scp
      // so we need to either load it or fake it, depending
      // on whether the file is "special", see below.
***************
*** 631,636 ****
--- 632,638 ----
  #endif
          scp->fid = *fidp;
          scp->volp = cm_data.rootSCachep->volp;
+ 	cm_GetVolume(scp->volp);	/* grab an additional reference */
          scp->dotdotFid.cell=AFS_FAKE_ROOT_CELL_ID;
          scp->dotdotFid.volume=AFS_FAKE_ROOT_VOL_ID;
          scp->dotdotFid.unique=1;
***************
*** 654,660 ****
          lock_ReleaseMutex(&cm_Freelance_Lock);
  
          scp->owner=0x0;
!         scp->unixModeBits=0x1ff;
          scp->clientModTime=FakeFreelanceModTime;
          scp->serverModTime=FakeFreelanceModTime;
          scp->parentUnique = 0x1;
--- 656,662 ----
          lock_ReleaseMutex(&cm_Freelance_Lock);
  
          scp->owner=0x0;
!         scp->unixModeBits=0777;
          scp->clientModTime=FakeFreelanceModTime;
          scp->serverModTime=FakeFreelanceModTime;
          scp->parentUnique = 0x1;
***************
*** 714,719 ****
--- 716,723 ----
      if (scp == NULL) {
  	osi_Log0(afsd_logp,"cm_GetNewSCache unable to obtain *new* scache entry");
  	lock_ReleaseWrite(&cm_scacheLock);
+ 	if (volp)
+ 	    cm_PutVolume(volp);
  	return CM_ERROR_WOULDBLOCK;
      }
      osi_Log2(afsd_logp,"cm_GetNewSCache returns scp 0x%x flags 0x%x", scp, scp->flags);
***************
*** 1209,1215 ****
  
      /* now update the buffer pointer */
      if (flags & CM_SCACHESYNC_FETCHDATA) {
!         /* ensure that the buffer isn't already in the I/O list */
          for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) {
              tbufp = osi_GetQData(qdp);
              if (tbufp == bufp) 
--- 1213,1221 ----
  
      /* now update the buffer pointer */
      if (flags & CM_SCACHESYNC_FETCHDATA) {
! 	int release = 0;
! 
! 	/* ensure that the buffer isn't already in the I/O list */
          for(qdp = scp->bufReadsp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) {
              tbufp = osi_GetQData(qdp);
              if (tbufp == bufp) 
***************
*** 1218,1228 ****
  	if (qdp) {
  	    osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q);
  	    osi_QDFree(qdp);
  	}
          if (bufp) {
- 	    int release = 0;
- 	    if (bufp->cmFlags & CM_BUF_CMFETCHING)
- 		release = 1;
              bufp->cmFlags &= ~(CM_BUF_CMFETCHING | CM_BUF_CMFULLYFETCHED);
              if (bufp->flags & CM_BUF_WAITING) {
                  osi_Log2(afsd_logp, "CM SyncOpDone Waking [scp 0x%p] bufp 0x%p", scp, bufp);
--- 1224,1232 ----
  	if (qdp) {
  	    osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q);
  	    osi_QDFree(qdp);
+ 	    release = 1;
  	}
          if (bufp) {
              bufp->cmFlags &= ~(CM_BUF_CMFETCHING | CM_BUF_CMFULLYFETCHED);
              if (bufp->flags & CM_BUF_WAITING) {
                  osi_Log2(afsd_logp, "CM SyncOpDone Waking [scp 0x%p] bufp 0x%p", scp, bufp);
***************
*** 1235,1240 ****
--- 1239,1245 ----
  
      /* now update the buffer pointer */
      if (flags & CM_SCACHESYNC_STOREDATA) {
+ 	int release = 0;
          /* ensure that the buffer isn't already in the I/O list */
          for(qdp = scp->bufWritesp; qdp; qdp = (osi_queueData_t *) osi_QNext(&qdp->q)) {
              tbufp = osi_GetQData(qdp);
***************
*** 1244,1254 ****
  	if (qdp) {
  	    osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q);
  	    osi_QDFree(qdp);
  	}
          if (bufp) {
- 	    int release = 0;
- 	    if (bufp->cmFlags & CM_BUF_CMSTORING)
- 		release = 1;
              bufp->cmFlags &= ~CM_BUF_CMSTORING;
              if (bufp->flags & CM_BUF_WAITING) {
                  osi_Log2(afsd_logp, "CM SyncOpDone Waking [scp 0x%p] bufp 0x%p", scp, bufp);
--- 1249,1257 ----
  	if (qdp) {
  	    osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q);
  	    osi_QDFree(qdp);
+ 	    release = 1;
  	}
          if (bufp) {
              bufp->cmFlags &= ~CM_BUF_CMSTORING;
              if (bufp->flags & CM_BUF_WAITING) {
                  osi_Log2(afsd_logp, "CM SyncOpDone Waking [scp 0x%p] bufp 0x%p", scp, bufp);
***************
*** 1279,1285 ****
   * handled after the callback breaking is done, but only one of whose calls
   * started before that, can cause old info to be merged from the first call.
   */
! void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
                      cm_user_t *userp, afs_uint32 flags)
  {
      // yj: i want to create some fake status for the /afs directory and the
--- 1282,1290 ----
   * handled after the callback breaking is done, but only one of whose calls
   * started before that, can cause old info to be merged from the first call.
   */
! void cm_MergeStatus(cm_scache_t *dscp, 
! 		    cm_scache_t *scp, AFSFetchStatus *statusp, 
! 		    AFSVolSync *volsyncp,
                      cm_user_t *userp, afs_uint32 flags)
  {
      // yj: i want to create some fake status for the /afs directory and the
***************
*** 1297,1303 ****
          statusp->Owner = 0x0;
          statusp->CallerAccess = 0x9;
          statusp->AnonymousAccess = 0x9;
!         statusp->UnixModeBits = 0x1ff;
          statusp->ParentVnode = 0x1;
          statusp->ParentUnique = 0x1;
          statusp->ResidencyMask = 0;
--- 1302,1308 ----
          statusp->Owner = 0x0;
          statusp->CallerAccess = 0x9;
          statusp->AnonymousAccess = 0x9;
!         statusp->UnixModeBits = 0777;
          statusp->ParentVnode = 0x1;
          statusp->ParentUnique = 0x1;
          statusp->ResidencyMask = 0;
***************
*** 1313,1318 ****
--- 1318,1342 ----
      if (statusp->errorCode != 0) {	
  	scp->flags |= CM_SCACHEFLAG_EACCESS;
  	osi_Log2(afsd_logp, "Merge, Failure scp %x code 0x%x", scp, statusp->errorCode);
+ 
+ 	scp->fileType = 0;	/* unknown */
+ 
+ 	scp->serverModTime = 0;
+ 	scp->clientModTime = 0;
+ 	scp->length.LowPart = 0;
+ 	scp->length.HighPart = 0;
+ 	scp->serverLength.LowPart = 0;
+ 	scp->serverLength.HighPart = 0;
+ 	scp->linkCount = 0;
+ 	scp->owner = 0;
+ 	scp->group = 0;
+ 	scp->unixModeBits = 0;
+ 	scp->anyAccess = 0;
+ 	scp->dataVersion = 0;
+ 
+ 	scp->parentVnode = dscp->fid.vnode;
+ 	scp->parentUnique = dscp->fid.unique;
+ 
  	return;
      } else {
  	scp->flags &= ~CM_SCACHEFLAG_EACCESS;
***************
*** 1366,1371 ****
--- 1390,1396 ----
          if (!(scp->flags & CM_SCACHEFLAG_RO))
              return;
      }       
+ 
      scp->serverModTime = statusp->ServerModTime;
  
      if (!(scp->mask & CM_SCACHEMASK_CLIENTMODTIME)) {
***************
*** 1380,1386 ****
      scp->serverLength.HighPart = statusp->Length_hi;
  
      scp->linkCount = statusp->LinkCount;
-     scp->dataVersion = statusp->DataVersion;
      scp->owner = statusp->Owner;
      scp->group = statusp->Group;
      scp->unixModeBits = statusp->UnixModeBits & 07777;
--- 1405,1410 ----
***************
*** 1411,1416 ****
--- 1435,1454 ----
      if (userp != NULL) {
          cm_AddACLCache(scp, userp, statusp->CallerAccess);
      }
+ 
+     if ((flags & CM_MERGEFLAG_STOREDATA) &&
+ 	statusp->DataVersion - scp->dataVersion == 1) {
+ 	cm_buf_t *bp;
+ 
+ 	for (bp = cm_data.buf_fileHashTablepp[BUF_FILEHASH(&scp->fid)]; bp; bp=bp->fileHashp)
+ 	{
+ 	    if (cm_FidCmp(&scp->fid, &bp->fid) == 0 && 
+ 		bp->dataVersion == scp->dataVersion)
+ 		bp->dataVersion = statusp->DataVersion;
+ 	}
+ 
+     }
+     scp->dataVersion = statusp->DataVersion;
  }
  
  /* note that our stat cache info is incorrect, so force us eventually
***************
*** 1546,1566 ****
      if (lock)
          lock_ObtainRead(&cm_scacheLock);
    
!     sprintf(output, "%s - dumping scache - cm_data.currentSCaches=%d, cm_data.maxSCaches=%d\n", cookie, cm_data.currentSCaches, cm_data.maxSCaches);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      for (scp = cm_data.scacheLRULastp; scp; scp = (cm_scache_t *) osi_QPrev(&scp->q)) 
      {
          if (scp->refCount != 0)
          {
!             sprintf(output, "%s fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\n", 
!                     cookie, scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique, 
                      scp->refCount);
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
      }
    
!     sprintf(output, "%s - dumping cm_data.hashTable - cm_data.hashTableSize=%d\n", cookie, cm_data.hashTableSize);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      for (i = 0; i < cm_data.hashTableSize; i++)
--- 1584,1604 ----
      if (lock)
          lock_ObtainRead(&cm_scacheLock);
    
!     sprintf(output, "%s - dumping scache - cm_data.currentSCaches=%d, cm_data.maxSCaches=%d\r\n", cookie, cm_data.currentSCaches, cm_data.maxSCaches);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      for (scp = cm_data.scacheLRULastp; scp; scp = (cm_scache_t *) osi_QPrev(&scp->q)) 
      {
          if (scp->refCount != 0)
          {
!             sprintf(output, "%s scp=0x%p, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\r\n", 
!                     cookie, scp, scp->fid.cell, scp->fid.volume, scp->fid.vnode, scp->fid.unique, 
                      scp->refCount);
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
      }
    
!     sprintf(output, "%s - dumping cm_data.hashTable - cm_data.hashTableSize=%d\r\n", cookie, cm_data.hashTableSize);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      for (i = 0; i < cm_data.hashTableSize; i++)
***************
*** 1569,1575 ****
          {
              if (scp->refCount != 0)
              {
!                 sprintf(output, "%s scp=0x%p, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\n", 
                           cookie, scp, i, scp->fid.cell, scp->fid.volume, scp->fid.vnode, 
                           scp->fid.unique, scp->refCount);
                  WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
--- 1607,1613 ----
          {
              if (scp->refCount != 0)
              {
!                 sprintf(output, "%s scp=0x%p, hash=%d, fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u\r\n", 
                           cookie, scp, i, scp->fid.cell, scp->fid.volume, scp->fid.vnode, 
                           scp->fid.unique, scp->refCount);
                  WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
***************
*** 1577,1583 ****
          }
      }
  
!     sprintf(output, "%s - Done dumping scache.\n", cookie);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      if (lock)
--- 1615,1621 ----
          }
      }
  
!     sprintf(output, "%s - Done dumping scache.\r\n", cookie);
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      if (lock)
Index: openafs/src/WINNT/afsd/cm_scache.h
diff -c openafs/src/WINNT/afsd/cm_scache.h:1.21.2.9 openafs/src/WINNT/afsd/cm_scache.h:1.21.2.11
*** openafs/src/WINNT/afsd/cm_scache.h:1.21.2.9	Sat Oct 21 16:47:48 2006
--- openafs/src/WINNT/afsd/cm_scache.h	Wed Feb  7 12:35:16 2007
***************
*** 292,297 ****
--- 292,298 ----
  						 * used to see if we're merging
  						 * in old info.
                                                   */
+ #define CM_MERGEFLAG_STOREDATA		2	/* Merge due to storedata op */
  
  /* hash define.  Must not include the cell, since the callback revocation code
   * doesn't necessarily know the cell in the case of a multihomed server
***************
*** 327,334 ****
  
  extern void cm_SyncOpDone(cm_scache_t *, struct cm_buf *, afs_uint32);
  
! extern void cm_MergeStatus(cm_scache_t *, struct AFSFetchStatus *, struct AFSVolSync *,
! 	struct cm_user *, afs_uint32 flags);
  
  extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
  
--- 328,338 ----
  
  extern void cm_SyncOpDone(cm_scache_t *, struct cm_buf *, afs_uint32);
  
! extern void cm_MergeStatus(cm_scache_t * dscp, cm_scache_t * scp, 
! 			   struct AFSFetchStatus * statusp, 
! 			   struct AFSVolSync * volsyncp,
! 			   struct cm_user *userp, 
! 			   afs_uint32 flags);
  
  extern void cm_AFSFidFromFid(struct AFSFid *, cm_fid_t *);
  
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.21 openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.28
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.21	Mon Jan 15 14:52:19 2007
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Tue Feb 13 00:47:02 2007
***************
*** 209,215 ****
                  break;
          if (tc)
              validExtension = 1;
!     }       
  
      /* Copy name characters */
      for (i = 0, name = longname;
--- 209,215 ----
                  break;
          if (tc)
              validExtension = 1;
!     }
  
      /* Copy name characters */
      for (i = 0, name = longname;
***************
*** 353,360 ****
      if (desiredAccess & AFS_ACCESS_READ)
          rights |= (scp->fileType == CM_SCACHETYPE_DIRECTORY ? PRSFS_LOOKUP : PRSFS_READ);
  
!     if ((desiredAccess & AFS_ACCESS_WRITE)
!          || createDisp == 4)
          rights |= PRSFS_WRITE;
  
      lock_ObtainMutex(&scp->mx);
--- 353,363 ----
      if (desiredAccess & AFS_ACCESS_READ)
          rights |= (scp->fileType == CM_SCACHETYPE_DIRECTORY ? PRSFS_LOOKUP : PRSFS_READ);
  
!     /* We used to require PRSFS_WRITE if createDisp was 4
!        (OPEN_ALWAYS) even if AFS_ACCESS_WRITE was not requested.
!        However, we don't need to do that since the existence of the
!        scp implies that we don't need to create it. */
!     if (desiredAccess & AFS_ACCESS_WRITE)
          rights |= PRSFS_WRITE;
  
      lock_ObtainMutex(&scp->mx);
***************
*** 481,491 ****
      int BeyondPage = 0, HaveDot = 0, HaveDotDot = 0;
  
      /* First check permissions */
!     lock_ObtainMutex(&dscp->mx);
!     code = cm_SyncOp(dscp, NULL, userp, reqp, PRSFS_DELETE,
                        CM_SCACHESYNC_GETSTATUS | CM_SCACHESYNC_NEEDCALLBACK);
!     cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     lock_ReleaseMutex(&dscp->mx);
      if (code)
          return code;
  
--- 484,494 ----
      int BeyondPage = 0, HaveDot = 0, HaveDotDot = 0;
  
      /* First check permissions */
!     lock_ObtainMutex(&scp->mx);
!     code = cm_SyncOp(scp, NULL, userp, reqp, PRSFS_DELETE,
                        CM_SCACHESYNC_GETSTATUS | CM_SCACHESYNC_NEEDCALLBACK);
!     cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     lock_ReleaseMutex(&scp->mx);
      if (code)
          return code;
  
***************
*** 937,951 ****
      lock_ReleaseRead(&scp->bufCreateLock);
  
      lock_ObtainMutex(&scp->mx);
!     if (code) {
          return code;
!     }
      while (1) {
          code = cm_SyncOp(scp, bufp, userp, reqp, 0,
                            CM_SCACHESYNC_READ | CM_SCACHESYNC_NEEDCALLBACK);
!         if (code) {
              goto done;
!         }
  	cm_SyncOpDone(scp, bufp, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_READ);
  
  
--- 940,954 ----
      lock_ReleaseRead(&scp->bufCreateLock);
  
      lock_ObtainMutex(&scp->mx);
!     if (code)
          return code;
! 
      while (1) {
          code = cm_SyncOp(scp, bufp, userp, reqp, 0,
                            CM_SCACHESYNC_READ | CM_SCACHESYNC_NEEDCALLBACK);
!         if (code)
              goto done;
! 
  	cm_SyncOpDone(scp, bufp, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_READ);
  
  
***************
*** 954,962 ****
  
          /* otherwise load buffer */
          code = cm_GetBuffer(scp, bufp, NULL, userp, reqp);
!         if (code) {
              goto done;
-         }
      }
      /* locked, has callback, has valid data in buffer */
      if ((tlen = scp->length.LowPart) > 1000) 
--- 957,964 ----
  
          /* otherwise load buffer */
          code = cm_GetBuffer(scp, bufp, NULL, userp, reqp);
!         if (code)
              goto done;
      }
      /* locked, has callback, has valid data in buffer */
      if ((tlen = scp->length.LowPart) > 1000) 
***************
*** 1002,1008 ****
      long code;
      char *cp;
      char *mpNamep;
!     cm_volume_t *volp;
      cm_cell_t *cellp;
      char mtType;
      cm_fid_t tfid;
--- 1004,1010 ----
      long code;
      char *cp;
      char *mpNamep;
!     cm_volume_t *volp = NULL;
      cm_cell_t *cellp;
      char mtType;
      cm_fid_t tfid;
***************
*** 1108,1113 ****
--- 1110,1117 ----
      }
  
    done:
+     if (volp)
+ 	cm_PutVolume(volp);
      free(cellNamep);
      free(volNamep);
      return code;
***************
*** 1403,1416 ****
      cm_dnlcRemove(dscp, namep);
      cm_SyncOpDone(dscp, NULL, sflags);
      if (code == 0) 
!         cm_MergeStatus(dscp, &newDirStatus, &volSync, userp, 0);
! 	else if (code == CM_ERROR_NOSUCHFILE) {
! 		/* windows would not have allowed the request to delete the file 
! 		 * if it did not believe the file existed.  therefore, we must 
! 		 * have an inconsistent view of the world.
! 		 */
! 		dscp->cbServerp = NULL;
! 	}
      lock_ReleaseMutex(&dscp->mx);
  
      return code;
--- 1407,1420 ----
      cm_dnlcRemove(dscp, namep);
      cm_SyncOpDone(dscp, NULL, sflags);
      if (code == 0) 
!         cm_MergeStatus(NULL, dscp, &newDirStatus, &volSync, userp, 0);
!     else if (code == CM_ERROR_NOSUCHFILE) {
! 	/* windows would not have allowed the request to delete the file 
! 	 * if it did not believe the file existed.  therefore, we must 
! 	 * have an inconsistent view of the world.
! 	 */
! 	dscp->cbServerp = NULL;
!     }
      lock_ReleaseMutex(&dscp->mx);
  
      return code;
***************
*** 1653,1666 ****
                   * is a symlink, we have more to do.
                   */
                  *cp++ = 0;	/* add null termination */
- 		if (!strcmp(".",component)) {
-                     code = 0;
-                     if (dirScp) {
-                         cm_ReleaseSCache(dirScp);
-                         dirScp = NULL;
-                     }
-                     break;
- 		}
  		extraFlag = 0;
  		if ((flags & CM_FLAG_DIRSEARCH) && tc == 0)
  		    extraFlag = CM_FLAG_NOMOUNTCHASE;
--- 1657,1662 ----
***************
*** 2101,2107 ****
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &bb.callbacks[j],
                                              CM_CALLBACK_MAINTAINCOUNT);
!                 cm_MergeStatus(scp, &bb.stats[j], &volSync, userp, 0);
              }       
              lock_ReleaseMutex(&scp->mx);
              cm_ReleaseSCache(scp);
--- 2097,2103 ----
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &bb.callbacks[j],
                                              CM_CALLBACK_MAINTAINCOUNT);
!                 cm_MergeStatus(dscp, scp, &bb.stats[j], &volSync, userp, 0);
              }       
              lock_ReleaseMutex(&scp->mx);
              cm_ReleaseSCache(scp);
***************
*** 2114,2135 ****
      }	/* while there are still more files to process */
      lock_ObtainMutex(&dscp->mx);
  
! #if 0
!     /* If we did the InlineBulk RPC pull out the return code */
      if (inlinebulk) {
  	if ((&bb.stats[0])->errorCode) {
! 	    cm_Analyze(NULL /*connp was released by the previous cm_Analyze */, 
! 			userp, reqp, &dscp->fid, &volSync, NULL, NULL, (&bb.stats[0])->errorCode);
! 	    code = cm_MapRPCError((&bb.stats[0])->errorCode, reqp);
  	}
-     } else
- #endif	
-     { 
- 	code = 0;
      }
  
!     osi_Log1(afsd_logp, "END cm_TryBulkStat code = 0x%x", code);
!     return code;
  }       
  
  void cm_StatusFromAttr(AFSStoreStatus *statusp, cm_scache_t *scp, cm_attr_t *attrp)
--- 2110,2125 ----
      }	/* while there are still more files to process */
      lock_ObtainMutex(&dscp->mx);
  
!     /* If we did the InlineBulk RPC pull out the return code and log it */
      if (inlinebulk) {
  	if ((&bb.stats[0])->errorCode) {
! 	    osi_Log1(afsd_logp, "cm_TryBulkStat bulk stat error: %d", 
! 		     (&bb.stats[0])->errorCode);
  	}
      }
  
!     osi_Log0(afsd_logp, "END cm_TryBulkStat");
!     return 0;
  }       
  
  void cm_StatusFromAttr(AFSStoreStatus *statusp, cm_scache_t *scp, cm_attr_t *attrp)
***************
*** 2317,2329 ****
      lock_ObtainMutex(&scp->mx);
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STORESTATUS);
      if (code == 0)
!         cm_MergeStatus(scp, &afsOutStatus, &volSync, userp,
!                         CM_MERGEFLAG_FORCE);
  	
      /* if we're changing the mode bits, discard the ACL cache, 
       * since we changed the mode bits.
       */
!     if (afsInStatus.Mask & AFS_SETMODE) cm_FreeAllACLEnts(scp);
      lock_ReleaseMutex(&scp->mx);
      return code;
  }       
--- 2307,2320 ----
      lock_ObtainMutex(&scp->mx);
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STORESTATUS);
      if (code == 0)
!         cm_MergeStatus(NULL, scp, &afsOutStatus, &volSync, userp,
!                         CM_MERGEFLAG_FORCE|CM_MERGEFLAG_STOREDATA);
  	
      /* if we're changing the mode bits, discard the ACL cache, 
       * since we changed the mode bits.
       */
!     if (afsInStatus.Mask & AFS_SETMODE) 
! 	cm_FreeAllACLEnts(scp);
      lock_ReleaseMutex(&scp->mx);
      return code;
  }       
***************
*** 2400,2406 ****
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
--- 2391,2397 ----
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
***************
*** 2419,2425 ****
              lock_ObtainMutex(&scp->mx);
  	    scp->creator = userp;		/* remember who created it */
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(scp, &newFileStatus, &volSync,
                                  userp, 0);
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &newFileCallback, 0);
--- 2410,2416 ----
              lock_ObtainMutex(&scp->mx);
  	    scp->creator = userp;		/* remember who created it */
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(dscp, scp, &newFileStatus, &volSync,
                                  userp, 0);
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &newFileCallback, 0);
***************
*** 2534,2540 ****
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
--- 2525,2531 ----
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
***************
*** 2552,2558 ****
          if (code == 0) {
              lock_ObtainMutex(&scp->mx);
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(scp, &newDirStatus, &volSync,
                                  userp, 0);
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &newDirCallback, 0);
--- 2543,2549 ----
          if (code == 0) {
              lock_ObtainMutex(&scp->mx);
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(dscp, scp, &newDirStatus, &volSync,
                                  userp, 0);
                  cm_EndCallbackGrantingCall(scp, &cbReq,
                                              &newDirCallback, 0);
***************
*** 2628,2634 ****
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
--- 2619,2625 ----
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
***************
*** 2692,2698 ****
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
--- 2683,2689 ----
      lock_ObtainMutex(&dscp->mx);
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
***************
*** 2710,2716 ****
          if (code == 0) {
              lock_ObtainMutex(&scp->mx);
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(scp, &newLinkStatus, &volSync,
                                  userp, 0);
              }       
              lock_ReleaseMutex(&scp->mx);
--- 2701,2707 ----
          if (code == 0) {
              lock_ObtainMutex(&scp->mx);
              if (!cm_HaveCallback(scp)) {
!                 cm_MergeStatus(dscp, scp, &newLinkStatus, &volSync,
                                  userp, 0);
              }       
              lock_ReleaseMutex(&scp->mx);
***************
*** 2774,2780 ****
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
          cm_dnlcRemove(dscp, namep); 
!         cm_MergeStatus(dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
--- 2765,2771 ----
      cm_SyncOpDone(dscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
          cm_dnlcRemove(dscp, namep); 
!         cm_MergeStatus(NULL, dscp, &updatedDirStatus, &volSync, userp, 0);
      }
      lock_ReleaseMutex(&dscp->mx);
  
***************
*** 2931,2937 ****
      lock_ObtainMutex(&oldDscp->mx);
      cm_SyncOpDone(oldDscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(oldDscp, &updatedOldDirStatus, &volSync,
                          userp, 0);
      }
      lock_ReleaseMutex(&oldDscp->mx);
--- 2922,2928 ----
      lock_ObtainMutex(&oldDscp->mx);
      cm_SyncOpDone(oldDscp, NULL, CM_SCACHESYNC_STOREDATA);
      if (code == 0) {
!         cm_MergeStatus(NULL, oldDscp, &updatedOldDirStatus, &volSync,
                          userp, 0);
      }
      lock_ReleaseMutex(&oldDscp->mx);
***************
*** 2941,2947 ****
          lock_ObtainMutex(&newDscp->mx);
          cm_SyncOpDone(newDscp, NULL, CM_SCACHESYNC_STOREDATA);
          if (code == 0) {
!             cm_MergeStatus(newDscp, &updatedNewDirStatus, &volSync,
                              userp, 0);
          }
          lock_ReleaseMutex(&newDscp->mx);
--- 2932,2938 ----
          lock_ObtainMutex(&newDscp->mx);
          cm_SyncOpDone(newDscp, NULL, CM_SCACHESYNC_STOREDATA);
          if (code == 0) {
!             cm_MergeStatus(NULL, newDscp, &updatedNewDirStatus, &volSync,
                              userp, 0);
          }
          lock_ReleaseMutex(&newDscp->mx);
Index: openafs/src/WINNT/afsd/cm_volume.c
diff -c openafs/src/WINNT/afsd/cm_volume.c:1.14.4.2 openafs/src/WINNT/afsd/cm_volume.c:1.14.4.6
*** openafs/src/WINNT/afsd/cm_volume.c:1.14.4.2	Fri Aug 25 11:27:39 2006
--- openafs/src/WINNT/afsd/cm_volume.c	Sat Feb  3 21:46:25 2007
***************
*** 129,135 ****
   */
  #define MULTIHOMED 1
  long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp,
! 	cm_volume_t *volp)
  {
      cm_conn_t *connp;
      int i, j, k;
--- 129,135 ----
   */
  #define MULTIHOMED 1
  long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp,
! 		     cm_volume_t *volp)
  {
      cm_conn_t *connp;
      int i, j, k;
***************
*** 363,512 ****
      return code;
  }
  
  long cm_GetVolumeByID(cm_cell_t *cellp, long volumeID, cm_user_t *userp,
  	cm_req_t *reqp, cm_volume_t **outVolpp)
  {
! 	cm_volume_t *volp;
!         char volNameString[100];
!         long code;
  
!         lock_ObtainWrite(&cm_volumeLock);
! 	for(volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 		if (cellp == volp->cellp &&
!                 	((unsigned) volumeID == volp->rwID ||
!                 	 (unsigned) volumeID == volp->roID ||
!                          (unsigned) volumeID == volp->bkID))
!                         	break;
!         }
  
! 	/* hold the volume if we found it */
      if (volp) 
          volp->refCount++;
!         lock_ReleaseWrite(&cm_volumeLock);
          
! 	/* return it held */
!         if (volp) {
! 		lock_ObtainMutex(&volp->mx);
          
! 		if (volp->flags & CM_VOLUMEFLAG_RESET) {
! 			code = cm_UpdateVolume(cellp, userp, reqp, volp);
! 			if (code == 0) {
! 				volp->flags &= ~CM_VOLUMEFLAG_RESET;
! 			}
! 		}
! 		else
! 			code = 0;
! 		lock_ReleaseMutex(&volp->mx);
! 		if (code == 0)
! 			*outVolpp = volp;
! 		return code;
!         }
          
!         /* otherwise, we didn't find it so consult the VLDB */
!         sprintf(volNameString, "%u", volumeID);
!         code = cm_GetVolumeByName(cellp, volNameString, userp, reqp,
! 				  0, outVolpp);
!         return code;
  }
  
  long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
! 	struct cm_user *userp, struct cm_req *reqp,
! 	long flags, cm_volume_t **outVolpp)
  {
! 	cm_volume_t *volp;
!         long code;
!         
! 	/* initialize this */
! 	code = 0;
! 
! 	lock_ObtainWrite(&cm_volumeLock);
!         for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
!             if (cellp == volp->cellp && strcmp(volumeNamep, volp->namep) == 0) {
!                 break;
!             }
!         }
          
!         /* otherwise, get from VLDB */
! 	if (!volp) {
!             if ( cm_data.currentVolumes >= cm_data.maxVolumes ) {
!                 for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
!                     if ( volp->refCount == 0 ) {
!                         /* There is one we can re-use */
!                         break;
!                     }
!                 }
! 		if (!volp)
! 		    osi_panic("Exceeded Max Volumes", __FILE__, __LINE__);
!             }
! 
!             if (volp) {
!                 volp->rwID = volp->roID = volp->bkID = 0;
!                 volp->dotdotFid.cell = 0;
!                 volp->dotdotFid.volume = 0;
!                 volp->dotdotFid.unique = 0;
!                 volp->dotdotFid.vnode = 0;
!             } else {
!                 volp = &cm_data.volumeBaseAddress[cm_data.currentVolumes++];
!                 memset(volp, 0, sizeof(cm_volume_t));
!                 volp->magic = CM_VOLUME_MAGIC;
!                 volp->nextp = cm_data.allVolumesp;
!                 cm_data.allVolumesp = volp;
!                 lock_InitializeMutex(&volp->mx, "cm_volume_t mutex");
!             }
!             volp->cellp = cellp;
!             strncpy(volp->namep, volumeNamep, VL_MAXNAMELEN);
!             volp->namep[VL_MAXNAMELEN-1] = '\0';
!             volp->refCount = 1;	/* starts off held */
!             volp->flags = CM_VOLUMEFLAG_RESET;
! 	}
!         else {
!             volp->refCount++;
  	}
          
! 	/* next should work since no one could have gotten ptr to this structure yet */
!         lock_ReleaseWrite(&cm_volumeLock);
! 	lock_ObtainMutex(&volp->mx);
!         
! 	if (volp->flags & CM_VOLUMEFLAG_RESET) {
!             code = cm_UpdateVolume(cellp, userp, reqp, volp);
!             if (code == 0)
!                 volp->flags &= ~CM_VOLUMEFLAG_RESET;
  	}
  
  	if (code == 0)
!             *outVolpp = volp;
!         lock_ReleaseMutex(&volp->mx);
!         return code;
! }
  
  void cm_ForceUpdateVolume(cm_fid_t *fidp, cm_user_t *userp, cm_req_t *reqp)
  {
! 	cm_cell_t *cellp;
! 	cm_volume_t *volp;
  
! 	if (!fidp) return;
  
! 	cellp = cm_FindCellByID(fidp->cell);
! 	if (!cellp) return;
  
! 	/* search for the volume */
!         lock_ObtainWrite(&cm_volumeLock);
! 	for(volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 		if (cellp == volp->cellp &&
!                 	(fidp->volume == volp->rwID ||
!                 	 fidp->volume == volp->roID ||
!                          fidp->volume == volp->bkID))
!                         	break;
!         }
  
! 	/* hold the volume if we found it */
!         if (volp) volp->refCount++;
!         lock_ReleaseWrite(&cm_volumeLock);
  
! 	/* update it */
! 	cm_data.mountRootGen = time(NULL);
! 	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
--- 363,523 ----
      return code;
  }
  
+ void cm_GetVolume(cm_volume_t *volp)
+ {
+     if (volp) {
+ 	lock_ObtainWrite(&cm_volumeLock);
+ 	volp->refCount++;
+ 	lock_ReleaseWrite(&cm_volumeLock);
+     }
+ }
+ 
  long cm_GetVolumeByID(cm_cell_t *cellp, long volumeID, cm_user_t *userp,
  	cm_req_t *reqp, cm_volume_t **outVolpp)
  {
!     cm_volume_t *volp;
!     char volNameString[100];
!     long code = 0;
  
!     lock_ObtainWrite(&cm_volumeLock);
!     for(volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 	if (cellp == volp->cellp &&
! 	     ((unsigned) volumeID == volp->rwID ||
! 	       (unsigned) volumeID == volp->roID ||
! 	       (unsigned) volumeID == volp->bkID))
! 	    break;
!     }	
  
!     /* hold the volume if we found it */
      if (volp) 
          volp->refCount++;
!     lock_ReleaseWrite(&cm_volumeLock);
          
!     /* return it held */
!     if (volp) {
! 	lock_ObtainMutex(&volp->mx);
          
! 	code = 0;
! 	if (volp->flags & CM_VOLUMEFLAG_RESET) {
! 	    code = cm_UpdateVolume(cellp, userp, reqp, volp);
! 	    if (code == 0)
! 		volp->flags &= ~CM_VOLUMEFLAG_RESET;
! 	}
! 	lock_ReleaseMutex(&volp->mx);
! 	if (code == 0)
! 	    *outVolpp = volp;
! 	else
! 	    cm_PutVolume(volp);
! 
! 	return code;
!     }
          
!     /* otherwise, we didn't find it so consult the VLDB */
!     sprintf(volNameString, "%u", volumeID);
!     code = cm_GetVolumeByName(cellp, volNameString, userp, reqp,
! 			       0, outVolpp);
!     return code;
  }
  
  long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
! 			 struct cm_user *userp, struct cm_req *reqp,
! 			 long flags, cm_volume_t **outVolpp)
  {
!     cm_volume_t *volp;
!     long code = 0;
          
!     lock_ObtainWrite(&cm_volumeLock);
!     for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 	if (cellp == volp->cellp && strcmp(volumeNamep, volp->namep) == 0) {
! 	    break;
  	}
+     }	
          
!     /* otherwise, get from VLDB */
!     if (!volp) {
! 	if ( cm_data.currentVolumes >= cm_data.maxVolumes ) {
! 	    for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 		if ( volp->refCount == 0 ) {
! 		    /* There is one we can re-use */
! 		    break;
! 		}
! 	    }
! 	    if (!volp)
! 		osi_panic("Exceeded Max Volumes", __FILE__, __LINE__);
! 	}	
! 
! 	if (volp) {
! 	    volp->rwID = volp->roID = volp->bkID = 0;
! 	    volp->dotdotFid.cell = 0;
! 	    volp->dotdotFid.volume = 0;
! 	    volp->dotdotFid.unique = 0;
! 	    volp->dotdotFid.vnode = 0;
! 	} else {
! 	    volp = &cm_data.volumeBaseAddress[cm_data.currentVolumes++];
! 	    memset(volp, 0, sizeof(cm_volume_t));
! 	    volp->magic = CM_VOLUME_MAGIC;
! 	    volp->nextp = cm_data.allVolumesp;
! 	    cm_data.allVolumesp = volp;
! 	    lock_InitializeMutex(&volp->mx, "cm_volume_t mutex");
  	}
+ 	volp->cellp = cellp;
+ 	strncpy(volp->namep, volumeNamep, VL_MAXNAMELEN);
+ 	volp->namep[VL_MAXNAMELEN-1] = '\0';
+ 	volp->refCount = 1;	/* starts off held */
+ 	volp->flags = CM_VOLUMEFLAG_RESET;
+     }
+     else {
+ 	volp->refCount++;
+     }
+ 
+     /* next should work since no one could have gotten ptr to this structure yet */
+     lock_ReleaseWrite(&cm_volumeLock);
+     lock_ObtainMutex(&volp->mx);
  
+     if (volp->flags & CM_VOLUMEFLAG_RESET) {
+ 	code = cm_UpdateVolume(cellp, userp, reqp, volp);
  	if (code == 0)
! 	    volp->flags &= ~CM_VOLUMEFLAG_RESET;
!     }	
! 
!     if (code == 0)
! 	*outVolpp = volp;
!     else
! 	cm_PutVolume(volp);
! 
!     lock_ReleaseMutex(&volp->mx);
!     return code;
! }	
  
  void cm_ForceUpdateVolume(cm_fid_t *fidp, cm_user_t *userp, cm_req_t *reqp)
  {
!     cm_cell_t *cellp;
!     cm_volume_t *volp;
  
!     if (!fidp) return;
  
!     cellp = cm_FindCellByID(fidp->cell);
!     if (!cellp) return;
  
!     /* search for the volume */
!     lock_ObtainWrite(&cm_volumeLock);
!     for(volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 	if (cellp == volp->cellp &&
! 	     (fidp->volume == volp->rwID ||
! 	       fidp->volume == volp->roID ||
! 	       fidp->volume == volp->bkID))
! 	    break;
!     }	
  
!     /* hold the volume if we found it */
!     if (volp) 
! 	volp->refCount++;
!     lock_ReleaseWrite(&cm_volumeLock);
  
!     /* update it */
!     cm_data.mountRootGen = time(NULL);
!     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
***************
*** 518,530 ****
       * 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 */
--- 529,541 ----
       * 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 */
***************
*** 564,631 ****
   */
  long cm_GetROVolumeID(cm_volume_t *volp)
  {
! 	long id;
  
! 	lock_ObtainMutex(&volp->mx);
! 	if (volp->roID && volp->roServersp)
! 		id = volp->roID;
! 	else
!         	id = volp->rwID;
! 	lock_ReleaseMutex(&volp->mx);
  
!         return id;
  }
  
! void cm_CheckVolumes(void)
  {
! 	cm_volume_t *volp;
  
! 	cm_data.mountRootGen = time(NULL);
!         lock_ObtainWrite(&cm_volumeLock);
! 	for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 		volp->refCount++;
!                 lock_ReleaseWrite(&cm_volumeLock);
!                 lock_ObtainMutex(&volp->mx);
! 
!                 volp->flags |= CM_VOLUMEFLAG_RESET;
! 
!                 lock_ReleaseMutex(&volp->mx);
!                 lock_ObtainWrite(&cm_volumeLock);
!                 osi_assert(volp->refCount-- > 0);
! 	}
!         lock_ReleaseWrite(&cm_volumeLock);
  
! 	/* We should also refresh cached mount points */
  }
  
  /*
  ** Finds all volumes that reside on this server and reorders their
  ** RO list according to the changed rank of server.
  */
! void cm_ChangeRankVolume(cm_server_t       *tsp)
! {
! 	int 		code;
! 	cm_volume_t*	volp;
  
! 	/* find volumes which might have RO copy on server*/
! 	lock_ObtainWrite(&cm_volumeLock);
! 	for(volp = cm_data.allVolumesp; volp; volp=volp->nextp)
! 	{
! 		code = 1 ;	/* assume that list is unchanged */
! 		volp->refCount++;
! 		lock_ReleaseWrite(&cm_volumeLock);
! 		lock_ObtainMutex(&volp->mx);
! 
! 		if ((tsp->cellp==volp->cellp) && (volp->roServersp))
! 		    code =cm_ChangeRankServer(&volp->roServersp, tsp);
! 
! 		/* this volume list was changed */
! 		if ( !code )
! 			cm_RandomizeServer(&volp->roServersp);
! 
! 		lock_ReleaseMutex(&volp->mx);
! 		lock_ObtainWrite(&cm_volumeLock);
! 		osi_assert(volp->refCount-- > 0);
! 	}
  	lock_ReleaseWrite(&cm_volumeLock);
  }
--- 575,692 ----
   */
  long cm_GetROVolumeID(cm_volume_t *volp)
  {
!     long id;
  
!     lock_ObtainMutex(&volp->mx);
!     if (volp->roID && volp->roServersp)
! 	id = volp->roID;
!     else
! 	id = volp->rwID;
!     lock_ReleaseMutex(&volp->mx);
  
!     return id;
  }
  
! void cm_RefreshVolumes(void)
  {
!     cm_volume_t *volp;
  
!     cm_data.mountRootGen = time(NULL);
!     lock_ObtainWrite(&cm_volumeLock);
!     for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
! 	volp->refCount++;
! 	lock_ReleaseWrite(&cm_volumeLock);
! 	lock_ObtainMutex(&volp->mx);
! 
! 	volp->flags |= CM_VOLUMEFLAG_RESET;
! 
! 	lock_ReleaseMutex(&volp->mx);
! 	lock_ObtainWrite(&cm_volumeLock);
! 	osi_assert(volp->refCount-- > 0);
!     }
!     lock_ReleaseWrite(&cm_volumeLock);
  
!     /* We should also refresh cached mount points */
  }
  
  /*
  ** Finds all volumes that reside on this server and reorders their
  ** RO list according to the changed rank of server.
  */
! void cm_ChangeRankVolume(cm_server_t *tsp)
! {	
!     int 		code;
!     cm_volume_t*	volp;
  
!     /* find volumes which might have RO copy on server*/
!     lock_ObtainWrite(&cm_volumeLock);
!     for(volp = cm_data.allVolumesp; volp; volp=volp->nextp)
!     {
! 	code = 1 ;	/* assume that list is unchanged */
! 	volp->refCount++;
  	lock_ReleaseWrite(&cm_volumeLock);
+ 	lock_ObtainMutex(&volp->mx);
+ 
+ 	if ((tsp->cellp==volp->cellp) && (volp->roServersp))
+ 	    code =cm_ChangeRankServer(&volp->roServersp, tsp);
+ 
+ 	/* this volume list was changed */
+ 	if ( !code )
+ 	    cm_RandomizeServer(&volp->roServersp);
+ 
+ 	lock_ReleaseMutex(&volp->mx);
+ 	lock_ObtainWrite(&cm_volumeLock);
+ 	osi_assert(volp->refCount-- > 0);
+     }
+     lock_ReleaseWrite(&cm_volumeLock);
+ }	
+ 
+ /* dump all scp's that have reference count > 0 to a file. 
+  * cookie is used to identify this batch for easy parsing, 
+  * and it a string provided by a caller 
+  */
+ int cm_DumpVolumes(FILE *outputFile, char *cookie, int lock)
+ {
+     int zilch;
+     cm_volume_t *volp;
+     char output[1024];
+   
+     if (lock) {
+ 	lock_ObtainRead(&cm_scacheLock);
+         lock_ObtainRead(&cm_volumeLock);
+     }
+   
+     sprintf(output, "%s - dumping volumes - cm_data.currentVolumes=%d, cm_data.maxVolumes=%d\r\n", cookie, cm_data.currentVolumes, cm_data.maxVolumes);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+   
+     for (volp = cm_data.allVolumesp; volp; volp=volp->nextp)
+     {
+         if (volp->refCount != 0)
+         {
+ 	    cm_scache_t *scp;
+ 	    int scprefs = 0;
+ 
+ 	    for (scp = cm_data.scacheLRULastp; scp; scp = (cm_scache_t *) osi_QPrev(&scp->q)) 
+ 	    {
+ 		if (scp->volp == volp)
+ 		    scprefs++;
+ 	    }
+ 
+             sprintf(output, "%s cell=%s name=%s rwID=%u roID=%u bkID=%u flags=0x%x fid (cell=%d, volume=%d, vnode=%d, unique=%d) refCount=%u scpRefs=%u\r\n", 
+                     cookie, volp->cellp->name, volp->namep, volp->rwID, volp->roID, volp->bkID, volp->flags, 
+ 		    volp->dotdotFid.cell, volp->dotdotFid.volume, volp->dotdotFid.vnode, volp->dotdotFid.unique,
+ 		    volp->refCount, scprefs);
+             WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+         }
+     }
+     sprintf(output, "%s - Done dumping volumes.\r\n", cookie);
+     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+   
+     if (lock) {
+         lock_ReleaseRead(&cm_volumeLock);
+ 	lock_ReleaseRead(&cm_scacheLock);
+     }
+     return (0);     
  }
+ 
+ 
Index: openafs/src/WINNT/afsd/cm_volume.h
diff -c openafs/src/WINNT/afsd/cm_volume.h:1.5 openafs/src/WINNT/afsd/cm_volume.h:1.5.6.2
*** openafs/src/WINNT/afsd/cm_volume.h:1.5	Fri Mar 11 00:33:23 2005
--- openafs/src/WINNT/afsd/cm_volume.h	Sat Feb  3 21:46:25 2007
***************
*** 38,50 ****
  extern long cm_GetVolumeByName(struct cm_cell *, char *, struct cm_user *,
  	struct cm_req *, long, cm_volume_t **);
  
  extern void cm_PutVolume(cm_volume_t *volp);
  
  extern long cm_GetROVolumeID(cm_volume_t *volp);
  
- extern long cm_GetVolumeByID(struct cm_cell *cellp, long volumeID,
- 	cm_user_t *userp, cm_req_t *reqp, cm_volume_t **outVolpp);
- 
  extern void cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp,
  	cm_req_t *reqp);
  
--- 38,52 ----
  extern long cm_GetVolumeByName(struct cm_cell *, char *, struct cm_user *,
  	struct cm_req *, long, cm_volume_t **);
  
+ extern long cm_GetVolumeByID(struct cm_cell *cellp, long volumeID,
+ 	cm_user_t *userp, cm_req_t *reqp, cm_volume_t **outVolpp);
+ 
+ extern void cm_GetVolume(cm_volume_t *volp);
+ 
  extern void cm_PutVolume(cm_volume_t *volp);
  
  extern long cm_GetROVolumeID(cm_volume_t *volp);
  
  extern void cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp,
  	cm_req_t *reqp);
  
***************
*** 52,60 ****
  
  extern void cm_ChangeRankVolume(cm_server_t *tsp);
  
! extern void cm_CheckVolumes(void);
  
  extern long cm_ValidateVolume(void);
  
  extern long cm_ShutdownVolume(void);
  #endif /*  __CM_VOLUME_H_ENV__ */
--- 54,64 ----
  
  extern void cm_ChangeRankVolume(cm_server_t *tsp);
  
! extern void cm_RefreshVolumes(void);
  
  extern long cm_ValidateVolume(void);
  
  extern long cm_ShutdownVolume(void);
+ 
+ extern int cm_DumpVolumes(FILE *outputFile, char *cookie, int lock);
  #endif /*  __CM_VOLUME_H_ENV__ */
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.32.4.4 openafs/src/WINNT/afsd/fs.c:1.32.4.5
*** openafs/src/WINNT/afsd/fs.c:1.32.4.4	Tue Sep  5 19:54:48 2006
--- openafs/src/WINNT/afsd/fs.c	Sun Jan 21 21:18:09 2007
***************
*** 3826,3832 ****
          return code;
      }
  
!     if (outValue) { 
          printf("AFS memdump created.\n");
          return 0;
      } else {
--- 3826,3832 ----
          return code;
      }
  
!     if (!outValue) { 
          printf("AFS memdump created.\n");
          return 0;
      } else {
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.30 openafs/src/WINNT/afsd/smb.c:1.118.2.32
*** openafs/src/WINNT/afsd/smb.c:1.118.2.30	Mon Jan 15 14:52:19 2007
--- openafs/src/WINNT/afsd/smb.c	Fri Feb  9 18:51:15 2007
***************
*** 9476,9569 ****
      if (lock)
          lock_ObtainRead(&smb_rctLock);
    
!     sprintf(output, "begin dumping smb_vc_t\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      for (vcp = smb_allVCsp; vcp; vcp=vcp->nextp) 
      {
          smb_fid_t *fidp;
        
!         sprintf(output, "%s vcp=0x%p, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\n",
                   cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
        
!         sprintf(output, "begin dumping smb_fid_t\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
          for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
          {
!             sprintf(output, "%s -- smb_fidp=0x%p, refCount=%d, fid=%d, vcp=0x%p, scp=0x%p, ioctlp=0x%p, NTopen_pathp=%s, NTopen_wholepathp=%s\n", 
                       cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp, 
                       fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL", 
                       fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
        
!         sprintf(output, "done dumping smb_fid_t\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
  
!     sprintf(output, "done dumping smb_vc_t\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
!     sprintf(output, "begin dumping DEAD smb_vc_t\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      for (vcp = smb_deadVCsp; vcp; vcp=vcp->nextp) 
      {
          smb_fid_t *fidp;
        
!         sprintf(output, "%s vcp=0x%p, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\n",
                   cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
        
!         sprintf(output, "begin dumping smb_fid_t\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
          for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
          {
!             sprintf(output, "%s -- smb_fidp=0x%p, refCount=%d, fid=%d, vcp=0x%p, scp=0x%p, ioctlp=0x%p, NTopen_pathp=%s, NTopen_wholepathp=%s\n", 
                       cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp, 
                       fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL", 
                       fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
        
!         sprintf(output, "done dumping smb_fid_t\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
  
!     sprintf(output, "done dumping DEAD smb_vc_t\n");
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!   
!     sprintf(output, "begin dumping DEAD smb_vc_t\n");
!     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
! 
!     for (vcp = smb_deadVCsp; vcp; vcp=vcp->nextp) 
!     {
!         smb_fid_t *fidp;
!       
!         sprintf(output, "%s vcp=0x%p, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\n",
!                  cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
!         WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!       
!         sprintf(output, "begin dumping smb_fid_t\n");
!         WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
! 
!         for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
!         {
!             sprintf(output, "%s -- smb_fidp=0x%p, refCount=%d, fid=%d, vcp=0x%p, scp=0x%p, ioctlp=0x%p, NTopen_pathp=%s, NTopen_wholepathp=%s\n", 
!                      cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp, 
!                      fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL", 
!                      fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
!             WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!         }
!       
!         sprintf(output, "done dumping smb_fid_t\n");
!         WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
!     }
! 
!     sprintf(output, "done dumping DEAD smb_vc_t\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      if (lock)
--- 9476,9539 ----
      if (lock)
          lock_ObtainRead(&smb_rctLock);
    
!     sprintf(output, "begin dumping smb_vc_t\r\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      for (vcp = smb_allVCsp; vcp; vcp=vcp->nextp) 
      {
          smb_fid_t *fidp;
        
!         sprintf(output, "%s vcp=0x%p, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\r\n",
                   cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
        
!         sprintf(output, "begin dumping smb_fid_t\r\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
          for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
          {
!             sprintf(output, "%s -- smb_fidp=0x%p, refCount=%d, fid=%d, vcp=0x%p, scp=0x%p, ioctlp=0x%p, NTopen_pathp=%s, NTopen_wholepathp=%s\r\n", 
                       cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp, 
                       fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL", 
                       fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
        
!         sprintf(output, "done dumping smb_fid_t\r\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
  
!     sprintf(output, "done dumping smb_vc_t\r\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
!     sprintf(output, "begin dumping DEAD smb_vc_t\r\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
      for (vcp = smb_deadVCsp; vcp; vcp=vcp->nextp) 
      {
          smb_fid_t *fidp;
        
!         sprintf(output, "%s vcp=0x%p, refCount=%d, flags=%d, vcID=%d, lsn=%d, uidCounter=%d, tidCounter=%d, fidCounter=%d\r\n",
                   cookie, vcp, vcp->refCount, vcp->flags, vcp->vcID, vcp->lsn, vcp->uidCounter, vcp->tidCounter, vcp->fidCounter);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
        
!         sprintf(output, "begin dumping smb_fid_t\r\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
  
          for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q))
          {
!             sprintf(output, "%s -- smb_fidp=0x%p, refCount=%d, fid=%d, vcp=0x%p, scp=0x%p, ioctlp=0x%p, NTopen_pathp=%s, NTopen_wholepathp=%s\r\n", 
                       cookie, fidp, fidp->refCount, fidp->fid, fidp->vcp, fidp->scp, fidp->ioctlp, 
                       fidp->NTopen_pathp ? fidp->NTopen_pathp : "NULL", 
                       fidp->NTopen_wholepathp ? fidp->NTopen_wholepathp : "NULL");
              WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
          }
        
!         sprintf(output, "done dumping smb_fid_t\r\n");
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
  
!     sprintf(output, "done dumping DEAD smb_vc_t\r\n");
      WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
    
      if (lock)
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.95.2.28 openafs/src/WINNT/afsd/smb3.c:1.95.2.30
*** openafs/src/WINNT/afsd/smb3.c:1.95.2.28	Mon Jan 15 14:52:19 2007
--- openafs/src/WINNT/afsd/smb3.c	Fri Feb  9 19:00:44 2007
***************
*** 3317,3323 ****
      }
  
      lock_ObtainMutex(&fidp->mx);
!     if (infoLevel == SMB_SET_FILE_DISPOSITION_INFO && !(fidp->flags & SMB_FID_OPENDELETE)) {
  	lock_ReleaseMutex(&fidp->mx);
          smb_ReleaseFID(fidp);
          smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOACCESS);
--- 3317,3326 ----
      }
  
      lock_ObtainMutex(&fidp->mx);
!     if (infoLevel == SMB_SET_FILE_DISPOSITION_INFO && 
! 	!(fidp->flags & SMB_FID_OPENDELETE)) {
! 	osi_Log3(smb_logp,"smb_ReceiveTran2SetFileInfo !SMB_FID_OPENDELETE fidp 0x%p scp 0x%p fidp->flags 0x%x", 
! 		  fidp, scp, fidp->flags);
  	lock_ReleaseMutex(&fidp->mx);
          smb_ReleaseFID(fidp);
          smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOACCESS);
***************
*** 3326,3331 ****
--- 3329,3336 ----
      if ((infoLevel == SMB_SET_FILE_ALLOCATION_INFO || 
  	 infoLevel == SMB_SET_FILE_END_OF_FILE_INFO)
           && !(fidp->flags & SMB_FID_OPENWRITE)) {
+ 	osi_Log3(smb_logp,"smb_ReceiveTran2SetFileInfo !SMB_FID_OPENWRITE fidp 0x%p scp 0x%p fidp->flags 0x%x", 
+ 		  fidp, scp, fidp->flags);
  	lock_ReleaseMutex(&fidp->mx);
          smb_ReleaseFID(fidp);
          smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOACCESS);
***************
*** 3415,3420 ****
--- 3420,3428 ----
              code = 0;
      }
      else if (infoLevel == SMB_SET_FILE_DISPOSITION_INFO) {
+ 	int delflag = *((char *)(p->datap));
+ 	osi_Log3(smb_logp,"smb_ReceiveTran2SetFileInfo Delete? %d fidp 0x%p scp 0x%p", 
+ 		 delflag, fidp, scp);
          if (*((char *)(p->datap))) {	/* File is Deleted */
              code = cm_CheckNTDelete(fidp->NTopen_dscp, scp, userp,
                                       &req);
***************
*** 3422,3427 ****
--- 3430,3438 ----
  		lock_ObtainMutex(&fidp->mx);
                  fidp->flags |= SMB_FID_DELONCLOSE;
  		lock_ReleaseMutex(&fidp->mx);
+ 	    } else {
+ 		osi_Log3(smb_logp,"smb_ReceiveTran2SetFileInfo CheckNTDelete fidp 0x%p scp 0x%p code 0x%x", 
+ 			 fidp, scp, code);
  	    }
  	}               
          else {  
***************
*** 5717,5722 ****
--- 5728,5741 ----
      NumberOfUnlocks = smb_GetSMBParm(inp, 6);
      NumberOfLocks = smb_GetSMBParm(inp, 7);
  
+     if (!(fidp->flags & SMB_FID_OPENWRITE) &&
+         !(LockType & LOCKING_ANDX_SHARED_LOCK)) {
+         /* somebody wants exclusive locks on a file that they only
+            opened for reading.  We downgrade this to a shared lock. */
+         osi_Log0(smb_logp, "smb_ReceiveV3Locking reinterpreting exclusive lock as shared for read-only fid");
+         LockType |= LOCKING_ANDX_SHARED_LOCK;
+     }
+ 
      if ((LockType & LOCKING_ANDX_CANCEL_LOCK) ||
          (LockType & LOCKING_ANDX_CHANGE_LOCKTYPE)) {
  
***************
*** 5757,5762 ****
--- 5776,5788 ----
          code = cm_Lock(scp, LockType, LOffset, LLength, key, (Timeout != 0),
                          userp, &req, &lockp);
  
+ 	if (code == CM_ERROR_NOACCESS && LockType == LockWrite && 
+ 	    (fidp->flags & (SMB_FID_OPENREAD_LISTDIR | SMB_FID_OPENWRITE)) == SMB_FID_OPENREAD_LISTDIR)
+ 	{
+ 	    code = cm_Lock(scp, LockRead, LOffset, LLength, key, (Timeout != 0),
+ 			    userp, &req, &lockp);
+ 	}
+ 
          if (code == CM_ERROR_WOULDBLOCK && Timeout != 0) {
              smb_waitingLock_t * wLock;
  
***************
*** 6364,6370 ****
      BOOL foundscp;
      cm_req_t req;
      int created = 0;
!     cm_lock_data_t *ldp = NULL;									       
  
      cm_InitReq(&req);
  
--- 6390,6396 ----
      BOOL foundscp;
      cm_req_t req;
      int created = 0;
!     cm_lock_data_t *ldp = NULL;
  
      cm_InitReq(&req);
  
***************
*** 7020,7026 ****
          LLength.HighPart = 0;
          LLength.LowPart = SMB_FID_QLOCK_LENGTH;
  
!         if (fidflags & SMB_FID_SHARE_READ) {
              sLockType = LOCKING_ANDX_SHARED_LOCK;
          } else {
              sLockType = 0;
--- 7046,7057 ----
          LLength.HighPart = 0;
          LLength.LowPart = SMB_FID_QLOCK_LENGTH;
  
!         /* If we are not opening the file for writing, then we don't
!            try to get an exclusive lock.  Noone else should be able to
!            get an exclusive lock on the file anyway, although someone
!            else can get a shared lock. */
!         if ((fidflags & SMB_FID_SHARE_READ) ||
!             !(fidflags & SMB_FID_OPENWRITE)) {
              sLockType = LOCKING_ANDX_SHARED_LOCK;
          } else {
              sLockType = 0;
***************
*** 7663,7669 ****
          LLength.HighPart = 0;
          LLength.LowPart = SMB_FID_QLOCK_LENGTH;
  
!         if (fidflags & SMB_FID_SHARE_READ) {
              sLockType = LOCKING_ANDX_SHARED_LOCK;
          } else {
              sLockType = 0;
--- 7694,7703 ----
          LLength.HighPart = 0;
          LLength.LowPart = SMB_FID_QLOCK_LENGTH;
  
!         /* Similar to what we do in handling NTCreateX.  We get a
!            shared lock if we are only opening the file for reading. */
!         if ((fidflags & SMB_FID_SHARE_READ) ||
!             !(fidflags & SMB_FID_OPENWRITE)) {
              sLockType = LOCKING_ANDX_SHARED_LOCK;
          } else {
              sLockType = 0;
Index: openafs/src/WINNT/aklog/aklog.c
diff -c openafs/src/WINNT/aklog/aklog.c:1.14.4.1 openafs/src/WINNT/aklog/aklog.c:1.14.4.2
*** openafs/src/WINNT/aklog/aklog.c:1.14.4.1	Thu Jun  1 11:38:52 2006
--- openafs/src/WINNT/aklog/aklog.c	Fri Feb  9 12:30:33 2007
***************
*** 279,286 ****
                          "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);
  #ifdef AFS_ID_TO_NAME
                  strncpy(username_copy, username, BUFSIZ);
                  snprintf (username, BUFSIZ, "%s (AFS ID %d)", username_copy, (int) viceId);
--- 279,286 ----
                          "user %s in cell %s (status: %d).\n", progname,
                          username, cell_to_use, *status);
              } else {
!                 printf("created cross-cell entry for %s (Id %d) at %s\n",
!                         username, viceId, cell_to_use);
  #ifdef AFS_ID_TO_NAME
                  strncpy(username_copy, username, BUFSIZ);
                  snprintf (username, BUFSIZ, "%s (AFS ID %d)", username_copy, (int) viceId);
***************
*** 412,486 ****
  
  static char *afs_realm_of_cell(struct afsconf_cell *cellconfig)
  {
! 	char krbhst[MAX_HSTNM];
! 	static char krbrlm[REALM_SZ+1];
  
! 	if (!cellconfig)
! 		return 0;
  
! 	strcpy(krbrlm, (char *) krb_realmofhost(cellconfig->hostName[0]));
  
! 	if (krb_get_admhst(krbhst, krbrlm, 1) != KSUCCESS)
  	{
! 		char *s = krbrlm;
! 		char *t = cellconfig->name;
! 		int c;
! 
! 		while (c = *t++)
! 		{
! 			if (islower(c))
! 				c = toupper(c);
! 			*s++ = c;
! 		}
! 		*s++ = 0;
  	}
! 	return krbrlm;
  }
  
- static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellconfig)
- {
- 	char ** krbrlms = 0;
- 	static char krbrlm[REALM_SZ+1];
- 	krb5_error_code status;
- 
- 	if (!cellconfig)
- 		return 0;
  
  	status = krb5_get_host_realm( context, cellconfig->hostName[0], &krbrlms );
- 
  	if (status == 0 && krbrlms && krbrlms[0]) {
! 		strcpy(krbrlm, krbrlms[0]);
!     } else {
! 		strcpy(krbrlm, cellconfig->name);
! 		strupr(krbrlm);
  	}
  
  	if (krbrlms)
! 		krb5_free_host_realm( context, krbrlms );
! 
! 	return krbrlm;
! }
  
  static char *copy_cellinfo(cellinfo_t *cellinfo)
  {
! 	cellinfo_t *new_cellinfo;
  
! 	if (new_cellinfo = (cellinfo_t *)malloc(sizeof(cellinfo_t)))
! 		memcpy(new_cellinfo, cellinfo, sizeof(cellinfo_t));
  
! 	return ((char *)new_cellinfo);
  }
  
  
  static char *copy_string(char *string)
  {
! 	char *new_string;
  
! 	if (new_string = (char *)calloc(strlen(string) + 1, sizeof(char)))
! 		(void) strcpy(new_string, string);
  
! 	return (new_string);
! }
  
  
  static int get_cellconfig(char *cell, struct afsconf_cell *cellconfig,
--- 412,503 ----
  
  static char *afs_realm_of_cell(struct afsconf_cell *cellconfig)
  {
!     char krbhst[MAX_HSTNM];
!     static char krbrlm[REALM_SZ+1];
  
!     if (!cellconfig)
! 	return 0;
  
!     strcpy(krbrlm, (char *) krb_realmofhost(cellconfig->hostName[0]));
  
!     if (krb_get_admhst(krbhst, krbrlm, 1) != KSUCCESS)
!     {
! 	char *s = krbrlm;
! 	char *t = cellconfig->name;
! 	int c;
! 
! 	while (c = *t++)
  	{
! 	    if (islower(c))
! 		c = toupper(c);
! 	    *s++ = c;
  	}
! 	*s++ = 0;
!     }
!     return krbrlm;
  }
  
  
+ /* As of MIT Kerberos 1.6, krb5_get_host_realm() will return the NUL-string 
+  * if there is no domain_realm mapping for the hostname's domain.  This is 
+  * used as a trigger indicating that referrals should be used within the
+  * krb5_get_credentials() call.  However, if the KDC does not support referrals
+  * that will result in a KRB5_ERR_HOST_REALM_UNKNOWN error and we will have
+  * to manually fallback to mapping the domain of the host as a realm name.
+  * Hence, the new fallback parameter.
+  */
+ static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellconfig, int fallback)
+ {
+     char ** krbrlms = 0;
+     static char krbrlm[REALM_SZ+1];
+     krb5_error_code status;
+ 
+     if (!cellconfig)
+ 	return 0;
+ 
+     if (fallback) {
+ 	char * p;
+ 	p = strchr(cellconfig->hostName[0], '.');
+ 	if (p++)
+ 	    strcpy(krbrlm, p);
+ 	else
+ 	    strcpy(krbrlm, cellconfig->name);
+ 	strupr(krbrlm);
+     } else {
  	status = krb5_get_host_realm( context, cellconfig->hostName[0], &krbrlms );
  	if (status == 0 && krbrlms && krbrlms[0]) {
! 	    strcpy(krbrlm, krbrlms[0]);
! 	} else {
! 	    strcpy(krbrlm, cellconfig->name);
! 	    strupr(krbrlm);
  	}
  
  	if (krbrlms)
! 	    krb5_free_host_realm( context, krbrlms );
!     }
!     return krbrlm;
! }	
  
  static char *copy_cellinfo(cellinfo_t *cellinfo)
  {
!     cellinfo_t *new_cellinfo;
  
!     if (new_cellinfo = (cellinfo_t *)malloc(sizeof(cellinfo_t)))
! 	memcpy(new_cellinfo, cellinfo, sizeof(cellinfo_t));
  
!     return ((char *)new_cellinfo);
  }
  
  
  static char *copy_string(char *string)
  {
!     char *new_string;
  
!     if (new_string = (char *)calloc(strlen(string) + 1, sizeof(char)))
! 	(void) strcpy(new_string, string);
  
!     return (new_string);
! }	
  
  
  static int get_cellconfig(char *cell, struct afsconf_cell *cellconfig,
***************
*** 591,604 ****
      if (dflag)
          printf("Authenticating to cell %s.\n", cell_to_use);
  
-     if (realm && realm[0])
-         strcpy(realm_of_cell, realm);
-     else
-         strcpy(realm_of_cell,
-                 (usev5)? 
-                 afs_realm_of_cell5(context, &ak_cellconfig) : 
-                 afs_realm_of_cell(&ak_cellconfig));
- 
      /* We use the afs.<cellname> convention here... */
      strcpy(name, AFSKEY);
      strncpy(instance, cell_to_use, sizeof(instance));
--- 608,613 ----
***************
*** 612,617 ****
--- 621,627 ----
      if (usev5) 
      { /* using krb5 */
          int retry = 1;
+ 	int realm_fallback = 0;
  
          if ( strchr(name,'.') != NULL ) {
              fprintf(stderr, "%s: Can't support principal names including a dot.\n",
***************
*** 620,643 ****
          }
  
        try_v5:
!         if (dflag)
              printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm_of_cell);
          status = get_v5cred(context, name, instance, realm_of_cell, 
                              use524 ? &c : NULL, &v5cred);
!         if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN) {
              if (dflag)
                  printf("Getting v5 tickets: %s@%s\n", name, realm_of_cell);
              status = get_v5cred(context, name, "", realm_of_cell, 
                                  use524 ? &c : NULL, &v5cred);
!         }
          if ( status == KRB5KRB_AP_ERR_MSG_TYPE && retry ) {
              retry = 0;
              goto try_v5;
          }       
      }       
      else 
      {
!         /*
           * Try to obtain AFS tickets.  Because there are two valid service
           * names, we will try both, but trying the more specific first.
           *
--- 630,672 ----
          }
  
        try_v5:
! 	if (realm && realm[0])
! 	    strcpy(realm_of_cell, realm);
! 	else
! 	    strcpy(realm_of_cell,
! 		    afs_realm_of_cell5(context, &ak_cellconfig, realm_fallback));
! 
! 	if (dflag)
              printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm_of_cell);
          status = get_v5cred(context, name, instance, realm_of_cell, 
                              use524 ? &c : NULL, &v5cred);
! 	if (status == KRB5_ERR_HOST_REALM_UNKNOWN) {
! 	    realm_fallback = 1;
! 	    goto try_v5;
! 	} else if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN) {
! 	    if (!realm_of_cell[0]) {
! 		realm_fallback = 1;
! 		goto try_v5;
! 	    }
              if (dflag)
                  printf("Getting v5 tickets: %s@%s\n", name, realm_of_cell);
              status = get_v5cred(context, name, "", realm_of_cell, 
                                  use524 ? &c : NULL, &v5cred);
! 	}
          if ( status == KRB5KRB_AP_ERR_MSG_TYPE && retry ) {
              retry = 0;
+ 	    realm_fallback = 0;
              goto try_v5;
          }       
      }       
      else 
      {
! 	if (realm && realm[0])
! 	    strcpy(realm_of_cell, realm);
! 	else
! 	    strcpy(realm_of_cell, afs_realm_of_cell(&ak_cellconfig));
! 
! 	/*
           * Try to obtain AFS tickets.  Because there are two valid service
           * names, we will try both, but trying the more specific first.
           *
Index: openafs/src/WINNT/client_config/lang/en_US/afs_config.rc
diff -c openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.7.6.2 openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.7.6.3
*** openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.7.6.2	Tue Dec 12 15:41:15 2006
--- openafs/src/WINNT/client_config/lang/en_US/afs_config.rc	Fri Feb  2 23:53:04 2007
***************
*** 735,746 ****
      IDS_SVRCOL_SERVER       "Address"
      IDS_SVRCOL_COMMENT      "Server Name"
      IDS_TIP_DRIVES          "Tip: You can connect a network drive mapping by checking the box next to the mapping's drive letter."
!     IDS_MAP_LETTER          "Drive *:"
  END
  
  STRINGTABLE DISCARDABLE 
  BEGIN
!     IDS_DRIVE_MAP           "Drive %1: \t%2"
      IDS_ERROR_MAP           "Error Mapping Network Drive"
      IDS_ERROR_MAP_DESC      "AFS was unable to map the network drive to the specified path in AFS. Check to make sure the drive letter is not currently in use.\n\nError: 0x%1."
      IDS_ERROR_UNMAP         "Error Mapping Network Drive"
--- 735,746 ----
      IDS_SVRCOL_SERVER       "Address"
      IDS_SVRCOL_COMMENT      "Server Name"
      IDS_TIP_DRIVES          "Tip: You can connect a network drive mapping by checking the box next to the mapping's drive letter."
!     IDS_MAP_LETTER          "*:"
  END
  
  STRINGTABLE DISCARDABLE 
  BEGIN
!     IDS_DRIVE_MAP           "%1: \t%2"
      IDS_ERROR_MAP           "Error Mapping Network Drive"
      IDS_ERROR_MAP_DESC      "AFS was unable to map the network drive to the specified path in AFS. Check to make sure the drive letter is not currently in use.\n\nError: 0x%1."
      IDS_ERROR_UNMAP         "Error Mapping Network Drive"
Index: openafs/src/WINNT/client_creds/mounttab.cpp
diff -c openafs/src/WINNT/client_creds/mounttab.cpp:1.8.4.1 openafs/src/WINNT/client_creds/mounttab.cpp:1.8.4.3
*** openafs/src/WINNT/client_creds/mounttab.cpp:1.8.4.1	Tue Dec 12 15:41:18 2006
--- openafs/src/WINNT/client_creds/mounttab.cpp	Wed Feb  7 11:39:32 2007
***************
*** 114,132 ****
  
  void Mount_OnUpdate (HWND hDlg, BOOL fOnInitDialog)
  {
-     char dbgstr[128];
- 
      DRIVEMAPLIST List;
      memset(&List, 0, sizeof(DRIVEMAPLIST));
      QueryDriveMapList (&List);
  
      HWND hList = GetDlgItem (hDlg, IDC_LIST);
      int iItemSel = LB_GetSelected(hList);
-     sprintf(dbgstr,"Mount_OnUpdate LB_GETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
      int iDataSel = Mount_DriveFromItem (hDlg, iItemSel);
-     sprintf(dbgstr,"Mount_OnUpdate Drive = %d\n",iDataSel);
-     OutputDebugStringA(dbgstr);
      iItemSel = -1;
  
      if (fOnInitDialog && (iDataSel == -1))
--- 114,126 ----
***************
*** 144,156 ****
  
  	LPTSTR psz = FormatString (IDS_DRIVE_MAP, TEXT("%c%s"), List.aDriveMap[ iDrive ].chDrive, szAfsPath);
  	int iItem = LB_AddItem(hList, psz, List.aDriveMap[ iDrive ].fActive);
- 	sprintf(dbgstr,"Mount_OnUpdate LB_ADDSTRING drive %d [%s] as item %d\n", iDrive, psz, iItem);
- 	OutputDebugStringA(dbgstr);
  	FreeString (psz);
  
  	int iCount = SendMessage(hList, LB_GETCOUNT, 0, 0);
- 	sprintf(dbgstr,"Mount_OnUpdate LB_GETCOUNT = %d\n", iCount);
- 	OutputDebugStringA(dbgstr);
  
  	/* This really shouldn't work except that we are adding 
  	 * the strings in alphabetical order.  Otherwise, we could
--- 138,146 ----
***************
*** 163,170 ****
      LB_EndChange(hList, NULL);
  
      LB_SetSelected(hList, iItemSel);
-     sprintf(dbgstr,"Mount_OnUpdate LB_SETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
  
      Mount_OnSelect (hDlg);
      FreeDriveMapList (&List);
--- 153,158 ----
***************
*** 173,188 ****
  
  void Mount_OnSelect (HWND hDlg)
  {
-     char dbgstr[128];
      BOOL fServiceRunning = IsServiceRunning();
  
     HWND hList = GetDlgItem (hDlg, IDC_LIST);
     int iItemSel = LB_GetSelected(hList);
-     sprintf(dbgstr,"Mount_OnSelect LB_GETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
     int iDataSel = Mount_DriveFromItem (hDlg, iItemSel);
-     sprintf(dbgstr,"Mount_OnSelect Drive = %d\n",iDataSel);
-     OutputDebugStringA(dbgstr);
  
     l.iDriveSelectLast = iDataSel;
  
--- 161,171 ----
***************
*** 194,210 ****
  
  void Mount_OnCheck (HWND hDlg)
  {
-     char dbgstr[128];
     DRIVEMAPLIST List;
     QueryDriveMapList (&List);
  
     HWND hList = GetDlgItem (hDlg, IDC_LIST);
     int iItemSel = LB_GetSelected(hList);
-     sprintf(dbgstr,"Mount_OnCheck LB_GETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
     int iDriveSel = Mount_DriveFromItem (hDlg, iItemSel);
-     sprintf(dbgstr,"Mount_OnCheck Drive = %d\n",iDriveSel);
-     OutputDebugStringA(dbgstr);
     BOOL fChecked = SendMessage (hList, LB_GETITEMDATA, iItemSel, 0);
  
     if (iDriveSel != -1)
--- 177,188 ----
***************
*** 231,244 ****
  
  void Mount_OnRemove (HWND hDlg)
  {
-     char dbgstr[128];
      HWND hList = GetDlgItem (hDlg, IDC_LIST);
      int iItemSel = LB_GetSelected(hList);
-     sprintf(dbgstr,"Mount_OnRemove LB_GETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
     int iDriveSel = Mount_DriveFromItem (hDlg, iItemSel);
-     sprintf(dbgstr,"Mount_OnRemove Drive = %d\n",iDriveSel);
-     OutputDebugStringA(dbgstr);
  
     if (iDriveSel != -1)
        {
--- 209,217 ----
***************
*** 275,288 ****
  
  void Mount_OnEdit (HWND hDlg)
  {
-     char dbgstr[128];
     HWND hList = GetDlgItem (hDlg, IDC_LIST);
     int iItemSel = LB_GetSelected(hList);
-     sprintf(dbgstr,"Mount_OnEdit LB_GETCURSEL = %d\n",iItemSel);
-     OutputDebugStringA(dbgstr);
     int iDriveSel = Mount_DriveFromItem (hDlg, iItemSel);
-     sprintf(dbgstr,"Mount_OnEdit Drive = %d\n",iDriveSel);
-     OutputDebugStringA(dbgstr);
  
     Mount_AdjustMapping (hDlg, iDriveSel);
  }
--- 248,256 ----
***************
*** 364,374 ****
  
  int Mount_DriveFromItem (HWND hDlg, int iItem)
  {
-     char dbgstr[128];
      TCHAR szItem[ 1024 ] = TEXT("");
      SendDlgItemMessage (hDlg, IDC_LIST, LB_GETTEXT, iItem, (LPARAM)szItem);
-     sprintf(dbgstr, "Mount_DriveFromItem LB_GETTEXT - [%s]\n", szItem);
-     OutputDebugString(dbgstr);
  
      LPTSTR pch;
      if ((pch = (LPTSTR)lstrchr (szItem, TEXT(':'))) != NULL)
--- 332,339 ----
***************
*** 425,431 ****
  
  void Mapping_OnInitDialog (HWND hDlg)
  {
-     char dbgstr[128];
     PDRIVEMAP pMap = (PDRIVEMAP)GetWindowLongPtr (hDlg, DWLP_USER);
  
     // Fill in the combo box
--- 390,395 ----
***************
*** 481,487 ****
  
  void Mapping_OnOK (HWND hDlg)
  {
-     char dbgstr[128];
     PDRIVEMAP pMap = (PDRIVEMAP)GetWindowLongPtr (hDlg, DWLP_USER);
  
     int iItem = SendDlgItemMessage (hDlg, IDC_MAP_LETTER, CB_GETCURSEL, 0, 0);
--- 445,450 ----
Index: openafs/src/WINNT/client_exp/afs_shl_ext.cpp
diff -c openafs/src/WINNT/client_exp/afs_shl_ext.cpp:1.6.4.2 openafs/src/WINNT/client_exp/afs_shl_ext.cpp:1.6.4.3
*** openafs/src/WINNT/client_exp/afs_shl_ext.cpp:1.6.4.2	Wed Sep  6 19:14:00 2006
--- openafs/src/WINNT/client_exp/afs_shl_ext.cpp	Tue Jan 30 07:42:43 2007
***************
*** 43,52 ****
  // CAfsShlExt
  
  BEGIN_MESSAGE_MAP(CAfsShlExt, CWinApp)
! 	//{{AFX_MSG_MAP(CAfsShlExt)
! 		// NOTE - the ClassWizard will add and remove mapping macros here.
! 		//    DO NOT EDIT what you see in these blocks of generated code!
! 	//}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  /////////////////////////////////////////////////////////////////////////////
--- 43,52 ----
  // CAfsShlExt
  
  BEGIN_MESSAGE_MAP(CAfsShlExt, CWinApp)
!     //{{AFX_MSG_MAP(CAfsShlExt)
!     // NOTE - the ClassWizard will add and remove mapping macros here.
!     //    DO NOT EDIT what you see in these blocks of generated code!
!     //}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 54,62 ****
  
  CAfsShlExt::CAfsShlExt()
  {
! 	/* Start up sockets */
! 	WSADATA WSAjunk;
! 	WSAStartup(0x0101, &WSAjunk);
  }
  
  /////////////////////////////////////////////////////////////////////////////
--- 54,62 ----
  
  CAfsShlExt::CAfsShlExt()
  {
!     /* Start up sockets */
!     WSADATA WSAjunk;
!     WSAStartup(0x0101, &WSAjunk);
  }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 70,85 ****
  
  BOOL CAfsShlExt::InitInstance()
  {
! 	// Load our translated resources
! 	TaLocale_LoadCorrespondingModuleByName (m_hInstance, TEXT("afs_shl_ext.dll"));
  
! 	// Register all OLE server (factories) as running.  This enables the
! 	//  OLE libraries to create objects from other applications.
! 	COleObjectFactory::RegisterAll();
  
! 	SetHelpPath(m_pszHelpFilePath);
  
! 	return TRUE;
  }
  
  /////////////////////////////////////////////////////////////////////////////
--- 70,85 ----
  
  BOOL CAfsShlExt::InitInstance()
  {
!     // Load our translated resources
!     TaLocale_LoadCorrespondingModuleByName (m_hInstance, TEXT("afs_shl_ext.dll"));
  
!     // Register all OLE server (factories) as running.  This enables the
!     //  OLE libraries to create objects from other applications.
!     COleObjectFactory::RegisterAll();
  
!     SetHelpPath(m_pszHelpFilePath);
  
!     return TRUE;
  }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 87,99 ****
  
  STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  {
! 	AFX_MANAGE_STATE(AfxGetStaticModuleState());
! 	return AfxDllGetClassObject(rclsid, riid, ppv);
! }
  
  STDAPI DllCanUnloadNow(void)
  {
! 	AFX_MANAGE_STATE(AfxGetStaticModuleState());
  
  #ifdef COMMENT
      // This test is correct and we really do want to allow the extension to be loaded and 
--- 87,99 ----
  
  STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  {
!     AFX_MANAGE_STATE(AfxGetStaticModuleState());
!     return AfxDllGetClassObject(rclsid, riid, ppv);
! }	
  
  STDAPI DllCanUnloadNow(void)
  {
!     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  
  #ifdef COMMENT
      // This test is correct and we really do want to allow the extension to be loaded and 
***************
*** 102,166 ****
      // until someone has time to figure out how to debug this.   
      // Jeffrey Altman - 2 Oct 2005
  
! 	if (!nCMRefCount && !nSERefCount && !nICRefCount && !nTPRefCount && !nXPRefCount)
! 		return S_OK;
  #endif
! 	return S_FALSE;
  }
  
  int WideCharToLocal(LPTSTR pLocal, LPCWSTR pWide, DWORD dwChars)
  {
! 	*pLocal = 0;
! 	WideCharToMultiByte( CP_ACP, 0, pWide, -1, pLocal, dwChars, NULL, NULL);
! 	return lstrlen(pLocal);
  }
  
  LRESULT DoRegCLSID(HKEY hKey,PTCHAR szSubKey,PTCHAR szData,PTCHAR szValue=NULL)
  {
! 	DWORD    dwDisp;
! 	LRESULT  lResult;
! 	HKEY     thKey;
! 	lResult = RegCreateKeyEx(hKey, szSubKey, 0, NULL,
! 				 REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
! 				 &thKey, &dwDisp);
! 	if(NOERROR == lResult)
! 	{
! 		lResult = RegSetValueEx(thKey, szValue, 0, REG_SZ,
! 					(LPBYTE)szData, (lstrlen(szData) + 1) 
! 					* sizeof(TCHAR));
! 		RegCloseKey(thKey);
! 	}
! 	RegCloseKey(hKey);
! 	return lResult;
  }
  
  // by exporting DllRegisterServer, you can use regsvr.exe
  STDAPI DllRegisterServer(void)
  {
! 	HKEY     hKey;
! 	LRESULT  lResult;
! 	DWORD    dwDisp;
! 	TCHAR    szSubKey[MAX_PATH];
! 	TCHAR    szCLSID[MAX_PATH];
      TCHAR    szModule[MAX_PATH];
      LPWSTR   pwsz;
! 	AFX_MANAGE_STATE(AfxGetStaticModuleState());
! 	COleObjectFactory::UpdateRegistryAll();
  
! 	StringFromIID(IID_IShellExt, &pwsz);
! 	if(pwsz)
  	{
! 		WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
! 		LPMALLOC pMalloc;
! 		CoGetMalloc(1, &pMalloc);
! 		if(pMalloc)
! 		{
! 			(pMalloc->Free)(pwsz);
! 			(pMalloc->Release)();
! 		}
! 	} else {
! 		return E_FAIL;
  	}
      
      /*
      [HKEY_CLASSES_ROOT\CLSID\{$CLSID}\InprocServer32]
--- 102,166 ----
      // until someone has time to figure out how to debug this.   
      // Jeffrey Altman - 2 Oct 2005
  
!     if (!nCMRefCount && !nSERefCount && !nICRefCount && !nTPRefCount && !nXPRefCount)
! 	return S_OK;
  #endif
!     return S_FALSE;
  }
  
  int WideCharToLocal(LPTSTR pLocal, LPCWSTR pWide, DWORD dwChars)
  {
!     *pLocal = 0;
!     WideCharToMultiByte( CP_ACP, 0, pWide, -1, pLocal, dwChars, NULL, NULL);
!     return lstrlen(pLocal);
  }
  
  LRESULT DoRegCLSID(HKEY hKey,PTCHAR szSubKey,PTCHAR szData,PTCHAR szValue=NULL)
  {
!     DWORD    dwDisp;
!     LRESULT  lResult;
!     HKEY     thKey;
!     lResult = RegCreateKeyEx(hKey, szSubKey, 0, NULL,
! 			      REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
! 			      &thKey, &dwDisp);
!     if(NOERROR == lResult)
!     {
! 	lResult = RegSetValueEx(thKey, szValue, 0, REG_SZ,
! 				 (LPBYTE)szData, (lstrlen(szData) + 1) 
! 				 * sizeof(TCHAR));
! 	RegCloseKey(thKey);
!     }
!     RegCloseKey(hKey);
!     return lResult;
  }
  
  // by exporting DllRegisterServer, you can use regsvr.exe
  STDAPI DllRegisterServer(void)
  {
!     HKEY     hKey;
!     LRESULT  lResult;
!     DWORD    dwDisp;
!     TCHAR    szSubKey[MAX_PATH];
!     TCHAR    szCLSID[MAX_PATH];
      TCHAR    szModule[MAX_PATH];
      LPWSTR   pwsz;
!     AFX_MANAGE_STATE(AfxGetStaticModuleState());
!     COleObjectFactory::UpdateRegistryAll();
  
!     StringFromIID(IID_IShellExt, &pwsz);
!     if(pwsz)
!     {
! 	WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
! 	LPMALLOC pMalloc;
! 	CoGetMalloc(1, &pMalloc);
! 	if(pMalloc)
  	{
! 	    (pMalloc->Free)(pwsz);
! 	    (pMalloc->Release)();
  	}
+     } else {
+ 	return E_FAIL;
+     }
      
      /*
      [HKEY_CLASSES_ROOT\CLSID\{$CLSID}\InprocServer32]
***************
*** 168,192 ****
      "ThreadingModel"="Apartment"
      */
      HMODULE hModule=GetModuleHandle("afs_shl_ext.dll");
! 	DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
! 	wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
! 	if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szModule))!=NOERROR)
! 		return lResult;
! 
! 	wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
! 	if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,"Apartment","ThreadingModel"))!=NOERROR)
! 		return lResult;
  
      /*
      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\AFS Client Shell Extension]
      @="{EA3775F2-28BE-11D3-9C8D-00105A24ED29}"
      */
  
! 	wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
! 	if ((lResult=DoRegCLSID(HKEY_LOCAL_MACHINE,szSubKey,szCLSID))!=NOERROR)
! 		return lResult;
  	
! 	//If running on NT, register the extension as approved.
      /*
      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
      "{$(CLSID)}"="AFS Client Shell Extension"
--- 168,192 ----
      "ThreadingModel"="Apartment"
      */
      HMODULE hModule=GetModuleHandle("afs_shl_ext.dll");
!     DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
!     wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
!     if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szModule))!=NOERROR)
! 	return lResult;
! 
!     wsprintf(szSubKey, TEXT("CLSID\\%s\\InprocServer32"),szCLSID);
!     if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,"Apartment","ThreadingModel"))!=NOERROR)
! 	return lResult;
  
      /*
      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\AFS Client Shell Extension]
      @="{EA3775F2-28BE-11D3-9C8D-00105A24ED29}"
      */
  
!     wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
!     if ((lResult=DoRegCLSID(HKEY_LOCAL_MACHINE,szSubKey,szCLSID))!=NOERROR)
! 	return lResult;
  	
!     //If running on NT, register the extension as approved.
      /*
      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
      "{$(CLSID)}"="AFS Client Shell Extension"
***************
*** 218,347 ****
      @="{$(CLSID)}"
      */
  
! 	wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
! 	if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szCLSID))!=NOERROR)
! 		return lResult;
  
  	
! 	/* Below needs to be merged with above */
! 
      wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
! 	lResult = RegCreateKeyEx(  HKEY_LOCAL_MACHINE,
! 							szSubKey,
! 							0,
! 							NULL,
! 							REG_OPTION_NON_VOLATILE,
! 							KEY_WRITE,
! 							NULL,
! 							&hKey,
! 							&dwDisp);
  
! 	if(NOERROR == lResult)
! 	{
          //Create the value string.
! 		lResult = RegSetValueEx(   hKey,
! 								NULL,
! 								0,
! 								REG_SZ,
! 								(LPBYTE)szCLSID,
! 								(lstrlen(szCLSID) + 1) * sizeof(TCHAR));
! 		RegCloseKey(hKey);
! 	}
! 	else
! 		return SELFREG_E_CLASS;
  
! 	//If running on NT, register the extension as approved.
! 	osvi.dwOSVersionInfoSize = sizeof(osvi);
! 	GetVersionEx(&osvi);
! 	if(VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
  	{
! 		lstrcpy( szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
  
! 		lResult = RegCreateKeyEx(  HKEY_LOCAL_MACHINE,
! 								szSubKey,
! 								0,
! 								NULL,
! 								REG_OPTION_NON_VOLATILE,
! 								KEY_WRITE,
! 								NULL,
! 								&hKey,
! 								&dwDisp);
! 
! 		if(NOERROR == lResult)
! 		{
! 			TCHAR szData[MAX_PATH];
! 
! 		//Create the value string.
! 			lstrcpy(szData, STR_EXT_TITLE);
! 
! 			lResult = RegSetValueEx(   hKey,
! 									szCLSID,
! 									0,
! 									REG_SZ,
! 									(LPBYTE)szData,
! 									(lstrlen(szData) + 1) * sizeof(TCHAR));
! 	      
! 			RegCloseKey(hKey);
! 		} else
! 			return SELFREG_E_CLASS;
! 	}
! 	return S_OK;
  }
  
  //returnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, keyName, 0, KEY_ALL_ACCESS, &registryKey);
  
  LRESULT DoValueDelete(HKEY hKey,PTCHAR pszSubKey,PTCHAR szValue=NULL)
  {
! 	LRESULT  lResult;
! 	HKEY     thKey;
! 	if (szValue==NULL) {
! 		lResult=RegDeleteKey(hKey, pszSubKey);
! 		return lResult;
! 	}
! 	lResult = RegOpenKeyEx( hKey,
! 				pszSubKey,
! 				0,
! 				KEY_ALL_ACCESS,
! 				&thKey);
! 	if(NOERROR == lResult)
! 	{
! 		lResult=RegDeleteValue(hKey, szValue);
! 		RegCloseKey(thKey);
! 	}
  	return lResult;
  }
  
  STDAPI DllUnregisterServer(void)
  {
! 	TCHAR    szSubKey[MAX_PATH];
! 	TCHAR    szCLSID[MAX_PATH];
! 	LPWSTR   pwsz;
! 	AFX_MANAGE_STATE(AfxGetStaticModuleState());
! 	COleObjectFactory::UpdateRegistryAll(FALSE);
! 	StringFromIID(IID_IShellExt, &pwsz);
! 	if(pwsz)
  	{
! 		WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
! 		LPMALLOC pMalloc;
! 		CoGetMalloc(1, &pMalloc);
! 		if(pMalloc)
! 		{
! 			(pMalloc->Free)(pwsz);
! 			(pMalloc->Release)();
! 		}
! 	} else {
! 		return E_FAIL;
  	}
! 	wsprintf(szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
! 	DoValueDelete(HKEY_LOCAL_MACHINE,szSubKey,szCLSID);
! 	wsprintf(szSubKey, TEXT("*\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
! 	DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
! 	wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
! 	DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
! 	wsprintf(szSubKey, TEXT("Folder\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
! 	DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
! 	wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
! 	DoValueDelete(HKEY_LOCAL_MACHINE, szSubKey);
! 	return S_OK;
! }
  
--- 218,346 ----
      @="{$(CLSID)}"
      */
  
!     wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
!     if ((lResult=DoRegCLSID(HKEY_CLASSES_ROOT,szSubKey,szCLSID))!=NOERROR)
! 	return lResult;
  
  	
!     /* Below needs to be merged with above */
      wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
!     lResult = RegCreateKeyEx(  HKEY_LOCAL_MACHINE,
! 			      szSubKey,
! 			      0,
! 			      NULL,
! 			      REG_OPTION_NON_VOLATILE,
! 			      KEY_WRITE,
! 			      NULL,
! 			      &hKey,
! 			      &dwDisp);
  
!     if(NOERROR == lResult)
!     {
          //Create the value string.
! 	lResult = RegSetValueEx( hKey,
! 				 NULL,
! 				 0,
! 				 REG_SZ,
! 				 (LPBYTE)szCLSID,
! 				 (lstrlen(szCLSID) + 1) * sizeof(TCHAR));
! 	RegCloseKey(hKey);
!     }
!     else
! 	return SELFREG_E_CLASS;
  
!     //If running on NT, register the extension as approved.
!     osvi.dwOSVersionInfoSize = sizeof(osvi);
!     GetVersionEx(&osvi);
!     if(VER_PLATFORM_WIN32_NT == osvi.dwPlatformId)
!     {
! 	lstrcpy( szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
! 
! 	lResult = RegCreateKeyEx( HKEY_LOCAL_MACHINE,
! 				  szSubKey,
! 				  0,
! 				  NULL,
! 				  REG_OPTION_NON_VOLATILE,
! 				  KEY_WRITE,
! 				  NULL,
! 				  &hKey,
! 				  &dwDisp);
! 
! 	if(NOERROR == lResult)
  	{
! 	    TCHAR szData[MAX_PATH];
  
! 	    //Create the value string.
! 	    lstrcpy(szData, STR_EXT_TITLE);
! 
! 	    lResult = RegSetValueEx( hKey,
! 				     szCLSID,
! 				     0,
! 				     REG_SZ,
! 				     (LPBYTE)szData,
! 				     (lstrlen(szData) + 1) * sizeof(TCHAR));
! 
! 	    RegCloseKey(hKey);
! 	} else
! 	    return SELFREG_E_CLASS;
!     }	
!     return S_OK;
  }
  
  //returnValue = RegOpenKeyEx (HKEY_CLASSES_ROOT, keyName, 0, KEY_ALL_ACCESS, &registryKey);
  
  LRESULT DoValueDelete(HKEY hKey,PTCHAR pszSubKey,PTCHAR szValue=NULL)
  {
!     LRESULT  lResult;
!     HKEY     thKey;
!     if (szValue==NULL) {
! 	lResult=RegDeleteKey(hKey, pszSubKey);
  	return lResult;
+     }
+     lResult = RegOpenKeyEx( hKey,
+ 			    pszSubKey,
+ 			    0,
+ 			    KEY_ALL_ACCESS,
+ 			    &thKey);
+     if(NOERROR == lResult)
+     {
+ 	lResult=RegDeleteValue(hKey, szValue);
+ 	RegCloseKey(thKey);
+     }
+     return lResult;
  }
  
  STDAPI DllUnregisterServer(void)
  {
!     TCHAR    szSubKey[MAX_PATH];
!     TCHAR    szCLSID[MAX_PATH];
!     LPWSTR   pwsz;
!     AFX_MANAGE_STATE(AfxGetStaticModuleState());
!     COleObjectFactory::UpdateRegistryAll(FALSE);
!     StringFromIID(IID_IShellExt, &pwsz);
!     if(pwsz)
!     {
! 	WideCharToMultiByte( CP_ACP, 0,pwsz, -1, szCLSID, sizeof(szCLSID), NULL, NULL);
! 	LPMALLOC pMalloc;
! 	CoGetMalloc(1, &pMalloc);
! 	if(pMalloc)
  	{
! 	    (pMalloc->Free)(pwsz);
! 	    (pMalloc->Release)();
  	}
!     } else {
! 	return E_FAIL;
!     }
!     wsprintf(szSubKey, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"));
!     DoValueDelete(HKEY_LOCAL_MACHINE,szSubKey,szCLSID);
!     wsprintf(szSubKey, TEXT("*\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
!     DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
!     wsprintf(szSubKey, TEXT("Folder\\shellex\\{00021500-0000-0000-C000-000000000046}"));
!     DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
!     wsprintf(szSubKey, TEXT("Folder\\shellex\\ContextMenuHandlers\\%s"),STR_EXT_TITLE);
!     DoValueDelete(HKEY_CLASSES_ROOT, szSubKey);
!     wsprintf(szSubKey, TEXT("%s\\%s"), STR_REG_PATH, STR_EXT_TITLE);
!     DoValueDelete(HKEY_LOCAL_MACHINE, szSubKey);
!     return S_OK;
! }	
  
Index: openafs/src/WINNT/client_exp/gui2fs.cpp
diff -c openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.1 openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.2
*** openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.1	Thu Aug 31 07:35:12 2006
--- openafs/src/WINNT/client_exp/gui2fs.cpp	Mon Feb 12 22:09:20 2007
***************
*** 1304,1310 ****
--- 1304,1312 ----
      register char *cellName;
      char localCellName[128];
      struct afsconf_cell info;
+ #if 0
      struct vldbentry vldbEntry;
+ #endif
      struct ViceIoctl blob;
      char * parent;
      char path[1024] = "";
Index: openafs/src/WINNT/client_exp/msgs.cpp
diff -c openafs/src/WINNT/client_exp/msgs.cpp:1.2 openafs/src/WINNT/client_exp/msgs.cpp:1.2.32.1
*** openafs/src/WINNT/client_exp/msgs.cpp:1.2	Sat Nov  4 05:02:53 2000
--- openafs/src/WINNT/client_exp/msgs.cpp	Tue Jan 30 07:42:43 2007
***************
*** 21,416 ****
  
  
  /* 
!         ShowMessageBox:
! 		
!  		This function takes three main arguements, the stringtable ID, the button types
!  		to be displayed (default = MB_OK) and the help table reference (default = 0, no 
!  		help) and then a variable amount of arguements. The variable list does not need 
!  		a special ending flag/character/number. The list is read only as needed, which 
!  		is defined by the string table and the presence of any "%X" characters, where X 
!  		is one of the printf format types. The order of the variable list MUST 
!  		correspond to the order of types in the string table entry. If the string table 
!  		calls for INT INT UINT CHAR* DOUBLE, then the arguement list had better be INT 
!  		INT UINT CHAR* DOUBLE or else there will be serious problems (stack will be 
!  		misread, general protection faults, garbage output, and other errors).
!  		
!  		This function takes the arguements passed in the list and inserts them by 
!  		parsing and pszcut/pszpaste the string table entry to add all the arguements passed 
!  		in. This allows for any generic	message to be created.
!  		
! 		%i,d 	= Integer
! 		%u 		= unsigned int
! 		%x,X    = Hex (takes an integer arguement, pszconverts it)
! 		%g,f,e	= Double
! 		%s		= String (char*)
! 		%l
! 			d	= Long int
! 			x	= long hex
! 		%c		= character (one)
! 		%a		= String Table Ref. (UINT)
! 		%o		= CString object (prints the string of the object)
! 		default = prints out string so far, with error message attached at place of error.
!         
!         Return type is the button pressed in the message box.
   
  */
  
  UINT ShowMessageBox (UINT Id, UINT Button, UINT Help, ...) {
  
! 	CString 
! 		 temp;
! 	char *pszstring, 
! 		 *pszpaste, 
! 		 *pszcut, 
! 		 *pszdone,
! 	  	 *pszconvert;
! 	char
! 		 chread;
! 	va_list 
! 		 params;
! 	int 
! 	  	 x;
! 	           
! 	pszconvert = new char[255];    	
! 	va_start(params, Help);
! 	LoadString (temp, Id);
! 	pszstring = temp.GetBuffer(512);
! 	strcpy(pszstring,pszstring);
! 	temp.ReleaseBuffer();
! 			// Look and see - is there a need to insert chars (95% of the time, there won't)
!     		if (!strstr(pszstring, "%")) {
! 			delete pszconvert;
! 			return AfxMessageBox(pszstring, Button, Help);
! 		}   
! 		
! 	x = strcspn(pszstring, "%");
! 	pszdone = new char[512];
! 	pszcut = new char[512];
! 	pszpaste = new char[512];
! 	strcpy(pszcut, &pszstring[x+2]);
! 	strncpy(pszpaste, pszstring, x);
! 	pszpaste[x] = '\0';
! 	chread = pszstring[x+1];
! 	
! 		for ( ; ; ) {
! 
! 				switch (chread) { 
! 					case	'i' :
! 					case	'd' :
! 								{ 	    
! 								int anint = va_arg(params, int);
! 								_itoa( anint, pszconvert, 10);
! 								break;
! 								}
! 					case	'u' :
! 								{	
! 								UINT anuint = va_arg(params, UINT);
! 								_itoa( anuint, pszconvert, 10);
! 								break;
! 								}
! 					
! 					case	'x' :
! 					case	'X' :   
! 								{
! 								int ahex = va_arg(params, int);
! 								_itoa( ahex, pszconvert, 16);
! 								break;
! 								}
! 					case	'g' :
! 					case	'f' :
! 					case	'e' :   
! 								{
! 								double adbl = va_arg(params, double);
! 								_gcvt( adbl, 10, pszconvert);
! 								break;
! 								}
! 					case	's' :	
! 								{
! 								char *pStr = va_arg(params, char*);
! 								ASSERT(strlen(pStr) <= 255);
! 								strcpy(pszconvert, pStr);
! 					        	break;
! 					        	}
! 					case	'l' :	
! 								{
! 								chread = pszdone[x+2];
! 									switch(chread) {
! 										case	'x'	:
! 													{
! 													long int alhex = va_arg(params, long int);
! 													_ltoa(alhex, pszconvert, 16);
! 													strcpy(pszcut, &pszcut[1]);
! 													break;
! 													}
! 										case 	'd'	:
! 										default 	:
! 												    {
! 													long int along = va_arg(params, long int);
! 													_ltoa( along, pszconvert, 10);
! 													// For the L, there will be one character after it,
! 													//   so move ahead another letter
! 													strcpy(pszcut, &pszcut[1]);
! 													break;
! 													}
! 									}
! 								break;
! 								}
! 
! 					case	'c' :	
! 								{
! 								int letter = va_arg(params, int);
!                                 pszconvert[0] = (char)letter;
!                                 pszconvert[1] = '\0'; 
! 								break;
! 								}
! 					case 	'a'	:
! 								{
! 								CString zeta;
! 								char* lsc;
! 								UINT ls = va_arg(params, UINT);
! 								LoadString (zeta, ls);
! 								lsc = zeta.GetBuffer(255);
! 								strcpy(pszconvert, lsc);
! 								zeta.ReleaseBuffer();
! 								break;
! 								}
! 					case	'o'	:
! 								{
! 								CString get = va_arg(params, CString);
! 								char* ex = get.GetBuffer(255);
! 								strcpy(pszconvert,ex);
! 								get.ReleaseBuffer();
! 								break;
! 								}
! 					default 	:
! 								{	
! 								strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
! 								delete pszdone;
! 								pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 								strcpy(pszdone, pszpaste);
! 								strcat(pszdone, pszconvert);
! 								strcat(pszdone, pszcut);
! 								AfxMessageBox(pszdone, Button, Help);
! 								delete pszcut;
! 								delete pszpaste;
! 								delete pszconvert;
! 								delete pszdone;
! 								ASSERT(FALSE);
! 								return 0;
! 								}		
! 				} // case
! 	        
! 	        delete pszdone;
! 			pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 			strcpy(pszdone, pszpaste);
! 			strcat(pszdone, pszconvert);
! 			strcat(pszdone, pszcut);
! 			// Now pszdone holds the entire message.
! 			// Check to see if there are more insertions to be made or not
  	
! 				if (!strstr(pszdone, "%"))	{
! 					UINT rt_type = AfxMessageBox(pszdone, Button, Help);
! 					delete pszcut;
! 					delete pszpaste;
! 					delete pszconvert;
! 					delete pszdone;
! 					return rt_type;
! 				} // if
! 				
! 			// there are more insertions to make, prepare the strings to use.
! 			x = strcspn(pszdone, "%");
! 			strcpy(pszcut, &pszdone[x+2]);
! 			strncpy(pszpaste, pszdone, x); 
!             pszpaste[x] = '\0';
!             chread = pszdone[x+1];
  	
! 		} // for
! 	ASSERT(FALSE);		
! 	return 0;
  
  } // ShowMessageBox
  
  CString GetMessageString(UINT Id, ...)
  {
! 	CString 
! 		 temp;
! 	char *pszstring, 
! 		 *pszpaste, 
! 		 *pszcut, 
! 		 *pszdone,
! 	  	 *pszconvert;
! 	char
! 		 chread;
! 	va_list 
! 		 params;
! 	int 
! 	  	 x;
! 	CString strMsg;
! 
! 	pszconvert = new char[255];    	
! 	va_start(params, Id);
! 	LoadString (temp, Id);
! 	pszstring = temp.GetBuffer(512);
! 	strcpy(pszconvert,pszstring);
! 	temp.ReleaseBuffer();
! 
! 	// Look and see - is there a need to insert chars (95% of the time, there won't)
!    	if (!strstr(pszstring, "%")) {
! 		strMsg = pszconvert;
  		delete pszconvert;
  		return strMsg;
! 	}   
! 		
! 	x = strcspn(pszstring, "%");
! 	pszdone = new char[512];
! 	pszcut = new char[512];
! 	pszpaste = new char[512];
! 	strcpy(pszcut, &pszstring[x+2]);
! 	strncpy(pszpaste, pszstring, x);
! 	pszpaste[x] = '\0';
! 	chread = pszstring[x+1];
! 	
! 		for ( ; ; ) {
  
! 				switch (chread) { 
! 					case	'i' :
! 					case	'd' :
! 								{ 	    
! 								int anint = va_arg(params, int);
! 								_itoa( anint, pszconvert, 10);
! 								break;
! 								}
! 					case	'u' :
! 								{	
! 								UINT anuint = va_arg(params, UINT);
! 								_itoa( anuint, pszconvert, 10);
! 								break;
! 								}
! 					
! 					case	'x' :
! 					case	'X' :   
! 								{
! 								int ahex = va_arg(params, int);
! 								_itoa( ahex, pszconvert, 16);
! 								break;
! 								}
! 					case	'g' :
! 					case	'f' :
! 					case	'e' :   
! 								{
! 								double adbl = va_arg(params, double);
! 								_gcvt( adbl, 10, pszconvert);
! 								break;
! 								}
! 					case	's' :	
! 								{
! 								char *pStr = va_arg(params, char*);
! 								ASSERT(strlen(pStr) <= 255);
! 								strcpy(pszconvert, pStr);
! 					        	break;
! 					        	}
! 					case	'l' :	
! 								{
! 								chread = pszdone[x+2];
! 									switch(chread) {
! 										case	'x'	:
! 													{
! 													long int alhex = va_arg(params, long int);
! 													_ltoa(alhex, pszconvert, 16);
! 													strcpy(pszcut, &pszcut[1]);
! 													break;
! 													}
! 										case 	'd'	:
! 										default 	:
! 												    {
! 													long int along = va_arg(params, long int);
! 													_ltoa( along, pszconvert, 10);
! 													// For the L, there will be one character after it,
! 													//   so move ahead another letter
! 													strcpy(pszcut, &pszcut[1]);
! 													break;
! 													}
! 									}
! 								break;
! 								}
! 
! 					case	'c' :	
! 								{
! 								int letter = va_arg(params, int);
!                                 pszconvert[0] = (char)letter;
!                                 pszconvert[1] = '\0'; 
! 								break;
! 								}
! 					case 	'a'	:
! 								{
! 								CString zeta;
! 								char* lsc;
! 								UINT ls = va_arg(params, UINT);
! 								LoadString (zeta, ls);
! 								lsc = zeta.GetBuffer(255);
! 								strcpy(pszconvert, lsc);
! 								zeta.ReleaseBuffer();
! 								break;
! 								}
! 					case	'o'	:
! 								{
! 								CString get = va_arg(params, CString);
! 								char* ex = get.GetBuffer(255);
! 								strcpy(pszconvert,ex);
! 								get.ReleaseBuffer();
! 								break;
! 								}
! 					default 	:
! 								{	
! 								strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
! 								delete pszdone;
! 								pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 								strcpy(pszdone, pszpaste);
! 								strcat(pszdone, pszconvert);
! 								strcat(pszdone, pszcut);
! 								strMsg = pszdone;
! 								delete pszcut;
! 								delete pszpaste;
! 								delete pszconvert;
! 								delete pszdone;
! 								ASSERT(FALSE);
! 								return strMsg;
! 								}		
! 				} // case
! 	        
! 	        delete pszdone;
! 			pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 			strcpy(pszdone, pszpaste);
! 			strcat(pszdone, pszconvert);
! 			strcat(pszdone, pszcut);
! 			// Now pszdone holds the entire message.
! 			// Check to see if there are more insertions to be made or not
  	
! 				if (!strstr(pszdone, "%"))	{
! 					strMsg = pszdone;
! 					delete pszcut;
! 					delete pszpaste;
! 					delete pszconvert;
! 					delete pszdone;
! 					return strMsg;
! 				} // if
! 				
! 			// there are more insertions to make, prepare the strings to use.
! 			x = strcspn(pszdone, "%");
! 			strcpy(pszcut, &pszdone[x+2]);
! 			strncpy(pszpaste, pszdone, x); 
!             pszpaste[x] = '\0';
!             chread = pszdone[x+1];
  	
! 		} // for
! 	ASSERT(FALSE);		
! 	return strMsg;
  }
  
  void LoadString (CString &Str, UINT id)
  {
!    TCHAR szString[ 256 ];
!    GetString (szString, id);
!    Str = szString;
  }
  
--- 21,408 ----
  
  
  /* 
!   ShowMessageBox:
! 
!   This function takes three main arguements, the stringtable ID, the button types
!   to be displayed (default = MB_OK) and the help table reference (default = 0, no 
!   help) and then a variable amount of arguements. The variable list does not need 
!   a special ending flag/character/number. The list is read only as needed, which 
!   is defined by the string table and the presence of any "%X" characters, where X 
!   is one of the printf format types. The order of the variable list MUST 
!   correspond to the order of types in the string table entry. If the string table 
!   calls for INT INT UINT CHAR* DOUBLE, then the arguement list had better be INT 
!   INT UINT CHAR* DOUBLE or else there will be serious problems (stack will be 
!   misread, general protection faults, garbage output, and other errors).
! 
!   This function takes the arguements passed in the list and inserts them by 
!   parsing and pszcut/pszpaste the string table entry to add all the arguements passed 
!   in. This allows for any generic	message to be created.
! 
!   %i,d 	  = Integer
!   %u 	  = unsigned int
!   %x,X    = Hex (takes an integer arguement, pszconverts it)
!   %g,f,e  = Double
!   %s	  = String (char*)
!   %l
!   d       = Long int
!   x	  = long hex
!   %c	  = character (one)
!   %a	  = String Table Ref. (UINT)
!   %o	  = CString object (prints the string of the object)
!   default = prints out string so far, with error message attached at place of error.
! 
!   Return type is the button pressed in the message box.
   
  */
  
  UINT ShowMessageBox (UINT Id, UINT Button, UINT Help, ...) {
  
!     CString temp;
!     char *pszstring, 
!     *pszpaste, 
!     *pszcut, 
!     *pszdone,
!     *pszconvert;
!     char chread;
!     va_list params;
!     int x;
! 
!     pszconvert = new char[255];    	
!     va_start(params, Help);
!     LoadString (temp, Id);
!     pszstring = temp.GetBuffer(512);
!     strcpy(pszstring,pszstring);
!     temp.ReleaseBuffer();
!     // Look and see - is there a need to insert chars (95% of the time, there won't)
!     if (!strstr(pszstring, "%")) {
! 	delete pszconvert;
! 	return AfxMessageBox(pszstring, Button, Help);
!     }   
! 
!     x = strcspn(pszstring, "%");
!     pszdone = new char[512];
!     pszcut = new char[512];
!     pszpaste = new char[512];
!     strcpy(pszcut, &pszstring[x+2]);
!     strncpy(pszpaste, pszstring, x);
!     pszpaste[x] = '\0';
!     chread = pszstring[x+1];
! 
!     for ( ; ; ) {
! 
! 	switch (chread) { 
! 	case	'i' :
! 	case	'd' :
! 	{ 	    
! 	    int anint = va_arg(params, int);
! 	    _itoa( anint, pszconvert, 10);
! 	    break;
! 	}
! 	case	'u' :
! 	{	
! 	    UINT anuint = va_arg(params, UINT);
! 	    _itoa( anuint, pszconvert, 10);
! 	    break;
! 	}
! 
! 	case	'x' :
! 	case	'X' :   
! 	{
! 	    int ahex = va_arg(params, int);
! 	    _itoa( ahex, pszconvert, 16);
! 	    break;
! 	}
! 	case	'g' :
! 	case	'f' :
! 	case	'e' :   
! 	{
! 	    double adbl = va_arg(params, double);
! 	    _gcvt( adbl, 10, pszconvert);
! 	    break;
! 	}
! 	case	's' :	
! 	{
! 	    char *pStr = va_arg(params, char*);
! 	    ASSERT(strlen(pStr) <= 255);
! 	    strcpy(pszconvert, pStr);
! 	    break;
! 	}
! 	case	'l' :	
! 	{
! 	    chread = pszdone[x+2];
! 	    switch(chread) {
! 	    case	'x'	:
! 	    {
! 		long int alhex = va_arg(params, long int);
! 		_ltoa(alhex, pszconvert, 16);
! 		strcpy(pszcut, &pszcut[1]);
! 		break;
! 	    }
! 	    case 	'd'	:
! 		default 	:
! 		{
! 		    long int along = va_arg(params, long int);
! 		    _ltoa( along, pszconvert, 10);
! 		    // For the L, there will be one character after it,
! 		    //   so move ahead another letter
! 		    strcpy(pszcut, &pszcut[1]);
! 		    break;
! 		}
! 	    }
! 	    break;
! 	}
! 
! 	case	'c' :	
! 	{
! 	    int letter = va_arg(params, int);
! 	    pszconvert[0] = (char)letter;
! 	    pszconvert[1] = '\0'; 
! 	    break;
! 	}
! 	case 	'a'	:
! 	{
! 	    CString zeta;
! 	    char* lsc;
! 	    UINT ls = va_arg(params, UINT);
! 	    LoadString (zeta, ls);
! 	    lsc = zeta.GetBuffer(255);
! 	    strcpy(pszconvert, lsc);
! 	    zeta.ReleaseBuffer();
! 	    break;
! 	}
! 	case	'o'	:
! 	{
! 	    CString get = va_arg(params, CString);
! 	    char* ex = get.GetBuffer(255);
! 	    strcpy(pszconvert,ex);
! 	    get.ReleaseBuffer();
! 	    break;
! 	}
! 	    default 	:
! 	    {	
! 		strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
! 		delete pszdone;
! 		pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 		strcpy(pszdone, pszpaste);
! 		strcat(pszdone, pszconvert);
! 		strcat(pszdone, pszcut);
! 		AfxMessageBox(pszdone, Button, Help);
! 		delete pszcut;
! 		delete pszpaste;
! 		delete pszconvert;
! 		delete pszdone;
! 		ASSERT(FALSE);
! 		return 0;
! 	    }		
! 	} // case
! 
! 	delete pszdone;
! 	pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 	strcpy(pszdone, pszpaste);
! 	strcat(pszdone, pszconvert);
! 	strcat(pszdone, pszcut);
! 	// Now pszdone holds the entire message.
! 	// Check to see if there are more insertions to be made or not
  	
! 	if (!strstr(pszdone, "%"))	{
! 	    UINT rt_type = AfxMessageBox(pszdone, Button, Help);
! 	    delete pszcut;
! 	    delete pszpaste;
! 	    delete pszconvert;
! 	    delete pszdone;
! 	    return rt_type;
! 	} // if
! 
! 	// there are more insertions to make, prepare the strings to use.
! 	x = strcspn(pszdone, "%");
! 	strcpy(pszcut, &pszdone[x+2]);
! 	strncpy(pszpaste, pszdone, x); 
! 	pszpaste[x] = '\0';
! 	chread = pszdone[x+1];
  	
!     } // for
!     ASSERT(FALSE);		
!     return 0;
  
  } // ShowMessageBox
  
  CString GetMessageString(UINT Id, ...)
  {
!     CString temp;
!     char *pszstring, 
!     *pszpaste, 
!     *pszcut, 
!     *pszdone,
!     *pszconvert;
!     char chread;
!     va_list params;
!     int x;
!     CString strMsg;
! 
!     pszconvert = new char[255];    	
!     va_start(params, Id);
!     LoadString (temp, Id);
!     pszstring = temp.GetBuffer(512);
!     strcpy(pszconvert,pszstring);
!     temp.ReleaseBuffer();
! 
!     // Look and see - is there a need to insert chars (95% of the time, there won't)
!     if (!strstr(pszstring, "%")) {
! 	strMsg = pszconvert;
! 	delete pszconvert;
! 	return strMsg;
!     }   
! 
!     x = strcspn(pszstring, "%");
!     pszdone = new char[512];
!     pszcut = new char[512];
!     pszpaste = new char[512];
!     strcpy(pszcut, &pszstring[x+2]);
!     strncpy(pszpaste, pszstring, x);
!     pszpaste[x] = '\0';
!     chread = pszstring[x+1];
! 
!     for ( ; ; ) {
! 
! 	switch (chread) { 
! 	case	'i' :
! 	case	'd' :
! 	{ 	    
! 	    int anint = va_arg(params, int);
! 	    _itoa( anint, pszconvert, 10);
! 	    break;
! 	}
! 	case	'u' :
! 	{	
! 	    UINT anuint = va_arg(params, UINT);
! 	    _itoa( anuint, pszconvert, 10);
! 	    break;
! 	}
! 
! 	case	'x' :
! 	case	'X' :   
! 	{
! 	    int ahex = va_arg(params, int);
! 	    _itoa( ahex, pszconvert, 16);
! 	    break;
! 	}
! 	case	'g' :
! 	case	'f' :
! 	case	'e' :   
! 	{
! 	    double adbl = va_arg(params, double);
! 	    _gcvt( adbl, 10, pszconvert);
! 	    break;
! 	}
! 	case	's' :	
! 	{
! 	    char *pStr = va_arg(params, char*);
! 	    ASSERT(strlen(pStr) <= 255);
! 	    strcpy(pszconvert, pStr);
! 	    break;
! 	}
! 	case	'l' :	
! 	{
! 	    chread = pszdone[x+2];
! 	    switch(chread) {
! 	    case	'x'	:
! 	    {
! 		long int alhex = va_arg(params, long int);
! 		_ltoa(alhex, pszconvert, 16);
! 		strcpy(pszcut, &pszcut[1]);
! 		break;
! 	    }
! 	    case 	'd'	:
! 		default 	:
! 		{
! 		    long int along = va_arg(params, long int);
! 		    _ltoa( along, pszconvert, 10);
! 		    // For the L, there will be one character after it,
! 		    //   so move ahead another letter
! 		    strcpy(pszcut, &pszcut[1]);
! 		    break;
! 		}
! 	    }
! 	    break;
! 	}	
! 
! 	case	'c' :	
! 	{
! 	    int letter = va_arg(params, int);
! 	    pszconvert[0] = (char)letter;
! 	    pszconvert[1] = '\0'; 
! 	    break;
! 	}
! 	case 	'a'	:
! 	{
! 	    CString zeta;
! 	    char* lsc;
! 	    UINT ls = va_arg(params, UINT);
! 	    LoadString (zeta, ls);
! 	    lsc = zeta.GetBuffer(255);
! 	    strcpy(pszconvert, lsc);
! 	    zeta.ReleaseBuffer();
! 	    break;
! 	}
! 	case	'o'	:
! 	{
! 	    CString get = va_arg(params, CString);
! 	    char* ex = get.GetBuffer(255);
! 	    strcpy(pszconvert,ex);
! 	    get.ReleaseBuffer();
! 	    break;
! 	}
! 	default:
! 	    {	
! 		strcpy(pszconvert, " Could not load message. Invalid %type in string table entry. ");
! 		delete pszdone;
! 		pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 		strcpy(pszdone, pszpaste);
! 		strcat(pszdone, pszconvert);
! 		strcat(pszdone, pszcut);
! 		strMsg = pszdone;
! 		delete pszcut;
! 		delete pszpaste;
  		delete pszconvert;
+ 		delete pszdone;
+ 		ASSERT(FALSE);
  		return strMsg;
! 	    }		
! 	} // case
  
! 	delete pszdone;
! 	pszdone = new char[strlen(pszpaste)+strlen(pszcut)+strlen(pszconvert)+5];
! 	strcpy(pszdone, pszpaste);
! 	strcat(pszdone, pszconvert);
! 	strcat(pszdone, pszcut);
! 	// Now pszdone holds the entire message.
! 	// Check to see if there are more insertions to be made or not
  	
! 	if (!strstr(pszdone, "%"))	{
! 	    strMsg = pszdone;
! 	    delete pszcut;
! 	    delete pszpaste;
! 	    delete pszconvert;
! 	    delete pszdone;
! 	    return strMsg;
! 	} // if
! 
! 	// there are more insertions to make, prepare the strings to use.
! 	x = strcspn(pszdone, "%");
! 	strcpy(pszcut, &pszdone[x+2]);
! 	strncpy(pszpaste, pszdone, x); 
! 	pszpaste[x] = '\0';
! 	chread = pszdone[x+1];
  	
!     } // for
!     ASSERT(FALSE);		
!     return strMsg;
  }
  
  void LoadString (CString &Str, UINT id)
  {
!     TCHAR szString[ 256 ];
!     GetString (szString, id);
!     Str = szString;
  }
  
Index: openafs/src/WINNT/client_exp/results_dlg.cpp
diff -c openafs/src/WINNT/client_exp/results_dlg.cpp:1.2 openafs/src/WINNT/client_exp/results_dlg.cpp:1.2.32.1
*** openafs/src/WINNT/client_exp/results_dlg.cpp:1.2	Sat Nov  4 05:02:54 2000
--- openafs/src/WINNT/client_exp/results_dlg.cpp	Tue Jan 30 07:42:43 2007
***************
*** 29,57 ****
  CResultsDlg::CResultsDlg(DWORD nHelpID, CWnd* pParent /*=NULL*/)
  	: CDialog()
  {
! 	InitModalIndirect (TaLocale_GetDialogResource (CResultsDlg::IDD), pParent);
  
! 	//{{AFX_DATA_INIT(CResultsDlg)
! 		// NOTE: the ClassWizard will add member initialization here
! 	//}}AFX_DATA_INIT
  
! 	m_nHelpID = nHelpID;
  }
  
  
  void CResultsDlg::DoDataExchange(CDataExchange* pDX)
  {
! 	CDialog::DoDataExchange(pDX);
! 	//{{AFX_DATA_MAP(CResultsDlg)
! 	DDX_Control(pDX, IDC_RESULTS_LABEL, m_ResultsLabel);
! 	DDX_Control(pDX, IDC_LIST, m_List);
! 	//}}AFX_DATA_MAP
  }
  
  BEGIN_MESSAGE_MAP(CResultsDlg, CDialog)
! 	//{{AFX_MSG_MAP(CResultsDlg)
! 	ON_BN_CLICKED(IDHELP, OnHelp)
! 	//}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  /////////////////////////////////////////////////////////////////////////////
--- 29,57 ----
  CResultsDlg::CResultsDlg(DWORD nHelpID, CWnd* pParent /*=NULL*/)
  	: CDialog()
  {
!     InitModalIndirect (TaLocale_GetDialogResource (CResultsDlg::IDD), pParent);
  
!     //{{AFX_DATA_INIT(CResultsDlg)
!     // NOTE: the ClassWizard will add member initialization here
!     //}}AFX_DATA_INIT
  
!     m_nHelpID = nHelpID;
  }
  
  
  void CResultsDlg::DoDataExchange(CDataExchange* pDX)
  {
!     CDialog::DoDataExchange(pDX);
!     //{{AFX_DATA_MAP(CResultsDlg)
!     DDX_Control(pDX, IDC_RESULTS_LABEL, m_ResultsLabel);
!     DDX_Control(pDX, IDC_LIST, m_List);
!     //}}AFX_DATA_MAP
  }
  
  BEGIN_MESSAGE_MAP(CResultsDlg, CDialog)
!     //{{AFX_MSG_MAP(CResultsDlg)
!     ON_BN_CLICKED(IDHELP, OnHelp)
!     //}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 59,96 ****
  
  BOOL CResultsDlg::OnInitDialog() 
  {
! 	CDialog::OnInitDialog();
  	
! 	SetWindowText(m_strDlgTitle);
! 	m_ResultsLabel.SetWindowText(m_strResultsTitle);
  
! 	ASSERT(m_Files.GetSize() == m_Results.GetSize());
  
! 	m_List.SetTabStops(118);
  
! 	for (int i = 0; i < m_Files.GetSize(); i++) {
! 		CString strItem = m_Files[i] + "\t" + m_Results[i];
! 		m_List.AddString(strItem);
! 	}
! 	
! 	return TRUE;  // return TRUE unless you set the focus to a control
! 	              // EXCEPTION: OCX Property Pages should return FALSE
  }
  
  void CResultsDlg::SetContents(const CString& strDlgTitle, const CString& strResultsTitle, const CStringArray& files, const CStringArray& results)
  {
! 	m_strDlgTitle = strDlgTitle;
! 	m_strResultsTitle = strResultsTitle;
  
! 	m_Files.RemoveAll();
! 	m_Files.Copy(files);
  
! 	m_Results.RemoveAll();
! 	m_Results.Copy(results);
  }
  
  void CResultsDlg::OnHelp() 
  {
! 	ShowHelp(m_hWnd, m_nHelpID);
  }
  
--- 59,96 ----
  
  BOOL CResultsDlg::OnInitDialog() 
  {
!     CDialog::OnInitDialog();
  	
!     SetWindowText(m_strDlgTitle);
!     m_ResultsLabel.SetWindowText(m_strResultsTitle);
  
!     ASSERT(m_Files.GetSize() == m_Results.GetSize());
  
!     m_List.SetTabStops(118);
  
!     for (int i = 0; i < m_Files.GetSize(); i++) {
! 	CString strItem = m_Files[i] + "\t" + m_Results[i];
! 	m_List.AddString(strItem);
!     }
! 
!     return TRUE;  // return TRUE unless you set the focus to a control
!     // EXCEPTION: OCX Property Pages should return FALSE
  }
  
  void CResultsDlg::SetContents(const CString& strDlgTitle, const CString& strResultsTitle, const CStringArray& files, const CStringArray& results)
  {
!     m_strDlgTitle = strDlgTitle;
!     m_strResultsTitle = strResultsTitle;
  
!     m_Files.RemoveAll();
!     m_Files.Copy(files);
  
!     m_Results.RemoveAll();
!     m_Results.Copy(results);
  }
  
  void CResultsDlg::OnHelp() 
  {
!     ShowHelp(m_hWnd, m_nHelpID);
  }
  
Index: openafs/src/WINNT/client_exp/shell_ext.cpp
diff -c openafs/src/WINNT/client_exp/shell_ext.cpp:1.12.4.1 openafs/src/WINNT/client_exp/shell_ext.cpp:1.12.4.2
*** openafs/src/WINNT/client_exp/shell_ext.cpp:1.12.4.1	Wed Sep  6 19:14:00 2006
--- openafs/src/WINNT/client_exp/shell_ext.cpp	Tue Jan 30 07:42:43 2007
***************
*** 49,60 ****
  
  static BOOL IsADir(const CString& strName)
  {
! 	struct _stat statbuf;
  
! 	if (_stat(strName, &statbuf) < 0)
! 		return FALSE;
  
! 	return statbuf.st_mode & _S_IFDIR;
  }
  
  /////////////////////////////////////////////////////////////////////////////
--- 49,60 ----
  
  static BOOL IsADir(const CString& strName)
  {
!     struct _stat statbuf;
  
!     if (_stat(strName, &statbuf) < 0)
! 	return FALSE;
  
!     return statbuf.st_mode & _S_IFDIR;
  }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 66,119 ****
  
  CShellExt::CShellExt()
  {
! 	HKEY NPKey;
! 	EnableAutomation();
! 	nCMRefCount++;
! 	HRESULT hr;
! 	UINT code;
! 	DWORD ShellOption,LSPsize,LSPtype;
! 	hr = SHGetMalloc(&m_pAlloc);
! 	m_bIsOverlayEnabled=FALSE;
! 	if (FAILED(hr))
! 		m_pAlloc = NULL;
! 	RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,0, KEY_QUERY_VALUE, &NPKey);
! 	LSPsize=sizeof(ShellOption);
! 	code=RegQueryValueEx(NPKey, "ShellOption", NULL,
! 			     &LSPtype, (LPBYTE)&ShellOption, &LSPsize);
! 	RegCloseKey (NPKey);
! 	m_bIsOverlayEnabled=((code==0) && (LSPtype==REG_DWORD) && ((ShellOption & OVERLAYENABLED)!=0));
! 	TRACE("Create CShellExt, Ref count %d/n",nCMRefCount);
  }
  
  CShellExt::~CShellExt()
  {
! 	if(m_pAlloc) m_pAlloc->Release();
! 	nCMRefCount--;
! 	TRACE("Destroy CShellExt, Ref count %d/n",nCMRefCount);
  }
  
  
  void CShellExt::OnFinalRelease()
  {
! 	// When the last reference for an automation object is released
! 	// OnFinalRelease is called.  The base class will automatically
! 	// deletes the object.  Add additional cleanup required for your
! 	// object before calling the base class.
  
! 	CCmdTarget::OnFinalRelease();
! }
  
  
  BEGIN_MESSAGE_MAP(CShellExt, CCmdTarget)
! 	//{{AFX_MSG_MAP(CShellExt)
! 		// NOTE - the ClassWizard will add and remove mapping macros here.
! 	//}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  BEGIN_DISPATCH_MAP(CShellExt, CCmdTarget)
! 	//{{AFX_DISPATCH_MAP(CShellExt)
! 		// NOTE - the ClassWizard will add and remove mapping macros here.
! 	//}}AFX_DISPATCH_MAP
  END_DISPATCH_MAP()
  
  // Note: we add support for IID_IShellExt to support typesafe binding
--- 66,120 ----
  
  CShellExt::CShellExt()
  {
!     HKEY NPKey;
!     EnableAutomation();
!     nCMRefCount++;
!     HRESULT hr;
!     UINT code;
!     DWORD ShellOption,LSPsize,LSPtype;
!     hr = SHGetMalloc(&m_pAlloc);
!     m_bIsOverlayEnabled=FALSE;
!     if (FAILED(hr))
! 	m_pAlloc = NULL;
!     RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,0, KEY_QUERY_VALUE, &NPKey);
!     LSPsize=sizeof(ShellOption);
!     code=RegQueryValueEx(NPKey, "ShellOption", NULL,
! 			  &LSPtype, (LPBYTE)&ShellOption, &LSPsize);
!     RegCloseKey (NPKey);
!     m_bIsOverlayEnabled=((code==0) && (LSPtype==REG_DWORD) && ((ShellOption & OVERLAYENABLED)!=0));
!     TRACE("Create CShellExt, Ref count %d/n",nCMRefCount);
  }
  
  CShellExt::~CShellExt()
  {
!     if(m_pAlloc) 
! 	m_pAlloc->Release();
!     nCMRefCount--;
!     TRACE("Destroy CShellExt, Ref count %d/n",nCMRefCount);
  }
  
  
  void CShellExt::OnFinalRelease()
  {
!     // When the last reference for an automation object is released
!     // OnFinalRelease is called.  The base class will automatically
!     // deletes the object.  Add additional cleanup required for your
!     // object before calling the base class.
  
!     CCmdTarget::OnFinalRelease();
! }	
  
  
  BEGIN_MESSAGE_MAP(CShellExt, CCmdTarget)
!     //{{AFX_MSG_MAP(CShellExt)
!     // NOTE - the ClassWizard will add and remove mapping macros here.
!     //}}AFX_MSG_MAP
  END_MESSAGE_MAP()
  
  BEGIN_DISPATCH_MAP(CShellExt, CCmdTarget)
!     //{{AFX_DISPATCH_MAP(CShellExt)
!     // NOTE - the ClassWizard will add and remove mapping macros here.
!     //}}AFX_DISPATCH_MAP
  END_DISPATCH_MAP()
  
  // Note: we add support for IID_IShellExt to support typesafe binding
***************
*** 133,144 ****
  #endif
  
  BEGIN_INTERFACE_MAP(CShellExt, CCmdTarget)
! 	INTERFACE_PART(CShellExt, IID_IShellExt, Dispatch)
      INTERFACE_PART(CShellExt, IID_IContextMenu, MenuExt)
      INTERFACE_PART(CShellExt, IID_IShellExtInit, ShellInit)
! 	INTERFACE_PART(CShellExt, IID_IShellIconOverlayIdentifier, IconExt)
! 	INTERFACE_PART(CShellExt, IID_IQueryInfo , ToolTipExt)
! 	INTERFACE_PART(CShellExt, IID_IPersistFile , PersistFileExt)
  END_INTERFACE_MAP()
  
  #ifndef _WIN64
--- 134,145 ----
  #endif
  
  BEGIN_INTERFACE_MAP(CShellExt, CCmdTarget)
!     INTERFACE_PART(CShellExt, IID_IShellExt, Dispatch)
      INTERFACE_PART(CShellExt, IID_IContextMenu, MenuExt)
      INTERFACE_PART(CShellExt, IID_IShellExtInit, ShellInit)
!     INTERFACE_PART(CShellExt, IID_IShellIconOverlayIdentifier, IconExt)
!     INTERFACE_PART(CShellExt, IID_IQueryInfo , ToolTipExt)
!     INTERFACE_PART(CShellExt, IID_IPersistFile , PersistFileExt)
  END_INTERFACE_MAP()
  
  #ifndef _WIN64
***************
*** 167,181 ****
  
  STDMETHODIMP_(ULONG) CShellExt::XMenuExt::AddRef(void)
  {
! 	return ++nCMRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XMenuExt::Release(void)
  {
! 	if (nCMRefCount > 0)
! 		nCMRefCount--;
  
! 	return nCMRefCount;
  }
  
  /////////////////////////////////////////////////////////////////////////////
--- 168,182 ----
  
  STDMETHODIMP_(ULONG) CShellExt::XMenuExt::AddRef(void)
  {
!     return ++nCMRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XMenuExt::Release(void)
  {
!     if (nCMRefCount > 0)
! 	nCMRefCount--;
  
!     return nCMRefCount;
  }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 186,292 ****
  {
      METHOD_PROLOGUE(CShellExt, MenuExt);
  
! 	// Don't add any menu items if we're being asked to deal with this file as a shortcut.
! 	if (uFlags & CMF_VERBSONLY)
! 		return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, (USHORT)0);
! 
! 	// Check to see if there's already an AFS menu here; if so, remove it
! 	int nItemsNow = GetMenuItemCount (hMenu);
! 	CString strAfsItemText = GetMessageString(IDS_AFS_ITEM);
! 	LPCTSTR pszAfsItemText = (LPCTSTR)strAfsItemText;
! 	for (int iItem = 0; iItem < nItemsNow; iItem++) {
! 		TCHAR szItemText[256];
! 		if (!GetMenuString (hMenu, iItem, szItemText, 256, MF_BYPOSITION))
! 			continue;
! 		if (!lstrcmp (szItemText, pszAfsItemText)) {
! 			DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 			continue;
! 		}
! 		if ((!lstrcmp(szItemText,"&Delete"))&&(pThis->m_bIsSymlink)) {	/*this is a symlink - don't present a delete menu!*/
! 			DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 			continue;
! 		}
! 		if ((!lstrcmp(szItemText,"Cu&t"))&&(pThis->m_bIsSymlink)) {		/*same for cut*/
! 			DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 			continue;
! 		}
  	}
! 	int indexShellMenu = 0;
  
! 	// Create the AFS submenu using the allowed ID's.
! 	HMENU hAfsMenu = CreatePopupMenu();
! 	int indexAfsMenu = 0;
! 
! 	// The Authentication item has been removed from the AFS menu because
! 	// there is now a tray icon to handle authentication.
! 	//
! 	//::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_AUTHENTICATION, GetMessageString(IDS_AUTHENTICATION_ITEM));
! 	
! 	// Only enable the ACL menu item if a single directory is selected
! 	int nSingleDirOnly = MF_GRAYED;
! 	if (pThis->m_bDirSelected && (pThis->m_astrFileNames.GetSize() == 1))
! 		nSingleDirOnly = MF_ENABLED;
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | nSingleDirOnly, idCmdFirst + IDM_ACL_SET, GetMessageString(IDS_ACLS_ITEM));
! 	
! 	// Volume/Partition submenu of the AFS submenu
! 	HMENU hVolPartMenu = CreatePopupMenu();
! 	int indexVolPartMenu = 0;
! 	::InsertMenu(hVolPartMenu, indexVolPartMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_VOLUME_PROPERTIES, GetMessageString(IDS_VOL_PART_PROPS_ITEM));
! 	::InsertMenu(hVolPartMenu, indexVolPartMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE, GetMessageString(IDS_VOL_PART_REFRESH_ITEM));
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hVolPartMenu, GetMessageString(IDS_VOL_PART_ITEM));
! 
! 	// Mount Point submenu of the AFS submenu
! 	HMENU hMountPointMenu = CreatePopupMenu();
! 	int indexMountPointMenu = 0;
!         int nMountPointSelected = MF_GRAYED;
!         for (int n = pThis->m_astrFileNames.GetSize() - 1 ; n >= 0; n--) {
!             if ( IsMountPoint(pThis->m_astrFileNames[n]) ) {
!                 nMountPointSelected = MF_ENABLED;
!                 break;
!             }
!         }
!         ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
! 	::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION | nMountPointSelected, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
!         ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hMountPointMenu, GetMessageString(IDS_MOUNT_POINT_ITEM));
! 
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH, GetMessageString(IDS_FLUSH_FILE_DIR_ITEM));	
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH_VOLUME, GetMessageString(IDS_FLUSH_VOLUME_ITEM));
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SHOW_SERVER, GetMessageString(IDS_SHOW_FILE_SERVERS_ITEM));
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SHOWCELL, GetMessageString(IDS_SHOW_CELL_ITEM));
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SERVER_STATUS, GetMessageString(IDS_SHOW_SERVER_STATUS_ITEM));
  
      HMENU hSymbolicMenu = CreatePopupMenu();
! 	int indexSymbolicMenu = 0;
      ::InsertMenu(hSymbolicMenu, indexSymbolicMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_ADD, GetMessageString(IDS_SYMBOLICLINK_ADD));
      // ::InsertMenu(hSymbolicMenu, indexSymbolicMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_EDIT, GetMessageString(IDS_SYMBOLICLINK_EDIT));
! 	// ::EnableMenuItem(hSymbolicMenu,indexSymbolicMenu++,((pThis->m_bIsSymlink)?MF_ENABLED:MF_GRAYED)|MF_BYPOSITION);
! 	::InsertMenu(hSymbolicMenu, indexSymbolicMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_REMOVE, GetMessageString(IDS_SYMBOLICLINK_REMOVE));
! 	::EnableMenuItem(hSymbolicMenu,indexSymbolicMenu++,((pThis->m_bIsSymlink)?MF_ENABLED:MF_GRAYED)|MF_BYPOSITION);
! 	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hSymbolicMenu, GetMessageString(IDS_SYMBOLIC_LINK_ITEM));
! 	
! 	// The Submounts menu has been removed because the AFS tray icon
! 	// and control panel now support mapping drives directly to an AFS
! 	// path.
! 	//
! 	// HMENU hSubmountMenu = CreatePopupMenu();
! 	// int indexSubmountMenu = 0;
! 	// ::InsertMenu(hSubmountMenu, indexSubmountMenu++, MF_STRING | MF_BYPOSITION | nSingleDirOnly, idCmdFirst + IDM_SUBMOUNTS_CREATE, GetMessageString(IDS_SUBMOUNTS_CREATE_ITEM));
! 	// ::InsertMenu(hSubmountMenu, indexSubmountMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SUBMOUNTS_EDIT, GetMessageString(IDS_SUBMOUNTS_EDIT_ITEM));
! 	// ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hSubmountMenu, GetMessageString(IDS_SUBMOUNTS_ITEM));
  
! 	// Add a separator
! 	::InsertMenu (hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
  
! 	// Add the AFS submenu to the shell's menu
! 	::InsertMenu(hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hAfsMenu, GetMessageString(IDS_AFS_ITEM));
  
- 	// Add a separator after us
- 	::InsertMenu (hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
- 	
      return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 
! 			(USHORT)indexAfsMenu + indexVolPartMenu + indexMountPointMenu + indexShellMenu + indexSymbolicMenu);
! }
  
  STDMETHODIMP CShellExt::XMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
  {
--- 187,293 ----
  {
      METHOD_PROLOGUE(CShellExt, MenuExt);
  
!     // Don't add any menu items if we're being asked to deal with this file as a shortcut.
!     if (uFlags & CMF_VERBSONLY)
! 	return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, (USHORT)0);
! 
!     // Check to see if there's already an AFS menu here; if so, remove it
!     int nItemsNow = GetMenuItemCount (hMenu);
!     CString strAfsItemText = GetMessageString(IDS_AFS_ITEM);
!     LPCTSTR pszAfsItemText = (LPCTSTR)strAfsItemText;
!     for (int iItem = 0; iItem < nItemsNow; iItem++) {
! 	TCHAR szItemText[256];
! 	if (!GetMenuString (hMenu, iItem, szItemText, 256, MF_BYPOSITION))
! 	    continue;
! 	if (!lstrcmp (szItemText, pszAfsItemText)) {
! 	    DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 	    continue;
  	}
! 	if ((!lstrcmp(szItemText,"&Delete"))&&(pThis->m_bIsSymlink)) {	/*this is a symlink - don't present a delete menu!*/
! 	    DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 	    continue;
! 	}
! 	if ((!lstrcmp(szItemText,"Cu&t"))&&(pThis->m_bIsSymlink)) {		/*same for cut*/
! 	    DeleteMenu (hMenu, iItem, MF_BYPOSITION);
! 	    continue;
! 	}
!     }
!     int indexShellMenu = 0;
  
!     // Create the AFS submenu using the allowed ID's.
!     HMENU hAfsMenu = CreatePopupMenu();
!     int indexAfsMenu = 0;
! 
!     // The Authentication item has been removed from the AFS menu because
!     // there is now a tray icon to handle authentication.
!     //
!     //::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_AUTHENTICATION, GetMessageString(IDS_AUTHENTICATION_ITEM));
! 
!     // Only enable the ACL menu item if a single directory is selected
!     int nSingleDirOnly = MF_GRAYED;
!     if (pThis->m_bDirSelected && (pThis->m_astrFileNames.GetSize() == 1))
! 	nSingleDirOnly = MF_ENABLED;
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | nSingleDirOnly, idCmdFirst + IDM_ACL_SET, GetMessageString(IDS_ACLS_ITEM));
! 
!     // Volume/Partition submenu of the AFS submenu
!     HMENU hVolPartMenu = CreatePopupMenu();
!     int indexVolPartMenu = 0;
!     ::InsertMenu(hVolPartMenu, indexVolPartMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_VOLUME_PROPERTIES, GetMessageString(IDS_VOL_PART_PROPS_ITEM));
!     ::InsertMenu(hVolPartMenu, indexVolPartMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE, GetMessageString(IDS_VOL_PART_REFRESH_ITEM));
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hVolPartMenu, GetMessageString(IDS_VOL_PART_ITEM));
! 
!     // Mount Point submenu of the AFS submenu
!     HMENU hMountPointMenu = CreatePopupMenu();
!     int indexMountPointMenu = 0;
!     int nMountPointSelected = MF_GRAYED;
!     for (int n = pThis->m_astrFileNames.GetSize() - 1 ; n >= 0; n--) {
! 	if ( IsMountPoint(pThis->m_astrFileNames[n]) ) {
! 	    nMountPointSelected = MF_ENABLED;
! 	    break;
! 	}
!     }
!     ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
!     ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION | nMountPointSelected, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
!     ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hMountPointMenu, GetMessageString(IDS_MOUNT_POINT_ITEM));
! 
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH, GetMessageString(IDS_FLUSH_FILE_DIR_ITEM));	
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH_VOLUME, GetMessageString(IDS_FLUSH_VOLUME_ITEM));
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SHOW_SERVER, GetMessageString(IDS_SHOW_FILE_SERVERS_ITEM));
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SHOWCELL, GetMessageString(IDS_SHOW_CELL_ITEM));
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SERVER_STATUS, GetMessageString(IDS_SHOW_SERVER_STATUS_ITEM));
  
      HMENU hSymbolicMenu = CreatePopupMenu();
!     int indexSymbolicMenu = 0;
      ::InsertMenu(hSymbolicMenu, indexSymbolicMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_ADD, GetMessageString(IDS_SYMBOLICLINK_ADD));
      // ::InsertMenu(hSymbolicMenu, indexSymbolicMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_EDIT, GetMessageString(IDS_SYMBOLICLINK_EDIT));
!     // ::EnableMenuItem(hSymbolicMenu,indexSymbolicMenu++,((pThis->m_bIsSymlink)?MF_ENABLED:MF_GRAYED)|MF_BYPOSITION);
!     ::InsertMenu(hSymbolicMenu, indexSymbolicMenu, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SYMBOLICLINK_REMOVE, GetMessageString(IDS_SYMBOLICLINK_REMOVE));
!     ::EnableMenuItem(hSymbolicMenu,indexSymbolicMenu++,((pThis->m_bIsSymlink)?MF_ENABLED:MF_GRAYED)|MF_BYPOSITION);
!     ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hSymbolicMenu, GetMessageString(IDS_SYMBOLIC_LINK_ITEM));
! 
!     // The Submounts menu has been removed because the AFS tray icon
!     // and control panel now support mapping drives directly to an AFS
!     // path.
!     //
!     // HMENU hSubmountMenu = CreatePopupMenu();
!     // int indexSubmountMenu = 0;
!     // ::InsertMenu(hSubmountMenu, indexSubmountMenu++, MF_STRING | MF_BYPOSITION | nSingleDirOnly, idCmdFirst + IDM_SUBMOUNTS_CREATE, GetMessageString(IDS_SUBMOUNTS_CREATE_ITEM));
!     // ::InsertMenu(hSubmountMenu, indexSubmountMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_SUBMOUNTS_EDIT, GetMessageString(IDS_SUBMOUNTS_EDIT_ITEM));
!     // ::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hSubmountMenu, GetMessageString(IDS_SUBMOUNTS_ITEM));
  
!     // Add a separator
!     ::InsertMenu (hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
  
!     // Add the AFS submenu to the shell's menu
!     ::InsertMenu(hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hAfsMenu, GetMessageString(IDS_AFS_ITEM));
! 
!     // Add a separator after us
!     ::InsertMenu (hMenu, indexMenu + indexShellMenu++, MF_STRING | MF_BYPOSITION | MF_SEPARATOR, 0, TEXT(""));
  
      return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 
! 			 (USHORT)indexAfsMenu + indexVolPartMenu + indexMountPointMenu + indexShellMenu + indexSymbolicMenu);
! }	
  
  STDMETHODIMP CShellExt::XMenuExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
  {
***************
*** 295,500 ****
      if (HIWORD(lpici->lpVerb ))
          return E_FAIL;
  
! 	AddRef();
  
! 	CStringArray &files = pThis->m_astrFileNames;
  
! 	switch (LOWORD(lpici->lpVerb))
! 	{
! 		case IDM_AUTHENTICATION:	{
! 										CAuthDlg dlg;
! 										dlg.DoModal();
! 										break;
! 									}
! 		
! 		case IDM_ACL_SET:			{ 
! 										CSetAfsAcl dlg;
! 										ASSERT(files.GetSize() == 1);
! 										dlg.SetDir(files[0]);
! 										dlg.DoModal();
! 									}
! 									break;
! 		
! 		case IDM_VOLUME_PROPERTIES:	{
! 										CVolumeInfo dlg;
! 										dlg.SetFiles(files);
! 										dlg.DoModal();
! 									}
! 									break;
! 
! 		case IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE:	CheckVolumes();
! 													break;
! 
! 		case IDM_MOUNTPOINT_SHOW:	ListMount(files);
! 									break;
! 
! 		case IDM_MOUNTPOINT_REMOVE:	{
! 										int nChoice = ShowMessageBox(IDS_REALLY_DEL_MOUNT_POINTS, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_DEL_MOUNT_POINTS);
! 										if (nChoice == IDYES)
! 											RemoveMount(files);
! 									}
! 									break;
! 		
! 		case IDM_MOUNTPOINT_MAKE:	{
! 										CMakeMountPointDlg dlg;
! 										ASSERT(files.GetSize() == 1);
! 										dlg.SetDir(files[0]);
! 										dlg.DoModal();
! 									}
! 									break;
  
  
! 		case IDM_FLUSH:				Flush(files);
! 									break;
! 		
! 		case IDM_FLUSH_VOLUME:		FlushVolume(files);
! 									break;
  
! 		case IDM_SHOW_SERVER:		WhereIs(files);
! 									break;
! 		
! 		case IDM_SHOWCELL:			WhichCell(files);
! 									break;
  
! 		case IDM_SERVER_STATUS:		{
! 										CServerStatusDlg dlg;
! 										dlg.DoModal();
! 									}
! 									break;
  
!         /*
! 		case IDM_SUBMOUNTS_EDIT:	{
! 										CSubmountsDlg dlg;
! 										dlg.DoModal();
! 									}
! 									break;
! 
! 		case IDM_SUBMOUNTS_CREATE:	{
! 										ASSERT(files.GetSize() == 1);
! 										CSubmountsDlg dlg;
! 										dlg.SetAddOnlyMode(files[0]);
! 										dlg.DoModal();
! 									}
! 									break;
!         */
! 	case IDM_SYMBOLICLINK_REMOVE: {
! 		if (files.GetSize()>1)
! 			break;
! 		CString msg=files.GetAt(0);
! 		int i;
! 		if ((i=msg.ReverseFind('\\'))>0)
! 			msg=msg.Left(i+1);
! 		else if ((i=msg.ReverseFind(':'))>0)
! 			msg=msg.Left(i+1)+"\\";
! 		if (!SetCurrentDirectory(msg))
! 		{
! 			MessageBeep((UINT)-1);
! 			ShowMessageBox(IDS_UNABLE_TO_SET_CURRENT_DIRECTORY,MB_OK,IDS_UNABLE_TO_SET_CURRENT_DIRECTORY);
! 			break;
! 		}
! 		msg=files.GetAt(0);
! 		if ((i=msg.ReverseFind('\\'))>0||((i=msg.ReverseFind(':'))>0))
! 			msg=msg.Right(msg.GetLength()-i-1);
! 		int nChoice = ShowMessageBox(IDS_REALLY_REMOVE_SYMLINK, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_REMOVE_SYMLINK,msg);
! 		if (nChoice == IDYES)
! 			RemoveSymlink(files.GetAt(0));
! 	}
! 		break;
  
! 	case IDM_SYMBOLICLINK_ADD: {
! 		CString msg=files.GetAt(0);
! 		int i;
! 		if ((i=msg.ReverseFind('\\'))>0)
! 			msg=msg.Left(i+1);
! 		else if ((i=msg.ReverseFind(':'))>0)
! 			msg=msg.Left(i+1)+"\\";
! 		CMakeSymbolicLinkDlg dlg;
! 		dlg.Setbase(msg);
! 		dlg.DoModal();
  	}
! 		break;
! 		
! 	case IDM_REMOVE_SYMLINK:	{
! 		if (files.GetSize()>1)
! 			break;
! 		int nChoice = ShowMessageBox(IDS_REALLY_REMOVE_SYMLINK, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_REMOVE_SYMLINK);
! 		if (nChoice == IDYES)
! 			RemoveSymlink(files.GetAt(0));
  	}
! 		break;
! 	default:
! 		ASSERT(FALSE);
! 		Release();
! 		return E_INVALIDARG;
  	}
  
  	Release();
  
      return NOERROR;
! }
  
  STDMETHODIMP CShellExt::XMenuExt::GetCommandString(UINT_PTR idCmd, UINT uType,
      UINT* pwReserved, LPSTR pszName, UINT cchMax)
  {
! 	if (uType != GCS_HELPTEXT)
! 		return NOERROR;			// ?????????????????????????????????????????????????
  
! 	UINT nCmdStrID;
  
      AfxSetResourceHandle(theApp.m_hInstance);
  
      switch (idCmd)
! 	{
! 		case IDM_AUTHENTICATION:	nCmdStrID = ID_AUTHENTICATE;
! 									break;
  		
! 		case IDM_ACL_SET:			nCmdStrID = ID_ACL_SET;
! 									break;
! 		
! 		case IDM_VOLUME_PROPERTIES:	nCmdStrID = ID_VOLUME_PROPERTIES;
! 									break;
! 
! 		case IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE:	nCmdStrID = ID_VOLUMEPARTITION_UPDATENAMEIDTABLE;
! 													break;
! 
! 		case IDM_MOUNTPOINT_SHOW:	nCmdStrID = ID_MOUNTPOINT_SHOW;
! 									break;
! 
! 		case IDM_MOUNTPOINT_REMOVE:	nCmdStrID = ID_MOUNTPOINT_REMOVE;
! 									break;
! 		
! 		case IDM_MOUNTPOINT_MAKE:	nCmdStrID = ID_MOUNTPOINT_MAKE;
! 									break;
! 
! 		case IDM_FLUSH:				nCmdStrID = ID_FLUSH;
! 									break;
! 		
! 		case IDM_FLUSH_VOLUME:		nCmdStrID = ID_VOLUME_FLUSH;
! 									break;
! 
! 		case IDM_SHOW_SERVER:		nCmdStrID = ID_WHEREIS;
! 									break;
! 		
! 		case IDM_SHOWCELL:			nCmdStrID = ID_SHOWCELL;
! 									break;
! 
! 		case IDM_SERVER_STATUS:		nCmdStrID = ID_SERVER_STATUS;
! 									break;
! 
! 		case IDM_SYMBOLICLINK_ADD:	nCmdStrID = ID_SYMBOLICLINK_ADD;
! 									break;
! 		
! 		case IDM_SYMBOLICLINK_REMOVE:	nCmdStrID = ID_SYMBOLICLINK_REMOVE;
! 									break;
! 
! 		case IDM_REMOVE_SYMLINK:	nCmdStrID= ID_REMOVE_SYMLINK;
! 									break;
! 		
! 		default:
! 			ASSERT(FALSE);
! 			Release();
! 		    return E_INVALIDARG;
! 	}
  
      CString strMsg;
      LoadString (strMsg, nCmdStrID);
--- 296,520 ----
      if (HIWORD(lpici->lpVerb ))
          return E_FAIL;
  
!     AddRef();
  
!     CStringArray &files = pThis->m_astrFileNames;
  
!     switch (LOWORD(lpici->lpVerb))
!     {
!     case IDM_AUTHENTICATION:	{
! 	CAuthDlg dlg;
! 	dlg.DoModal();
! 	break;
!     }
  
+     case IDM_ACL_SET:			{ 
+ 	CSetAfsAcl dlg;
+ 	ASSERT(files.GetSize() == 1);
+ 	dlg.SetDir(files[0]);
+ 	dlg.DoModal();
+ 	break;
+     }
  
!     case IDM_VOLUME_PROPERTIES:	{
! 	CVolumeInfo dlg;
! 	dlg.SetFiles(files);
! 	dlg.DoModal();
! 	break;
!     }
  
!     case IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE:
! 	CheckVolumes();
! 	break;
! 
!     case IDM_MOUNTPOINT_SHOW:	
! 	ListMount(files);
! 	break;
! 
!     case IDM_MOUNTPOINT_REMOVE:	{
! 	int nChoice = ShowMessageBox(IDS_REALLY_DEL_MOUNT_POINTS, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_DEL_MOUNT_POINTS);
! 	if (nChoice == IDYES)
! 	    RemoveMount(files);
! 	break;
!     }
  
!     case IDM_MOUNTPOINT_MAKE:	{
! 	CMakeMountPointDlg dlg;
! 	ASSERT(files.GetSize() == 1);
! 	dlg.SetDir(files[0]);
! 	dlg.DoModal();
! 	break;
!     }
  
!     case IDM_FLUSH:				
! 	Flush(files);
! 	break;
! 
!     case IDM_FLUSH_VOLUME:		
! 	FlushVolume(files);
! 	break;
! 
!     case IDM_SHOW_SERVER:	       
! 	WhereIs(files);
! 	break;
! 
!     case IDM_SHOWCELL:
! 	WhichCell(files);
! 	break;
! 
!     case IDM_SERVER_STATUS: {
! 	CServerStatusDlg dlg;
! 	dlg.DoModal();
! 	break;
!     }
  
!         /*
! 	case IDM_SUBMOUNTS_EDIT:	{
! 	CSubmountsDlg dlg;
! 	dlg.DoModal();
! 	break;
  	}
! 	case IDM_SUBMOUNTS_CREATE:	{
! 	ASSERT(files.GetSize() == 1);
! 	CSubmountsDlg dlg;
! 	dlg.SetAddOnlyMode(files[0]);
! 	dlg.DoModal();
! 	break;
  	}
!         */
!     case IDM_SYMBOLICLINK_REMOVE: {
! 	if (files.GetSize()>1)
! 	    break;
! 	CString msg=files.GetAt(0);
! 	int i;
! 	if ((i=msg.ReverseFind('\\'))>0)
! 	    msg=msg.Left(i+1);
! 	else if ((i=msg.ReverseFind(':'))>0)
! 	    msg=msg.Left(i+1)+"\\";
! 	if (!SetCurrentDirectory(msg))
! 	{
! 	    MessageBeep((UINT)-1);
! 	    ShowMessageBox(IDS_UNABLE_TO_SET_CURRENT_DIRECTORY,MB_OK,IDS_UNABLE_TO_SET_CURRENT_DIRECTORY);
! 	    break;
  	}
+ 	msg=files.GetAt(0);
+ 	if ((i=msg.ReverseFind('\\'))>0||((i=msg.ReverseFind(':'))>0))
+ 	    msg=msg.Right(msg.GetLength()-i-1);
+ 	int nChoice = ShowMessageBox(IDS_REALLY_REMOVE_SYMLINK, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_REMOVE_SYMLINK,msg);
+ 	if (nChoice == IDYES)
+ 	    RemoveSymlink(files.GetAt(0));
+ 	break;
+     }
  
+     case IDM_SYMBOLICLINK_ADD: {
+ 	CString msg=files.GetAt(0);
+ 	int i;
+ 	if ((i=msg.ReverseFind('\\'))>0)
+ 	    msg=msg.Left(i+1);
+ 	else if ((i=msg.ReverseFind(':'))>0)
+ 	    msg=msg.Left(i+1)+"\\";
+ 	CMakeSymbolicLinkDlg dlg;
+ 	dlg.Setbase(msg);
+ 	dlg.DoModal();
+ 	break;
+     }
+ 		
+     case IDM_REMOVE_SYMLINK:	{
+ 	if (files.GetSize()>1)
+ 	    break;
+ 	int nChoice = ShowMessageBox(IDS_REALLY_REMOVE_SYMLINK, MB_ICONQUESTION | MB_YESNO, IDS_REALLY_REMOVE_SYMLINK);
+ 	if (nChoice == IDYES)
+ 	    RemoveSymlink(files.GetAt(0));
+ 	}	
+ 	break;
+     default:
+ 	ASSERT(FALSE);
  	Release();
+ 	return E_INVALIDARG;
+     }
+ 
+     Release();
  
      return NOERROR;
! }	
  
  STDMETHODIMP CShellExt::XMenuExt::GetCommandString(UINT_PTR idCmd, UINT uType,
      UINT* pwReserved, LPSTR pszName, UINT cchMax)
  {
!     if (uType != GCS_HELPTEXT)
! 	return NOERROR;			// ?????????????????????????????????????????????????
  
!     UINT nCmdStrID;
  
      AfxSetResourceHandle(theApp.m_hInstance);
  
      switch (idCmd)
!     {
!     case IDM_AUTHENTICATION: 
! 	nCmdStrID = ID_AUTHENTICATE;
! 	break;
! 
!     case IDM_ACL_SET: 
! 	nCmdStrID = ID_ACL_SET;
! 	break;
! 
!     case IDM_VOLUME_PROPERTIES:
! 	nCmdStrID = ID_VOLUME_PROPERTIES;
! 	break;
! 
!     case IDM_VOLUMEPARTITION_UPDATENAMEIDTABLE:	
! 	nCmdStrID = ID_VOLUMEPARTITION_UPDATENAMEIDTABLE;
! 	break;
! 
!     case IDM_MOUNTPOINT_SHOW:  
! 	nCmdStrID = ID_MOUNTPOINT_SHOW;
! 	break;
! 
!     case IDM_MOUNTPOINT_REMOVE:	
! 	nCmdStrID = ID_MOUNTPOINT_REMOVE;
! 	break;
! 		
!     case IDM_MOUNTPOINT_MAKE: 
! 	nCmdStrID = ID_MOUNTPOINT_MAKE;
! 	break;
! 
!     case IDM_FLUSH:  
! 	nCmdStrID = ID_FLUSH;
! 	break;
! 
!     case IDM_FLUSH_VOLUME:   
! 	nCmdStrID = ID_VOLUME_FLUSH;
! 	break;
! 
!     case IDM_SHOW_SERVER: 
! 	nCmdStrID = ID_WHEREIS;
! 	break;
! 
!     case IDM_SHOWCELL:	
! 	nCmdStrID = ID_SHOWCELL;
! 	break;
! 
!     case IDM_SERVER_STATUS: 
! 	nCmdStrID = ID_SERVER_STATUS;
! 	break;
! 
!     case IDM_SYMBOLICLINK_ADD:
! 	nCmdStrID = ID_SYMBOLICLINK_ADD;
! 	break;
! 		
!     case IDM_SYMBOLICLINK_REMOVE: 
! 	nCmdStrID = ID_SYMBOLICLINK_REMOVE;
! 	break;
! 
!     case IDM_REMOVE_SYMLINK:
! 	nCmdStrID= ID_REMOVE_SYMLINK;
! 	break;
  		
!     default:
! 	ASSERT(FALSE);
! 	Release();
! 	return E_INVALIDARG;
!     }
  
      CString strMsg;
      LoadString (strMsg, nCmdStrID);
***************
*** 516,530 ****
  
  STDMETHODIMP_(ULONG) CShellExt::XShellInit::AddRef(void)
  {
! 	return ++nSERefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XShellInit::Release(void)
  {
! 	if (nSERefCount > 0)
! 		nSERefCount--;
  	
! 	return nSERefCount;
  }
  
  /////////////////////////////////////////////////////////////////////////////
--- 536,550 ----
  
  STDMETHODIMP_(ULONG) CShellExt::XShellInit::AddRef(void)
  {
!     return ++nSERefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XShellInit::Release(void)
  {
!     if (nSERefCount > 0)
! 	nSERefCount--;
  	
!     return nSERefCount;
  }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 538,591 ****
      FORMATETC fmte = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
      STGMEDIUM medium;
  
! 	// We must have a data object
      if (pdobj == NULL)
  	    return E_FAIL;
  
      //  Use the given IDataObject to get a list of filenames (CF_HDROP)
      hres = pdobj->GetData(&fmte, &medium);
      if (FAILED(hres)) {
! 	    return E_FAIL;
      }
  
      int nNumFiles = DragQueryFile((HDROP)medium.hGlobal, 0xFFFFFFFF, NULL, 0);
! 	if (nNumFiles == 0)
! 		hres = E_FAIL;
! 	else {
! 		pThis->m_bDirSelected = FALSE;
! 
! 		for (int ii = 0; ii < nNumFiles; ii++) {
! 			CString strFileName;
! 
! 			// Get the size of the file name string
! 			int nNameLen = DragQueryFile((HDROP)medium.hGlobal, ii, 0, 0);
! 
! 			// Make room for it in our string object
! 			LPTSTR pszFileNameBuf = strFileName.GetBuffer(nNameLen + 1);	// +1 for the terminating NULL
! 			ASSERT(pszFileNameBuf);
! 			
! 			// Get the file name
! 			DragQueryFile((HDROP)medium.hGlobal, ii, pszFileNameBuf, nNameLen + 1);
! 			
! 			strFileName.ReleaseBuffer();
! 
! 			if (!IsPathInAfs(strFileName)) {
! 				pThis->m_astrFileNames.RemoveAll();
! 				break;
! 			} else {
! 				pThis->m_bIsSymlink=IsSymlink(strFileName);
! 			}
! 
! 			if (IsADir(strFileName))
! 				pThis->m_bDirSelected = TRUE;
! 
! 			pThis->m_astrFileNames.Add(strFileName);
! 		}
! 
! 		if (pThis->m_astrFileNames.GetSize() > 0)
! 			hres = NOERROR;
! 		else
! 			hres = E_FAIL;
      }
   
      //	Release the data
--- 558,611 ----
      FORMATETC fmte = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
      STGMEDIUM medium;
  
!     // We must have a data object
      if (pdobj == NULL)
  	    return E_FAIL;
  
      //  Use the given IDataObject to get a list of filenames (CF_HDROP)
      hres = pdobj->GetData(&fmte, &medium);
      if (FAILED(hres)) {
! 	return E_FAIL;
      }
  
      int nNumFiles = DragQueryFile((HDROP)medium.hGlobal, 0xFFFFFFFF, NULL, 0);
!     if (nNumFiles == 0)
! 	hres = E_FAIL;
!     else {
! 	pThis->m_bDirSelected = FALSE;
! 
! 	for (int ii = 0; ii < nNumFiles; ii++) {
! 	    CString strFileName;
! 
! 	    // Get the size of the file name string
! 	    int nNameLen = DragQueryFile((HDROP)medium.hGlobal, ii, 0, 0);
! 
! 	    // Make room for it in our string object
! 	    LPTSTR pszFileNameBuf = strFileName.GetBuffer(nNameLen + 1);	// +1 for the terminating NULL
! 	    ASSERT(pszFileNameBuf);
! 
! 	    // Get the file name
! 	    DragQueryFile((HDROP)medium.hGlobal, ii, pszFileNameBuf, nNameLen + 1);
! 
! 	    strFileName.ReleaseBuffer();
! 
! 	    if (!IsPathInAfs(strFileName)) {
! 		pThis->m_astrFileNames.RemoveAll();
! 		break;
! 	    } else {
! 		pThis->m_bIsSymlink=IsSymlink(strFileName);
! 	    }
! 
! 	    if (IsADir(strFileName))
! 		pThis->m_bDirSelected = TRUE;
! 
! 	    pThis->m_astrFileNames.Add(strFileName);
! 	}
! 
! 	if (pThis->m_astrFileNames.GetSize() > 0)
! 	    hres = NOERROR;
! 	else
! 	    hres = E_FAIL;
      }
   
      //	Release the data
***************
*** 602,617 ****
  
  STDMETHODIMP_(ULONG) CShellExt::XIconExt::AddRef(void)
  {
! 	return ++nICRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XIconExt::Release(void)
  {
! 	if (nICRefCount > 0)
! 		nICRefCount--;
  
! 	return nICRefCount;
! }
  
  
  /////////////////////////////////////////////////////////////////////////////
--- 622,637 ----
  
  STDMETHODIMP_(ULONG) CShellExt::XIconExt::AddRef(void)
  {
!     return ++nICRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XIconExt::Release(void)
  {
!     if (nICRefCount > 0)
! 	nICRefCount--;
  
!     return nICRefCount;
! }	
  
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 621,658 ****
  STDMETHODIMP CShellExt::XIconExt::GetOverlayInfo(LPWSTR pwszIconFile
  	,int cchMax,int* pIndex,DWORD* pdwFlags)
  {
! 	if(IsBadWritePtr(pIndex, sizeof(int)))
! 		return E_INVALIDARG;
! 	if(IsBadWritePtr(pdwFlags, sizeof(DWORD)))
! 		return E_INVALIDARG;
! 
! 	HMODULE hModule=GetModuleHandle("shell32.dll");
! 	TCHAR szModule[MAX_PATH];
! 	DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
! 	MultiByteToWideChar( CP_ACP,0,szModule,-1,pwszIconFile,cchMax); 
! 	*pIndex = 30;
! 	*pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
! 	return S_OK;
  }
  
  STDMETHODIMP CShellExt::XIconExt::GetPriority(int* pPriority)
  {
! 	if(IsBadWritePtr(pPriority, sizeof(int)))
! 	   return E_INVALIDARG;
! 	*pPriority = 0;
! 	return S_OK;
  }
  
  STDMETHODIMP CShellExt::XIconExt::IsMemberOf(LPCWSTR pwszPath,DWORD dwAttrib)
  {
! 	TCHAR szPath[MAX_PATH];
! 	WideCharToMultiByte( CP_ACP,0,pwszPath,-1,szPath,MAX_PATH,NULL,NULL);
! 	if (IsSymlink(szPath))
! 		return S_OK;
! 	return S_FALSE;
! }
  
! /*          TOOL TIP INFO IMPLIMENTION   */
  
  STDMETHODIMP CShellExt::XToolTipExt::QueryInterface(REFIID riid, void** ppv)
  {
--- 641,678 ----
  STDMETHODIMP CShellExt::XIconExt::GetOverlayInfo(LPWSTR pwszIconFile
  	,int cchMax,int* pIndex,DWORD* pdwFlags)
  {
!     if(IsBadWritePtr(pIndex, sizeof(int)))
! 	return E_INVALIDARG;
!     if(IsBadWritePtr(pdwFlags, sizeof(DWORD)))
! 	return E_INVALIDARG;
! 
!     HMODULE hModule=GetModuleHandle("shell32.dll");
!     TCHAR szModule[MAX_PATH];
!     DWORD z=GetModuleFileName(hModule,szModule,sizeof(szModule));
!     MultiByteToWideChar( CP_ACP,0,szModule,-1,pwszIconFile,cchMax); 
!     *pIndex = 30;
!     *pdwFlags = ISIOI_ICONFILE | ISIOI_ICONINDEX;
!     return S_OK;
  }
  
  STDMETHODIMP CShellExt::XIconExt::GetPriority(int* pPriority)
  {
!     if(IsBadWritePtr(pPriority, sizeof(int)))
! 	return E_INVALIDARG;
!     *pPriority = 0;
!     return S_OK;
  }
  
  STDMETHODIMP CShellExt::XIconExt::IsMemberOf(LPCWSTR pwszPath,DWORD dwAttrib)
  {
!     TCHAR szPath[MAX_PATH];
!     WideCharToMultiByte( CP_ACP,0,pwszPath,-1,szPath,MAX_PATH,NULL,NULL);
!     if (IsSymlink(szPath))
! 	return S_OK;
!     return S_FALSE;
! }	
  
! /*  TOOL TIP INFO IMPLIMENTION   */
  
  STDMETHODIMP CShellExt::XToolTipExt::QueryInterface(REFIID riid, void** ppv)
  {
***************
*** 662,700 ****
  
  STDMETHODIMP_(ULONG) CShellExt::XToolTipExt::AddRef(void)
  {
! 	return ++nTPRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XToolTipExt::Release(void)
  {
! 	if (nTPRefCount> 0)
! 		nTPRefCount--;
  
! 	return nTPRefCount;
  }
  
  STDMETHODIMP CShellExt::XToolTipExt::GetInfoTip(DWORD dwFlags, LPWSTR *ppwszTip)
  {
      METHOD_PROLOGUE(CShellExt, ToolTipExt);
  
! 	if (!IsSymlink(pThis->m_szFile))
! 	{
! 		ppwszTip=NULL;
! 		return S_OK;
! 	}
! 	USES_CONVERSION;
! 	// dwFlags is currently unused.
! 	*ppwszTip = (WCHAR*) (pThis->m_pAlloc)->Alloc((1+lstrlen(pThis->m_szFile))*sizeof(WCHAR));
! 	if (*ppwszTip)
! 	{
! 		wcscpy(*ppwszTip, (WCHAR*)T2OLE(pThis->m_szFile));
! 	}
! 
  	return S_OK;
  }
  STDMETHODIMP CShellExt::XToolTipExt::GetInfoFlags(LPDWORD pdwFlags)
  {
! 	return S_OK;
  }
  
  //////////                          IPersistFile
--- 682,720 ----
  
  STDMETHODIMP_(ULONG) CShellExt::XToolTipExt::AddRef(void)
  {
!     return ++nTPRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XToolTipExt::Release(void)
  {
!     if (nTPRefCount> 0)
! 	nTPRefCount--;
  
!     return nTPRefCount;
  }
  
  STDMETHODIMP CShellExt::XToolTipExt::GetInfoTip(DWORD dwFlags, LPWSTR *ppwszTip)
  {
      METHOD_PROLOGUE(CShellExt, ToolTipExt);
  
!     if (!IsSymlink(pThis->m_szFile))
!     {
! 	ppwszTip=NULL;
  	return S_OK;
+     }
+     USES_CONVERSION;
+     // dwFlags is currently unused.
+     *ppwszTip = (WCHAR*) (pThis->m_pAlloc)->Alloc((1+lstrlen(pThis->m_szFile))*sizeof(WCHAR));
+     if (*ppwszTip)
+     {
+ 	wcscpy(*ppwszTip, (WCHAR*)T2OLE(pThis->m_szFile));
+     }
+ 
+     return S_OK;
  }
  STDMETHODIMP CShellExt::XToolTipExt::GetInfoFlags(LPDWORD pdwFlags)
  {
!     return S_OK;
  }
  
  //////////                          IPersistFile
***************
*** 708,753 ****
  
  STDMETHODIMP_(ULONG) CShellExt::XPersistFileExt::AddRef(void)
  {
! 	return ++nXPRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XPersistFileExt::Release(void)
  {
! 	if (nXPRefCount> 0)
! 		nXPRefCount--;
  
! 	return nXPRefCount;
  }
  
  STDMETHODIMP	CShellExt::XPersistFileExt::Load(LPCOLESTR wszFile, DWORD dwMode)
  {
      METHOD_PROLOGUE(CShellExt, PersistFileExt);
! 	USES_CONVERSION;
! 	_tcscpy(pThis->m_szFile, OLE2T((WCHAR*)wszFile)); 
! 	return S_OK;	
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::GetClassID(LPCLSID)
  { 
! 	return E_NOTIMPL;	
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::IsDirty(VOID)
  { 
! 	return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::Save(LPCOLESTR, BOOL)
  { 
! 	return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::SaveCompleted(LPCOLESTR)
  { 
! 	return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::GetCurFile(LPOLESTR FAR*)
  { 
! 	return E_NOTIMPL; 
  }
--- 728,773 ----
  
  STDMETHODIMP_(ULONG) CShellExt::XPersistFileExt::AddRef(void)
  {
!     return ++nXPRefCount;
  }
  
  STDMETHODIMP_(ULONG) CShellExt::XPersistFileExt::Release(void)
  {
!     if (nXPRefCount> 0)
! 	nXPRefCount--;
  
!     return nXPRefCount;
  }
  
  STDMETHODIMP	CShellExt::XPersistFileExt::Load(LPCOLESTR wszFile, DWORD dwMode)
  {
      METHOD_PROLOGUE(CShellExt, PersistFileExt);
!     USES_CONVERSION;
!     _tcscpy(pThis->m_szFile, OLE2T((WCHAR*)wszFile)); 
!     return S_OK;	
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::GetClassID(LPCLSID)
  { 
!     return E_NOTIMPL;	
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::IsDirty(VOID)
  { 
!     return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::Save(LPCOLESTR, BOOL)
  { 
!     return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::SaveCompleted(LPCOLESTR)
  { 
!     return E_NOTIMPL; 
  }
  
  STDMETHODIMP CShellExt::XPersistFileExt::GetCurFile(LPOLESTR FAR*)
  { 
!     return E_NOTIMPL; 
  }
Index: openafs/src/WINNT/client_exp/shell_ext.h
diff -c openafs/src/WINNT/client_exp/shell_ext.h:1.6 openafs/src/WINNT/client_exp/shell_ext.h:1.6.4.1
*** openafs/src/WINNT/client_exp/shell_ext.h:1.6	Sat Nov 19 09:30:34 2005
--- openafs/src/WINNT/client_exp/shell_ext.h	Tue Jan 30 07:42:43 2007
***************
*** 32,49 ****
  
  class CShellExt : public CCmdTarget
  {
! 	DECLARE_DYNCREATE(CShellExt)
  
! 	BOOL m_bDirSelected;
! 	BOOL m_bIsSymlink;	// is symbolic link!
! 	TCHAR m_szFile[MAX_PATH];
! 	BOOL m_bIsOverlayEnabled;
! 	BOOL IsOverlayEnabled(){return m_bIsOverlayEnabled;}
  
      CStringArray m_astrFileNames;
  
! 	CShellExt();           // protected constructor used by dynamic creation
! 	LPMALLOC m_pAlloc;
  
  // Attributes
  public:
--- 32,49 ----
  
  class CShellExt : public CCmdTarget
  {
!     DECLARE_DYNCREATE(CShellExt)
  
!     BOOL m_bDirSelected;
!     BOOL m_bIsSymlink;	// is symbolic link!
!     TCHAR m_szFile[MAX_PATH];
!     BOOL m_bIsOverlayEnabled;
!     BOOL IsOverlayEnabled(){return m_bIsOverlayEnabled;}
  
      CStringArray m_astrFileNames;
  
!     CShellExt();           // protected constructor used by dynamic creation
!     LPMALLOC m_pAlloc;
  
  // Attributes
  public:
***************
*** 52,88 ****
  public:
  
  // Overrides
! 	// ClassWizard generated virtual function overrides
! 	//{{AFX_VIRTUAL(CShellExt)
! 	public:
! 	virtual void OnFinalRelease();
! 	//}}AFX_VIRTUAL
  
  // Implementation
  protected:
! 	virtual ~CShellExt();
  
! 	// Generated message map functions
! 	//{{AFX_MSG(CShellExt)
! 		// NOTE - the ClassWizard will add and remove member functions here.
! 	//}}AFX_MSG
! 
! 	DECLARE_MESSAGE_MAP()
! 	// Generated OLE dispatch map functions
! 	//{{AFX_DISPATCH(CShellExt)
! 		// NOTE - the ClassWizard will add and remove member functions here.
! 	//}}AFX_DISPATCH
! 	DECLARE_DISPATCH_MAP()
  	
! 	DECLARE_OLECREATE(CShellExt)
      
  	// IFileViewer interface
      BEGIN_INTERFACE_PART(MenuExt, IContextMenu)
!         STDMETHOD(QueryContextMenu)( HMENU hmenu,UINT indexMenu,UINT idCmdFirst,
!             UINT idCmdLast,UINT uFlags);
          STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
          STDMETHOD(GetCommandString)(UINT_PTR idCmd,UINT uType,UINT* pwReserved,LPSTR pszName,
!             UINT cchMax);
      END_INTERFACE_PART(MenuExt)
  
      // IShellExtInit interface
--- 52,88 ----
  public:
  
  // Overrides
!     // ClassWizard generated virtual function overrides
!     //{{AFX_VIRTUAL(CShellExt)
!   public:
!     virtual void OnFinalRelease();
!     //}}AFX_VIRTUAL
  
  // Implementation
  protected:
!     virtual ~CShellExt();
  
!     // Generated message map functions
!     //{{AFX_MSG(CShellExt)
!     // NOTE - the ClassWizard will add and remove member functions here.
!     //}}AFX_MSG
! 
!     DECLARE_MESSAGE_MAP()
!     // Generated OLE dispatch map functions
!     //{{AFX_DISPATCH(CShellExt)
!     // NOTE - the ClassWizard will add and remove member functions here.
!     //}}AFX_DISPATCH
!     DECLARE_DISPATCH_MAP()
  	
!     DECLARE_OLECREATE(CShellExt)
      
  	// IFileViewer interface
      BEGIN_INTERFACE_PART(MenuExt, IContextMenu)
! 	STDMETHOD(QueryContextMenu)( HMENU hmenu,UINT indexMenu,UINT idCmdFirst,
! 				     UINT idCmdLast,UINT uFlags);
          STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
          STDMETHOD(GetCommandString)(UINT_PTR idCmd,UINT uType,UINT* pwReserved,LPSTR pszName,
! 				     UINT cchMax);
      END_INTERFACE_PART(MenuExt)
  
      // IShellExtInit interface
***************
*** 96,116 ****
          STDMETHOD(IsMemberOf)(LPCWSTR pwszPath,DWORD dwAttrib);
      END_INTERFACE_PART(IconExt)
  
! 	BEGIN_INTERFACE_PART(ToolTipExt, IQueryInfo)
! 		STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR *ppwszTip);
! 		STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags);
      END_INTERFACE_PART(ToolTipExt)
  
! 	BEGIN_INTERFACE_PART(PersistFileExt, IPersistFile)
! 		STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode);
! 		STDMETHOD(GetClassID)(LPCLSID);
! 		STDMETHOD(IsDirty)(VOID);
! 		STDMETHOD(Save)(LPCOLESTR, BOOL);
! 		STDMETHOD(SaveCompleted)(LPCOLESTR);
! 		STDMETHOD(GetCurFile)(LPOLESTR FAR*);
      END_INTERFACE_PART(PersistFileExt)
  
! 	DECLARE_INTERFACE_MAP()
  };
  
  /////////////////////////////////////////////////////////////////////////////
--- 96,116 ----
          STDMETHOD(IsMemberOf)(LPCWSTR pwszPath,DWORD dwAttrib);
      END_INTERFACE_PART(IconExt)
  
!     BEGIN_INTERFACE_PART(ToolTipExt, IQueryInfo)
! 	STDMETHOD(GetInfoTip)(DWORD dwFlags, LPWSTR *ppwszTip);
!         STDMETHOD(GetInfoFlags)(LPDWORD pdwFlags);
      END_INTERFACE_PART(ToolTipExt)
  
!     BEGIN_INTERFACE_PART(PersistFileExt, IPersistFile)
! 	STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode);
!         STDMETHOD(GetClassID)(LPCLSID);
!         STDMETHOD(IsDirty)(VOID);
!         STDMETHOD(Save)(LPCOLESTR, BOOL);
!         STDMETHOD(SaveCompleted)(LPCOLESTR);
!         STDMETHOD(GetCurFile)(LPOLESTR FAR*);
      END_INTERFACE_PART(PersistFileExt)
  
!     DECLARE_INTERFACE_MAP()
  };
  
  /////////////////////////////////////////////////////////////////////////////
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.8 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.9
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.8	Mon Jan 15 15:03:13 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm	Sat Feb 10 10:28:15 2007
***************
*** 198,204 ****
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.14</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.15</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.9 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.10
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.9	Mon Jan 15 15:03:16 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm	Sat Feb 10 10:28:39 2007
***************
*** 18,24 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.14 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.15 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.11 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.12
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.11	Mon Jan 15 15:03:16 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm	Sat Feb 10 10:28:39 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.14 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.15 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.12 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.13
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.12	Mon Jan 15 15:03:16 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm	Sat Feb 10 10:28:39 2007
***************
*** 19,25 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.14 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.15 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.14<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.15<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
***************
*** 1547,1554 ****
  lock semantics on top of AFS lock semantics it is important to understand how
  AFS file locks work.&nbsp; In Windows there are no special privileges
  associated with obtaining file locks.&nbsp; If you can read or execute a file,
! then you can obtain a read lock.&nbsp; If you can write or create a file, then
! you can obtain a write lock.&nbsp; In AFS if you can write to a file, then you
  can obtain a write lock.&nbsp; However, in AFS if you can read a file it does
  not mean that you can obtain a read lock on it.&nbsp;&nbsp; The ability to
  obtain read locks is granted only if you have the lock (or ‘k’) privilege.&nbsp;
--- 1547,1555 ----
  lock semantics on top of AFS lock semantics it is important to understand how
  AFS file locks work.&nbsp; In Windows there are no special privileges
  associated with obtaining file locks.&nbsp; If you can read or execute a file,
! then you can obtain shared and exclusive locks.&nbsp; In general, a Windows shared
! lock equates to an AFS read lock and a Windows exclusive lock equates to an AFS 
! write lock.&nbsp; In AFS if you can write to a file, then you
  can obtain a write lock.&nbsp; However, in AFS if you can read a file it does
  not mean that you can obtain a read lock on it.&nbsp;&nbsp; The ability to
  obtain read locks is granted only if you have the lock (or ‘k’) privilege.&nbsp;
***************
*** 1561,1588 ****
  write locks because the contents of the volume cannot be changed by the client.</p>
  
  <p class=MsoNormal>Since Microsoft Windows applications almost always attempt
! to obtain a temporary read lock when accessing files the OpenAFS Client’s
  CIFS-AFS gateway implements the following semantics in order to reduce the
  inconvenience on end users.&nbsp; </p>
  
  <ul style='margin-top:0pt' type=disc>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
       the file is located on a read-only volume and the application requests a
!      read lock, the CIFS-AFS server will grant the lock request without asking
       the AFS file server.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
!      the file is located on a read-only volume and the application requests a write
!      lock, the CIFS-AFS server will refuse the lock request and return a read
!      only error.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
!      the file is located on a read-write volume and the application requests a
!      write lock, the CIFS-AFS server will request a lock from the AFS file
       server.&nbsp; If granted by the file server, then the CIFS-AFS server will
!      grant the lock request.&nbsp; Otherwise, the request will be denied either
!      with an access denied or an in use error.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
       the file is located on a read-write volume and the application requests a
!      read lock, the CIFS-AFS server will request a lock from the AFS file
       server.&nbsp; If granted by the file server, then the CIFS-AFS server
       grants the lock request.&nbsp; If the request is denied due to an access
       denied error and the user has the lookup and read privileges but not the
--- 1562,1602 ----
  write locks because the contents of the volume cannot be changed by the client.</p>
  
  <p class=MsoNormal>Since Microsoft Windows applications almost always attempt
! to obtain a temporary exclusive lock when accessing files the OpenAFS Client’s
  CIFS-AFS gateway implements the following semantics in order to reduce the
  inconvenience on end users.&nbsp; </p>
  
  <ul style='margin-top:0pt' type=disc>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
       the file is located on a read-only volume and the application requests a
!      shared lock, the CIFS-AFS server will grant the lock request without asking
       the AFS file server.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
!      the file is located on a read-only volume and the application opens the 
!      file with write access and requests an exclusive lock, the CIFS-AFS server 
!      will refuse the lock request and return a read only error.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
!      the file is located on a read-only volume and the application opens the 
!      file with only read access and requests an exclusive lock, the CIFS-AFS server 
!      will fulfill the lock request with a read lock.</li>
!  <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
!      the file is located on a read-write volume and the application requests an
!      exclusive lock, the CIFS-AFS server will request a write lock from the AFS file
       server.&nbsp; If granted by the file server, then the CIFS-AFS server will
!      grant the lock request.&nbsp; 
! 
!      If the request is denied due to an access denied error and the user has the 
!      lookup, read and lock privileges and the file was opened for read only access, 
!      then the CIFS-AFS server will request a read lock from the file server.&nbsp;
! 
!      If the request is denied due to an access denied error and the user has the 
!      lookup and read privileges but not the lock privilege, then the CIFS-AFS 
!      server will grant the request even though the AFS file server said ‘no’.&nbsp; 
!      If the user does not have at least those permissions, the CIFS-AFS server 
!      will deny the request.</li>
   <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list 36.0pt'>If
       the file is located on a read-write volume and the application requests a
!      shared lock, the CIFS-AFS server will request a read lock from the AFS file
       server.&nbsp; If granted by the file server, then the CIFS-AFS server
       grants the lock request.&nbsp; If the request is denied due to an access
       denied error and the user has the lookup and read privileges but not the
***************
*** 2124,2129 ****
--- 2138,2149 ----
  Start and Stop Service features of the AFS System Tray tool and the AFS Control
  Panel will not work unless they are “Run as Administrator”.</p>
  
+ <p class=MsoBodyText>
+ The help files provided with OpenAFS are in .HLP format.  <a href="http://support.microsoft.com/kb/917607">
+ Windows Vista does not include a help engine for this format.</a>  <a href="http://www.secure-endpoints.com>
+ Secure Endpoints Inc.</a> is funding the development of compatible HtmlHelp (.CHM) files.
+ </p>
+ 
  <h1><a name="_Toc154229405"></a><a name="_Toc152605084"></a><a
  name="_Toc115416145"></a><a name="_Toc139993133"></a><a name="_Toc126872210"></a><a
  name="_Toc115417112"></a><a name="_Toc115417081"></a><span style='mso-bookmark:
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.7 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.8
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.7	Mon Jan 15 15:03:17 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm	Sat Feb 10 10:28:39 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.14 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.15 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.6 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.8
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.6	Mon Jan 15 18:41:30 2007
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Fri Feb  2 10:40:08 2007
***************
*** 542,548 ****
    File "${AFS_CLIENT_BUILDDIR}\aklog.exe"
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds.exe"	   "$INSTDIR\Client\Program\afscreds.exe"    "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll" "$INSTDIR\Client\Program\afs_shl_ext.dll" "$INSTDIR"
!   File "${AFS_CLIENT_BUILDDIR}\afsd_service.exe"
    File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
    File "${AFS_DESTDIR}\bin\kpasswd.exe"
    File "${AFS_SERVER_BUILDDIR}\pts.exe"
--- 542,548 ----
    File "${AFS_CLIENT_BUILDDIR}\aklog.exe"
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds.exe"	   "$INSTDIR\Client\Program\afscreds.exe"    "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afs_shl_ext.dll" "$INSTDIR\Client\Program\afs_shl_ext.dll" "$INSTDIR"
!   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afsd_service.exe" "$INSTDIR\Client\Program\afsd_service.exe" "$INSTDIR"
    File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
    File "${AFS_DESTDIR}\bin\kpasswd.exe"
    File "${AFS_SERVER_BUILDDIR}\pts.exe"
***************
*** 1303,1315 ****
     ; Check that RPC functions are installed (I believe any one of these can be present for
     ; OpenAFS to work)
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_np"
!    StrCmp $R0 "rpcrt4.dll" +1 contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_ip_tcp"
!    StrCmp $R0 "rpcrt4.dll" +1 contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncadg_ip_udp"
!    StrCmp $R0 "rpcrt4.dll" +1 contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_http"
!    StrCmp $R0 "rpcrt4.dll" +1 contInstall2
     
     MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "An error was detected with your Windows RPC installation. Please make sure Windows RPC is installed before installing OpenAFS."
     Abort
--- 1303,1315 ----
     ; Check that RPC functions are installed (I believe any one of these can be present for
     ; OpenAFS to work)
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_np"
!    StrCmp $R0 "rpcrt4.dll" contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_ip_tcp"
!    StrCmp $R0 "rpcrt4.dll" contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncadg_ip_udp"
!    StrCmp $R0 "rpcrt4.dll" contInstall2
     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\RPC\ClientProtocols" "ncacn_http"
!    StrCmp $R0 "rpcrt4.dll" contInstall2
     
     MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "An error was detected with your Windows RPC installation. Please make sure Windows RPC is installed before installing OpenAFS."
     Abort
Index: openafs/src/WINNT/netidmgr_plugin/afsfuncs.c
diff -c openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.3 openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.4
*** openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.3	Mon Oct 16 09:55:34 2006
--- openafs/src/WINNT/netidmgr_plugin/afsfuncs.c	Fri Feb  9 15:12:38 2007
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.3 2006/10/16 13:55:34 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.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. */
***************
*** 727,734 ****
      char	RealmName[128];
      char	CellName[128];
      char	ServiceName[128];
! 	khm_handle	confighandle;
! 	khm_int32	supports_krb4 = 1;
  
      /* signalling */
      BOOL        bGotCreds = FALSE; /* got creds? */
--- 727,734 ----
      char	RealmName[128];
      char	CellName[128];
      char	ServiceName[128];
!     khm_handle	confighandle;
!     khm_int32	supports_krb4 = 1;
  
      /* signalling */
      BOOL        bGotCreds = FALSE; /* got creds? */
***************
*** 767,773 ****
      }
  
      StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
!                   afs_realm_of_cell(&ak_cellconfig));
  
      if (strlen(service) == 0)
          StringCbCopyA(ServiceName, sizeof(ServiceName), "afs");
--- 767,773 ----
      }
  
      StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
!                   afs_realm_of_cell(&ak_cellconfig, FALSE));
  
      if (strlen(service) == 0)
          StringCbCopyA(ServiceName, sizeof(ServiceName), "afs");
***************
*** 844,850 ****
          r = pkrb5_cc_set_flags(context, k5cc, flags);
  #endif
          r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
!         if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
              r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
              /* Next try Service@REALM */
              pkrb5_free_principal(context, increds.server);
--- 844,867 ----
          r = pkrb5_cc_set_flags(context, k5cc, flags);
  #endif
          r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
! 	if ((r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
! 	      r == KRB5KRB_ERR_GENERIC /* Heimdal */) &&
! 	     !RealmName[0]) {
! 	    StringCbCopyA(RealmName, sizeof(RealmName), 
! 			  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,
! 					 CellName,
! 					 0);
!             if (r == 0)
!                 r = pkrb5_get_credentials(context, 0, k5cc, 
!                                           &increds, &k5creds);
! 	}
! 	if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
              r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
              /* Next try Service@REALM */
              pkrb5_free_principal(context, increds.server);
***************
*** 1168,1174 ****
  /* afs_realm_of_cell():               */
  /**************************************/
  static char *
! afs_realm_of_cell(afs_conf_cell *cellconfig)
  {
      char krbhst[MAX_HSTNM]="";
      static char krbrlm[REALM_SZ+1]="";
--- 1185,1191 ----
  /* afs_realm_of_cell():               */
  /**************************************/
  static char *
! afs_realm_of_cell(afs_conf_cell *cellconfig, BOOL referral_fallback)
  {
      char krbhst[MAX_HSTNM]="";
      static char krbrlm[REALM_SZ+1]="";
***************
*** 1179,1214 ****
      if (!cellconfig)
          return 0;
  
!     if ( pkrb5_init_context ) {
!         r = pkrb5_init_context(&ctx); 
!         if ( !r )
!             r = pkrb5_get_host_realm(ctx, cellconfig->hostName[0], &realmlist);
!         if ( !r && realmlist && realmlist[0] ) {
!             StringCbCopyA(krbrlm, sizeof(krbrlm), realmlist[0]);
!             pkrb5_free_host_realm(ctx, realmlist);
!         }
!         if (ctx)
!             pkrb5_free_context(ctx);
!     }
! 
!     if ( !krbrlm[0] ) {
!         StringCbCopyA(krbrlm, sizeof(krbrlm), 
!                       (char *)(*pkrb_realmofhost)(cellconfig->hostName[0]));
!         if ((*pkrb_get_krbhst)(krbhst, krbrlm, 1) != KSUCCESS)
!             krbrlm[0] = '\0';
!     }
! 
!     if ( !krbrlm[0] ) {
!         char *s = krbrlm;
!         char *t = cellconfig->name;
!         int c;
! 
!         while (c = *t++)
!         {
!             if (islower(c)) c=toupper(c);
!             *s++ = c;
!         }
!         *s++ = 0;
      }
      return(krbrlm);
  }
--- 1196,1240 ----
      if (!cellconfig)
          return 0;
  
!     if (referral_fallback) {
! 	char * p;
! 	p = strchr(cellconfig->hostName[0], '.');
! 	if (p++)
! 	    StringCbCopyA(krbrlm, sizeof(krbrlm), p);
! 	else
! 	    StringCbCopyA(krbrlm, sizeof(krbrlm), cellconfig->name);
! 	strupr(krbrlm);
!     } else {
! 	if ( pkrb5_init_context ) {
! 	    r = pkrb5_init_context(&ctx); 
! 	    if ( !r )
! 		r = pkrb5_get_host_realm(ctx, cellconfig->hostName[0], &realmlist);
! 	    if ( !r && realmlist && realmlist[0] ) {
! 		StringCbCopyA(krbrlm, sizeof(krbrlm), realmlist[0]);
! 		pkrb5_free_host_realm(ctx, realmlist);
! 	    }
! 	    if (ctx)
! 		pkrb5_free_context(ctx);
! 	}
! 
! 	if (r) {
! 	    if (pkrb_get_krbhst && pkrb_realmofhost) {
! 		StringCbCopyA(krbrlm, sizeof(krbrlm), 
! 			       (char *)(*pkrb_realmofhost)(cellconfig->hostName[0]));
! 		if ((*pkrb_get_krbhst)(krbhst, krbrlm, 1) != KSUCCESS)
! 		    krbrlm[0] = '\0';
! 	    }
! 
! 	    if ( !krbrlm[0] ) {
! 		char * p;
! 		p = strchr(cellconfig->hostName[0], '.');
! 		if (p++)
! 		    StringCbCopyA(krbrlm, sizeof(krbrlm), p);
! 		else
! 		    StringCbCopyA(krbrlm, sizeof(krbrlm), cellconfig->name);
! 		strupr(krbrlm);
! 	    }
! 	}
      }
      return(krbrlm);
  }
Index: openafs/src/WINNT/netidmgr_plugin/afsfuncs.h
diff -c openafs/src/WINNT/netidmgr_plugin/afsfuncs.h:1.1.2.3 openafs/src/WINNT/netidmgr_plugin/afsfuncs.h:1.1.2.4
*** openafs/src/WINNT/netidmgr_plugin/afsfuncs.h:1.1.2.3	Mon Oct 16 09:55:35 2006
--- openafs/src/WINNT/netidmgr_plugin/afsfuncs.h	Fri Feb  9 15:12:38 2007
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.h,v 1.1.2.3 2006/10/16 13:55:35 jaltman Exp $ */
  
  #ifndef __KHIMAIRA_AFSFUNCS_H
  #define __KHIMAIRA_AFSFUNCS_H
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.h,v 1.1.2.4 2007/02/09 20:12:38 jaltman Exp $ */
  
  #ifndef __KHIMAIRA_AFSFUNCS_H
  #define __KHIMAIRA_AFSFUNCS_H
***************
*** 73,79 ****
  
  void afs_report_error(LONG rc, LPCSTR FailedFunctionName);
  
! static char *afs_realm_of_cell(afs_conf_cell *);
  static long afs_get_cellconfig_callback(void *, struct sockaddr_in *, char *);
  static int afs_get_cellconfig(char *, afs_conf_cell *, char *);
  
--- 73,79 ----
  
  void afs_report_error(LONG rc, LPCSTR FailedFunctionName);
  
! static char *afs_realm_of_cell(afs_conf_cell *, BOOL);
  static long afs_get_cellconfig_callback(void *, struct sockaddr_in *, char *);
  static int afs_get_cellconfig(char *, afs_conf_cell *, char *);
  
Index: openafs/src/WINNT/netidmgr_plugin/version.rc
diff -c openafs/src/WINNT/netidmgr_plugin/version.rc:1.1.2.4 openafs/src/WINNT/netidmgr_plugin/version.rc:1.1.2.5
*** openafs/src/WINNT/netidmgr_plugin/version.rc:1.1.2.4	Mon Oct 16 09:55:35 2006
--- openafs/src/WINNT/netidmgr_plugin/version.rc	Tue Jan 30 07:31:46 2007
***************
*** 23,36 ****
   *
   */
  
! /* $Id: version.rc,v 1.1.2.4 2006/10/16 13:55:35 jaltman Exp $ */
  
  #include<netidmgr_version.h>
  #include<afsp_version.h>
  
  #ifndef LANGVER
  
! #define STR_FILEDESC "OpenAFS Plugin for NetIDMgr"
  #define STR_INTNAME  "afscred"
  #define STR_ORIGNAME "afscred.dll"
  
--- 23,36 ----
   *
   */
  
! /* $Id: version.rc,v 1.1.2.5 2007/01/30 12:31:46 jaltman Exp $ */
  
  #include<netidmgr_version.h>
  #include<afsp_version.h>
  
  #ifndef LANGVER
  
! #define STR_FILEDESC "OpenAFS Plugin for Network Identity Manager"
  #define STR_INTNAME  "afscred"
  #define STR_ORIGNAME "afscred.dll"
  
***************
*** 68,76 ****
          VALUE "FileDescription", STR_FILEDESC
          VALUE "FileVersion",     AFSPLUGIN_VERSION_STR
          VALUE "InternalName",    STR_INTNAME
!         VALUE "LegalCopyright",  "(C) 2005,2006 Secure Endpoints Inc."
          VALUE "OriginalFilename", STR_ORIGNAME
!         VALUE "ProductName",     "OpenAFS Plugin for NetIDMgr"
          VALUE "ProductVersion",  AFSPLUGIN_VERSION_STR
  #ifndef LANGVER
          VALUE NIMV_MODULE,       "OpenAFS"
--- 68,76 ----
          VALUE "FileDescription", STR_FILEDESC
          VALUE "FileVersion",     AFSPLUGIN_VERSION_STR
          VALUE "InternalName",    STR_INTNAME
!         VALUE "LegalCopyright",  "(C) 2005-2007 Secure Endpoints Inc."
          VALUE "OriginalFilename", STR_ORIGNAME
!         VALUE "ProductName",     "OpenAFS Plugin for Network Identity Manager"
          VALUE "ProductVersion",  AFSPLUGIN_VERSION_STR
  #ifndef LANGVER
          VALUE NIMV_MODULE,       "OpenAFS"
Index: openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc
diff -c openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.2 openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.4
*** openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.2	Thu Oct 12 17:19:46 2006
--- openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc	Mon Feb 12 22:49:27 2007
***************
*** 57,71 ****
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     LTEXT           "AFS Token Options",IDC_STATIC,7,7,286,11,SS_SUNKEN | NOT WS_GROUP
!     CONTROL         "Obtain &AFS tokens",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,19,74,12
!     GROUPBOX        "Token for",IDC_STATIC,7,32,286,54
      LTEXT           "&Cell",IDC_STATIC,12,41,42,10
!     COMBOBOX        IDC_NCAFS_CELL,57,38,152,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Realm",IDC_STATIC,12,57,42,10
!     COMBOBOX        IDC_NCAFS_REALM,57,54,152,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Method",IDC_STATIC,12,73,42,10
!     COMBOBOX        IDC_NCAFS_METHOD,57,70,152,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
      PUSHBUTTON      "&Add/Update",IDC_NCAFS_ADD_TOKEN,213,38,77,13,BS_NOTIFY
      PUSHBUTTON      "&Delete",IDC_NCAFS_DELETE_TOKEN,213,70,77,13,BS_NOTIFY
      CONTROL         "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,88,286,71
--- 57,71 ----
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     LTEXT           "AFS Credential Options",IDC_STATIC,7,7,286,11,SS_SUNKEN | NOT WS_GROUP
!     CONTROL         "Obtain &AFS credentials",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,19,140,12
!     GROUPBOX        "Credential for",IDC_STATIC,7,32,286,54
      LTEXT           "&Cell",IDC_STATIC,12,41,42,10
!     COMBOBOX        IDC_NCAFS_CELL,57,38,152,48,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Realm",IDC_STATIC,12,57,42,10
!     COMBOBOX        IDC_NCAFS_REALM,57,54,152,48,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Method",IDC_STATIC,12,73,42,10
!     COMBOBOX        IDC_NCAFS_METHOD,57,70,152,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
      PUSHBUTTON      "&Add/Update",IDC_NCAFS_ADD_TOKEN,213,38,77,13,BS_NOTIFY
      PUSHBUTTON      "&Delete",IDC_NCAFS_DELETE_TOKEN,213,70,77,13,BS_NOTIFY
      CONTROL         "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,88,286,71
***************
*** 76,83 ****
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     CONTROL         "Obtain AFS tokens for new identities",IDC_CFG_OBTAIN,
!                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,133,10
  END
  
  IDD_CFG_ID_TAB DIALOGEX 0, 0, 235, 151
--- 76,83 ----
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     CONTROL         "Obtain AFS credentials for new identities",IDC_CFG_OBTAIN,
!                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,160,10
  END
  
  IDD_CFG_ID_TAB DIALOGEX 0, 0, 235, 151
***************
*** 85,98 ****
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     CONTROL         "Obtain &AFS tokens",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,74,12
!     GROUPBOX        "Token for",IDC_STATIC,7,18,221,56
      LTEXT           "&Cell",IDC_STATIC,13,28,42,10
!     COMBOBOX        IDC_NCAFS_CELL,57,25,109,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Realm",IDC_STATIC,13,44,42,10
!     COMBOBOX        IDC_NCAFS_REALM,57,41,109,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Method",IDC_STATIC,13,60,42,10
!     COMBOBOX        IDC_NCAFS_METHOD,57,57,109,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
      PUSHBUTTON      "&Add/Update",IDC_NCAFS_ADD_TOKEN,174,26,50,13,BS_NOTIFY
      PUSHBUTTON      "&Delete",IDC_NCAFS_DELETE_TOKEN,174,56,50,13,BS_NOTIFY
      CONTROL         "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,75,221,69
--- 85,98 ----
  EXSTYLE WS_EX_CONTROLPARENT
  FONT 8, "MS Shell Dlg", 400, 0, 0x1
  BEGIN
!     CONTROL         "Obtain &AFS credentials",IDC_NCAFS_OBTAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,140,12
!     GROUPBOX        "Credential for",IDC_STATIC,7,18,221,56
      LTEXT           "&Cell",IDC_STATIC,13,28,42,10
!     COMBOBOX        IDC_NCAFS_CELL,57,25,109,48,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Realm",IDC_STATIC,13,44,42,10
!     COMBOBOX        IDC_NCAFS_REALM,57,41,109,48,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
      LTEXT           "&Method",IDC_STATIC,13,60,42,10
!     COMBOBOX        IDC_NCAFS_METHOD,57,57,109,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
      PUSHBUTTON      "&Add/Update",IDC_NCAFS_ADD_TOKEN,174,26,50,13,BS_NOTIFY
      PUSHBUTTON      "&Delete",IDC_NCAFS_DELETE_TOKEN,174,56,50,13,BS_NOTIFY
      CONTROL         "",IDC_NCAFS_TOKENLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,75,221,69
***************
*** 113,121 ****
      EDITTEXT        IDC_CFG_VERSION,68,54,172,14,ES_AUTOHSCROLL | ES_READONLY
      LTEXT           "Company",IDC_CFG_LBL_COMPANY,14,75,31,8
      EDITTEXT        IDC_CFG_COMPANY,68,72,172,14,ES_AUTOHSCROLL | ES_READONLY
!     PUSHBUTTON      "Open AFS Control Panel ...",IDC_CFG_CPL,128,161,112,14
      GROUPBOX        "Startup options",IDC_CFG_STARTGRP,7,99,241,48
!     CONTROL         "Prevent AFSCreds.exe from starting automatically everytime you log in to Windows.",IDC_CFG_STARTAFSCREDS,
                      "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,108,226,22
  END
  
--- 113,121 ----
      EDITTEXT        IDC_CFG_VERSION,68,54,172,14,ES_AUTOHSCROLL | ES_READONLY
      LTEXT           "Company",IDC_CFG_LBL_COMPANY,14,75,31,8
      EDITTEXT        IDC_CFG_COMPANY,68,72,172,14,ES_AUTOHSCROLL | ES_READONLY
!     PUSHBUTTON      "OpenAFS Control Panel ...",IDC_CFG_CPL,128,161,112,14
      GROUPBOX        "Startup options",IDC_CFG_STARTGRP,7,99,241,48
!     CONTROL         "Prevent AFSCreds.exe from starting automatically when you log in to Windows.",IDC_CFG_STARTAFSCREDS,
                      "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,108,226,22
  END
  
***************
*** 186,201 ****
  
  STRINGTABLE 
  BEGIN
!     IDS_AFS_SHORT_DESC      "AFS tokens"
!     IDS_AFS_LONG_DESC       "AFS tokens"
      IDS_AFS_NAME            "AFS"
      IDS_NCAFS_COL_CELL      "Cell"
      IDS_NCAFS_COL_REALM     "Realm"
      IDS_NCAFS_COL_METHOD    "Method"
      IDS_NC_METHOD_AUTO      "(Automatic)"
!     IDS_NC_METHOD_KRB5      "Kerberos 5"
!     IDS_NC_METHOD_KRB4      "Kerberos 4"
!     IDS_NC_METHOD_KRB524    "Krb524"
      IDS_NC_REALM_AUTO       "(Automatic)"
  END
  
--- 186,201 ----
  
  STRINGTABLE 
  BEGIN
!     IDS_AFS_SHORT_DESC      "AFS credentials"
!     IDS_AFS_LONG_DESC       "AFS credentials"
      IDS_AFS_NAME            "AFS"
      IDS_NCAFS_COL_CELL      "Cell"
      IDS_NCAFS_COL_REALM     "Realm"
      IDS_NCAFS_COL_METHOD    "Method"
      IDS_NC_METHOD_AUTO      "(Automatic)"
!     IDS_NC_METHOD_KRB5      "Kerberos v5"
!     IDS_NC_METHOD_KRB4      "Kerberos v4"
!     IDS_NC_METHOD_KRB524    "Kerberos v5 to v4"
      IDS_NC_REALM_AUTO       "(Automatic)"
  END
  
***************
*** 211,219 ****
                              "The realm name you entered contains invalid characters."
      IDS_NC_TT_CANT_UPDATE   "Can't update token"
      IDS_AFS_CREDTEXT_DIS    "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: AFS is disabled. (click <a id=""AfsCred:Enable"">here</a> to enable)</p>"
!     IDS_AFS_CREDTEXT_0      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: No tokens selected</p>"
!     IDS_AFS_CREDTEXT_1      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Token for cell %s</p>"
!     IDS_AFS_CREDTEXT_N      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Tokens for cells %s</p>"
      IDS_ATTR_CELL_SHORT_DESC "Cell"
      IDS_ATTR_REALM_SHORT_DESC "Realm"
      IDS_ATTR_METHOD_SHORT_DESC "Method"
--- 211,219 ----
                              "The realm name you entered contains invalid characters."
      IDS_NC_TT_CANT_UPDATE   "Can't update token"
      IDS_AFS_CREDTEXT_DIS    "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: AFS is disabled. (click <a id=""AfsCred:Enable"">here</a> to enable)</p>"
!     IDS_AFS_CREDTEXT_0      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: No credentials selected</p>"
!     IDS_AFS_CREDTEXT_1      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Credential for cell %s</p>"
!     IDS_AFS_CREDTEXT_N      "<p><a id=""SwitchPanel"" param=""AfsCred""><b>AFS</b></a><tab>: Credentials for cells %s</p>"
      IDS_ATTR_CELL_SHORT_DESC "Cell"
      IDS_ATTR_REALM_SHORT_DESC "Realm"
      IDS_ATTR_METHOD_SHORT_DESC "Method"
***************
*** 232,259 ****
      IDS_CFG_MAIN_SHORT      "AFS"
      IDS_CFG_SVCSTATUS       "Status is unknown,Stopped,Starting ...,Stopping ...,Running,Continuing ...,Pausing ...,Paused,Status is unknown"
      IDS_NC_METHODL_AUTO     "(Automatically determine method)"
!     IDS_NC_METHODL_KRB5     "Kerberos 5"
!     IDS_NC_METHODL_KRB4     "Kerberos 4"
!     IDS_NC_METHODL_KRB524   "Krb524"
      IDS_NC_METHOD_INVALID   "(Invalid method identifier)"
!     IDS_NC_TT_CONFLICT      "Tokens for cell %s are already listed for identity %s.\nDo you want to keep the token for this cell for other identities?"
!     IDS_NC_TT_PROBLEM       "Problem with new token"
!     IDS_NC_TT_CONFLICTM     "Tokens for cell %s are already listed for identity %s.\nDo you want to keep the token for other identities as well as this one?"
  END
  
  STRINGTABLE 
  BEGIN
!     IDS_NC_TT_DETAILS       "Details about token"
!     IDS_NC_TT_CONFLICTD     "This token already exists under a different identity."
!     IDS_NC_TT_EXPIRED       "Currently existing token has expired."
!     IDS_NC_TT_EXISTS        "This token already exists for this identity."
!     IDS_NC_TT_NEW           "This is a new token for this identity."
      IDS_CFG_CANTSTART       "The AFS service could not be started.\n\n"
      IDS_CFG_CANTSTOP        "The AFS service could not be stopped.\n\n"
      IDS_ERR_CELLCONFIG      "Could not locate configuration information for cell %1!S!."
      IDS_ERR_NOSERVICE       "The AFS service is not running.  If OpenAFS is installed, you can start the service using the AFS configuration panel."
      IDS_ERR_CELLCONFIG_S    "The error code returned was %2!d!."
!     IDS_ERR_GENERAL         "Tokens could not be obtained for cell %1!S!."
  END
  
  #endif    // English (U.S.) resources
--- 232,259 ----
      IDS_CFG_MAIN_SHORT      "AFS"
      IDS_CFG_SVCSTATUS       "Status is unknown,Stopped,Starting ...,Stopping ...,Running,Continuing ...,Pausing ...,Paused,Status is unknown"
      IDS_NC_METHODL_AUTO     "(Automatically determine method)"
!     IDS_NC_METHODL_KRB5     "Kerberos v5"
!     IDS_NC_METHODL_KRB4     "Kerberos v4"
!     IDS_NC_METHODL_KRB524   "Kerberos v5 to v4"
      IDS_NC_METHOD_INVALID   "(Invalid method identifier)"
!     IDS_NC_TT_CONFLICT      "Credentials for cell %s are already listed for identity %s.\nDo you want to keep the credentials for this cell for other identities?"
!     IDS_NC_TT_PROBLEM       "Problem with new credential"
!     IDS_NC_TT_CONFLICTM     "Credentials for cell %s are already listed for identity %s.\nDo you want to keep the credentials for other identities as well as this one?"
  END
  
  STRINGTABLE 
  BEGIN
!     IDS_NC_TT_DETAILS       "Details about credential"
!     IDS_NC_TT_CONFLICTD     "This credential already exists under a different identity."
!     IDS_NC_TT_EXPIRED       "Currently existing credential has expired."
!     IDS_NC_TT_EXISTS        "This credential already exists for this identity."
!     IDS_NC_TT_NEW           "This is a new credential for this identity."
      IDS_CFG_CANTSTART       "The AFS service could not be started.\n\n"
      IDS_CFG_CANTSTOP        "The AFS service could not be stopped.\n\n"
      IDS_ERR_CELLCONFIG      "Could not locate configuration information for cell %1!S!."
      IDS_ERR_NOSERVICE       "The AFS service is not running.  If OpenAFS is installed, you can start the service using the AFS configuration panel."
      IDS_ERR_CELLCONFIG_S    "The error code returned was %2!d!."
!     IDS_ERR_GENERAL         "Credentials could not be obtained for cell %1!S!."
  END
  
  #endif    // English (U.S.) resources
Index: openafs/src/afs/Makefile.am
diff -c openafs/src/afs/Makefile.am:1.1 openafs/src/afs/Makefile.am:removed
*** openafs/src/afs/Makefile.am:1.1	Tue Jun  5 16:17:49 2001
--- openafs/src/afs/Makefile.am	Tue Feb 13 21:16:07 2007
***************
*** 1,5 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:49 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- SUBDIRS= "foo"
--- 0 ----
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.86.4.5 openafs/src/afs/afs_call.c:1.86.4.6
*** openafs/src/afs/afs_call.c:1.86.4.5	Thu Dec 28 16:30:27 2006
--- openafs/src/afs/afs_call.c	Thu Feb  8 20:06:11 2007
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.86.4.5 2006/12/28 21:30:27 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_call.c,v 1.86.4.6 2007/02/09 01:06:11 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 238,244 ****
  
  #if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
  struct afsd_thread_info {
! #if !defined(INIT_WORK_HAS_DATA)
      struct work_struct tq;
  #endif
      unsigned long parm;
--- 238,244 ----
  
  #if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
  struct afsd_thread_info {
! #if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
      struct work_struct tq;
  #endif
      unsigned long parm;
***************
*** 373,385 ****
  }
  
  void
! #if !defined(INIT_WORK_HAS_DATA)
  afsd_launcher(struct work_struct *work)
  #else
  afsd_launcher(void *rock)
  #endif
  {
! #if !defined(INIT_WORK_HAS_DATA)
      struct afsd_thread_info *rock = container_of(work, struct afsd_thread_info, tq);
  #endif
  
--- 373,385 ----
  }
  
  void
! #if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
  afsd_launcher(struct work_struct *work)
  #else
  afsd_launcher(void *rock)
  #endif
  {
! #if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
      struct afsd_thread_info *rock = container_of(work, struct afsd_thread_info, tq);
  #endif
  
Index: openafs/src/afs/afs_callback.c
diff -c openafs/src/afs/afs_callback.c:1.39.2.1 openafs/src/afs/afs_callback.c:1.39.2.2
*** openafs/src/afs/afs_callback.c:1.39.2.1	Thu Jan 11 22:24:36 2007
--- openafs/src/afs/afs_callback.c	Fri Feb  2 22:28:03 2007
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_callback.c,v 1.39.2.1 2007/01/12 03:24:36 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_callback.c,v 1.39.2.2 2007/02/03 03:28:03 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 136,143 ****
      a_result->lock.readersReading = tvc->lock.readers_reading;
      a_result->lock.numWaiting = tvc->lock.num_waiting;
  #if defined(INSTRUMENT_LOCKS)
!     a_result->lock.pid_last_reader = tvc->lock.pid_last_reader;
!     a_result->lock.pid_writer = tvc->lock.pid_writer;
      a_result->lock.src_indicator = tvc->lock.src_indicator;
  #else
      /* On osf20 , the vcache does not maintain these three fields */
--- 136,143 ----
      a_result->lock.readersReading = tvc->lock.readers_reading;
      a_result->lock.numWaiting = tvc->lock.num_waiting;
  #if defined(INSTRUMENT_LOCKS)
!     a_result->lock.pid_last_reader = MyPidxx2Pid(tvc->lock.pid_last_reader);
!     a_result->lock.pid_writer = MyPidxx2Pid(tvc->lock.pid_writer);
      a_result->lock.src_indicator = tvc->lock.src_indicator;
  #else
      /* On osf20 , the vcache does not maintain these three fields */
***************
*** 222,229 ****
      a_result->lock.readersReading = tvc->lock.readers_reading;
      a_result->lock.numWaiting = tvc->lock.num_waiting;
  #if defined(INSTRUMENT_LOCKS)
!     a_result->lock.pid_last_reader = tvc->lock.pid_last_reader;
!     a_result->lock.pid_writer = tvc->lock.pid_writer;
      a_result->lock.src_indicator = tvc->lock.src_indicator;
  #else
      /* On osf20 , the vcache does not maintain these three fields */
--- 222,229 ----
      a_result->lock.readersReading = tvc->lock.readers_reading;
      a_result->lock.numWaiting = tvc->lock.num_waiting;
  #if defined(INSTRUMENT_LOCKS)
!     a_result->lock.pid_last_reader = MyPidxx2Pid(tvc->lock.pid_last_reader);
!     a_result->lock.pid_writer = MyPidxx2Pid(tvc->lock.pid_writer);
      a_result->lock.src_indicator = tvc->lock.src_indicator;
  #else
      /* On osf20 , the vcache does not maintain these three fields */
Index: openafs/src/afs/afs_osi.h
diff -c openafs/src/afs/afs_osi.h:1.42.4.4 openafs/src/afs/afs_osi.h:1.42.4.5
*** openafs/src/afs/afs_osi.h:1.42.4.4	Thu Nov  9 18:30:52 2006
--- openafs/src/afs/afs_osi.h	Thu Feb  8 17:39:29 2007
***************
*** 212,219 ****
--- 212,223 ----
  /* should use curthread, but 'ps' can't display it */
  #define osi_ThreadUnique()	curproc
  #else
+ #ifdef AFS_LINUX_ENV
+ #define osi_ThreadUnique()	(current->pid)
+ #else
  #define osi_ThreadUnique()	getpid()
  #endif
+ #endif
  
  
  
Index: openafs/src/afs/afs_osi_gcpags.c
diff -c openafs/src/afs/afs_osi_gcpags.c:1.1.2.4 openafs/src/afs/afs_osi_gcpags.c:1.1.2.5
*** openafs/src/afs/afs_osi_gcpags.c:1.1.2.4	Wed Sep 27 16:02:45 2006
--- openafs/src/afs/afs_osi_gcpags.c	Thu Feb  8 20:30:16 2007
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_gcpags.c,v 1.1.2.4 2006/09/27 20:02:45 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.5 2007/02/09 01:30:16 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 230,242 ****
  afs_osi_TraverseProcTable()
  {
  #if !defined(LINUX_KEYRING_SUPPORT)
-     extern rwlock_t tasklist_lock __attribute__((weak));
      struct task_struct *p;
!  
      if (&tasklist_lock)
         read_lock(&tasklist_lock);
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
      else
  	rcu_read_lock();
  #endif
  
--- 230,246 ----
  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
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ #ifdef EXPORTED_TASKLIST_LOCK
      else
+ #endif
  	rcu_read_lock();
  #endif
  
***************
*** 263,272 ****
--- 267,280 ----
  	afs_GCPAGs_perproc_func(p);
      }
  #endif
+ #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
  #endif
Index: openafs/src/afs/afs_osi_pag.c
diff -c openafs/src/afs/afs_osi_pag.c:1.29.4.8 openafs/src/afs/afs_osi_pag.c:1.29.4.9
*** openafs/src/afs/afs_osi_pag.c:1.29.4.8	Mon Jan 15 10:51:01 2007
--- openafs/src/afs/afs_osi_pag.c	Thu Feb  8 19:27:00 2007
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.29.4.8 2007/01/15 15:51:01 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.29.4.9 2007/02/09 00:27:00 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 601,615 ****
  #if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT)
      if (pag == NOPAG) {
  	struct key *key;
! 	afs_uint32 pag, newpag;
  
  	key = request_key(&key_type_afs_pag, "_pag", NULL);
  	if (!IS_ERR(key)) {
  	    if (key_validate(key) == 0 && key->uid == 0) {	/* also verify in the session keyring? */
! 
! 		pag = (afs_uint32) key->payload.value;
! 		if (((pag >> 24) & 0xff) == 'A')
! 		    __setpag(&cred, pag, &newpag, 0);
  	    }
  	    key_put(key);
  	} 
--- 601,616 ----
  #if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT)
      if (pag == NOPAG) {
  	struct key *key;
! 	afs_uint32 upag, newpag;
  
  	key = request_key(&key_type_afs_pag, "_pag", NULL);
  	if (!IS_ERR(key)) {
  	    if (key_validate(key) == 0 && key->uid == 0) {	/* also verify in the session keyring? */
! 		upag = (afs_uint32) key->payload.value;
! 		if (((upag >> 24) & 0xff) == 'A') {
! 		    __setpag(&cred, upag, &newpag, 0);
! 		    pag = (afs_int32) upag;
! 		}
  	    }
  	    key_put(key);
  	} 
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.74.2.5 openafs/src/afs/afs_prototypes.h:1.74.2.6
*** openafs/src/afs/afs_prototypes.h:1.74.2.5	Mon Jan 15 10:51:01 2007
--- openafs/src/afs/afs_prototypes.h	Mon Jan 22 12:20:38 2007
***************
*** 538,543 ****
--- 538,547 ----
  extern int afs_InitReq(register struct vrequest *av, struct AFS_UCRED *acred);
  #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
  extern afs_uint32 afs_get_pag_from_groups(gid_t g0a, gid_t g1a);
+ #else
+ #ifdef AFS_LINUX26_ONEGROUP_ENV
+ extern afs_uint32 afs_get_pag_from_groups(struct group_info *gi);
+ #endif
  #endif
  extern void afs_get_groups_from_pag(afs_uint32 pag, gid_t * g0p, gid_t * g1p);
  extern afs_int32 PagInCred(const struct AFS_UCRED *cred);
Index: openafs/src/afs/afs_volume.c
diff -c openafs/src/afs/afs_volume.c:1.31.2.4 openafs/src/afs/afs_volume.c:1.31.2.5
*** openafs/src/afs/afs_volume.c:1.31.2.4	Mon Dec 18 21:34:05 2006
--- openafs/src/afs/afs_volume.c	Thu Jan 25 06:20:47 2007
***************
*** 19,25 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_volume.c,v 1.31.2.4 2006/12/19 02:34:05 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 19,25 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_volume.c,v 1.31.2.5 2007/01/25 11:20:47 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 688,701 ****
      } while (afs_Analyze(tconn, code, NULL, &treq, -1,	/* no op code for this */
  			 SHARED_LOCK, tcell));
  
-     /* RT 48959 - unclear if this should really go */
- #if 0
      if (code) {
  	/* If the client has yet to contact this cell and contact failed due
  	 * to network errors, mark the VLDB servers as back up.
  	 * That the client tried and failed can be determined from the
  	 * fact that there was a downtime incident, but CHasVolRef is not set.
  	 */
  	if (areq->networkError && !(tcell->states & CHasVolRef)) {
  	    int i;
  	    struct server *sp;
--- 688,701 ----
      } while (afs_Analyze(tconn, code, NULL, &treq, -1,	/* no op code for this */
  			 SHARED_LOCK, tcell));
  
      if (code) {
  	/* If the client has yet to contact this cell and contact failed due
  	 * to network errors, mark the VLDB servers as back up.
  	 * That the client tried and failed can be determined from the
  	 * fact that there was a downtime incident, but CHasVolRef is not set.
  	 */
+     /* RT 48959 - unclear if this should really go */
+ #if 0
  	if (areq->networkError && !(tcell->states & CHasVolRef)) {
  	    int i;
  	    struct server *sp;
***************
*** 707,718 ****
  		    afs_MarkServerUpOrDown(sap, 0);
  	    }
  	}
  	afs_CopyError(&treq, areq);
  	osi_FreeLargeSpace(tbuffer);
  	afs_PutCell(tcell, READ_LOCK);
  	return NULL;
      }
- #endif
      /*
       * Check to see if this cell has not yet referenced a volume.  If
       * it hasn't, it's just about to change its status, and we need to mark
--- 707,718 ----
  		    afs_MarkServerUpOrDown(sap, 0);
  	    }
  	}
+ #endif
  	afs_CopyError(&treq, areq);
  	osi_FreeLargeSpace(tbuffer);
  	afs_PutCell(tcell, READ_LOCK);
  	return NULL;
      }
      /*
       * Check to see if this cell has not yet referenced a volume.  If
       * it hasn't, it's just about to change its status, and we need to mark
Index: openafs/src/afs/lock.h
diff -c openafs/src/afs/lock.h:1.17.4.4 openafs/src/afs/lock.h:1.17.4.5
*** openafs/src/afs/lock.h:1.17.4.4	Fri Jan 12 11:29:03 2007
--- openafs/src/afs/lock.h	Fri Feb  2 22:28:03 2007
***************
*** 89,95 ****
  #if defined(AFS_SUN57_ENV)
  typedef kthread_t * afs_lock_tracker_t;
  #define MyPidxx (curthread)
! #define MyPidxx2Pid(x) (ttoproc(x)->p_pid)
  #elif defined(AFS_SUN5_ENV) || defined(AFS_OBSD_ENV)
  typedef unsigned int afs_lock_tracker_t;
  #define MyPidxx (curproc->p_pid)
--- 89,95 ----
  #if defined(AFS_SUN57_ENV)
  typedef kthread_t * afs_lock_tracker_t;
  #define MyPidxx (curthread)
! #define MyPidxx2Pid(x) (x ? ttoproc(x)->p_pid : 0)
  #elif defined(AFS_SUN5_ENV) || defined(AFS_OBSD_ENV)
  typedef unsigned int afs_lock_tracker_t;
  #define MyPidxx (curproc->p_pid)
***************
*** 104,110 ****
  #if defined(AFS_HPUX101_ENV)
  typedef struct proc * afs_lock_tracker_t;
  #define MyPidxx (u.u_procp)
! #define MyPidxx2Pid(x) ((afs_int32)p_pid(x))
  #else
  #if defined(AFS_SGI64_ENV)
  #if defined(AFS_SGI65_ENV)
--- 104,110 ----
  #if defined(AFS_HPUX101_ENV)
  typedef struct proc * afs_lock_tracker_t;
  #define MyPidxx (u.u_procp)
! #define MyPidxx2Pid(x) (x ? (afs_int32)p_pid(x) : 0)
  #else
  #if defined(AFS_SGI64_ENV)
  #if defined(AFS_SGI65_ENV)
***************
*** 120,126 ****
  #ifdef AFS_LINUX20_ENV
  typedef struct task_struct * afs_lock_tracker_t;
  #define MyPidxx (current)
! #define MyPidxx2Pid(x) ((x)->pid)
  #else
  #if defined(AFS_DARWIN_ENV)
  #if defined(AFS_DARWIN80_ENV)
--- 120,126 ----
  #ifdef AFS_LINUX20_ENV
  typedef struct task_struct * afs_lock_tracker_t;
  #define MyPidxx (current)
! #define MyPidxx2Pid(x) (x? (x)->pid : 0)
  #else
  #if defined(AFS_DARWIN_ENV)
  #if defined(AFS_DARWIN80_ENV)
Index: openafs/src/afs/LINUX/osi_machdep.h
diff -c openafs/src/afs/LINUX/osi_machdep.h:1.34.2.4 openafs/src/afs/LINUX/osi_machdep.h:1.34.2.5
*** openafs/src/afs/LINUX/osi_machdep.h:1.34.2.4	Mon Jan 15 10:51:02 2007
--- openafs/src/afs/LINUX/osi_machdep.h	Thu Feb  8 17:39:30 2007
***************
*** 28,33 ****
--- 28,43 ----
  
  #undef getuerror
  
+ #ifdef STRUCT_TASK_STRUCT_HAS_TGID
+ #define getpid() current->tgid
+ #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+ #define getppid() current->real_parent->tgid
+ #elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
+ #define getppid() current->parent->tgid
+ #else
+ #define getppid() current->p_opptr->tgid
+ #endif
+ #else /* !STRUCT_TASK_STRUCT_HAS_TGID */
  #define getpid() current->pid
  #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
  #define getppid() current->real_parent->pid
***************
*** 36,41 ****
--- 46,52 ----
  #else
  #define getppid() current->p_opptr->pid
  #endif
+ #endif /* STRUCT_TASK_STRUCT_HAS_TGID */
  
  #ifdef RECALC_SIGPENDING_TAKES_VOID
  #define RECALC_SIGPENDING(X) recalc_sigpending()
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.74.2.5 openafs/src/afs/LINUX/osi_module.c:1.74.2.6
*** openafs/src/afs/LINUX/osi_module.c:1.74.2.5	Tue Jan  2 10:41:41 2007
--- openafs/src/afs/LINUX/osi_module.c	Thu Feb  8 20:30:17 2007
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.74.2.5 2007/01/02 15:41:41 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.74.2.6 2007/02/09 01:30:17 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 154,160 ****
      struct task_struct *p, *q;
  
      /* search backward thru the circular list */
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
      read_lock(&tasklist_lock);
  #endif
      /* search backward thru the circular list */
--- 154,160 ----
      struct task_struct *p, *q;
  
      /* search backward thru the circular list */
! #if defined(EXPORTED_TASKLIST_LOCK) 
      read_lock(&tasklist_lock);
  #endif
      /* search backward thru the circular list */
***************
*** 164,177 ****
      for (p = current; p; p = p->prev_task) {
  #endif
  	if (p->pid == 1) {
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  	    read_unlock(&tasklist_lock);
  #endif
  	    return p->addr_limit.seg;
  	}
      }
  
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
      read_unlock(&tasklist_lock);
  #endif
      return 0;
--- 164,177 ----
      for (p = current; p; p = p->prev_task) {
  #endif
  	if (p->pid == 1) {
! #if defined(EXPORTED_TASKLIST_LOCK) 
  	    read_unlock(&tasklist_lock);
  #endif
  	    return p->addr_limit.seg;
  	}
      }
  
! #if defined(EXPORTED_TASKLIST_LOCK) 
      read_unlock(&tasklist_lock);
  #endif
      return 0;
Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.11.2.5 openafs/src/afs/LINUX/osi_probe.c:1.11.2.9
*** openafs/src/afs/LINUX/osi_probe.c:1.11.2.5	Thu Nov  9 18:12:51 2006
--- openafs/src/afs/LINUX/osi_probe.c	Tue Feb 13 17:54:11 2007
***************
*** 247,253 ****
  extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak));
  #endif
  extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak));
- extern rwlock_t tasklist_lock __attribute__((weak));
  
  
  /* Structures used to control probing.  We put all the details of which
--- 247,252 ----
***************
*** 515,521 ****
      (unsigned long)&sys_close,
  #elif defined(AFS_AMD64_LINUX20_ENV)
      /* On this platform, it's in a different section! */
!     (unsigned long)&tasklist_lock,
  #else
      (unsigned long)&init_mm,
  #endif
--- 514,520 ----
      (unsigned long)&sys_close,
  #elif defined(AFS_AMD64_LINUX20_ENV)
      /* On this platform, it's in a different section! */
!     (unsigned long)&generic_ro_fops,
  #else
      (unsigned long)&init_mm,
  #endif
***************
*** 537,543 ****
      0x1fffff,
      0x30000,
  #elif defined(AFS_AMD64_LINUX20_ENV)
!     (unsigned long)(&tasklist_lock) - 0x30000,
      0,
      0x6000,
  #elif defined(AFS_PPC64_LINUX26_ENV)
--- 536,542 ----
      0x1fffff,
      0x30000,
  #elif defined(AFS_AMD64_LINUX20_ENV)
!     (unsigned long)(&generic_ro_fops) - 0x30000,
      0,
      0x6000,
  #elif defined(AFS_PPC64_LINUX26_ENV)
***************
*** 556,564 ****
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size,
      0x3ffff,
!     0x30000,
  #else
      0, 0, 0, 0,
  #endif
--- 555,563 ----
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size - 0x10000,
      0x3ffff,
!     0x40000,
  #else
      0, 0, 0, 0,
  #endif
***************
*** 654,662 ****
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size,
      0x3ffff,
!     0x30000,
  #else
      0, 0, 0, 0,
  #endif
--- 653,661 ----
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size - 0x10000,
      0x3ffff,
!     0x40000,
  #else
      0, 0, 0, 0,
  #endif
***************
*** 793,801 ****
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size,
      0x3ffff,
!     0x30000,
  #else
      0, 0, 0, 0,
  #endif
--- 792,800 ----
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size - 0x10000,
      0x3ffff,
!     0x40000,
  #else
      0, 0, 0, 0,
  #endif
***************
*** 888,896 ****
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size,
      0x3ffff,
!     0x30000,
  #else
      0, 0, 0, 0,
  #endif
--- 887,895 ----
  
  #ifdef AFS_LINUX26_ENV
      (unsigned long)scsi_command_size,
!     (unsigned long)scsi_command_size - 0x10000,
      0x3ffff,
!     0x40000,
  #else
      0, 0, 0, 0,
  #endif
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.42.4.13 openafs/src/afs/LINUX/osi_vfsops.c:1.42.4.14
*** openafs/src/afs/LINUX/osi_vfsops.c:1.42.4.13	Thu Dec 28 16:30:28 2006
--- openafs/src/afs/LINUX/osi_vfsops.c	Thu Feb  8 20:23:40 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.42.4.13 2006/12/28 21:30:28 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.42.4.14 2007/02/09 01:23:40 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 422,428 ****
  
      AFS_STATCNT(afs_statfs);
  
!     statp->f_type = 0;		/* Can we get a real type sometime? */
  #if defined(STATFS_TAKES_DENTRY)
      statp->f_bsize = dentry->d_sb->s_blocksize;
  #else
--- 422,429 ----
  
      AFS_STATCNT(afs_statfs);
  
!     /* hardcode in case that which is giveth is taken away */
!     statp->f_type = 0x5346414F;
  #if defined(STATFS_TAKES_DENTRY)
      statp->f_bsize = dentry->d_sb->s_blocksize;
  #else
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.8 openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.11
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.8	Thu Nov  9 19:11:06 2006
--- openafs/src/afs/LINUX/osi_vnodeops.c	Thu Feb  8 20:36:35 2007
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.8 2006/11/10 00:11:06 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.11 2007/02/09 01:36:35 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 99,105 ****
  afs_linux_write(struct file *fp, const char *buf, size_t count, loff_t * offp)
  {
      ssize_t code = 0;
-     int code2 = 0;
      struct vcache *vcp = VTOAFS(fp->f_dentry->d_inode);
      struct vrequest treq;
      cred_t *credp = crref();
--- 99,104 ----
***************
*** 490,504 ****
      AFS_GUNLOCK();
  
  #ifdef AFS_LINUX24_ENV
!     if (code == 0 && (cmd == F_SETLK || cmd == F_SETLKW)) {
!        struct file_lock flp2;
!        flp2 = *flp;
  #ifdef AFS_LINUX26_ENV
!        flp2.fl_flags &=~ FL_SLEEP;
  #endif
!        code = posix_lock_file(fp, &flp2);
!        osi_Assert(code != -EAGAIN); /* there should be no conflicts */
!        if (code) {
             struct AFS_FLOCK flock2;
             flock2 = flock;
             flock2.l_type = F_UNLCK;
--- 489,503 ----
      AFS_GUNLOCK();
  
  #ifdef AFS_LINUX24_ENV
!     if ((code == 0 || flp->fl_type == F_UNLCK) && 
! 	(cmd == F_SETLK || cmd == F_SETLKW)) {
  #ifdef AFS_LINUX26_ENV
! 	flp->fl_flags &=~ FL_SLEEP;
! 	code = posix_lock_file(fp, flp);
! #else
! 	code = posix_lock_file(fp, flp, 0);
  #endif
!        if (code && flp->fl_type != F_UNLCK) {
             struct AFS_FLOCK flock2;
             flock2 = flock;
             flock2.l_type = F_UNLCK;
***************
*** 519,524 ****
--- 518,574 ----
  
  }
  
+ #ifdef STRUCT_FILE_OPERATIONS_HAS_FLOCK
+ static int
+ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
+     int code = 0;
+     struct vcache *vcp = VTOAFS(FILE_INODE(fp));
+     cred_t *credp = crref();
+     struct AFS_FLOCK flock;
+     /* Convert to a lock format afs_lockctl understands. */
+     memset((char *)&flock, 0, sizeof(flock));
+     flock.l_type = flp->fl_type;
+     flock.l_pid = flp->fl_pid;
+     flock.l_whence = 0;
+     flock.l_start = 0;
+     flock.l_len = OFFSET_MAX;
+ 
+     /* Safe because there are no large files, yet */
+ #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)
+     if (cmd == F_GETLK64)
+ 	cmd = F_GETLK;
+     else if (cmd == F_SETLK64)
+ 	cmd = F_SETLK;
+     else if (cmd == F_SETLKW64)
+ 	cmd = F_SETLKW;
+ #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
+ 
+     AFS_GLOCK();
+     code = afs_lockctl(vcp, &flock, cmd, credp);
+     AFS_GUNLOCK();
+ 
+     if ((code == 0 || flp->fl_type == F_UNLCK) && 
+         (cmd == F_SETLK || cmd == F_SETLKW)) {
+ 	flp->fl_flags &=~ FL_SLEEP;
+ 	code = flock_lock_file_wait(fp, flp);
+ 	if (code && flp->fl_type != F_UNLCK) {
+ 	    struct AFS_FLOCK flock2;
+ 	    flock2 = flock;
+ 	    flock2.l_type = F_UNLCK;
+ 	    AFS_GLOCK();
+ 	    afs_lockctl(vcp, &flock2, F_SETLK, credp);
+ 	    AFS_GUNLOCK();
+ 	}
+     }
+     /* Convert flock back to Linux's file_lock */
+     flp->fl_type = flock.l_type;
+     flp->fl_pid = flock.l_pid;
+ 
+     crfree(credp);
+     return -code;
+ }
+ #endif
+ 
  /* afs_linux_flush
   * essentially the same as afs_fsync() but we need to get the return
   * code for the sys_close() here, not afs_linux_release(), so call
***************
*** 610,615 ****
--- 660,668 ----
    .release =	afs_linux_release,
    .fsync =	afs_linux_fsync,
    .lock =	afs_linux_lock,
+ #ifdef STRUCT_FILE_OPERATIONS_HAS_FLOCK
+   .flock =	afs_linux_flock,
+ #endif
  };
  
  
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.2 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.3
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.2	Fri Jun  2 17:25:26 2006
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Mon Feb 12 20:34:38 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.2 2006/06/02 21:25:26 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.3 2007/02/13 01:34:38 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 547,552 ****
--- 547,556 ----
  	af->l_len = 0;		/* since some systems indicate it as EOF */
  #endif
  #endif
+     /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU; bottom 32 bits
+      * sometimes get masked off by OS */
+     if ((af->l_len >> 32) == 0x7fffffff)
+ 	af->l_len = 0;
      /* next line makes byte range locks always succeed,
       * even when they should block */
      if (af->l_whence != 0 || af->l_start != 0 || af->l_len != 0) {
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.60.2.2 openafs/src/afsd/afsd.c:1.60.2.3
*** openafs/src/afsd/afsd.c:1.60.2.2	Mon Aug 21 16:41:13 2006
--- openafs/src/afsd/afsd.c	Thu Feb  8 20:00:18 2007
***************
*** 58,64 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.60.2.2 2006/08/21 20:41:13 shadow Exp $");
  
  #define VFS 1
  
--- 58,64 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.60.2.3 2007/02/09 01:00:18 shadow Exp $");
  
  #define VFS 1
  
***************
*** 133,139 ****
  #include <netinet/in.h>
  #include <afs/afs_args.h>
  #include <afs/cellconfig.h>
- #include <afs/auth.h>
  #include <ctype.h>
  #include <afs/afssyscalls.h>
  #include <afs/afsutil.h>
--- 133,138 ----
Index: openafs/src/aklog/aklog_main.c
diff -c openafs/src/aklog/aklog_main.c:1.12.2.2 openafs/src/aklog/aklog_main.c:1.12.2.4
*** openafs/src/aklog/aklog_main.c:1.12.2.2	Tue Aug 29 15:09:41 2006
--- openafs/src/aklog/aklog_main.c	Sat Feb 10 08:58:17 2007
***************
*** 1,5 ****
  /* 
!  * $Id: aklog_main.c,v 1.12.2.2 2006/08/29 19:09:41 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
--- 1,5 ----
  /* 
!  * $Id: aklog_main.c,v 1.12.2.4 2007/02/10 13:58:17 jaltman Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 7,13 ****
  
  #if !defined(lint) && !defined(SABER)
  static char *rcsid =
! 	"$Id: aklog_main.c,v 1.12.2.2 2006/08/29 19:09:41 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <afsconfig.h>
--- 7,13 ----
  
  #if !defined(lint) && !defined(SABER)
  static char *rcsid =
! 	"$Id: aklog_main.c,v 1.12.2.4 2007/02/10 13:58:17 jaltman Exp $";
  #endif /* lint || SABER */
  
  #include <afsconfig.h>
***************
*** 66,72 ****
  #ifdef WINDOWS
  
  #include <afs/auth.h>
- #include <rx/rxkad.h>
  #include <afs/dirpath.h>
  
  #else /* !WINDOWS */
--- 66,71 ----
***************
*** 158,164 ****
   * Other prototypes
   */
  
! extern char *afs_realm_of_cell(krb5_context, struct afsconf_cell *);
  static int isdir(char *, unsigned char *);
  static krb5_error_code get_credv5(krb5_context context, char *, char *,
  				  char *, krb5_creds **);
--- 157,163 ----
   * Other prototypes
   */
  
! extern char *afs_realm_of_cell(krb5_context, struct afsconf_cell *, int);
  static int isdir(char *, unsigned char *);
  static krb5_error_code get_credv5(krb5_context context, char *, char *,
  				  char *, krb5_creds **);
***************
*** 496,515 ****
  	    }
  	}
  	else {
! 	    char *realm = afs_realm_of_cell(context, &ak_cellconfig);
  
! 	    if (!realm) {
  		fprintf(stderr, 
  			"%s: Couldn't figure out realm for cell %s.\n",
  			progname, cell_to_use);
  		exit(AKLOG_MISC);
  	    }
  
! 	    strcpy(realm_of_cell, realm);
  
  	    if (dflag) {
! 		printf("We've deduced that we need to authenticate to"
! 		       " realm %s.\n", realm_of_cell);
  	    }
  	}
  
--- 495,518 ----
  	    }
  	}
  	else {
! 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, FALSE);
  
! 	    if (!afs_realm) {
  		fprintf(stderr, 
  			"%s: Couldn't figure out realm for cell %s.\n",
  			progname, cell_to_use);
  		exit(AKLOG_MISC);
  	    }
  
! 	    strcpy(realm_of_cell, afs_realm);
  
  	    if (dflag) {
! 		if (realm_of_cell[0])
! 		    printf("We've deduced that we need to authenticate to"
! 			   " realm %s.\n", realm_of_cell);
! 		else
! 		    printf("We've deduced that we need to authenticate "
! 			   "using referrals.\n");
  	    }
  	}
  
***************
*** 563,580 ****
  	 */
  
  	if (dflag) {
! 	    printf("Getting tickets: %s/%s@%s\n", name,
  		   primary_instance, realm_of_cell);
  	}
  
  	status = get_credv5(context, name, primary_instance, realm_of_cell,
  			    &v5cred);
  
  	if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
  	    if (try_secondary) {
  		if (dflag) {
  		    printf("Principal not found, trying alternate "
! 			   "service name: %s/%s@%s\n", name,
  			    secondary_instance, realm_of_cell);
  		}
  		status = get_credv5(context, name, secondary_instance,
--- 566,615 ----
  	 */
  
  	if (dflag) {
! 	    printf("Getting tickets: %s%s%s@%s\n", name,
! 		   primary_instance[0] ? "/" : "", 
  		   primary_instance, realm_of_cell);
  	}
  
  	status = get_credv5(context, name, primary_instance, realm_of_cell,
  			    &v5cred);
  
+ 	if ((status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) &&
+ 	    !realm_of_cell[0]) {
+ 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, TRUE);
+ 
+ 	    if (!afs_realm) {
+ 		fprintf(stderr, 
+ 			"%s: Couldn't figure out realm for cell %s.\n",
+ 			progname, cell_to_use);
+ 		exit(AKLOG_MISC);
+ 	    }
+ 
+ 	    strcpy(realm_of_cell, afs_realm);
+ 
+ 	    if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
+ 		try_secondary = 1;
+ 		secondary_instance[0] = '\0';
+ 	    }
+ 
+ 	    if (dflag) {
+ 		printf("We've deduced that we need to authenticate to"
+ 			" realm %s.\n", realm_of_cell);
+ 		printf("Getting tickets: %s%s%s@%s\n", name,
+ 			primary_instance[0] ? "/" : "", 
+ 			primary_instance, realm_of_cell);
+ 	    }
+ 
+ 	    status = get_credv5(context, name, primary_instance, realm_of_cell,
+ 				 &v5cred);
+ 
+ 	}
  	if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
  	    if (try_secondary) {
  		if (dflag) {
  		    printf("Principal not found, trying alternate "
! 			   "service name: %s%s%s@%s\n", name,
! 			    secondary_instance[0] ? "/" : "",
  			    secondary_instance, realm_of_cell);
  		}
  		status = get_credv5(context, name, secondary_instance,
***************
*** 779,786 ****
  			    error_message(status), 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);
  		}
  	    }
--- 814,821 ----
  			    error_message(status), username, cell_to_use,
  			    status);
  		} else {
! 		    printf("created cross-cell entry for %s (Id %d) at %s\n",
! 			   username, id, cell_to_use);
  		    sprintf(username, "AFS ID %d", (int) id);
  		}
  	    }
Index: openafs/src/aklog/krb_util.c
diff -c openafs/src/aklog/krb_util.c:1.4 openafs/src/aklog/krb_util.c:1.4.4.1
*** openafs/src/aklog/krb_util.c:1.4	Thu Jul 14 21:19:27 2005
--- openafs/src/aklog/krb_util.c	Sat Feb 10 08:58:17 2007
***************
*** 11,17 ****
  
  #ifndef lint
  static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.4 2005/07/15 01:19:27 rra Exp $";
  #endif /* lint */
  
  #if 0
--- 11,17 ----
  
  #ifndef lint
  static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.4.4.1 2007/02/10 13:58:17 jaltman Exp $";
  #endif /* lint */
  
  #if 0
***************
*** 40,46 ****
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
! char *afs_realm_of_cell(krb5_context context, struct afsconf_cell *cellconfig)
  {
      static char krbrlm[REALM_SZ+1];
  	char **hrealms = 0;
--- 40,46 ----
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
! char *afs_realm_of_cell(krb5_context context, struct afsconf_cell *cellconfig, int fallback)
  {
      static char krbrlm[REALM_SZ+1];
  	char **hrealms = 0;
***************
*** 48,60 ****
  
      if (!cellconfig)
  	return 0;
!     if (retval = krb5_get_host_realm(context,
! 				cellconfig->hostName[0], &hrealms))
! 		return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
  
  	if (hrealms) krb5_free_host_realm(context, hrealms);
!     
      return krbrlm;
  }
--- 48,73 ----
  
      if (!cellconfig)
  	return 0;
! 
!     if (fallback) {
! 	char * p;
! 	p = strchr(cellconfig->hostName[0], '.');
! 	if (p++)
! 	    strcpy(krbrlm, p);
! 	else
! 	    strcpy(krbrlm, cellconfig->name);
! 	for (p=krbrlm; *p; p++) {
! 	    if (islower(*p)) 
! 		*p = toupper(*p);
! 	}
!     } else {
! 	if (retval = krb5_get_host_realm(context,
! 					 cellconfig->hostName[0], &hrealms))
! 	    return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
  
  	if (hrealms) krb5_free_host_realm(context, hrealms);
!     }
      return krbrlm;
  }
Index: openafs/src/auth/auth.p.h
diff -c openafs/src/auth/auth.p.h:1.4 openafs/src/auth/auth.p.h:1.4.14.2
*** openafs/src/auth/auth.p.h:1.4	Tue Jul 15 19:14:39 2003
--- openafs/src/auth/auth.p.h	Thu Feb  8 22:13:31 2007
***************
*** 24,42 ****
      char ticket[MAXKTCTICKETLEN];
  };
  
! #ifdef AFS_NT40_ENV
! extern int ktc_SetToken(struct ktc_principal *server, struct ktc_token *token,
! 			struct ktc_principal *client, afs_int32 flags);
! 
! extern int ktc_GetToken(struct ktc_principal *server, struct ktc_token *token,
! 			int tokenLen, struct ktc_principal *client);
! 
! extern int ktc_ListTokens(int cellNum, int *cellNumP,
! 			  struct ktc_principal *serverName);
  
! extern int ktc_ForgetToken(struct ktc_principal *server);
! 
! extern int ktc_ForgetAllTokens(void);
  
  /* Flags for the flag word sent along with a token */
  #define PIOCTL_LOGON		0x1	/* invoked from integrated logon */
--- 24,38 ----
      char ticket[MAXKTCTICKETLEN];
  };
  
! int ktc_SetToken(struct ktc_principal *, struct ktc_token *,
!     struct ktc_principal *, afs_int32);
! int ktc_GetToken(struct ktc_principal *, struct ktc_token *,
!     int, struct ktc_principal *);
! int ktc_ListTokens(int, int *, struct ktc_principal *);
! int ktc_ForgetToken(struct ktc_principal *);
! int ktc_ForgetAllTokens(void);
  
! #ifdef AFS_NT40_ENV
  
  /* Flags for the flag word sent along with a token */
  #define PIOCTL_LOGON		0x1	/* invoked from integrated logon */
Index: openafs/src/auth/ktc.c
diff -c openafs/src/auth/ktc.c:1.16.8.3 openafs/src/auth/ktc.c:1.16.8.4
*** openafs/src/auth/ktc.c:1.16.8.3	Wed Jul 19 17:17:17 2006
--- openafs/src/auth/ktc.c	Thu Feb  8 20:17:45 2007
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/ktc.c,v 1.16.8.3 2006/07/19 21:17:17 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/ktc.c,v 1.16.8.4 2007/02/09 01:17:45 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 414,425 ****
      return 0;
  }
  
! 
! ktc_SetToken(aserver, atoken, aclient, flags)
!      struct ktc_principal *aserver;
!      struct ktc_principal *aclient;
!      struct ktc_token *atoken;
!      afs_int32 flags;
  {
      int ncode, ocode;
  
--- 414,424 ----
      return 0;
  }
  
! int
! ktc_SetToken(struct ktc_principal *aserver,
!     struct ktc_token *atoken,
!     struct ktc_principal *aclient,
!     afs_int32 flags)
  {
      int ncode, ocode;
  
***************
*** 689,697 ****
   * next rock in (*aindex).  (*aserver) is set to the relevant ticket on
   * success.  */
  
! ktc_ListTokens(aprevIndex, aindex, aserver)
!      int aprevIndex, *aindex;
!      struct ktc_principal *aserver;
  {
      struct ViceIoctl iob;
      char tbuffer[MAXPIOCTLTOKENLEN];
--- 688,697 ----
   * next rock in (*aindex).  (*aserver) is set to the relevant ticket on
   * success.  */
  
! int
! ktc_ListTokens(int aprevIndex,
!     int *aindex,
!     struct ktc_principal *aserver)
  {
      struct ViceIoctl iob;
      char tbuffer[MAXPIOCTLTOKENLEN];
***************
*** 841,847 ****
  /* discard all tokens from this user's cache */
  
  static int
! NewForgetAll()
  {
  #ifndef NO_AFS_CLIENT
      TRY_KERNEL(KTC_FORGETALLTOKENS_OP, 0, 0, 0, 0);
--- 841,847 ----
  /* discard all tokens from this user's cache */
  
  static int
! NewForgetAll(void)
  {
  #ifndef NO_AFS_CLIENT
      TRY_KERNEL(KTC_FORGETALLTOKENS_OP, 0, 0, 0, 0);
***************
*** 850,856 ****
  }
  
  static int
! OldForgetAll()
  {
      struct ViceIoctl iob;
      register afs_int32 code;
--- 850,856 ----
  }
  
  static int
! OldForgetAll(void)
  {
      struct ViceIoctl iob;
      register afs_int32 code;
***************
*** 872,878 ****
  }
  
  int
! ktc_ForgetAllTokens()
  {
      int ncode, ocode;
  
--- 872,878 ----
  }
  
  int
! ktc_ForgetAllTokens(void)
  {
      int ncode, ocode;
  
Index: openafs/src/bozo/bos.c
diff -c openafs/src/bozo/bos.c:1.23 openafs/src/bozo/bos.c:1.23.2.1
*** openafs/src/bozo/bos.c:1.23	Fri Mar 17 14:54:36 2006
--- openafs/src/bozo/bos.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bos.c,v 1.23 2006/03/17 19:54:36 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bos.c,v 1.23.2.1 2007/02/09 01:00:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdlib.h>
***************
*** 39,45 ****
  #include <sys/stat.h>
  #include <rx/xdr.h>
  #include <afs/auth.h>
- #include <rx/rxkad.h>
  #include <afs/cellconfig.h>
  #include <stdio.h>
  #include <afs/cmd.h>
--- 39,44 ----
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.32.2.3 openafs/src/bozo/bosserver.c:1.32.2.5
*** openafs/src/bozo/bosserver.c:1.32.2.3	Thu Dec 21 18:14:05 2006
--- openafs/src/bozo/bosserver.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.32.2.3 2006/12/21 23:14:05 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.32.2.5 2007/02/09 01:00:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 37,43 ****
  #include <rx/rx_globals.h>
  #include "bosint.h"
  #include "bnode.h"
! #include <afs/auth.h>
  #include <afs/keys.h>
  #include <afs/ktime.h>
  #include <afs/afsutil.h>
--- 37,43 ----
  #include <rx/rx_globals.h>
  #include "bosint.h"
  #include "bnode.h"
! #include <rx/rxkad.h>
  #include <afs/keys.h>
  #include <afs/ktime.h>
  #include <afs/afsutil.h>
***************
*** 56,62 ****
  void bozo_Log();
  
  struct afsconf_dir *bozo_confdir = 0;	/* bozo configuration dir */
! static char *bozo_pid;
  struct rx_securityClass *bozo_rxsc[3];
  const char *bozo_fileName;
  FILE *bozo_logFile;
--- 56,62 ----
  void bozo_Log();
  
  struct afsconf_dir *bozo_confdir = 0;	/* bozo configuration dir */
! static PROCESS bozo_pid;
  struct rx_securityClass *bozo_rxsc[3];
  const char *bozo_fileName;
  FILE *bozo_logFile;
***************
*** 164,170 ****
  
  /* make sure a dir exists */
  static int
! MakeDir(register char *adir)
  {
      struct stat tstat;
      register afs_int32 code;
--- 164,170 ----
  
  /* make sure a dir exists */
  static int
! MakeDir(const char *adir)
  {
      struct stat tstat;
      register afs_int32 code;
***************
*** 720,726 ****
      register afs_int32 code;
      struct afsconf_dir *tdir;
      int noAuth = 0;
-     struct ktc_encryptionKey tkey;
      int i;
      char namebuf[AFSDIR_PATH_MAX];
      int rxMaxMTU = -1;
--- 720,725 ----
***************
*** 1016,1022 ****
  
      /* opened the cell databse */
      bozo_confdir = tdir;
-     code = afsconf_GetKey(tdir, 999, &tkey);
  
      /* allow super users to manage RX statistics */
      rx_SetRxStatUserOk(bozo_rxstat_userok);
--- 1015,1020 ----
Index: openafs/src/budb/database.c
diff -c openafs/src/budb/database.c:1.7 openafs/src/budb/database.c:1.7.14.1
*** openafs/src/budb/database.c:1.7	Tue Jul 15 19:14:48 2003
--- openafs/src/budb/database.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/database.c,v 1.7 2003/07/15 23:14:48 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/database.c,v 1.7.14.1 2007/02/09 01:00:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 21,27 ****
  #include <sys/types.h>
  #include <afs/stds.h>
  #include <ubik.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include "budb_errs.h"
  #include "database.h"
--- 21,26 ----
Index: openafs/src/budb/db_alloc.c
diff -c openafs/src/budb/db_alloc.c:1.7 openafs/src/budb/db_alloc.c:1.7.14.1
*** openafs/src/budb/db_alloc.c:1.7	Tue Jul 15 19:14:48 2003
--- openafs/src/budb/db_alloc.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_alloc.c,v 1.7 2003/07/15 23:14:48 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_alloc.c,v 1.7.14.1 2007/02/09 01:00:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 28,34 ****
  #include <sys/types.h>
  #include <afs/stds.h>
  #include <ubik.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include "budb_errs.h"
  #include "database.h"
--- 28,33 ----
Index: openafs/src/budb/db_hash.c
diff -c openafs/src/budb/db_hash.c:1.8 openafs/src/budb/db_hash.c:1.8.14.1
*** openafs/src/budb/db_hash.c:1.8	Sat Nov 22 23:53:31 2003
--- openafs/src/budb/db_hash.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_hash.c,v 1.8 2003/11/23 04:53:31 jaltman Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_hash.c,v 1.8.14.1 2007/02/09 01:00:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 28,34 ****
  #include <sys/types.h>
  #include <afs/stds.h>
  #include <ubik.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include "budb_errs.h"
  #include "database.h"
--- 28,33 ----
Index: openafs/src/budb/db_lock.c
diff -c openafs/src/budb/db_lock.c:1.6 openafs/src/budb/db_lock.c:1.6.14.1
*** openafs/src/budb/db_lock.c:1.6	Tue Jul 15 19:14:48 2003
--- openafs/src/budb/db_lock.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_lock.c,v 1.6 2003/07/15 23:14:48 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_lock.c,v 1.6.14.1 2007/02/09 01:00:19 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 22,28 ****
  #endif
  #include <afs/afsutil.h>
  #include <ubik.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include "budb_errs.h"
  #include "database.h"
--- 22,27 ----
Index: openafs/src/budb/db_text.c
diff -c openafs/src/budb/db_text.c:1.12 openafs/src/budb/db_text.c:1.12.4.1
*** openafs/src/budb/db_text.c:1.12	Sun Jul 10 23:22:19 2005
--- openafs/src/budb/db_text.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_text.c,v 1.12 2005/07/11 03:22:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_text.c,v 1.12.4.1 2007/02/09 01:00:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 31,37 ****
  #endif
  #include <sys/types.h>
  #include <ubik.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include "budb_errs.h"
  #include "database.h"
--- 31,36 ----
Index: openafs/src/budb/dbs_dump.c
diff -c openafs/src/budb/dbs_dump.c:1.11 openafs/src/budb/dbs_dump.c:1.11.14.1
*** openafs/src/budb/dbs_dump.c:1.11	Tue Jul 15 19:14:48 2003
--- openafs/src/budb/dbs_dump.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/dbs_dump.c,v 1.11 2003/07/15 23:14:48 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/dbs_dump.c,v 1.11.14.1 2007/02/09 01:00:19 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 36,42 ****
  #include <string.h>
  #include <des.h>
  #include <afs/cellconfig.h>
- #include <afs/auth.h>
  #include <errno.h>
  #include "budb.h"
  #include "budb_errs.h"
--- 36,41 ----
Index: openafs/src/budb/server.c
diff -c openafs/src/budb/server.c:1.16.2.2 openafs/src/budb/server.c:1.16.2.3
*** openafs/src/budb/server.c:1.16.2.2	Tue Jun 20 16:37:11 2006
--- openafs/src/budb/server.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.2 2006/06/20 20:37:11 jaltman Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.3 2007/02/09 01:00:19 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
***************
*** 45,51 ****
  #include <rx/rxkad.h>
  #include <rx/rx_globals.h>
  #include <afs/cellconfig.h>
- #include <afs/auth.h>
  #include <afs/bubasics.h>
  #include <afs/afsutil.h>
  #include <afs/com_err.h>
--- 45,50 ----
Index: openafs/src/butc/tcmain.c
diff -c openafs/src/butc/tcmain.c:1.16.8.4 openafs/src/butc/tcmain.c:1.16.8.5
*** openafs/src/butc/tcmain.c:1.16.8.4	Sat Jul  1 01:02:49 2006
--- openafs/src/butc/tcmain.c	Thu Feb  8 20:00:19 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcmain.c,v 1.16.8.4 2006/07/01 05:02:49 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcmain.c,v 1.16.8.5 2007/02/09 01:00:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 40,46 ****
  #include <afs/afsutil.h>
  #include <rx/rx.h>
  #include <rx/rx_globals.h>
- #include <afs/auth.h>
  #include <rx/rxkad.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
--- 40,45 ----
Index: openafs/src/butc/tcprocs.c
diff -c openafs/src/butc/tcprocs.c:1.14.6.1 openafs/src/butc/tcprocs.c:1.14.6.2
*** openafs/src/butc/tcprocs.c:1.14.6.1	Sat Jul  1 01:02:50 2006
--- openafs/src/butc/tcprocs.c	Thu Feb  8 20:00:20 2007
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcprocs.c,v 1.14.6.1 2006/07/01 05:02:50 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcprocs.c,v 1.14.6.2 2007/02/09 01:00:20 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 34,40 ****
  #include <afs/nfs.h>
  #include <lwp.h>
  #include <lock.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 34,39 ----
Index: openafs/src/butc/tcudbprocs.c
diff -c openafs/src/butc/tcudbprocs.c:1.15.6.1 openafs/src/butc/tcudbprocs.c:1.15.6.2
*** openafs/src/butc/tcudbprocs.c:1.15.6.1	Mon Jul  3 15:07:14 2006
--- openafs/src/butc/tcudbprocs.c	Thu Feb  8 20:00:20 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcudbprocs.c,v 1.15.6.1 2006/07/03 19:07:14 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcudbprocs.c,v 1.15.6.2 2007/02/09 01:00:20 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 35,41 ****
  #include <afs/nfs.h>
  #include <lwp.h>
  #include <lock.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 35,40 ----
Index: openafs/src/butc/test.c
diff -c openafs/src/butc/test.c:1.5 openafs/src/butc/test.c:1.5.14.1
*** openafs/src/butc/test.c:1.5	Tue Jul 15 19:14:49 2003
--- openafs/src/butc/test.c	Thu Feb  8 20:00:20 2007
***************
*** 22,28 ****
  #include <rx/rx_globals.h>
  #include <afs/nfs.h>
  #include <afs/vlserver.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 22,27 ----
Index: openafs/src/butc/test_budb.c
diff -c openafs/src/butc/test_budb.c:1.5.14.1 openafs/src/butc/test_budb.c:1.5.14.2
*** openafs/src/butc/test_budb.c:1.5.14.1	Mon Jul  3 15:07:14 2006
--- openafs/src/butc/test_budb.c	Thu Feb  8 20:00:20 2007
***************
*** 14,22 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/test_budb.c,v 1.5.14.1 2006/07/03 19:07:14 shadow Exp $");
  
- #include <afs/auth.h>
  #include <afs/budb_client.h>
  #include <afs/budb.h>
  #include <rx/rx_globals.h>
--- 14,21 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/test_budb.c,v 1.5.14.2 2007/02/09 01:00:20 shadow Exp $");
  
  #include <afs/budb_client.h>
  #include <afs/budb.h>
  #include <rx/rx_globals.h>
Index: openafs/src/cf/Makefile.am.common
diff -c openafs/src/cf/Makefile.am.common:1.2 openafs/src/cf/Makefile.am.common:removed
*** openafs/src/cf/Makefile.am.common:1.2	Wed Oct 17 19:07:03 2001
--- openafs/src/cf/Makefile.am.common	Tue Feb 13 21:16:07 2007
***************
*** 1,178 ****
- # $Id: Makefile.am.common,v 1.2 2001/10/17 23:07:03 shadow Exp $
- 
- AUTOMAKE_OPTIONS = foreign no-dependencies
- 
- SUFFIXES = .et .h
- 
- INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken)
- 
- AM_CFLAGS += $(WFLAGS)
- 
- CP	= cp
- 
- COMPILE_ET = $(top_builddir)/lib/com_err/compile_et
- 
- ## set build_HEADERZ to headers that should just be installed in build tree
- 
- buildinclude = $(top_builddir)/include
- 
- ## these aren't detected by automake
- LIB_XauReadAuth		= @LIB_XauReadAuth@
- LIB_crypt		= @LIB_crypt@
- LIB_dbm_firstkey	= @LIB_dbm_firstkey@
- LIB_dbopen		= @LIB_dbopen@
- LIB_dlopen		= @LIB_dlopen@
- LIB_dn_expand		= @LIB_dn_expand@
- LIB_el_init		= @LIB_el_init@
- LIB_getattr		= @LIB_getattr@
- LIB_gethostbyname	= @LIB_gethostbyname@
- LIB_getpwent_r		= @LIB_getpwent_r@
- LIB_getpwnam_r		= @LIB_getpwnam_r@
- LIB_getsockopt		= @LIB_getsockopt@
- LIB_logout		= @LIB_logout@
- LIB_logwtmp		= @LIB_logwtmp@
- LIB_odm_initialize	= @LIB_odm_initialize@
- LIB_pidfile		= @LIB_pidfile@
- LIB_readline		= @LIB_readline@
- LIB_res_search		= @LIB_res_search@
- LIB_setpcred		= @LIB_setpcred@
- LIB_setsockopt		= @LIB_setsockopt@
- LIB_socket		= @LIB_socket@
- LIB_syslog		= @LIB_syslog@
- LIB_tgetent		= @LIB_tgetent@
- 
- LIBS			= @LIBS@
- 
- 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@
- 
- INCLUDE_readline = @INCLUDE_readline@
- LIB_readline = @LIB_readline@
- 
- LEXLIB = @LEXLIB@
- 
- 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) $(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
- 
- SUFFIXES += .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
- 
- NROFF_MAN = groff -mandoc -Tascii
- #NROFF_MAN = nroff -man
- .1.cat1:
- 	$(NROFF_MAN) $< > $@
- .3.cat3:
- 	$(NROFF_MAN) $< > $@
- .5.cat5:
- 	$(NROFF_MAN) $< > $@
- .8.cat8:
- 	$(NROFF_MAN) $< > $@
- 
- ## MAINTAINERCLEANFILES += 
- 
- 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:
- 	$(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} $<
- 
- if KRB4
- LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
- endif
- 
- if KRB5
- LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
- 	$(top_builddir)/lib/asn1/libasn1.la
- LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
- endif
- 
--- 0 ----
Index: openafs/src/cf/linux-test1.m4
diff -c openafs/src/cf/linux-test1.m4:1.6.4.3 openafs/src/cf/linux-test1.m4:1.6.4.5
*** openafs/src/cf/linux-test1.m4:1.6.4.3	Thu Jan  4 17:05:30 2007
--- openafs/src/cf/linux-test1.m4	Fri Feb  9 13:27:54 2007
***************
*** 9,14 ****
--- 9,19 ----
  obj-m += conftest.o
  _ACEOF
      cat >conftest.dir/conftest.c <<\_ACEOF &&
+ /* confdefs.h */
+ _ACEOF
+     cat confdefs.h >>conftest.dir/conftest.c &&
+     cat >>conftest.dir/conftest.c <<\_ACEOF &&
+ /* end confdefs.h */
  #include <linux/module.h>
  $1
  
***************
*** 46,52 ****
  #               [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
  #
  AC_DEFUN([AC_TRY_KBUILD], [
!   if test -f $LINUX_KERNEL_PATH/scripts/Makefile.build; then
      AC_TRY_KBUILD26([$1], [$2], [$3], [$4])
    else
      AC_TRY_KBUILD24([$1], [$2], [$3], [$4])
--- 51,57 ----
  #               [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
  #
  AC_DEFUN([AC_TRY_KBUILD], [
!   if test $AFS_SYSKVERS -ge 26 ; then
      AC_TRY_KBUILD26([$1], [$2], [$3], [$4])
    else
      AC_TRY_KBUILD24([$1], [$2], [$3], [$4])
***************
*** 54,59 ****
  
  AC_DEFUN([LINUX_KERNEL_COMPILE_WORKS], [
    AC_MSG_CHECKING([for linux kernel module build works])
!   AC_TRY_KBUILD([],[],:,AC_MSG_RESULT(no)
      AC_MSG_FAILURE([Fix problem or use --disable-kernel-module...]))
    AC_MSG_RESULT(yes)])
--- 59,67 ----
  
  AC_DEFUN([LINUX_KERNEL_COMPILE_WORKS], [
    AC_MSG_CHECKING([for linux kernel module build works])
!   AC_TRY_KBUILD(
! [#include <linux/sched.h>
! #include <linux/fs.h>],
!     [],:,AC_MSG_RESULT(no)
      AC_MSG_FAILURE([Fix problem or use --disable-kernel-module...]))
    AC_MSG_RESULT(yes)])
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.29.2.16 openafs/src/cf/linux-test4.m4:1.29.2.20
*** openafs/src/cf/linux-test4.m4:1.29.2.16	Thu Jan  4 16:46:35 2007
--- openafs/src/cf/linux-test4.m4	Fri Feb  9 13:22:50 2007
***************
*** 1,3 ****
--- 1,17 ----
+ AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
+   AC_MSG_CHECKING([for exported tasklist_lock])
+   AC_CACHE_VAL([ac_cv_linux_exports_tasklist_lock], [
+     AC_TRY_KBUILD(
+ [
+ #include <linux/sched.h>],
+ [
+ extern rwlock_t tasklist_lock __attribute__((weak)); 
+ ],
+       ac_cv_linux_exports_tasklist_lock=yes,
+       ac_cv_linux_exports_tasklist_lock=no)])
+   AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)])
+ 
+ 
  AC_DEFUN([LINUX_CONFIG_H_EXISTS], [
    AC_MSG_CHECKING([for linux/config.h existance])
    AC_CACHE_VAL([ac_cv_linux_config_h_exists], [
***************
*** 333,338 ****
--- 347,364 ----
    AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_parent)])
  
  
+ AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TGID], [
+   AC_MSG_CHECKING([for tgid in struct task_struct])
+   AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_tgid], [
+     AC_TRY_KBUILD(
+ [#include <linux/sched.h>],
+ [struct task_struct _tsk;
+ printk("%d\n", _tsk.tgid);],
+       ac_cv_linux_sched_struct_task_struct_has_tgid=yes,
+       ac_cv_linux_sched_struct_task_struct_has_tgid=no)])
+   AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_tgid)])
+ 
+ 
  AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT], [
    AC_MSG_CHECKING([for real_parent in struct task_struct])
    AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_real_parent], [
***************
*** 562,568 ****
    AC_MSG_CHECKING([whether refrigerator takes PF_FREEZE])
    AC_CACHE_VAL([ac_cv_linux_func_refrigerator_takes_pf_freeze], [
      AC_TRY_KBUILD(
! [#include <linux/sched.h>],
  [refrigerator(PF_FREEZE);],
        ac_cv_linux_func_refrigerator_takes_pf_freeze=yes,
        ac_cv_linux_func_refrigerator_takes_pf_freeze=no)])
--- 588,597 ----
    AC_MSG_CHECKING([whether refrigerator takes PF_FREEZE])
    AC_CACHE_VAL([ac_cv_linux_func_refrigerator_takes_pf_freeze], [
      AC_TRY_KBUILD(
! [#include <linux/sched.h>
! #ifdef FREEZER_H_EXISTS
! #include <linux/freezer.h>
! #endif],
  [refrigerator(PF_FREEZE);],
        ac_cv_linux_func_refrigerator_takes_pf_freeze=yes,
        ac_cv_linux_func_refrigerator_takes_pf_freeze=no)])
***************
*** 766,768 ****
--- 795,808 ----
        ac_cv_linux_init_work_has_data=no)])
    AC_MSG_RESULT($ac_cv_linux_init_work_has_data)])
  
+ 
+ AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_FLOCK], [
+   AC_MSG_CHECKING([for flock in struct file_operations])
+   AC_CACHE_VAL([ac_cv_linux_fs_struct_fop_has_flock], [
+     AC_TRY_KBUILD(
+ [#include <linux/fs.h>],
+ [struct file_operations _fop;
+ _fop.flock(NULL, 0, NULL);],
+       ac_cv_linux_fs_struct_fop_has_flock=yes,
+       ac_cv_linux_fs_struct_fop_has_flock=no)])
+   AC_MSG_RESULT($ac_cv_linux_fs_struct_fop_has_flock)])
Index: openafs/src/cmd/Makefile.am
diff -c openafs/src/cmd/Makefile.am:1.1 openafs/src/cmd/Makefile.am:removed
*** openafs/src/cmd/Makefile.am:1.1	Tue Jun  5 16:17:49 2001
--- openafs/src/cmd/Makefile.am	Tue Feb 13 21:16:07 2007
***************
*** 1,16 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:49 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- afsincludedir = $(top_builddir)/include/afs
- afsinclude_HEADERS = com_err.h error_table.h mit-sipb-cr.h
- afsbuild_HEADERZ=$(afsinclude_HEADERS)
- 
- bin_PROGRAMS = compile_et
- 
- compile_et_SOURCES = compile_et.c parse.y lex.l 
- compile_et_LDADD = -L../util -lutil
- 
- lib_LIBRARIES=libcom_err.a
- 
- libcom_err_a_SOURCES =  error_msg.c et_name.c com_err.c 
--- 0 ----
Index: openafs/src/comerr/Makefile.am
diff -c openafs/src/comerr/Makefile.am:1.1 openafs/src/comerr/Makefile.am:removed
*** openafs/src/comerr/Makefile.am:1.1	Tue Jun  5 16:17:50 2001
--- openafs/src/comerr/Makefile.am	Tue Feb 13 21:16:07 2007
***************
*** 1,18 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:50 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- YFLAGS = -d
- 
- afsincludedir = $(top_builddir)/include/afs
- afsinclude_HEADERS = com_err.h error_table.h mit-sipb-cr.h
- afsbuild_HEADERZ=$(afsinclude_HEADERS)
- 
- bin_PROGRAMS = compile_et
- 
- compile_et_SOURCES = compile_et.c parse.y lex.l 
- compile_et_LDADD = -L../util -lutil
- 
- lib_LIBRARIES=libcom_err.a
- 
- libcom_err_a_SOURCES =  error_msg.c et_name.c com_err.c 
--- 0 ----
Index: openafs/src/config/Makefile.am
diff -c openafs/src/config/Makefile.am:1.1 openafs/src/config/Makefile.am:removed
*** openafs/src/config/Makefile.am:1.1	Tue Jun  5 16:17:50 2001
--- openafs/src/config/Makefile.am	Tue Feb 13 21:16:07 2007
***************
*** 1,18 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:50 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- afsincludedir = $(includedir)/afs
- afsinclude_HEADERS = 	\
- 	stds.h		\
- 	icl.h		\
- 	afs_args.h	\
- 	venus.h		\
- 	debug.h		\
- 	param.h 	\
- 	afs_sysnames.h
- 
- afsbuild_HEADERZ=$(afsinclude_HEADERS)
- 
- param.h:	param.$(SYSNAME).h
- 	cp $(srcdir)/param.$(SYSNAME).h param.h
--- 0 ----
Index: openafs/src/config/Makefile.in
diff -c openafs/src/config/Makefile.in:1.15.2.1 openafs/src/config/Makefile.in:1.15.2.3
*** openafs/src/config/Makefile.in:1.15.2.1	Mon Dec 18 23:20:10 2006
--- openafs/src/config/Makefile.in	Fri Feb  9 13:43:12 2007
***************
*** 23,29 ****
  
  Makefile.version: ${srcdir}/Makefile.version-CML Makefile.version-NOCML
  	$(RM) -f Makefile.version
- 	$(CP) Makefile.version-NOCML.in Makefile.version.in
  	if	[ -r SRC/../CML/state ] ; \
  	then	$(CP) ${srcdir}/Makefile.version-CML Makefile.version ; \
  	else	$(CP) Makefile.version-NOCML Makefile.version ; \
--- 23,28 ----
***************
*** 102,108 ****
  	${DESTDIR}${includedir}/afs/debug.h
  
  clean:
! 	$(RM) -f *.o config mkvers core xprt AFS_component_version_number.c param.h.new
  
  dest: ${DEST}/include/afs/param.h \
  	${DEST}/include/afs/stds.h \
--- 101,107 ----
  	${DESTDIR}${includedir}/afs/debug.h
  
  clean:
! 	$(RM) -f *.o config mkvers core xprt AFS_component_version_number.c param.h.new Makefile.version.in
  
  dest: ${DEST}/include/afs/param.h \
  	${DEST}/include/afs/stds.h \
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.17 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.18
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.17	Mon Jan 15 15:56:27 2007
--- openafs/src/config/NTMakefile.amd64_w2k	Tue Feb 13 13:29:59 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1400
  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=1500
  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.17 openafs/src/config/NTMakefile.i386_nt40:1.84.2.18
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.17	Mon Jan 15 15:56:27 2007
--- openafs/src/config/NTMakefile.i386_nt40	Tue Feb 13 13:29:59 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1400
  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=1500
  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.17 openafs/src/config/NTMakefile.i386_w2k:1.23.2.18
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.17	Mon Jan 15 15:56:27 2007
--- openafs/src/config/NTMakefile.i386_w2k	Tue Feb 13 13:29:59 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1400
  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=1500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.77.2.2 openafs/src/config/afs_sysnames.h:1.77.2.3
*** openafs/src/config/afs_sysnames.h:1.77.2.2	Thu Dec 28 17:02:16 2006
--- openafs/src/config/afs_sysnames.h	Thu Feb  8 20:13:19 2007
***************
*** 239,244 ****
--- 239,245 ----
  #define SYS_NAME_ID_i386_obsd37		2606
  #define SYS_NAME_ID_i386_obsd38		2607
  #define SYS_NAME_ID_i386_obsd39		2608
+ #define SYS_NAME_ID_i386_obsd40         2609
  
  #define SYS_NAME_ID_amd64_linux2        2700
  #define SYS_NAME_ID_amd64_linux22       2701
Index: openafs/src/config/param.amd64_linux24.h
diff -c openafs/src/config/param.amd64_linux24.h:1.5.6.2 openafs/src/config/param.amd64_linux24.h:1.5.6.3
*** openafs/src/config/param.amd64_linux24.h:1.5.6.2	Thu Nov  9 18:18:45 2006
--- openafs/src/config/param.amd64_linux24.h	Tue Feb 13 14:12:27 2007
***************
*** 87,92 ****
--- 87,93 ----
  #endif
  #endif /* KERNEL */
  
+ #define USE_UCONTEXT           /* should be in afsconfig.h */
  
  #endif /* _PARAM_AMD64_LINUX20_H_ */
  
***************
*** 157,162 ****
--- 158,164 ----
  #define CMSERVERPREF
  #endif
  
+ #define USE_UCONTEXT           /* should be in afsconfig.h */
  
  #endif /* AFS_PARAM_H */
  
Index: openafs/src/config/param.i386_obsd40.h
diff -c /dev/null openafs/src/config/param.i386_obsd40.h:1.1.2.2
*** /dev/null	Tue Feb 13 21:16:07 2007
--- openafs/src/config/param.i386_obsd40.h	Thu Feb  8 20:13:19 2007
***************
*** 0 ****
--- 1,68 ----
+ /*
+  * Jim Rees, University of Michigan CITI
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define SYS_NAME		"i386_obsd40"
+ #define SYS_NAME_ID		SYS_NAME_ID_i386_obsd40
+ 
+ #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_OBSD37_ENV		1
+ #define AFS_OBSD38_ENV		1
+ #define AFS_OBSD39_ENV		1
+ #define AFS_OBSD40_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 <afs/afs_sysnames.h>
+ #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 */
Index: openafs/src/finale/translate_et.c
diff -c openafs/src/finale/translate_et.c:1.8 openafs/src/finale/translate_et.c:1.8.14.1
*** openafs/src/finale/translate_et.c:1.8	Tue Jul 15 19:15:06 2003
--- openafs/src/finale/translate_et.c	Thu Feb  8 20:00:20 2007
***************
*** 11,22 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/finale/translate_et.c,v 1.8 2003/07/15 23:15:06 shadow Exp $");
  
  #include <afs/com_err.h>
  #include <rx/rxkad.h>
  #include <afs/kautils.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <afs/vlserver.h>
--- 11,21 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/finale/translate_et.c,v 1.8.14.1 2007/02/09 01:00:20 shadow Exp $");
  
  #include <afs/com_err.h>
  #include <rx/rxkad.h>
  #include <afs/kautils.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <afs/vlserver.h>
Index: openafs/src/include/Makefile.am
diff -c openafs/src/include/Makefile.am:1.1 openafs/src/include/Makefile.am:removed
*** openafs/src/include/Makefile.am:1.1	Tue Jun  5 16:17:51 2001
--- openafs/src/include/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,13 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:51 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- SUBDIRS = 	\
- 	afs	\
- 	rx
- 
- CLEANFILES =            \
- 	com_err.h 	\
- 	error_table.h	\
- 	mit-sipb-cr.h	
- 
--- 0 ----
Index: openafs/src/include/afs/Makefile.am
diff -c openafs/src/include/afs/Makefile.am:1.1 openafs/src/include/afs/Makefile.am:removed
*** openafs/src/include/afs/Makefile.am:1.1	Tue Jun  5 16:17:51 2001
--- openafs/src/include/afs/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,6 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:51 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- CLEANFILES =            \
- 	param.h		
--- 0 ----
Index: openafs/src/include/rx/Makefile.am
diff -c openafs/src/include/rx/Makefile.am:1.1 openafs/src/include/rx/Makefile.am:removed
*** openafs/src/include/rx/Makefile.am:1.1	Tue Jun  5 16:17:51 2001
--- openafs/src/include/rx/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,7 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:51 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- CLEANFILES =            \
- 	afs_sysnames.h	\
- 	param.h		
--- 0 ----
Index: openafs/src/kauth/.cvsignore
diff -c openafs/src/kauth/.cvsignore:1.1 openafs/src/kauth/.cvsignore:1.1.26.1
*** openafs/src/kauth/.cvsignore:1.1	Mon Sep 10 16:14:18 2001
--- openafs/src/kauth/.cvsignore	Mon Jan 22 12:34:15 2007
***************
*** 20,22 ****
--- 20,23 ----
  kpasswd
  kpwvalid
  rebuild
+ ka-forwarder
Index: openafs/src/kauth/klog.c
diff -c openafs/src/kauth/klog.c:1.8 openafs/src/kauth/klog.c:1.8.14.1
*** openafs/src/kauth/klog.c:1.8	Tue Jul 15 19:15:16 2003
--- openafs/src/kauth/klog.c	Thu Feb  8 20:00:20 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/klog.c,v 1.8 2003/07/15 23:15:16 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/klog.c,v 1.8.14.1 2007/02/09 01:00:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 33,39 ****
  #include <stdio.h>
  #include <pwd.h>
  #include <afs/com_err.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include "kauth.h"
--- 33,38 ----
Index: openafs/src/kauth/manyklog.c
diff -c openafs/src/kauth/manyklog.c:1.7 openafs/src/kauth/manyklog.c:1.7.14.1
*** openafs/src/kauth/manyklog.c:1.7	Tue Jul 15 19:15:17 2003
--- openafs/src/kauth/manyklog.c	Thu Feb  8 20:00:20 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/manyklog.c,v 1.7 2003/07/15 23:15:17 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/manyklog.c,v 1.7.14.1 2007/02/09 01:00:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 26,32 ****
  #include <stdio.h>
  #include <pwd.h>
  #include <afs/com_err.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include "kauth.h"
--- 26,31 ----
Index: openafs/src/kauth/test/multiklog.c
diff -c openafs/src/kauth/test/multiklog.c:1.7 openafs/src/kauth/test/multiklog.c:1.7.14.1
*** openafs/src/kauth/test/multiklog.c:1.7	Tue Jul 15 19:15:17 2003
--- openafs/src/kauth/test/multiklog.c	Thu Feb  8 20:00:20 2007
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/test/multiklog.c,v 1.7 2003/07/15 23:15:17 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/test/multiklog.c,v 1.7.14.1 2007/02/09 01:00:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 30,36 ****
  #include <stdio.h>
  #include <pwd.h>
  #include <afs/com_err.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include "kauth.h"
--- 30,35 ----
Index: openafs/src/libadmin/vos/vsprocs.h
diff -c openafs/src/libadmin/vos/vsprocs.h:1.7 openafs/src/libadmin/vos/vsprocs.h:1.7.4.1
*** openafs/src/libadmin/vos/vsprocs.h:1.7	Sat Oct 15 11:36:55 2005
--- openafs/src/libadmin/vos/vsprocs.h	Thu Feb  8 20:00:21 2007
***************
*** 26,32 ****
  #include <rx/rx.h>
  #include <afs/vlserver.h>
  #include <afs/nfs.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 26,31 ----
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.10 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.11
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.10	Mon Jan 15 15:56:43 2007
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Mon Feb 12 20:50:59 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.14</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.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</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.10 openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.11
*** openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.10	Mon Jan 15 15:56:43 2007
--- openafs/src/libafs/afs.ppc_darwin_80.plist.in	Mon Feb 12 20:50:59 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.14</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.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</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.10 openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.11
*** openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.10	Mon Jan 15 15:56:43 2007
--- openafs/src/libafs/afs.ppc_darwin_90.plist.in	Mon Feb 12 20:50:59 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.14</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.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</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.10 openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.11
*** openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.10	Mon Jan 15 15:56:43 2007
--- openafs/src/libafs/afs.x86_darwin_80.plist.in	Mon Feb 12 20:50:59 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.14</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.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</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.10 openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.11
*** openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.10	Mon Jan 15 15:56:43 2007
--- openafs/src/libafs/afs.x86_darwin_90.plist.in	Mon Feb 12 20:50:59 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.14</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.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</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.11 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.12
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.11	Mon Jan 15 15:56:44 2007
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Mon Feb 12 20:51:01 2007
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.14</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.14</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.15</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</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.10 openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.11
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.10	Mon Jan 15 15:56:44 2007
--- openafs/src/packaging/MacOS/OpenAFS.info	Mon Feb 12 20:51:01 2007
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.5.14
  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.15
  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/platform/.cvsignore
diff -c /dev/null openafs/src/platform/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/.cvsignore	Mon Jan 22 12:34:16 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/AIX/.cvsignore
diff -c /dev/null openafs/src/platform/AIX/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/AIX/.cvsignore	Mon Jan 22 12:34:17 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/DARWIN/.cvsignore
diff -c /dev/null openafs/src/platform/DARWIN/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/DARWIN/.cvsignore	Mon Jan 22 12:34:18 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/FBSD/.cvsignore
diff -c /dev/null openafs/src/platform/FBSD/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/FBSD/.cvsignore	Mon Jan 22 12:34:19 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/HPUX/.cvsignore
diff -c /dev/null openafs/src/platform/HPUX/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/HPUX/.cvsignore	Mon Jan 22 12:34:19 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/IRIX/.cvsignore
diff -c /dev/null openafs/src/platform/IRIX/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/IRIX/.cvsignore	Mon Jan 22 12:34:20 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/LINUX/.cvsignore
diff -c /dev/null openafs/src/platform/LINUX/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/LINUX/.cvsignore	Mon Jan 22 12:34:21 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/NBSD/.cvsignore
diff -c /dev/null openafs/src/platform/NBSD/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/NBSD/.cvsignore	Mon Jan 22 12:34:23 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/OBSD/.cvsignore
diff -c /dev/null openafs/src/platform/OBSD/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/OBSD/.cvsignore	Mon Jan 22 12:34:24 2007
***************
*** 0 ****
--- 1 ----
+ Makefile
Index: openafs/src/platform/SOLARIS/.cvsignore
diff -c /dev/null openafs/src/platform/SOLARIS/.cvsignore:1.3.8.2
*** /dev/null	Tue Feb 13 21:16:08 2007
--- openafs/src/platform/SOLARIS/.cvsignore	Mon Jan 22 12:34:25 2007
***************
*** 0 ****
--- 1,3 ----
+ AFS_component_version_number.c
+ Makefile
+ fs_conv_sol26
Index: openafs/src/procmgmt/Makefile.am
diff -c openafs/src/procmgmt/Makefile.am:1.1 openafs/src/procmgmt/Makefile.am:removed
*** openafs/src/procmgmt/Makefile.am:1.1	Tue Jun  5 16:17:52 2001
--- openafs/src/procmgmt/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,9 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:52 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- SUBDIRS = afs
- 
- lib_LIBRARIES=libprocmgmt.a
- 
- libprocmgmt_a_SOURCES = procmgmt_unix.c
--- 0 ----
Index: openafs/src/procmgmt/procmgmt_nt.c
diff -c openafs/src/procmgmt/procmgmt_nt.c:1.7 openafs/src/procmgmt/procmgmt_nt.c:1.7.4.1
*** openafs/src/procmgmt/procmgmt_nt.c:1.7	Tue Dec 27 11:17:11 2005
--- openafs/src/procmgmt/procmgmt_nt.c	Tue Jan 30 07:07:18 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/procmgmt/procmgmt_nt.c,v 1.7 2005/12/27 16:17:11 jaltman Exp $");
  
  #include <afs/stds.h>
  
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/procmgmt/procmgmt_nt.c,v 1.7.4.1 2007/01/30 12:07:18 jaltman Exp $");
  
  #include <afs/stds.h>
  
***************
*** 141,153 ****
      case SIGHUP:
      case SIGINT:
      case SIGKILL:
      case SIGTERM:
-     case SIGUSR1:
-     case SIGUSR2:
  	/* default action is "exit" */
  	ExitProcess(PMGT_SIGSTATUS_ENCODE(signo));
  	break;
-     case SIGQUIT:
      case SIGILL:
      case SIGABRT:
      case SIGFPE:
--- 141,151 ----
      case SIGHUP:
      case SIGINT:
      case SIGKILL:
+     case SIGQUIT:
      case SIGTERM:
  	/* default action is "exit" */
  	ExitProcess(PMGT_SIGSTATUS_ENCODE(signo));
  	break;
      case SIGILL:
      case SIGABRT:
      case SIGFPE:
***************
*** 161,166 ****
--- 159,166 ----
  	RaiseException((DWORD) PMGT_SIGSTATUS_ENCODE(signo),
  		       EXCEPTION_NONCONTINUABLE, 0, NULL);
  	break;
+     case SIGUSR1:
+     case SIGUSR2:
      case SIGCHLD:
  	/* default action is "ignore" */
  	break;
Index: openafs/src/procmgmt/afs/Makefile.am
diff -c openafs/src/procmgmt/afs/Makefile.am:1.1 openafs/src/procmgmt/afs/Makefile.am:removed
*** openafs/src/procmgmt/afs/Makefile.am:1.1	Tue Jun  5 16:17:52 2001
--- openafs/src/procmgmt/afs/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,12 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:52 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- buildinclude = $(top_builddir)/include/afs
- 
- afsincludedir = $(includedir)/afs
- afsinclude_HEADERS = 	\
- 	procmgmt.h
- 
- build_HEADERZ = $(afsinclude_HEADERS)
- 
--- 0 ----
Index: openafs/src/ptserver/ptprocs.c
diff -c openafs/src/ptserver/ptprocs.c:1.29.2.1 openafs/src/ptserver/ptprocs.c:1.29.2.2
*** openafs/src/ptserver/ptprocs.c:1.29.2.1	Mon Jul  3 23:57:24 2006
--- openafs/src/ptserver/ptprocs.c	Tue Feb  6 23:53:18 2007
***************
*** 51,57 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.29.2.1 2006/07/04 03:57:24 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
--- 51,57 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.29.2.2 2007/02/07 04:53:18 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
***************
*** 628,634 ****
  	ABORT_WITH(tt, code);
  
      for (i = 0; i < aname->namelist_len; i++) {
! 	code = NameToID(tt, aname->namelist_val[i], &aid->idlist_val[i]);
  	if (code != PRSUCCESS)
  	    aid->idlist_val[i] = ANONYMOUSID;
          osi_audit(PTS_NmToIdEvent, code, AUD_STR,
--- 628,651 ----
  	ABORT_WITH(tt, code);
  
      for (i = 0; i < aname->namelist_len; i++) {
! 	char vname[256];
! 	char *nameinst, *cell;
! 
! 	strncpy(vname, aname->namelist_val[i], sizeof(vname));
! 	vname[sizeof(vname)-1] ='\0';
! 
! 	nameinst = vname;
! 	cell = strchr(vname, '@');
! 	if (cell) {
! 	    *cell = '\0';
! 	    cell++;
! 	}
! 
! 	if (cell && afs_is_foreign_ticket_name(nameinst,NULL,cell,pr_realmName))
! 	    code = NameToID(tt, aname->namelist_val[i], &aid->idlist_val[i]);
! 	else 
! 	    code = NameToID(tt, nameinst, &aid->idlist_val[i]);
! 
  	if (code != PRSUCCESS)
  	    aid->idlist_val[i] = ANONYMOUSID;
          osi_audit(PTS_NmToIdEvent, code, AUD_STR,
Index: openafs/src/ptserver/ptuser.c
diff -c openafs/src/ptserver/ptuser.c:1.25.2.8 openafs/src/ptserver/ptuser.c:1.25.2.9
*** openafs/src/ptserver/ptuser.c:1.25.2.8	Fri Jan  5 13:21:50 2007
--- openafs/src/ptserver/ptuser.c	Thu Feb  8 20:00:21 2007
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.25.2.8 2007/01/05 18:21:50 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.25.2.9 2007/02/09 01:00:21 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 24,30 ****
  #include "afs/stds.h"
  #include "rx/rx.h"
  #include "rx/xdr.h"
- #include "rx/rxkad.h"
  #include "afs/auth.h"
  #include "afs/cellconfig.h"
  #include "afs/afsutil.h"
--- 24,29 ----
***************
*** 50,56 ****
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
- #include <rx/rxkad.h>
  #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/afsutil.h>
--- 49,54 ----
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.56.2.3 openafs/src/rx/rx_kcommon.c:1.56.2.4
*** openafs/src/rx/rx_kcommon.c:1.56.2.3	Thu Nov  9 19:20:19 2006
--- openafs/src/rx/rx_kcommon.c	Thu Feb  8 19:18:45 2007
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.3 2006/11/10 00:20:19 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.4 2007/02/09 00:18:45 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 520,526 ****
  int
  rxi_GetcbiInfo(void)
  {
!     int i, j, different = 0;
      int rxmtu, maxmtu;
      afs_uint32 ifinaddr;
      afs_uint32 addrs[ADDRSPERSITE];
--- 520,526 ----
  int
  rxi_GetcbiInfo(void)
  {
!     int i, j, different = 0, num = ADDRSPERSITE;
      int rxmtu, maxmtu;
      afs_uint32 ifinaddr;
      afs_uint32 addrs[ADDRSPERSITE];
***************
*** 529,535 ****
      memset((void *)addrs, 0, sizeof(addrs));
      memset((void *)mtus, 0, sizeof(mtus));
  
!     for (i = 0; i < afs_cb_interface.numberOfInterfaces; i++) {
  	if (!afs_cb_interface.mtu[i])
  	    afs_cb_interface.mtu[i] = htonl(1500);
  	rxmtu = (ntohl(afs_cb_interface.mtu[i]) - RX_IPUDP_SIZE);
--- 529,537 ----
      memset((void *)addrs, 0, sizeof(addrs));
      memset((void *)mtus, 0, sizeof(mtus));
  
!     if (afs_cb_interface.numberOfInterfaces < num)
! 	num = afs_cb_interface.numberOfInterfaces;
!     for (i = 0; i < num; i++) {
  	if (!afs_cb_interface.mtu[i])
  	    afs_cb_interface.mtu[i] = htonl(1500);
  	rxmtu = (ntohl(afs_cb_interface.mtu[i]) - RX_IPUDP_SIZE);
Index: openafs/src/rxgen/Makefile.am
diff -c openafs/src/rxgen/Makefile.am:1.1 openafs/src/rxgen/Makefile.am:removed
*** openafs/src/rxgen/Makefile.am:1.1	Tue Jun  5 16:17:53 2001
--- openafs/src/rxgen/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 1,19 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:53 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- bin_PROGRAMS = rxgen
- 
- rxgen_SOURCES = 	\
- 	rpc_main.c	\
- 	rpc_hout.c	\
- 	rpc_cout.c	\
- 	rpc_parse.c	\
- 	rpc_scan.c	\
- 	rpc_util.c	\
- 	rpc_svcout.c	\
- 	rpc_clntout.c	\
- 	rpc_util.h	\
- 	rpc_parse.h	\
- 	rpc_scan.h
- 
--- 0 ----
Index: openafs/src/rxgk/Makefile.am
diff -c openafs/src/rxgk/Makefile.am:1.1 openafs/src/rxgk/Makefile.am:removed
*** openafs/src/rxgk/Makefile.am:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/Makefile.am	Tue Feb 13 21:16:08 2007
***************
*** 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)
--- 0 ----
Index: openafs/src/rxgk/Makefile.in
diff -c openafs/src/rxgk/Makefile.in:1.1 openafs/src/rxgk/Makefile.in:removed
*** openafs/src/rxgk/Makefile.in:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/Makefile.in	Tue Feb 13 21:16:08 2007
***************
*** 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:
--- 0 ----
Index: openafs/src/rxgk/README
diff -c openafs/src/rxgk/README:1.1 openafs/src/rxgk/README:removed
*** openafs/src/rxgk/README:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/README	Tue Feb 13 21:16:08 2007
***************
*** 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.
--- 0 ----
Index: openafs/src/rxgk/rxgk.h
diff -c openafs/src/rxgk/rxgk.h:1.1 openafs/src/rxgk/rxgk.h:removed
*** openafs/src/rxgk/rxgk.h:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk.h	Tue Feb 13 21:16:08 2007
***************
*** 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 */
--- 0 ----
Index: openafs/src/rxgk/rxgk_clnt.c
diff -c openafs/src/rxgk/rxgk_clnt.c:1.1 openafs/src/rxgk/rxgk_clnt.c:removed
*** openafs/src/rxgk/rxgk_clnt.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_clnt.c	Tue Feb 13 21:16:08 2007
***************
*** 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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_common.c
diff -c openafs/src/rxgk/rxgk_common.c:1.1 openafs/src/rxgk/rxgk_common.c:removed
*** openafs/src/rxgk/rxgk_common.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_common.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <errno.h>
- 
- #include <rx/rx.h>
- #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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_crkrb.c
diff -c openafs/src/rxgk/rxgk_crkrb.c:1.1 openafs/src/rxgk/rxgk_crkrb.c:removed
*** openafs/src/rxgk/rxgk_crkrb.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_crkrb.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <errno.h>
- 
- 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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_crlha.c
diff -c openafs/src/rxgk/rxgk_crlha.c:1.1 openafs/src/rxgk/rxgk_crlha.c:removed
*** openafs/src/rxgk/rxgk_crlha.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_crlha.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <openssl/md5.h>
- #include <openssl/des.h>
- 
- #include <errno.h>
- 
- /*
-  *	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
--- 0 ----
Index: openafs/src/rxgk/rxgk_crpc.c
diff -c openafs/src/rxgk/rxgk_crpc.c:1.1 openafs/src/rxgk/rxgk_crpc.c:removed
*** openafs/src/rxgk/rxgk_crpc.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_crpc.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <rx/rx.h>
- #include "rxgk_proto.h"
- #include "rxgk_proto.cs.h"
- 
- #include <errno.h>
- 
- 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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_info.c
diff -c openafs/src/rxgk/rxgk_info.c:1.1 openafs/src/rxgk/rxgk_info.c:removed
*** openafs/src/rxgk/rxgk_info.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_info.c	Tue Feb 13 21:16:08 2007
***************
*** 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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_locl.h
diff -c openafs/src/rxgk/rxgk_locl.h:1.1 openafs/src/rxgk/rxgk_locl.h:removed
*** openafs/src/rxgk/rxgk_locl.h:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_locl.h	Tue Feb 13 21:16:08 2007
***************
*** 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 <config.h>
- #endif
- 
- #include <stdlib.h>
- #include <string.h>
- #include <limits.h>
- 
- #include <sys/types.h>
- #include <netinet/in.h>
- 
- #include <krb5.h>
- #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 <rx/rx.h>
- #include <rx/rx_null.h>
- #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 */
--- 0 ----
Index: openafs/src/rxgk/rxgk_proto.xg
diff -c openafs/src/rxgk/rxgk_proto.xg:1.1 openafs/src/rxgk/rxgk_proto.xg:removed
*** openafs/src/rxgk/rxgk_proto.xg:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_proto.xg	Tue Feb 13 21:16:08 2007
***************
*** 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<RXGK_MAX_TOKEN_LEN>;
- 
- /*
-  *
-  */
- 
- 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<RXGK_KEY_ENCTYPES>;	/* 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<RXGK_KEY_MAXSIZE>;
- };
- 
- /*
-  * Rx auth cred equivalent
-  */
- 
- struct RXGK_AUTH_CRED {
-     afs_int32	ac_version;	/* version of format of RXGK_AUTH_CRED */
-     string	ac_principal<RXGK_KEY_MAXPRINCIPAL>; /* prefixed with mech */
-     afs_int32	ac_starttime;
-     afs_int32	ac_endtime;
-     afs_int32	ac_enctype;
-     opaque	ac_key<RXGK_KEY_MAXSIZE>;
- };
- 
- /*
-  * 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<RXGK_MAX_AUTHTOKEN>;
-     opaque	rr_ctext<RXGK_MAX_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<RXGK_MAX_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<RXGK_MAX_KEYCONTRIB>;
- };
- 
- /* rx transport key */
- 
- struct RXGK_rxtransport_key {
-     opaque	client_keycontribution<RXGK_MAX_KEYCONTRIB>;
-     opaque	server_keycontribution<RXGK_MAX_KEYCONTRIB>;
- };
- 
- #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
- 
--- 0 ----
Index: openafs/src/rxgk/rxgk_serv.c
diff -c openafs/src/rxgk/rxgk_serv.c:1.1 openafs/src/rxgk/rxgk_serv.c:removed
*** openafs/src/rxgk/rxgk_serv.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_serv.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <errno.h>
- 
- #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;
- }
--- 0 ----
Index: openafs/src/rxgk/rxgk_srpc.c
diff -c openafs/src/rxgk/rxgk_srpc.c:1.1 openafs/src/rxgk/rxgk_srpc.c:removed
*** openafs/src/rxgk/rxgk_srpc.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/rxgk_srpc.c	Tue Feb 13 21:16:08 2007
***************
*** 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 <errno.h>
- 
- #include <rx/rx.h>
- #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;
- }
--- 0 ----
Index: openafs/src/rxgk/test.xg
diff -c openafs/src/rxgk/test.xg:1.1 openafs/src/rxgk/test.xg:removed
*** openafs/src/rxgk/test.xg:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/test.xg	Tue Feb 13 21:16:08 2007
***************
*** 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;
--- 0 ----
Index: openafs/src/rxgk/test_client.c
diff -c openafs/src/rxgk/test_client.c:1.1 openafs/src/rxgk/test_client.c:removed
*** openafs/src/rxgk/test_client.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/test_client.c	Tue Feb 13 21:16:08 2007
***************
*** 1,202 ****
- /*
-  * Copyright (c) 2002 - 2004, Stockholms universitet
-  * (Stockholm University, Stockholm Sweden)
-  * All rights reserved.
-  * 
-  * Redistribution is not permitted
-  */
- 
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- 
- #include <err.h>
- #include <errno.h>
- #include <netdb.h>
- 
- #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;
- }
- 
--- 0 ----
Index: openafs/src/rxgk/test_server.c
diff -c openafs/src/rxgk/test_server.c:1.1 openafs/src/rxgk/test_server.c:removed
*** openafs/src/rxgk/test_server.c:1.1	Sun Aug  8 15:21:33 2004
--- openafs/src/rxgk/test_server.c	Tue Feb 13 21:16:08 2007
***************
*** 1,76 ****
- /*
-  * Copyright (c) 2002 - 2004, Stockholms universitet
-  * (Stockholm University, Stockholm Sweden)
-  * All rights reserved.
-  * 
-  * Redistribution is not permitted
-  */
- 
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- 
- #include <err.h>
- #include <netdb.h>
- 
- #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;
- }
--- 0 ----
Index: openafs/src/shlibafsrpc/.cvsignore
diff -c openafs/src/shlibafsrpc/.cvsignore:1.2 openafs/src/shlibafsrpc/.cvsignore:1.2.14.1
*** openafs/src/shlibafsrpc/.cvsignore:1.2	Thu Jun 19 12:29:00 2003
--- openafs/src/shlibafsrpc/.cvsignore	Mon Jan 22 12:34:26 2007
***************
*** 1,2 ****
  Makefile
! libafsrpc.so.1.0
--- 1,2 ----
  Makefile
! libafsrpc.so.1.1
Index: openafs/src/tests/create-stat.c
diff -c openafs/src/tests/create-stat.c:1.2 openafs/src/tests/create-stat.c:1.2.14.1
*** openafs/src/tests/create-stat.c:1.2	Tue Jul 15 19:16:56 2003
--- openafs/src/tests/create-stat.c	Thu Feb  8 20:00:21 2007
***************
*** 44,50 ****
  #include <unistd.h>
  #include <dirent.h>
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  
--- 44,49 ----
***************
*** 56,62 ****
  };
  
  #ifdef RCSID
! RCSID("$Id: create-stat.c,v 1.2 2003/07/15 23:16:56 shadow Exp $");
  #endif
  
  static void
--- 55,61 ----
  };
  
  #ifdef RCSID
! RCSID("$Id: create-stat.c,v 1.2.14.1 2007/02/09 01:00:21 shadow Exp $");
  #endif
  
  static void
Index: openafs/src/tests/dumpscan.h
diff -c openafs/src/tests/dumpscan.h:1.2 openafs/src/tests/dumpscan.h:1.2.14.1
*** openafs/src/tests/dumpscan.h:1.2	Tue Jul 15 19:16:58 2003
--- openafs/src/tests/dumpscan.h	Thu Feb  8 20:00:21 2007
***************
*** 40,46 ****
  #include <afs/ihandle.h>
  #include <afs/vnode.h>
  #include <afs/cmd.h>
- #include <afs/auth.h>
  #include <afs/bnode.h>
  #include <afs/cellconfig.h>
  #include <afs/kautils.h>
--- 40,45 ----
Index: openafs/src/tests/fs_lib.c
diff -c openafs/src/tests/fs_lib.c:1.3 openafs/src/tests/fs_lib.c:1.3.14.1
*** openafs/src/tests/fs_lib.c:1.3	Tue Jul 15 19:17:00 2003
--- openafs/src/tests/fs_lib.c	Thu Feb  8 20:00:21 2007
***************
*** 49,55 ****
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  
--- 49,54 ----
Index: openafs/src/tsalvaged/.cvsignore
diff -c /dev/null openafs/src/tsalvaged/.cvsignore:1.1.8.2
*** /dev/null	Tue Feb 13 21:16:09 2007
--- openafs/src/tsalvaged/.cvsignore	Mon Jan 22 12:34:27 2007
***************
*** 0 ****
--- 1,4 ----
+ Makefile
+ fssync-debug
+ salvageserver
+ salvsync-debug
Index: openafs/src/tviced/serialize_state.c
diff -c openafs/src/tviced/serialize_state.c:1.1.4.1 openafs/src/tviced/serialize_state.c:1.1.4.2
*** openafs/src/tviced/serialize_state.c:1.1.4.1	Wed Aug  2 15:01:23 2006
--- openafs/src/tviced/serialize_state.c	Thu Feb  8 20:00:21 2007
***************
*** 16,22 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tviced/serialize_state.c,v 1.1.4.1 2006/08/02 19:01:23 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
--- 16,22 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tviced/serialize_state.c,v 1.1.4.2 2007/02/09 01:00:21 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
***************
*** 53,59 ****
  #include <afs/acl.h>
  #include <afs/ptclient.h>
  #include <afs/prs_fs.h>
- #include <afs/auth.h>
  #include <afs/afsutil.h>
  #include <rx/rx.h>
  #include <afs/cellconfig.h>
--- 53,58 ----
Index: openafs/src/tviced/state_analyzer.c
diff -c openafs/src/tviced/state_analyzer.c:1.1 openafs/src/tviced/state_analyzer.c:1.1.4.1
*** openafs/src/tviced/state_analyzer.c:1.1	Thu Mar 23 10:09:13 2006
--- openafs/src/tviced/state_analyzer.c	Thu Feb  8 20:00:21 2007
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tviced/state_analyzer.c,v 1.1 2006/03/23 15:09:13 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tviced/state_analyzer.c,v 1.1.4.1 2007/02/09 01:00:21 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 53,59 ****
  #include <afs/acl.h>
  #include <afs/ptclient.h>
  #include <afs/prs_fs.h>
- #include <afs/auth.h>
  #include <afs/afsutil.h>
  #include <rx/rx.h>
  #include <afs/cellconfig.h>
--- 53,58 ----
Index: openafs/src/ubik/uinit.c
diff -c openafs/src/ubik/uinit.c:1.7.8.1 openafs/src/ubik/uinit.c:1.7.8.2
*** openafs/src/ubik/uinit.c:1.7.8.1	Fri Sep 15 19:22:27 2006
--- openafs/src/ubik/uinit.c	Thu Feb  8 20:00:22 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.7.8.1 2006/09/15 23:22:27 jaltman Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/uinit.c,v 1.7.8.2 2007/02/09 01:00:22 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
***************
*** 48,54 ****
  #include <ubik.h>
  #include <afs/afsint.h>
  #include <afs/cmd.h>
- #include <rx/rxkad.h>
  
  /*
    Get the appropriate type of ubik client structure out from the system.
--- 48,53 ----
Index: openafs/src/uss/uss_vol.c
diff -c openafs/src/uss/uss_vol.c:1.10 openafs/src/uss/uss_vol.c:1.10.14.1
*** openafs/src/uss/uss_vol.c:1.10	Tue Jul 15 19:17:12 2003
--- openafs/src/uss/uss_vol.c	Thu Feb  8 20:00:22 2007
***************
*** 19,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/uss/uss_vol.c,v 1.10 2003/07/15 23:17:12 shadow Exp $");
  
  #include "uss_vol.h"		/*Interface to this module */
  #include "uss_common.h"		/*Common definitions */
--- 19,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/uss/uss_vol.c,v 1.10.14.1 2007/02/09 01:00:22 shadow Exp $");
  
  #include "uss_vol.h"		/*Interface to this module */
  #include "uss_common.h"		/*Common definitions */
***************
*** 41,47 ****
  #include <afs/vlserver.h>
  #include <afs/auth.h>
  #include <afs/cellconfig.h>
- #include <rx/rxkad.h>
  #include <rx/rx_globals.h>
  #include <afs/volser.h>
  #include <afs/volint.h>
--- 41,46 ----
Index: openafs/src/util/Makefile.am
diff -c openafs/src/util/Makefile.am:1.2 openafs/src/util/Makefile.am:removed
*** openafs/src/util/Makefile.am:1.2	Thu Mar  9 01:35:05 2006
--- openafs/src/util/Makefile.am	Tue Feb 13 21:16:09 2007
***************
*** 1,32 ****
- # $Id: Makefile.am,v 1.2 2006/03/09 06:35:05 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- SUBDIRS = afs
- 
- #bin_PROGRAMS = sys
- 
- lib_LIBRARIES=libutil.a
- 
- libutil_a_SOURCES =  	\
- 	assert.c	\
- 	base64.c	\
- 	casestrcpy.c	\
- 	ktime.c		\
- 	volparse.c	\
- 	hostparse.c	\
- 	hputil.c	\
- 	kreltime.c	\
- 	isathing.c	\
- 	get_krbrlm.c	\
- 	uuid.c		\
- 	serverLog.c	\
- 	dirpath.c	\
- 	fileutil.c	\
- 	netutils.c	\
- 	flipbase64.c	\
- 	afs_atomlist.c	\
- 	afs_lhash.c	\
- 	snprintf.c	\
- 	fstab.c
- 
--- 0 ----
Index: openafs/src/util/get_krbrlm.c
diff -c openafs/src/util/get_krbrlm.c:1.9 openafs/src/util/get_krbrlm.c:1.9.2.1
*** openafs/src/util/get_krbrlm.c:1.9	Mon Mar 13 10:09:47 2006
--- openafs/src/util/get_krbrlm.c	Tue Feb  6 23:53:18 2007
***************
*** 7,13 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/get_krbrlm.c,v 1.9 2006/03/13 15:09:47 jaltman Exp $");
  
  #include <stdio.h>
  #include "afsutil.h"
--- 7,13 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/get_krbrlm.c,v 1.9.2.1 2007/02/07 04:53:18 jaltman Exp $");
  
  #include <stdio.h>
  #include "afsutil.h"
***************
*** 122,128 ****
  	foreign = 1;
  
  #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
!     if (!foreign) {
  	static char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
  	static int  num_lrealms = -1;
  	int lrealm_match, i;
--- 122,128 ----
  	foreign = 1;
  
  #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
!     if (foreign) {
  	static char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
  	static int  num_lrealms = -1;
  	int lrealm_match, i;
Index: openafs/src/util/afs/Makefile.am
diff -c openafs/src/util/afs/Makefile.am:1.1 openafs/src/util/afs/Makefile.am:removed
*** openafs/src/util/afs/Makefile.am:1.1	Tue Jun  5 16:17:53 2001
--- openafs/src/util/afs/Makefile.am	Tue Feb 13 21:16:09 2007
***************
*** 1,26 ****
- # $Id: Makefile.am,v 1.1 2001/06/05 20:17:53 shadow Exp $
- 
- include $(top_srcdir)/Makefile.am.common
- 
- buildinclude = $(top_builddir)/include/afs
- 
- afsincludedir = $(includedir)/afs
- afsinclude_HEADERS = 	\
- 	assert.h	\
- 	potpourri.h	\
- 	itc.h		\
- 	errors.h	\
- 	afsutil.h	\
- 	pthread_glock.h	\
- 	dirpath.h	\
- 	afs_atomlist.h	\
- 	fileutil.h	\
- 	ktime.h		\
- 	netutils.h	\
- 	packages.h	\
- 	pthread_nosigs.h \
- 	remote.h	\
- 	afs_lhash.h
- 
- build_HEADERZ = $(afsinclude_HEADERS)
- 
--- 0 ----
Index: openafs/src/venus/cmdebug.c
diff -c openafs/src/venus/cmdebug.c:1.19.4.1 openafs/src/venus/cmdebug.c:1.19.4.2
*** openafs/src/venus/cmdebug.c:1.19.4.1	Mon Jun 26 12:20:50 2006
--- openafs/src/venus/cmdebug.c	Thu Feb  1 08:25:33 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/cmdebug.c,v 1.19.4.1 2006/06/26 16:20:50 rra Exp $");
  
  
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/cmdebug.c,v 1.19.4.2 2007/02/01 13:25:33 jaltman Exp $");
  
  
  #include <sys/types.h>
***************
*** 42,47 ****
--- 42,48 ----
  #include <lock.h>
  #include <afs/afs_args.h>
  #include <afs/afsutil.h>
+ #include <afs/com_err.h>
  
  extern struct hostent *hostutil_GetHostByName();
  
Index: openafs/src/venus/dedebug.c
diff -c openafs/src/venus/dedebug.c:1.1 openafs/src/venus/dedebug.c:1.1.4.1
*** openafs/src/venus/dedebug.c:1.1	Wed Nov  2 23:00:26 2005
--- openafs/src/venus/dedebug.c	Thu Feb  1 08:25:33 2007
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /cvs/openafs/src/venus/dedebug.c,v 1.1 2005/11/03 04:00:26 shadow Exp $");
  
  
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /cvs/openafs/src/venus/dedebug.c,v 1.1.4.1 2007/02/01 13:25:33 jaltman Exp $");
  
  
  #include <sys/types.h>
***************
*** 23,28 ****
--- 23,29 ----
  #endif
  #include <afs/afscbint.h>
  #include <afs/cmd.h>
+ #include <afs/com_err.h>
  #include <rx/rx.h>
  #include <lock.h>
  
Index: openafs/src/venus/fs.c
diff -c openafs/src/venus/fs.c:1.30.2.5 openafs/src/venus/fs.c:1.30.2.7
*** openafs/src/venus/fs.c:1.30.2.5	Mon Jul 31 17:27:41 2006
--- openafs/src/venus/fs.c	Thu Feb  8 20:00:22 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.30.2.5 2006/07/31 21:27:41 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.30.2.7 2007/02/09 01:00:22 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 25,30 ****
--- 25,31 ----
  #include <afs/stds.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
+ #include <afs/com_err.h>
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #endif
***************
*** 41,47 ****
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <ubik.h>
  #include <rx/rxkad.h>
--- 42,47 ----
Index: openafs/src/venus/gcpags.c
diff -c openafs/src/venus/gcpags.c:1.5 openafs/src/venus/gcpags.c:1.5.14.1
*** openafs/src/venus/gcpags.c:1.5	Tue Jul 15 19:17:22 2003
--- openafs/src/venus/gcpags.c	Thu Feb  8 20:00:22 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/gcpags.c,v 1.5 2003/07/15 23:17:22 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/gcpags.c,v 1.5.14.1 2007/02/09 01:00:22 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
***************
*** 31,37 ****
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
--- 31,36 ----
Index: openafs/src/venus/livesys.c
diff -c openafs/src/venus/livesys.c:1.4 openafs/src/venus/livesys.c:1.4.14.1
*** openafs/src/venus/livesys.c:1.4	Tue Jul 15 19:17:22 2003
--- openafs/src/venus/livesys.c	Thu Feb  1 08:25:33 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4 2003/07/15 23:17:22 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4.14.1 2007/02/01 13:25:33 jaltman Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 32,37 ****
--- 32,38 ----
  #include <afs/stds.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
+ #include <afs/com_err.h>
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #endif
Index: openafs/src/venus/twiddle.c
diff -c openafs/src/venus/twiddle.c:1.7 openafs/src/venus/twiddle.c:1.7.14.2
*** openafs/src/venus/twiddle.c:1.7	Tue Jul 15 19:17:22 2003
--- openafs/src/venus/twiddle.c	Thu Feb  8 20:00:22 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7 2003/07/15 23:17:22 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7.14.2 2007/02/09 01:00:22 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
***************
*** 31,42 ****
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
- #include <afs/auth.h>>
  #include <errno.h
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
! 
  
  #define	MAXSIZE	2048
  #define MAXINSIZE 1300		/* pioctl complains if data is larger than this */
--- 31,41 ----
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
  #include <errno.h
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
! #include <afs/com_err.h>
  
  #define	MAXSIZE	2048
  #define MAXINSIZE 1300		/* pioctl complains if data is larger than this */
Index: openafs/src/venus/whatfid.c
diff -c openafs/src/venus/whatfid.c:1.5 openafs/src/venus/whatfid.c:1.5.14.1
*** openafs/src/venus/whatfid.c:1.5	Tue Jul 15 19:17:22 2003
--- openafs/src/venus/whatfid.c	Thu Feb  8 20:00:22 2007
***************
*** 14,20 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5 2003/07/15 23:17:22 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 14,20 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5.14.1 2007/02/09 01:00:22 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 30,36 ****
  #include <afs/venus.h>
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
--- 30,35 ----
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.113.2.11 openafs/src/viced/afsfileprocs.c:1.113.2.12
*** openafs/src/viced/afsfileprocs.c:1.113.2.11	Mon Sep 25 21:37:23 2006
--- openafs/src/viced/afsfileprocs.c	Thu Feb  8 20:00:22 2007
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.11 2006/09/26 01:37:23 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.12 2007/02/09 01:00:22 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 106,112 ****
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  
- #include <afs/auth.h>
  #include <signal.h>
  #include <afs/partition.h>
  #include "viced_prototypes.h"
--- 106,111 ----
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.75.2.9 openafs/src/viced/viced.c:1.75.2.10
*** openafs/src/viced/viced.c:1.75.2.9	Fri Jan 12 00:20:33 2007
--- openafs/src/viced/viced.c	Thu Feb  8 20:00:22 2007
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.75.2.9 2007/01/12 05:20:33 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.75.2.10 2007/02/09 01:00:22 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 77,83 ****
  #include <afs/acl.h>
  #include <afs/prs_fs.h>
  #include <rx/rx.h>
- #include <rx/rxkad.h>
  #include <afs/keys.h>
  #include <afs/afs_args.h>
  #include <afs/vlserver.h>
--- 77,82 ----
Index: openafs/src/vlserver/sascnvldb.c
diff -c openafs/src/vlserver/sascnvldb.c:1.7 openafs/src/vlserver/sascnvldb.c:1.7.14.1
*** openafs/src/vlserver/sascnvldb.c:1.7	Tue Jul 15 19:17:34 2003
--- openafs/src/vlserver/sascnvldb.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/sascnvldb.c,v 1.7 2003/07/15 23:17:34 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/sascnvldb.c,v 1.7.14.1 2007/02/09 01:00:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 28,34 ****
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <ubik.h>
  #endif
--- 28,33 ----
Index: openafs/src/vlserver/vlclient.c
diff -c openafs/src/vlserver/vlclient.c:1.16 openafs/src/vlserver/vlclient.c:1.16.2.1
*** openafs/src/vlserver/vlclient.c:1.16	Tue Apr  4 16:51:20 2006
--- openafs/src/vlserver/vlclient.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlclient.c,v 1.16 2006/04/04 20:51:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlclient.c,v 1.16.2.1 2007/02/09 01:00:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 52,58 ****
  #include <rx/rx.h>
  #include <rx/rx_globals.h>
  #include <rx/rxkad.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <afs/cmd.h>
--- 52,57 ----
Index: openafs/src/vol/NTMakefile
diff -c openafs/src/vol/NTMakefile:1.9 openafs/src/vol/NTMakefile:1.9.2.1
*** openafs/src/vol/NTMakefile:1.9	Mon Mar 20 12:29:57 2006
--- openafs/src/vol/NTMakefile	Tue Jan 30 07:17:28 2007
***************
*** 40,46 ****
  	$(OUT)\clone.obj \
  	$(OUT)\fssync-client.obj \
  	$(OUT)\fssync-server.obj \
- 	$(OUT)\fssync-debug.obj \
  	$(OUT)\daemon_com.obj \
  	$(OUT)\ntops.obj \
  	$(OUT)\nuke.obj \
--- 40,45 ----
***************
*** 77,82 ****
--- 76,82 ----
  SALVAGER = $(DESTDIR)\root.server\usr\afs\bin\salvager.exe
  
  SALVAGER_EXEOBJS =\
+ 	$(OUT)\salvager.obj \
  	$(OUT)\vol-salvage.obj \
  	$(OUT)\physio.obj \
  	$(OUT)\AFS_component_version_number.obj \
***************
*** 89,94 ****
--- 89,108 ----
  
  
  ############################################################################
+ # build fssync-debug
+ FSSYNC_DEBUG = $(DESTDIR)\root.server\usr\afs\bin\fssync-debug.exe
+ 
+ FSSYNC_DEBUG_EXEOBJS =\
+ 	$(OUT)\fssync-debug.obj \
+ 	$(OUT)\AFS_component_version_number.obj \
+ 	$(OUT)\fssync-debug.res
+ 
+ $(FSSYNC_DEBUG): $(FSSYNC_DEBUG_EXEOBJS) $(EXEC_LIBS)
+ 	$(EXECONLINK)
+         $(_VC_MANIFEST_EMBED_EXE)
+ 	$(EXEPREP)
+ 
+ ############################################################################
  # build volinfo
  VOLINFO = $(DESTDIR)\root.server\usr\afs\bin\volinfo.exe
  
Index: openafs/src/vol/daemon_com.c
diff -c openafs/src/vol/daemon_com.c:1.3 openafs/src/vol/daemon_com.c:1.3.4.2
*** openafs/src/vol/daemon_com.c:1.3	Tue Apr  4 20:34:17 2006
--- openafs/src/vol/daemon_com.c	Thu Feb  8 18:59:32 2007
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/daemon_com.c,v 1.3 2006/04/05 00:34:17 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/daemon_com.c,v 1.3.4.2 2007/02/08 23:59:32 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 63,68 ****
--- 63,73 ----
  #include "partition.h"
  #include <rx/rx_queue.h>
  
+ #ifdef USE_UNIX_SOCKETS
+ #include <afs/afsutil.h>
+ #include <sys/un.h>
+ #endif
+ 
  /*@printflike@*/ extern void Log(const char *format, ...);
  
  #ifdef osi_Assert
***************
*** 77,83 ****
  
  #define MAX_BIND_TRIES	5	/* Number of times to retry socket bind */
  
! static int getport(SYNC_client_state * state, struct sockaddr_in *addr);
  static int SYNC_ask_internal(SYNC_client_state * state, SYNC_command * com, SYNC_response * res);
  
  /* daemon com SYNC client interface */
--- 82,93 ----
  
  #define MAX_BIND_TRIES	5	/* Number of times to retry socket bind */
  
! #ifdef USE_UNIX_SOCKETS
! static getport(SYNC_client_state * state, struct sockaddr_un *addr);
! #else  /* USE_UNIX_SOCKETS */
! static getport(SYNC_client_state * state, struct sockaddr_in *addr);
! #endif /* USE_UNIX_SOCKETS */
! 
  static int SYNC_ask_internal(SYNC_client_state * state, SYNC_command * com, SYNC_response * res);
  
  /* daemon com SYNC client interface */
***************
*** 85,91 ****
--- 95,105 ----
  int
  SYNC_connect(SYNC_client_state * state)
  {
+ #ifdef USE_UNIX_SOCKETS
+     struct sockaddr_un addr;
+ #else /* USE_UNIX_SOCKETS */
      struct sockaddr_in addr;
+ #endif /* USE_UNIX_SOCKETS */
      /* I can't believe the following is needed for localhost connections!! */
      static time_t backoff[] =
  	{ 3, 3, 3, 5, 5, 5, 7, 15, 16, 24, 32, 40, 48, 0 };
***************
*** 171,181 ****
  }
  
  /* private function to fill in the sockaddr struct for us */
  static int
! getport(SYNC_client_state * state, struct sockaddr_in *addr)
  {
      int sd;
  
      memset(addr, 0, sizeof(*addr));
      assert((sd = socket(AF_INET, SOCK_STREAM, 0)) >= 0);
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
--- 185,210 ----
  }
  
  /* private function to fill in the sockaddr struct for us */
+ #ifdef USE_UNIX_SOCKETS
  static int
! getport(SYNC_client_state * state, struct sockaddr_un *addr)
  {
      int sd;
+     char tbuffer[AFSDIR_PATH_MAX]; 
  
+     strcompose(tbuffer, AFSDIR_PATH_MAX, AFSDIR_SERVER_LOCAL_DIRPATH, "/",
+                "fssync.sock", NULL);
+     memset(addr, 0, sizeof(*addr));
+     addr->sun_family = AF_UNIX;
+     strncpy(addr->sun_path, tbuffer, (sizeof(struct sockaddr_un) - sizeof(short)));
+     assert((sd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
+     return sd;
+ }
+ #else  /* USE_UNIX_SOCKETS */
+ static int
+ getport(SYNC_client_state * state, struct sockaddr_in *addr)
+ {
+     int sd;
      memset(addr, 0, sizeof(*addr));
      assert((sd = socket(AF_INET, SOCK_STREAM, 0)) >= 0);
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
***************
*** 184,192 ****
      addr->sin_addr.s_addr = htonl(0x7f000001);
      addr->sin_family = AF_INET;	/* was localhost->h_addrtype */
      addr->sin_port = htons(state->port);	/* XXXX htons not _really_ neccessary */
- 
      return sd;
  }
  
  afs_int32
  SYNC_ask(SYNC_client_state * state, SYNC_command * com, SYNC_response * res)
--- 213,221 ----
      addr->sin_addr.s_addr = htonl(0x7f000001);
      addr->sin_family = AF_INET;	/* was localhost->h_addrtype */
      addr->sin_port = htons(state->port);	/* XXXX htons not _really_ neccessary */
      return sd;
  }
+ #endif /* USE_UNIX_SOCKETS */
  
  afs_int32
  SYNC_ask(SYNC_client_state * state, SYNC_command * com, SYNC_response * res)
Index: openafs/src/vol/fssync-debug.rc
diff -c /dev/null openafs/src/vol/fssync-debug.rc:1.1.2.2
*** /dev/null	Tue Feb 13 21:16:09 2007
--- openafs/src/vol/fssync-debug.rc	Tue Jan 30 07:25:20 2007
***************
*** 0 ****
--- 1,17 ----
+ /*
+  * 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 VERSIONINFO resource */
+ 
+ #define  AFS_VERINFO_FILE_DESCRIPTION "AFS FSSync Debug Command"
+ #define  AFS_VERINFO_NAME "fssync-debug"
+ #define  AFS_VERINFO_FILENAME "fssync-debug.exe"
+ 
+ #include "AFS_component_version_number.h"
+ #include "..\config\NTVersioninfo.rc"
Index: openafs/src/vol/fssync-server.c
diff -c openafs/src/vol/fssync-server.c:1.1 openafs/src/vol/fssync-server.c:1.1.4.2
*** openafs/src/vol/fssync-server.c:1.1	Fri Mar 17 23:20:19 2006
--- openafs/src/vol/fssync-server.c	Thu Feb  8 18:59:32 2007
***************
*** 53,59 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-server.c,v 1.1 2006/03/18 04:20:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 53,59 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-server.c,v 1.1.4.2 2007/02/08 23:59:32 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 98,103 ****
--- 98,107 ----
  #include "volume.h"
  #include "partition.h"
  
+ #ifdef USE_UNIX_SOCKETS
+ #include <sys/un.h>
+ #include <afs/afsutil.h>
+ #endif /* USE_UNIX_SOCKETS */
  
  #ifdef FSSYNC_BUILD_SERVER
  
***************
*** 201,206 ****
--- 205,227 ----
  
  static fd_set FSYNC_readfds;
  
+ #ifdef USE_UNIX_SOCKETS
+ static int
+ getport(struct sockaddr_un *addr)
+ {
+     int sd;
+     char tbuffer[AFSDIR_PATH_MAX]; 
+     
+     strcompose(tbuffer, AFSDIR_PATH_MAX, AFSDIR_SERVER_LOCAL_DIRPATH, "/",
+                "fssync.sock", NULL);
+     
+     memset(addr, 0, sizeof(*addr));
+     addr->sun_family = AF_UNIX;
+     strncpy(addr->sun_path, tbuffer, (sizeof(struct sockaddr_un) - sizeof(short)));
+     assert((sd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
+     return sd;
+ }
+ #else
  static int
  getport(struct sockaddr_in *addr)
  {
***************
*** 217,228 ****
--- 238,255 ----
  
      return sd;
  }
+ #endif
  
  
  static void
  FSYNC_sync()
  {
+ #ifdef USE_UNIX_SOCKETS
+     struct sockaddr_un addr;
+     char tbuffer[AFSDIR_PATH_MAX];
+ #else  /* USE_UNIX_SOCKETS */
      struct sockaddr_in addr;
+ #endif /* USE_UNIX_SOCKETS */
      int on = 1;
      extern int VInit;
      int code;
***************
*** 244,249 ****
--- 271,284 ----
      Log("Set thread id %d for FSYNC_sync\n", tid);
  #endif /* AFS_PTHREAD_ENV */
  
+ #ifdef USE_UNIX_SOCKETS
+     /* ignore errors */
+     strcompose(tbuffer, AFSDIR_PATH_MAX, AFSDIR_SERVER_LOCAL_DIRPATH, "/",
+ 	       "fssync.sock", NULL);
+ 
+     remove(tbuffer);
+ #endif /* USE_UNIX_SOCKETS */
+ 
      while (!VInit) {
  	/* Let somebody else run until level > 0.  That doesn't mean that 
  	 * all volumes have been attached. */
***************
*** 291,297 ****
--- 326,336 ----
  static void
  FSYNC_newconnection(int afd)
  {
+ #ifdef USE_UNIX_SOCKETS
+     struct sockaddr_un other;
+ #else  /* USE_UNIX_SOCKETS */
      struct sockaddr_in other;
+ #endif
      int junk, fd;
      junk = sizeof(other);
      fd = accept(afd, (struct sockaddr *)&other, &junk);
Index: openafs/src/vol/fssync.h
diff -c openafs/src/vol/fssync.h:1.5 openafs/src/vol/fssync.h:1.5.2.1
*** openafs/src/vol/fssync.h:1.5	Fri Mar 17 14:54:51 2006
--- openafs/src/vol/fssync.h	Thu Feb  8 18:16:49 2007
***************
*** 59,66 ****
  
  /* FSYNC flag codes */
  
- 
- 
  struct offlineInfo {
      afs_uint32 volumeID;
      char partName[16];
--- 59,64 ----
Index: openafs/src/vol/salvager.c
diff -c openafs/src/vol/salvager.c:1.1 openafs/src/vol/salvager.c:1.1.4.1
*** openafs/src/vol/salvager.c:1.1	Fri Mar 17 23:20:19 2006
--- openafs/src/vol/salvager.c	Tue Jan 30 07:17:28 2007
***************
*** 21,27 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvager.c,v 1.1 2006/03/18 04:20:19 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 21,27 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvager.c,v 1.1.4.1 2007/01/30 12:17:28 jaltman Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
***************
*** 124,129 ****
--- 124,130 ----
  #include "vol-salvage.h"
  #ifdef AFS_NT40_ENV
  #include <pthread.h>
+ pthread_t main_thread;
  #endif
  
  
***************
*** 350,361 ****
  #ifndef AFS_NT40_ENV
  #include "AFS_component_version_number.c"
  #endif
- #define MAX_ARGS 128
- #ifdef AFS_NT40_ENV
- char *save_args[MAX_ARGS];
- int n_save_args = 0;
- pthread_t main_thread;
- #endif
  
  int
  main(int argc, char **argv)
--- 351,356 ----
Index: openafs/src/vol/salvsync-server.c
diff -c openafs/src/vol/salvsync-server.c:1.1 openafs/src/vol/salvsync-server.c:1.1.4.2
*** openafs/src/vol/salvsync-server.c:1.1	Fri Mar 17 23:20:19 2006
--- openafs/src/vol/salvsync-server.c	Thu Feb  8 18:59:32 2007
***************
*** 27,33 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-server.c,v 1.1 2006/03/18 04:20:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 27,33 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-server.c,v 1.1.4.2 2007/02/08 23:59:32 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 72,77 ****
--- 72,83 ----
  #include <stddef.h>
  #endif
  
+ #ifdef USE_UNIX_SOCKETS
+ #include <afs/afsutil.h>
+ #include <sys/un.h>
+ #endif
+ 
+ 
  /*@printflike@*/ extern void Log(const char *format, ...);
  
  #ifdef osi_Assert
***************
*** 267,272 ****
--- 273,295 ----
      assert(pthread_create(&tid, &tattr, SALVSYNC_syncThread, NULL) == 0);
  }
  
+ #ifdef USE_UNIX_SOCKETS
+ static int
+ getport(struct sockaddr_un *addr)
+ {
+     int sd;
+     char tbuffer[AFSDIR_PATH_MAX]; 
+     
+     strcompose(tbuffer, AFSDIR_PATH_MAX, AFSDIR_SERVER_LOCAL_DIRPATH, "/",
+                "fssync.sock", NULL);
+     
+     memset(addr, 0, sizeof(*addr));
+     addr->sun_family = AF_UNIX;
+     strncpy(addr->sun_path, tbuffer, (sizeof(struct sockaddr_un) - sizeof(short)));
+     assert((sd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
+     return sd;
+ }
+ #else
  static int
  getport(struct sockaddr_in *addr)
  {
***************
*** 283,288 ****
--- 306,312 ----
  
      return sd;
  }
+ #endif
  
  static fd_set SALVSYNC_readfds;
  
***************
*** 294,299 ****
--- 318,326 ----
      int code;
      int numTries;
      int tid;
+ #ifdef USE_UNIX_SOCKETS
+     char tbuffer[AFSDIR_PATH_MAX]; 
+ #endif
  
  #ifndef AFS_NT40_ENV
      (void)signal(SIGPIPE, SIG_IGN);
***************
*** 306,311 ****
--- 333,345 ----
      pthread_setspecific(rx_thread_id_key, (void *)tid);
      Log("Set thread id %d for SALVSYNC_syncThread\n", tid);
  
+ #ifdef USE_UNIX_SOCKETS
+     strcompose(tbuffer, AFSDIR_PATH_MAX, AFSDIR_SERVER_LOCAL_DIRPATH, "/",
+                "fssync.sock", NULL);
+     /* ignore errors */
+     remove(tbuffer);
+ #endif /* USE_UNIX_SOCKETS */
+ 
      AcceptSd = getport(&addr);
      /* Reuseaddr needed because system inexplicably leaves crud lying around */
      code =
***************
*** 343,349 ****
--- 377,387 ----
  static void
  SALVSYNC_newconnection(int afd)
  {
+ #ifdef USE_UNIX_SOCKETS
+     struct sockaddr_un other;
+ #else  /* USE_UNIX_SOCKETS */
      struct sockaddr_in other;
+ #endif
      int junk, fd;
      junk = sizeof(other);
      fd = accept(afd, (struct sockaddr *)&other, &junk);
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.51.2.6 openafs/src/vol/vol-salvage.c:1.51.2.7
*** openafs/src/vol/vol-salvage.c:1.51.2.6	Tue Sep  5 19:50:18 2006
--- openafs/src/vol/vol-salvage.c	Tue Jan 30 07:17:28 2007
***************
*** 87,93 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.51.2.6 2006/09/05 23:50:18 jaltman Exp $");
  
  #ifndef AFS_NT40_ENV
  #include <sys/param.h>
--- 87,93 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.51.2.7 2007/01/30 12:17:28 jaltman Exp $");
  
  #ifndef AFS_NT40_ENV
  #include <sys/param.h>
***************
*** 317,331 ****
      return 0;			/* otherwise may be transient, e.g. EMFILE */
  }
  
- 
  #define MAX_ARGS 128
  #ifdef AFS_NT40_ENV
  char *save_args[MAX_ARGS];
  int n_save_args = 0;
! pthread_t main_thread;
  #endif
  
- 
  /* Get the salvage lock if not already held. Hold until process exits. */
  void
  ObtainSalvageLock(void)
--- 317,330 ----
      return 0;			/* otherwise may be transient, e.g. EMFILE */
  }
  
  #define MAX_ARGS 128
  #ifdef AFS_NT40_ENV
  char *save_args[MAX_ARGS];
  int n_save_args = 0;
! extern pthread_t main_thread;
! childJob_t myjob = { SALVAGER_MAGIC, NOT_CHILD, "" };
  #endif
  
  /* Get the salvage lock if not already held. Hold until process exits. */
  void
  ObtainSalvageLock(void)
Index: openafs/src/vol/vol-salvage.h
diff -c openafs/src/vol/vol-salvage.h:1.1 openafs/src/vol/vol-salvage.h:1.1.4.1
*** openafs/src/vol/vol-salvage.h:1.1	Fri Mar 17 23:20:19 2006
--- openafs/src/vol/vol-salvage.h	Tue Jan 30 07:17:28 2007
***************
*** 202,208 ****
  } childJob_t;
  
  /* Child job this process is running. */
! extern childJob_t myjob = { SALVAGER_MAGIC, NOT_CHILD, "" };
  
  extern int nt_SalvagePartition(char *partName, int jobn);
  extern int nt_SetupPartitionSalvage(void *datap, int len);
--- 202,208 ----
  } childJob_t;
  
  /* Child job this process is running. */
! extern childJob_t myjob;
  
  extern int nt_SalvagePartition(char *partName, int jobn);
  extern int nt_SetupPartitionSalvage(void *datap, int len);
Index: openafs/src/volser/volmain.c
diff -c openafs/src/volser/volmain.c:1.22.2.4 openafs/src/volser/volmain.c:1.22.2.5
*** openafs/src/volser/volmain.c:1.22.2.4	Sun Sep  3 01:53:15 2006
--- openafs/src/volser/volmain.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.4 2006/09/03 05:53:15 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.5 2007/02/09 01:00:23 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 55,61 ****
  #include <rx/rx.h>
  #include <rx/rx_globals.h>
  #include <afs/auth.h>
- #include <rx/rxkad.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 55,60 ----
Index: openafs/src/volser/volprocs.c
diff -c openafs/src/volser/volprocs.c:1.42.2.2 openafs/src/volser/volprocs.c:1.42.2.3
*** openafs/src/volser/volprocs.c:1.42.2.2	Mon Dec 18 22:42:21 2006
--- openafs/src/volser/volprocs.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.42.2.2 2006/12/19 03:42:21 jaltman Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.42.2.3 2007/02/09 01:00:23 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 49,55 ****
  #include <afs/nfs.h>
  #include <lwp.h>
  #include <lock.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 49,54 ----
Index: openafs/src/volser/voltrans.c
diff -c openafs/src/volser/voltrans.c:1.11 openafs/src/volser/voltrans.c:1.11.8.1
*** openafs/src/volser/voltrans.c:1.11	Wed Sep 22 23:55:52 2004
--- openafs/src/volser/voltrans.c	Thu Feb  8 20:00:23 2007
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/voltrans.c,v 1.11 2004/09/23 03:55:52 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.1 2007/02/09 01:00:23 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <afs/afsutil.h>
***************
*** 50,56 ****
  #include <afs/nfs.h>
  #include <lwp.h>
  #include <lock.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <rx/rx.h>
--- 50,55 ----
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.55.2.1 openafs/src/volser/vos.c:1.55.2.2
*** openafs/src/volser/vos.c:1.55.2.1	Mon Jul 31 11:24:45 2006
--- openafs/src/volser/vos.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.55.2.1 2006/07/31 15:24:45 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.55.2.2 2007/02/09 01:00:23 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 46,52 ****
  #include <rx/rx_globals.h>
  #include <afs/nfs.h>
  #include <afs/vlserver.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <afs/afsutil.h>
--- 46,51 ----
***************
*** 54,60 ****
  #include <afs/afsint.h>
  #include <afs/cmd.h>
  #include <afs/usd.h>
- #include <rx/rxkad.h>
  #include "volser.h"
  #include "volint.h"
  #include "lockdata.h"
--- 53,58 ----
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.38 openafs/src/volser/vsprocs.c:1.38.2.1
*** openafs/src/volser/vsprocs.c:1.38	Tue Apr  4 16:51:23 2006
--- openafs/src/volser/vsprocs.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.38 2006/04/04 20:51:23 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.38.2.1 2007/02/09 01:00:23 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 41,47 ****
  #include <rx/rx.h>
  #include <afs/vlserver.h>
  #include <afs/nfs.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 41,46 ----
Index: openafs/src/volser/vsutils.c
diff -c openafs/src/volser/vsutils.c:1.18.8.1 openafs/src/volser/vsutils.c:1.18.8.2
*** openafs/src/volser/vsutils.c:1.18.8.1	Mon Jul  3 15:07:16 2006
--- openafs/src/volser/vsutils.c	Thu Feb  8 20:00:23 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsutils.c,v 1.18.8.1 2006/07/03 19:07:16 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsutils.c,v 1.18.8.2 2007/02/09 01:00:23 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
***************
*** 43,49 ****
  #include <rx/rx_globals.h>
  #include <afs/nfs.h>
  #include <afs/vlserver.h>
- #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/keys.h>
  #include <ubik.h>
--- 43,48 ----
***************
*** 407,421 ****
       char *confDir;
       afs_int32 sauth;
  {
-     afs_int32 code, scIndex, i;
-     struct afsconf_cell info;
-     struct afsconf_dir *tdir;
-     struct ktc_principal sname;
-     struct ktc_token ttoken;
-     struct rx_securityClass *sc;
-     static struct rx_connection *serverconns[VLDB_MAXSERVERS];
-     char cellstr[64];
- 
      return ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, 
  			   secproc, "vsu_ClientInit", vsu_rxkad_level,
  			   VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 90,
--- 406,411 ----

