Blob Blame History Raw
From 0edb93b54bf79df41aa34a77e9a173cf8529559a Mon Sep 17 00:00:00 2001
From: Petr Cech <pcech@redhat.com>
Date: Wed, 27 Jul 2016 11:13:32 +0200
Subject: [PATCH 72/74] PROVIDER: Conversion empty string from D-Bus to NULL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch fixes the issue with empty string recieving from D-Bus.
Data providers obtains NULL. So this is simple conversin.

Resolves:
https://fedorahosted.org/sssd/ticket/3084

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
 src/providers/data_provider/dp_target_id.c | 6 +++---
 src/providers/ldap/ldap_id_services.c      | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/providers/data_provider/dp_target_id.c b/src/providers/data_provider/dp_target_id.c
index 7c882be2c17650d818cb3907197e381a8f635a77..1b06cbe5b96f56c33dd048cf6211b7c97819db8c 100644
--- a/src/providers/data_provider/dp_target_id.c
+++ b/src/providers/data_provider/dp_target_id.c
@@ -62,15 +62,15 @@ static bool check_and_parse_filter(struct be_acct_req *data,
                  {0, 0, 0}};
     int i;
 
-    if (filter == NULL) {
+    if (SBUS_IS_STRING_EMPTY(filter)) {
         return false;
     }
 
     for (i = 0; types[i].name != NULL; i++) {
         if (strncmp(filter, types[i].name, types[i].lenght) == 0) {
             data->filter_type = types[i].type;
-            data->filter_value = &filter[types[i].lenght];
-            data->extra_value = extra;
+            data->filter_value = SBUS_SET_STRING(&filter[types[i].lenght]);
+            data->extra_value = SBUS_SET_STRING(extra);
             return true;
         }
     }
diff --git a/src/providers/ldap/ldap_id_services.c b/src/providers/ldap/ldap_id_services.c
index 77215127b53297d840eaa4d2f35a75eedb085e43..e91fc52d731eaa22be7e98365fc75e7057cb8f1f 100644
--- a/src/providers/ldap/ldap_id_services.c
+++ b/src/providers/ldap/ldap_id_services.c
@@ -114,7 +114,7 @@ services_get_send(TALLOC_CTX *mem_ctx,
     ret = sss_filter_sanitize(state, name, &clean_name);
     if (ret != EOK)  goto error;
 
-    if (protocol) {
+    if (protocol == NULL) {
         ret = sss_filter_sanitize(state, protocol, &clean_protocol);
         if (ret != EOK)  goto error;
     }
-- 
2.4.11