mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virStorageBackendRBDOpenRADOSConn: Use virSecureEraseString instead of VIR_AUTODISPOSE_STR
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3b1d2ff510
commit
7f0780c0d2
@ -188,7 +188,6 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
|
|||||||
virStorageAuthDefPtr authdef = source->auth;
|
virStorageAuthDefPtr authdef = source->auth;
|
||||||
g_autofree unsigned char *secret_value = NULL;
|
g_autofree unsigned char *secret_value = NULL;
|
||||||
size_t secret_value_size = 0;
|
size_t secret_value_size = 0;
|
||||||
VIR_AUTODISPOSE_STR rados_key = NULL;
|
|
||||||
g_auto(virBuffer) mon_host = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) mon_host = VIR_BUFFER_INITIALIZER;
|
||||||
size_t i;
|
size_t i;
|
||||||
const char *client_mount_timeout = "30";
|
const char *client_mount_timeout = "30";
|
||||||
@ -199,6 +198,9 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
|
|||||||
g_autofree char *mon_buff = NULL;
|
g_autofree char *mon_buff = NULL;
|
||||||
|
|
||||||
if (authdef) {
|
if (authdef) {
|
||||||
|
g_autofree char *rados_key = NULL;
|
||||||
|
int rc;
|
||||||
|
|
||||||
VIR_DEBUG("Using cephx authorization, username: %s", authdef->username);
|
VIR_DEBUG("Using cephx authorization, username: %s", authdef->username);
|
||||||
|
|
||||||
if (rados_create(&ptr->cluster, authdef->username) < 0) {
|
if (rados_create(&ptr->cluster, authdef->username) < 0) {
|
||||||
@ -218,8 +220,10 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr ptr,
|
|||||||
rados_key = g_base64_encode(secret_value, secret_value_size);
|
rados_key = g_base64_encode(secret_value, secret_value_size);
|
||||||
virSecureErase(secret_value, secret_value_size);
|
virSecureErase(secret_value, secret_value_size);
|
||||||
|
|
||||||
if (virStorageBackendRBDRADOSConfSet(ptr->cluster,
|
rc = virStorageBackendRBDRADOSConfSet(ptr->cluster, "key", rados_key);
|
||||||
"key", rados_key) < 0)
|
virSecureEraseString(rados_key);
|
||||||
|
|
||||||
|
if (rc < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virStorageBackendRBDRADOSConfSet(ptr->cluster,
|
if (virStorageBackendRBDRADOSConfSet(ptr->cluster,
|
||||||
|
Loading…
Reference in New Issue
Block a user