mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
qemu: Remove VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN and associated code
There's no code which could set it any more so we can remove the generators. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
09466e1f62
commit
ed98e8ec99
@ -760,28 +760,13 @@ qemuBuildObjectSecretCommandLine(virCommand *cmd,
|
||||
* -1 and error message if fail to add secret information
|
||||
*/
|
||||
static int
|
||||
qemuBuildGeneralSecinfoURI(virURI *uri,
|
||||
qemuBuildGeneralSecinfoURI(virURI *uri G_GNUC_UNUSED,
|
||||
qemuDomainSecretInfo *secinfo)
|
||||
{
|
||||
if (!secinfo)
|
||||
return 0;
|
||||
|
||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN:
|
||||
if (secinfo->s.plain.secret) {
|
||||
if (!virStringBufferIsPrintable(secinfo->s.plain.secret,
|
||||
secinfo->s.plain.secretlen)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("found non printable characters in secret"));
|
||||
return -1;
|
||||
}
|
||||
uri->user = g_strdup_printf("%s:%s", secinfo->s.plain.username,
|
||||
secinfo->s.plain.secret);
|
||||
} else {
|
||||
uri->user = g_strdup(secinfo->s.plain.username);
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_LAST:
|
||||
return -1;
|
||||
@ -806,24 +791,12 @@ static int
|
||||
qemuBuildRBDSecinfoURI(virBuffer *buf,
|
||||
qemuDomainSecretInfo *secinfo)
|
||||
{
|
||||
g_autofree char *base64secret = NULL;
|
||||
|
||||
if (!secinfo) {
|
||||
virBufferAddLit(buf, ":auth_supported=none");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN:
|
||||
base64secret = g_base64_encode(secinfo->s.plain.secret,
|
||||
secinfo->s.plain.secretlen);
|
||||
virBufferEscape(buf, '\\', ":", ":id=%s", secinfo->s.plain.username);
|
||||
virBufferEscape(buf, '\\', ":",
|
||||
":key=%s:auth_supported=cephx\\;none",
|
||||
base64secret);
|
||||
virSecureEraseString(base64secret);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
||||
virBufferEscape(buf, '\\', ":", ":id=%s:auth_supported=cephx\\;none",
|
||||
secinfo->s.aes.username);
|
||||
|
@ -657,15 +657,6 @@ qemuDomainMasterKeyCreate(virDomainObj *vm)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuDomainSecretPlainClear(struct _qemuDomainSecretPlain *secret)
|
||||
{
|
||||
VIR_FREE(secret->username);
|
||||
virSecureErase(secret->secret, secret->secretlen);
|
||||
g_clear_pointer(&secret->secret, g_free);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuDomainSecretAESClear(struct _qemuDomainSecretAES *secret,
|
||||
bool keepAlias)
|
||||
@ -687,10 +678,6 @@ qemuDomainSecretInfoClear(qemuDomainSecretInfo *secinfo,
|
||||
return;
|
||||
|
||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN:
|
||||
qemuDomainSecretPlainClear(&secinfo->s.plain);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
||||
qemuDomainSecretAESClear(&secinfo->s.aes, keepAlias);
|
||||
break;
|
||||
|
@ -92,19 +92,11 @@ struct _qemuDomainUnpluggingDevice {
|
||||
|
||||
/* Type of domain secret */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN = 0,
|
||||
VIR_DOMAIN_SECRET_INFO_TYPE_AES, /* utilize GNUTLS_CIPHER_AES_256_CBC */
|
||||
|
||||
VIR_DOMAIN_SECRET_INFO_TYPE_LAST
|
||||
} qemuDomainSecretInfoType;
|
||||
|
||||
typedef struct _qemuDomainSecretPlain qemuDomainSecretPlain;
|
||||
struct _qemuDomainSecretPlain {
|
||||
char *username;
|
||||
uint8_t *secret;
|
||||
size_t secretlen;
|
||||
};
|
||||
|
||||
#define QEMU_DOMAIN_AES_IV_LEN 16 /* 16 bytes for 128 bit random */
|
||||
/* initialization vector */
|
||||
typedef struct _qemuDomainSecretAES qemuDomainSecretAES;
|
||||
@ -119,7 +111,6 @@ typedef struct _qemuDomainSecretInfo qemuDomainSecretInfo;
|
||||
struct _qemuDomainSecretInfo {
|
||||
qemuDomainSecretInfoType type;
|
||||
union {
|
||||
qemuDomainSecretPlain plain;
|
||||
qemuDomainSecretAES aes;
|
||||
} s;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user