VirtualBox

Ignore:
Timestamp:
May 10, 2022 2:48:36 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151394
Message:

Main/Update check Removed update agent-specific proxy settings. ​bugref:7983

File:
1 edited

Legend:

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

    r94756 r94981  
    4242
    4343
    44 /**
    45  * Returns the proxy mode as a string.
    46  *
    47  * @returns Proxy mode as string.
    48  * @param   enmMode             Proxy mode to return as string.
    49  */
    50 static const char *proxyModeToStr(ProxyMode_T enmMode)
    51 {
    52     switch (enmMode)
    53     {
    54         case ProxyMode_System:  return "System";
    55         case ProxyMode_Manual:  return "Manual";
    56         case ProxyMode_NoProxy: return "None";
    57         default:                break;
    58     }
    59 
    60     AssertFailed();
    61     return "<Invalid>";
    62 }
    63 
    6444static RTEXITCODE doUpdateList(int argc, char **argv, ComPtr<IUpdateAgent> pUpdateAgent)
    6545{
     
    167147        RTPrintf(UpdateCheck::tr("Repository:             %ls\n"), bstrVal.raw());
    168148
    169     ProxyMode_T enmProxyMode;
    170     CHECK_ERROR2I_RET(pUpdateAgent, COMGETTER(ProxyMode)(&enmProxyMode), RTEXITCODE_FAILURE);
    171     if (fMachineReadable)
    172         outputMachineReadableString("proxy-mode", proxyModeToStr(enmProxyMode));
    173     else
    174         RTPrintf(UpdateCheck::tr("Proxy mode:             %s\n"), proxyModeToStr(enmProxyMode));
    175     CHECK_ERROR2I_RET(pUpdateAgent, COMGETTER(ProxyURL)(bstrVal.asOutParam()), RTEXITCODE_FAILURE);
    176     if (fMachineReadable)
    177         outputMachineReadableString("proxy-url", &bstrVal);
    178     else
    179         RTPrintf(UpdateCheck::tr("Proxy URL:              %ls\n"), bstrVal.raw());
    180 
    181149    return RTEXITCODE_SUCCESS;
    182150}
     
    187155     * Parse options.
    188156     */
    189     enum GETOPTDEF_UPDATEMODIFY
    190     {
    191         GETOPTDEF_UPDATEMODIFY_PROXY_MODE = 2000,
    192         GETOPTDEF_UPDATEMODIFY_PROXY_URL
    193     };
    194157    static const RTGETOPTDEF s_aOptions[] =
    195158    {
     
    198161        { "--channel",       'c',                                   RTGETOPT_REQ_STRING  },
    199162        { "--frequency",     'f',                                   RTGETOPT_REQ_UINT32  },
    200         { "--proxy-mode",    GETOPTDEF_UPDATEMODIFY_PROXY_MODE,     RTGETOPT_REQ_STRING  },
    201         { "--proxy-url",     GETOPTDEF_UPDATEMODIFY_PROXY_URL,      RTGETOPT_REQ_STRING  }
    202163    };
    203164
     
    209170    UpdateChannel_T             enmChannel     = (UpdateChannel_T)-1;
    210171    uint32_t                    cFrequencyDays = 0;
    211     ProxyMode_T                 enmProxyMode   = (ProxyMode_T)-1; /* Default  if not modified, or ProxyMode_T values. */
    212     Bstr                        strProxyURL    = "unmodified";    /* Default if not modified, so that empty values also can be set (clears proxy). */
    213172
    214173    int c;
     
    244203                break;
    245204
    246             case GETOPTDEF_UPDATEMODIFY_PROXY_MODE:
    247                 if (!RTStrICmp(ValueUnion.psz, "system"))
    248                     enmProxyMode = ProxyMode_System;
    249                 else if (   !RTStrICmp(ValueUnion.psz, "none")
    250                          || !RTStrICmp(ValueUnion.psz, "disabled")
    251                          || !RTStrICmp(ValueUnion.psz, "off"))
    252                     enmProxyMode = ProxyMode_NoProxy;
    253                 else if (!RTStrICmp(ValueUnion.psz, "manual"))
    254                     enmProxyMode = ProxyMode_Manual;
    255                 else
    256                     return errorArgument(UpdateCheck::tr("Invalid proxy mode specified: '%s'"), ValueUnion.psz);
    257                 break;
    258 
    259             case GETOPTDEF_UPDATEMODIFY_PROXY_URL:
    260                 strProxyURL = ValueUnion.psz;
    261                 break;
    262 
    263205            /** @todo Add more options like repo handling etc. */
    264206
     
    270212    if (   fEnabled       == -1
    271213        && enmChannel     == (UpdateChannel_T)-1
    272         && cFrequencyDays == 0
    273         && enmProxyMode   == (ProxyMode_T)-1
    274         && strProxyURL    == "unmodified")
     214        && cFrequencyDays == 0)
    275215        return errorSyntax(UpdateCheck::tr("No change requested"));
    276216
     
    289229    {
    290230        CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(CheckFrequency)(cFrequencyDays * RT_SEC_1DAY), RTEXITCODE_FAILURE);
    291     }
    292     if (enmProxyMode != (ProxyMode_T)-1)
    293     {
    294         CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(ProxyMode)(enmProxyMode), RTEXITCODE_FAILURE);
    295     }
    296     if (strProxyURL.compare("unmodified") != 0)
    297     {
    298         CHECK_ERROR2I_RET(pUpdateAgent, COMSETTER(ProxyURL)(strProxyURL.raw()), RTEXITCODE_FAILURE);
    299231    }
    300232    return RTEXITCODE_SUCCESS;
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