diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-03-08 17:24:44 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-09 10:53:47 -0400 |
commit | ea4f00deaa457f8d8262528cf628691ced497c2e (patch) | |
tree | 6bd839ee204fc2e1d60175cfa7411811d391a012 /server/infopipe/infopipe.c | |
parent | 0c6b300a283c7c6bfc03fa16af1f0ce934d02391 (diff) | |
download | sssd-ea4f00deaa457f8d8262528cf628691ced497c2e.tar.gz sssd-ea4f00deaa457f8d8262528cf628691ced497c2e.tar.xz sssd-ea4f00deaa457f8d8262528cf628691ced497c2e.zip |
Implement SetGroupGID in the InfoPipe
Diffstat (limited to 'server/infopipe/infopipe.c')
-rw-r--r-- | server/infopipe/infopipe.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c index 09ffcbdf6..4ec971caa 100644 --- a/server/infopipe/infopipe.c +++ b/server/infopipe/infopipe.c @@ -141,6 +141,49 @@ static int infp_monitor_init(struct infp_ctx *infp_ctx) return EOK; } +/* Helper function to return an immediate error message in the event + * of internal error in the InfoPipe to avoid forcing the clients to + * time out waiting for a reply. + */ +void infp_return_failure(struct infp_req_ctx *infp_req, const char *message) +{ + DBusMessage *reply; + + reply = dbus_message_new_error(infp_req->req_message, + DBUS_ERROR_FAILED, + message); + /* If the reply was NULL, we ran out of memory, so we won't + * bother trying to queue the message to send. In this case, + * our safest move is to allow the client to time out waiting + * for a reply. + */ + if(reply) { + sbus_conn_send_reply(infp_req->sconn, reply); + dbus_message_unref(reply); + } +} + +/* Helper function to return an ack to the caller to indicate + * that the internal process completed succesfully. An ack in + * InfoPipe is simply an empty D-BUS method return (as opposed + * to a D-BUS error or signal) + */ +void infp_return_success(struct infp_req_ctx *infp_req) +{ + DBusMessage *reply; + + reply = dbus_message_new_method_return(infp_req->req_message); + /* If the reply was NULL, we ran out of memory, so we won't + * bother trying to queue the message to send. In this case, + * our safest move is to allow the client to time out waiting + * for a reply. + */ + if(reply) { + sbus_conn_send_reply(infp_req->sconn, reply); + dbus_message_unref(reply); + } +} + struct sbus_method infp_methods[] = { INFP_PERMISSION_METHODS INFP_USER_METHODS |