- Timestamp:
- Jan 24, 2023 1:30:57 AM (21 months ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Main/src-client/CloudGateway.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/CloudGateway.cpp
r98103 r98261 61 61 static HRESULT setMacAddress(const Utf8Str& str, RTMAC& mac) 62 62 { 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)) 65 65 { 66 66 LogRel(("CLOUD-NET: Invalid MAC address '%s'\n", str.c_str())); … … 104 104 Utf8Str strError(pszFormat, va); 105 105 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)); 107 107 throw CloudError(hrc, strError); 108 108 } … … 220 220 char szKeyPath[RTPATH_MAX]; 221 221 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)) 224 224 { 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)); 230 230 } 231 231 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)); 233 233 # endif /* DEBUG */ 234 234 #endif … … 237 237 { 238 238 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)); 240 240 } 241 241 gateway.mGatewayInstanceId.setNull(); … … 251 251 #else /* VBOX_WITH_LIBSSH */ 252 252 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)); 257 257 return E_FAIL; 258 258 } 259 259 260 260 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)); 265 265 return E_FAIL; 266 266 } … … 270 270 char szConfigPath[RTPATH_MAX]; 271 271 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) 279 279 { 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)); 281 281 return E_FAIL; 282 282 } 283 283 # 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); 286 286 # endif 287 287 } 288 288 else 289 289 { 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)); 291 291 return E_FAIL; 292 292 } … … 295 295 ssh_string_free_char(pstrKey); 296 296 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)); 301 301 return E_FAIL; 302 302 }
Note:
See TracChangeset
for help on using the changeset viewer.

