1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

conf: parse optional RDP username & password

Like VNC, allow to set credentials for RDP.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Marc-André Lureau 2025-03-16 12:18:28 +04:00 committed by Martin Kletzander
parent bd5f4d3237
commit bfa7d5aaa8
3 changed files with 25 additions and 0 deletions

View File

@ -1994,6 +1994,7 @@ virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDef *def)
if (!def)
return;
VIR_FREE(def->username);
VIR_FREE(def->passwd);
/* Don't free def */
@ -11319,6 +11320,8 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
if (!def->passwd)
return 0;
def->username = virXMLPropString(node, "username");
validTo = virXMLPropString(node, "passwdValidTo");
if (validTo) {
g_autoptr(GDateTime) then = NULL;
@ -11708,6 +11711,10 @@ virDomainGraphicsDefParseXMLRDP(virDomainGraphicsDef *def,
if (STREQ_NULLABLE(multiUser, "yes"))
def->data.rdp.multiUser = true;
if (virDomainGraphicsAuthDefParseXML(node, &def->data.rdp.auth,
def->type) < 0)
return -1;
return 0;
}
@ -26306,6 +26313,10 @@ virDomainGraphicsAuthDefFormatAttr(virBuffer *buf,
if (!def->passwd)
return;
if (def->username)
virBufferEscapeString(buf, " username='%s'",
def->username);
if (flags & VIR_DOMAIN_DEF_FORMAT_SECURE)
virBufferEscapeString(buf, " passwd='%s'",
def->passwd);
@ -26580,6 +26591,8 @@ virDomainGraphicsDefFormatRDP(virBuffer *attrBuf,
virDomainGraphicsListenDefFormatAddr(attrBuf, glisten, flags);
virDomainGraphicsAuthDefFormatAttr(attrBuf, &def->data.rdp.auth, flags);
virDomainGraphicsDefFormatListnes(childBuf, def, flags);
}

View File

@ -1903,6 +1903,7 @@ typedef enum {
} virDomainGraphicsAuthConnectedType;
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;

View File

@ -4540,6 +4540,16 @@
<ref name="addrIPorName"/>
</attribute>
</optional>
<optional>
<attribute name="username">
<text/>
</attribute>
</optional>
<optional>
<attribute name="passwd">
<text/>
</attribute>
</optional>
<ref name="listenElements"/>
</group>
<group>