summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/monitor/monitor.c4
-rw-r--r--server/providers/data_provider.c19
-rw-r--r--server/providers/data_provider_be.c48
-rw-r--r--server/providers/dp_backend.h1
4 files changed, 41 insertions, 31 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 67e5b6e3..893de9b1 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -1040,10 +1040,10 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
/* if there are no custom commands, build a default one */
if (!svc->command) {
svc->command = talloc_asprintf(svc,
- "%s/sssd_be -d %d%s --provider %s --domain %s",
+ "%s/sssd_be -d %d%s --domain %s",
SSSD_LIBEXEC_PATH, debug_level,
(debug_timestamps?" --debug-timestamps":""),
- svc->provider, svc->name);
+ svc->name);
if (!svc->command) {
talloc_free(svc);
return ENOMEM;
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index 4cb39bfb..f8efcc8d 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -64,7 +64,6 @@ struct dp_client {
struct dp_backend {
struct dp_backend *prev;
struct dp_backend *next;
- char *name;
char *domain;
struct dp_client *dpcli;
};
@@ -282,9 +281,8 @@ static int client_registration(DBusMessage *message,
return ENOMEM;
}
- dpbe->name = talloc_strdup(dpbe, cli_name);
dpbe->domain = talloc_strdup(dpbe, cli_domain);
- if (!dpbe->name || !dpbe->domain) {
+ if (!dpbe->domain) {
DEBUG(0, ("Out of memory!\n"));
sbus_disconnect(conn);
return ENOMEM;
@@ -294,8 +292,7 @@ static int client_registration(DBusMessage *message,
DLIST_ADD(dpcli->dpctx->be_list, dpbe);
- DEBUG(4, ("Added Backend client [%s], for domain [%s]\n",
- dpbe->name, dpbe->domain));
+ DEBUG(4, ("Added Backend client for domain [%s]\n", dpbe->domain));
talloc_set_destructor((TALLOC_CTX *)dpbe, dp_backend_destructor);
break;
@@ -398,9 +395,9 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
goto done;
}
- DEBUG(4, ("Got reply (%u, %u, %s) from %s(%s)\n",
+ DEBUG(4, ("Got reply (%u, %u, %s) from (%s)\n",
(unsigned int)err_maj, (unsigned int)err_min, err_msg,
- bereq->be->name, bereq->be->domain));
+ bereq->be->domain));
break;
@@ -712,8 +709,8 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
goto done;
}
- DEBUG(4, ("Got reply (%d, %s) from %s(%s)\n", pd->pam_status, pd->domain,
- bereq->be->name, bereq->be->domain));
+ DEBUG(4, ("Got reply (%d, %s) from (%s)\n", pd->pam_status, pd->domain,
+ bereq->be->domain));
break;
@@ -909,8 +906,8 @@ static int dp_backend_destructor(void *ctx)
struct dp_backend *dpbe = talloc_get_type(ctx, struct dp_backend);
if (dpbe->dpcli && dpbe->dpcli->dpctx && dpbe->dpcli->dpctx->be_list) {
DLIST_REMOVE(dpbe->dpcli->dpctx->be_list, dpbe);
- DEBUG(4, ("Removed Backend client [%s], for domain [%s]\n",
- dpbe->name, dpbe->domain));
+ DEBUG(4, ("Removed Backend client for domain [%s]\n",
+ dpbe->domain));
}
return 0;
}
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 7df90020..8428954a 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -622,7 +622,7 @@ static int be_cli_init(struct be_ctx *ctx)
/* Identify ourselves to the data provider */
ret = dp_common_send_id(ctx->dp_conn,
DP_CLI_BACKEND, DATA_PROVIDER_VERSION,
- ctx->name, ctx->domain->name);
+ "", ctx->domain->name);
if (ret != EOK) {
DEBUG(0, ("Failed to identify to the data provider!\n"));
return ret;
@@ -657,7 +657,7 @@ static void be_cli_reconnect_init(struct sbus_connection *conn, int status, void
/* Identify ourselves to the data provider */
ret = dp_common_send_id(be_ctx->dp_conn,
DP_CLI_BACKEND, DATA_PROVIDER_VERSION,
- be_ctx->name, be_ctx->domain->name);
+ "", be_ctx->domain->name);
if (ret != EOK) {
DEBUG(0, ("Failed to send id to the data provider!\n"));
} else {
@@ -879,13 +879,26 @@ static int be_rewrite(struct be_ctx *ctx)
int ret;
const char *val[2];
val[1] = NULL;
+ char **get_values = 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));
+ ret = confdb_get_param(ctx->cdb, ctx, ctx->conf_path, "provider",
+ &get_values);
+ if (ret != EOK) {
+ DEBUG(1, ("Failed to read provider from confdb.\n"));
+ return ret;
+ }
+ if (get_values[0] == NULL) {
+ DEBUG(1, ("Missing provider.\n"));
+ return EINVAL;
+ }
+
+ if (strcasecmp(get_values[0], "files") == 0) {
+ DEBUG(5, ("Rewriting provider %s\n", get_values[0]));
+ talloc_zfree(get_values);
val[0] = "proxy";
ret = confdb_add_param(ctx->cdb, true,
@@ -910,7 +923,6 @@ static int be_rewrite(struct be_ctx *ctx)
}
int be_process_init(TALLOC_CTX *mem_ctx,
- const char *be_name,
const char *be_domain,
struct tevent_context *ev,
struct confdb_ctx *cdb)
@@ -925,10 +937,9 @@ int be_process_init(TALLOC_CTX *mem_ctx,
}
ctx->ev = ev;
ctx->cdb = cdb;
- ctx->name = talloc_strdup(ctx, be_name);
ctx->identity = talloc_asprintf(ctx, "%%BE_%s", be_domain);
ctx->conf_path = talloc_asprintf(ctx, "config/domains/%s", be_domain);
- if (!ctx->name || !ctx->identity || !ctx->conf_path) {
+ if (!ctx->identity || !ctx->conf_path) {
DEBUG(0, ("Out of memory!?\n"));
return ENOMEM;
}
@@ -1016,20 +1027,17 @@ int main(int argc, const char *argv[])
{
int opt;
poptContext pc;
- char *be_name;
- char *be_domain;
- char *srv_name;
- char *conf_entry;
+ char *be_domain = NULL;
+ char *srv_name = NULL;
+ char *conf_entry = NULL;
struct main_context *main_ctx;
int ret;
struct poptOption long_options[] = {
POPT_AUTOHELP
SSSD_MAIN_OPTS
- {"provider", 0, POPT_ARG_STRING, &be_name, 0,
- "Information Provider", NULL },
{"domain", 0, POPT_ARG_STRING, &be_domain, 0,
- "Domain of the information provider", NULL },
+ "Domain of the information provider (mandatory)", NULL },
POPT_TABLEEND
};
@@ -1044,10 +1052,16 @@ int main(int argc, const char *argv[])
}
}
+ if (be_domain == NULL) {
+ fprintf(stderr, "\nMissing option, --domain is a mandatory option.\n\n");
+ poptPrintUsage(pc, stderr, 0);
+ return 1;
+ }
+
poptFreeContext(pc);
/* set up things like debug , signals, daemonization, etc... */
- srv_name = talloc_asprintf(NULL, "sssd[be[%s]]", be_name);
+ srv_name = talloc_asprintf(NULL, "sssd[be[%s]]", be_domain);
if (!srv_name) return 2;
conf_entry = talloc_asprintf(NULL, BE_CONF_ENTRY, be_domain);
@@ -1066,7 +1080,7 @@ int main(int argc, const char *argv[])
}
ret = be_process_init(main_ctx,
- be_name, be_domain,
+ be_domain,
main_ctx->event_ctx,
main_ctx->confdb_ctx);
if (ret != EOK) {
@@ -1074,7 +1088,7 @@ int main(int argc, const char *argv[])
return 3;
}
- DEBUG(1, ("Backend provider %s(%s) started!\n", be_name, be_domain));
+ DEBUG(1, ("Backend provider (%s) started!\n", be_domain));
/* loop on main */
server_loop(main_ctx);
diff --git a/server/providers/dp_backend.h b/server/providers/dp_backend.h
index 987e5365..cce854ef 100644
--- a/server/providers/dp_backend.h
+++ b/server/providers/dp_backend.h
@@ -66,7 +66,6 @@ struct be_ctx {
struct confdb_ctx *cdb;
struct sysdb_ctx *sysdb;
struct sss_domain_info *domain;
- const char *name;
const char *identity;
const char *conf_path;