- Timestamp:
- Dec 8, 2023 11:06:41 AM (10 months ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
-
idl/VirtualBox.xidl (modified) (2 diffs)
-
include/UnattendedImpl.h (modified) (3 diffs)
-
src-server/UnattendedImpl.cpp (modified) (3 diffs)
-
src-server/UnattendedInstaller.cpp (modified) (1 diff)
-
src-server/UnattendedScript.cpp (modified) (1 diff)
-
testcase/tstUnattendedScript-1.expected (modified) (9 diffs)
-
testcase/tstUnattendedScript-1.template (modified) (1 diff)
-
testcase/tstUnattendedScript.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r102381 r102534 4962 4962 <interface 4963 4963 name="IUnattended" extends="$unknown" 4964 uuid=" 1136224d-0ba7-45d6-9aee-03b628da46b6"4964 uuid="a71e5822-365b-49ba-bd14-c8d616e6740d" 4965 4965 wsmap="managed" 4966 4966 rest="managed" … … 5010 5010 <attribute name="user" type="wstring"> 5011 5011 <desc> 5012 Assign an user login name. 5013 </desc> 5014 </attribute> 5015 5016 <attribute name="password" type="wstring"> 5017 <desc> 5018 Assign a password to the user. The password is the same for both 5019 normal user and for Administrator / 'root' accounts. 5012 Assigns an user login name. 5013 </desc> 5014 </attribute> 5015 5016 <attribute name="userPassword" type="wstring"> 5017 <desc> 5018 Assigns a password to the user. 5019 </desc> 5020 </attribute> 5021 5022 <attribute name="adminPassword" type="wstring"> 5023 <desc> 5024 Assigns a password to the Administrator / 'root' accounts. 5025 5026 If no Administrator / 'root' password is being set explicitly, the password set via <link to="IUnattended::userPassword"/> 5027 will be used instead. 5020 5028 </desc> 5021 5029 </attribute> -
trunk/src/VBox/Main/include/UnattendedImpl.h
r102381 r102534 80 80 Utf8Str const &i_getIsoPath() const; 81 81 Utf8Str const &i_getUser() const; 82 Utf8Str const &i_getPassword() const; 82 Utf8Str const &i_getUserPassword() const; 83 Utf8Str const &i_getAdminPassword() const; 83 84 Utf8Str const &i_getFullUserName() const; 84 85 Utf8Str const &i_getProductKey() const; … … 128 129 * @{ */ 129 130 Utf8Str mStrUser; 130 Utf8Str mStrPassword; 131 Utf8Str mStrUserPassword; 132 Utf8Str mStrAdminPassword; 131 133 Utf8Str mStrFullUserName; 132 134 Utf8Str mStrProductKey; … … 198 200 HRESULT getUser(com::Utf8Str &user); 199 201 HRESULT setUser(const com::Utf8Str &user); 200 HRESULT getPassword(com::Utf8Str &password); 201 HRESULT setPassword(const com::Utf8Str &password); 202 HRESULT getUserPassword(com::Utf8Str &password); 203 HRESULT setUserPassword(const com::Utf8Str &password); 204 HRESULT getAdminPassword(com::Utf8Str &password); 205 HRESULT setAdminPassword(const com::Utf8Str &password); 202 206 HRESULT getFullUserName(com::Utf8Str &user); 203 207 HRESULT setFullUserName(const com::Utf8Str &user); -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r102417 r102534 315 315 { 316 316 mStrUser = "vboxuser"; 317 mStrPassword = "changeme"; 317 mStrUserPassword = "changeme"; 318 /* Note: For mStrAdminPassword see Unattended::i_getAdminPassword(). */ 318 319 mfInstallGuestAdditions = false; 319 320 mfInstallTestExecService = false; … … 3462 3463 } 3463 3464 3464 HRESULT Unattended::get Password(com::Utf8Str &password)3465 HRESULT Unattended::getUserPassword(com::Utf8Str &password) 3465 3466 { 3466 3467 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3467 password = mStr Password;3468 return S_OK; 3469 } 3470 3471 HRESULT Unattended::set Password(const com::Utf8Str &password)3468 password = mStrUserPassword; 3469 return S_OK; 3470 } 3471 3472 HRESULT Unattended::setUserPassword(const com::Utf8Str &password) 3472 3473 { 3473 3474 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3474 3475 AssertReturn(mpInstaller == NULL, setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("Cannot change after prepare() has been called"))); 3475 mStrPassword = password; 3476 mStrUserPassword = password; 3477 return S_OK; 3478 } 3479 3480 HRESULT Unattended::getAdminPassword(com::Utf8Str &password) 3481 { 3482 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3483 password = mStrAdminPassword; 3484 return S_OK; 3485 } 3486 3487 HRESULT Unattended::setAdminPassword(const com::Utf8Str &password) 3488 { 3489 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3490 AssertReturn(mpInstaller == NULL, setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("Cannot change after prepare() has been called"))); 3491 mStrAdminPassword = password; 3476 3492 return S_OK; 3477 3493 } … … 4148 4164 } 4149 4165 4150 Utf8Str const &Unattended::i_get Password() const4166 Utf8Str const &Unattended::i_getUserPassword() const 4151 4167 { 4152 4168 Assert(isReadLockedOnCurrentThread()); 4153 return mStrPassword; 4169 return mStrUserPassword; 4170 } 4171 4172 Utf8Str const &Unattended::i_getAdminPassword() const 4173 { 4174 Assert(isReadLockedOnCurrentThread()); 4175 4176 /* If no Administrator / 'root' password is being set, the user password will be used instead. 4177 * Also see API documentation. */ 4178 return mStrAdminPassword.isEmpty() ? mStrUserPassword : mStrAdminPassword; 4154 4179 } 4155 4180 -
trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp
r102347 r102534 250 250 if (mpParent->i_getUser().isEmpty()) 251 251 return mpParent->setError(E_INVALIDARG, tr("Empty user name is not allowed")); 252 if (mpParent->i_getPassword().isEmpty()) 253 return mpParent->setError(E_INVALIDARG, tr("Empty password is not allowed")); 252 if (mpParent->i_getUserPassword().isEmpty()) 253 return mpParent->setError(E_INVALIDARG, tr("Empty user password is not allowed")); 254 /* If admin password is empty, the user password will be used instead. */ 254 255 255 256 LogRelFunc(("UnattendedInstaller::savePassedData(): \n")); -
trunk/src/VBox/Main/src-server/UnattendedScript.cpp
r102488 r102534 676 676 pszValue = mpUnattended->i_getUser().c_str(); 677 677 else if (IS_MATCH("USER_PASSWORD")) 678 pszValue = mpUnattended->i_get Password().c_str();678 pszValue = mpUnattended->i_getUserPassword().c_str(); 679 679 else if (IS_MATCH("USER_PASSWORD_SHACRYPT512")) 680 SHACRYPT_AND_ASSIGN(mpUnattended->i_get Password().c_str(), RTCrShaCrypt512, RT_SHACRYPT_512_MAX_SIZE);680 SHACRYPT_AND_ASSIGN(mpUnattended->i_getUserPassword().c_str(), RTCrShaCrypt512, RT_SHACRYPT_512_MAX_SIZE); 681 681 else if (IS_MATCH("ROOT_PASSWORD")) 682 pszValue = mpUnattended->i_get Password().c_str();682 pszValue = mpUnattended->i_getAdminPassword().c_str(); 683 683 else if (IS_MATCH("ROOT_PASSWORD_SHACRYPT512")) 684 SHACRYPT_AND_ASSIGN(mpUnattended->i_get Password().c_str(), RTCrShaCrypt512, RT_SHACRYPT_512_MAX_SIZE);684 SHACRYPT_AND_ASSIGN(mpUnattended->i_getAdminPassword().c_str(), RTCrShaCrypt512, RT_SHACRYPT_512_MAX_SIZE); 685 685 else if (IS_MATCH("USER_FULL_NAME")) 686 686 pszValue = mpUnattended->i_getFullUserName().c_str(); -
trunk/src/VBox/Main/testcase/tstUnattendedScript-1.expected
r102416 r102534 31 31 01=vboxuser 32 32 02=changeme 33 03= changeme33 03=adminpw 34 34 04=VBox & VBox; 35 35 05=911 … … 75 75 01=vboxuser 76 76 02=changeme 77 03= changeme77 03=adminpw 78 78 04=VBox & VBox; 79 79 05=911 … … 119 119 01=vboxuser 120 120 02=changeme 121 03= changeme121 03=adminpw 122 122 04='VBox & VBox;' 123 123 05=911 … … 163 163 01=vboxuser 164 164 02=changeme 165 03= changeme165 03=adminpw 166 166 04='VBox & VBox;' 167 167 05=911 … … 207 207 01=vboxuser 208 208 02=changeme 209 03= changeme209 03=adminpw 210 210 04=VBox & VBox; 211 211 05=911 … … 251 251 01=vboxuser 252 252 02=changeme 253 03= changeme253 03=adminpw 254 254 04=VBox & VBox; 255 255 05=911 … … 295 295 01=vboxuser 296 296 02=changeme 297 03= changeme297 03=adminpw 298 298 04=VBox & VBox; 299 299 05=911 … … 339 339 01=vboxuser 340 340 02=changeme 341 03= changeme341 03=adminpw 342 342 04=VBox & VBox; 343 343 05=911 … … 384 384 385 385 /* 386 * SHAcrypt 512. Contains the word "changeme" as hashed results.386 * SHAcrypt 512. Contains the word "changeme" (01) and "adminpw" (02) as hashed results. 387 387 * Note: This uses a fixed salt ("testcase123") within UnattendedScript.cpp, so that we can compare the outputs. 388 388 */ 389 389 01=$6$testcase123$AtdiLq2Dp.l/NRkh9/9Ai6Eapd6d0bGxCOmqErpuGa4unRjiohzK5YERWtLHKvAYx26X0YhIrgSFRimkaLToI1 390 02=$6$testcase123$ AtdiLq2Dp.l/NRkh9/9Ai6Eapd6d0bGxCOmqErpuGa4unRjiohzK5YERWtLHKvAYx26X0YhIrgSFRimkaLToI1391 390 02=$6$testcase123$.ul/vC02q6oasrgQH/gqtOwHCo0jALPhIY63uypm0Mb2kJeDT0yedResX/mMNVZkm0fuMj24tpxs9gMAm7sEC0 391 -
trunk/src/VBox/Main/testcase/tstUnattendedScript-1.template
r102416 r102534 384 384 385 385 /* 386 * SHAcrypt 512. Contains the word "changeme" as hashed results.386 * SHAcrypt 512. Contains the word "changeme" (01) and "adminpw" (02) as hashed results. 387 387 * Note: This uses a fixed salt ("testcase123") within UnattendedScript.cpp, so that we can compare the outputs. 388 388 */ -
trunk/src/VBox/Main/testcase/tstUnattendedScript.cpp
r102381 r102534 59 59 { 60 60 mStrUser = "vboxuser"; 61 mStrPassword = "changeme"; 61 mStrUserPassword = "changeme"; 62 mStrAdminPassword = "adminpw"; 62 63 mStrFullUserName = "VBox & VBox;"; 63 64 mStrProductKey = "911"; … … 168 169 } 169 170 170 HRESULT Unattended::get Password(com::Utf8Str &password)171 HRESULT Unattended::getUserPassword(com::Utf8Str &password) 171 172 { 172 173 RT_NOREF(password); … … 174 175 } 175 176 176 HRESULT Unattended::setPassword(const com::Utf8Str &password) 177 HRESULT Unattended::setUserPassword(const com::Utf8Str &password) 178 { 179 RT_NOREF(password); 180 return E_NOTIMPL; 181 } 182 183 HRESULT Unattended::getAdminPassword(com::Utf8Str &password) 184 { 185 RT_NOREF(password); 186 return E_NOTIMPL; 187 } 188 189 HRESULT Unattended::setAdminPassword(const com::Utf8Str &password) 177 190 { 178 191 RT_NOREF(password); … … 544 557 } 545 558 546 Utf8Str const &Unattended::i_getPassword() const 547 { 548 return mStrPassword; 559 Utf8Str const &Unattended::i_getUserPassword() const 560 { 561 return mStrUserPassword; 562 } 563 564 Utf8Str const &Unattended::i_getAdminPassword() const 565 { 566 /* If no Administrator / 'root' password is being set, the user password will be used instead. 567 * Also see API documentation. */ 568 return mStrAdminPassword.isEmpty() ? mStrUserPassword : mStrAdminPassword; 549 569 } 550 570
Note:
See TracChangeset
for help on using the changeset viewer.

