Changeset 92880 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Dec 13, 2021 11:16:44 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note:
See TracChangeset
for help on using the changeset viewer.