VirtualBox

Changeset 98261 in vbox for trunk


Ignore:
Timestamp:
Jan 24, 2023 1:30:57 AM (21 months ago)
Author:
vboxsync
Message:

Main/CloudGateway.cpp: rc -> vrc/hrc bugref:10223

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/CloudGateway.cpp

    r98103 r98261  
    6161static HRESULT setMacAddress(const Utf8Str& str, RTMAC& mac)
    6262{
    63     int rc = RTNetStrToMacAddr(str.c_str(), &mac);
    64     if (RT_FAILURE(rc))
     63    int vrc = RTNetStrToMacAddr(str.c_str(), &mac);
     64    if (RT_FAILURE(vrc))
    6565    {
    6666        LogRel(("CLOUD-NET: Invalid MAC address '%s'\n", str.c_str()));
     
    104104        Utf8Str strError(pszFormat, va);
    105105        va_end(va);
    106         LogRel(("CLOUD-NET: %s (rc=%x)\n", strError.c_str(), hrc));
     106        LogRel(("CLOUD-NET: %s (hrc=%x)\n", strError.c_str(), hrc));
    107107        throw CloudError(hrc, strError);
    108108    }
     
    220220        char szKeyPath[RTPATH_MAX];
    221221
    222         int rc = GetVBoxUserHomeDirectory(szKeyPath, sizeof(szKeyPath), false /* fCreateDir */);
    223         if (RT_SUCCESS(rc))
     222        int vrc = GetVBoxUserHomeDirectory(szKeyPath, sizeof(szKeyPath), false /* fCreateDir */);
     223        if (RT_SUCCESS(vrc))
    224224        {
    225             rc = RTPathAppend(szKeyPath, sizeof(szKeyPath), "gateway-key.pem");
    226             AssertRCReturn(rc, rc);
    227             rc = RTFileDelete(szKeyPath);
    228             if (RT_FAILURE(rc))
    229                 LogRel(("WARNING! Failed to delete private key %s with rc=%d\n", szKeyPath, rc));
     225            vrc = RTPathAppend(szKeyPath, sizeof(szKeyPath), "gateway-key.pem");
     226            AssertRCReturn(vrc, vrc);
     227            vrc = RTFileDelete(szKeyPath);
     228            if (RT_FAILURE(vrc))
     229                LogRel(("WARNING! Failed to delete private key %s with vrc=%d\n", szKeyPath, vrc));
    230230        }
    231231        else
    232             LogRel(("WARNING! Failed to get VirtualBox user home directory with '%Rrc'\n", rc));
     232            LogRel(("WARNING! Failed to get VirtualBox user home directory with '%Rrc'\n", vrc));
    233233# endif /* DEBUG */
    234234#endif
     
    237237    {
    238238        hrc = e.getRc();
    239         LogRel(("CLOUD-NET: Failed to terminate cloud gateway instance (rc=%x).\n", hrc));
     239        LogRel(("CLOUD-NET: Failed to terminate cloud gateway instance (hrc=%x).\n", hrc));
    240240    }
    241241    gateway.mGatewayInstanceId.setNull();
     
    251251#else /* VBOX_WITH_LIBSSH */
    252252    ssh_key single_use_key;
    253     int rc = ssh_pki_generate(SSH_KEYTYPE_RSA, 2048, &single_use_key);
    254     if (rc != SSH_OK)
    255     {
    256         LogRel(("Failed to generate a key pair. rc = %d\n", rc));
     253    int iRcSsh = ssh_pki_generate(SSH_KEYTYPE_RSA, 2048, &single_use_key);
     254    if (iRcSsh != SSH_OK)
     255    {
     256        LogRel(("Failed to generate a key pair. iRcSsh = %d\n", iRcSsh));
    257257        return E_FAIL;
    258258    }
    259259
    260260    char *pstrKey = NULL;
    261     rc = ssh_pki_export_privkey_base64(single_use_key, NULL, NULL, NULL, &pstrKey);
    262     if (rc != SSH_OK)
    263     {
    264         LogRel(("Failed to export private key. rc = %d\n", rc));
     261    iRcSsh = ssh_pki_export_privkey_base64(single_use_key, NULL, NULL, NULL, &pstrKey);
     262    if (iRcSsh != SSH_OK)
     263    {
     264        LogRel(("Failed to export private key. iRcSsh = %d\n", iRcSsh));
    265265        return E_FAIL;
    266266    }
     
    270270    char szConfigPath[RTPATH_MAX];
    271271
    272     rc = GetVBoxUserHomeDirectory(szConfigPath, sizeof(szConfigPath), false /* fCreateDir */);
    273     if (RT_SUCCESS(rc))
    274     {
    275         rc = RTPathAppend(szConfigPath, sizeof(szConfigPath), "gateway-key.pem");
    276         AssertRCReturn(rc, rc);
    277         rc = ssh_pki_export_privkey_file(single_use_key, NULL, NULL, NULL, szConfigPath);
    278         if (rc != SSH_OK)
     272    vrc = GetVBoxUserHomeDirectory(szConfigPath, sizeof(szConfigPath), false /* fCreateDir */);
     273    if (RT_SUCCESS(vrc))
     274    {
     275        vrc = RTPathAppend(szConfigPath, sizeof(szConfigPath), "gateway-key.pem");
     276        AssertRCReturn(vrc, E_FAIL);
     277        iRcSsh = ssh_pki_export_privkey_file(single_use_key, NULL, NULL, NULL, szConfigPath);
     278        if (iRcSsh != SSH_OK)
    279279        {
    280             LogRel(("Failed to export private key to %s with rc=%d\n", szConfigPath, rc));
     280            LogRel(("Failed to export private key to %s with iRcSsh=%d\n", szConfigPath, iRcSsh));
    281281            return E_FAIL;
    282282        }
    283283#  ifndef RT_OS_WINDOWS
    284         rc = RTPathSetMode(szConfigPath, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR); /* Satisfy ssh client */
    285         AssertRCReturn(rc, rc);
     284        vrc = RTPathSetMode(szConfigPath, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR); /* Satisfy ssh client */
     285        AssertRCReturn(vrc, E_FAIL);
    286286#  endif
    287287    }
    288288    else
    289289    {
    290         LogRel(("Failed to get VirtualBox user home directory with '%Rrc'\n", rc));
     290        LogRel(("Failed to get VirtualBox user home directory with '%Rrc'\n", vrc));
    291291        return E_FAIL;
    292292    }
     
    295295    ssh_string_free_char(pstrKey);
    296296    pstrKey = NULL;
    297     rc = ssh_pki_export_pubkey_base64(single_use_key, &pstrKey);
    298     if (rc != SSH_OK)
    299     {
    300         LogRel(("Failed to export public key. rc = %d\n", rc));
     297    iRcSsh = ssh_pki_export_pubkey_base64(single_use_key, &pstrKey);
     298    if (iRcSsh != SSH_OK)
     299    {
     300        LogRel(("Failed to export public key. iRcSsh = %d\n", iRcSsh));
    301301        return E_FAIL;
    302302    }
Note: See TracChangeset for help on using the changeset viewer.

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