summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-08-13 13:02:28 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-08-13 09:16:20 -0400
commit2e53c10c68a86c33d97936fce02c3c53aad82bfa (patch)
tree88eb9699c29422737a9ce663319480a17a5db13b
parent7fb74edcde011adef137357c916494409a94f1a1 (diff)
downloadsssd-2e53c10c68a86c33d97936fce02c3c53aad82bfa.tar.gz
sssd-2e53c10c68a86c33d97936fce02c3c53aad82bfa.tar.xz
sssd-2e53c10c68a86c33d97936fce02c3c53aad82bfa.zip
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 document this in sssd.conf(5) and example config
-rw-r--r--server/examples/sssd.conf3
-rw-r--r--server/man/sssd.conf.5.xml12
-rw-r--r--server/providers/data_provider_be.c43
-rw-r--r--server/tools/tools_util.c3
4 files changed, 57 insertions, 4 deletions
diff --git a/server/examples/sssd.conf b/server/examples/sssd.conf
index ab8007a1e..d57bed70d 100644
--- a/server/examples/sssd.conf
+++ b/server/examples/sssd.conf
@@ -45,8 +45,7 @@ description = Domains served by SSSD
; magicPrivateGroups = FALSE
; legacy = TRUE
;
-; provider = proxy
-; libName = files
+; provider = files
# optionally a file named sssdproxylocal can be place in pam.d configured to
# check pam_unix only and pam_sss can be used in the normal pam stack
diff --git a/server/man/sssd.conf.5.xml b/server/man/sssd.conf.5.xml
index 833bd7188..6c5ce87a3 100644
--- a/server/man/sssd.conf.5.xml
+++ b/server/man/sssd.conf.5.xml
@@ -493,6 +493,9 @@
Supported backends:
</para>
<para>
+ files: traditional UNIX files (<filename>/etc/passwd</filename>)
+ </para>
+ <para>
proxy: Support a legacy NSS provider
</para>
<para>
@@ -598,7 +601,7 @@ description = Service Monitor Configuration
[domains]
description = Domains served by SSSD
-domains = LOCAL
+domains = LOCAL,FILES
[domains/LOCAL]
description = LOCAL Users domain
@@ -608,6 +611,13 @@ maxId = 30000
legacy = FALSE
magicPrivateGroups = TRUE
provider = local
+
+[domains/FILES]
+description = Users stored in UNIX files
+enumerate = 3
+minId = 500
+maxId = 4999
+provider = files
</programlisting>
</para>
</refsect1>
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index c92289b6d..24d9105ef 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 79f73ac66..620139940 100644
--- a/server/tools/tools_util.c
+++ b/server/tools/tools_util.c
@@ -78,7 +78,8 @@ 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 ||
+ is_domain_local_legacy(ctx, dom) == 0) {
return ID_IN_LEGACY_LOCAL;
}