Changeset 98789 in vbox
- Timestamp:
- Feb 28, 2023 4:34:10 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156100
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r98774 r98789 1909 1909 if (!(fFlags & ~GSTCTL_CREATETEMP_F_VALID_MASK)) 1910 1910 { 1911 const char *pszWhat = fMode & GSTCTL_CREATETEMP_F_DIRECTORY ? "directory" : "file"; 1912 VGSvcVerbose(4, "Creating temporary %s (szTemplate='%s', fFlags=%#x), rc=%Rrc\n", pszWhat, szTemplate, fFlags, rc); 1913 1914 bool const fSecure = RT_BOOL(fMode & GSTCTL_CREATETEMP_F_SECURE); 1915 if (fMode & GSTCTL_CREATETEMP_F_DIRECTORY) 1911 const char *pszWhat = fFlags & GSTCTL_CREATETEMP_F_DIRECTORY ? "directory" : "file"; 1912 1913 /* Validate that the template is as IPRT requires (asserted by IPRT). */ 1914 if ( RTPathHasPath(szTemplate) 1915 || ( !strstr(szTemplate, "XXX") 1916 && szTemplate[strlen(szTemplate) - 1] != 'X')) 1916 1917 { 1917 if (fSecure) 1918 rc = RTDirCreateTempSecure(szTemplate); /* File mode is fixed to 0700. */ 1918 VGSvcError("createtemp: Template '%s' should contain a file name with no path and at least three consecutive 'X' characters or ending in 'X'\n", 1919 szTemplate); 1920 rc = VERR_INVALID_PARAMETER; 1921 } 1922 1923 if ( RT_SUCCESS(rc) 1924 && szPath[0] != '\0' && !RTPathStartsWithRoot(szPath)) 1925 { 1926 VGSvcError("createtemp: Path '%s' must be absolute\n", szPath); 1927 rc = VERR_INVALID_PARAMETER; 1928 } 1929 1930 if (RT_SUCCESS(rc)) 1931 { 1932 char szTemplateWithPath[RTPATH_MAX] = ""; 1933 if (szPath[0] != '\0') 1934 { 1935 rc = RTStrCopy(szTemplateWithPath, sizeof(szTemplateWithPath), szPath); 1936 if (RT_FAILURE(rc)) 1937 { 1938 VGSvcError("createtemp: Path '%s' too long\n", szPath); 1939 rc = VERR_INVALID_PARAMETER; 1940 } 1941 } 1919 1942 else 1920 rc = RTDirCreateTemp(szTemplate, fMode); 1921 } 1922 else /* File */ 1923 { 1924 if (fSecure) 1925 rc = RTFileCreateTempSecure(szTemplate); /* File mode is fixed to 0700. */ 1926 else 1927 rc = RTFileCreateTemp(szTemplate, fMode); 1943 { 1944 rc = RTPathTemp(szTemplateWithPath, sizeof(szTemplateWithPath)); 1945 if (RT_FAILURE(rc)) 1946 { 1947 VGSvcError("createtemp: Failed to get the temporary directory (%Rrc)", rc); 1948 rc = VERR_INVALID_PARAMETER; 1949 } 1950 } 1951 1952 if (RT_SUCCESS(rc)) 1953 { 1954 rc = RTPathAppend(szTemplateWithPath, sizeof(szTemplateWithPath), szTemplate); 1955 if (RT_FAILURE(rc)) 1956 { 1957 VGSvcError("createtemp: Template '%s' too long for path\n", szTemplate); 1958 rc = VERR_INVALID_PARAMETER; 1959 } 1960 else 1961 { 1962 bool const fSecure = RT_BOOL(fFlags & GSTCTL_CREATETEMP_F_SECURE); 1963 if (fFlags & GSTCTL_CREATETEMP_F_DIRECTORY) 1964 { 1965 if (fSecure) 1966 rc = RTDirCreateTempSecure(szTemplateWithPath); /* File mode is fixed to 0700. */ 1967 else 1968 rc = RTDirCreateTemp(szTemplate, fMode); 1969 } 1970 else /* File */ 1971 { 1972 if (fSecure) 1973 rc = RTFileCreateTempSecure(szTemplateWithPath); /* File mode is fixed to 0700. */ 1974 else 1975 rc = RTFileCreateTemp(szTemplate, fMode); 1976 } 1977 1978 VGSvcVerbose(3, "Creating temporary %s (szTemplate='%s', fFlags=%#x, fMode=%#x) -> rc=%Rrc\n", 1979 pszWhat, szTemplate, fFlags, fMode, rc); 1980 } 1981 } 1928 1982 } 1929 1983 } … … 1950 2004 VbglR3GuestCtrlMsgSkip(pHostCtx->uClientID, rc, UINT32_MAX); 1951 2005 } 1952 VGSvcVerbose( 5, "Creating temporary file/directory returned rc=%Rrc\n", rc);2006 VGSvcVerbose(3, "Creating temporary file/directory returned rc=%Rrc\n", rc); 1953 2007 return rc; 1954 2008 } -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r98725 r98789 77 77 break; 78 78 79 case VERR_INVALID_PARAMETER: 80 strErr.printf(tr("Invalid parameter specified")); 81 break; 82 79 83 case VERR_INVALID_VM_HANDLE: 80 84 strErr.printf(tr("VMM device is not available (is the VM running?)")); … … 111 115 case VERR_NOT_FOUND: 112 116 strErr.printf(tr("The guest execution service is not ready (yet)")); 117 break; 118 119 case VERR_NOT_SUPPORTED: 120 strErr.printf(tr("Specified mode or flag is not supported on the guest")); 113 121 break; 114 122
Note:
See TracChangeset
for help on using the changeset viewer.