From 8c50bd085c0efe5fde354deee2c8118887aae29d Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 18 Sep 2009 12:35:34 +0200 Subject: Use syslog for logging error conditions in SSSD This is just a band-aid until ELAPI is fully functional and ready to use. --- server/providers/ldap/ldap_id.c | 4 +-- server/providers/ldap/sdap.c | 66 +++++++++++++++++++------------------- server/providers/ldap/sdap_async.c | 6 ++-- 3 files changed, 38 insertions(+), 38 deletions(-) (limited to 'server/providers/ldap') diff --git a/server/providers/ldap/ldap_id.c b/server/providers/ldap/ldap_id.c index 72caf9664..bd376f7cb 100644 --- a/server/providers/ldap/ldap_id.c +++ b/server/providers/ldap/ldap_id.c @@ -873,7 +873,7 @@ static void ldap_id_enumerate_set_timer(struct sdap_id_ctx *ctx, tv = tevent_timeval_add(&tv, ert, 0); enum_task = tevent_add_timer(ctx->be->ev, ctx, tv, ldap_id_enumerate, ctx); if (!enum_task) { - DEBUG(0, ("FATAL: failed to setup enumeration task!\n")); + SYSLOG_ERROR("FATAL: failed to setup enumeration task!\n"); /* shutdown! */ exit(1); } @@ -1354,7 +1354,7 @@ int sssm_ldap_init(struct be_ctx *bectx, enum_task = tevent_add_timer(ctx->be->ev, ctx, ctx->last_run, ldap_id_enumerate, ctx); if (!enum_task) { - DEBUG(0, ("FATAL: failed to setup enumeration task!\n")); + SYSLOG_ERROR("FATAL: failed to setup enumeration task!\n"); ret = EFAULT; goto done; } diff --git a/server/providers/ldap/sdap.c b/server/providers/ldap/sdap.c index 22d238e65..7edcc3d88 100644 --- a/server/providers/ldap/sdap.c +++ b/server/providers/ldap/sdap.c @@ -148,8 +148,8 @@ int sdap_get_options(TALLOC_CTX *memctx, if (ret != EOK || ((opts->basic[i].def_val.string != NULL) && (opts->basic[i].val.string == NULL))) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts->basic[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve value for option (%s)\n", + opts->basic[i].opt_name); if (ret == EOK) ret = EINVAL; goto done; } @@ -162,8 +162,8 @@ int sdap_get_options(TALLOC_CTX *memctx, opts->basic[i].opt_name, NULL, &tmp); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts->basic[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve value for option (%s)\n", + opts->basic[i].opt_name); goto done; } @@ -186,8 +186,8 @@ int sdap_get_options(TALLOC_CTX *memctx, opts->basic[i].def_val.number, &opts->basic[i].val.number); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts->basic[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve value for option (%s)\n", + opts->basic[i].opt_name); goto done; } DEBUG(6, ("Option %s has value %d\n", @@ -200,8 +200,8 @@ int sdap_get_options(TALLOC_CTX *memctx, opts->basic[i].def_val.boolean, &opts->basic[i].val.boolean); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts->basic[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve value for option (%s)\n", + opts->basic[i].opt_name); goto done; } DEBUG(6, ("Option %s is %s\n", @@ -223,7 +223,7 @@ int sdap_get_options(TALLOC_CTX *memctx, default_user_map = rfc2307bis_user_map; default_group_map = rfc2307bis_group_map; } else { - DEBUG(0, ("Unrecognized schema type: %s\n", schema)); + SYSLOG_ERROR("Unrecognized schema type: %s\n", schema); ret = EINVAL; goto done; } @@ -240,8 +240,8 @@ int sdap_get_options(TALLOC_CTX *memctx, &opts->user_map[i].name); if (ret != EOK || (opts->user_map[i].def_name && !opts->user_map[i].name)) { - DEBUG(0, ("Failed to retrieve a value (%s)\n", - opts->user_map[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve a value (%s)\n", + opts->user_map[i].opt_name); if (ret != EOK) ret = EINVAL; goto done; } @@ -262,8 +262,8 @@ int sdap_get_options(TALLOC_CTX *memctx, &opts->group_map[i].name); if (ret != EOK || (opts->group_map[i].def_name && !opts->group_map[i].name)) { - DEBUG(0, ("Failed to retrieve a value (%s)\n", - opts->group_map[i].opt_name)); + SYSLOG_ERROR("Failed to retrieve a value (%s)\n", + opts->group_map[i].opt_name); if (ret != EOK) ret = EINVAL; goto done; } @@ -301,10 +301,10 @@ const char *_sdap_go_get_cstring(struct sdap_gen_opts *opts, int id, const char *location) { if (opts[id].type != SDAP_STRING) { - DEBUG(0, ("[%s] Requested type 'String' for option '%s'" - " but value is of type '%s'!\n", - location, opts[id].opt_name, - sdap_type_to_string(opts[id].type))); + SYSLOG_ERROR("[%s] Requested type 'String' for option '%s'" + " but value is of type '%s'!\n", + location, opts[id].opt_name, + sdap_type_to_string(opts[id].type)); return NULL; } return opts[id].val.cstring; @@ -314,10 +314,10 @@ char *_sdap_go_get_string(struct sdap_gen_opts *opts, int id, const char *location) { if (opts[id].type != SDAP_STRING) { - DEBUG(0, ("[%s] Requested type 'String' for option '%s'" - " but value is of type '%s'!\n", - location, opts[id].opt_name, - sdap_type_to_string(opts[id].type))); + SYSLOG_ERROR("[%s] Requested type 'String' for option '%s'" + " but value is of type '%s'!\n", + location, opts[id].opt_name, + sdap_type_to_string(opts[id].type)); return NULL; } return opts[id].val.string; @@ -328,10 +328,10 @@ struct sdap_blob _sdap_go_get_blob(struct sdap_gen_opts *opts, { struct sdap_blob null_blob = { NULL, 0 }; if (opts[id].type != SDAP_BLOB) { - DEBUG(0, ("[%s] Requested type 'Blob' for option '%s'" - " but value is of type '%s'!\n", - location, opts[id].opt_name, - sdap_type_to_string(opts[id].type))); + SYSLOG_ERROR("[%s] Requested type 'Blob' for option '%s'" + " but value is of type '%s'!\n", + location, opts[id].opt_name, + sdap_type_to_string(opts[id].type)); return null_blob; } return opts[id].val.blob; @@ -341,10 +341,10 @@ int _sdap_go_get_int(struct sdap_gen_opts *opts, int id, const char *location) { if (opts[id].type != SDAP_NUMBER) { - DEBUG(0, ("[%s] Requested type 'Number' for option '%s'" - " but value is of type '%s'!\n", - location, opts[id].opt_name, - sdap_type_to_string(opts[id].type))); + SYSLOG_ERROR("[%s] Requested type 'Number' for option '%s'" + " but value is of type '%s'!\n", + location, opts[id].opt_name, + sdap_type_to_string(opts[id].type)); return 0; } return opts[id].val.number; @@ -354,10 +354,10 @@ bool _sdap_go_get_bool(struct sdap_gen_opts *opts, int id, const char *location) { if (opts[id].type != SDAP_BOOL) { - DEBUG(0, ("[%s] Requested type 'Boolean' for option '%s'" - " but value is of type '%s'!\n", - location, opts[id].opt_name, - sdap_type_to_string(opts[id].type))); + SYSLOG_ERROR("[%s] Requested type 'Boolean' for option '%s'" + " but value is of type '%s'!\n", + location, opts[id].opt_name, + sdap_type_to_string(opts[id].type)); return false; } return opts[id].val.boolean; diff --git a/server/providers/ldap/sdap_async.c b/server/providers/ldap/sdap_async.c index 6ab88679f..f50750a20 100644 --- a/server/providers/ldap/sdap_async.c +++ b/server/providers/ldap/sdap_async.c @@ -1350,7 +1350,7 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx, continue; } if (mu > mg) { /* shouldn't be possible */ - DEBUG(0, ("Fatal Internal error: aborting\n")); + SYSLOG_ERROR("Fatal Internal error: aborting\n"); ret = EFAULT; goto fail; } @@ -1369,8 +1369,8 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx, break; default: - DEBUG(0, ("FATAL ERROR: Unhandled schema type! (%d)\n", - opts->schema_type)); + SYSLOG_ERROR("FATAL ERROR: Unhandled schema type! (%d)\n", + opts->schema_type); ret = EFAULT; goto fail; } -- cgit