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

Jakub Hrozek jhrozek at redhat.com
Tue Nov 12 09:56:31 UTC 2013


On Tue, Nov 12, 2013 at 10:49:19AM +0100, Lukas Slebodnik wrote:
> 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.

These should be fixed separately as well as removing sysdb_ctx from all
the tevent_req "states" that no longer need them.

> 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);
> 

These functions are mostly a leftover from the distant past where sysdb
was asynchronous. These functions provided convenience synchronous
wrappers for code that was synchronous anyway (mostly the command line
tools).

Maybe we can get rid of these wrappers and just use the sysdb API
directly?



More information about the sssd-devel mailing list