[SSSD] [PATCH] DP: Refactor responder_dp_req so it's reusable by other responders

Jakub Hrozek jhrozek at redhat.com
Sun Jan 22 21:08:40 UTC 2012


A number of new responders is currently being developed in addition to
the existing NSS and PAM responders that only deal with accounts. The
new responders often deal with different data such as automounter maps
or sudoer rules. It is prudent to let these responders communicate with
back ends using their own protocol.

Attached is a patch that refactors the requests in Data Provider so that
they are more generic. The commits message is slightly more verbose than
usual this time to explain all the changes.

I'm going to include a sudo request shortly as an example of a new
non-account request.

[PATCH] DP: Refactor responder_dp_req so it's reusable by other responders:
* the internal requst is now more generic and is decoupled from
  account-specific data. There is a new sss_dp_issue_request() wrapper
  that issues a BE request or registers a callback
* the public requests all use struct sss_dp_req_state as the tevent_req
  state data. This allows to report back data from the internal request
  even if the caller is just a callback notifier
* each specific request now uses an _info structure that contains all
  the data necessary to construct a DBusMessage passed to provider
* each specific request now defines a sss_dp_get_$data_msg callback that
  is called from the sss_dp_issue_request() common wraper. The purpose
  of the wrapper is to construct a DBusMessage and bind it to a DBus
  method so the message can be just sent over to back end

The miscellanous changes include:
* change SSS_DP_ constants to an enum. This way, a switch() would error
  if a value is not handled.
* rename sss_dp_get_account_int_send() to sss_dp_internal_get_send()
  request because the internal request is going to handle more than just
  account data

The patch must be applied on top of all Stephen's patches that are
currently on the list, including the services support.
-------------- next part --------------
>From e16f790ec319a446302191d1820ae306338f211f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 20 Jan 2012 13:53:16 +0100
Subject: [PATCH 1/2] DP: Refactor responder_dp_req so it's reusable by other
 responders

* the internal requst is now more generic and is decoupled from
  account-specific data. There is a new sss_dp_issue_request() wrapper
  that issues a BE request or registers a callback
* the public requests all use struct sss_dp_req_state as the tevent_req
  state data. This allows to report back data from the internal request
  even if the caller is just a callback notifier
* each specific request now uses an _info structure that contains all
  the data necessary to construct a DBusMessage passed to provider
* each specific request now defines a sss_dp_get_$data_msg callback that
  is called from the sss_dp_issue_request() common wraper. The purpose
  of the wrapper is to construct a DBusMessage and bind it to a DBus
  method so the message can be just sent over to back end

The miscellanous changes include:
* change SSS_DP_ constants to an enum. This way, a switch() would error
  if a value is not handled.
* rename sss_dp_get_account_int_send() to sss_dp_internal_get_send()
  request because the internal request is going to handle more than just
  account data
---
 src/responder/common/responder.h    |   12 +-
 src/responder/common/responder_dp.c |  455 ++++++++++++++++++++---------------
 2 files changed, 264 insertions(+), 203 deletions(-)

diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index 2944aa5c47ffd33df53933f50d47dc770db100c7..12196a3430a68120eba13e625d8050036bd0484a 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -157,11 +157,13 @@ void sss_cmd_done(struct cli_ctx *cctx, void *freectx);
 int sss_cmd_get_version(struct cli_ctx *cctx);
 struct cli_protocol_version *register_cli_protocol_version(void);
 
-#define SSS_DP_USER 1
-#define SSS_DP_GROUP 2
-#define SSS_DP_INITGROUPS 3
-#define SSS_DP_NETGR 4
-#define SSS_DP_SERVICES 5
+enum sss_dp_type {
+    SSS_DP_USER,
+    SSS_DP_GROUP,
+    SSS_DP_INITGROUPS,
+    SSS_DP_NETGR,
+    SSS_DP_SERVICES
+};
 
 typedef void (*sss_dp_callback_t)(uint16_t err_maj, uint32_t err_min,
                                   const char *err_msg, void *ptr);
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c
index 5174bd3e9fe71c01a6e4885f3e969709b58d9564..f101a3c85d74acdd382d83f4e0efc6bcfa2d1d82 100644
--- a/src/responder/common/responder_dp.c
+++ b/src/responder/common/responder_dp.c
@@ -32,11 +32,7 @@ hash_table_t *dp_requests = NULL;
 
 struct sss_dp_req;
 
