Changeset 25849 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jan 15, 2010 10:33:22 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56637
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGINA/Dialog.cpp
r22239 r25849 19 19 20 20 #include <windows.h> 21 #include <stdio.h> /* Needed for swprintf() */ 21 22 #include "Dialog.h" 22 23 #include "WinWlx.h" … … 156 157 if (credentialsRetrieve()) 157 158 { 158 if (hwndUserId) 159 SendMessage(hwndUserId, WM_SETTEXT, 0, (LPARAM)g_Username); 160 if (hwndPassword) 161 SendMessage(hwndPassword, WM_SETTEXT, 0, (LPARAM)g_Password); 159 BOOL bIsFQDN = FALSE; 160 wchar_t szUserFQDN[512]; /* VMMDEV_CREDENTIALS_STRLEN + 255 bytes max. for FQDN */ 162 161 if (hwndDomain) 163 162 { 164 163 /* search the domain combo box for our required domain and select it */ 165 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Find domain entry...\n"));164 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Trying to find domain entry in combo box ...\n")); 166 165 DWORD dwIndex = (DWORD) SendMessage(hwndDomain, CB_FINDSTRING, 167 166 0, (LPARAM)g_Domain); 168 167 if (dwIndex != CB_ERR) 169 168 { 170 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Found domain at pos %ld\n", dwIndex));169 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Found domain at combo box pos %ld\n", dwIndex)); 171 170 SendMessage(hwndDomain, CB_SETCURSEL, (WPARAM) dwIndex, 0); 172 171 EnableWindow(hwndDomain, FALSE); 173 172 } 174 else Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Domain entry not found!")); 173 else 174 { 175 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Domain not found in combo box ...\n")); 176 177 /* If the domain value has a dot (.) in it, it is a FQDN (Fully Qualified Domain Name) 178 * which will not work with the combo box selection because Windows only keeps the 179 * NETBIOS names to the left most part of the domain name there. Of course a FQDN 180 * then will not be found by the search in the block below. 181 * 182 * To solve this problem the FQDN domain value will be appended at the user name value 183 * (Kerberos style) using an "@", e.g. "<user-name>@full.qualified.domain". 184 * 185 */ 186 size_t l = wcslen(g_Domain); 187 if (l > 255) 188 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Warning! FQDN is too long (max 255 bytes), will be truncated!\n")); 189 190 if ( l > 0 191 && wcslen(g_Username) > 0 192 && wcsstr(g_Domain, L".") != NULL) /* if we found a dot (.) in the domain name, this has to be a FQDN */ 193 { 194 Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Domain seems to be a FQDN!\n")); 195 swprintf(szUserFQDN, sizeof(szUserFQDN) / sizeof(wchar_t), L"%s@%s", g_Username, g_Domain); 196 bIsFQDN = TRUE; 197 } 198 } 175 199 } 200 if (hwndUserId) 201 { 202 if (!bIsFQDN) 203 SendMessage(hwndUserId, WM_SETTEXT, 0, (LPARAM)g_Username); 204 else 205 SendMessage(hwndUserId, WM_SETTEXT, 0, (LPARAM)szUserFQDN); 206 } 207 if (hwndPassword) 208 SendMessage(hwndPassword, WM_SETTEXT, 0, (LPARAM)g_Password); 176 209 177 210 /* we got the credentials, null them out */
Note:
See TracChangeset
for help on using the changeset viewer.