VirtualBox

Changeset 25849 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Jan 15, 2010 10:33:22 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56637
Message:

VBoxGINA: Added handling for FQDN values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/Dialog.cpp

    r22239 r25849  
    1919
    2020#include <windows.h>
     21#include <stdio.h>      /* Needed for swprintf() */
    2122#include "Dialog.h"
    2223#include "WinWlx.h"
     
    156157                if (credentialsRetrieve())
    157158                {
    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 */
    162161                    if (hwndDomain)
    163162                    {
    164163                        /* 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"));
    166165                        DWORD dwIndex = (DWORD) SendMessage(hwndDomain, CB_FINDSTRING,
    167166                                                            0, (LPARAM)g_Domain);
    168167                        if (dwIndex != CB_ERR)
    169168                        {
    170                             Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Found domain at pos %ld\n", dwIndex));
     169                            Log(("VBoxGINA::MyWlxLoggedOutSASDlgProc: Found domain at combo box pos %ld\n", dwIndex));
    171170                            SendMessage(hwndDomain, CB_SETCURSEL, (WPARAM) dwIndex, 0);
    172171                            EnableWindow(hwndDomain, FALSE);
    173172                        }
    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                        }
    175199                    }
     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);
    176209
    177210                    /* we got the credentials, null them out */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette