Changeset 59134 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Dec 15, 2015 2:55:18 PM (9 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.h
r58029 r59134 209 209 /** Password of specified user name (account). */ 210 210 char szPassword[GUESTPROCESS_MAX_PASSWORD_LEN]; 211 /** Domain to be used for authenticating the specified user name (account). */ 212 char szDomain[GUESTPROCESS_MAX_DOMAIN_LEN]; 211 213 /** Time limit (in ms) of the process' life time. */ 212 214 uint32_t uTimeLimitMS; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r59131 r59134 1204 1204 * @param pszAsUser User name (account) to start the process under. 1205 1205 * @param pszPassword Password of the specified user. 1206 * @param pszDomain Domain to use for authentication. 1206 1207 * @param phProcess Pointer which will receive the process handle after 1207 1208 * successful process start. … … 1209 1210 static int vgsvcGstCtrlProcessCreateProcess(const char *pszExec, const char * const *papszArgs, RTENV hEnv, uint32_t fFlags, 1210 1211 PCRTHANDLE phStdIn, PCRTHANDLE phStdOut, PCRTHANDLE phStdErr, const char *pszAsUser, 1211 const char *pszPassword, PRTPROCESS phProcess)1212 const char *pszPassword, const char *pszDomain, PRTPROCESS phProcess) 1212 1213 { 1213 1214 AssertPtrReturn(pszExec, VERR_INVALID_PARAMETER); … … 1350 1351 VGSvcVerbose(3, "Starting process '%s' ...\n", szExecExp); 1351 1352 1353 const char *pszUser; 1354 #ifdef RT_OS_WINDOWS 1355 /* If a domain name is given, construct an UPN (User Principle Name) with 1356 * the domain name built-in, e.g. "[email protected]". */ 1357 char *pszUserUPN = NULL; 1358 if (strlen(pszDomain)) 1359 { 1360 int cbUserUPN = RTStrAPrintf(&pszUserUPN, "%s@%s", pszAsUser, pszDomain); 1361 if (cbUserUPN > 0) 1362 { 1363 pszUser = pszUserUPN; 1364 VGSvcVerbose(3, "Using UPN: %s\n", pszUserUPN); 1365 } 1366 } 1367 1368 if (!pszUserUPN) /* Fallback */ 1369 #endif 1370 pszUser = pszAsUser; 1371 1352 1372 /* Do normal execution. */ 1353 1373 rc = RTProcCreateEx(szExecExp, papszArgsExp, hEnv, uProcFlags, 1354 1374 phStdIn, phStdOut, phStdErr, 1355 psz AsUser && *pszAsUser ? pszAsUser : NULL,1375 pszUser, 1356 1376 pszPassword && *pszPassword ? pszPassword : NULL, 1357 1377 phProcess); 1358 1378 #ifdef RT_OS_WINDOWS 1379 if (pszUserUPN) 1380 RTStrFree(pszUserUPN); 1381 #endif 1359 1382 VGSvcVerbose(3, "Starting process '%s' returned rc=%Rrc\n", szExecExp, rc); 1360 1383 … … 1575 1598 pProcess->StartupInfo.uFlags, 1576 1599 phStdIn, phStdOut, phStdErr, 1577 fNeedsImpersonation ? pProcess->StartupInfo.szUser : NULL,1600 fNeedsImpersonation ? pProcess->StartupInfo.szUser : NULL, 1578 1601 fNeedsImpersonation ? pProcess->StartupInfo.szPassword : NULL, 1602 fNeedsImpersonation ? pProcess->StartupInfo.szDomain : NULL, 1579 1603 &pProcess->hProcess); 1580 1604 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r58089 r59134 1712 1712 apszArgs[idxArg++] = "--user"; 1713 1713 apszArgs[idxArg++] = pSessionThread->StartupInfo.szUser; 1714 1715 if (strlen(pSessionThread->StartupInfo.szDomain)) 1716 { 1717 apszArgs[idxArg++] = "--domain"; 1718 apszArgs[idxArg++] = pSessionThread->StartupInfo.szDomain; 1719 } 1714 1720 } 1715 1721 … … 1836 1842 hStdOutAndErr.enmType = RTHANDLETYPE_FILE; 1837 1843 1844 const char *pszUser; 1845 #ifdef RT_OS_WINDOWS 1846 /* If a domain name is given, construct an UPN (User Principle Name) with 1847 * the domain name built-in, e.g. "[email protected]". */ 1848 char *pszUserUPN = NULL; 1849 if (strlen(pSessionThread->StartupInfo.szDomain)) 1850 { 1851 int cbUserUPN = RTStrAPrintf(&pszUserUPN, "%s@%s", 1852 pSessionThread->StartupInfo.szUser, 1853 pSessionThread->StartupInfo.szDomain); 1854 if (cbUserUPN > 0) 1855 { 1856 pszUser = pszUserUPN; 1857 VGSvcVerbose(3, "Using UPN: %s\n", pszUserUPN); 1858 } 1859 } 1860 1861 if (!pszUserUPN) /* Fallback */ 1862 #endif 1863 pszUser = pSessionThread->StartupInfo.szUser; 1864 1838 1865 rc = RTProcCreateEx(pszExeName, apszArgs, RTENV_DEFAULT, fProcCreate, 1839 1866 &hStdIn, &hStdOutAndErr, &hStdOutAndErr, 1840 !fAnonymous ? p SessionThread->StartupInfo.szUser : NULL,1867 !fAnonymous ? pszUser : NULL, 1841 1868 !fAnonymous ? pSessionThread->StartupInfo.szPassword : NULL, 1842 1869 &pSessionThread->hProcess); 1843 1870 # ifdef RT_OS_WINDOWS 1871 if (pszUserUPN) 1872 RTStrFree(pszUserUPN); 1873 # endif 1844 1874 RTFileClose(hStdOutAndErr.u.hFile); 1845 1875 }
Note:
See TracChangeset
for help on using the changeset viewer.