Bug 1777146

Summary: Sys::Virt::IDENTITY_SASL_USER_NAME field is passed as VIR_TYPED_PARAM_INT by mistake, but should be VIR_TYPED_PARAM_STRING
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Dan Zheng <dzheng>
Component: perl-Sys-VirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Dan Zheng <dzheng>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.2CC: dzheng, xuzhang
Target Milestone: rcKeywords: Automation
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: perl-Sys-Virt-6.0.0-1.module+el8.2.0+5488+267def79 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 09:51:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Zheng 2019-11-27 02:40:29 UTC
Description of problem:
Sys::Virt::IDENTITY_SASL_USER_NAME field is passed as VIR_TYPED_PARAM_INT by mistake, but should be VIR_TYPED_PARAM_STRING

Version-Release number of selected component (if applicable):
perl-Sys-Virt-5.8.0-1.module+el8.2.0+4793+b09dd2fb.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
libvirt-tck codes:
my %params = (Sys::Virt::IDENTITY_USER_NAME => 'test',
              Sys::Virt::IDENTITY_UNIX_USER_ID => '1001',
              Sys::Virt::IDENTITY_GROUP_NAME => 'test',
              Sys::Virt::IDENTITY_UNIX_GROUP_ID => '1001',
              Sys::Virt::IDENTITY_PROCESS_ID => '4567',
              Sys::Virt::IDENTITY_PROCESS_TIME => '2094256127',
              Sys::Virt::IDENTITY_SASL_USER_NAME => 'test',
              Sys::Virt::IDENTITY_X509_DISTINGUISHED_NAME => 'test',
              Sys::Virt::IDENTITY_SELINUX_CONTEXT => 'context');

lives_ok( sub {$conn->set_identity(\%params, 0)}, "Set identity OK");

Argument "test" isn't numeric in subroutine entry at 060-interface-list.t line 52.
not ok 1 - Set identity OK
#   Failed test 'Set identity OK'
#   at 060-interface-list.t line 52.
# died: Sys::Virt::Error (libvirt error code: 8, message: invalid argument: invalid type 'int' for parameter 'sasl-user-name', expected 'string'
# )

2. Check libvirt-perl commit d4f1b912fa973b7dd79b6d3d90969baa147840bc

void
set_identity(conn, newident, flags=0)
...
    PPCODE:
      nident = 9;
      Newx(ident, nident, virTypedParameter);

      strncpy(ident[0].field, VIR_CONNECT_IDENTITY_USER_NAME,
              VIR_TYPED_PARAM_FIELD_LENGTH);
      ident[0].type = VIR_TYPED_PARAM_STRING;
...

      strncpy(ident[6].field, VIR_CONNECT_IDENTITY_SASL_USER_NAME,
              VIR_TYPED_PARAM_FIELD_LENGTH);
      ident[6].type = VIR_TYPED_PARAM_INT;                 <=== wrong type


3. Check libvirt commit 305cdc37f0f38a79e541194648e1513d3158a23d

diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h
index 7debb5f829..be65b4686b 100644
--- a/include/libvirt/libvirt-host.h
+++ b/include/libvirt/libvirt-host.h
@@ -579,6 +579,80 @@ virConnectPtr           virConnectOpenAuth      (const char *name,
                                                  unsigned int flags);
+
...
+/**
+ * VIR_CONNECT_IDENTITY_SASL_USER_NAME:
+ *
+ * The SASL authenticated username as VIR_TYPED_PARAM_STRING
+ */
+# define VIR_CONNECT_IDENTITY_SASL_USER_NAME "sasl-user-name"
+



...


Actual results:
See above

Expected results:

The API should work correctly.

Additional info:

Comment 1 Daniel Berrangé 2019-12-11 10:49:02 UTC
commit a21cbf5a6cb63072c609362530c2dcc9163b91b7 
Author: Daniel P. Berrangé <berrange>
Date:   Tue Dec 10 13:14:54 2019 +0000

    Fix data type for VIR_CONNECT_IDENTITY_SASL_USER_NAME
    
    
    Reviewed-by: Michal Privoznik <mprivozn>
    Signed-off-by: Daniel P. Berrangé <berrange>

Comment 4 Dan Zheng 2020-02-12 07:18:07 UTC
Package:
perl-Sys-Virt-6.0.0-1.module+el8.2.0

Test using steps in description,  PASS.

Comment 6 errata-xmlrpc 2020-05-05 09:51:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2017