Changeset 42444 in vbox for trunk/src/VBox
- Timestamp:
- Jul 30, 2012 11:56:33 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r42125 r42444 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 247 247 248 248 #ifndef VBOX_ONLY_DOCS 249 static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const char *pszFile)249 RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd) 250 250 { 251 251 size_t cbFile; … … 253 253 int vrc = VINF_SUCCESS; 254 254 RTEXITCODE rcExit = RTEXITCODE_SUCCESS; 255 bool fStdIn = !strcmp(pszFile , "stdin");255 bool fStdIn = !strcmp(pszFilename, "stdin"); 256 256 PRTSTREAM pStrm; 257 257 if (!fStdIn) 258 vrc = RTStrmOpen(pszFile , "r", &pStrm);258 vrc = RTStrmOpen(pszFilename, "r", &pStrm); 259 259 else 260 260 pStrm = g_pStdIn; … … 265 265 { 266 266 if (cbFile >= sizeof(szPasswd)-1) 267 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Provided password too long");267 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Provided password in file '%s' is too long", pszFilename); 268 268 else 269 269 { … … 272 272 ; 273 273 szPasswd[i] = '\0'; 274 int rc; 275 CHECK_ERROR(virtualBox, SetSettingsSecret(com::Bstr(szPasswd).raw())); 276 if (FAILED(rc)) 277 rcExit = RTEXITCODE_FAILURE; 278 } 279 } 274 *pPasswd = szPasswd; 275 } 276 } 277 else 278 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot read password from file '%s': %Rrc", pszFilename, vrc); 280 279 if (!fStdIn) 281 280 RTStrmClose(pStrm); 282 281 } 283 282 else 284 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot open password file '%s' (%Rrc)", pszFile); 283 rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Cannot open password file '%s' (%Rrc)", pszFilename, vrc); 284 285 return rcExit; 286 } 287 288 static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const char *pszFilename) 289 { 290 com::Utf8Str passwd; 291 RTEXITCODE rcExit = readPasswordFile(pszFilename, &passwd); 292 if (rcExit == RTEXITCODE_SUCCESS) 293 { 294 int rc; 295 CHECK_ERROR(virtualBox, SetSettingsSecret(com::Bstr(passwd).raw())); 296 if (FAILED(rc)) 297 rcExit = RTEXITCODE_FAILURE; 298 } 285 299 286 300 return rcExit; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r42442 r42444 162 162 163 163 #ifndef VBOX_ONLY_DOCS 164 RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd); 165 164 166 int handleInternalCommands(HandlerArg *a); 165 167 #endif /* !VBOX_ONLY_DOCS */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r42261 r42444 953 953 { 954 954 bool fAllowLocalLogon = true; 955 if (a->argc == 7) 956 { 957 if ( strcmp(a->argv[5], "--allowlocallogon") 958 && strcmp(a->argv[5], "-allowlocallogon")) 955 if ( a->argc == 7 956 || ( a->argc == 8 957 && ( !strcmp(a->argv[3], "-p") 958 || !strcmp(a->argv[3], "--passwordfile")))) 959 { 960 if ( strcmp(a->argv[5 + (a->argc - 7)], "--allowlocallogon") 961 && strcmp(a->argv[5 + (a->argc - 7)], "-allowlocallogon")) 959 962 { 960 963 errorArgument("Invalid parameter '%s'", a->argv[5]); … … 962 965 break; 963 966 } 964 if (!strcmp(a->argv[6 ], "no"))967 if (!strcmp(a->argv[6 + (a->argc - 7)], "no")) 965 968 fAllowLocalLogon = false; 966 969 } 967 else if (a->argc != 5) 970 else if ( a->argc != 5 971 && ( a->argc != 6 972 || ( strcmp(a->argv[3], "-p") 973 && strcmp(a->argv[3], "--passwordfile")))) 968 974 { 969 975 errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters"); 970 976 rc = E_FAIL; 971 977 break; 978 } 979 Utf8Str passwd, domain; 980 if (a->argc == 5 || a->argc == 7) 981 { 982 passwd = a->argv[3]; 983 domain = a->argv[4]; 984 } 985 else 986 { 987 RTEXITCODE rcExit = readPasswordFile(a->argv[4], &passwd); 988 if (rcExit != RTEXITCODE_SUCCESS) 989 { 990 rc = E_FAIL; 991 break; 992 } 993 domain = a->argv[5]; 972 994 } 973 995 … … 975 997 CHECK_ERROR_BREAK(console, COMGETTER(Guest)(guest.asOutParam())); 976 998 CHECK_ERROR_BREAK(guest, SetCredentials(Bstr(a->argv[2]).raw(), 977 Bstr( a->argv[3]).raw(),978 Bstr( a->argv[4]).raw(),999 Bstr(passwd).raw(), 1000 Bstr(domain).raw(), 979 1001 fAllowLocalLogon)); 980 1002 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r40687 r42444 5 5 6 6 /* 7 * Copyright (C) 2010-201 1Oracle Corporation7 * Copyright (C) 2010-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 183 183 GETOPTDEF_EXEC_DOS2UNIX, 184 184 GETOPTDEF_EXEC_UNIX2DOS, 185 GETOPTDEF_EXEC_PASSWORD, 185 186 GETOPTDEF_EXEC_WAITFOREXIT, 186 187 GETOPTDEF_EXEC_WAITFORSTDOUT, … … 188 189 }; 189 190 190 enum GETOPTDEF_COPYFROM 191 { 192 GETOPTDEF_COPYFROM_DRYRUN = 1000, 193 GETOPTDEF_COPYFROM_FOLLOW, 194 GETOPTDEF_COPYFROM_PASSWORD, 195 GETOPTDEF_COPYFROM_TARGETDIR, 196 GETOPTDEF_COPYFROM_USERNAME 191 enum GETOPTDEF_COPY 192 { 193 GETOPTDEF_COPY_DRYRUN = 1000, 194 GETOPTDEF_COPY_FOLLOW, 195 GETOPTDEF_COPY_PASSWORD, 196 GETOPTDEF_COPY_TARGETDIR 197 197 }; 198 198 199 enum GETOPTDEF_COPYTO 200 { 201 GETOPTDEF_COPYTO_DRYRUN = 1000, 202 GETOPTDEF_COPYTO_FOLLOW, 203 GETOPTDEF_COPYTO_PASSWORD, 204 GETOPTDEF_COPYTO_TARGETDIR, 205 GETOPTDEF_COPYTO_USERNAME 199 enum GETOPTDEF_MKDIR 200 { 201 GETOPTDEF_MKDIR_PASSWORD = 1000 206 202 }; 207 203 208 enum GETOPTDEF_MKDIR209 {210 GETOPTDEF_MKDIR_PASSWORD = 1000,211 GETOPTDEF_MKDIR_USERNAME212 };213 214 204 enum GETOPTDEF_STAT 215 205 { 216 GETOPTDEF_STAT_PASSWORD = 1000, 217 GETOPTDEF_STAT_USERNAME 206 GETOPTDEF_STAT_PASSWORD = 1000 218 207 }; 219 208 … … 234 223 "VBoxManage guestcontrol <vmname>|<uuid>\n" 235 224 " exec[ute]\n" 236 " --image <path to program>\n" 237 " --username <name> --password <password>\n" 238 " [--dos2unix]\n" 225 " --image <path to program> --username <name>\n" 226 " --passwordfile <file> | --password <password>\n" 239 227 " [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n" 240 " [-- timeout <msec>] [--unix2dos] [--verbose]\n"228 " [--verbose] [--timeout <msec>]\n" 241 229 " [--wait-exit] [--wait-stdout] [--wait-stderr]\n" 230 " [--dos2unix] [--unix2dos]\n" 242 231 " [-- [<argument1>] ... [<argumentN>]]\n" 243 232 /** @todo Add a "--" parameter (has to be last parameter) to directly execute … … 245 234 "\n" 246 235 " copyfrom\n" 247 " < source on guest> <destination on host>\n"248 " -- username <name>--password <password>\n"236 " <guest source> <host dest> --username <name>\n" 237 " --passwordfile <file> | --password <password>\n" 249 238 " [--dryrun] [--follow] [--recursive] [--verbose]\n" 250 239 "\n" 251 240 " copyto|cp\n" 252 " < source on host> <destination on guest>\n"253 " -- username <name>--password <password>\n"241 " <host source> <guest dest> --username <name>\n" 242 " --passwordfile <file> | --password <password>\n" 254 243 " [--dryrun] [--follow] [--recursive] [--verbose]\n" 255 244 "\n" 256 245 " createdir[ectory]|mkdir|md\n" 257 " < director[y|ies] to create on guest>\n"258 " -- username <name>--password <password>\n"246 " <guest directory>... --username <name>\n" 247 " --passwordfile <file> | --password <password>\n" 259 248 " [--parents] [--mode <mode>] [--verbose]\n" 260 249 "\n" 261 250 " stat\n" 262 " <file element(s) to check on guest>\n"263 " -- username <name>--password <password>\n"251 " <file>... --username <name>\n" 252 " --passwordfile <file> | --password <password>\n" 264 253 " [--verbose]\n" 265 254 "\n" … … 597 586 } 598 587 599 /* <Missing docu emntation> */588 /* <Missing documentation> */ 600 589 static int handleCtrlExecProgram(ComPtr<IGuest> pGuest, HandlerArg *pArg) 601 590 { … … 616 605 { "--image", 'i', RTGETOPT_REQ_STRING }, 617 606 { "--no-profile", GETOPTDEF_EXEC_NO_PROFILE, RTGETOPT_REQ_NOTHING }, 618 { "--password", 'p', RTGETOPT_REQ_STRING }, 607 { "--passwordfile", 'p', RTGETOPT_REQ_STRING }, 608 { "--password", GETOPTDEF_EXEC_PASSWORD, RTGETOPT_REQ_STRING }, 619 609 { "--timeout", 't', RTGETOPT_REQ_UINT32 }, 620 610 { "--unix2dos", GETOPTDEF_EXEC_UNIX2DOS, RTGETOPT_REQ_NOTHING }, … … 685 675 /** @todo Add a hidden flag. */ 686 676 687 case 'p': /* Password */677 case GETOPTDEF_EXEC_PASSWORD: /* Password */ 688 678 Utf8Password = ValueUnion.psz; 689 679 break; 680 681 case 'p': /* Password file */ 682 { 683 RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password); 684 if (rcExit != RTEXITCODE_SUCCESS) 685 return rcExit; 686 break; 687 } 690 688 691 689 case 't': /* Timeout */ … … 761 759 762 760 /* Execute the process. */ 763 int rc Proc= RTEXITCODE_FAILURE;761 int rcExit = RTEXITCODE_FAILURE; 764 762 ComPtr<IProgress> progress; 765 763 ULONG uPID = 0; … … 872 870 if (fVerbose) 873 871 RTPrintf("Process execution canceled!\n"); 874 rc Proc= EXITCODEEXEC_CANCELED;872 rcExit = EXITCODEEXEC_CANCELED; 875 873 } 876 874 else if ( fCompleted … … 890 888 if (fVerbose) 891 889 RTPrintf("Exit code=%u (Status=%u [%s], Flags=%u)\n", uRetExitCode, retStatus, ctrlExecProcessStatusToText(retStatus), uRetFlags); 892 rc Proc= ctrlExecProcessStatusToExitCode(retStatus, uRetExitCode);890 rcExit = ctrlExecProcessStatusToExitCode(retStatus, uRetExitCode); 893 891 } 894 892 else 895 893 { 896 894 ctrlPrintError(pGuest, COM_IIDOF(IGuest)); 897 rc Proc= RTEXITCODE_FAILURE;895 rcExit = RTEXITCODE_FAILURE; 898 896 } 899 897 } … … 903 901 if (fVerbose) 904 902 RTPrintf("Process execution aborted!\n"); 905 rc Proc= EXITCODEEXEC_TERM_ABEND;903 rcExit = EXITCODEEXEC_TERM_ABEND; 906 904 } 907 905 } … … 909 907 if (RT_FAILURE(vrc) || FAILED(rc)) 910 908 return RTEXITCODE_FAILURE; 911 return rc Proc;909 return rcExit; 912 910 } 913 911 … … 1799 1797 } 1800 1798 1801 static int handleCtrlCopy To(ComPtr<IGuest> guest, HandlerArg *pArg,1802 1799 static int handleCtrlCopy(ComPtr<IGuest> guest, HandlerArg *pArg, 1800 bool fHostToGuest) 1803 1801 { 1804 1802 AssertPtrReturn(pArg, VERR_INVALID_PARAMETER); … … 1820 1818 static const RTGETOPTDEF s_aOptions[] = 1821 1819 { 1822 { "--dryrun", GETOPTDEF_COPYTO_DRYRUN, RTGETOPT_REQ_NOTHING }, 1823 { "--follow", GETOPTDEF_COPYTO_FOLLOW, RTGETOPT_REQ_NOTHING }, 1824 { "--password", GETOPTDEF_COPYTO_PASSWORD, RTGETOPT_REQ_STRING }, 1820 { "--dryrun", GETOPTDEF_COPY_DRYRUN, RTGETOPT_REQ_NOTHING }, 1821 { "--follow", GETOPTDEF_COPY_FOLLOW, RTGETOPT_REQ_NOTHING }, 1822 { "--passwordfile", 'p', RTGETOPT_REQ_STRING }, 1823 { "--password", GETOPTDEF_COPY_PASSWORD, RTGETOPT_REQ_STRING }, 1825 1824 { "--recursive", 'R', RTGETOPT_REQ_NOTHING }, 1826 { "--target-directory", GETOPTDEF_COPY TO_TARGETDIR,RTGETOPT_REQ_STRING },1827 { "--username", GETOPTDEF_COPYTO_USERNAME,RTGETOPT_REQ_STRING },1825 { "--target-directory", GETOPTDEF_COPY_TARGETDIR, RTGETOPT_REQ_STRING }, 1826 { "--username", 'u', RTGETOPT_REQ_STRING }, 1828 1827 { "--verbose", 'v', RTGETOPT_REQ_NOTHING } 1829 1828 }; … … 1852 1851 switch (ch) 1853 1852 { 1854 case GETOPTDEF_COPY TO_DRYRUN:1853 case GETOPTDEF_COPY_DRYRUN: 1855 1854 fDryRun = true; 1856 1855 break; 1857 1856 1858 case GETOPTDEF_COPY TO_FOLLOW:1857 case GETOPTDEF_COPY_FOLLOW: 1859 1858 fFlags |= CopyFileFlag_FollowLinks; 1860 1859 break; 1861 1860 1862 case GETOPTDEF_COPY TO_PASSWORD:1861 case GETOPTDEF_COPY_PASSWORD: /* Password */ 1863 1862 Utf8Password = ValueUnion.psz; 1864 1863 break; 1864 1865 case 'p': /* Password file */ 1866 { 1867 RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password); 1868 if (rcExit != RTEXITCODE_SUCCESS) 1869 return rcExit; 1870 break; 1871 } 1865 1872 1866 1873 case 'R': /* Recursive processing */ … … 1868 1875 break; 1869 1876 1870 case GETOPTDEF_COPY TO_TARGETDIR:1877 case GETOPTDEF_COPY_TARGETDIR: 1871 1878 Utf8Dest = ValueUnion.psz; 1872 1879 break; 1873 1880 1874 case GETOPTDEF_COPYTO_USERNAME:1881 case 'u': /* User name */ 1875 1882 Utf8UserName = ValueUnion.psz; 1876 1883 break; … … 2081 2088 { "--mode", 'm', RTGETOPT_REQ_UINT32 }, 2082 2089 { "--parents", 'P', RTGETOPT_REQ_NOTHING }, 2090 { "--passwordfile", 'p', RTGETOPT_REQ_STRING }, 2083 2091 { "--password", GETOPTDEF_MKDIR_PASSWORD, RTGETOPT_REQ_STRING }, 2084 { "--username", GETOPTDEF_MKDIR_USERNAME,RTGETOPT_REQ_STRING },2092 { "--username", 'u', RTGETOPT_REQ_STRING }, 2085 2093 { "--verbose", 'v', RTGETOPT_REQ_NOTHING } 2086 2094 }; … … 2100 2108 DESTDIRMAP mapDirs; 2101 2109 2102 RTEXITCODE rcExit = RTEXITCODE_SUCCESS; 2103 while ( (ch = RTGetOpt(&GetState, &ValueUnion)) 2104 && rcExit == RTEXITCODE_SUCCESS) 2110 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 2105 2111 { 2106 2112 /* For options that require an argument, ValueUnion has received the value. */ … … 2119 2125 break; 2120 2126 2121 case GETOPTDEF_MKDIR_USERNAME: /* User name */ 2127 case 'p': /* Password file */ 2128 { 2129 RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password); 2130 if (rcExit != RTEXITCODE_SUCCESS) 2131 return rcExit; 2132 break; 2133 } 2134 2135 case 'u': /* User name */ 2122 2136 Utf8UserName = ValueUnion.psz; 2123 2137 break; … … 2134 2148 2135 2149 default: 2136 rcExit = RTGetOptPrintError(ch, &ValueUnion); 2137 break; 2150 return RTGetOptPrintError(ch, &ValueUnion); 2138 2151 } 2139 2152 } 2140 2153 2141 2154 uint32_t cDirs = mapDirs.size(); 2142 if (rcExit == RTEXITCODE_SUCCESS && !cDirs) 2143 rcExit = errorSyntax(USAGE_GUESTCONTROL, "No directory to create specified!"); 2144 2145 if (rcExit == RTEXITCODE_SUCCESS && Utf8UserName.isEmpty()) 2146 rcExit = errorSyntax(USAGE_GUESTCONTROL, "No user name specified!"); 2147 2148 if (rcExit == RTEXITCODE_SUCCESS) 2149 { 2150 /* 2151 * Create the directories. 2152 */ 2153 HRESULT hrc = S_OK; 2154 if (fVerbose && cDirs) 2155 RTPrintf("Creating %u directories ...\n", cDirs); 2156 2157 DESTDIRMAPITER it = mapDirs.begin(); 2158 while (it != mapDirs.end()) 2159 { 2160 if (fVerbose) 2161 RTPrintf("Creating directory \"%s\" ...\n", it->first.c_str()); 2162 2163 hrc = guest->DirectoryCreate(Bstr(it->first).raw(), 2164 Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(), 2165 fDirMode, fFlags); 2166 if (FAILED(hrc)) 2167 { 2168 ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */ 2169 break; 2170 } 2171 2172 it++; 2173 } 2174 2155 if (!cDirs) 2156 return errorSyntax(USAGE_GUESTCONTROL, "No directory to create specified!"); 2157 2158 if (Utf8UserName.isEmpty()) 2159 return errorSyntax(USAGE_GUESTCONTROL, "No user name specified!"); 2160 2161 /* 2162 * Create the directories. 2163 */ 2164 HRESULT hrc = S_OK; 2165 if (fVerbose && cDirs) 2166 RTPrintf("Creating %u directories ...\n", cDirs); 2167 2168 DESTDIRMAPITER it = mapDirs.begin(); 2169 while (it != mapDirs.end()) 2170 { 2171 if (fVerbose) 2172 RTPrintf("Creating directory \"%s\" ...\n", it->first.c_str()); 2173 2174 hrc = guest->DirectoryCreate(Bstr(it->first).raw(), 2175 Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(), 2176 fDirMode, fFlags); 2175 2177 if (FAILED(hrc)) 2176 rcExit = RTEXITCODE_FAILURE; 2177 } 2178 2179 return rcExit; 2178 { 2179 ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */ 2180 break; 2181 } 2182 2183 it++; 2184 } 2185 2186 return FAILED(hrc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS; 2180 2187 } 2181 2188 … … 2189 2196 { "--file-system", 'f', RTGETOPT_REQ_NOTHING }, 2190 2197 { "--format", 'c', RTGETOPT_REQ_STRING }, 2198 { "--passwordfile", 'p', RTGETOPT_REQ_STRING }, 2191 2199 { "--password", GETOPTDEF_STAT_PASSWORD, RTGETOPT_REQ_STRING }, 2192 2200 { "--terse", 't', RTGETOPT_REQ_NOTHING }, 2193 { "--username", GETOPTDEF_STAT_USERNAME,RTGETOPT_REQ_STRING },2201 { "--username", 'u', RTGETOPT_REQ_STRING }, 2194 2202 { "--verbose", 'v', RTGETOPT_REQ_NOTHING } 2195 2203 }; … … 2207 2215 DESTDIRMAP mapObjs; 2208 2216 2209 RTEXITCODE rcExit = RTEXITCODE_SUCCESS; 2210 while ( (ch = RTGetOpt(&GetState, &ValueUnion)) 2211 && rcExit == RTEXITCODE_SUCCESS) 2217 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 2212 2218 { 2213 2219 /* For options that require an argument, ValueUnion has received the value. */ … … 2218 2224 break; 2219 2225 2220 case GETOPTDEF_STAT_USERNAME: /* User name */ 2226 case 'p': /* Password file */ 2227 { 2228 RTEXITCODE rcExit = readPasswordFile(ValueUnion.psz, &Utf8Password); 2229 if (rcExit != RTEXITCODE_SUCCESS) 2230 return rcExit; 2231 break; 2232 } 2233 2234 case 'u': /* User name */ 2221 2235 Utf8UserName = ValueUnion.psz; 2222 2236 break; … … 2242 2256 default: 2243 2257 return RTGetOptPrintError(ch, &ValueUnion); 2244 break; /* Never reached. */2245 2258 } 2246 2259 } 2247 2260 2248 2261 uint32_t cObjs = mapObjs.size(); 2249 if (rcExit == RTEXITCODE_SUCCESS && !cObjs) 2250 rcExit = errorSyntax(USAGE_GUESTCONTROL, "No element(s) to check specified!"); 2251 2252 if (rcExit == RTEXITCODE_SUCCESS && Utf8UserName.isEmpty()) 2253 rcExit = errorSyntax(USAGE_GUESTCONTROL, "No user name specified!"); 2254 2255 if (rcExit == RTEXITCODE_SUCCESS) 2256 { 2257 /* 2258 * Create the directories. 2259 */ 2260 HRESULT hrc = S_OK; 2261 2262 DESTDIRMAPITER it = mapObjs.begin(); 2263 while (it != mapObjs.end()) 2264 { 2265 if (fVerbose) 2266 RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str()); 2267 2268 BOOL fExists; 2269 hrc = guest->FileExists(Bstr(it->first).raw(), 2270 Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(), 2271 &fExists); 2272 if (FAILED(hrc)) 2273 { 2274 ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */ 2275 break; 2276 } 2277 else 2278 { 2279 /** @todo: Output vbox_stat's stdout output to get more information about 2280 * what happened. */ 2281 2282 /* If there's at least one element which does not exist on the guest, 2283 * drop out with exitcode 1. */ 2284 if (!fExists) 2285 { 2286 if (fVerbose) 2287 RTPrintf("Cannot stat for element \"%s\": No such file or directory\n", 2288 it->first.c_str()); 2289 rcExit = RTEXITCODE_FAILURE; 2290 } 2291 } 2292 2293 it++; 2294 } 2295 2262 if (!cObjs) 2263 return errorSyntax(USAGE_GUESTCONTROL, "No element(s) to check specified!"); 2264 2265 if (Utf8UserName.isEmpty()) 2266 return errorSyntax(USAGE_GUESTCONTROL, "No user name specified!"); 2267 2268 /* 2269 * Create the directories. 2270 */ 2271 HRESULT hrc = S_OK; 2272 RTEXITCODE rcExit = RTEXITCODE_SUCCESS; 2273 DESTDIRMAPITER it = mapObjs.begin(); 2274 while (it != mapObjs.end()) 2275 { 2276 if (fVerbose) 2277 RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str()); 2278 2279 BOOL fExists; 2280 hrc = guest->FileExists(Bstr(it->first).raw(), 2281 Bstr(Utf8UserName).raw(), Bstr(Utf8Password).raw(), 2282 &fExists); 2296 2283 if (FAILED(hrc)) 2284 { 2285 ctrlPrintError(guest, COM_IIDOF(IGuest)); /* Return code ignored, save original rc. */ 2297 2286 rcExit = RTEXITCODE_FAILURE; 2287 } 2288 else 2289 { 2290 /** @todo: Output vbox_stat's stdout output to get more information about 2291 * what happened. */ 2292 2293 /* If there's at least one element which does not exist on the guest, 2294 * drop out with exitcode 1. */ 2295 if (!fExists) 2296 { 2297 if (fVerbose) 2298 RTPrintf("Cannot stat for element \"%s\": No such file or directory\n", 2299 it->first.c_str()); 2300 rcExit = RTEXITCODE_FAILURE; 2301 } 2302 } 2303 2304 it++; 2298 2305 } 2299 2306 … … 2443 2450 rcExit = handleCtrlExecProgram(guest, &arg); 2444 2451 else if (!strcmp(pArg->argv[1], "copyfrom")) 2445 rcExit = handleCtrlCopy To(guest, &arg, false /* Guest to host */);2452 rcExit = handleCtrlCopy(guest, &arg, false /* Guest to host */); 2446 2453 else if ( !strcmp(pArg->argv[1], "copyto") 2447 2454 || !strcmp(pArg->argv[1], "cp")) 2448 rcExit = handleCtrlCopy To(guest, &arg, true /* Host to guest */);2455 rcExit = handleCtrlCopy(guest, &arg, true /* Host to guest */); 2449 2456 else if ( !strcmp(pArg->argv[1], "createdirectory") 2450 2457 || !strcmp(pArg->argv[1], "createdir") -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r42395 r42444 439 439 " [<xorigin> <yorigin>]]] |\n" 440 440 " screenshotpng <file> [display] |\n" 441 " setcredentials <username> <password> <domain>\n" 441 " setcredentials <username>\n" 442 " --passwordfile <file> | <password>\n" 443 " <domain>\n" 442 444 " [--allowlocallogon <yes|no>] |\n" 443 445 " teleport --host <name> --port <port>\n"
Note:
See TracChangeset
for help on using the changeset viewer.