DWORD WINAPI AfsAdmSvr_AutoOpen_ThreadProc (PVOID lp)
{
   DWORD dwScope = PtrToUlong(lp);
   ULONG status;

   if (!l.fOperational)
      return 0;

   // First we'll have to find out which cell to open
   //
   TCHAR szCell[ cchNAME ];
   if (!CELL::GetDefaultCell (szCell, &status))
      {
      Print (dlERROR, TEXT("CELL::GetDefaultCell failed; error 0x%08lX"), status);
      }
   else
      {
      // Then try to actually open the cell
      //
      Print (dlSTANDARD, TEXT("Auto-opening cell %s; scope=%s"), szCell, (dwScope == (AFSADMSVR_SCOPE_VOLUMES | AFSADMSVR_SCOPE_USERS)) ? TEXT("full") : (dwScope == AFSADMSVR_SCOPE_VOLUMES) ? TEXT("volumes") : TEXT("users"));

      LPIDENT lpiCell;
      if ((lpiCell = CELL::OpenCell ((LPTSTR)szCell, &status)) == NULL)
         {
         Print (dlERROR, TEXT("Auto-open of cell %s failed; error 0x%08lX"), szCell, status);
         }
      else
         {
         LPCELL lpCell;
         if ((lpCell = lpiCell->OpenCell (&status)) == NULL)
            {
            Print (dlERROR, TEXT("Auto-open: OpenCell failed; error 0x%08lX"), status);
            }
         else
            {
            AfsAdmSvr_AddToMinScope (dwScope);
            if (!lpCell->RefreshAll (&status))
               Print (dlERROR, TEXT("Auto-open: RefreshCell failed; error 0x%08lX"), status);
            else
               Print (dlSTANDARD, TEXT("Auto-open of cell %s successful"), szCell);
            lpCell->Close();

            // We intentionally do not call CELL::CloseCell() here--as would
            // ordinarily be necessary to balance our CELL::OpenCell() call
            // above--because we never want to close our cache for this cell.
            // The point of calling AutoOpen() up front is to keep an admin
            // server alive and ready for use on a particular cell--calling
            // CELL::CloseCell() here negates that purpose.

            }
         }
      }

   return 0;
}
Beispiel #2
0
      // AfsAdmSvr_OpenCell
      // ...opens a cell for administration.
      //
extern "C" int AfsAdmSvr_OpenCell (UINT_PTR idClient, UINT_PTR hCreds, STRING pszCellName, DWORD dwScopeFlags, ASID *pidCell, ULONG *pStatus)
{
   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

   if (!AfsAdmSvr_fIsValidClient (idClient))
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   Print (dlDETAIL, TEXT("Client 0x%08lX: OpenCell"), idClient);

   AfsAdmSvr_AddToMinScope (dwScopeFlags);

   LPIDENT lpiCell;
   if ((lpiCell = CELL::OpenCell ((LPTSTR)pszCellName, (PVOID)hCreds, pStatus)) == NULL)
      {
      AfsAdmSvr_EndOperation (iOp);
      return FALSE;
      }

   Print (dlDETAIL, TEXT("Client 0x%08lX: OpenCell succeeded (idCell=0x%08lX)"), idClient, lpiCell);

   *pidCell = (ASID)lpiCell;
   AfsAdmSvr_EndOperation (iOp);
   return TRUE;
}