From nobody Sat Sep 21 05:27:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1632310576; cv=none; d=zohomail.com; s=zohoarc; b=NW4fadF3JmAgir/oj0CKmXMuRZwIQKY816gRaI1CeKtYh+UfFbV7ACh5NG+LU5kYL9eTWePbp+TSwpt44D1AwpJ7ybRXjLsETIgBg/l2Mm5EPHZ0KsJacWTNDGQ8eMJ6SfslYXUoQMdJh+fB2M4hEereUHyp7YCHR2OuSKSirBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632310576; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5Ibd4g8vXNA+Ajs+IBNLcE4ACDxvt7v0KjMmYSbvRHo=; b=GEmgle32CVDpIQ5qtpwBZLdcqNvSQqWLKNCOHzCExgyh0yCKJoOWntCBOWqQxupkuAcagIEa28lbGVJUWlQCfjC0pmPCCFCeNO0b+A7PLzqW6mYE8zMNBTbCJpZCK0TFTzdsaMWL/o68bXZ+5DJopf1PXWPkX1cEMc9/PX1aIwc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1632310576162385.8977668483741; Wed, 22 Sep 2021 04:36:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-91-fQN-7JXUOc2Wg_KlN3boMw-1; Wed, 22 Sep 2021 07:36:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B2B7100C661; Wed, 22 Sep 2021 11:36:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D91C2108C7; Wed, 22 Sep 2021 11:36:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A20E41806D04; Wed, 22 Sep 2021 11:36:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18MBZkvD006676 for ; Wed, 22 Sep 2021 07:35:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id A351A60843; Wed, 22 Sep 2021 11:35:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 056B260877 for ; Wed, 22 Sep 2021 11:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632310575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5Ibd4g8vXNA+Ajs+IBNLcE4ACDxvt7v0KjMmYSbvRHo=; b=B8O5QyT3uuuHucaDJzSUrbqA/ND7LLj6uitqcYhHuvdSG6pG/EaToGyBUslP8S7Rjiv57W 3tYq6E2NsKqs5WTXWcuR+Fth86k/GqqNHUuCPkebNTCy5IwGlvQpKWTo4v553GCJF2Kolq 4wESMJD1yZYuX6nKjQit7kBM18lVx2M= X-MC-Unique: fQN-7JXUOc2Wg_KlN3boMw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/12] qemu: Remove VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN and associated code Date: Wed, 22 Sep 2021 13:35:26 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632310578299100005 Content-Type: text/plain; charset="utf-8" There's no code which could set it any more so we can remove the generators. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 29 +---------------------------- src/qemu/qemu_domain.c | 13 ------------- src/qemu/qemu_domain.h | 9 --------- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 39659fe4f6..6e8699a3c6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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 =3D g_strdup_printf("%s:%s", secinfo->s.plain.userna= me, - secinfo->s.plain.secret); - } else { - uri->user =3D 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 =3D NULL; - if (!secinfo) { virBufferAddLit(buf, ":auth_supported=3Dnone"); return 0; } switch ((qemuDomainSecretInfoType) secinfo->type) { - case VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN: - base64secret =3D g_base64_encode(secinfo->s.plain.secret, - secinfo->s.plain.secretlen); - virBufferEscape(buf, '\\', ":", ":id=3D%s", secinfo->s.plain.usern= ame); - virBufferEscape(buf, '\\', ":", - ":key=3D%s:auth_supported=3Dcephx\\;none", - base64secret); - virSecureEraseString(base64secret); - break; - case VIR_DOMAIN_SECRET_INFO_TYPE_AES: virBufferEscape(buf, '\\', ":", ":id=3D%s:auth_supported=3Dcephx\\= ;none", secinfo->s.aes.username); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 73e69d1558..e9c1f3eacb 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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 *secinf= o, 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; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 08f33f0f9e..cb5c665766 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -92,19 +92,11 @@ struct _qemuDomainUnpluggingDevice { /* Type of domain secret */ typedef enum { - VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN =3D 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 qemuDomainSecretIn= fo; struct _qemuDomainSecretInfo { qemuDomainSecretInfoType type; union { - qemuDomainSecretPlain plain; qemuDomainSecretAES aes; } s; }; --=20 2.31.1