Blame SOURCES/0072-PROVIDER-Conversion-empty-string-from-D-Bus-to-NULL.patch

b2d430
From 0edb93b54bf79df41aa34a77e9a173cf8529559a Mon Sep 17 00:00:00 2001
b2d430
From: Petr Cech <pcech@redhat.com>
b2d430
Date: Wed, 27 Jul 2016 11:13:32 +0200
b2d430
Subject: [PATCH 72/74] PROVIDER: Conversion empty string from D-Bus to NULL
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
This patch fixes the issue with empty string recieving from D-Bus.
b2d430
Data providers obtains NULL. So this is simple conversin.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3084
b2d430
b2d430
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
b2d430
---
b2d430
 src/providers/data_provider/dp_target_id.c | 6 +++---
b2d430
 src/providers/ldap/ldap_id_services.c      | 2 +-
b2d430
 2 files changed, 4 insertions(+), 4 deletions(-)
b2d430
b2d430
diff --git a/src/providers/data_provider/dp_target_id.c b/src/providers/data_provider/dp_target_id.c
b2d430
index 7c882be2c17650d818cb3907197e381a8f635a77..1b06cbe5b96f56c33dd048cf6211b7c97819db8c 100644
b2d430
--- a/src/providers/data_provider/dp_target_id.c
b2d430
+++ b/src/providers/data_provider/dp_target_id.c
b2d430
@@ -62,15 +62,15 @@ static bool check_and_parse_filter(struct be_acct_req *data,
b2d430
                  {0, 0, 0}};
b2d430
     int i;
b2d430
 
b2d430
-    if (filter == NULL) {
b2d430
+    if (SBUS_IS_STRING_EMPTY(filter)) {
b2d430
         return false;
b2d430
     }
b2d430
 
b2d430
     for (i = 0; types[i].name != NULL; i++) {
b2d430
         if (strncmp(filter, types[i].name, types[i].lenght) == 0) {
b2d430
             data->filter_type = types[i].type;
b2d430
-            data->filter_value = &filter[types[i].lenght];
b2d430
-            data->extra_value = extra;
b2d430
+            data->filter_value = SBUS_SET_STRING(&filter[types[i].lenght]);
b2d430
+            data->extra_value = SBUS_SET_STRING(extra);
b2d430
             return true;
b2d430
         }
b2d430
     }
b2d430
diff --git a/src/providers/ldap/ldap_id_services.c b/src/providers/ldap/ldap_id_services.c
b2d430
index 77215127b53297d840eaa4d2f35a75eedb085e43..e91fc52d731eaa22be7e98365fc75e7057cb8f1f 100644
b2d430
--- a/src/providers/ldap/ldap_id_services.c
b2d430
+++ b/src/providers/ldap/ldap_id_services.c
b2d430
@@ -114,7 +114,7 @@ services_get_send(TALLOC_CTX *mem_ctx,
b2d430
     ret = sss_filter_sanitize(state, name, &clean_name);
b2d430
     if (ret != EOK)  goto error;
b2d430
 
b2d430
-    if (protocol) {
b2d430
+    if (protocol == NULL) {
b2d430
         ret = sss_filter_sanitize(state, protocol, &clean_protocol);
b2d430
         if (ret != EOK)  goto error;
b2d430
     }
b2d430
-- 
b2d430
2.4.11
b2d430