From nobody Tue Sep 9 23:38:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1738158289165496.16553854109725; Wed, 29 Jan 2025 05:44:49 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 98E5B17A6; Wed, 29 Jan 2025 08:44:48 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0944A17CF; Wed, 29 Jan 2025 08:41:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id CC5CC1709; Wed, 29 Jan 2025 08:41:48 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0F6CE16EF for ; Wed, 29 Jan 2025 08:41:37 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-K4WpobrMOKqQP-8TSBok3Q-1; Wed, 29 Jan 2025 08:41:35 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DF5C19560BB for ; Wed, 29 Jan 2025 13:41:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.35]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 70D171800951; Wed, 29 Jan 2025 13:41:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738158096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5beZwx0qJmvEzAy1ESmtUlG9Ug9jpsVpgrMMmwy8bSU=; b=Y45FWLBUMmPs8V0fluNCZ4E7/K63QSHOJqfhpIM1XZmqG/bPtdcH4B3a7+ja7B718sSfTN FCQ4+kLK/7nhXPd5ecwrGfMR6SDBGyvRSOlyziFkd/f19dlePOvm3W45WmO+zhymho2ErU yBouEaCcgsufxKFYNLxpncJ+K+zBdeI= X-MC-Unique: K4WpobrMOKqQP-8TSBok3Q-1 X-Mimecast-MFC-AGG-ID: K4WpobrMOKqQP-8TSBok3Q From: marcandre.lureau@redhat.com To: devel@lists.libvirt.org Subject: [PATCH 08/19] conf: parse optional RDP username & password Date: Wed, 29 Jan 2025 17:40:30 +0400 Message-ID: <20250129134042.1282472-9-marcandre.lureau@redhat.com> In-Reply-To: <20250129134042.1282472-1-marcandre.lureau@redhat.com> References: <20250129134042.1282472-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1ATsVWdMYHHvfH8jGwmRG9t7Xs3g-T8m2tqv8lND__U_1738158094 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3AZK63LTWIUJRRICRUQ7ZCAWEODTZ6LB X-Message-ID-Hash: 3AZK63LTWIUJRRICRUQ7ZCAWEODTZ6LB X-MailFrom: marcandre.lureau@redhat.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1738158290686019000 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Like VNC, allow to set credentials for RDP. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.c | 13 +++++++++++++ src/conf/domain_conf.h | 2 ++ src/conf/schemas/domaincommon.rng | 10 ++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 45c2cd09f1..35dbb13106 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1986,6 +1986,7 @@ virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDe= f *def) if (!def) return; =20 + VIR_FREE(def->username); VIR_FREE(def->passwd); =20 /* Don't free def */ @@ -11282,6 +11283,8 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, if (!def->passwd) return 0; =20 + def->username =3D virXMLPropString(node, "username"); + validTo =3D virXMLPropString(node, "passwdValidTo"); if (validTo) { g_autoptr(GDateTime) then =3D NULL; @@ -11671,6 +11674,10 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsD= ef *def, if (STREQ_NULLABLE(multiUser, "yes")) def->data.rdp.multiUser =3D true; =20 + if (virDomainGraphicsAuthDefParseXML(node, &def->data.rdp.auth, + def->type) < 0) + return -1; + return 0; } =20 @@ -26314,6 +26321,10 @@ virDomainGraphicsAuthDefFormatAttr(virBuffer *buf, if (!def->passwd) return; =20 + if (def->username) + virBufferEscapeString(buf, " username=3D'%s'", + def->username); + if (flags & VIR_DOMAIN_DEF_FORMAT_SECURE) virBufferEscapeString(buf, " passwd=3D'%s'", def->passwd); @@ -26543,6 +26554,8 @@ virDomainGraphicsDefFormat(virBuffer *buf, =20 virDomainGraphicsListenDefFormatAddr(buf, glisten, flags); =20 + virDomainGraphicsAuthDefFormatAttr(buf, &def->data.rdp.auth, flags= ); + break; =20 case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ba1a495764..e5c2c2157c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1903,6 +1903,7 @@ typedef enum { } virDomainGraphicsAuthConnectedType; =20 struct _virDomainGraphicsAuthDef { + char *username; char *passwd; bool expires; /* Whether there is an expiry time set */ time_t validTo; /* seconds since epoch */ @@ -2027,6 +2028,7 @@ struct _virDomainGraphicsDef { bool autoport; bool replaceUser; bool multiUser; + virDomainGraphicsAuthDef auth; } rdp; struct { char *display; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 5848d3eaaf..b5328601ff 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -4516,6 +4516,16 @@ + + + + + + + + + + --=20 2.47.0