PVOID SERVER::OpenVosObject (PVOID *phCell, ULONG *pStatus) { if (!m_hCellVOS) { LPCELL lpCell; if ((lpCell = m_lpiCell->OpenCell (pStatus)) != NULL) { m_hCellVOS = lpCell->GetCellObject (pStatus); lpCell->Close(); } } if (m_hCellVOS && !m_hVOS) { TCHAR szCell[ cchNAME ]; m_lpiCell->GetCellName (szCell); WORKERPACKET wp; wp.wpVosServerOpen.hCell = m_hCellVOS; wp.wpVosServerOpen.pszServer = m_szName; if (Worker_DoTask (wtaskVosServerOpen, &wp, pStatus)) m_hVOS = wp.wpVosServerOpen.hServer; } if (m_hVOS) { if (phCell) *phCell = m_hCellVOS; ++m_cReqVOS; } return m_hVOS; }
BOOL SERVER::RefreshStatus (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fStatusOutOfDate) { m_fStatusOutOfDate = FALSE; if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); LPCELL lpCell; if ((lpCell = OpenCell (&status)) == NULL) rc = FALSE; else { PVOID hCell; if ((hCell = lpCell->GetCellObject (&status)) == NULL) rc = FALSE; else { WORKERPACKET wp; wp.wpClientAFSServerGet.hCell = hCell; wp.wpClientAFSServerGet.pszServer = m_szName; if (!Worker_DoTask (wtaskClientAFSServerGet, &wp, &status)) rc = FALSE; else { m_ss.nAddresses = 0; for (size_t iAddr = 0; iAddr < AFS_MAX_SERVER_ADDRESS; ++iAddr) { if (wp.wpClientAFSServerGet.Entry.serverAddress[ iAddr ] == 0) continue; AfsClass_IntToAddress (&m_ss.aAddresses[ m_ss.nAddresses++ ], wp.wpClientAFSServerGet.Entry.serverAddress[ iAddr ]); } lpCell->m_lServers->Update (this); // That update affected a hashlistkey } } lpCell->Close(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status)); } if (pStatus && !rc) *pStatus = status; return TRUE; }
BOOL SERVER::CloseVosObject (ULONG *pStatus) { BOOL rc = TRUE; if ((m_cReqVOS > 0) && ((--m_cReqVOS) == 0)) { if (m_hVOS != NULL) { WORKERPACKET wp; wp.wpVosServerClose.hServer = m_hVOS; if (!Worker_DoTask (wtaskVosServerClose, &wp, pStatus)) rc = FALSE; } m_hVOS = NULL; m_hCellVOS = NULL; } return rc; }
BOOL SERVER::CloseBosObject (ULONG *pStatus) { BOOL rc = TRUE; if ((m_cReqBOS > 0) && ((--m_cReqBOS) == 0)) { if (m_hBOS != NULL) { WORKERPACKET wp; wp.wpBosServerClose.hServer = m_hBOS; if (!Worker_DoTask (wtaskBosServerClose, &wp, pStatus)) rc = FALSE; m_hBOS = NULL; } if (m_lpCellBOS != NULL) { m_lpCellBOS->Close(); m_lpCellBOS = NULL; } } return rc; }
BOOL FILESET::RefreshStatus (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fStatusOutOfDate && (m_wGhost & GHOST_HAS_SERVER_ENTRY)) { m_fStatusOutOfDate = FALSE; if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); LPSERVER lpServer; if ((lpServer = OpenServer (&status)) == NULL) rc = FALSE; else { PVOID hCell; PVOID hVOS; if ((hVOS = lpServer->OpenVosObject (&hCell, &status)) == NULL) rc = FALSE; else { WORKERPACKET wp; wp.wpVosVolumeGet.hCell = hCell; wp.wpVosVolumeGet.hServer = hVOS; wp.wpVosVolumeGet.idPartition = NO_PARTITION; wp.wpVosVolumeGet.idVolume = m_idVolume; LPAGGREGATE lpAggregate; if ((lpAggregate = m_lpiAggregate->OpenAggregate()) != NULL) { wp.wpVosVolumeGet.idPartition = lpAggregate->GetID(); lpAggregate->Close(); } if (!Worker_DoTask (wtaskVosVolumeGet, &wp, &status)) rc = FALSE; else { SetStatusFromVOS (&wp.wpVosVolumeGet.Data); if ((lpAggregate = m_lpiAggregate->OpenAggregate()) != NULL) { lpAggregate->InvalidateAllocation(); lpAggregate->Close(); } } lpServer->CloseVosObject(); } lpServer->Close(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status)); } if (pStatus && !rc) *pStatus = status; return TRUE; }
DWORD WINAPI SERVER::CanTalkToServer_ThreadProc (PVOID lp) { int idSection = PtrToInt(lp); // Until we post a notification saying that we've entered // a section, we don't need to worry about the aRefSec[] entry // being invalid. Once that post is made, the user can skip // the section at any time--so we'll have to check frequently, // always under the pcsRefSec critical section. // NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllSectionStart, NULL, NULL, NULL, NULL, idSection, 0); BOOL fAggregatesOK = FALSE; BOOL fServicesOK = FALSE; BOOL fContinue = TRUE; // Try to get the BOS object for this server. Remember, there's // a catch here: we can only assume that the aRefSec[idSection].lpServer // pointer is valid so long as we're within the pcsRefSec critical // section! (if we're in that critsec, we can verify that no one // has canceled the operation--and if no one has, there is a thread // hanging around which holds the library's critsec, which ensures // the lpServer pointer won't have been freed.) // PVOID hCell; PVOID hBOS = NULL; PVOID hVOS = NULL; TCHAR szServer[ cchNAME ]; EnterCriticalSection (pcsRefSec); if ( ((!aRefSec[ idSection ].fInUse) || (aRefSec[ idSection ].fCanceled)) ) fContinue = FALSE; else { hCell = aRefSec[ idSection ].hCell; aRefSec[ idSection ].lpServer->GetLongName (szServer); } LeaveCriticalSection (pcsRefSec); if (fContinue) { WORKERPACKET wp; wp.wpBosServerOpen.hCell = hCell; wp.wpBosServerOpen.pszServer = szServer; ULONG status; fContinue = Worker_DoTask (wtaskBosServerOpen, &wp, &status); EnterCriticalSection (pcsRefSec); if ( ((!aRefSec[ idSection ].fInUse) || (aRefSec[ idSection ].fCanceled)) ) fContinue = FALSE; else if (!fContinue) aRefSec[ idSection ].lpServer->m_lastStatus = status; else hBOS = wp.wpBosServerOpen.hServer; LeaveCriticalSection (pcsRefSec); } if (fContinue) { WORKERPACKET wpBegin; wpBegin.wpBosProcessNameGetBegin.hServer = hBOS; ULONG status; fContinue = Worker_DoTask (wtaskBosProcessNameGetBegin, &wpBegin, &status); EnterCriticalSection (pcsRefSec); if ( ((!aRefSec[ idSection ].fInUse) || (aRefSec[ idSection ].fCanceled)) ) fContinue = FALSE; else if (fContinue) aRefSec[ idSection ].lpServer->m_lastStatus = status; LeaveCriticalSection (pcsRefSec); if (fContinue) { WORKERPACKET wpDone; wpDone.wpBosProcessNameGetDone.hEnum = wpBegin.wpBosProcessNameGetBegin.hEnum; Worker_DoTask (wtaskBosProcessNameGetDone, &wpDone); // We can talk to BOS! fServicesOK = TRUE; } } // If we couldn't talk to BOS, it's a sure bet the server is down-- // and regardless, if BOS isn't around, VOS isn't either. So // we may not even have to test that. // if (fContinue) { WORKERPACKET wp; wp.wpVosServerOpen.hCell = hCell; wp.wpVosServerOpen.pszServer = szServer; ULONG status; fContinue = Worker_DoTask (wtaskVosServerOpen, &wp, &status); EnterCriticalSection (pcsRefSec); if ( ((!aRefSec[ idSection ].fInUse) || (aRefSec[ idSection ].fCanceled)) ) fContinue = FALSE; else if (!fContinue) aRefSec[ idSection ].lpServer->m_lastStatus = status; else hVOS = wp.wpVosServerOpen.hServer; LeaveCriticalSection (pcsRefSec); } if (fContinue) { WORKERPACKET wpBegin; wpBegin.wpVosPartitionGetBegin.hCell = hCell; wpBegin.wpVosPartitionGetBegin.hServer = hVOS; ULONG status; fContinue = Worker_DoTask (wtaskVosPartitionGetBegin, &wpBegin, &status); EnterCriticalSection (pcsRefSec); if ( ((!aRefSec[ idSection ].fInUse) || (aRefSec[ idSection ].fCanceled)) ) fContinue = FALSE; else if (fContinue) aRefSec[ idSection ].lpServer->m_lastStatus = status; LeaveCriticalSection (pcsRefSec); if (fContinue) { WORKERPACKET wpDone; wpDone.wpVosPartitionGetDone.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum; Worker_DoTask (wtaskVosPartitionGetDone, &wpDone); // We can talk to VOS! fAggregatesOK = TRUE; } } // Close the VOS and BOS objects we obtained. // if (hBOS) { WORKERPACKET wp; wp.wpBosServerClose.hServer = hBOS; Worker_DoTask (wtaskBosServerClose, &wp); } if (hVOS) { WORKERPACKET wp; wp.wpVosServerClose.hServer = hVOS; Worker_DoTask (wtaskVosServerClose, &wp); } // Return our entry in the RefSec array back to the pool. // If the request was never canceled, there is another // thread waiting to hear our results--update the server // entry specified by RefSec before leaving. // NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAllSectionEnd, NULL, NULL, NULL, NULL, idSection, 0); EnterCriticalSection (pcsRefSec); if ( (aRefSec[ idSection ].fInUse) && (!aRefSec[ idSection ].fCanceled) ) { aRefSec[ idSection ].lpServer->m_fCanGetAggregates = fAggregatesOK; aRefSec[ idSection ].lpServer->m_fCanGetServices = fServicesOK; } aRefSec[ idSection ].fInUse = FALSE; LeaveCriticalSection (pcsRefSec); return 1; }
BOOL SERVER::RefreshServices (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fServicesOutOfDate) { m_fServicesOutOfDate = FALSE; if (fIsMonitored()) { if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshServicesBegin, GetIdentifier()); // First thing is to forget about what services we think we have now. // LPENUM pEnum; for (pEnum = m_lServices->FindLast(); pEnum; pEnum = pEnum->FindPrevious()) { LPSERVICE lpService = (LPSERVICE)(pEnum->GetObject()); lpService->SendDeleteNotifications(); m_lServices->Remove (lpService); Delete (lpService); } // Next, the harder part: look through the server to find a list // of services. // PVOID hCell; PVOID hBOS; if ((hBOS = OpenBosObject (&hCell, &status)) == NULL) rc = FALSE; else { WORKERPACKET wpBegin; wpBegin.wpBosProcessNameGetBegin.hServer = hBOS; if (!Worker_DoTask (wtaskBosProcessNameGetBegin, &wpBegin, &status)) rc = FALSE; else { LPSERVICE lpService = New2 (SERVICE,(this, TEXT("BOS"))); m_lServices->Add (lpService); NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpService->GetIdentifier()); for (;;) { TCHAR szServiceName[ cchNAME ]; WORKERPACKET wpNext; wpNext.wpBosProcessNameGetNext.hEnum = wpBegin.wpBosProcessNameGetBegin.hEnum; wpNext.wpBosProcessNameGetNext.pszService = szServiceName; if (!Worker_DoTask (wtaskBosProcessNameGetNext, &wpNext, &status)) { if (status == ADMITERATORDONE) status = 0; else rc = FALSE; break; } lpService = New2 (SERVICE,(this, wpNext.wpBosProcessNameGetNext.pszService)); m_lServices->Add (lpService); NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpService->GetIdentifier()); } WORKERPACKET wpDone; wpDone.wpBosProcessNameGetDone.hEnum = wpBegin.wpBosProcessNameGetBegin.hEnum; Worker_DoTask (wtaskBosProcessNameGetDone, &wpDone); } CloseBosObject(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshServicesEnd, GetIdentifier(), ((rc) ? 0 : status)); } } if (pStatus && !rc) *pStatus = status; return TRUE; }
BOOL SERVER::RefreshAggregates (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fAggregatesOutOfDate) { m_fAggregatesOutOfDate = FALSE; if (fIsMonitored()) { if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesBegin, GetIdentifier()); // First thing is to forget about what aggregates we think we have // now. // LPENUM pEnum; for (pEnum = m_lAggregates->FindLast(); pEnum; pEnum = pEnum->FindPrevious()) { LPAGGREGATE lpAggregate = (LPAGGREGATE)(pEnum->GetObject()); lpAggregate->SendDeleteNotifications(); m_lAggregates->Remove (lpAggregate); Delete (lpAggregate); } // Next, the harder part: look through the server to find a list // of aggregates. // PVOID hCell; PVOID hVOS; if ((hVOS = OpenVosObject (&hCell, &status)) == NULL) rc = FALSE; else { WORKERPACKET wpBegin; wpBegin.wpVosPartitionGetBegin.hCell = hCell; wpBegin.wpVosPartitionGetBegin.hServer = hVOS; if (!Worker_DoTask (wtaskVosPartitionGetBegin, &wpBegin, &status)) rc = FALSE; else { for (;;) { WORKERPACKET wpNext; wpNext.wpVosPartitionGetNext.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum; if (!Worker_DoTask (wtaskVosPartitionGetNext, &wpNext, &status)) { if (status == ADMITERATORDONE) status = 0; else rc = FALSE; break; } vos_partitionEntry_p pData = &wpNext.wpVosPartitionGetNext.Data; LPTSTR pszName = AnsiToString (pData->name); LPTSTR pszDevice = AnsiToString (pData->deviceName); LPAGGREGATE lpAggregate = New2 (AGGREGATE,(this, pszName, pszDevice)); lpAggregate->m_as.dwID = lpAggregate->GetID(); FreeString (pszDevice, pData->deviceName); FreeString (pszName, pData->name); lpAggregate->m_wGhost |= GHOST_HAS_SERVER_ENTRY; lpAggregate->m_as.ckStorageTotal = pData->totalSpace; lpAggregate->m_as.ckStorageFree = pData->totalFreeSpace; m_lAggregates->Add (lpAggregate); NOTIFYCALLBACK::SendNotificationToAll (evtCreate, lpAggregate->GetIdentifier()); } WORKERPACKET wpDone; wpDone.wpVosPartitionGetDone.hEnum = wpBegin.wpVosPartitionGetBegin.hEnum; Worker_DoTask (wtaskVosPartitionGetDone, &wpDone); } CloseVosObject(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshAggregatesEnd, GetIdentifier(), ((rc) ? 0 : status)); } } if (pStatus && !rc) *pStatus = status; return TRUE; }
BOOL SERVICE::RefreshStatus (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fStatusOutOfDate) { m_fStatusOutOfDate = FALSE; if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); LPSERVER lpServer; if ((lpServer = OpenServer (&status)) == NULL) rc = FALSE; else { PVOID hCell; PVOID hBOS; if ((hBOS = lpServer->OpenBosObject (&hCell, &status)) == NULL) rc = FALSE; else { SERVICESTATUS ss; if (!lstrcmp (m_szName, TEXT("BOS"))) { memset (&ss, 0x00, sizeof(SERVICESTATUS)); AfsClass_UnixTimeToSystemTime (&ss.timeLastStart, 0); AfsClass_UnixTimeToSystemTime (&ss.timeLastStop, 0); AfsClass_UnixTimeToSystemTime (&ss.timeLastFail, 0); ss.nStarts = 1; ss.dwErrLast = 0; ss.dwSigLast = 0; ss.type = SERVICETYPE_SIMPLE; ss.state = SERVICESTATE_RUNNING; } else { WORKERPACKET wp; wp.wpBosProcessInfoGet.hServer = hBOS; wp.wpBosProcessInfoGet.pszService = m_szName; if (!Worker_DoTask (wtaskBosProcessInfoGet, &wp, &status)) rc = FALSE; else { memcpy (&ss, &wp.wpBosProcessInfoGet.ss, sizeof(SERVICESTATUS)); // Get the service's current state // wp.wpBosProcessExecutionStateGet.hServer = hBOS; wp.wpBosProcessExecutionStateGet.pszService = m_szName; wp.wpBosProcessExecutionStateGet.pszAuxStatus = ss.szAuxStatus; if (!Worker_DoTask (wtaskBosProcessExecutionStateGet, &wp, &status)) ss.state = SERVICESTATE_STOPPED; else ss.state = wp.wpBosProcessExecutionStateGet.state; // Get the service's notifier // ss.szNotifier[0] = TEXT('\0'); wp.wpBosProcessNotifierGet.hServer = hBOS; wp.wpBosProcessNotifierGet.pszService = m_szName; wp.wpBosProcessNotifierGet.pszNotifier = ss.szNotifier;; Worker_DoTask (wtaskBosProcessNotifierGet, &wp, &status); // Get the service's parameters // ss.szParams[0] = TEXT('\0'); WORKERPACKET wpBegin; wpBegin.wpBosProcessParameterGetBegin.hServer = hBOS; wpBegin.wpBosProcessParameterGetBegin.pszService = m_szName; if (Worker_DoTask (wtaskBosProcessParameterGetBegin, &wpBegin, &status)) { for (;;) { TCHAR szParam[ 256 ]; WORKERPACKET wpNext; wpNext.wpBosProcessParameterGetNext.hEnum = wpBegin.wpBosProcessParameterGetBegin.hEnum; wpNext.wpBosProcessParameterGetNext.pszParam = szParam; if (!Worker_DoTask (wtaskBosProcessParameterGetNext, &wpNext, &status)) { if (status == ADMITERATORDONE) status = 0; else rc = FALSE; break; } if (ss.szParams[0] != TEXT('\0')) lstrcat (ss.szParams, TEXT(" ")); lstrcat (ss.szParams, szParam); } WORKERPACKET wpDone; wpDone.wpBosProcessParameterGetDone.hEnum = wpBegin.wpBosProcessParameterGetBegin.hEnum; Worker_DoTask (wtaskBosProcessParameterGetDone, &wpDone); } // Strip trailing CR/LF characters // size_t cch = lstrlen (ss.szAuxStatus); while (cch && (ss.szAuxStatus[ cch-1 ] == TEXT('\r') || ss.szAuxStatus[ cch-1 ] == TEXT('\n'))) ss.szAuxStatus[ cch-- ] = TEXT('\0'); cch = lstrlen (ss.szParams); while (cch && (ss.szParams[ cch-1 ] == TEXT('\r') || ss.szParams[ cch-1 ] == TEXT('\n'))) ss.szParams[ cch-- ] = TEXT('\0'); cch = lstrlen (ss.szNotifier); while (cch && (ss.szNotifier[ cch-1 ] == TEXT('\r') || ss.szNotifier[ cch-1 ] == TEXT('\n'))) ss.szNotifier[ cch-- ] = TEXT('\0'); } } if (rc) { memcpy (&m_ss, &ss, sizeof(SERVICESTATUS)); } lpServer->CloseBosObject(); } lpServer->Close(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status)); } if (pStatus && !rc) *pStatus = status; return TRUE; }
BOOL USER::RefreshStatus (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; DWORD kasStatus = 0; DWORD ptsStatus = 0; if (m_fStatusOutOfDate) { m_fStatusOutOfDate = FALSE; if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); memset (&m_us, 0x00, sizeof(m_us)); FreeString (m_mszOwnerOf); m_mszOwnerOf = NULL; FreeString (m_mszMemberOf); m_mszMemberOf = NULL; TCHAR szFullName[ cchNAME ]; AfsClass_GenFullUserName (szFullName, m_szPrincipal, m_szInstance); LPCELL lpCell; if ((lpCell = OpenCell (&status)) == NULL) rc = FALSE; else { PVOID hCell; if ((hCell = lpCell->GetCellObject (&status)) == NULL) rc = FALSE; else { // Try to get KAS information. // WORKERPACKET wpGetKas; wpGetKas.wpKasPrincipalGet.hCell = hCell; wpGetKas.wpKasPrincipalGet.hServer = lpCell->GetKasObject (&kasStatus); wpGetKas.wpKasPrincipalGet.pszPrincipal = m_szPrincipal; wpGetKas.wpKasPrincipalGet.pszInstance = m_szInstance; if (Worker_DoTask (wtaskKasPrincipalGet, &wpGetKas, &kasStatus)) { m_us.fHaveKasInfo = TRUE; TCHAR szLastModPrincipal[ cchNAME ]; TCHAR szLastModInstance[ cchNAME ]; CopyAnsiToString (szLastModPrincipal, wpGetKas.wpKasPrincipalGet.Data.lastModPrincipal.principal); CopyAnsiToString (szLastModInstance, wpGetKas.wpKasPrincipalGet.Data.lastModPrincipal.instance); m_us.KASINFO.fIsAdmin = (wpGetKas.wpKasPrincipalGet.Data.adminSetting == KAS_ADMIN) ? TRUE : FALSE; m_us.KASINFO.fCanGetTickets = (wpGetKas.wpKasPrincipalGet.Data.tgsSetting == TGS) ? TRUE : FALSE; m_us.KASINFO.fEncrypt = (wpGetKas.wpKasPrincipalGet.Data.encSetting == ENCRYPT) ? TRUE : FALSE; m_us.KASINFO.fCanChangePassword = (wpGetKas.wpKasPrincipalGet.Data.cpwSetting == CHANGE_PASSWORD) ? TRUE : FALSE; m_us.KASINFO.fCanReusePasswords = (wpGetKas.wpKasPrincipalGet.Data.rpwSetting == REUSE_PASSWORD) ? TRUE : FALSE; AfsClass_UnixTimeToSystemTime (&m_us.KASINFO.timeExpires, wpGetKas.wpKasPrincipalGet.Data.userExpiration); AfsClass_UnixTimeToSystemTime (&m_us.KASINFO.timeLastPwChange, wpGetKas.wpKasPrincipalGet.Data.lastChangePasswordTime); AfsClass_UnixTimeToSystemTime (&m_us.KASINFO.timeLastMod, wpGetKas.wpKasPrincipalGet.Data.lastModTime); m_us.KASINFO.lpiLastMod = IDENT::FindUser (m_lpiCell, szLastModPrincipal, szLastModInstance); m_us.KASINFO.csecTicketLifetime = wpGetKas.wpKasPrincipalGet.Data.maxTicketLifetime; m_us.KASINFO.keyVersion = wpGetKas.wpKasPrincipalGet.Data.keyVersion; memcpy (&m_us.KASINFO.key.key, &wpGetKas.wpKasPrincipalGet.Data.key.key, ENCRYPTIONKEY_LEN); m_us.KASINFO.dwKeyChecksum = wpGetKas.wpKasPrincipalGet.Data.keyCheckSum; m_us.KASINFO.cdayPwExpire = wpGetKas.wpKasPrincipalGet.Data.daysToPasswordExpire; m_us.KASINFO.cFailLogin = wpGetKas.wpKasPrincipalGet.Data.failLoginCount; m_us.KASINFO.csecFailLoginLock = wpGetKas.wpKasPrincipalGet.Data.lockTime; } // Try to get PTS information. // WORKERPACKET wpGetPts; wpGetPts.wpPtsUserGet.hCell = hCell; wpGetPts.wpPtsUserGet.pszUser = szFullName; if (Worker_DoTask (wtaskPtsUserGet, &wpGetPts, &ptsStatus)) { m_us.fHavePtsInfo = TRUE; m_us.PTSINFO.cgroupCreationQuota = wpGetPts.wpPtsUserGet.Entry.groupCreationQuota; m_us.PTSINFO.cgroupMember = wpGetPts.wpPtsUserGet.Entry.groupMembershipCount; m_us.PTSINFO.uidName = wpGetPts.wpPtsUserGet.Entry.nameUid; m_us.PTSINFO.uidOwner = wpGetPts.wpPtsUserGet.Entry.ownerUid; m_us.PTSINFO.uidCreator = wpGetPts.wpPtsUserGet.Entry.creatorUid; CopyAnsiToString (m_us.PTSINFO.szOwner, wpGetPts.wpPtsUserGet.Entry.owner); CopyAnsiToString (m_us.PTSINFO.szCreator, wpGetPts.wpPtsUserGet.Entry.creator); m_us.PTSINFO.aaListStatus = USERACCESS_TO_ACCOUNTACCESS (wpGetPts.wpPtsUserGet.Entry.listStatus); m_us.PTSINFO.aaGroupsOwned = USERACCESS_TO_ACCOUNTACCESS (wpGetPts.wpPtsUserGet.Entry.listGroupsOwned); m_us.PTSINFO.aaMembership = USERACCESS_TO_ACCOUNTACCESS (wpGetPts.wpPtsUserGet.Entry.listMembership); } // Grab the list of groups to which this user belongs // WORKERPACKET wpBegin; wpBegin.wpPtsUserMemberListBegin.hCell = hCell; wpBegin.wpPtsUserMemberListBegin.pszUser = szFullName; if (Worker_DoTask (wtaskPtsUserMemberListBegin, &wpBegin, &status)) { for (;;) { TCHAR szGroup[ cchNAME ]; WORKERPACKET wpNext; wpNext.wpPtsUserMemberListNext.hEnum = wpBegin.wpPtsUserMemberListBegin.hEnum; wpNext.wpPtsUserMemberListNext.pszGroup = szGroup; if (!Worker_DoTask (wtaskPtsUserMemberListNext, &wpNext)) break; FormatMultiString (&m_mszMemberOf, FALSE, TEXT("%1"), TEXT("%s"), szGroup); } WORKERPACKET wpDone; wpDone.wpPtsUserMemberListDone.hEnum = wpBegin.wpPtsUserMemberListBegin.hEnum; Worker_DoTask (wtaskPtsUserMemberListDone, &wpDone); } // Grab the list of groups which this user owns // wpBegin.wpPtsOwnedGroupListBegin.hCell = hCell; wpBegin.wpPtsOwnedGroupListBegin.pszOwner = szFullName; if (Worker_DoTask (wtaskPtsOwnedGroupListBegin, &wpBegin, &status)) { for (;;) { TCHAR szGroup[ cchNAME ]; WORKERPACKET wpNext; wpNext.wpPtsOwnedGroupListNext.hEnum = wpBegin.wpPtsOwnedGroupListBegin.hEnum; wpNext.wpPtsOwnedGroupListNext.pszGroup = szGroup; if (!Worker_DoTask (wtaskPtsOwnedGroupListNext, &wpNext)) break; FormatMultiString (&m_mszOwnerOf, FALSE, TEXT("%1"), TEXT("%s"), szGroup); } WORKERPACKET wpDone; wpDone.wpPtsOwnedGroupListDone.hEnum = wpBegin.wpPtsOwnedGroupListBegin.hEnum; Worker_DoTask (wtaskPtsOwnedGroupListDone, &wpDone); } } lpCell->Close(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status)); } if (rc && (!m_us.fHaveKasInfo) && (!status) && kasStatus) { status = kasStatus; rc = FALSE; } if (rc && (!m_us.fHavePtsInfo) && (!status) && ptsStatus) { status = ptsStatus; // not fatal; rc remains TRUE } if (pStatus && !rc) *pStatus = status; return TRUE; }