sudosrv_dp.c revision 2827b0d03f7b6bafa504d22a5d7ca39cbda048b3
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2011 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <talloc.h>
#include <tevent.h>
#include "sbus/sssd_dbus.h"
#include "sbus/sbus_client.h"
#include "providers/data_provider.h"
#include "responder/common/responder.h"
#include "responder/sudo/sudosrv_private.h"
struct sudo_dp_refresh_state {
};
/* FIXME -- need to keep track of a running request
* and just queue a callback
* OR reuse the common dp requests
*/
struct sss_domain_info *dom,
const char *username)
{
struct sudo_dp_refresh_state *state;
int ret;
struct tevent_req *req;
/* Cache refresh requests need to be allocated on the responder context
* so that they don't go away if a client disconnects. The worst-
* case scenario here is that the cache is updated without any
* client expecting a response.
*/
/* double check dp_ctx has actually been initialized.
* in some pathological cases it may happen that sudo starts up before
* dp connection code is actually able to establish a connection.
*/
("The Data Provider connection for %s is not available! "
"This maybe a bug, it shouldn't happen!\n",
goto error;
}
goto error;
}
if (!dbret) {
goto error;
}
}
return req;
return req;
}
char **err_msg)
{
int type;
if (!reply) {
/* reply should never be null. This function shouldn't be called
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
goto done;
}
switch (type) {
if (!ret) {
goto done;
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
DBUS_ERROR_NO_REPLY) == 0) {
goto done;
}
DEBUG(0,("The Data Provider returned an error [%s]\n",
/* Falling through to default intentionally*/
default:
/*
* Timeout or other error occurred or something
* unexpected happened.
* It doesn't matter which, because either way we
* know that this connection isn't trustworthy.
* We'll destroy it now.
*/
}
done:
return err;
}
{
struct tevent_req *req;
char *err_msg;
struct sudo_dp_refresh_state *state;
"err_maj: %d err_min: %d err_msg: [%s]\n",
return;
}
}
{
struct sudo_dp_refresh_state *state;
return EOK;
}