Changeset 92880 in vbox
- Timestamp:
- Dec 13, 2021 11:16:44 AM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
-
Main/idl/VirtualBox.xidl (modified) (1 diff)
-
Main/include/GuestSessionImpl.h (modified) (1 diff)
-
Main/src-client/GuestSessionImpl.cpp (modified) (4 diffs)
-
ValidationKit/tests/additions/tdAddGuestCtrl.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r92853 r92880 14369 14369 OS. 14370 14370 14371 This parameter is ignore if the @a secure parameter is set to @c true.14371 This parameter is ignored if the @a secure parameter is set to @c true. 14372 14372 <note>It is strongly recommended to use 0700.</note> 14373 14373 </desc> -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r92878 r92880 303 303 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc); 304 304 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, 305 Utf8Str &strName, int *pGuestRc);305 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pGuestRc); 306 306 int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 307 307 const GuestCredentials &i_getCredentials(void); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r92879 r92880 1082 1082 } 1083 1083 1084 /** 1085 * Creates a temporary directory / file on the guest. 1086 * 1087 * @returns VBox status code. 1088 * @returns VERR_GSTCTL_GUEST_ERROR on received guest error. 1089 * @param strTemplate Name template to use. 1090 * \sa RTDirCreateTemp / RTDirCreateTempSecure. 1091 * @param strPath Path where to create the temporary directory / file. 1092 * @param fDirectory Whether to create a temporary directory or file. 1093 * @param strName Where to return the created temporary name on success. 1094 * @param fMode File mode to use for creation (octal). 1095 * @param fSecure Whether to perform a secure creation or not. 1096 * @param prcGuest Guest rc, when returning VERR_GSTCTL_GUEST_ERROR. 1097 */ 1084 1098 int GuestSession::i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, 1085 int *prcGuest)1099 uint32_t fMode, bool fSecure, int *prcGuest) 1086 1100 { 1087 1101 AssertPtrReturn(prcGuest, VERR_INVALID_POINTER); 1088 1102 1089 LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool \n",1090 strTemplate.c_str(), strPath.c_str(), fDirectory ));1103 LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool, fMode=%o, fSecure=%RTbool\n", 1104 strTemplate.c_str(), strPath.c_str(), fDirectory, fMode, fSecure)); 1091 1105 1092 1106 GuestProcessStartupInfo procInfo; … … 1103 1117 procInfo.mArguments.push_back(Utf8Str("-t")); 1104 1118 procInfo.mArguments.push_back(strPath); 1119 } 1120 /* Note: Secure flag and mode cannot be specified at the same time. */ 1121 if (fSecure) 1122 { 1123 procInfo.mArguments.push_back(Utf8Str("--secure")); 1124 } 1125 else 1126 { 1127 procInfo.mArguments.push_back(Utf8Str("--mode")); 1128 procInfo.mArguments.push_back(Utf8Str("%o", fMode)); /* Octal mode. */ 1105 1129 } 1106 1130 procInfo.mArguments.push_back("--"); /* strTemplate could be '--help'. */ … … 3437 3461 BOOL aSecure, com::Utf8Str &aDirectory) 3438 3462 { 3439 RT_NOREF(aMode, aSecure); /** @todo r=bird: WTF? */3440 3441 3463 if (RT_UNLIKELY((aTemplateName.c_str()) == NULL || *(aTemplateName.c_str()) == '\0')) 3442 3464 return setError(E_INVALIDARG, tr("No template specified")); 3443 3465 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 3444 3466 return setError(E_INVALIDARG, tr("No directory name specified")); 3467 if (!aSecure) /* Ignore what mode is specified when a secure temp thing needs to be created. */ 3468 if (RT_UNLIKELY(!(aMode & ~07777))) 3469 return setError(E_INVALIDARG, tr("Mode invalid (must be specified in octal mode)")); 3445 3470 3446 3471 HRESULT hrc = i_isStartedExternal(); … … 3451 3476 3452 3477 int rcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3453 int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, &rcGuest);3478 int vrc = i_fsCreateTemp(aTemplateName, aPath, true /* Directory */, aDirectory, aMode, RT_BOOL(aSecure), &rcGuest); 3454 3479 if (!RT_SUCCESS(vrc)) 3455 3480 { -
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r92877 r92880 3542 3542 tdTestResultFailure() ], 3543 3543 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm)), 3544 tdTestResultFailure() ], 3545 ## @todo test fSecure and pass weird fMode values once these parameters are implemented in the API. 3544 tdTestResultFailure() ], 3546 3545 ]; 3546 3547 if self.oTstDrv.fpApiVer >= 7.0: 3548 # Weird mode set. 3549 atTests.extend([ 3550 [ tdTestDirCreateTemp(sTemplate = 'XXX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o42333), 3551 tdTestResultFailure() ] 3552 ]); 3553 # Same as working stuff above, but with a different mode set. 3554 atTests.extend([ 3555 [ tdTestDirCreateTemp(sTemplate = 'X', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3556 tdTestResultFailure() ], 3557 [ tdTestDirCreateTemp(sTemplate = 'XX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3558 tdTestResultFailure() ], 3559 [ tdTestDirCreateTemp(sTemplate = 'XXX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3560 tdTestResultFailure() ], 3561 [ tdTestDirCreateTemp(sTemplate = 'XXXXXXX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3562 tdTestResultFailure() ], 3563 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3564 tdTestResultFailure() ], 3565 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3566 tdTestResultFailure() ], 3567 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fMode = 0o777), 3568 tdTestResultFailure() ] 3569 ]); 3570 # Same as working stuff above, but with secure mode set. 3571 atTests.extend([ 3572 [ tdTestDirCreateTemp(sTemplate = 'X', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fSecure = True), 3573 tdTestResultFailure() ], 3574 [ tdTestDirCreateTemp(sTemplate = 'XX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fSecure = True), 3575 tdTestResultFailure() ], 3576 [ tdTestDirCreateTemp(sTemplate = 'XXX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fSecure = True), 3577 tdTestResultFailure() ], 3578 [ tdTestDirCreateTemp(sTemplate = 'XXXXXXX', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), fSecure = True), 3579 tdTestResultFailure() ], 3580 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), 3581 fSecure = True), 3582 tdTestResultFailure() ], 3583 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), 3584 fSecure = True), 3585 tdTestResultFailure() ], 3586 [ tdTestDirCreateTemp(sTemplate = 'tmpXXXtst', sDirectory = self.oTstDrv.getGuestTempDir(oTestVm), 3587 fSecure = True), 3588 tdTestResultFailure() ] 3589 ]); 3547 3590 3548 3591 fRc = True;
Note:
See TracChangeset
for help on using the changeset viewer.