-struct dp_get_account_state {
-    struct resp_ctx *rctx;
-    struct sss_domain_info *dom;
-    const char *opt_name;
-    uint32_t opt_id;
+struct sss_dp_req_state {
     hash_key_t *key;
 
     dbus_uint16_t err_maj;
@@ -44,6 +40,8 @@ struct dp_get_account_state {
     char *err_msg;
 };
 
+typedef DBusMessage * (dbus_msg_constructor)(void *);
+
 struct sss_dp_callback {
     struct sss_dp_callback *prev;
     struct sss_dp_callback *next;
@@ -81,7 +79,7 @@ static int sss_dp_req_destructor(void *ptr)
 {
     struct sss_dp_callback *cb;
     struct sss_dp_req *sdp_req = talloc_get_type(ptr, struct sss_dp_req);
-    struct dp_get_account_state *state;
+    struct sss_dp_req_state *state;
 
     /* Cancel Dbus pending reply if still pending */
     if (sdp_req->pending_reply) {
@@ -93,7 +91,7 @@ static int sss_dp_req_destructor(void *ptr)
      * an error now.
      */
     while((cb = sdp_req->cb_list) != NULL) {
-        state = tevent_req_data(cb->req, struct dp_get_account_state);
+        state = tevent_req_data(cb->req, struct sss_dp_req_state);
         state->err_maj = DP_ERR_FATAL;
         state->err_min = EIO;
 
@@ -233,15 +231,125 @@ done:
 }
 
 static struct tevent_req *
-sss_dp_get_account_int_send(struct resp_ctx *rctx,
-                            hash_key_t *key,
-                            struct sss_domain_info *dom,
-                            uint32_t be_type,
-                            const char *filter);
+sss_dp_internal_get_send(struct resp_ctx *rctx,
+                         hash_key_t *key,
+                         struct sss_domain_info *dom,
+                         DBusMessage *msg);
 
 static void
 sss_dp_get_account_done(struct tevent_req *subreq);
 
+static errno_t
+sss_dp_issue_request(TALLOC_CTX *mem_ctx, struct resp_ctx *rctx,
+                     hash_key_t *key, struct sss_domain_info *dom,
+                     dbus_msg_constructor msg_create, void *pvt,
+                     struct tevent_req *nreq, tevent_req_fn tvcb)
+{
+    int hret;
+    hash_value_t value;
+    struct tevent_req *sidereq;
+    struct sss_dp_req *sdp_req;
+    struct sss_dp_callback *cb;
+    DBusMessage *msg;
+
+    /* Check the hash for existing references to this request */
+    hret = hash_lookup(rctx->dp_request_table, key, &value);
+    switch (hret) {
+    case HASH_SUCCESS:
+        /* Request already in progress */
+        DEBUG(SSSDBG_TRACE_FUNC,
+              ("Identical request in progress: [%s]\n", key->str));
+        return EOK;
+
+    case HASH_ERROR_KEY_NOT_FOUND:
+        /* No such request in progress
+         * Create a new request
+         */
+        msg = msg_create(pvt);
+        if (!msg) {
+            DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot create D-Bus message\n"));
+            return EIO;
+        }
+
+        value.type = HASH_VALUE_PTR;
+        sidereq = sss_dp_internal_get_send(rctx, key, dom, msg);
+        dbus_message_unref(msg);
+        if (!sidereq) {
+            DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot send D-Bus message\n"));
+            return EIO;
+        }
+        tevent_req_set_callback(sidereq, tvcb, NULL);
+
+        /* We should now be able to find the sdp_req in the hash table */
+        hret = hash_lookup(rctx->dp_request_table, key, &value);
+        if (hret != HASH_SUCCESS) {
+            /* Something must have gone wrong with creating the request */
+            DEBUG(SSSDBG_CRIT_FAILURE, ("The request has disappearead?\n"));
+            talloc_zfree(sidereq);
+            return EIO;
+        }
+        break;
+
+    default:
+        DEBUG(SSSDBG_CRIT_FAILURE,
+              ("Could not query request list (%s)\n",
+               hash_error_string(hret)));
+        return EIO;
+    }
+
+    /* Register this request for results */
+    sdp_req = talloc_get_type(value.ptr, struct sss_dp_req);
+    if (!sdp_req) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Could not retrieve DP request context\n"));
+        return EIO;
+    }
+
+    cb = talloc_zero(mem_ctx, struct sss_dp_callback);
+    if (!cb) {
+        return ENOMEM;
+    }
+
+    cb->req = nreq;
+    cb->sdp_req = sdp_req;
+
+    /* Add it to the list of requests to call */
+    DLIST_ADD_END(sdp_req->cb_list, cb,
+                  struct sss_dp_callback *);
+    talloc_set_destructor((TALLOC_CTX *)cb,
+                          sss_dp_callback_destructor);
+
+    return EOK;
+}
+
+static errno_t
+sss_dp_req_recv(TALLOC_CTX *mem_ctx,
+                struct tevent_req *req,
+                dbus_uint16_t *err_maj,
+                dbus_uint32_t *err_min,
+                char **err_msg)
+{
+    struct sss_dp_req_state *state =
+            tevent_req_data(req, struct sss_dp_req_state);
+
+    enum tevent_req_state TRROEstate;
+    uint64_t TRROEerr;
+
+    *err_maj = state->err_maj;
+    *err_min = state->err_min;
+    *err_msg = talloc_steal(mem_ctx, state->err_msg);
+
+    if (tevent_req_is_error(req, &TRROEstate, &TRROEerr)) {
+        if (TRROEstate == TEVENT_REQ_USER_ERROR) {
+            *err_maj = DP_ERR_FATAL;
+            *err_min = TRROEerr;
+        } else {
+            return EIO;
+        }
+    }
+
+    return EOK;
+}
+
 /* Send a request to the data provider
  * Once this function is called, the communication
  * with the data provider will always run to
@@ -249,6 +357,20 @@ sss_dp_get_account_done(struct tevent_req *subreq);
  * cancel the notification of completion, but not
  * the data provider action.
  */
+static DBusMessage *sss_dp_get_account_msg(void *pvt);
+
+struct sss_dp_account_info {
+    struct sss_domain_info *dom;
+
+    bool fast_reply;
+    int type;
+    const char *opt_name;
+    const char *extra;
+    uint32_t opt_id;
+
+    hash_key_t *key;
+};
+
 struct tevent_req *
 sss_dp_get_account_send(TALLOC_CTX *mem_ctx,
                         struct resp_ctx *rctx,
@@ -260,17 +382,11 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx,
                         const char *extra)
 {
     errno_t ret;
-    int hret;
     struct tevent_req *req;
-    struct tevent_req *sidereq;
-    struct dp_get_account_state *state;
-    struct sss_dp_req *sdp_req;
-    struct sss_dp_callback *cb;
-    char *filter;
-    uint32_t be_type;
-    hash_value_t value;
+    struct sss_dp_account_info *info;
+    struct sss_dp_req_state *state;
 
-    req = tevent_req_create(mem_ctx, &state, struct dp_get_account_state);
+    req = tevent_req_create(mem_ctx, &state, struct sss_dp_req_state);
     if (!req) {
         return NULL;
     }
@@ -286,35 +402,13 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx,
         goto error;
     }
 
-    state->rctx = rctx;
-    state->dom = dom;
-
-    switch (type) {
-    case SSS_DP_USER:
-        be_type = BE_REQ_USER;
-        break;
-    case SSS_DP_GROUP:
-        be_type = BE_REQ_GROUP;
-        break;
-    case SSS_DP_INITGROUPS:
-        be_type = BE_REQ_INITGROUPS;
-        break;
-    case SSS_DP_NETGR:
-        be_type = BE_REQ_NETGROUP;
-        break;
-    case SSS_DP_SERVICES:
-        be_type = BE_REQ_SERVICES;
-        break;
-    default:
-        ret = EINVAL;
-        goto error;
-    }
-
-    if (fast_reply) {
-        be_type |= BE_REQ_FAST;
-    }
-
-    /* Check whether there's already an identical request in progress */
+    info = talloc_zero(state, struct sss_dp_account_info);
+    info->fast_reply = fast_reply;
+    info->type = type;
+    info->opt_name = opt_name;
+    info->opt_id = opt_id;
+    info->extra = extra;
+    info->dom = dom;
 
     state->key = talloc(state, hash_key_t);
     if (!state->key) {
@@ -326,102 +420,40 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx,
 
     if (opt_name) {
         if (extra) {
-            filter = talloc_asprintf(state, "name=%s:%s",
-                                     opt_name, extra);
             state->key->str = talloc_asprintf(state->key, "%d:%s:%s@%s",
                                               type, opt_name,
                                               extra, dom->name);
         } else {
-            filter = talloc_asprintf(state, "name=%s", opt_name);
             state->key->str = talloc_asprintf(state->key, "%d:%s@%s",
                                               type, opt_name, dom->name);
         }
     } else if (opt_id) {
         if (extra) {
-            filter = talloc_asprintf(state, "idnumber=%u:%s",
-                                     opt_id, extra);
             state->key->str = talloc_asprintf(state->key, "%d:%d:%s@%s",
                                               type, opt_id,
                                               extra, dom->name);
         } else {
-            filter = talloc_asprintf(state, "idnumber=%u", opt_id);
             state->key->str = talloc_asprintf(state->key, "%d:%d@%s",
                                               type, opt_id, dom->name);
         }
     } else {
-        filter = talloc_strdup(state, ENUM_INDICATOR);
         state->key->str = talloc_asprintf(state->key, "%d:*@%s",
                                           type, dom->name);
     }
-    if (!filter || !state->key->str) {
+    if (!state->key->str) {
         ret = ENOMEM;
     }
 
-    /* Check the hash for existing references to this request */
-    hret = hash_lookup(rctx->dp_request_table, state->key, &value);
-    switch (hret) {
-    case HASH_SUCCESS:
-        /* Request already in progress */
-        DEBUG(SSSDBG_TRACE_FUNC,
-              ("Identical request in progress: [%s]\n", state->key->str));
-        break;
-
-    case HASH_ERROR_KEY_NOT_FOUND:
-        /* No such request in progress
-         * Create a new request
-         */
-
-        value.type = HASH_VALUE_PTR;
-        sidereq = sss_dp_get_account_int_send(rctx, state->key, dom,
-                                             be_type, filter);
-        if (!sidereq) {
-            ret = ENOMEM;
-            goto error;
-        }
-        tevent_req_set_callback(sidereq, sss_dp_get_account_done, NULL);
-
-        /* We should now be able to find the sdp_req in the hash table */
-        hret = hash_lookup(rctx->dp_request_table, state->key, &value);
-        if (hret != HASH_SUCCESS) {
-            /* Something must have gone wrong with creating the request */
-            talloc_zfree(sidereq);
-            ret = EIO;
-            goto error;
-        }
-
-        break;
-
-    default:
-        DEBUG(SSSDBG_CRIT_FAILURE,
-              ("Could not query request list (%s)\n",
-               hash_error_string(hret)));
-        ret = EIO;
-        goto error;
-    }
-
-    /* Register this request for results */
-    sdp_req = talloc_get_type(value.ptr, struct sss_dp_req);
-    if (!sdp_req) {
-        DEBUG(0, ("Could not retrieve DP request context\n"));
-        ret = EIO;
+    ret = sss_dp_issue_request(state, rctx, state->key, dom,
+                               sss_dp_get_account_msg, info,
+                               req, sss_dp_get_account_done);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_OP_FAILURE,
+              ("Could not issue DP request [%d]: %s\n",
+               ret, strerror(ret)));
         goto error;
     }
 
-    cb = talloc_zero(state, struct sss_dp_callback);
-    if (!cb) {
-        ret = ENOMEM;
-        goto error;
-    }
-
-    cb->req = req;
-    cb->sdp_req = sdp_req;
-
-    /* Add it to the list of requests to call */
-    DLIST_ADD_END(sdp_req->cb_list, cb,
-                  struct sss_dp_callback *);
-    talloc_set_destructor((TALLOC_CTX *)cb,
-                          sss_dp_callback_destructor);
-
     return req;
 
 error:
@@ -430,11 +462,99 @@ error:
     return req;
 }
 
+static DBusMessage *
+sss_dp_get_account_msg(void *pvt)
+{
+    DBusMessage *msg;
+    dbus_bool_t dbret;
+    struct sss_dp_account_info *info;
+    uint32_t be_type;
+    uint32_t attrs = BE_ATTR_CORE;
+    char *filter;
+
+    info = talloc_get_type(pvt, struct sss_dp_account_info);
+
+    switch (info->type) {
+        case SSS_DP_USER:
+            be_type = BE_REQ_USER;
+            break;
+        case SSS_DP_GROUP:
+            be_type = BE_REQ_GROUP;
+            break;
+        case SSS_DP_INITGROUPS:
+            be_type = BE_REQ_INITGROUPS;
+            break;
+        case SSS_DP_NETGR:
+            be_type = BE_REQ_NETGROUP;
+            break;
+        case SSS_DP_SERVICES:
+            be_type = BE_REQ_SERVICES;
+            break;
+        default:
+            DEBUG(SSSDBG_CRIT_FAILURE, ("Unknown BE type\n"));
+            return NULL;
+    }
+
+    if (info->fast_reply) {
+        be_type |= BE_REQ_FAST;
+    }
+
+    if (info->opt_name) {
+        if (info->extra) {
+            filter = talloc_asprintf(info, "name=%s:%s",
+                                     info->opt_name, info->extra);
+        } else {
+            filter = talloc_asprintf(info, "name=%s", info->opt_name);
+        }
+    } else if (info->opt_id) {
+        if (info->extra) {
+            filter = talloc_asprintf(info, "idnumber=%u:%s",
+                                     info->opt_id, info->extra);
+        } else {
+            filter = talloc_asprintf(info, "idnumber=%u", info->opt_id);
+        }
+    } else {
+        filter = talloc_strdup(info, ENUM_INDICATOR);
+    }
+    if (!filter) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory?!\n"));
+        return NULL;
+    }
+
+    msg = dbus_message_new_method_call(NULL,
+                                       DP_PATH,
+                                       DP_INTERFACE,
+                                       DP_METHOD_GETACCTINFO);
+    if (msg == NULL) {
+        talloc_free(filter);
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory?!\n"));
+        return NULL;
+    }
+
+    /* create the message */
+    DEBUG(SSSDBG_TRACE_FUNC,
+          ("Creating request for [%s][%u][%d][%s]\n",
+           info->dom->name, be_type, attrs, filter));
+
+    dbret = dbus_message_append_args(msg,
+                                     DBUS_TYPE_UINT32, &be_type,
+                                     DBUS_TYPE_UINT32, &attrs,
+                                     DBUS_TYPE_STRING, &filter,
+                                     DBUS_TYPE_INVALID);
+    talloc_free(filter);
+    if (!dbret) {
+        DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to build message\n"));
+        dbus_message_unref(msg);
+        return NULL;
+    }
+
+    return msg;
+}
+
 static void
 sss_dp_get_account_done(struct tevent_req *sidereq)
 {
-    /* Nothing to do here. The callbacks have already been invoked */
-    talloc_zfree(sidereq);
+    talloc_free(sidereq);
 }
 
 errno_t
@@ -444,57 +564,31 @@ sss_dp_get_account_recv(TALLOC_CTX *mem_ctx,
                         dbus_uint32_t *err_min,
                         char **err_msg)
 {
-    struct dp_get_account_state *state =
-            tevent_req_data(req, struct dp_get_account_state);
-
-    enum tevent_req_state TRROEstate;
-    uint64_t TRROEerr;
-
-    *err_maj = state->err_maj;
-    *err_min = state->err_min;
-    *err_msg = talloc_steal(mem_ctx, state->err_msg);
-
-    if (tevent_req_is_error(req, &TRROEstate, &TRROEerr)) {
-        if (TRROEstate == TEVENT_REQ_USER_ERROR) {
-            *err_maj = DP_ERR_FATAL;
-            *err_min = TRROEerr;
-        } else {
-            return EIO;
-        }
-    }
-
-    return EOK;
+    return sss_dp_req_recv(mem_ctx, req, err_maj, err_min, err_msg);
 }
 
-struct dp_get_account_int_state {
+struct dp_internal_get_state {
     struct resp_ctx *rctx;
     struct sss_domain_info *dom;
-    uint32_t be_type;
-    const char *filter;
 
     struct sss_dp_req *sdp_req;
     DBusPendingCall *pending_reply;
 };
 
-static void sss_dp_get_account_int_done(DBusPendingCall *pending, void *ptr);
+static void sss_dp_internal_get_done(DBusPendingCall *pending, void *ptr);
 
 static struct tevent_req *
-sss_dp_get_account_int_send(struct resp_ctx *rctx,
-                            hash_key_t *key,
-                            struct sss_domain_info *dom,
-                            uint32_t be_type,
-                            const char *filter)
+sss_dp_internal_get_send(struct resp_ctx *rctx,
+                         hash_key_t *key,
+                         struct sss_domain_info *dom,
+                         DBusMessage *msg)
 {
     errno_t ret;
     int hret;
     struct tevent_req *req;
-    struct dp_get_account_int_state *state;
+    struct dp_internal_get_state *state;
     struct be_conn *be_conn;
-    DBusMessage *msg;
-    dbus_bool_t dbret;
-    bool msg_created = false;
     hash_value_t value;
-    uint32_t attrs = BE_ATTR_CORE;
 
     /* Internal requests need to be allocated on the responder context
      * so that they don't go away if a client disconnects. The worst-
@@ -503,13 +597,11 @@ sss_dp_get_account_int_send(struct resp_ctx *rctx,
      */
     req = tevent_req_create(rctx,
                             &state,
-                            struct dp_get_account_int_state);
+                            struct dp_internal_get_state);
     if (!req)  return NULL;
 
     state->rctx = rctx;
     state->dom = dom;
-    state->be_type = be_type;
-    state->filter = filter;
 
     state->sdp_req = talloc_zero(state, struct sss_dp_req);
     if (!state->sdp_req) {
@@ -538,40 +630,11 @@ sss_dp_get_account_int_send(struct resp_ctx *rctx,
         goto error;
     }
 
-    /* create the message */
-    msg = dbus_message_new_method_call(NULL,
-                                       DP_PATH,
-                                       DP_INTERFACE,
-                                       DP_METHOD_GETACCTINFO);
-    if (msg == NULL) {
-        DEBUG(0,("Out of memory?!\n"));
-        ret = ENOMEM;
-        goto error;
-    }
-    msg_created = true;
-
-    DEBUG(SSSDBG_TRACE_FUNC,
-          ("Sending request for [%s][%u][%d][%s]\n",
-           dom->name, be_type, attrs, filter));
-
-    dbret = dbus_message_append_args(msg,
-                                     DBUS_TYPE_UINT32, &be_type,
-                                     DBUS_TYPE_UINT32, &attrs,
-                                     DBUS_TYPE_STRING, &filter,
-                                     DBUS_TYPE_INVALID);
-    if (!dbret) {
-        DEBUG(1,("Failed to build message\n"));
-        ret = EIO;
-        goto error;
-    }
-
     ret = sbus_conn_send(be_conn->conn, msg,
                          SSS_CLI_SOCKET_TIMEOUT / 2,
-                         sss_dp_get_account_int_done,
+                         sss_dp_internal_get_done,
                          req,
                          &state->sdp_req->pending_reply);
-    dbus_message_unref(msg);
-    msg_created = false;
     if (ret != EOK) {
         /*
          * Critical Failure
@@ -601,26 +664,22 @@ sss_dp_get_account_int_send(struct resp_ctx *rctx,
     return req;
 
 error:
-    if (msg_created) {
-        dbus_message_unref(msg);
-    }
-
     tevent_req_error(req, ret);
     tevent_req_post(req, rctx->ev);
     return req;
 }
 
-static void sss_dp_get_account_int_done(DBusPendingCall *pending, void *ptr)
+static void sss_dp_internal_get_done(DBusPendingCall *pending, void *ptr)
 {
     int ret;
     struct tevent_req *req;
     struct sss_dp_req *sdp_req;
     struct sss_dp_callback *cb;
-    struct dp_get_account_int_state *state;
-    struct dp_get_account_state *cb_state;
+    struct dp_internal_get_state *state;
+    struct sss_dp_req_state *cb_state;
 
     req = talloc_get_type(ptr, struct tevent_req);
-    state = tevent_req_data(req, struct dp_get_account_int_state);
+    state = tevent_req_data(req, struct dp_internal_get_state);
     sdp_req = state->sdp_req;
 
     /* prevent trying to cancel a reply that we already received */
@@ -647,7 +706,7 @@ static void sss_dp_get_account_int_done(DBusPendingCall *pending, void *ptr)
 
     /* Check whether we need to issue any callbacks */
     while ((cb = sdp_req->cb_list) != NULL) {
-        cb_state = tevent_req_data(cb->req, struct dp_get_account_state);
+        cb_state = tevent_req_data(cb->req, struct sss_dp_req_state);
         cb_state->err_maj = sdp_req->err_maj;
         cb_state->err_min = sdp_req->err_min;
         cb_state->err_msg = talloc_strdup(cb_state, sdp_req->err_msg);
-- 
1.7.7.5



More information about the sssd-devel mailing list