#47956 Create new config type for slapd structs
Closed: Invalid None Opened 4 years ago by mreynolds.

Configuration attributes in the frontend config should be allowed to store their values in internal structures, like a slapi_DN, instead of just strings and numbers.


{{{
7492 7493 case CONFIG_STRING:
7494 case CONFIG_SPECIAL_STRUCT:
7493 7495 slapi_entry_attr_set_charptr(e, cgas->attr_name,
7494 7496 (value && ((char )value)) ?
7495 7497 *((char
)value) : "");
}}}
This seems to imply that value in this case is a char
- but it will be a Slapi_DN or some other struct pointer?

Replying to [comment:2 rmeggins]:

{{{
7492 7493 case CONFIG_STRING:
7494 case CONFIG_SPECIAL_STRUCT:
7493 7495 slapi_entry_attr_set_charptr(e, cgas->attr_name,
7494 7496 (value && ((char )value)) ?
7495 7497 *((char
)value) : "");
}}}
This seems to imply that value in this case is a char
- but it will be a Slapi_DN or some other struct pointer?

This is the set value function call. At this point the getfunc was called, and a pointer to the char * is being applied.

I'm very open to changing CONFIG_SPECIAL_STRUCT to something else. CONFIG_SPECIAL_STRING? It's all a little misleading. But whatever we call it, it should be expected that the get function return a string. I guess we could also add CONFIG_SPECIAL_INT for completeness around the string and number values.

Do you even need a special type? A config item of type CONFIG_STRING with a getfunc and a config_var_addr of NULL would seem to already cover this case.

Replying to [comment:5 rmeggins]:

Do you even need a special type? A config item of type CONFIG_STRING with a getfunc and a config_var_addr of NULL would seem to already cover this case.

And this is the problem, the value is set - to the Slapi_DN in frontend pw_policy struct. When the value is set it doesn't call the get function. So this a special case that has to be handled differently.

Or I redo the password admin feature to use char*, instead of a Slapi_DN, for the DN, but I think storing the dn in a Slapi_DN struct is best.

{{{
{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
NULL, 0,
(void**)&global_slapdFrontendConfig.pw_policy.pw_admin,
CONFIG_STRING, NULL, ""},
}}}
What if you just did this instead?
{{{
{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
NULL, 0,
NULL,
CONFIG_STRING, config_get_pw_admin_dn, ""},
}}}

Replying to [comment:7 rmeggins]:

{{{
{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
NULL, 0,
(void**)&global_slapdFrontendConfig.pw_policy.pw_admin,
CONFIG_STRING, NULL, ""},
}}}
What if you just did this instead?
{{{
{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
NULL, 0,
NULL,
CONFIG_STRING, config_get_pw_admin_dn, ""},
}}}

That's a great idea. I always thought that was a required parameter, but sure enough it's not. Closing ticket, thanks!

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: N/A

2 years ago

Login to comment on this ticket.

Metadata