summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2015-01-05 13:49:27 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-02-17 15:53:47 +0100
commit16cf65323a41b3de4a98f309cdf900f3b0d9ec25 (patch)
tree9a870c177bbde4298939c8306de427db40fe509d /src
parentdf4e1db5d41c903ae57fd880acc76a0ad84aa7b2 (diff)
downloadsssd-16cf65323a41b3de4a98f309cdf900f3b0d9ec25.tar.gz
sssd-16cf65323a41b3de4a98f309cdf900f3b0d9ec25.tar.xz
sssd-16cf65323a41b3de4a98f309cdf900f3b0d9ec25.zip
sbus: remove unused 'reply as' functions
These functions became unused after previous patch. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/sbus/sssd_dbus.h22
-rw-r--r--src/sbus/sssd_dbus_properties.c144
-rw-r--r--src/sbus/sssd_dbus_request.c184
3 files changed, 0 insertions, 350 deletions
diff --git a/src/sbus/sssd_dbus.h b/src/sbus/sssd_dbus.h
index 0f7562e6b..1de069741 100644
--- a/src/sbus/sssd_dbus.h
+++ b/src/sbus/sssd_dbus.h
@@ -298,28 +298,6 @@ int sbus_request_return_and_finish(struct sbus_request *dbus_req,
int first_arg_type,
...);
-int sbus_add_variant_to_dict(DBusMessageIter *iter_dict,
- const char *key,
- int type,
- const void *value);
-
-int sbus_add_array_as_variant_to_dict(DBusMessageIter *iter_dict,
- const char *key,
- int type,
- uint8_t *values,
- const int len,
- const unsigned int item_size);
-
-int sbus_request_return_as_variant(struct sbus_request *dbus_req,
- int type,
- const void *value);
-
-int sbus_request_return_array_as_variant(struct sbus_request *dbus_req,
- int type,
- uint8_t *values,
- const int len,
- const size_t item_size);
-
/*
* Return an error for a DBus method call request. The @error is a normal
diff --git a/src/sbus/sssd_dbus_properties.c b/src/sbus/sssd_dbus_properties.c
index 15bc6a937..25ea446d1 100644
--- a/src/sbus/sssd_dbus_properties.c
+++ b/src/sbus/sssd_dbus_properties.c
@@ -339,147 +339,3 @@ static int sbus_properties_get_all(struct sbus_request *sbus_req, void *pvt)
fail:
return sbus_request_fail_and_finish(sbus_req, error);
}
-
-static char *
-type_to_string(char type, char *str)
-{
- int l;
-
- l = snprintf(str, 2, "%c", type);
- if (l != 1) {
- return NULL;
- }
-
- return str;
-}
-
-int sbus_add_variant_to_dict(DBusMessageIter *iter_dict,
- const char *key,
- int type,
- const void *value)
-{
- DBusMessageIter iter_dict_entry;
- DBusMessageIter iter_dict_val;
- dbus_bool_t dbret;
- char strtype[2];
-
- type_to_string(type, strtype);
-
- dbret = dbus_message_iter_open_container(iter_dict,
- DBUS_TYPE_DICT_ENTRY, NULL,
- &iter_dict_entry);
- if (!dbret) {
- return ENOMEM;
- }
-
- /* Start by appending the key */
- dbret = dbus_message_iter_append_basic(&iter_dict_entry,
- DBUS_TYPE_STRING, &key);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_open_container(&iter_dict_entry,
- DBUS_TYPE_VARIANT,
- strtype,
- &iter_dict_val);
- if (!dbret) {
- return ENOMEM;
- }
-
- /* Now add the value */
- dbret = dbus_message_iter_append_basic(&iter_dict_val, type, value);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_close_container(&iter_dict_entry,
- &iter_dict_val);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_close_container(iter_dict,
- &iter_dict_entry);
- if (!dbret) {
- return ENOMEM;
- }
-
- return EOK;
-}
-
-int sbus_add_array_as_variant_to_dict(DBusMessageIter *iter_dict,
- const char *key,
- int type,
- uint8_t *values,
- const int len,
- const unsigned int item_size)
-{
- DBusMessageIter iter_dict_entry;
- DBusMessageIter iter_variant;
- DBusMessageIter iter_array;
- dbus_bool_t dbret;
- char variant_type[] = {DBUS_TYPE_ARRAY, type, '\0'};
- char array_type[] = {type, '\0'};
- void *addr = NULL;
- int i;
-
- dbret = dbus_message_iter_open_container(iter_dict,
- DBUS_TYPE_DICT_ENTRY, NULL,
- &iter_dict_entry);
- if (!dbret) {
- return ENOMEM;
- }
-
- /* Start by appending the key */
- dbret = dbus_message_iter_append_basic(&iter_dict_entry,
- DBUS_TYPE_STRING, &key);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_open_container(&iter_dict_entry,
- DBUS_TYPE_VARIANT,
- variant_type,
- &iter_variant);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_open_container(&iter_variant,
- DBUS_TYPE_ARRAY,
- array_type,
- &iter_array);
- if (!dbret) {
- return ENOMEM;
- }
-
- /* Now add the value */
- for (i = 0; i < len; i++) {
- addr = values + i * item_size;
- dbret = dbus_message_iter_append_basic(&iter_array, type, addr);
- if (!dbret) {
- return ENOMEM;
- }
- }
-
- dbret = dbus_message_iter_close_container(&iter_variant,
- &iter_array);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_close_container(&iter_dict_entry,
- &iter_variant);
- if (!dbret) {
- return ENOMEM;
- }
-
- dbret = dbus_message_iter_close_container(iter_dict,
- &iter_dict_entry);
- if (!dbret) {
- return ENOMEM;
- }
-
- return EOK;
-}
diff --git a/src/sbus/sssd_dbus_request.c b/src/sbus/sssd_dbus_request.c
index 7362f4b79..6a012f1c6 100644
--- a/src/sbus/sssd_dbus_request.c
+++ b/src/sbus/sssd_dbus_request.c
@@ -129,190 +129,6 @@ int sbus_request_return_and_finish(struct sbus_request *dbus_req,
return ret;
}
-int sbus_request_return_as_variant(struct sbus_request *dbus_req,
- int type,
- const void *value)
-{
- DBusMessage *reply;
- dbus_bool_t dbret;
- DBusMessageIter iter;
- DBusMessageIter valiter;
- char strtype[2];
- int ret;
-
- snprintf(strtype, 2, "%c", type);
-
- reply = dbus_message_new_method_return(dbus_req->message);
- if (reply == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory allocating DBus message\n");
- sbus_request_finish(dbus_req, NULL);
- return ENOMEM;
- }
-
- dbus_message_iter_init_append(reply, &iter);
- dbret = dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
- strtype, &valiter);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not open variant for [%s]\n",
- strtype));
- ret = EINVAL;
- goto done;
- }
-
- dbret = dbus_message_iter_append_basic(&valiter, type, value);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not append [%s] to variant\n",
- strtype));
- ret = EINVAL;
- goto done;
- }
-
- dbret = dbus_message_iter_close_container(&iter, &valiter);
- if (dbret) {
- ret = sbus_request_finish(dbus_req, reply);
- } else {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not close variant\n"));
- ret = EINVAL;
- }
-
-done:
- dbus_message_unref(reply);
- return ret;
-}
-
-
-int sbus_request_return_array_as_variant(struct sbus_request *dbus_req,
- int type,
- uint8_t *values,
- const int len,
- const size_t item_size)
-{
- TALLOC_CTX *tmp_ctx = NULL;
- DBusMessage *reply = NULL;
- dbus_bool_t dbret;
- DBusMessageIter iter;
- DBusMessageIter variant_iter;
- DBusMessageIter array_iter;
- char *variant_type = NULL;
- char *array_type = NULL;
- void *addr = NULL;
- int ret;
- int i;
-
- tmp_ctx = talloc_new(NULL);
- if (tmp_ctx == NULL) {
- return ENOMEM;
- }
-
- variant_type = talloc_asprintf(tmp_ctx, DBUS_TYPE_ARRAY_AS_STRING "%c",
- type);
- if (variant_type == NULL) {
- ret = ENOMEM;
- goto done;
- }
-
- array_type = talloc_asprintf(tmp_ctx, "%c", type);
- if (array_type == NULL) {
- ret = ENOMEM;
- goto done;
- }
-
- reply = dbus_message_new_method_return(dbus_req->message);
- if (reply == NULL) {
- DEBUG(SSSDBG_CRIT_FAILURE, "Out of memory allocating DBus message\n");
- sbus_request_finish(dbus_req, NULL);
- ret = ENOMEM;
- goto done;
- }
-
- dbus_message_iter_init_append(reply, &iter);
- dbret = dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
- variant_type, &variant_iter);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not open variant for [%s]\n",
- variant_type));
- ret = EINVAL;
- goto done;
- }
-
- /* Open container for values */
- dbret = dbus_message_iter_open_container(&variant_iter, DBUS_TYPE_ARRAY,
- array_type, &array_iter);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not open array for [%s]\n",
- array_type));
- ret = EINVAL;
- goto done;
- }
-
- for (i = 0; i < len; i++) {
- addr = values + i * item_size;
- dbret = dbus_message_iter_append_basic(&array_iter, type, addr);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not append [%s] to variant\n",
- array_type));
- ret = EINVAL;
- goto done;
- }
- }
-
- dbret = dbus_message_iter_close_container(&variant_iter, &array_iter);
- if (!dbret) {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not close array\n"));
- ret = EINVAL;
- goto done;
- }
-
- dbret = dbus_message_iter_close_container(&iter, &variant_iter);
- if (dbret) {
- ret = sbus_request_finish(dbus_req, reply);
- } else {
- sbus_request_fail_and_finish(
- dbus_req,
- sbus_error_new(dbus_req,
- DBUS_ERROR_FAILED,
- "Could not close variant\n"));
- ret = EINVAL;
- goto done;
- }
-
-done:
- if (reply != NULL) {
- dbus_message_unref(reply);
- }
-
- talloc_free(tmp_ctx);
- return ret;
-}
-
int sbus_request_fail_and_finish(struct sbus_request *dbus_req,
const DBusError *error)
{