Jordan Brown wrote:
> I have a test suite that tries to save and restore a service's 
> configuration using svccfg export and svccfg import, but it seems to 
> consistently lose the values of general/action_authorization and 
> general/value_authorization.
> 
> Investigating a bit further, it appears that svccfg export doesn't 
> include those values, even with -a.  From the documentation, I don't 
> immediately see why not.
> 
> $ svcprop -p general idmap
> general/enabled boolean true
> general/entity_stability astring Unstable
> general/single_instance boolean true
> general/action_authorization astring solaris.smf.manage.idmap
> general/value_authorization astring solaris.smf.manage.idmap
> 
> # svccfg export -a idmap
> [...]
>     <property_group name='general' type='framework'>
>       <property name='action_authorization' type='astring'/>
>       <property name='value_authorization' type='astring'/>
>     </property_group>
> [...]
> 
> Any hints?

No hint but I see a bug. Some logic in export_property() don't seem right:

/* If we're exporting values, and there's just one, export it here. */
if (!(flags & SCE_ALL_VALUES))
       goto empty;
.....

When the input flag is 0, we'll actually try to get multiple values for 
the property. And when we do so, it'll fail because the empty section is:

empty:
.....
     if (err == SCF_ERROR_CONSTRAINT_VIOLATED) {
            lnname = uu_msprintf("%s_list", type);
            if (lnname == NULL)
                uu_die(gettext("Could not create string"));

....

Since err is set to 0 and didn't changed, we end up skipping the code 
that obtains the property values. A quick test that changed the if 
statement to

if (err == 0 || err == SCF_ERROR_CONSTRAINT_VIOLATED)

seems to work fine but I also doubt the logic of the first if statement, 
the goto. Anyhow, I'll file a bug.

-tony

Reply via email to