diff options
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/data_provider_be.c | 32 | ||||
-rw-r--r-- | src/providers/dp_backend.h | 7 | ||||
-rw-r--r-- | src/providers/ipa/ipa_hostid.c | 15 |
3 files changed, 24 insertions, 30 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index a343b107..0b45baaa 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -1336,7 +1336,7 @@ static void be_autofs_handler_callback(struct be_req *req, static int be_host_handler(DBusMessage *message, struct sbus_connection *conn) { - struct be_acct_req *req; + struct be_host_req *req; struct be_req *be_req; struct be_client *becli; DBusMessage *reply; @@ -1345,7 +1345,6 @@ static int be_host_handler(DBusMessage *message, struct sbus_connection *conn) void *user_data; uint32_t flags; char *filter; - uint32_t attr_type; int ret; dbus_uint16_t err_maj; dbus_uint32_t err_min; @@ -1362,7 +1361,6 @@ static int be_host_handler(DBusMessage *message, struct sbus_connection *conn) ret = dbus_message_get_args(message, &dbus_error, DBUS_TYPE_UINT32, &flags, - DBUS_TYPE_UINT32, &attr_type, DBUS_TYPE_STRING, &filter, DBUS_TYPE_INVALID); if (!ret) { @@ -1372,7 +1370,7 @@ static int be_host_handler(DBusMessage *message, struct sbus_connection *conn) } DEBUG(SSSDBG_TRACE_LIBS, - ("Got request for [%u][%d][%s]\n", flags, attr_type, filter)); + ("Got request for [%u][%s]\n", flags, filter)); reply = dbus_message_new_method_return(message); if (!reply) return ENOMEM; @@ -1420,35 +1418,27 @@ static int be_host_handler(DBusMessage *message, struct sbus_connection *conn) be_req->fn = acctinfo_callback; be_req->pvt = reply; - req = talloc(be_req, struct be_acct_req); + req = talloc(be_req, struct be_host_req); if (!req) { err_maj = DP_ERR_FATAL; err_min = ENOMEM; err_msg = "Out of memory"; goto done; } - req->entry_type = BE_REQ_HOST | (flags & BE_REQ_FAST); - req->attr_type = (int)attr_type; + req->type = BE_REQ_HOST | (flags & BE_REQ_FAST); be_req->req_data = req; - if ((attr_type != BE_ATTR_CORE) && - (attr_type != BE_ATTR_MEM) && - (attr_type != BE_ATTR_ALL)) { - /* Unrecognized attr type */ - err_maj = DP_ERR_FATAL; - err_min = EINVAL; - err_msg = "Invalid Attrs Parameter"; - goto done; - } - if (filter) { - if (strncmp(filter, "name=", 5) == 0) { + ret = strncmp(filter, "name=", 5); + if (ret == 0) { req->filter_type = BE_FILTER_NAME; ret = split_name_extended(req, &filter[5], - &req->filter_value, - &req->extra_value); - } else { + &req->name, + &req->alias); + } + + if (ret) { err_maj = DP_ERR_FATAL; err_min = EINVAL; err_msg = "Invalid Filter"; diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h index 8357e85f..c6bf2d0c 100644 --- a/src/providers/dp_backend.h +++ b/src/providers/dp_backend.h @@ -173,6 +173,13 @@ struct be_get_subdomains_req { struct subdomain_info **domain_list; }; +struct be_host_req { + uint32_t type; + int filter_type; + char *name; + char *alias; +}; + bool be_is_offline(struct be_ctx *ctx); void be_mark_offline(struct be_ctx *ctx); diff --git a/src/providers/ipa/ipa_hostid.c b/src/providers/ipa/ipa_hostid.c index 8fcc59ed..c322c61f 100644 --- a/src/providers/ipa/ipa_hostid.c +++ b/src/providers/ipa/ipa_hostid.c @@ -45,8 +45,7 @@ hosts_get_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct ipa_hostid_ctx *hostid_ctx, const char *name, - const char *alias, - int attrs_type); + const char *alias); static errno_t hosts_get_recv(struct tevent_req *req, int *dp_error_out); @@ -59,7 +58,7 @@ ipa_host_info_handler(struct be_req *breq) { struct ipa_hostid_ctx *hostid_ctx; struct sdap_id_ctx *ctx; - struct be_acct_req *ar; + struct be_host_req *hr; struct tevent_req *req; int dp_error = DP_ERR_FATAL; errno_t ret = EOK; @@ -75,17 +74,16 @@ ipa_host_info_handler(struct be_req *breq) goto done; } - ar = talloc_get_type(breq->req_data, struct be_acct_req); + hr = talloc_get_type(breq->req_data, struct be_host_req); - if (ar->filter_type != BE_FILTER_NAME) { + if (hr->filter_type != BE_FILTER_NAME) { ret = EINVAL; err = "Invalid filter type"; goto done; } req = hosts_get_send(breq, breq->be_ctx->ev, hostid_ctx, - ar->filter_value, ar->extra_value, - ar->attr_type); + hr->name, hr->alias); if (!req) { ret = ENOMEM; err = "Out of memory"; @@ -150,8 +148,7 @@ hosts_get_send(TALLOC_CTX *memctx, struct tevent_context *ev, struct ipa_hostid_ctx *hostid_ctx, const char *name, - const char *alias, - int attrs_type) + const char *alias) { struct tevent_req *req; struct hosts_get_state *state; |