Changeset 44468 in vbox
- Timestamp:
- Jan 30, 2013 2:58:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r44191 r44468 2958 2958 #endif /* VBOX_WITH_USB */ 2959 2959 2960 typedef struct AuthCtx 2961 { 2962 AuthResult result; 2963 2964 PAUTHENTRY3 pfnAuthEntry3; 2965 PAUTHENTRY2 pfnAuthEntry2; 2966 PAUTHENTRY pfnAuthEntry; 2967 2968 const char *pszCaller; 2969 PAUTHUUID pUuid; 2970 AuthGuestJudgement guestJudgement; 2971 const char *pszUser; 2972 const char *pszPassword; 2973 const char *pszDomain; 2974 int fLogon; 2975 unsigned clientId; 2976 } AuthCtx; 2977 2978 static DECLCALLBACK(int) authThread(RTTHREAD self, void *pvUser) 2979 { 2980 AuthCtx *pCtx = (AuthCtx *)pvUser; 2981 2982 if (pCtx->pfnAuthEntry3) 2983 { 2984 pCtx->result = pCtx->pfnAuthEntry3(pCtx->pszCaller, pCtx->pUuid, pCtx->guestJudgement, 2985 pCtx->pszUser, pCtx->pszPassword, pCtx->pszDomain, 2986 pCtx->fLogon, pCtx->clientId); 2987 } 2988 else if (pCtx->pfnAuthEntry2) 2989 { 2990 pCtx->result = pCtx->pfnAuthEntry2(pCtx->pUuid, pCtx->guestJudgement, 2991 pCtx->pszUser, pCtx->pszPassword, pCtx->pszDomain, 2992 pCtx->fLogon, pCtx->clientId); 2993 } 2994 else if (pCtx->pfnAuthEntry) 2995 { 2996 pCtx->result = pCtx->pfnAuthEntry(pCtx->pUuid, pCtx->guestJudgement, 2997 pCtx->pszUser, pCtx->pszPassword, pCtx->pszDomain); 2998 } 2999 return VINF_SUCCESS; 3000 } 3001 3002 static AuthResult authCall(AuthCtx *pCtx) 3003 { 3004 AuthResult result = AuthResultAccessDenied; 3005 3006 /* Use a separate thread because external modules might need a lot of stack space. */ 3007 RTTHREAD thread = NIL_RTTHREAD; 3008 int rc = RTThreadCreate(&thread, authThread, pCtx, 512*_1K, 3009 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "VRDEAuth"); 3010 LogFlow(("authCall: RTThreadCreate %Rrc\n", rc)); 3011 3012 if (RT_SUCCESS(rc)) 3013 { 3014 rc = RTThreadWait(thread, RT_INDEFINITE_WAIT, NULL); 3015 LogFlow(("authCall: RTThreadWait %Rrc\n", rc)); 3016 } 3017 3018 if (RT_SUCCESS(rc)) 3019 { 3020 /* Only update the result if the thread finished without errors. */ 3021 result = pCtx->result; 3022 } 3023 else 3024 { 3025 LogRel(("AUTH: unable to execute the auth thread %Rrc\n", rc)); 3026 } 3027 3028 return result; 3029 } 3030 2960 3031 AuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, AuthGuestJudgement guestJudgement, 2961 3032 const char *pszUser, const char *pszPassword, const char *pszDomain, … … 2981 3052 Utf8Str filename = authLibrary; 2982 3053 2983 LogRel(("AUTH: ConsoleVRDPServer::Authenticate:loading external authentication library '%ls'\n", authLibrary.raw()));3054 LogRel(("AUTH: loading external authentication library '%ls'\n", authLibrary.raw())); 2984 3055 2985 3056 int rc; … … 3069 3140 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2 || mpfnAuthEntry3)); 3070 3141 3071 AuthResult result = AuthResultAccessDenied; 3072 if (mpfnAuthEntry3) 3073 { 3074 result = mpfnAuthEntry3("vrde", &rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId); 3075 } 3076 else if (mpfnAuthEntry2) 3077 { 3078 result = mpfnAuthEntry2(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain, true, u32ClientId); 3079 } 3080 else if (mpfnAuthEntry) 3081 { 3082 result = mpfnAuthEntry(&rawuuid, guestJudgement, pszUser, pszPassword, pszDomain); 3083 } 3142 AuthCtx ctx; 3143 ctx.result = AuthResultAccessDenied; /* Denied by default. */ 3144 ctx.pfnAuthEntry3 = mpfnAuthEntry3; 3145 ctx.pfnAuthEntry2 = mpfnAuthEntry2; 3146 ctx.pfnAuthEntry = mpfnAuthEntry; 3147 ctx.pszCaller = "vrde"; 3148 ctx.pUuid = &rawuuid; 3149 ctx.guestJudgement = guestJudgement; 3150 ctx.pszUser = pszUser; 3151 ctx.pszPassword = pszPassword; 3152 ctx.pszDomain = pszDomain; 3153 ctx.fLogon = true; 3154 ctx.clientId = u32ClientId; 3155 3156 AuthResult result = authCall(&ctx); 3084 3157 3085 3158 switch (result) … … 3115 3188 Assert(mAuthLibrary && (mpfnAuthEntry || mpfnAuthEntry2 || mpfnAuthEntry3)); 3116 3189 3117 if (mpfnAuthEntry3) 3118 mpfnAuthEntry3("vrde", &rawuuid, AuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 3119 else if (mpfnAuthEntry2) 3120 mpfnAuthEntry2(&rawuuid, AuthGuestNotAsked, NULL, NULL, NULL, false, u32ClientId); 3190 AuthCtx ctx; 3191 ctx.result = AuthResultAccessDenied; /* Not used. */ 3192 ctx.pfnAuthEntry3 = mpfnAuthEntry3; 3193 ctx.pfnAuthEntry2 = mpfnAuthEntry2; 3194 ctx.pfnAuthEntry = NULL; /* Does not use disconnect notification. */ 3195 ctx.pszCaller = "vrde"; 3196 ctx.pUuid = &rawuuid; 3197 ctx.guestJudgement = AuthGuestNotAsked; 3198 ctx.pszUser = NULL; 3199 ctx.pszPassword = NULL; 3200 ctx.pszDomain = NULL; 3201 ctx.fLogon = false; 3202 ctx.clientId = u32ClientId; 3203 3204 authCall(&ctx); 3121 3205 } 3122 3206
Note:
See TracChangeset
for help on using the changeset viewer.