- Timestamp:
- Aug 14, 2016 11:54:12 PM (8 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/auth/directoryservice/directoryservice.cpp
r62489 r63447 38 38 /* Try to find the default search node for local names */ 39 39 UInt32 cNodes; 40 tContextData pCtx = NULL;41 dsErr = dsFindDirNodes(pDirRef, pTmpBuf, NULL, eDSLocalNodeNames, &cNodes, & pCtx);40 tContextData hCtx = 0; 41 dsErr = dsFindDirNodes(pDirRef, pTmpBuf, NULL, eDSLocalNodeNames, &cNodes, &hCtx); 42 42 /* Any nodes found? */ 43 43 if ( dsErr == eDSNoErr … … 48 48 dsErr = eDSNodeNotFound; 49 49 50 if ( pCtx)51 dsReleaseContinueData(pDirRef, pCtx);50 if (hCtx) /* (DSoNodeConfig.m from DSTools-162 does exactly the same free if not-zero-regardless-of-return-code.) */ 51 dsReleaseContinueData(pDirRef, hCtx); 52 52 dsDataBufferDeAllocate(pDirRef, pTmpBuf); 53 53 } … … 76 76 /* Now search for the first matching record */ 77 77 UInt32 cRecords = 1; 78 tContextData pCtx = NULL;78 tContextData hCtx = 0; 79 79 dsErr = dsGetRecordList(pNodeRef, 80 80 pTmpBuf, … … 85 85 false, 86 86 &cRecords, 87 & pCtx);87 &hCtx); 88 88 if ( dsErr == eDSNoErr 89 89 && cRecords >= 1) 90 90 { 91 91 /* Process the first found record. Look at any attribute one by one. */ 92 tAttributeListRef pRecAttrListRef = NULL;92 tAttributeListRef hRecAttrListRef = 0; 93 93 tRecordEntryPtr pRecEntry = NULL; 94 94 tDataListPtr pAuthNodeList = NULL; 95 dsErr = dsGetRecordEntry(pNodeRef, pTmpBuf, 1, & pRecAttrListRef, &pRecEntry);95 dsErr = dsGetRecordEntry(pNodeRef, pTmpBuf, 1, &hRecAttrListRef, &pRecEntry); 96 96 if (dsErr == eDSNoErr) 97 97 { 98 98 for (size_t i = 1; i <= pRecEntry->fRecordAttributeCount; ++i) 99 99 { 100 tAttributeValueListRef pAttrValueListRef = NULL;100 tAttributeValueListRef hAttrValueListRef = 0; 101 101 tAttributeEntryPtr pAttrEntry = NULL; 102 102 /* Get the information for this attribute. */ 103 dsErr = dsGetAttributeEntry(pNodeRef, pTmpBuf, pRecAttrListRef, i,104 & pAttrValueListRef, &pAttrEntry);103 dsErr = dsGetAttributeEntry(pNodeRef, pTmpBuf, hRecAttrListRef, i, 104 &hAttrValueListRef, &pAttrEntry); 105 105 if (dsErr == eDSNoErr) 106 106 { … … 109 109 if (pAttrEntry->fAttributeValueCount > 0) 110 110 { 111 dsErr = dsGetAttributeValue(pNodeRef, pTmpBuf, 1, pAttrValueListRef, &pValueEntry);111 dsErr = dsGetAttributeValue(pNodeRef, pTmpBuf, 1, hAttrValueListRef, &pValueEntry); 112 112 if (dsErr == eDSNoErr) 113 113 { … … 127 127 if (pValueEntry != NULL) 128 128 dsDeallocAttributeValueEntry(pDirRef, pValueEntry); 129 if ( pAttrValueListRef)130 dsCloseAttributeValueList( pAttrValueListRef);129 if (hAttrValueListRef) 130 dsCloseAttributeValueList(hAttrValueListRef); 131 131 if (pAttrEntry != NULL) 132 132 dsDeallocAttributeEntry(pDirRef, pAttrEntry); … … 156 156 free(pAuthNodeList); 157 157 } 158 if ( pRecAttrListRef)159 dsCloseAttributeList( pRecAttrListRef);158 if (hRecAttrListRef) 159 dsCloseAttributeList(hRecAttrListRef); 160 160 if (pRecEntry != NULL) 161 161 dsDeallocRecordEntry(pDirRef, pRecEntry); … … 163 163 else 164 164 dsErr = eDSRecordNotFound; 165 if ( pCtx)166 dsReleaseContinueData(pDirRef, pCtx);165 if (hCtx) 166 dsReleaseContinueData(pDirRef, hCtx); 167 167 } 168 168 else … … 198 198 tDirStatus dsErr = eDSNoErr; 199 199 /* Open the authentication node. */ 200 tDirNodeReference pAuthNodeRef = NULL;201 dsErr = dsOpenDirNode(pDirRef, pAuthNodeList, & pAuthNodeRef);200 tDirNodeReference hAuthNodeRef = 0; 201 dsErr = dsOpenDirNode(pDirRef, pAuthNodeList, &hAuthNodeRef); 202 202 if (dsErr == eDSNoErr) 203 203 { … … 236 236 pAuthInBuf->fBufferLength += cPassword; 237 237 /* Now authenticate */ 238 dsErr = dsDoDirNodeAuth( pAuthNodeRef, pAuthMethod, true, pAuthInBuf, pAuthOutBuf, NULL);238 dsErr = dsDoDirNodeAuth(hAuthNodeRef, pAuthMethod, true, pAuthInBuf, pAuthOutBuf, NULL); 239 239 /* Clean up. */ 240 240 dsDataBufferDeAllocate(pDirRef, pAuthInBuf); … … 250 250 else 251 251 dsErr = eDSAllocationFailed; 252 dsCloseDirNode( pAuthNodeRef);252 dsCloseDirNode(hAuthNodeRef); 253 253 } 254 254 … … 257 257 258 258 RT_C_DECLS_BEGIN 259 DECLEXPORT(AuthResult) AUTHCALL AuthEntry(const char *szCaller, 259 DECLEXPORT(FNAUTHENTRY3) AuthEntry; 260 RT_C_DECLS_END 261 262 DECLEXPORT(AuthResult) AUTHCALL AuthEntry(const char *pszCaller, 260 263 PAUTHUUID pUuid, 261 264 AuthGuestJudgement guestJudgement, 262 const char * szUser,263 const char * szPassword,264 const char * szDomain,265 const char *pszUser, 266 const char *pszPassword, 267 const char *pszDomain, 265 268 int fLogon, 266 269 unsigned clientId) 267 270 { 271 RT_NOREF(pszCaller, pUuid, guestJudgement, pszDomain, clientId); 272 268 273 /* Validate input */ 269 AssertPtrReturn( szUser, AuthResultAccessDenied);270 AssertPtrReturn( szPassword, AuthResultAccessDenied);274 AssertPtrReturn(pszUser, AuthResultAccessDenied); 275 AssertPtrReturn(pszPassword, AuthResultAccessDenied); 271 276 272 277 /* Result to a default value */ … … 279 284 tDirStatus dsErr = eDSNoErr; 280 285 tDirStatus dsCleanErr = eDSNoErr; 281 tDirReference pDirRef = NULL;286 tDirReference hDirRef = 0; 282 287 /* Connect to the Directory Service. */ 283 dsErr = dsOpenDirService(& pDirRef);288 dsErr = dsOpenDirService(&hDirRef); 284 289 if (dsErr == eDSNoErr) 285 290 { 286 291 /* Fetch the default search node */ 287 292 tDataListPtr pSearchNodeList = NULL; 288 dsErr = defaultSearchNodePath( pDirRef, &pSearchNodeList);293 dsErr = defaultSearchNodePath(hDirRef, &pSearchNodeList); 289 294 if (dsErr == eDSNoErr) 290 295 { 291 296 /* Open the default search node */ 292 tDirNodeReference pSearchNodeRef = NULL;293 dsErr = dsOpenDirNode( pDirRef, pSearchNodeList, &pSearchNodeRef);297 tDirNodeReference hSearchNodeRef = 0; 298 dsErr = dsOpenDirNode(hDirRef, pSearchNodeList, &hSearchNodeRef); 294 299 if (dsErr == eDSNoErr) 295 300 { … … 299 304 * authenticate has the short form. */ 300 305 tDataListPtr pAuthNodeList = NULL; 301 dsErr = userAuthInfo( pDirRef, pSearchNodeRef,szUser, &pAuthNodeList);306 dsErr = userAuthInfo(hDirRef, hSearchNodeRef, pszUser, &pAuthNodeList); 302 307 if (dsErr == eDSNoErr) 303 308 { 304 309 /* Open the authentication node and do the authentication. */ 305 dsErr = authWithNode( pDirRef, pAuthNodeList, szUser,szPassword);310 dsErr = authWithNode(hDirRef, pAuthNodeList, pszUser, pszPassword); 306 311 if (dsErr == eDSNoErr) 307 312 result = AuthResultAccessGranted; 308 dsCleanErr = dsDataListDeallocate( pDirRef, pAuthNodeList);313 dsCleanErr = dsDataListDeallocate(hDirRef, pAuthNodeList); 309 314 if (dsCleanErr == eDSNoErr) 310 315 free(pAuthNodeList); 311 316 } 312 dsCloseDirNode( pSearchNodeRef);317 dsCloseDirNode(hSearchNodeRef); 313 318 } 314 dsCleanErr = dsDataListDeallocate( pDirRef, pSearchNodeList);319 dsCleanErr = dsDataListDeallocate(hDirRef, pSearchNodeList); 315 320 if (dsCleanErr == eDSNoErr) 316 321 free(pSearchNodeList); 317 322 } 318 dsCloseDirService( pDirRef);323 dsCloseDirService(hDirRef); 319 324 } 320 325 321 326 return result; 322 327 } 323 RT_C_DECLS_END 324 325 static PAUTHENTRY3 gpfnAuthEntry = AuthEntry; 326 328 -
trunk/src/VBox/Main/cbinding/VBoxCAPI.cpp
r62770 r63447 39 39 #include "VBox/com/NativeEventQueue.h" 40 40 41 42 #ifndef RT_OS_DARWIN /* Probably not used for xpcom, so clang gets upset: error: using directive refers to implicitly-defined namespace 'std' [-Werror]*/ 41 43 using namespace std; 44 #endif 42 45 43 46 /* The following 2 object references should be eliminated once the legacy
Note:
See TracChangeset
for help on using the changeset viewer.