resend
----- Forwarded message from Sumit Bose <sb...@redhat.com> -----

Date: Wed, 6 Jul 2016 11:13:48 +0200
From: Sumit Bose <sb...@redhat.com>
To: sssd-devel@lists.fedorahosted.org
Subject: Re: [SSSD] [PATCH] LDAP: Lookup services by all protocols unless a
        protocol is specified
Message-ID: <20160706091348.GD29143@p.Speedport_W_724V_Typ_A_05011603_00_009>
References: <20160705103025.GB24232@hendrix>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20160705103025.GB24232@hendrix>
User-Agent: Mutt/1.6.1 (2016-04-27)

On Tue, Jul 05, 2016 at 12:30:25PM +0200, Jakub Hrozek wrote:
> Hi,
> 
> the attached patch makes service lookups great again.
> 
> To reproduce, just run:
>     getent service -s sss ldap
> before the patch we would look up ipService="" because DP gives us an
> empty string after the recent DP patches.

> From ba9834637b3cc0d7d98f704ba70f9dcb6f9a70e9 Mon Sep 17 00:00:00 2001
> From: Jakub Hrozek <jhro...@redhat.com>
> Date: Tue, 5 Jul 2016 12:23:23 +0200
> Subject: [PATCH] LDAP: Lookup services by all protocols unless a protocol is
>  specified
> 
> The DP refactoring changed the way we handle strings from sbus. We no
> longer receive NULL strings, but empty strings instead.
> ---
>  src/providers/ldap/ldap_id_services.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/providers/ldap/ldap_id_services.c 
> b/src/providers/ldap/ldap_id_services.c
> index 
> 77215127b53297d840eaa4d2f35a75eedb085e43..db47e3fc55eea969371d61c3c5ac7f818196f3d5
>  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 && protocol[0] != '\0') {
>          ret = sss_filter_sanitize(state, protocol, &clean_protocol);
>          if (ret != EOK)  goto error;
>      }

since the sysdb calls later on in the request expect protocol==NULL as
well I would suggest something like 

     state->sysdb = sdom->dom->sysdb;
     state->name = name;
     state->protocol = protocol;
+    if (state->protocol[0] == '\0') {
+        state->protocol = NULL;
+    }
     state->filter_type = filter_type;
     state->noexist_delete = noexist_delete;


in only use state->protocol in the request.

bye,
Sumit
> -- 
> 2.4.11
> 

> _______________________________________________
> sssd-devel mailing list
> sssd-devel@lists.fedorahosted.org
> https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org


----- End forwarded message -----
_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to