Menu ▾ ▴

#3408 imm: immcfg silently creates object when attribute lacks its own -a flag

5.27.01
unassigned
nobody
None
defect
imm
tools
major
False
2 days ago
2 days ago
No

immcfg accepts an unintended token as the object name without warning, which causes a common usage mistake to silently create a malformed object instead of producing an error.

When a user intends to set multiple attributes but groups them under a single -a flag (for example -a id=abc name=xyz expecting two attributes), only the first value is treated as an attribute. The remaining token is reinterpreted as the object name and stored as the object's RDN, even though it does not correspond to the class's declared RDN attribute. No warning or error is shown, so the user is not aware the input was misinterpreted.

Steps to reproduce

  • Load the following class, whose RDN attribute is id, with an additional writable string attribute name:
<?xml version="1.0"?>
<imm:IMM-contents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SAI-AIS-IMM-XSD-A.02.13.xsd"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:imm="http://www.saforum.org/IMMSchema">

  <class name="Employee">
<category>SA_CONFIG</category>
<rdn>
<name>id</name>
<type>SA_STRING_T</type>
<category>SA_CONFIG</category>
<flag>SA_INITIALIZED</flag>
</rdn>

    <attr>
<name>name</name>
<type>SA_STRING_T</type>
<category>SA_CONFIG</category>
<flag>SA_WRITABLE</flag>
</attr>

  </class>

</imm:IMM-contents>
  • Create an object with two attribute-style tokens under a single -a flag:
immcfg -c Employee -a id=abc name=xyz
  • Inspect the created object with immfind and immlist.

Observed behaviour

The command succeeds with no warning or error. The created object is malformed: the name attribute contains the literal string name=xyz instead of the intended value xyz. Full session log:

root@SC-1:/hostfs# immcfg -c Employee -a id=abc name=xyz
root@SC-1:/hostfs# immfind -c Employee
abc
root@SC-1:/hostfs# immlist abc
Name                                               Type         Value(s)
========================================================================
name                                               SA_STRING_T  name=xyz
id                                                 SA_STRING_T  abc
SaImmAttrImplementerName                           SA_STRING_T  <Empty>
SaImmAttrClassName                                 SA_STRING_T  Employee
SaImmAttrAdminOwnerName                            SA_STRING_T  <Empty>

The token name=xyz was treated as the object name rather than as an attribute, and no check was done to confirm it matched the class's declared RDN attribute id.

Expected behaviour

immcfg should reject the command with a clear diagnostic rather than silently create a malformed object -- for example, reporting an unexpected argument, or reporting that the object-name token does not match the class's RDN attribute.

The correct invocation should be accepted and store the value xyz:

immcfg -c Employee -a name=xyz id=abc

Error messages

None. No message is printed to stdout, stderr, or syslog. The absence of any diagnostic is the core problem: the malformed object is created silently.

Discussion


Log in to post a comment.