-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch introduces provider=files as a valid provider. Upon loading the backend, its properties in confdb are overwritten to those that represent legacy local domain.
Also get rid of old hackish way of detecting legacy local domain in tools Jakub -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkqC+4gACgkQHsardTLnvCV/FACg1PDQiDXyLTO4KFzuuitCjV0T DFEAn3O56agl+Q570u3/vLfGomIGFEHA =JDTz -----END PGP SIGNATURE-----
>From a3912c9eb27ef64d6611d8333d0596b20d59dc11 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek <jhro...@redhat.com> Date: Wed, 12 Aug 2009 15:38:10 +0200 Subject: [PATCH] Make "files" a reserved word for legacy local domain This patch introduces provider=files as a valid provider. Upon loading the backend, its properties in confdb are overwritten to those that represent legacy local domain. Also get rid of old hackish way of detecting legacy local domain in tools --- server/providers/data_provider_be.c | 43 +++++++++++++++++++++++++++++++++++ server/tools/tools_util.c | 42 +--------------------------------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index c92289b..24d9105 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -874,6 +874,43 @@ done: return ret; } +/* Some providers are just aliases for more complicated settings, + * rewrite the alias into the actual settings */ +static int be_rewrite(struct be_ctx *ctx) +{ + int ret; + const char *val[2]; + val[1] = NULL; + + /* "files" is a special case that means: + * provider = proxy + * libName = files + */ + if (strcasecmp(ctx->name, "files") == 0) { + DEBUG(5, ("Rewriting provider %s\n", ctx->name)); + + val[0] = "proxy"; + ret = confdb_add_param(ctx->cdb, true, + ctx->conf_path, + "provider", + val); + if (ret) { + return ret; + } + + val[0] = "files"; + ret = confdb_add_param(ctx->cdb, true, + ctx->conf_path, + "libName", + val); + if (ret) { + return ret; + } + } + + return EOK; +} + int be_process_init(TALLOC_CTX *mem_ctx, const char *be_name, const char *be_domain, @@ -922,6 +959,12 @@ int be_process_init(TALLOC_CTX *mem_ctx, return ret; } + ret = be_rewrite(ctx); + if (ret != EOK) { + DEBUG(0, ("error rewriting provider types\n")); + return ret; + } + ret = load_backend_module(ctx, BET_ID, &ctx->bet_info[BET_ID].bet_ops, &ctx->bet_info[BET_ID].pvt_bet_data); diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c index 1e0e91d..004c02e 100644 --- a/server/tools/tools_util.c +++ b/server/tools/tools_util.c @@ -29,46 +29,6 @@ #include "db/sysdb.h" #include "tools/tools_util.h" -/* - * Returns: - * 0 = yes, local domain proxying to files - * -1 = no, other type of domain - * > 0 = error code - */ -static int is_domain_local_legacy(struct tools_ctx *ctx, struct sss_domain_info *dom) -{ - char *libname = NULL; - char *conf_path = NULL; - int ret = -1; - - /* Is there a better way to find out? Having LEGACYLOCAL as reserved would help */ - conf_path = talloc_asprintf(ctx, "config/domains/%s", dom->name); - if (conf_path == NULL ) { - return ENOMEM; - } - - ret = confdb_get_string(ctx->confdb, ctx, conf_path, - "libName", NULL, &libname); - if (ret != EOK) { - talloc_free(conf_path); - return ret; - } - if (libname == NULL) { - talloc_free(conf_path); - return -1; - } - - if (strcasecmp(libname, "files") == 0) { - talloc_free(conf_path); - talloc_free(libname); - return EOK; - } - - talloc_free(conf_path); - talloc_free(libname); - return -1; -} - enum id_domain get_domain_type(struct tools_ctx *ctx, struct sss_domain_info *dom) { @@ -78,7 +38,7 @@ enum id_domain get_domain_type(struct tools_ctx *ctx, if (strcasecmp(dom->provider, "local") == 0) { return ID_IN_LOCAL; - } else if (is_domain_local_legacy(ctx, dom) == 0) { + } else if (strcasecmp(dom->provider, "files") == 0) { return ID_IN_LEGACY_LOCAL; } -- 1.6.2.5
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel