VirtualBox

Changeset 34558 in vbox


Ignore:
Timestamp:
Dec 1, 2010 10:56:44 AM (14 years ago)
Author:
vboxsync
Message:

Updated VBox authentication library interface, removed references to VRDP.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VRDPAuth.h

    r28800 r34558  
    11/** @file
    2  * VBox Remote Desktop Protocol - External Authentication Library Interface.
    3  * (VRDP)
     2 * VirtualBox External Authentication Library Interface.
    43 */
    54
    65/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    87 *
    98 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2928
    3029/* The following 2 enums are 32 bits values.*/
    31 typedef enum _VRDPAuthResult
     30typedef enum AuthResult
    3231{
    33     VRDPAuthAccessDenied    = 0,
    34     VRDPAuthAccessGranted   = 1,
    35     VRDPAuthDelegateToGuest = 2,
    36     VRDPAuthSizeHack        = 0x7fffffff
    37 } VRDPAuthResult;
     32    AuthResultAccessDenied    = 0,
     33    AuthResultAccessGranted   = 1,
     34    AuthResultDelegateToGuest = 2,
     35    AuthResultSizeHack        = 0x7fffffff
     36} AuthResult;
    3837
    39 typedef enum _VRDPAuthGuestJudgement
     38typedef enum AuthGuestJudgement
    4039{
    41     VRDPAuthGuestNotAsked      = 0,
    42     VRDPAuthGuestAccessDenied  = 1,
    43     VRDPAuthGuestNoJudgement   = 2,
    44     VRDPAuthGuestAccessGranted = 3,
    45     VRDPAuthGuestNotReacted    = 4,
    46     VRDPAuthGuestSizeHack      = 0x7fffffff
    47 } VRDPAuthGuestJudgement;
     40    AuthGuestNotAsked      = 0,
     41    AuthGuestAccessDenied  = 1,
     42    AuthGuestNoJudgement   = 2,
     43    AuthGuestAccessGranted = 3,
     44    AuthGuestNotReacted    = 4,
     45    AuthGuestSizeHack      = 0x7fffffff
     46} AuthGuestJudgement;
    4847
    4948/* UUID memory representation. Array of 16 bytes. */
    50 typedef unsigned char VRDPAUTHUUID[16];
    51 typedef VRDPAUTHUUID *PVRDPAUTHUUID;
     49typedef unsigned char AUTHUUID[16];
     50typedef AUTHUUID *PAUTHUUID;
    5251/*
    5352Note: VirtualBox uses a consistent binary representation of UUIDs on all platforms. For this reason
     
    6564/* The library entry point calling convention. */
    6665#ifdef _MSC_VER
    67 # define VRDPAUTHCALL __cdecl
     66# define AUTHCALL __cdecl
    6867#elif defined(__GNUC__)
    69 # define VRDPAUTHCALL
     68# define AUTHCALL
    7069#else
    7170# error "Unsupported compiler"
     
    7473
    7574/**
    76  * Authentication library entry point. Decides whether to allow
    77  * a client connection.
     75 * Authentication library entry point.
    7876 *
    7977 * Parameters:
    8078 *
    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.
    8380 *   guestJudgement   Result of the guest authentication.
    8481 *   szUser           User name passed in by the client (UTF8).
     
    8885 * Return code:
    8986 *
    90  *   VRDPAuthAccessDenied    Client access has been denied.
    91  *   VRDPAuthAccessGranted   Client has the right to use the
    92  *                           virtual machine.
    93  *   VRDPAuthDelegateToGuest Guest operating system must
    94  *                           authenticate the client and the
    95  *                           library must be called again with
    96  *                           the result of the guest
    97  *                           authentication.
     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.
    9895 */
    99 typedef VRDPAuthResult VRDPAUTHCALL VRDPAUTHENTRY(PVRDPAUTHUUID pUuid,
    100                                                   VRDPAuthGuestJudgement guestJudgement,
    101                                                   const char *szUser,
    102                                                   const char *szPassword,
    103                                                   const char *szDomain);
     96typedef AuthResult AUTHCALL AUTHENTRY(PAUTHUUID pUuid,
     97                                      AuthGuestJudgement guestJudgement,
     98                                      const char *szUser,
     99                                      const char *szPassword,
     100                                      const char *szDomain);
    104101
    105102
    106 typedef VRDPAUTHENTRY *PVRDPAUTHENTRY;
     103typedef AUTHENTRY *PAUTHENTRY;
     104
     105#define AUTHENTRY_NAME "VRDPAuth"
    107106
    108107/**
    109  * Authentication library entry point version 2. Decides whether to allow
    110  * a client connection.
     108 * Authentication library entry point version 2.
    111109 *
    112110 * Parameters:
    113111 *
    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.
    116113 *   guestJudgement   Result of the guest authentication.
    117114 *   szUser           User name passed in by the client (UTF8).
     
    124121 * Return code:
    125122 *
    126  *   VRDPAuthAccessDenied    Client access has been denied.
    127  *   VRDPAuthAccessGranted   Client has the right to use the
    128  *                           virtual machine.
    129  *   VRDPAuthDelegateToGuest Guest operating system must
    130  *                           authenticate the client and the
    131  *                           library must be called again with
    132  *                           the result of the guest
    133  *                           authentication.
     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.
    134131 *
    135132 * Note: When 'fLogon' is 0, only pUuid and clientId are valid and the return
    136133 *       code is ignored.
    137134 */
    138 typedef VRDPAuthResult VRDPAUTHCALL VRDPAUTHENTRY2(PVRDPAUTHUUID pUuid,
    139                                                    VRDPAuthGuestJudgement guestJudgement,
    140                                                    const char *szUser,
    141                                                    const char *szPassword,
    142                                                    const char *szDomain,
    143                                                    int fLogon,
    144                                                    unsigned clientId);
     135typedef 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);
    145142
    146143
    147 typedef VRDPAUTHENTRY2 *PVRDPAUTHENTRY2;
     144typedef 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 */
     177typedef 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
     187typedef AUTHENTRY3 *PAUTHENTRY3;
     188
     189#define AUTHENTRY3_NAME "AuthEntry"
    148190
    149191#endif
  • trunk/src/VBox/HostServices/auth/Makefile.kmk

    r33185 r34558  
    4444# Install the SDK samples.
    4545INSTALLS += VBoxAuth-samples
    46 VBoxAuth-samples_INST = $(INST_SDK)/bindings/vrdpauth/
     46VBoxAuth-samples_INST = $(INST_SDK)/bindings/auth/
    4747VBoxAuth-samples_MODE = a+r,u+w
    4848VBoxAuth-samples_SOURCES = simple/VBoxAuthSimple.cpp
     
    5252# Install the SDK header.
    5353INSTALLS += VBoxAuth-sdkhdr
    54 VBoxAuth-sdkhdr_INST = $(INST_SDK)/bindings/vrdpauth/include/
     54VBoxAuth-sdkhdr_INST = $(INST_SDK)/bindings/auth/include/
    5555VBoxAuth-sdkhdr_MODE = a+r,u+w
    5656VBoxAuth-sdkhdr_SOURCES = $(PATH_ROOT)/include/VBox/VRDPAuth.h=>VRDPAuth.h
  • trunk/src/VBox/HostServices/auth/directoryservice/directoryservice.cpp

    r33185 r34558  
    258258
    259259RT_C_DECLS_BEGIN
    260 DECLEXPORT(VRDPAuthResult) VRDPAUTHCALL VRDPAuth(PVRDPAUTHUUID pUuid,
    261                                                  VRDPAuthGuestJudgement guestJudgement,
    262                                                  const char *pszUser,
    263                                                  const char *pszPassword,
    264                                                  const char *pszDomain)
     260DECLEXPORT(AuthResult) AUTHCALL VRDPAuth(PAUTHUUID pUuid,
     261                                         AuthGuestJudgement guestJudgement,
     262                                         const char *pszUser,
     263                                         const char *pszPassword,
     264                                         const char *pszDomain)
    265265{
    266266    /* Validate input */
    267     AssertPtrReturn(pszUser, VRDPAuthAccessDenied);
    268     AssertPtrReturn(pszPassword, VRDPAuthAccessDenied);
     267    AssertPtrReturn(pszUser, AuthResultAccessDenied);
     268    AssertPtrReturn(pszPassword, AuthResultAccessDenied);
    269269
    270270    /* Result to a default value */
    271     VRDPAuthResult result = VRDPAuthAccessDenied;
     271    AuthResult result = AuthResultAccessDenied;
    272272
    273273    tDirStatus dsErr = eDSNoErr;
     
    299299                    dsErr = authWithNode(pDirRef, pAuthNodeList, pszUser, pszPassword);
    300300                    if (dsErr == eDSNoErr)
    301                         result = VRDPAuthAccessGranted;
     301                        result = AuthResultAccessGranted;
    302302                    dsCleanErr = dsDataListDeallocate(pDirRef, pAuthNodeList);
    303303                    if (dsCleanErr == eDSNoErr)
     
    317317RT_C_DECLS_END
    318318
    319 static PVRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;
    320 
     319static PAUTHENTRY gpfnAuthEntry = VRDPAuth;
     320
  • trunk/src/VBox/HostServices/auth/pam/VBoxAuthPAM.c

    r33185 r34558  
    147147};
    148148
    149 static int vrdpauth_pam_init(void)
     149static int auth_pam_init(void)
    150150{
    151151    SymMap *iter;
     
    155155    if (!gpvLibPam)
    156156    {
    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);
    158158        return PAM_SYSTEM_ERR;
    159159    }
     
    167167        if (pv == NULL)
    168168        {
    169             debug_printf("vrdpauth_pam_init: dlsym %s failed\n", iter->pszName);
     169            debug_printf("auth_pam_init: dlsym %s failed\n", iter->pszName);
    170170
    171171            dlclose(gpvLibPam);
     
    183183}
    184184
    185 static void vrdpauth_pam_close(void)
     185static void auth_pam_close(void)
    186186{
    187187    if (gpvLibPam)
     
    194194}
    195195#else
    196 static int vrdpauth_pam_init(void)
     196static int auth_pam_init(void)
    197197{
    198198    return PAM_SUCCESS;
    199199}
    200200
    201 static void vrdpauth_pam_close(void)
     201static void auth_pam_close(void)
    202202{
    203203    return;
     
    205205#endif /* VRDP_PAM_DLLOAD */
    206206
    207 static const char *vrdpauth_get_pam_service (void)
     207static const char *auth_get_pam_service (void)
    208208{
    209209    const char *service = getenv (VRDP_AUTH_PAM_SERVICE_NAME_ENV);
     
    273273}
    274274
    275 /* The VRDPAuth entry point must be visible. */
     275/* The entry point must be visible. */
    276276#if defined(_MSC_VER) || defined(__OS2__)
    277277# define DECLEXPORT(type)       __declspec(dllexport) type
     
    285285
    286286/* prototype to prevent gcc warning */
    287 DECLEXPORT(VRDPAuthResult) VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid,
    288                                                   VRDPAuthGuestJudgement guestJudgement,
    289                                                   const char *szUser,
    290                                                   const char *szPassword,
    291                                                   const char *szDomain);
    292 DECLEXPORT(VRDPAuthResult) VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid,
    293                                                   VRDPAuthGuestJudgement guestJudgement,
    294                                                   const char *szUser,
    295                                                   const char *szPassword,
    296                                                   const char *szDomain)
    297 {
    298     VRDPAuthResult result = VRDPAuthAccessDenied;
     287DECLEXPORT(AuthResult) AUTHCALL VRDPAuth (PAUTHUUID pUuid,
     288                                          AuthGuestJudgement guestJudgement,
     289                                          const char *szUser,
     290                                          const char *szPassword,
     291                                          const char *szDomain);
     292DECLEXPORT(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;
    299299
    300300    int rc;
     
    313313    pam_conversation.appdata_ptr = &ctx;
    314314
    315     rc = vrdpauth_pam_init ();
     315    rc = auth_pam_init ();
    316316
    317317    if (rc == PAM_SUCCESS)
     
    319319        debug_printf("init ok\n");
    320320
    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);
    322322
    323323        if (rc == PAM_SUCCESS)
     
    344344                    debug_printf("access granted\n");
    345345
    346                     result = VRDPAuthAccessGranted;
     346                    result = AuthResultAccessGranted;
    347347                }
    348348                else
     
    363363        }
    364364
    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");
    368368    }
    369369    else
    370370    {
    371         debug_printf("vrdpauth_pam_init failed %d\n", rc);
     371        debug_printf("auth_pam_init failed %d\n", rc);
    372372    }
    373373
     
    376376
    377377/* Verify the function prototype. */
    378 static PVRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;
     378static PAUTHENTRY gpfnAuthEntry = VRDPAuth;
  • trunk/src/VBox/HostServices/auth/simple/VBoxAuthSimple.cpp

    r33294 r34558  
    5151
    5252    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    }
    5558
    5659    va_end (va);
     
    5962
    6063RT_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)
     64DECLEXPORT(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)
    6872{
    6973    /* default is failed */
    70     VRDPAuthResult result = VRDPAuthAccessDenied;
     74    AuthResult result = AuthResultAccessDenied;
    7175
    7276    /* only interested in logon */
     
    117121
    118122            if (password == pszDigest)
    119                 result = VRDPAuthAccessGranted;
     123                result = AuthResultAccessGranted;
    120124        }
    121125    }
     
    126130
    127131/* Verify the function prototype. */
    128 static PVRDPAUTHENTRY2 gpfnAuthEntry = VRDPAuth2;
     132static PAUTHENTRY3 gpfnAuthEntry = AuthEntry;
  • trunk/src/VBox/HostServices/auth/winlogon/winlogon.cpp

    r33185 r34558  
    1919
    2020/* 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"
    2222
    2323#include <stdio.h>
     
    3030static void dprintf(const char *fmt, ...)
    3131{
     32#ifdef AUTH_DEBUG_FILE_NAME
    3233   va_list va;
    3334
     
    4041   OutputDebugStringA(buffer);
    4142
    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   }
    4749
    4850   va_end (va);
     51#endif
    4952}
    5053
     
    5356__declspec(dllexport)
    5457#endif
    55 VRDPAuthResult VRDPAUTHCALL VRDPAuth (PVRDPAUTHUUID pUuid,
    56                                       VRDPAuthGuestJudgement guestJudgement,
    57                                       const char *szUser,
    58                                       const char *szPassword,
    59                                       const char *szDomain)
     58AuthResult 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)
    6066{
    61     VRDPAuthResult result = VRDPAuthAccessDenied;
     67    AuthResult result = AuthResultAccessDenied;
    6268
    6369    LPTSTR lpszUsername = (char *)szUser;
     
    8692        dprintf("LogonUser success. hToken = %p\n", hToken);
    8793
    88         result = VRDPAuthAccessGranted;
     94        result = AuthResultAccessGranted;
    8995
    9096        CloseHandle (hToken);
     
    99105
    100106/* Verify the function prototype. */
    101 static PVRDPAUTHENTRY gpfnAuthEntry = VRDPAuth;
     107static PAUTHENTRY3 gpfnAuthEntry = AuthEntry;
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r34512 r34558  
    743743    {
    744744        /* Console has been already uninitialized, deny request */
    745         LogRel(("VRDPAUTH: Access denied (Console uninitialized).\n"));
     745        LogRel(("AUTH: Access denied (Console uninitialized).\n"));
    746746        LogFlowFuncLeave();
    747747        return VERR_ACCESS_DENIED;
     
    762762    AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
    763763
    764     VRDPAuthResult result = VRDPAuthAccessDenied;
    765     VRDPAuthGuestJudgement guestJudgement = VRDPAuthGuestNotAsked;
     764    AuthResult result = AuthResultAccessDenied;
     765    AuthGuestJudgement guestJudgement = AuthGuestNotAsked;
    766766
    767767    LogFlowFunc(("Auth type %d\n", authType));
    768768
    769     LogRel(("VRDPAUTH: User: [%s]. Domain: [%s]. Authentication type: [%s]\n",
     769    LogRel(("AUTH: User: [%s]. Domain: [%s]. Authentication type: [%s]\n",
    770770                pszUser, pszDomain,
    771771                authType == AuthType_Null?
     
    784784        case AuthType_Null:
    785785        {
    786             result = VRDPAuthAccessGranted;
     786            result = AuthResultAccessGranted;
    787787            break;
    788788        }
     
    793793            result = mConsoleVRDPServer->Authenticate(uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId);
    794794
    795             if (result != VRDPAuthDelegateToGuest)
     795            if (result != AuthResultDelegateToGuest)
    796796            {
    797797                break;
    798798            }
    799799
    800             LogRel(("VRDPAUTH: Delegated to guest.\n"));
     800            LogRel(("AUTH: Delegated to guest.\n"));
    801801
    802802            LogFlowFunc(("External auth asked for guest judgement\n"));
     
    805805        case AuthType_Guest:
    806806        {
    807             guestJudgement = VRDPAuthGuestNotReacted;
     807            guestJudgement = AuthGuestNotReacted;
    808808
    809809            // @todo r=dj locking required here for m_pVMMDev?
     
    829829                        switch (u32GuestFlags & (VMMDEV_CREDENTIALS_JUDGE_OK | VMMDEV_CREDENTIALS_JUDGE_DENY | VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT))
    830830                        {
    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;
    834834                            default:
    835835                                LogFlowFunc(("Invalid guest flags %08X!!!\n", u32GuestFlags)); break;
     
    851851            if (authType == AuthType_External)
    852852            {
    853                 LogRel(("VRDPAUTH: Guest judgement %d.\n", guestJudgement));
     853                LogRel(("AUTH: Guest judgement %d.\n", guestJudgement));
    854854                LogFlowFunc(("External auth called again with guest judgement = %d\n", guestJudgement));
    855855                result = mConsoleVRDPServer->Authenticate(uuid, guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId);
     
    859859                switch (guestJudgement)
    860860                {
    861                     case VRDPAuthGuestAccessGranted:
    862                         result = VRDPAuthAccessGranted;
     861                    case AuthGuestAccessGranted:
     862                        result = AuthResultAccessGranted;
    863863                        break;
    864864                    default:
    865                         result = VRDPAuthAccessDenied;
     865                        result = AuthResultAccessDenied;
    866866                        break;
    867867                }
     
    876876    LogFlowFuncLeave();
    877877
    878     if (result != VRDPAuthAccessGranted)
     878    if (result != AuthResultAccessGranted)
    879879    {
    880880        /* Reject. */
    881         LogRel(("VRDPAUTH: Access denied.\n"));
     881        LogRel(("AUTH: Access denied.\n"));
    882882        return VERR_ACCESS_DENIED;
    883883    }
    884884
    885     LogRel(("VRDPAUTH: Access granted.\n"));
     885    LogRel(("AUTH: Access granted.\n"));
    886886
    887887    /* Multiconnection check must be made after authentication, so bad clients would not interfere with a good one. */
     
    910910            if (reuseSingleConnection)
    911911            {
    912                 LogRel(("VRDPAUTH: Multiple connections are not enabled. Disconnecting existing client.\n"));
     912                LogRel(("AUTH: Multiple connections are not enabled. Disconnecting existing client.\n"));
    913913                mConsoleVRDPServer->DisconnectClient(mu32SingleRDPClientId, false);
    914914            }
     
    916916            {
    917917                /* Reject. */
    918                 LogRel(("VRDPAUTH: Multiple connections are not enabled. Access denied.\n"));
     918                LogRel(("AUTH: Multiple connections are not enabled. Access denied.\n"));
    919919                return VERR_ACCESS_DENIED;
    920920            }
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r34244 r34558  
    13471347    mpfnAuthEntry = NULL;
    13481348    mpfnAuthEntry2 = NULL;
     1349    mpfnAuthEntry3 = NULL;
    13491350
    13501351    if (mAuthLibrary)
     
    14711472#endif /* VBOX_WITH_USB */
    14721473
    1473 VRDPAuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,
     1474AuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, AuthGuestJudgement guestJudgement,
    14741475                                                const char *pszUser, const char *pszPassword, const char *pszDomain,
    14751476                                                uint32_t u32ClientId)
    14761477{
    1477     VRDPAUTHUUID rawuuid;
     1478    AUTHUUID rawuuid;
    14781479
    14791480    memcpy(rawuuid, uuid.raw(), sizeof(rawuuid));
     
    15041505        Utf8Str filename = authLibrary;
    15051506
    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()));
    15071508
    15081509        int rc;
     
    15131514
    15141515        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));
    15161517
    15171518        if (RT_SUCCESS(rc))
    15181519        {
     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
    15191534            /* 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
    15241549                if (rc2 != VERR_SYMBOL_NOT_FOUND)
    15251550                {
    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));
    15271552                }
    15281553                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++;
    15471556            }
    15481557        }
     
    15571566            mpfnAuthEntry = NULL;
    15581567            mpfnAuthEntry2 = NULL;
     1568            mpfnAuthEntry3 = NULL;
    15591569
    15601570            if (mAuthLibrary)
     
    15641574            }
    15651575
    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    }
    15751595
    15761596    switch (result)
    15771597    {
    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"));
    15801600            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"));
    15831603            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"));
    15861606            break;
    15871607        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;
    15901610    }
    15911611
     
    15971617void ConsoleVRDPServer::AuthDisconnect(const Guid &uuid, uint32_t u32ClientId)
    15981618{
    1599     VRDPAUTHUUID rawuuid;
     1619    AUTHUUID rawuuid;
    16001620
    16011621    memcpy(rawuuid, uuid.raw(), sizeof(rawuuid));
     
    16041624             rawuuid, u32ClientId));
    16051625
    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);
    16101632}
    16111633
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r33590 r34558  
    9090    void Stop (void);
    9191
    92     VRDPAuthResult Authenticate (const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,
    93                                  const char *pszUser, const char *pszPassword, const char *pszDomain,
    94                                  uint32_t u32ClientId);
     92    AuthResult Authenticate (const Guid &uuid, AuthGuestJudgement guestJudgement,
     93                             const char *pszUser, const char *pszPassword, const char *pszDomain,
     94                             uint32_t u32ClientId);
    9595
    9696    void AuthDisconnect (const Guid &uuid, uint32_t u32ClientId);
     
    209209     */
    210210    RTLDRMOD mAuthLibrary;
    211     PVRDPAUTHENTRY mpfnAuthEntry;
    212     PVRDPAUTHENTRY2 mpfnAuthEntry2;
     211    PAUTHENTRY mpfnAuthEntry;
     212    PAUTHENTRY2 mpfnAuthEntry2;
     213    PAUTHENTRY3 mpfnAuthEntry3;
    213214};
    214215
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r33540 r34558  
    11311131
    11321132    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;
    11351136
    11361137    if (!fAuthLibLoaded)
     
    11611162                }
    11621163
    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)
    11701174                    fAuthLibLoaded = true;
    11711175
     
    11751179
    11761180    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);
    11811192        WEBDEBUG(("%s(): result of VRDPAuth2(): %d\n", __FUNCTION__, result));
    1182         if (result == VRDPAuthAccessGranted)
     1193        if (result == AuthResultAccessGranted)
    11831194            rc = 0;
    11841195    }
    11851196    else if (pfnAuthEntry)
    11861197    {
    1187         result = pfnAuthEntry(NULL, VRDPAuthGuestNotAsked, pcszUsername, pcszPassword, NULL);
     1198        result = pfnAuthEntry(NULL, AuthGuestNotAsked, pcszUsername, pcszPassword, NULL);
    11881199        WEBDEBUG(("%s(): result of VRDPAuth(%s, [%d]): %d\n", __FUNCTION__, pcszUsername, strlen(pcszPassword), result));
    1189         if (result == VRDPAuthAccessGranted)
     1200        if (result == AuthResultAccessGranted)
    11901201            rc = 0;
    11911202    }
     
    11961207    else
    11971208    {
    1198         WEBDEBUG(("Could not resolve VRDPAuth2 or VRDPAuth entry point"));
     1209        WEBDEBUG(("Could not resolve AuthEntry, VRDPAuth2 or VRDPAuth entry point"));
    11991210    }
    12001211
Note: See TracChangeset for help on using the changeset viewer.

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