void AfsAdmSvr_Action_StopRefresh (ASID idScope)
{
   AfsAdmSvr_Enter();

   for (size_t iOp = 0; iOp < l.cOperationsAllocated; ++iOp)
      {
      if (!l.aOperations[ iOp ].fInUse)
         continue;
      if (!l.aOperations[ iOp ].pAction)
         continue;
      if (l.aOperations[ iOp ].pAction->Action != ACTION_REFRESH)
         continue;
      if (l.aOperations[ iOp ].pAction->u.Refresh.idScope != idScope)
         continue;

      AfsAdmSvr_EndOperation (iOp);
      break;
      }

   if (GetAsidType (idScope) == itCELL)
      {
      AfsAdmSvr_MarkRefreshThread (idScope);
      }

   AfsAdmSvr_Leave();
}
Esempio n. 2
0
      // AfsAdmSvr_CloseCell
      // ...used by client to open a cell for administration.
      //
extern "C" int AfsAdmSvr_CloseCell (UINT_PTR idClient, ASID idCell, ULONG *pStatus)
{
   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

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

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

   if (GetAsidType (idCell) != itCELL)
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   CELL::CloseCell ((LPIDENT)idCell);

   AfsAdmSvr_EndOperation (iOp);
   return TRUE;
}
Esempio n. 3
0
      // AfsAdmSvr_PushCredentials
      // ...requests that the specified AFS credentials be used hereafter
      //    when manipulating the specified cell. You should follow this
      //    call with a Refresh request if necessary.
      //
extern "C" int AfsAdmSvr_PushCredentials (UINT_PTR idClient, UINT_PTR hCreds, ASID idCell, ULONG *pStatus)
{
   ULONG status;
   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

   Print (dlDETAIL, TEXT("Client 0x%08lX: PushCredentials (hCreds=0x%08lX, idCell=0x%08lX)"), idClient, hCreds, idCell);

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

   if (GetAsidType (idCell) != itCELL)
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   LPCELL lpCell;
   if ((lpCell = ((LPIDENT)idCell)->OpenCell (&status)) == NULL)
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   lpCell->SetCurrentCredentials ((PVOID)hCreds);
   lpCell->Close();

   AfsAdmSvr_EndOperation (iOp);
   return TRUE;
}
void AfsAdmSvr_Action_StartRefresh (ASID idScope)
{
   switch (GetAsidType (idScope))
      {
      case itCELL:
         AfsAdmSvr_MarkRefreshThread (idScope);
         // fall through

      case itSERVER:
         ASACTION Action;
         memset (&Action, 0x00, sizeof(Action));
         Action.Action = ACTION_REFRESH;
         Action.idCell = (ASID)( ((LPIDENT)idScope)->GetCell() );
         Action.u.Refresh.idScope = idScope;
         (void)AfsAdmSvr_BeginOperation (0, &Action);
         break;

      default:
         // Don't bother listing status-refreshes as ongoing operations
         // for any granularity smaller than the server; they'll occur
         // really frequently, and finish really quickly.
         break;
      }
}
Esempio n. 5
0
extern "C" int AfsAdmSvr_FindObjects (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, AFSADMSVR_SEARCH_REFRESH SearchRefresh, STRING szPattern, LPAFSADMSVR_SEARCH_PARAMS pSearchParams, LPASIDLIST *ppList, ULONG *pStatus)
{
   BOOL rc = TRUE;
   ULONG status = 0;

   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

   Print (dlDETAIL, TEXT("Client 0x%08lX: FindObjects (scope=0x%08lX, type=%lu, pat='%s')"), idClient, idSearchScope, ObjectType, szPattern);

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

   if (GetAsidType (idSearchScope) == itUNUSED)
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   // First see if we need to refresh this cell/server
   //
   if (!AfsAdmSvr_SearchRefresh (idSearchScope, ObjectType, SearchRefresh, &status))
      return FALSE_(status,pStatus,iOp);

   // Prepare an ASIDLIST, and call whatever subroutine is necessary to
   // perform the actual search.
   //
   if ((*ppList = AfsAdmSvr_CreateAsidList()) == NULL)
      return FALSE_(ERROR_NOT_ENOUGH_MEMORY,pStatus,iOp);

   LPTSTR pszPattern = (szPattern && szPattern[0]) ? (LPTSTR)szPattern : NULL;

   switch (GetAsidType (idSearchScope))
      {
      case itCELL:
         if (ObjectType == TYPE_ANY)
            rc = AfsAdmSvr_Search_AllInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_SERVER)
            rc = AfsAdmSvr_Search_ServersInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_SERVICE)
            rc = AfsAdmSvr_Search_ServicesInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_PARTITION)
            rc = AfsAdmSvr_Search_PartitionsInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_VOLUME)
            rc = AfsAdmSvr_Search_VolumesInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_USER)
            rc = AfsAdmSvr_Search_UsersInCell (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_GROUP)
            rc = AfsAdmSvr_Search_GroupsInCell (ppList, idSearchScope, pszPattern, &status);
         else
            {
            rc = FALSE;
            status = ERROR_INVALID_PARAMETER;
            }
         break;

      case itSERVER:
         if (ObjectType == TYPE_ANY)
            rc = AfsAdmSvr_Search_AllInServer (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_SERVICE)
            rc = AfsAdmSvr_Search_ServicesInServer (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_PARTITION)
            rc = AfsAdmSvr_Search_PartitionsInServer (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_VOLUME)
            rc = AfsAdmSvr_Search_VolumesInServer (ppList, idSearchScope, pszPattern, &status);
         else
            {
            rc = FALSE;
            status = ERROR_INVALID_PARAMETER;
            }
         break;

      case itAGGREGATE:
         if (ObjectType == TYPE_ANY)
            rc = AfsAdmSvr_Search_VolumesInPartition (ppList, idSearchScope, pszPattern, &status);
         else if (ObjectType == TYPE_VOLUME)
            rc = AfsAdmSvr_Search_VolumesInPartition (ppList, idSearchScope, pszPattern, &status);
         else
            {
            rc = FALSE;
            status = ERROR_INVALID_PARAMETER;
            }
         break;
      }

   if (rc && (*ppList) && (pSearchParams))
      AfsAdmSvr_Search_Advanced (ppList, pSearchParams);

   if (!rc && (*ppList))
      AfsAdmSvr_FreeAsidList (ppList);
   if (!rc && pStatus)
      *pStatus = status;

   if (!rc)
      Print (dlERROR, TEXT("Client 0x%08lX: FindObjects failed (status=0x%08lX)"), idClient, status);
   else // (rc)
      Print (dlDETAIL, TEXT("Client 0x%08lX: FindObjects succeeded; returning %lu item(s)"), idClient, (*ppList)->cEntries);

   AfsAdmSvr_EndOperation (iOp);
   return rc;
}
Esempio n. 6
0
      // AfsAdmSvr_FindObject
      // AfsAdmSvr_FindObjects
      // ...used to search through all objects in the cell, obtaining a list
      //    of those which match the specified criteria. For FindObjects, the
      //    {*ppList} parameter will be filled in with an allocated list of
      //    ASIDs, and should be freed using the AfsAdmSvr_FreeAsidList()
      //    routine (clients using the TaAfsAdmSvrClient.lib library should
      //    call asc_AsidListFree(), which is a wrapper for that routine).
      //    The _FindObject routine can be used to find exactly one object--
      //    for instance, finding the ASID for a particular user or volume--
      //    while the _FindObjects routine returns a list of all objects
      //    which match the specified criteria--all volumes on a partition,
      //    or all users named "b*" within a cell.
      //
