[SSSD] [PATCH] Make basic options typed

Simo Sorce ssorce at redhat.com
Sun Sep 13 14:38:56 UTC 2009


This patch finally allows us to define the type for basic options.
It uses a union to store different types, and an enum to list the
allowed types.
It also provides for helper functions that always check the type to
safely retrieve data, or scream loudly if we messed up.

This allowed me to remove all but 1 special option that was a duplicate
made only to avoid converting from string to int every time we needed to
get an option.
The only remaining special case is the schema type, because that is a
special string to special number transaltion. But these kind of options
(another is tls_reqcert) are rare enough that we can avoid trying to
make special handlers for them too.

Currently there are 4 types supported: string, blob, number, boolean.
String has 2 subtypes, const and non const, but they are not enforced
(you can assign a const string and then re-read it as non-const). But
this is not really a problem, as values are always copied in the init
functions, furthermore, although you can get values as non-const they
should always be regarded a immutable strings as the value returned is
the actual string saved in the option, so changing it, means changing
the configuration.

I think we can later take this code and make it generic in the provider
backend code, so that all backends can use it. It should be easy enough
to do.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Trun-ldap-driver-options-into-multitype.patch
Type: text/x-patch
Size: 40997 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20090913/e26e6be3/attachment.bin>


More information about the sssd-devel mailing list