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
|
* -1 and error message if fail to add secret information
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qemuBuildGeneralSecinfoURI(virURI *uri,
|
qemuBuildGeneralSecinfoURI(virURI *uri G_GNUC_UNUSED,
|
||||||
qemuDomainSecretInfo *secinfo)
|
qemuDomainSecretInfo *secinfo)
|
||||||
{
|
{
|
||||||
if (!secinfo)
|
if (!secinfo)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
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_AES:
|
||||||
case VIR_DOMAIN_SECRET_INFO_TYPE_LAST:
|
case VIR_DOMAIN_SECRET_INFO_TYPE_LAST:
|
||||||
return -1;
|
return -1;
|
||||||
@ -806,24 +791,12 @@ static int
|
|||||||
qemuBuildRBDSecinfoURI(virBuffer *buf,
|
qemuBuildRBDSecinfoURI(virBuffer *buf,
|
||||||
qemuDomainSecretInfo *secinfo)
|
qemuDomainSecretInfo *secinfo)
|
||||||
{
|
{
|
||||||
g_autofree char *base64secret = NULL;
|
|
||||||
|
|
||||||
if (!secinfo) {
|
if (!secinfo) {
|
||||||
virBufferAddLit(buf, ":auth_supported=none");
|
virBufferAddLit(buf, ":auth_supported=none");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
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:
|
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
||||||
virBufferEscape(buf, '\\', ":", ":id=%s:auth_supported=cephx\\;none",
|
virBufferEscape(buf, '\\', ":", ":id=%s:auth_supported=cephx\\;none",
|
||||||
secinfo->s.aes.username);
|
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
|
static void
|
||||||
qemuDomainSecretAESClear(struct _qemuDomainSecretAES *secret,
|
qemuDomainSecretAESClear(struct _qemuDomainSecretAES *secret,
|
||||||
bool keepAlias)
|
bool keepAlias)
|
||||||
@ -687,10 +678,6 @@ qemuDomainSecretInfoClear(qemuDomainSecretInfo *secinfo,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
switch ((qemuDomainSecretInfoType) secinfo->type) {
|
||||||
case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN:
|
|
||||||
qemuDomainSecretPlainClear(&secinfo->s.plain);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
case VIR_DOMAIN_SECRET_INFO_TYPE_AES:
|
||||||
qemuDomainSecretAESClear(&secinfo->s.aes, keepAlias);
|
qemuDomainSecretAESClear(&secinfo->s.aes, keepAlias);
|
||||||
break;
|
break;
|
||||||
|
@ -92,19 +92,11 @@ struct _qemuDomainUnpluggingDevice {
|
|||||||
|
|
||||||
/* Type of domain secret */
|
/* Type of domain secret */
|
||||||
typedef enum {
|
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_AES, /* utilize GNUTLS_CIPHER_AES_256_CBC */
|
||||||
|
|
||||||
VIR_DOMAIN_SECRET_INFO_TYPE_LAST
|
VIR_DOMAIN_SECRET_INFO_TYPE_LAST
|
||||||
} qemuDomainSecretInfoType;
|
} 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 */
|
#define QEMU_DOMAIN_AES_IV_LEN 16 /* 16 bytes for 128 bit random */
|
||||||
/* initialization vector */
|
/* initialization vector */
|
||||||
typedef struct _qemuDomainSecretAES qemuDomainSecretAES;
|
typedef struct _qemuDomainSecretAES qemuDomainSecretAES;
|
||||||
@ -119,7 +111,6 @@ typedef struct _qemuDomainSecretInfo qemuDomainSecretInfo;
|
|||||||
struct _qemuDomainSecretInfo {
|
struct _qemuDomainSecretInfo {
|
||||||
qemuDomainSecretInfoType type;
|
qemuDomainSecretInfoType type;
|
||||||
union {
|
union {
|
||||||
qemuDomainSecretPlain plain;
|
|
||||||
qemuDomainSecretAES aes;
|
qemuDomainSecretAES aes;
|
||||||
} s;
|
} s;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user