示例#1
0
BOOL AfsAppLib_CrackCredentials (UINT_PTR hCreds, LPTSTR pszCell, LPTSTR pszUser, LPSYSTEMTIME pst, ULONG *pStatus)
{
   BOOL rc = FALSE;
   ULONG status = 0;

   UINT_PTR idClient;
   if ((idClient = AfsAppLib_GetAdminServerClientID()) != 0)
      {
      rc = asc_CredentialsCrack (idClient, (PVOID) hCreds, pszCell, pszUser, pst, &status);
      }
   else 
       if (OpenClientLibrary())
      {
      char szUserA[ cchRESOURCE ], szUser2A[ cchRESOURCE ];
      char szCellA[ cchRESOURCE ];
      unsigned long dateExpire;
      int fHasKasToken;

      if (afsclient_TokenQuery ((PVOID)hCreds, &dateExpire, szUserA, szUser2A, szCellA, &fHasKasToken, (afs_status_p)&status))
         {
         rc = TRUE;
         CopyAnsiToString (pszUser, szUserA);
         CopyAnsiToString (pszCell, szCellA);
         AfsAppLib_UnixTimeToSystemTime (pst, dateExpire);
         }

      CloseClientLibrary();
      }

   if (!hCreds && pStatus)
      *pStatus = status;
   return rc;
}
示例#2
0
      // AfsAdmSvr_CrackCredentials
      // ...queries the specified AFS credentials token for its cell, user
      //    and expiration date.
      //
extern "C" int AfsAdmSvr_CrackCredentials (UINT_PTR idClient, UINT_PTR hCreds, STRING pszCell, STRING pszUser, SYSTEMTIME *pstExpiration, ULONG *pStatus)
{
   ULONG status;
   size_t iOp = AfsAdmSvr_BeginOperation (idClient);

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

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

   unsigned long dateExpirationQuery;
   int fHasKasTokenQuery;
   char szUser[ cchSTRING ];
   char szUser2[ cchSTRING ];
   char szCell[ cchSTRING ];
   char *pszCellQuery = (pszCell) ? (char *)pszCell : szCell;
   char *pszUserQuery = (pszUser) ? (char *)pszUser : szUser;
   if (!afsclient_TokenQuery ((PVOID)hCreds, &dateExpirationQuery, pszUserQuery, szUser2, pszCellQuery, &fHasKasTokenQuery, (afs_status_p)&status))
      return FALSE_(status, pStatus, iOp);

   if (pstExpiration)
      AfsAppLib_UnixTimeToSystemTime (pstExpiration, dateExpirationQuery);

   AfsAdmSvr_EndOperation (iOp);
   return TRUE;
}