[SSSD] [PATCHES] Drop-redundant-sysdb_ctx-parameter

Lukas Slebodnik lslebodn at redhat.com
Tue Nov 12 09:49:19 UTC 2013


On (08/11/13 16:41), Michal Židek wrote:
>Hello,
>
>these patches (made by Jakub and me) remove redundant sysdb_ctx
>parameter from sysdb API in functions that are closely bound to some
>domain (sss_domain_info already contains sysdb_ctx, so there is no
>need to pass it as a separate parameter).
>
>
>NOTE:
>This is the first wave of sysdb refactoring effort. Other sysdb
>changes will follow, including ticket
>https://fedorahosted.org/sssd/ticket/2129
>(Always store users with FQDN with hardcoded format), which is change
>that should simplify handling of 'name' attribute and avoid code
>patterns like this:
>
>if (IS_SUBDOMAIN) {
>   parse name and domain part from 'name' attribute using
>   regular expression (requires initialization of names_ctx).
>} else {
>   'name' attribute contains only name
>}
>
>In other words, we should store data in unified manner for main
>domains as well as for subdomains and avoid the need for regular
>expressions when simply need to parse name and domain portion from
>the 'name' attribute. Alternatively we might store name and domain
>portions in separate attributes instead of one FQDN attribute.
>
>Thanks,
>Michal

There are a lot of unused parameters after applying your patches.
After removing unused parameters, API of some function is really strange.
It seems like function work with some global context(variables),
but sysdb_ctx is hidden in another parameter "struct ops_ctx *data"

src/tools/sss_sync_ops.h
Before
------------------------------------
/* synchronous operations */
int useradd(TALLOC_CTX *mem_ctx,
            struct sysdb_ctx *sysdb,
            struct ops_ctx *data);
int usermod(TALLOC_CTX *mem_ctx,
            struct sysdb_ctx *sysdb,
            struct ops_ctx *data);
int groupadd(struct sysdb_ctx *sysdb,
             struct ops_ctx *data);
int groupmod(TALLOC_CTX *mem_ctx,
            struct sysdb_ctx *sysdb,
            struct ops_ctx *data);

After
------------------------------------
/* synchronous operations */
int useradd(TALLOC_CTX *mem_ctx,
            struct ops_ctx *data);
int usermod(TALLOC_CTX *mem_ctx,
            struct ops_ctx *data);
int groupadd(struct ops_ctx *data);
int groupmod(TALLOC_CTX *mem_ctx,
             struct ops_ctx *data);

LS



More information about the sssd-devel mailing list