VirtualBox

Changeset 40724 in vbox


Ignore:
Timestamp:
Mar 30, 2012 11:21:27 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77189
Message:

VBoxManage modifyvm: --telporterpassword '-' for stdin

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r40714 r40724  
    321321                     "                            [--teleporteraddress <address|empty>\n"
    322322                     "                            [--teleporterpassword <password>]\n"
    323                      "                            [--teleporterpasswordfrom  <file>]\n"
     323                     "                            [--teleporterpasswordfrom  <file>|-]\n"
    324324                     "                            [--tracing-enabled on|off]\n"
    325325                     "                            [--tracing-config <config-string>]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r40714 r40724  
    22172217            {
    22182218                size_t cbFile;
    2219                 char *pszFileBuf;
    2220                 int vrc = RTFileReadAll(ValueUnion.psz, (void**)&pszFileBuf, &cbFile);
     2219                char szPasswd[512];
     2220                int vrc = VINF_SUCCESS;
     2221                bool fStdIn = !strcmp(ValueUnion.psz, "-");
     2222                PRTSTREAM pStrm;
     2223                if (!fStdIn)
     2224                    vrc = RTStrmOpen(ValueUnion.psz, "r", &pStrm);
     2225                else
     2226                    pStrm = g_pStdIn;
    22212227                if (RT_SUCCESS(vrc))
    22222228                {
    2223                     char szPasswd[512];
    2224                     for (unsigned i = 0;
    2225                             i < cbFile
    2226                          && i < sizeof(szPasswd)-1
    2227                          && !RT_C_IS_CNTRL(pszFileBuf[i]); i++)
    2228                         szPasswd[i] = pszFileBuf[i];
    2229 
    2230                     CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(szPasswd).raw()));
     2229                    vrc = RTStrmReadEx(pStrm, szPasswd, sizeof(szPasswd)-1, &cbFile);
     2230                    if (RT_SUCCESS(vrc))
     2231                    {
     2232                        if (cbFile >= sizeof(szPasswd)-1)
     2233                            errorArgument("Provided password too long");
     2234                        else
     2235                        {
     2236                            unsigned i;
     2237                            for (i = 0; i < cbFile && !RT_C_IS_CNTRL(szPasswd[i]); i++)
     2238                                ;
     2239                            szPasswd[i] = '\0';
     2240                            CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(szPasswd).raw()));
     2241                        }
     2242                    }
     2243                    if (!fStdIn)
     2244                        RTStrmClose(pStrm);
    22312245                }
    22322246                else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette