Changeset 34558 in vbox
- Timestamp:
- Dec 1, 2010 10:56:44 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VRDPAuth.h
r28800 r34558 1 1 /** @file 2 * VBox Remote Desktop Protocol - External Authentication Library Interface. 3 * (VRDP) 2 * VirtualBox External Authentication Library Interface. 4 3 */ 5 4 6 5 /* 7 * Copyright (C) 2006-20 07Oracle Corporation6 * Copyright (C) 2006-2010 Oracle Corporation 8 7 * 9 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 28 30 29 /* The following 2 enums are 32 bits values.*/ 31 typedef enum _VRDPAuthResult30 typedef enum AuthResult 32 31 { 33 VRDPAuthAccessDenied = 0,34 VRDPAuthAccessGranted = 1,35 VRDPAuthDelegateToGuest = 2,36 VRDPAuthSizeHack = 0x7fffffff37 } VRDPAuthResult;32 AuthResultAccessDenied = 0, 33 AuthResultAccessGranted = 1, 34 AuthResultDelegateToGuest = 2, 35 AuthResultSizeHack = 0x7fffffff 36 } AuthResult; 38 37 39 typedef enum _VRDPAuthGuestJudgement38 typedef enum AuthGuestJudgement 40 39 { 41 VRDPAuthGuestNotAsked = 0,42 VRDPAuthGuestAccessDenied = 1,43 VRDPAuthGuestNoJudgement = 2,44 VRDPAuthGuestAccessGranted = 3,45 VRDPAuthGuestNotReacted = 4,46 VRDPAuthGuestSizeHack = 0x7fffffff47 } VRDPAuthGuestJudgement;40 AuthGuestNotAsked = 0, 41 AuthGuestAccessDenied = 1, 42 AuthGuestNoJudgement = 2, 43 AuthGuestAccessGranted = 3, 44 AuthGuestNotReacted = 4, 45 AuthGuestSizeHack = 0x7fffffff 46 } AuthGuestJudgement; 48 47 49 48 /* UUID memory representation. Array of 16 bytes. */ 50 typedef unsigned char VRDPAUTHUUID[16];51 typedef VRDPAUTHUUID *PVRDPAUTHUUID;49 typedef unsigned char AUTHUUID[16]; 50 typedef AUTHUUID *PAUTHUUID; 52 51 /* 53 52 Note: VirtualBox uses a consistent binary representation of UUIDs on all platforms. For this reason … … 65 64 /* The library entry point calling convention. */ 66 65 #ifdef _MSC_VER 67 # define VRDPAUTHCALL __cdecl66 # define AUTHCALL __cdecl 68 67 #elif defined(__GNUC__) 69 # define VRDPAUTHCALL68 # define AUTHCALL 70 69 #else 71 70 # error "Unsupported compiler" … … 74 73 75 74 /** 76 * Authentication library entry point. Decides whether to allow 77 * a client connection. 75 * Authentication library entry point. 78 76 * 79 77 * Parameters: 80 78 * 81 * pUuid Pointer to the UUID of the virtual machine 82 * which the client connected to. 79 * pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL. 83 80 * guestJudgement Result of the guest authentication. 84 81 * szUser User name passed in by the client (UTF8). … … 88 85 * Return code: 89 86 * 90 * VRDPAuthAccessDenied Client access has been denied.91 * VRDPAuthAccessGranted Client has the right to use the92 * 93 * VRDPAuthDelegateToGuest Guest operating system must94 * 95 * 96 * 97 * 87 * AuthAccessDenied Client access has been denied. 88 * AuthAccessGranted Client has the right to use the 89 * virtual machine. 90 * AuthDelegateToGuest Guest operating system must 91 * authenticate the client and the 92 * library must be called again with 93 * the result of the guest 94 * authentication. 98 95 */ 99 typedef VRDPAuthResult VRDPAUTHCALL VRDPAUTHENTRY(PVRDPAUTHUUID pUuid,100 VRDPAuthGuestJudgement guestJudgement,101 102 103 96 typedef AuthResult AUTHCALL AUTHENTRY(PAUTHUUID pUuid, 97 AuthGuestJudgement guestJudgement, 98 const char *szUser, 99 const char *szPassword, 100 const char *szDomain); 104 101 105 102 106 typedef VRDPAUTHENTRY *PVRDPAUTHENTRY; 103 typedef AUTHENTRY *PAUTHENTRY; 104 105 #define AUTHENTRY_NAME "VRDPAuth" 107 106 108 107 /** 109 * Authentication library entry point version 2. Decides whether to allow 110 * a client connection. 108 * Authentication library entry point version 2. 111 109 * 112 110 * Parameters: 113 111 * 114 * pUuid Pointer to the UUID of the virtual machine 115 * which the client connected to. 112 * pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL. 116 113 * guestJudgement Result of the guest authentication. 117 114 * szUser User name passed in by the client (UTF8). … … 124 121 * Return code: 125 122 * 126 * VRDPAuthAccessDenied Client access has been denied.127 * VRDPAuthAccessGranted Client has the right to use the128 * 129 * VRDPAuthDelegateToGuest Guest operating system must130 * 131 * 132 * 133 * 123 * AuthAccessDenied Client access has been denied. 124 * AuthAccessGranted Client has the right to use the 125 * virtual machine. 126 * AuthDelegateToGuest Guest operating system must 127 * authenticate the client and the 128 * library must be called again with 129 * the result of the guest 130 * authentication. 134 131 * 135 132 * Note: When 'fLogon' is 0, only pUuid and clientId are valid and the return 136 133 * code is ignored. 137 134 */ 138 typedef VRDPAuthResult VRDPAUTHCALL VRDPAUTHENTRY2(PVRDPAUTHUUID pUuid,139 VRDPAuthGuestJudgement guestJudgement,140 141 142 143 144 135 typedef AuthResult AUTHCALL AUTHENTRY2(PAUTHUUID pUuid, 136 AuthGuestJudgement guestJudgement, 137 const char *szUser, 138 const char *szPassword, 139 const char *szDomain, 140 int fLogon, 141 unsigned clientId); 145 142 146 143 147 typedef VRDPAUTHENTRY2 *PVRDPAUTHENTRY2; 144 typedef AUTHENTRY2 *PAUTHENTRY2; 145 146 #define AUTHENTRY2_NAME "VRDPAuth2" 147 148 /** 149 * Authentication library entry point version 3. 150 * 151 * Parameters: 152 * 153 * szCaller The name of the component which calls the library (UTF8). 154 * pUuid Pointer to the UUID of the accessed virtual machine. Can be NULL. 155 * guestJudgement Result of the guest authentication. 156 * szUser User name passed in by the client (UTF8). 157 * szPassword Password passed in by the client (UTF8). 158 * szDomain Domain passed in by the client (UTF8). 159 * fLogon Boolean flag. Indicates whether the entry point is called 160 * for a client logon or the client disconnect. 161 * clientId Server side unique identifier of the client. 162 * 163 * Return code: 164 * 165 * AuthAccessDenied Client access has been denied. 166 * AuthAccessGranted Client has the right to use the 167 * virtual machine. 168 * AuthDelegateToGuest Guest operating system must 169 * authenticate the client and the 170 * library must be called again with 171 * the result of the guest 172 * authentication. 173 * 174 * Note: When 'fLogon' is 0, only pszCaller, pUuid and clientId are valid and the return 175 * code is ignored. 176 */ 177 typedef AuthResult AUTHCALL AUTHENTRY3(const char *szCaller, 178 PAUTHUUID pUuid, 179 AuthGuestJudgement guestJudgement, 180 const char *szUser, 181 const char *szPassword, 182 const char *szDomain, 183 int fLogon, 184 unsigned clientId); 185 186 187 typedef AUTHENTRY3 *PAUTHENTRY3; 188 189 #define AUTHENTRY3_NAME "AuthEntry" 148 190 149 191 #endif -
trunk/src/VBox/HostServices/auth/Makefile.kmk
r33185 r34558 44 44 # Install the SDK samples. 45 45 INSTALLS += VBoxAuth-samples 46 VBoxAuth-samples_INST = $(INST_SDK)/bindings/ vrdpauth/46 VBoxAuth-samples_INST = $(INST_SDK)/bindings/auth/ 47 47 VBoxAuth-samples_MODE = a+r,u+w 48 48 VBoxAuth-samples_SOURCES = simple/VBoxAuthSimple.cpp … … 52 52 # Install the SDK header. 53 53 INSTALLS += VBoxAuth-sdkhdr 54 VBoxAuth-sdkhdr_INST = $(INST_SDK)/bindings/ vrdpauth/include/54 VBoxAuth-sdkhdr_INST = $(INST_SDK)/bindings/auth/include/ 55 55 VBoxAuth-sdkhdr_MODE = a+r,u+w 56 56 VBoxAuth-sdkhdr_SOURCES = $(PATH_ROOT)/include/VBox/VRDPAuth.h=>VRDPAuth.h -
trunk/src/VBox/HostServices/auth/directoryservice/directoryservice.cpp
r33185 r34558 258 258 259 259 RT_C_DECLS_BEGIN 260 DECLEXPORT( VRDPAuthResult) VRDPAUTHCALL VRDPAuth(PVRDPAUTHUUID pUuid,261 VRDPAuthGuestJudgement guestJudgement,262 263 264 260 DECLEXPORT(AuthResult) AUTHCALL VRDPAuth(PAUTHUUID pUuid, 261 AuthGuestJudgement guestJudgement, 262 const char *pszUser, 263 const char *pszPassword, 264 const char *pszDomain) 265 265 { 266 266 /* Validate input */ 267 AssertPtrReturn(pszUser, VRDPAuthAccessDenied);268 AssertPtrReturn(pszPassword, VRDPAuthAccessDenied);267 AssertPtrReturn(pszUser, AuthResultAccessDenied); 268 AssertPtrReturn(pszPassword, AuthResultAccessDenied); 269 269 270 270 /* Result to a default value */ 271 VRDPAuthResult result = VRDPAuthAccessDenied;271 AuthResult result = AuthResultAccessDenied; 272 272 273 273 tDirStatus dsErr = eDSNoErr; … … 299 299 dsErr = authWithNode(pDirRef, pAuthNodeList, pszUser, pszPassword); 300 300 if (dsErr == eDSNoErr) 301 result = VRDPAuthAccessGranted;301 result = AuthResultAccessGranted; 302 302 dsCleanErr = dsDataListDeallocate(pDirRef, pAuthNodeList); 303 303 if (dsCleanErr == eDSNoErr) … … 317 317 RT_C_DECLS_END 318 318 319 static P VRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;320 319 static PAUTHENTRY gpfnAuthEntry = VRDPAuth; 320 -
trunk/src/VBox/HostServices/auth/pam/VBoxAuthPAM.c
r33185 r34558 147 147 }; 148 148 149 static int vrdpauth_pam_init(void)149 static int auth_pam_init(void) 150 150 { 151 151 SymMap *iter; … … 155 155 if (!gpvLibPam) 156 156 { 157 debug_printf(" vrdpauth_pam_init: dlopen %s failed\n", VRDP_PAM_LIB);157 debug_printf("auth_pam_init: dlopen %s failed\n", VRDP_PAM_LIB); 158 158 return PAM_SYSTEM_ERR; 159 159 } … … 167 167 if (pv == NULL) 168 168 { 169 debug_printf(" vrdpauth_pam_init: dlsym %s failed\n", iter->pszName);169 debug_printf("auth_pam_init: dlsym %s failed\n", iter->pszName); 170 170 171 171 dlclose(gpvLibPam); … … 183 183 } 184 184 185 static void vrdpauth_pam_close(void)185 static void auth_pam_close(void) 186 186 { 187 187 if (gpvLibPam) … … 194 194 } 195 195 #else 196 static int vrdpauth_pam_init(void)196 static int auth_pam_init(void) 197 197 { 198 198 return PAM_SUCCESS; 199 199 } 200 200 201 static void vrdpauth_pam_close(void)201 static void auth_pam_close(void) 202 202 { 203 203 return; … … 205 205 #endif /* VRDP_PAM_DLLOAD */ 206 206 207 static const char * vrdpauth_get_pam_service (void)207 static const char *auth_get_pam_service (void) 208 208 { 209 209 const char *service = getenv (VRDP_AUTH_PAM_SERVICE_NAME_ENV); … … 273 273 } 274 274 275 /* The VRDPAuthentry point must be visible. */275 /* The entry point must be visible. */ 276 276 #if defined(_MSC_VER) || defined(__OS2__) 277 277 # define DECLEXPORT(type) __declspec(dllexport) type … … 285 285 286 286 /* prototype to prevent gcc warning */ 287 DECLEXPORT( VRDPAuthResult) VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid,288 VRDPAuthGuestJudgement guestJudgement,289 290 291 292 DECLEXPORT( VRDPAuthResult) VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid,293 VRDPAuthGuestJudgement guestJudgement,294 295 296 297 { 298 VRDPAuthResult result = VRDPAuthAccessDenied;287 DECLEXPORT(AuthResult) AUTHCALL VRDPAuth (PAUTHUUID pUuid, 288 AuthGuestJudgement guestJudgement, 289 const char *szUser, 290 const char *szPassword, 291 const char *szDomain); 292 DECLEXPORT(AuthResult) AUTHCALL VRDPAuth (PAUTHUUID pUuid, 293 AuthGuestJudgement guestJudgement, 294 const char *szUser, 295 const char *szPassword, 296 const char *szDomain) 297 { 298 AuthResult result = AuthResultAccessDenied; 299 299 300 300 int rc; … … 313 313 pam_conversation.appdata_ptr = &ctx; 314 314 315 rc = vrdpauth_pam_init ();315 rc = auth_pam_init (); 316 316 317 317 if (rc == PAM_SUCCESS) … … 319 319 debug_printf("init ok\n"); 320 320 321 rc = fn_pam_start( vrdpauth_get_pam_service (), szUser, &pam_conversation, &pam_handle);321 rc = fn_pam_start(auth_get_pam_service (), szUser, &pam_conversation, &pam_handle); 322 322 323 323 if (rc == PAM_SUCCESS) … … 344 344 debug_printf("access granted\n"); 345 345 346 result = VRDPAuthAccessGranted;346 result = AuthResultAccessGranted; 347 347 } 348 348 else … … 363 363 } 364 364 365 vrdpauth_pam_close ();366 367 debug_printf(" vrdpauth_pam_close completed\n");365 auth_pam_close (); 366 367 debug_printf("auth_pam_close completed\n"); 368 368 } 369 369 else 370 370 { 371 debug_printf(" vrdpauth_pam_init failed %d\n", rc);371 debug_printf("auth_pam_init failed %d\n", rc); 372 372 } 373 373 … … 376 376 377 377 /* Verify the function prototype. */ 378 static P VRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;378 static PAUTHENTRY gpfnAuthEntry = VRDPAuth; -
trunk/src/VBox/HostServices/auth/simple/VBoxAuthSimple.cpp
r33294 r34558 51 51 52 52 FILE *f = fopen(VRDPAUTH_DEBUG_FILE_NAME, "ab"); 53 fprintf(f, "%s", buffer); 54 fclose(f); 53 if (f) 54 { 55 fprintf(f, "%s", buffer); 56 fclose(f); 57 } 55 58 56 59 va_end (va); … … 59 62 60 63 RT_C_DECLS_BEGIN 61 DECLEXPORT(VRDPAuthResult) VRDPAUTHCALL VRDPAuth2(PVRDPAUTHUUID pUuid, 62 VRDPAuthGuestJudgement guestJudgement, 63 const char *szUser, 64 const char *szPassword, 65 const char *szDomain, 66 int fLogon, 67 unsigned clientId) 64 DECLEXPORT(AuthResult) AUTHCALL AuthEntry(const char *szCaller, 65 PAUTHUUID pUuid, 66 AuthGuestJudgement guestJudgement, 67 const char *szUser, 68 const char *szPassword, 69 const char *szDomain, 70 int fLogon, 71 unsigned clientId) 68 72 { 69 73 /* default is failed */ 70 VRDPAuthResult result = VRDPAuthAccessDenied;74 AuthResult result = AuthResultAccessDenied; 71 75 72 76 /* only interested in logon */ … … 117 121 118 122 if (password == pszDigest) 119 result = VRDPAuthAccessGranted;123 result = AuthResultAccessGranted; 120 124 } 121 125 } … … 126 130 127 131 /* Verify the function prototype. */ 128 static P VRDPAUTHENTRY2 gpfnAuthEntry = VRDPAuth2;132 static PAUTHENTRY3 gpfnAuthEntry = AuthEntry; -
trunk/src/VBox/HostServices/auth/winlogon/winlogon.cpp
r33185 r34558 19 19 20 20 /* If defined, debug messages will be written to the specified file. */ 21 // #define VRDPAUTH_DEBUG_FILE_NAME "\\VRDPAuth.log"21 // #define AUTH_DEBUG_FILE_NAME "\\VBoxAuth.log" 22 22 23 23 #include <stdio.h> … … 30 30 static void dprintf(const char *fmt, ...) 31 31 { 32 #ifdef AUTH_DEBUG_FILE_NAME 32 33 va_list va; 33 34 … … 40 41 OutputDebugStringA(buffer); 41 42 42 #ifdef VRDPAUTH_DEBUG_FILE_NAME 43 FILE *f = fopen (VRDPAUTH_DEBUG_FILE_NAME, "ab"); 44 fprintf (f, "%s", buffer); 45 fclose (f); 46 #endif 43 FILE *f = fopen (AUTH_DEBUG_FILE_NAME, "ab"); 44 if (f) 45 { 46 fprintf (f, "%s", buffer); 47 fclose (f); 48 } 47 49 48 50 va_end (va); 51 #endif 49 52 } 50 53 … … 53 56 __declspec(dllexport) 54 57 #endif 55 VRDPAuthResult VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid, 56 VRDPAuthGuestJudgement guestJudgement, 57 const char *szUser, 58 const char *szPassword, 59 const char *szDomain) 58 AuthResult AUTHCALL AuthEntry (const char *szCaller, 59 PAUTHUUID pUuid, 60 AuthGuestJudgement guestJudgement, 61 const char *szUser, 62 const char *szPassword, 63 const char *szDomain, 64 int fLogon, 65 unsigned clientId) 60 66 { 61 VRDPAuthResult result = VRDPAuthAccessDenied;67 AuthResult result = AuthResultAccessDenied; 62 68 63 69 LPTSTR lpszUsername = (char *)szUser; … … 86 92 dprintf("LogonUser success. hToken = %p\n", hToken); 87 93 88 result = VRDPAuthAccessGranted;94 result = AuthResultAccessGranted; 89 95 90 96 CloseHandle (hToken); … … 99 105 100 106 /* Verify the function prototype. */ 101 static P VRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;107 static PAUTHENTRY3 gpfnAuthEntry = AuthEntry; -
trunk/src/VBox/Main/ConsoleImpl.cpp
r34512 r34558 743 743 { 744 744 /* Console has been already uninitialized, deny request */ 745 LogRel((" VRDPAUTH: Access denied (Console uninitialized).\n"));745 LogRel(("AUTH: Access denied (Console uninitialized).\n")); 746 746 LogFlowFuncLeave(); 747 747 return VERR_ACCESS_DENIED; … … 762 762 AssertComRCReturn(hrc, VERR_ACCESS_DENIED); 763 763 764 VRDPAuthResult result = VRDPAuthAccessDenied;765 VRDPAuthGuestJudgement guestJudgement = VRDPAuthGuestNotAsked;764 AuthResult result = AuthResultAccessDenied; 765 AuthGuestJudgement guestJudgement = AuthGuestNotAsked; 766 766 767 767 LogFlowFunc(("Auth type %d\n", authType)); 768 768 769 LogRel((" VRDPAUTH: User: [%s]. Domain: [%s]. Authentication type: [%s]\n",769 LogRel(("AUTH: User: [%s]. Domain: [%s]. Authentication type: [%s]\n", 770 770 pszUser, pszDomain, 771 771 authType == AuthType_Null? … … 784 784 case AuthType_Null: 785 785 { 786 result = VRDPAuthAccessGranted;786 result = AuthResultAccessGranted; 787 787 break; 788 788 } … … 793 793 result = mConsoleVRDPServer->Authenticate(uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId); 794 794 795 if (result != VRDPAuthDelegateToGuest)795 if (result != AuthResultDelegateToGuest) 796 796 { 797 797 break; 798 798 } 799 799 800 LogRel((" VRDPAUTH: Delegated to guest.\n"));800 LogRel(("AUTH: Delegated to guest.\n")); 801 801 802 802 LogFlowFunc(("External auth asked for guest judgement\n")); … … 805 805 case AuthType_Guest: 806 806 { 807 guestJudgement = VRDPAuthGuestNotReacted;807 guestJudgement = AuthGuestNotReacted; 808 808 809 809 // @todo r=dj locking required here for m_pVMMDev? … … 829 829 switch (u32GuestFlags & (VMMDEV_CREDENTIALS_JUDGE_OK | VMMDEV_CREDENTIALS_JUDGE_DENY | VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT)) 830 830 { 831 case VMMDEV_CREDENTIALS_JUDGE_DENY: guestJudgement = VRDPAuthGuestAccessDenied; break;832 case VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT: guestJudgement = VRDPAuthGuestNoJudgement; break;833 case VMMDEV_CREDENTIALS_JUDGE_OK: guestJudgement = VRDPAuthGuestAccessGranted; break;831 case VMMDEV_CREDENTIALS_JUDGE_DENY: guestJudgement = AuthGuestAccessDenied; break; 832 case VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT: guestJudgement = AuthGuestNoJudgement; break; 833 case VMMDEV_CREDENTIALS_JUDGE_OK: guestJudgement = AuthGuestAccessGranted; break; 834 834 default: 835 835 LogFlowFunc(("Invalid guest flags %08X!!!\n", u32GuestFlags)); break; … … 851 851 if (authType == AuthType_External) 852 852 { 853 LogRel((" VRDPAUTH: Guest judgement %d.\n", guestJudgement));853 LogRel(("AUTH: Guest judgement %d.\n", guestJudgement)); 854 854 LogFlowFunc(("External auth called again with guest judgement = %d\n", guestJudgement)); 855 855 result = mConsoleVRDPServer->Authenticate(uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId); … … 859 859 switch (guestJudgement) 860 860 { 861 case VRDPAuthGuestAccessGranted:862 result = VRDPAuthAccessGranted;861 case AuthGuestAccessGranted: 862 result = AuthResultAccessGranted; 863 863 break; 864 864 default: 865 result = VRDPAuthAccessDenied;865 result = AuthResultAccessDenied; 866 866 break; 867 867 } … … 876 876 LogFlowFuncLeave(); 877 877 878 if (result != VRDPAuthAccessGranted)878 if (result != AuthResultAccessGranted) 879 879 { 880 880 /* Reject. */ 881 LogRel((" VRDPAUTH: Access denied.\n"));881 LogRel(("AUTH: Access denied.\n")); 882 882 return VERR_ACCESS_DENIED; 883 883 } 884 884 885 LogRel((" VRDPAUTH: Access granted.\n"));885 LogRel(("AUTH: Access granted.\n")); 886 886 887 887 /* Multiconnection check must be made after authentication, so bad clients would not interfere with a good one. */ … … 910 910 if (reuseSingleConnection) 911 911 { 912 LogRel((" VRDPAUTH: Multiple connections are not enabled. Disconnecting existing client.\n"));912 LogRel(("AUTH: Multiple connections are not enabled. Disconnecting existing client.\n")); 913 913 mConsoleVRDPServer->DisconnectClient(mu32SingleRDPClientId, false); 914 914 } … … 916 916 { 917 917 /* Reject. */ 918 LogRel((" VRDPAUTH: Multiple connections are not enabled. Access denied.\n"));918 LogRel(("AUTH: Multiple connections are not enabled. Access denied.\n")); 919 919 return VERR_ACCESS_DENIED; 920 920 } -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r34244 r34558 1347 1347 mpfnAuthEntry = NULL; 1348 1348 mpfnAuthEntry2 = NULL; 1349 mpfnAuthEntry3 = NULL; 1349 1350 1350 1351 if (mAuthLibrary) … … 1471 1472 #endif /* VBOX_WITH_USB */ 1472 1473 1473 VRDPAuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,1474 AuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, AuthGuestJudgement guestJudgement, 1474 1475 const char *pszUser, const char *pszPassword, const char *pszDomain, 1475 1476 uint32_t u32ClientId) 1476 1477 { 1477 VRDPAUTHUUID rawuuid;1478 AUTHUUID rawuuid; 1478 1479 1479 1480 memcpy(rawuuid, uuid.raw(), sizeof(rawuuid)); … … 1504 1505 Utf8Str filename = authLibrary; 1505 1506 1506 LogRel((" VRDPAUTH: ConsoleVRDPServer::Authenticate: loading external authentication library '%ls'\n", authLibrary.raw()));1507 LogRel(("AUTH: ConsoleVRDPServer::Authenticate: loading external authentication library '%ls'\n", authLibrary.raw())); 1507 1508 1508 1509 int rc; … … 1513 1514 1514 1515 if (RT_FAILURE(rc)) 1515 LogRel((" VRDPAUTH: Failed to load external authentication library. Error code: %Rrc\n", rc));1516 LogRel(("AUTH: Failed to load external authentication library. Error code: %Rrc\n", rc)); 1516 1517 1517 1518 if (RT_SUCCESS(rc)) 1518 1519 { 1520 typedef struct AuthEntryInfo 1521 { 1522 const char *pszName; 1523 void **ppvAddress; 1524 1525 } AuthEntryInfo; 1526 AuthEntryInfo entries[] = 1527 { 1528 { AUTHENTRY3_NAME, (void **)&mpfnAuthEntry3 }, 1529 { AUTHENTRY2_NAME, (void **)&mpfnAuthEntry2 }, 1530 { AUTHENTRY_NAME, (void **)&mpfnAuthEntry }, 1531 { NULL, NULL } 1532 }; 1533 1519 1534 /* Get the entry point. */ 1520 mpfnAuthEntry2 = NULL; 1521 int rc2 = RTLdrGetSymbol(mAuthLibrary, "VRDPAuth2", (void**)&mpfnAuthEntry2); 1522 if (RT_FAILURE(rc2)) 1523 { 1535 AuthEntryInfo *pEntryInfo = &entries[0]; 1536 while (pEntryInfo->pszName) 1537 { 1538 *pEntryInfo->ppvAddress = NULL; 1539 1540 int rc2 = RTLdrGetSymbol(mAuthLibrary, pEntryInfo->pszName, pEntryInfo->ppvAddress); 1541 if (RT_SUCCESS(rc2)) 1542 { 1543 /* Found an entry point. */ 1544 LogRel(("AUTH: Using entry point '%s'.\n", pEntryInfo->pszName)); 1545 rc = VINF_SUCCESS; 1546 break; 1547 } 1548 1524 1549 if (rc2 != VERR_SYMBOL_NOT_FOUND) 1525 1550 { 1526 LogRel((" VRDPAUTH: Could not resolve import '%s'. Error code: %Rrc\n", "VRDPAuth2", rc2));1551 LogRel(("AUTH: Could not resolve import '%s'. Error code: %Rrc\n", pEntryInfo->pszName, rc2)); 1527 1552 } 1528 1553 rc = rc2; 1529 } 1530 1531 /* Get the entry point. */ 1532 mpfnAuthEntry = NULL; 1533 rc2 = RTLdrGetSymbol(mAuthLibrary, "VRDPAuth", (void**)&mpfnAuthEntry); 1534 if (RT_FAILURE(rc2)) 1535 { 1536 if (rc2 != VERR_SYMBOL_NOT_FOUND) 1537 { 1538 LogRel(("VRDPAUTH: Could not resolve import '%s'. Error code: %Rrc\n", "VRDPAuth", rc2)); 1539 } 1540 rc = rc2; 1541 } 1542 1543 if (mpfnAuthEntry2 || mpfnAuthEntry) 1544 { 1545 LogRel(("VRDPAUTH: Using entry point '%s'.\n", mpfnAuthEntry2? "VRDPAuth2": "VRDPAuth")); 1546 rc = VINF_SUCCESS; 1554 1555 pEntryInfo++; 1547 1556 } 1548 1557 } … … 1557 1566 mpfnAuthEntry = NULL; 1558 1567 mpfnAuthEntry2 = NULL; 1568 mpfnAuthEntry3 = NULL; 1559 1569 1560 1570 if (mAuthLibrary) … … 1564 1574 } 1565 1575 1566 return VRDPAuthAccessDenied; 1567 } 1568 } 1569 1570 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2)); 1571 1572 VRDPAuthResult result = mpfnAuthEntry2? 1573 mpfnAuthEntry2(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId): 1574 mpfnAuthEntry(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain); 1576 return AuthResultAccessDenied; 1577 } 1578 } 1579 1580 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2 || mpfnAuthEntry3)); 1581 1582 AuthResult result; 1583 if (mpfnAuthEntry3) 1584 { 1585 result = mpfnAuthEntry3("vrde", &rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId); 1586 } 1587 else if (mpfnAuthEntry2) 1588 { 1589 result = mpfnAuthEntry2(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId); 1590 } 1591 else if (mpfnAuthEntry) 1592 { 1593 result = mpfnAuthEntry(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain); 1594 } 1575 1595 1576 1596 switch (result) 1577 1597 { 1578 case VRDPAuthAccessDenied:1579 LogRel((" VRDPAUTH: external authentication module returned 'access denied'\n"));1598 case AuthResultAccessDenied: 1599 LogRel(("AUTH: external authentication module returned 'access denied'\n")); 1580 1600 break; 1581 case VRDPAuthAccessGranted:1582 LogRel((" VRDPAUTH: external authentication module returned 'access granted'\n"));1601 case AuthResultAccessGranted: 1602 LogRel(("AUTH: external authentication module returned 'access granted'\n")); 1583 1603 break; 1584 case VRDPAuthDelegateToGuest:1585 LogRel((" VRDPAUTH: external authentication module returned 'delegate request to guest'\n"));1604 case AuthResultDelegateToGuest: 1605 LogRel(("AUTH: external authentication module returned 'delegate request to guest'\n")); 1586 1606 break; 1587 1607 default: 1588 LogRel((" VRDPAUTH: external authentication module returned incorrect return code %d\n", result));1589 result = VRDPAuthAccessDenied;1608 LogRel(("AUTH: external authentication module returned incorrect return code %d\n", result)); 1609 result = AuthResultAccessDenied; 1590 1610 } 1591 1611 … … 1597 1617 void ConsoleVRDPServer::AuthDisconnect(const Guid &uuid, uint32_t u32ClientId) 1598 1618 { 1599 VRDPAUTHUUID rawuuid;1619 AUTHUUID rawuuid; 1600 1620 1601 1621 memcpy(rawuuid, uuid.raw(), sizeof(rawuuid)); … … 1604 1624 rawuuid, u32ClientId)); 1605 1625 1606 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2)); 1607 1608 if (mpfnAuthEntry2) 1609 mpfnAuthEntry2(&rawuuid, VRDPAuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 1626 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2 || mpfnAuthEntry3)); 1627 1628 if (mpfnAuthEntry3) 1629 mpfnAuthEntry3("vrde", &rawuuid, AuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 1630 else if (mpfnAuthEntry2) 1631 mpfnAuthEntry2(&rawuuid, AuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 1610 1632 } 1611 1633 -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r33590 r34558 90 90 void Stop (void); 91 91 92 VRDPAuthResult Authenticate (const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,93 94 92 AuthResult Authenticate (const Guid &uuid, AuthGuestJudgement guestJudgement, 93 const char *pszUser, const char *pszPassword, const char *pszDomain, 94 uint32_t u32ClientId); 95 95 96 96 void AuthDisconnect (const Guid &uuid, uint32_t u32ClientId); … … 209 209 */ 210 210 RTLDRMOD mAuthLibrary; 211 PVRDPAUTHENTRY mpfnAuthEntry; 212 PVRDPAUTHENTRY2 mpfnAuthEntry2; 211 PAUTHENTRY mpfnAuthEntry; 212 PAUTHENTRY2 mpfnAuthEntry2; 213 PAUTHENTRY3 mpfnAuthEntry3; 213 214 }; 214 215 -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r33540 r34558 1131 1131 1132 1132 static bool fAuthLibLoaded = false; 1133 static PVRDPAUTHENTRY pfnAuthEntry = NULL; 1134 static PVRDPAUTHENTRY2 pfnAuthEntry2 = NULL; 1133 static PAUTHENTRY pfnAuthEntry = NULL; 1134 static PAUTHENTRY2 pfnAuthEntry2 = NULL; 1135 static PAUTHENTRY3 pfnAuthEntry3 = NULL; 1135 1136 1136 1137 if (!fAuthLibLoaded) … … 1161 1162 } 1162 1163 1163 if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, "VRDPAuth2", (void**)&pfnAuthEntry2))) 1164 WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, "VRDPAuth2", rc)); 1165 1166 if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, "VRDPAuth", (void**)&pfnAuthEntry))) 1167 WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, "VRDPAuth", rc)); 1168 1169 if (pfnAuthEntry || pfnAuthEntry2) 1164 if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, AUTHENTRY3_NAME, (void**)&pfnAuthEntry3))) 1165 WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, AUTHENTRY3_NAME, rc)); 1166 1167 if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, AUTHENTRY2_NAME, (void**)&pfnAuthEntry2))) 1168 WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, AUTHENTRY2_NAME, rc)); 1169 1170 if (RT_FAILURE(rc = RTLdrGetSymbol(hlibAuth, AUTHENTRY_NAME, (void**)&pfnAuthEntry))) 1171 WEBDEBUG(("%s(): Could not resolve import '%s'. Error code: %Rrc\n", __FUNCTION__, AUTHENTRY_NAME, rc)); 1172 1173 if (pfnAuthEntry || pfnAuthEntry2 || pfnAuthEntry3) 1170 1174 fAuthLibLoaded = true; 1171 1175 … … 1175 1179 1176 1180 rc = VERR_WEB_NOT_AUTHENTICATED; 1177 VRDPAuthResult result; 1178 if (pfnAuthEntry2) 1179 { 1180 result = pfnAuthEntry2(NULL, VRDPAuthGuestNotAsked, pcszUsername, pcszPassword, NULL, true, 0); 1181 AuthResult result; 1182 if (pfnAuthEntry3) 1183 { 1184 result = pfnAuthEntry3("webservice", NULL, AuthGuestNotAsked, pcszUsername, pcszPassword, NULL, true, 0); 1185 WEBDEBUG(("%s(): result of AuthEntry(): %d\n", __FUNCTION__, result)); 1186 if (result == AuthResultAccessGranted) 1187 rc = 0; 1188 } 1189 else if (pfnAuthEntry2) 1190 { 1191 result = pfnAuthEntry2(NULL, AuthGuestNotAsked, pcszUsername, pcszPassword, NULL, true, 0); 1181 1192 WEBDEBUG(("%s(): result of VRDPAuth2(): %d\n", __FUNCTION__, result)); 1182 if (result == VRDPAuthAccessGranted)1193 if (result == AuthResultAccessGranted) 1183 1194 rc = 0; 1184 1195 } 1185 1196 else if (pfnAuthEntry) 1186 1197 { 1187 result = pfnAuthEntry(NULL, VRDPAuthGuestNotAsked, pcszUsername, pcszPassword, NULL);1198 result = pfnAuthEntry(NULL, AuthGuestNotAsked, pcszUsername, pcszPassword, NULL); 1188 1199 WEBDEBUG(("%s(): result of VRDPAuth(%s, [%d]): %d\n", __FUNCTION__, pcszUsername, strlen(pcszPassword), result)); 1189 if (result == VRDPAuthAccessGranted)1200 if (result == AuthResultAccessGranted) 1190 1201 rc = 0; 1191 1202 } … … 1196 1207 else 1197 1208 { 1198 WEBDEBUG(("Could not resolve VRDPAuth2 or VRDPAuth entry point"));1209 WEBDEBUG(("Could not resolve AuthEntry, VRDPAuth2 or VRDPAuth entry point")); 1199 1210 } 1200 1211
Note:
See TracChangeset
for help on using the changeset viewer.