>From 8716489b7bf849873b36f061f4e70f3b6e3c8e85 Mon Sep 17 00:00:00 2001
From: Pavel Reichl <preichl@redhat.com>
Date: Tue, 28 Jan 2014 17:19:07 +0000
Subject: [PATCH] refactor calls of sss_parse_name

sss_parse_name now supports NULL as output parameters so existing calls passing
arguments which were never read were substituted by NULL.
---
 src/providers/krb5/krb5_common.c | 3 +--
 src/providers/ldap/sdap_access.c | 3 +--
 src/responder/nss/nsssrv_cmd.c   | 3 +--
 src/util/domain_info_utils.c     | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c
index d1d26ee711db992e30d0d107c8c2fbcc41327368..01dac6d979cc110cda1717e8d7944ee8b27a0c81 100644
--- a/src/providers/krb5/krb5_common.c
+++ b/src/providers/krb5/krb5_common.c
@@ -988,7 +988,6 @@ errno_t krb5_get_simple_upn(TALLOC_CTX *mem_ctx, struct krb5_ctx *krb5_ctx,
     char *uc_dom = NULL;
     char *upn;
     char *name;
-    char *domname;
     TALLOC_CTX *tmp_ctx = NULL;
     errno_t ret;
 
@@ -1018,7 +1017,7 @@ errno_t krb5_get_simple_upn(TALLOC_CTX *mem_ctx, struct krb5_ctx *krb5_ctx,
     /* Subdomains already have a fully qualified name, which contains
      * the domain name. We need to replace it with the realm name
      */
-    ret = sss_parse_name(tmp_ctx, dom->names, username, &domname, &name);
+    ret = sss_parse_name(tmp_ctx, dom->names, username, NULL, &name);
     if (ret != EOK) {
         DEBUG(SSSDBG_OP_FAILURE,
               ("Could not parse [%s] into name and "
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index e361cc33e37be8c9e7e63f780d01ae1109729237..c8c45825f3b538bdc45ee01f1104fefb29012761 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -644,7 +644,6 @@ static struct tevent_req *sdap_access_filter_send(TALLOC_CTX *mem_ctx,
     char *clean_username;
     errno_t ret = ERR_INTERNAL;
     char *name;
-    char *domname;
 
     req = tevent_req_create(mem_ctx, &state, struct sdap_access_filter_req_ctx);
     if (req == NULL) {
@@ -696,7 +695,7 @@ static struct tevent_req *sdap_access_filter_send(TALLOC_CTX *mem_ctx,
 
     /* Construct the filter */
     /* Subdomain users are identified by FQDN. We need to use just the username */
-    ret = sss_parse_name(state, domain->names, username, &domname, &name);
+    ret = sss_parse_name(state, domain->names, username, NULL, &name);
     if (ret != EOK) {
         DEBUG(SSSDBG_OP_FAILURE,
               ("Could not parse [%s] into name and "
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 2e2d7c86adf6d6444652435f888748385c64acf2..b3a260a08fda2f226f5729142ffcdf37c6ce26ae 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -177,13 +177,12 @@ static const char *get_homedir_override(TALLOC_CTX *mem_ctx,
 {
     const char *homedir;
     char *name;
-    char *domname;
     errno_t ret;
 
     homedir = ldb_msg_find_attr_as_string(msg, SYSDB_HOMEDIR, NULL);
 
     /* Subdomain users store FQDN in their name attribute */
-    ret = sss_parse_name(mem_ctx, dom->names, orig_name, &domname, &name);
+    ret = sss_parse_name(mem_ctx, dom->names, orig_name, NULL, &name);
     if (ret != EOK) {
         DEBUG(SSSDBG_MINOR_FAILURE, ("Could not parse [%s] into "
               "name-value components.\n", orig_name));
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
index 50b5f06f560a9856297be726e221cfa771ba6adc..4e6728908d2281255cbec9f6f212ff62cce0d2c5 100644
--- a/src/util/domain_info_utils.c
+++ b/src/util/domain_info_utils.c
@@ -160,7 +160,6 @@ find_subdomain_by_object_name(struct sss_domain_info *domain,
     TALLOC_CTX *tmp_ctx;
     struct sss_domain_info *dom = NULL;
     char *domainname = NULL;
-    char *name = NULL;
     errno_t ret;
 
     tmp_ctx = talloc_new(NULL);
@@ -170,7 +169,7 @@ find_subdomain_by_object_name(struct sss_domain_info *domain,
     }
 
     ret = sss_parse_name(tmp_ctx, domain->names, object_name,
-                         &domainname, &name);
+                         &domainname, NULL);
     if (ret != EOK) {
         DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to parse name '%s' [%d]: %s\n",
                                     object_name, ret, sss_strerror(ret)));
-- 
1.8.4.2

