Changeset 33228 in vbox for trunk/src/VBox/HostServices/auth
- Timestamp:
- Oct 19, 2010 1:12:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/auth/simple/VBoxAuthSimple.cpp
r33185 r33228 24 24 #include <iprt/cdefs.h> 25 25 #include <iprt/uuid.h> 26 #include <iprt/sha.h> 26 27 27 28 #include <VBox/VRDPAuth.h> … … 85 86 user = (char*)szUser; 86 87 87 dprintf("VRDPAuth: uuid: %s, user: %s, szPassword: %s\n", uuid, user, szPassword); 88 89 #if 0 90 /* this is crude stuff, but let's keep it there as a sample */ 91 if (getenv("VBOX_VRDP_AUTH_USER") && getenv("VBOX_VRDP_AUTH_PASSWORD")) 92 { 93 94 if ( !strcmp(getenv("VBOX_VRDP_AUTH_USER"), user) 95 && !strcmp(getenv("VBOX_VRDP_AUTH_PASSWORD"), szPassword)) 96 { 97 result = VRDPAuthAccessGranted; 98 } 99 } 100 #endif 88 dprintf("VBoxAuth: uuid: %s, user: %s, szPassword: %s\n", uuid, user, szPassword); 101 89 102 90 ComPtr<IVirtualBox> virtualBox; … … 106 94 if (SUCCEEDED(rc)) 107 95 { 108 Bstr key = BstrFmt("V RDPAuthSimple/users/%s", user);96 Bstr key = BstrFmt("VBoxAuthSimple/users/%s", user); 109 97 Bstr password; 110 98 … … 120 108 virtualBox->GetExtraData(key.raw(), password.asOutParam()); 121 109 122 /* we compare the password or check for special NULL marker */ 123 if ( (!password.isEmpty() && (password == szPassword)) 124 || ((password == "[NULL]") && (!szPassword || (*szPassword == '\0')))) 110 if (!password.isEmpty()) 125 111 { 126 result = VRDPAuthAccessGranted; 112 /* calculate hash */ 113 uint8_t abDigest[RTSHA256_HASH_SIZE]; 114 RTSha256(szPassword, strlen(szPassword), abDigest); 115 char pszDigest[RTSHA256_STRING_LEN + 1]; 116 RTSha256ToString(abDigest, pszDigest, sizeof(pszDigest)); 117 118 if (password == pszDigest) 119 result = VRDPAuthAccessGranted; 127 120 } 128 121 }
Note:
See TracChangeset
for help on using the changeset viewer.