a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina Pavel Březina <pbrezina@redhat.com>
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina Copyright (C) 2016 Red Hat
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina This program is free software; you can redistribute it and/or modify
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina it under the terms of the GNU General Public License as published by
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina the Free Software Foundation; either version 3 of the License, or
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina (at your option) any later version.
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina This program is distributed in the hope that it will be useful,
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina but WITHOUT ANY WARRANTY; without even the implied warranty of
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina GNU General Public License for more details.
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina You should have received a copy of the GNU General Public License
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina along with this program. If not, see <http://www.gnu.org/licenses/>.
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina#include "providers/data_provider/dp_private.h"
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březinastatic const char *dp_err_to_string(int dp_err_type)
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina return "Success";
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina return "Provider is Offline";
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina return "Request timed out";
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina return "Internal Error";
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina return "Unknown Error";
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březinastatic const char *safe_be_req_err_msg(const char *msg_in,
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina /* No custom error, just use default */
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina "Back end message [%s] contains invalid non-UTF8 character, " \
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březinavoid dp_req_reply_std(const char *request_name,
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina safe_err_msg = safe_be_req_err_msg(reply->message, reply->dp_error);
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina DP_REQ_DEBUG(SSSDBG_TRACE_LIBS, request_name, "Returning [%s]: %d,%d,%s",
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina dp_err_to_string(reply->dp_error), reply->dp_error,
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březinavoid dp_reply_std_set(struct dp_reply_std *reply,
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina const char *msg)
a1bf79449204ce9a5392b9d09b953a6bdf53a122Pavel Březina DEBUG(SSSDBG_MINOR_FAILURE, "DP Error is OK on failed request?\n");