support authz ACL Xml format. Signed-off-by: Zihao Chang <changzihao1@xxxxxxxxxx> --- src/conf/domain_conf.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e303bd76b779..de1813227f03 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26960,9 +26960,9 @@ virDomainTimerDefFormat(virBufferPtr buf, } static void -virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf, - virDomainGraphicsAuthDefPtr def, - unsigned int flags) +virDomainGraphicsPasswdDefFormatAttr(virBufferPtr buf, + virDomainGraphicsAuthDefPtr def, + unsigned int flags) { if (!def->passwd) return; @@ -26986,6 +26986,34 @@ virDomainGraphicsAuthDefFormatAttr(virBufferPtr buf, } +static void +virDomainGraphicsAuthzDefFormatAttr(virBufferPtr buf, + virDomainGraphicsAuthzDefPtr def) +{ + virBufferAsprintf(buf, "<authz type='%s' index='%lu'/>\n", + virDomainAuthzTypeTypeToString(def->type), + def->index); + return; +} + + +static void +virDomainGraphicsAuthzsDefFormatAttr(virBufferPtr buf, + virDomainGraphicsAuthDefPtr def) +{ + size_t i; + + if (!def->nAuthzs) + return; + + for (i = 0; i < def->nAuthzs; i++) { + virDomainGraphicsAuthzDefFormatAttr(buf, &def->authzs[i]); + } + + return; +} + + static void virDomainGraphicsListenDefFormat(virBufferPtr buf, virDomainGraphicsListenDefPtr def, @@ -27149,7 +27177,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainGraphicsVNCSharePolicyTypeToString( def->data.vnc.sharePolicy)); - virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, flags); + virDomainGraphicsPasswdDefFormatAttr(buf, &def->data.vnc.auth, flags); break; case VIR_DOMAIN_GRAPHICS_TYPE_SDL: @@ -27261,7 +27289,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " defaultMode='%s'", virDomainGraphicsSpiceChannelModeTypeToString(def->data.spice.defaultMode)); - virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags); + virDomainGraphicsPasswdDefFormatAttr(buf, &def->data.spice.auth, flags); break; case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: @@ -27317,6 +27345,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainGraphicsListenDefFormat(buf, &def->listens[i], flags); } + virDomainGraphicsAuthzsDefFormatAttr(buf, &def->data.vnc.auth); + if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { for (i = 0; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST; i++) { int mode = def->data.spice.channels[i]; -- 2.28.0