Changeset 54885 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 20, 2015 5:38:27 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r54487 r54885 492 492 { "clonevdi", USAGE_CLONEMEDIUM, handleCloneMedium }, /* backward compatibility */ 493 493 { "encryptmedium", USAGE_ENCRYPTMEDIUM, handleEncryptMedium}, 494 { "checkmediumpwd", USAGE_MEDIUMENCCHKPWD, handleCheckMediumPassword}, 494 495 { "createvm", USAGE_CREATEVM, handleCreateVM }, 495 496 { "modifyvm", USAGE_MODIFYVM, handleModifyVM }, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r54487 r54885 106 106 #define USAGE_MEDIUMPROPERTY RT_BIT_64(60) 107 107 #define USAGE_ENCRYPTMEDIUM RT_BIT_64(61) 108 #define USAGE_MEDIUMENCCHKPWD RT_BIT_64(62) 108 109 #define USAGE_ALL (~(uint64_t)0) 109 110 /** @} */ … … 264 265 int handleMediumProperty(HandlerArg *a); 265 266 int handleEncryptMedium(HandlerArg *a); 267 int handleCheckMediumPassword(HandlerArg *a); 266 268 RTEXITCODE handleConvertFromRaw(int argc, char *argv[]); 267 269 HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r54854 r54885 1841 1841 } 1842 1842 1843 int handleCheckMediumPassword(HandlerArg *a) 1844 { 1845 HRESULT rc; 1846 int vrc; 1847 ComPtr<IMedium> hardDisk; 1848 const char *pszFilenameOrUuid = NULL; 1849 Utf8Str strPassword; 1850 1851 if (a->argc != 2) 1852 return errorSyntax(USAGE_MEDIUMENCCHKPWD, "Invalid number of arguments: %d", a->argc); 1853 1854 pszFilenameOrUuid = a->argv[0]; 1855 1856 if (!RTStrCmp(a->argv[1], "-")) 1857 { 1858 /* Get password from console. */ 1859 vrc = getPassword("Enter password:", &strPassword); 1860 if (RT_FAILURE(vrc)) 1861 { 1862 RTMsgError("Failed to read password from standard input"); 1863 return 1; 1864 } 1865 } 1866 else 1867 { 1868 RTEXITCODE rcExit = readPasswordFile(a->argv[1], &strPassword); 1869 if (rcExit == RTEXITCODE_FAILURE) 1870 { 1871 RTMsgError("Failed to read password from file"); 1872 return rcExit; 1873 } 1874 } 1875 1876 /* Always open the medium if necessary, there is no other way. */ 1877 rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk, 1878 AccessMode_ReadWrite, hardDisk, 1879 false /* fForceNewUuidOnOpen */, false /* fSilent */); 1880 if (FAILED(rc)) 1881 return 1; 1882 if (hardDisk.isNull()) 1883 { 1884 RTMsgError("Invalid hard disk reference, avoiding crash"); 1885 return 1; 1886 } 1887 1888 CHECK_ERROR(hardDisk, CheckEncryptionPassword(Bstr(strPassword).raw())); 1889 if (SUCCEEDED(rc)) 1890 RTPrintf("The given password is correct\n"); 1891 return SUCCEEDED(rc) ? 0 : 1; 1892 } 1893 1843 1894 #endif /* !VBOX_ONLY_DOCS */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r54725 r54885 645 645 "\n", SEP); 646 646 647 if (fCategory & USAGE_MEDIUMENCCHKPWD) 648 RTStrmPrintf(pStrm, 649 "%s checkmediumpwd %s <uuid|filename>\n" 650 " <pwd file>|-\n" 651 "\n", SEP); 652 647 653 if (fCategory & USAGE_CONVERTFROMRAW) 648 654 RTStrmPrintf(pStrm,
Note:
See TracChangeset
for help on using the changeset viewer.