extern "C" int AfsAdmSvr_FindObject (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, AFSADMSVR_SEARCH_REFRESH SearchRefresh, STRING szName, ASID *pidObject, ULONG *pStatus)
{
   BOOL rc = TRUE;
   ULONG status = 0;

   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

   Print (dlDETAIL, TEXT("Client 0x%08lX: FindObject (scope=0x%08lX, type=%lu, name='%s')"), idClient, idSearchScope, ObjectType, szName);

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

   if (GetAsidType (idSearchScope) == itUNUSED)
      return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);

   // We've got a special case here: if possible, we don't want to have to
   // refresh the contents of the entire cell. So if the client is looking
   // for a user or group, we can just try to grab that object by its name;
   // afsclass supports an interface for just this case.
   //
   switch (ObjectType)
      {
      case TYPE_USER:
         rc = AfsAdmSvr_Search_OneUser (pidObject, idSearchScope, szName, &status);
         break;

      case TYPE_GROUP:
         rc = AfsAdmSvr_Search_OneGroup (pidObject, idSearchScope, szName, &status);
         break;

      default:
         // We'll have to do the search the hard way. First
         // see if we need to refresh this cell/server.
         //
         if (!AfsAdmSvr_SearchRefresh (idSearchScope, ObjectType, SearchRefresh, &status))
            return FALSE_(status,pStatus,iOp);

         // Look for the specified object.
         //
         switch (GetAsidType (idSearchScope))
            {
            case itCELL:
               if (ObjectType == TYPE_SERVER)
                  rc = AfsAdmSvr_Search_ServerInCell (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_SERVICE)
                  rc = AfsAdmSvr_Search_ServiceInCell (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_PARTITION)
                  rc = AfsAdmSvr_Search_PartitionInCell (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_VOLUME)
                  rc = AfsAdmSvr_Search_VolumeInCell (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_USER)
                  rc = AfsAdmSvr_Search_UserInCell (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_GROUP)
                  rc = AfsAdmSvr_Search_GroupInCell (pidObject, idSearchScope, szName, &status);
               else
                  {
                  rc = FALSE;
                  status = ERROR_INVALID_PARAMETER;
                  }
               break;

            case itSERVER:
               if (ObjectType == TYPE_SERVICE)
                  rc = AfsAdmSvr_Search_ServiceInServer (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_PARTITION)
                  rc = AfsAdmSvr_Search_PartitionInServer (pidObject, idSearchScope, szName, &status);
               else if (ObjectType == TYPE_VOLUME)
                  rc = AfsAdmSvr_Search_VolumeInServer (pidObject, idSearchScope, szName, &status);
               else
                  {
                  rc = FALSE;
                  status = ERROR_INVALID_PARAMETER;
                  }
               break;

            case itAGGREGATE:
               if (ObjectType == TYPE_VOLUME)
                  rc = AfsAdmSvr_Search_VolumeInPartition (pidObject, idSearchScope, szName, &status);
               else
                  {
                  rc = FALSE;
                  status = ERROR_INVALID_PARAMETER;
                  }
               break;
            }
         break;
      }

   if (!rc && pStatus)
      *pStatus = status;

   if (!rc)
      Print (dlERROR, TEXT("Client 0x%08lX: FindObject failed (status=0x%08lX)"), idClient, status);
   else // (rc)
      Print (dlDETAIL, TEXT("Client 0x%08lX: FindObject succeeded; returning idObject=0x%08lX"), idClient, *pidObject);

   AfsAdmSvr_EndOperation (iOp);
   return rc;
}