summaryrefslogtreecommitdiffstats
path: root/src/providers/proxy/proxy_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/providers/proxy/proxy_init.c')
-rw-r--r--src/providers/proxy/proxy_init.c85
1 files changed, 53 insertions, 32 deletions
diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c
index f2ad14475..ae73fe702 100644
--- a/src/providers/proxy/proxy_init.c
+++ b/src/providers/proxy/proxy_init.c
@@ -125,7 +125,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->handle = dlopen(libpath, RTLD_NOW);
if (!ctx->handle) {
- DEBUG(0, "Unable to load %s module with path, error: %s\n",
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Unable to load %s module with path, error: %s\n",
libpath, dlerror());
ret = ELIBACC;
goto done;
@@ -134,7 +135,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getpwnam_r = proxy_dlsym(ctx->handle, "_nss_%s_getpwnam_r",
libname);
if (!ctx->ops.getpwnam_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -142,14 +144,16 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getpwuid_r = proxy_dlsym(ctx->handle, "_nss_%s_getpwuid_r",
libname);
if (!ctx->ops.getpwuid_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
ctx->ops.setpwent = proxy_dlsym(ctx->handle, "_nss_%s_setpwent", libname);
if (!ctx->ops.setpwent) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -157,14 +161,16 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getpwent_r = proxy_dlsym(ctx->handle, "_nss_%s_getpwent_r",
libname);
if (!ctx->ops.getpwent_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
ctx->ops.endpwent = proxy_dlsym(ctx->handle, "_nss_%s_endpwent", libname);
if (!ctx->ops.endpwent) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -172,7 +178,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getgrnam_r = proxy_dlsym(ctx->handle, "_nss_%s_getgrnam_r",
libname);
if (!ctx->ops.getgrnam_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -180,14 +187,16 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getgrgid_r = proxy_dlsym(ctx->handle, "_nss_%s_getgrgid_r",
libname);
if (!ctx->ops.getgrgid_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
ctx->ops.setgrent = proxy_dlsym(ctx->handle, "_nss_%s_setgrent", libname);
if (!ctx->ops.setgrent) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -195,14 +204,16 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getgrent_r = proxy_dlsym(ctx->handle, "_nss_%s_getgrent_r",
libname);
if (!ctx->ops.getgrent_r) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
ctx->ops.endgrent = proxy_dlsym(ctx->handle, "_nss_%s_endgrent", libname);
if (!ctx->ops.endgrent) {
- DEBUG(0, "Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load NSS fns, error: %s\n", dlerror());
ret = ELIBBAD;
goto done;
}
@@ -210,7 +221,7 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.initgroups_dyn = proxy_dlsym(ctx->handle, "_nss_%s_initgroups_dyn",
libname);
if (!ctx->ops.initgroups_dyn) {
- DEBUG(1, "The '%s' library does not provides the "
+ DEBUG(SSSDBG_CRIT_FAILURE, "The '%s' library does not provides the "
"_nss_XXX_initgroups_dyn function!\n"
"initgroups will be slow as it will require "
"full groups enumeration!\n", libname);
@@ -219,7 +230,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.setnetgrent = proxy_dlsym(ctx->handle, "_nss_%s_setnetgrent",
libname);
if (!ctx->ops.setnetgrent) {
- DEBUG(0, "Failed to load _nss_%s_setnetgrent, error: %s. "
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load _nss_%s_setnetgrent, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
@@ -227,7 +239,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.getnetgrent_r = proxy_dlsym(ctx->handle, "_nss_%s_getnetgrent_r",
libname);
if (!ctx->ops.getgrent_r) {
- DEBUG(0, "Failed to load _nss_%s_getnetgrent_r, error: %s. "
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load _nss_%s_getnetgrent_r, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
@@ -235,7 +248,8 @@ int sssm_proxy_id_init(struct be_ctx *bectx,
ctx->ops.endnetgrent = proxy_dlsym(ctx->handle, "_nss_%s_endnetgrent",
libname);
if (!ctx->ops.endnetgrent) {
- DEBUG(0, "Failed to load _nss_%s_endnetgrent, error: %s. "
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Failed to load _nss_%s_endnetgrent, error: %s. "
"The library does not support netgroups.\n", libname,
dlerror());
}
@@ -329,7 +343,7 @@ static int proxy_client_init(struct sbus_connection *conn, void *data)
proxy_cli = talloc_zero(conn, struct proxy_client);
if (!proxy_cli) {
- DEBUG(0,"Out of memory?!\n");
+ DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n");
talloc_zfree(conn);
return ENOMEM;
}
@@ -343,11 +357,12 @@ static int proxy_client_init(struct sbus_connection *conn, void *data)
proxy_cli->timeout = tevent_add_timer(proxy_auth_ctx->be->ev, proxy_cli,
tv, init_timeout, proxy_cli);
if (!proxy_cli->timeout) {
- DEBUG(0,"Out of memory?!\n");
+ DEBUG(SSSDBG_FATAL_FAILURE,"Out of memory?!\n");
talloc_zfree(conn);
return ENOMEM;
}
- DEBUG(4, "Set-up proxy client ID timeout [%p]\n", proxy_cli->timeout);
+ DEBUG(SSSDBG_CONF_SETTINGS,
+ "Set-up proxy client ID timeout [%p]\n", proxy_cli->timeout);
/* Attach the client context to the connection context, so that it is
* always available when we need to manage the connection. */
@@ -362,7 +377,8 @@ static void init_timeout(struct tevent_context *ev,
{
struct proxy_client *proxy_cli;
- DEBUG(2, "Client timed out before Identification [%p]!\n", te);
+ DEBUG(SSSDBG_OP_FAILURE,
+ "Client timed out before Identification [%p]!\n", te);
proxy_cli = talloc_get_type(ptr, struct proxy_client);
@@ -396,12 +412,13 @@ static int client_registration(DBusMessage *message,
data = sbus_conn_get_private_data(conn);
proxy_cli = talloc_get_type(data, struct proxy_client);
if (!proxy_cli) {
- DEBUG(0, "Connection holds no valid init data\n");
+ DEBUG(SSSDBG_FATAL_FAILURE, "Connection holds no valid init data\n");
return EINVAL;
}
/* First thing, cancel the timeout */
- DEBUG(4, "Cancel proxy client ID timeout [%p]\n", proxy_cli->timeout);
+ DEBUG(SSSDBG_CONF_SETTINGS,
+ "Cancel proxy client ID timeout [%p]\n", proxy_cli->timeout);
talloc_zfree(proxy_cli->timeout);
dbus_error_init(&dbus_error);
@@ -411,7 +428,8 @@ static int client_registration(DBusMessage *message,
DBUS_TYPE_UINT32, &cli_id,
DBUS_TYPE_INVALID);
if (!dbret) {
- DEBUG(1, "Failed to parse message, killing connection\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Failed to parse message, killing connection\n");
if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
sbus_disconnect(conn);
/* FIXME: should we just talloc_zfree(conn) ? */
@@ -424,7 +442,8 @@ static int client_registration(DBusMessage *message,
key.type = HASH_KEY_ULONG;
key.ul = cli_id;
if (!hash_has_key(proxy_cli->proxy_auth_ctx->request_table, &key)) {
- DEBUG(1, "Unknown child ID. Killing the connection\n");
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Unknown child ID. Killing the connection\n");
sbus_disconnect(proxy_cli->conn);
return EIO;
}
@@ -432,7 +451,7 @@ static int client_registration(DBusMessage *message,
/* reply that all is ok */
reply = dbus_message_new_method_return(message);
if (!reply) {
- DEBUG(0, "Dbus Out of memory!\n");
+ DEBUG(SSSDBG_FATAL_FAILURE, "Dbus Out of memory!\n");
return ENOMEM;
}
@@ -440,7 +459,7 @@ static int client_registration(DBusMessage *message,
DBUS_TYPE_UINT16, &version,
DBUS_TYPE_INVALID);
if (!dbret) {
- DEBUG(0, "Failed to build dbus reply\n");
+ DEBUG(SSSDBG_FATAL_FAILURE, "Failed to build dbus reply\n");
dbus_message_unref(reply);
sbus_disconnect(conn);
return EIO;
@@ -452,7 +471,8 @@ static int client_registration(DBusMessage *message,
hret = hash_lookup(proxy_cli->proxy_auth_ctx->request_table, &key, &value);
if (hret != HASH_SUCCESS) {
- DEBUG(1, "Hash error [%d][%s]\n", hret, hash_error_string(hret));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ "Hash error [%d][%s]\n", hret, hash_error_string(hret));
sbus_disconnect(conn);
}
@@ -466,7 +486,7 @@ static int client_registration(DBusMessage *message,
* the init_req will be NULL below and things will
* break.
*/
- DEBUG(1, "Client connection from a request "
+ DEBUG(SSSDBG_CRIT_FAILURE, "Client connection from a request "
"that's not marked as running\n");
return EIO;
}
@@ -490,7 +510,8 @@ int sssm_proxy_auth_init(struct be_ctx *bectx,
/* If we're already set up, just return that */
if(bectx->bet_info[BET_AUTH].mod_name &&
strcmp("proxy", bectx->bet_info[BET_AUTH].mod_name) == 0) {
- DEBUG(8, "Re-using proxy_auth_ctx for this provider\n");
+ DEBUG(SSSDBG_TRACE_INTERNAL,
+ "Re-using proxy_auth_ctx for this provider\n");
*ops = bectx->bet_info[BET_AUTH].bet_ops;
*pvt_data = bectx->bet_info[BET_AUTH].pvt_bet_data;
return EOK;
@@ -509,7 +530,7 @@ int sssm_proxy_auth_init(struct be_ctx *bectx,
&ctx->pam_target);
if (ret != EOK) goto done;
if (!ctx->pam_target) {
- DEBUG(1, "Missing option proxy_pam_target.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "Missing option proxy_pam_target.\n");
ret = EINVAL;
goto done;
}
@@ -517,7 +538,7 @@ int sssm_proxy_auth_init(struct be_ctx *bectx,
sbus_address = talloc_asprintf(ctx, "unix:path=%s/%s_%s", PIPE_PATH,
PROXY_CHILD_PIPE, bectx->domain->name);
if (sbus_address == NULL) {
- DEBUG(1, "talloc_asprintf failed.\n");
+ DEBUG(SSSDBG_CRIT_FAILURE, "talloc_asprintf failed.\n");
ret = ENOMEM;
goto done;
}
@@ -525,7 +546,7 @@ int sssm_proxy_auth_init(struct be_ctx *bectx,
ret = sbus_new_server(ctx, bectx->ev, sbus_address, &proxy_interface,
false, &ctx->sbus_srv, proxy_client_init, ctx);
if (ret != EOK) {
- DEBUG(0, "Could not set up sbus server.\n");
+ DEBUG(SSSDBG_FATAL_FAILURE, "Could not set up sbus server.\n");
goto done;
}
@@ -536,7 +557,7 @@ int sssm_proxy_auth_init(struct be_ctx *bectx,
hret = hash_create(ctx->max_children * 2, &ctx->request_table,
NULL, NULL);
if (hret != HASH_SUCCESS) {
- DEBUG(0, "Could not initialize request table\n");
+ DEBUG(SSSDBG_FATAL_FAILURE, "Could not initialize request table\n");
ret = EIO;
goto done;
}