2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
13 #include <afsconfig.h>
14 #include <afs/param.h>
18 #include "TaAfsAdmSvrInternal.h"
22 * ROUTINES ___________________________________________________________________
27 // ...obtains a cookie to represent the calling process. The cookie should
28 // be freed with AfsAdmSvr_Disconnect when the process disconnects.
30 extern "C" int AfsAdmSvr_Connect (STRING szClientAddress, UINT_PTR *pidClient, ULONG *pStatus)
32 // Make sure AfsClass initialized properly. If it's already init'd,
33 // this won't hurt at all.
36 if (!AfsClass_Initialize (&status))
38 Print (TEXT("Denying client %s due to AfsClass initialization failure"), szClientAddress);
39 return FALSE_(status, pStatus);
42 // Find a free CLIENTINFO structure for this caller
44 if (!AfsAdmSvr_AttachClient (szClientAddress, (PVOID *)pidClient, pStatus))
47 Print (TEXT("Connected to client %s (ID 0x%08lX)"), AfsAdmSvr_GetClientName (*pidClient), *pidClient);
54 // ...reminds the admin server that the specified client is still around.
55 // this call should be made at least every csecAFSADMSVR_CLIENT_PING
56 // seconds, lest the admin server think you've disconnected. (The
57 // client library TaAfsAdmSvrClient.lib automatically handles this.)
59 extern "C" int AfsAdmSvr_Ping (UINT_PTR idClient, ULONG *pStatus)
63 if (!AfsAdmSvr_fIsValidClient (idClient))
64 return Leave_FALSE_(ERROR_INVALID_PARAMETER, pStatus);
66 AfsAdmSvr_PingClient (idClient);
72 // AfsAdmSvr_Disconnect
73 // ...releases and invalidates the cookie representing the calling process.
75 extern "C" int AfsAdmSvr_Disconnect (UINT_PTR idClient, ULONG *pStatus)
79 // Make sure this is a valid client, and free its l.aClients[] entry if so.
81 if (!AfsAdmSvr_fIsValidClient (idClient))
82 return Leave_FALSE_(ERROR_INVALID_PARAMETER, pStatus);
84 Print (TEXT("Disconnected from client %s (ID 0x%08lX)"), AfsAdmSvr_GetClientName (idClient), idClient);
86 AfsAdmSvr_DetachClient (idClient);
92 // AfsAdmSvr_CrackCredentials
93 // ...queries the specified AFS credentials token for its cell, user
94 // and expiration date.
96 extern "C" int AfsAdmSvr_CrackCredentials (UINT_PTR idClient, UINT_PTR hCreds, STRING pszCell, STRING pszUser, SYSTEMTIME *pstExpiration, ULONG *pStatus)
99 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
101 if (!AfsAdmSvr_fIsValidClient (idClient))
102 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
104 Print (dlDETAIL, TEXT("Client 0x%08lX: CrackCredentials (0x%08lX)"), idClient, hCreds);
106 unsigned long dateExpirationQuery;
107 int fHasKasTokenQuery;
108 char szUser[ cchSTRING ];
109 char szUser2[ cchSTRING ];
110 char szCell[ cchSTRING ];
111 char *pszCellQuery = (pszCell) ? (char *)pszCell : szCell;
112 char *pszUserQuery = (pszUser) ? (char *)pszUser : szUser;
113 if (!afsclient_TokenQuery ((PVOID)hCreds, &dateExpirationQuery, pszUserQuery, szUser2, pszCellQuery, &fHasKasTokenQuery, (afs_status_p)&status))
114 return FALSE_(status, pStatus, iOp);
117 AfsAppLib_UnixTimeToSystemTime (pstExpiration, dateExpirationQuery);
119 AfsAdmSvr_EndOperation (iOp);
124 // AfsAdmSvr_GetCredentials
125 // ...queries the user's current AFS credentials for the specified cell
126 // if the user already has credentials in the cell, returns a nonzero
127 // token {hCreds}, suitable for use in AfsAdmSvr_OpenCell().
129 extern "C" UINT_PTR AfsAdmSvr_GetCredentials (UINT_PTR idClient, STRING pszCell, ULONG *pStatus)
132 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
134 if (!AfsAdmSvr_fIsValidClient (idClient))
135 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
137 Print (dlDETAIL, TEXT("Client 0x%08lX: GetCredentials (%s)"), idClient, pszCell);
139 const char *pszCellTest = (pszCell && *pszCell) ? (const char *)pszCell : NULL;
141 UINT_PTR hCreds = NULL;
142 if (!afsclient_TokenGetExisting (pszCellTest, (PVOID *)&hCreds, (afs_status_p)&status))
143 return FALSE_(status, pStatus, iOp);
145 AfsAdmSvr_EndOperation (iOp);
150 // AfsAdmSvr_SetCredentials
151 // ...obtains new AFS credentials within the administrative server process
152 // on behalf of the specified user. if successful, returns a nonzero
153 // token {hCreds}, suitable for use in AfsAdmSvr_OpenCell().
155 extern "C" UINT_PTR AfsAdmSvr_SetCredentials (UINT_PTR idClient, STRING pszCell, STRING pszUser, STRING pszPassword, ULONG *pStatus)
158 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
160 Print (dlDETAIL, TEXT("Client 0x%08lX: SetCredentials (%s,%s)"), idClient, pszCell, pszUser);
162 if (!AfsAdmSvr_fIsValidClient (idClient))
163 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
165 const char *pszCellSet = (pszCell && *pszCell) ? (const char *)pszCell : NULL;
168 if (!afsclient_TokenGetNew (pszCellSet, (const char *)pszUser, (const char *)pszPassword, (PVOID *)&hCreds, (afs_status_p)&status))
169 return FALSE_(status,pStatus,iOp);
171 AfsAdmSvr_EndOperation (iOp);
176 // AfsAdmSvr_PushCredentials
177 // ...requests that the specified AFS credentials be used hereafter
178 // when manipulating the specified cell. You should follow this
179 // call with a Refresh request if necessary.
181 extern "C" int AfsAdmSvr_PushCredentials (UINT_PTR idClient, UINT_PTR hCreds, ASID idCell, ULONG *pStatus)
184 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
186 Print (dlDETAIL, TEXT("Client 0x%08lX: PushCredentials (hCreds=0x%08lX, idCell=0x%08lX)"), idClient, hCreds, idCell);
188 if (!AfsAdmSvr_fIsValidClient (idClient))
189 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
191 if (GetAsidType (idCell) != itCELL)
192 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
195 if ((lpCell = ((LPIDENT)idCell)->OpenCell (&status)) == NULL)
196 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
198 lpCell->SetCurrentCredentials ((PVOID)hCreds);
201 AfsAdmSvr_EndOperation (iOp);
206 // AfsAdmSvr_GetLocalCell
207 // ...obtains the name of the primary cell used by the admin server
209 extern "C" int AfsAdmSvr_GetLocalCell (UINT_PTR idClient, STRING pszCellName, ULONG *pStatus)
211 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
213 Print (dlDETAIL, TEXT("Client 0x%08lX: GetLocalCell"), idClient);
215 if (!AfsAdmSvr_fIsValidClient (idClient))
216 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
218 if (!CELL::GetDefaultCell (pszCellName, pStatus))
220 AfsAdmSvr_EndOperation (iOp);
224 AfsAdmSvr_EndOperation (iOp);
229 // AfsAdmSvr_ErrorCodeTranslate
230 // ...translates an error code into an English string
232 extern "C" int AfsAdmSvr_ErrorCodeTranslate (UINT_PTR idClient, ULONG code, LANGID idLanguage, STRING pszErrorText, ULONG *pStatus)
234 if (!AfsAppLib_TranslateError (pszErrorText, code, idLanguage))
235 return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
238 if ((pch = (LPTSTR)lstrrchr (pszErrorText, TEXT('('))) != NULL)
240 while (lstrlen(pszErrorText) && pszErrorText[ lstrlen(pszErrorText)-1 ] == TEXT(' '))
241 pszErrorText[ lstrlen(pszErrorText)-1 ] = TEXT('\0');
246 // AfsAdmSvr_GetAction
247 // ...returns information about a particular operation in progress.
249 extern "C" int AfsAdmSvr_GetAction (UINT_PTR idClient, DWORD idAction, LPASACTION pAction, ULONG *pStatus)
251 Print (dlDETAIL, TEXT("Client 0x%08lX: GetAction (idAction=0x%08lX)"), idClient, idAction);
253 if (!AfsAdmSvr_fIsValidClient (idClient))
254 return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
256 if (!AfsAdmSvr_GetOperation (idAction, pAction))
257 return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
259 Print (dlERROR, TEXT("Client 0x%08lX: GetAction succeeded"));
264 // AfsAdmSvr_GetActions
265 // ...returns a list of operations in progress. The list returned can
266 // be constrained to only including those operations initiated by
267 // a particular client and/or performed in a particular cell.
269 extern "C" int AfsAdmSvr_GetActions (UINT_PTR idClient, UINT_PTR idClientSearch, ASID idCellSearch, LPASACTIONLIST *ppList, ULONG *pStatus)
271 Print (dlDETAIL, TEXT("Client 0x%08lX: GetActions (idClientSearch=0x%08lX, idCellSearch=0x%08lX)"), idClient, idClientSearch, idCellSearch);
273 if (!AfsAdmSvr_fIsValidClient (idClient))
274 return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
276 if ((*ppList = AfsAdmSvr_GetOperations (idClientSearch, idCellSearch)) == NULL)
278 Print (dlERROR, TEXT("Client 0x%08lX: GetActions failed"), idClient);
279 return FALSE_(ERROR_NOT_ENOUGH_MEMORY,pStatus);
282 Print (dlERROR, TEXT("Client 0x%08lX: GetActions succeeded; %ld actions"), idClient, (*ppList) ? (*ppList)->cEntries : 0);
287 // AfsAdmSvr_OpenCell
288 // ...opens a cell for administration.
290 extern "C" int AfsAdmSvr_OpenCell (UINT_PTR idClient, UINT_PTR hCreds, STRING pszCellName, DWORD dwScopeFlags, ASID *pidCell, ULONG *pStatus)
292 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
294 if (!AfsAdmSvr_fIsValidClient (idClient))
295 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
297 Print (dlDETAIL, TEXT("Client 0x%08lX: OpenCell"), idClient);
299 AfsAdmSvr_AddToMinScope (dwScopeFlags);
302 if ((lpiCell = CELL::OpenCell ((LPTSTR)pszCellName, (PVOID)hCreds, pStatus)) == NULL)
304 AfsAdmSvr_EndOperation (iOp);
308 Print (dlDETAIL, TEXT("Client 0x%08lX: OpenCell succeeded (idCell=0x%08lX)"), idClient, lpiCell);
310 *pidCell = (ASID)lpiCell;
311 AfsAdmSvr_EndOperation (iOp);
316 // AfsAdmSvr_CloseCell
317 // ...used by client to open a cell for administration.
319 extern "C" int AfsAdmSvr_CloseCell (UINT_PTR idClient, ASID idCell, ULONG *pStatus)
321 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
323 Print (dlDETAIL, TEXT("Client 0x%08lX: CloseCell (idCell=0x%08lX)"), idClient, idCell);
325 if (!AfsAdmSvr_fIsValidClient (idClient))
326 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
328 if (GetAsidType (idCell) != itCELL)
329 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
331 CELL::CloseCell ((LPIDENT)idCell);
333 AfsAdmSvr_EndOperation (iOp);
338 // AfsAdmSvr_FindObject
339 // AfsAdmSvr_FindObjects
340 // ...used to search through all objects in the cell, obtaining a list
341 // of those which match the specified criteria. For FindObjects, the
342 // {*ppList} parameter will be filled in with an allocated list of
343 // ASIDs, and should be freed using the AfsAdmSvr_FreeAsidList()
344 // routine (clients using the TaAfsAdmSvrClient.lib library should
345 // call asc_AsidListFree(), which is a wrapper for that routine).
346 // The _FindObject routine can be used to find exactly one object--
347 // for instance, finding the ASID for a particular user or volume--
348 // while the _FindObjects routine returns a list of all objects
349 // which match the specified criteria--all volumes on a partition,
350 // or all users named "b*" within a cell.
352 extern "C" int AfsAdmSvr_FindObject (UINT_PTR idClient, ASID idSearchScope, ASOBJTYPE ObjectType, AFSADMSVR_SEARCH_REFRESH SearchRefresh, STRING szName, ASID *pidObject, ULONG *pStatus)
357 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
359 Print (dlDETAIL, TEXT("Client 0x%08lX: FindObject (scope=0x%08lX, type=%lu, name='%s')"), idClient, idSearchScope, ObjectType, szName);
361 if (!AfsAdmSvr_fIsValidClient (idClient))
362 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
364 if (GetAsidType (idSearchScope) == itUNUSED)
365 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
367 // We've got a special case here: if possible, we don't want to have to
368 // refresh the contents of the entire cell. So if the client is looking
369 // for a user or group, we can just try to grab that object by its name;
370 // afsclass supports an interface for just this case.
375 rc = AfsAdmSvr_Search_OneUser (pidObject, idSearchScope, szName, &status);
379 rc = AfsAdmSvr_Search_OneGroup (pidObject, idSearchScope, szName, &status);
383 // We'll have to do the search the hard way. First
384 // see if we need to refresh this cell/server.
386 if (!AfsAdmSvr_SearchRefresh (idSearchScope, ObjectType, SearchRefresh, &status))
387 return FALSE_(status,pStatus,iOp);
389 // Look for the specified object.
391 switch (GetAsidType (idSearchScope))
394 if (ObjectType == TYPE_SERVER)
395 rc = AfsAdmSvr_Search_ServerInCell (pidObject, idSearchScope, szName, &status);
396 else if (ObjectType == TYPE_SERVICE)
397 rc = AfsAdmSvr_Search_ServiceInCell (pidObject, idSearchScope, szName, &status);
398 else if (ObjectType == TYPE_PARTITION)
399 rc = AfsAdmSvr_Search_PartitionInCell (pidObject, idSearchScope, szName, &status);
400 else if (ObjectType == TYPE_VOLUME)
401 rc = AfsAdmSvr_Search_VolumeInCell (pidObject, idSearchScope, szName, &status);
402 else if (ObjectType == TYPE_USER)
403 rc = AfsAdmSvr_Search_UserInCell (pidObject, idSearchScope, szName, &status);
404 else if (ObjectType == TYPE_GROUP)
405 rc = AfsAdmSvr_Search_GroupInCell (pidObject, idSearchScope, szName, &status);
409 status = ERROR_INVALID_PARAMETER;
414 if (ObjectType == TYPE_SERVICE)
415 rc = AfsAdmSvr_Search_ServiceInServer (pidObject, idSearchScope, szName, &status);
416 else if (ObjectType == TYPE_PARTITION)
417 rc = AfsAdmSvr_Search_PartitionInServer (pidObject, idSearchScope, szName, &status);
418 else if (ObjectType == TYPE_VOLUME)
419 rc = AfsAdmSvr_Search_VolumeInServer (pidObject, idSearchScope, szName, &status);
423 status = ERROR_INVALID_PARAMETER;
428 if (ObjectType == TYPE_VOLUME)
429 rc = AfsAdmSvr_Search_VolumeInPartition (pidObject, idSearchScope, szName, &status);
433 status = ERROR_INVALID_PARAMETER;
444 Print (dlERROR, TEXT("Client 0x%08lX: FindObject failed (status=0x%08lX)"), idClient, status);
446 Print (dlDETAIL, TEXT("Client 0x%08lX: FindObject succeeded; returning idObject=0x%08lX"), idClient, *pidObject);
448 AfsAdmSvr_EndOperation (iOp);
453 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)
458 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
460 Print (dlDETAIL, TEXT("Client 0x%08lX: FindObjects (scope=0x%08lX, type=%lu, pat='%s')"), idClient, idSearchScope, ObjectType, szPattern);
462 if (!AfsAdmSvr_fIsValidClient (idClient))
463 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
465 if (GetAsidType (idSearchScope) == itUNUSED)
466 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
468 // First see if we need to refresh this cell/server
470 if (!AfsAdmSvr_SearchRefresh (idSearchScope, ObjectType, SearchRefresh, &status))
471 return FALSE_(status,pStatus,iOp);
473 // Prepare an ASIDLIST, and call whatever subroutine is necessary to
474 // perform the actual search.
476 if ((*ppList = AfsAdmSvr_CreateAsidList()) == NULL)
477 return FALSE_(ERROR_NOT_ENOUGH_MEMORY,pStatus,iOp);
479 LPTSTR pszPattern = (szPattern && szPattern[0]) ? (LPTSTR)szPattern : NULL;
481 switch (GetAsidType (idSearchScope))
484 if (ObjectType == TYPE_ANY)
485 rc = AfsAdmSvr_Search_AllInCell (ppList, idSearchScope, pszPattern, &status);
486 else if (ObjectType == TYPE_SERVER)
487 rc = AfsAdmSvr_Search_ServersInCell (ppList, idSearchScope, pszPattern, &status);
488 else if (ObjectType == TYPE_SERVICE)
489 rc = AfsAdmSvr_Search_ServicesInCell (ppList, idSearchScope, pszPattern, &status);
490 else if (ObjectType == TYPE_PARTITION)
491 rc = AfsAdmSvr_Search_PartitionsInCell (ppList, idSearchScope, pszPattern, &status);
492 else if (ObjectType == TYPE_VOLUME)
493 rc = AfsAdmSvr_Search_VolumesInCell (ppList, idSearchScope, pszPattern, &status);
494 else if (ObjectType == TYPE_USER)
495 rc = AfsAdmSvr_Search_UsersInCell (ppList, idSearchScope, pszPattern, &status);
496 else if (ObjectType == TYPE_GROUP)
497 rc = AfsAdmSvr_Search_GroupsInCell (ppList, idSearchScope, pszPattern, &status);
501 status = ERROR_INVALID_PARAMETER;
506 if (ObjectType == TYPE_ANY)
507 rc = AfsAdmSvr_Search_AllInServer (ppList, idSearchScope, pszPattern, &status);
508 else if (ObjectType == TYPE_SERVICE)
509 rc = AfsAdmSvr_Search_ServicesInServer (ppList, idSearchScope, pszPattern, &status);
510 else if (ObjectType == TYPE_PARTITION)
511 rc = AfsAdmSvr_Search_PartitionsInServer (ppList, idSearchScope, pszPattern, &status);
512 else if (ObjectType == TYPE_VOLUME)
513 rc = AfsAdmSvr_Search_VolumesInServer (ppList, idSearchScope, pszPattern, &status);
517 status = ERROR_INVALID_PARAMETER;
522 if (ObjectType == TYPE_ANY)
523 rc = AfsAdmSvr_Search_VolumesInPartition (ppList, idSearchScope, pszPattern, &status);
524 else if (ObjectType == TYPE_VOLUME)
525 rc = AfsAdmSvr_Search_VolumesInPartition (ppList, idSearchScope, pszPattern, &status);
529 status = ERROR_INVALID_PARAMETER;
534 if (rc && (*ppList) && (pSearchParams))
535 AfsAdmSvr_Search_Advanced (ppList, pSearchParams);
537 if (!rc && (*ppList))
538 AfsAdmSvr_FreeAsidList (ppList);
543 Print (dlERROR, TEXT("Client 0x%08lX: FindObjects failed (status=0x%08lX)"), idClient, status);
545 Print (dlDETAIL, TEXT("Client 0x%08lX: FindObjects succeeded; returning %lu item(s)"), idClient, (*ppList)->cEntries);
547 AfsAdmSvr_EndOperation (iOp);
552 // AfsAdmSvr_GetObject
553 // AfsAdmSvr_GetObjects
554 // ...returns server-cached information about the specified object (or
557 extern "C" int AfsAdmSvr_GetObject (UINT_PTR idClient, AFSADMSVR_GET_TYPE GetType, AFSADMSVR_GET_LEVEL GetLevel, ASID idObject, UINT_PTR verProperties, LPASOBJPROP pProperties, ULONG *pStatus)
559 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
561 Print (dlDETAIL2, TEXT("Client 0x%08lX: GetObject (Type=%lu, Level=%lu, idObject=0x%08lX, ver=%ld)"), idClient, (LONG)GetType, (LONG)GetLevel, idObject, verProperties);
563 memset (pProperties, 0x00, sizeof(ASOBJPROP));
565 if (!AfsAdmSvr_fIsValidClient (idClient))
566 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
568 LPASOBJPROP pCurrentProperties;
569 if ((pCurrentProperties = AfsAdmSvr_GetCurrentProperties (idObject, pStatus)) == NULL)
571 Print (dlERROR, TEXT("Client 0x%08lX: GetObject failed; no properties"), idClient, idObject);
572 AfsAdmSvr_EndOperation (iOp);
576 // At this point pCurrentProperties may just be rudimentary properties.
577 // If the user has requested GET_ALL_DATA, we'll have to get full properties.
579 if ( (GetLevel == GET_ALL_DATA) && (pCurrentProperties->verProperties < verPROP_FIRST_SCAN) )
581 if (!AfsAdmSvr_ObtainFullProperties (pCurrentProperties, pStatus))
583 Print (dlERROR, TEXT("Client 0x%08lX: GetObject failed; no full properties"), idClient, idObject);
584 AfsAdmSvr_EndOperation (iOp);
589 // Now determine if we need to return anything at all; if the user specified
590 // RETURN_IF_OUT_OF_DATE, it's possible that there's no need to do so.
592 if ((pCurrentProperties->verProperties > verProperties) || (GetType == RETURN_DATA_ALWAYS))
594 memcpy (pProperties, pCurrentProperties, sizeof(ASOBJPROP));
597 Print (dlDETAIL2, TEXT("Client 0x%08lX: GetObject succeeded (idObject=0x%08lX)"), idClient, idObject);
598 AfsAdmSvr_EndOperation (iOp);
603 extern "C" int AfsAdmSvr_GetObjects (UINT_PTR idClient, AFSADMSVR_GET_TYPE GetType, AFSADMSVR_GET_LEVEL GetLevel, LPASIDLIST pListObjects, LPASOBJPROPLIST *ppListObjectProperties, ULONG *pStatus)
605 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
607 Print (dlDETAIL, TEXT("Client 0x%08lX: GetObjects (Type=%lu, Level=%lu, nObjects=%lu)"), idClient, (LONG)GetType, (LONG)GetLevel, (pListObjects) ? (pListObjects->cEntries) : 0);
609 if (!AfsAdmSvr_fIsValidClient (idClient))
610 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
612 *ppListObjectProperties = NULL;
613 for (size_t iObject = 0; iObject < pListObjects->cEntries; ++iObject)
615 ASOBJPROP ObjectProperties;
618 if (AfsAdmSvr_GetObject (idClient, GetType, GetLevel, pListObjects->aEntries[ iObject ].idObject, pListObjects->aEntries[ iObject ].lParam, &ObjectProperties, &status))
620 if (ObjectProperties.idObject == pListObjects->aEntries[ iObject ].idObject)
622 if (!*ppListObjectProperties)
623 *ppListObjectProperties = AfsAdmSvr_CreateObjPropList();
625 if (*ppListObjectProperties)
626 AfsAdmSvr_AddToObjPropList (ppListObjectProperties, &ObjectProperties, 0);
631 Print (dlDETAIL, TEXT("Client 0x%08lX: GetObjects succeeded; returning %lu properties"), idClient, (*ppListObjectProperties) ? ((*ppListObjectProperties)->cEntries) : 0);
632 AfsAdmSvr_EndOperation (iOp);
637 // AfsAdmSvr_RefreshObject
638 // AfsAdmSvr_RefreshObjects
639 // ...invalidates the server's cache of information about the specified
640 // object or objects.
642 extern "C" int AfsAdmSvr_RefreshObject (UINT_PTR idClient, ASID idObject, ULONG *pStatus)
644 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
646 Print (dlDETAIL, TEXT("Client 0x%08lX: RefreshObject (idObject=0x%08lX)"), idClient, idObject);
648 if (!AfsAdmSvr_fIsValidClient (idClient))
649 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
651 if (!AfsAdmSvr_InvalidateObjectProperties (idObject, pStatus))
653 AfsAdmSvr_EndOperation (iOp);
657 AfsAdmSvr_EndOperation (iOp);
662 extern "C" int AfsAdmSvr_RefreshObjects (UINT_PTR idClient, LPASIDLIST pListObjects, ULONG *pStatus)
664 size_t iOp = AfsAdmSvr_BeginOperation (idClient);
666 Print (dlDETAIL, TEXT("Client 0x%08lX: RefreshObjects (nObjects=%lu)"), idClient, (pListObjects) ? (pListObjects->cEntries) : 0);
668 if (!AfsAdmSvr_fIsValidClient (idClient))
669 return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
671 for (size_t iObject = 0; iObject < pListObjects->cEntries; ++iObject)
674 AfsAdmSvr_RefreshObject (idClient, pListObjects->aEntries[ iObject ].idObject, &status);
677 AfsAdmSvr_EndOperation (iOp);
682 // AfsAdmSvr_CallbackHost
683 // ...provides a context in which the server can issue callback functions
684 // via the AfsAdmSvrCallBack_* routines, which the client must implement.
685 // This routine will only return if the server is shut down. It should
686 // be called on a dedicated thread by the client. (TaAfsAdmSvrClient.lib
687 // automatically handles this.)
689 extern "C" void AfsAdmSvr_CallbackHost (void)
691 AfsAdmSvr_CallbackManager();
696 // AfsAdmSvr_GetRandomKey
697 // ...returns a randomly-generated 8-byte encryption key
699 extern "C" int AfsAdmSvr_GetRandomKey (UINT_PTR idClient, ASID idCell, BYTE keyData[ ENCRYPTIONKEYLENGTH ], ULONG *pStatus)
701 if (!AfsAdmSvr_fIsValidClient (idClient))
702 return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
704 return AfsClass_GetRandomKey ((LPIDENT)idCell, (LPENCRYPTIONKEY)keyData, pStatus);