- **status**: assigned --> fixed
- **Comment**:

commit ccf80448399e5231cc8acc282b8c338bc5084c17 (HEAD -> develop, 
origin/develop, ticket-3408)
Author: Tran Gia Khiem <[email protected]>
Date:   Fri Oct 30 08:20:09 2026 +0000

    imm: reject non-RDN attribute in immcfg object name [#340
    
    When creating an object, each -a option consumes only its immediate
    argument. Any following token is interpreted as the object DN.
    
    For example, in:
    
      immcfg -c Employee -a id=abc name=xyz
    
    name=xyz is treated as the object DN instead of a second attribute.
    object_create() accepted it because name existed in the class,
    without checking that it was the RDN. This allowed immcfg to silently
    create an object with id=abc and name=name=xyz.
    
    Fix by passing the attribute flags from new_attr_value() when processing the
    positional object DN and requiring SA_IMM_ATTR_RDN before adding it to
    the CCB create request. Report a clear error and abort the operation
    when the attribute is not the RDN.



---

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

**Status:** fixed
**Milestone:** 5.27.01
**Created:** Tue Oct 20, 2026 10:13 AM UTC by Thien Minh Huynh
**Last Updated:** Thu Oct 29, 2026 03:47 AM UTC
**Owner:** Tran Gia Khiem


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
<?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.


---

Sent from sourceforge.net because [email protected] is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to