Fix const warning.
authorJeremy Allison <jra@samba.org>
Fri, 21 Dec 2007 20:18:17 +0000 (12:18 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 21 Dec 2007 20:18:17 +0000 (12:18 -0800)
Jeremy.
(This used to be commit 5159f897ddaad1878fff629cc074dd71b2b3f4ab)

source3/nsswitch/libwbclient/wbc_sid.c

index 5e7cb9a61be6a6f74df0bff82b53873b4ea856a4..c877e1d9d4df1359b7e762428ea143cf3b167195 100644 (file)
@@ -298,7 +298,7 @@ wbcErr wbcLookupSid(const struct wbcDomainSid *sid,
 wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
                     int num_rids,
                     uint32_t *rids,
 wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
                     int num_rids,
                     uint32_t *rids,
-                    const char **domain_name,
+                    const char **pp_domain_name,
                     const char ***names,
                     enum wbcSidType **types)
 {
                     const char ***names,
                     enum wbcSidType **types)
 {
@@ -308,6 +308,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
        struct winbindd_request request;
        struct winbindd_response response;
        char *sid_string = NULL;
        struct winbindd_request request;
        struct winbindd_response response;
        char *sid_string = NULL;
+       char *domain_name = NULL;
        wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 
        if (!dom_sid || (num_rids == 0)) {
        wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 
        if (!dom_sid || (num_rids == 0)) {
@@ -357,8 +358,8 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
                                        &response);
        free(ridlist);
 
                                        &response);
        free(ridlist);
 
-       *domain_name = strdup(response.data.domain_name);
-       BAIL_ON_PTR_ERROR((*domain_name), wbc_status);
+       domain_name = strdup(response.data.domain_name);
+       BAIL_ON_PTR_ERROR(domain_name, wbc_status);
 
        *names = (const char**)malloc(sizeof(char*) * num_rids);
        BAIL_ON_PTR_ERROR((*names), wbc_status);
 
        *names = (const char**)malloc(sizeof(char*) * num_rids);
        BAIL_ON_PTR_ERROR((*names), wbc_status);
@@ -408,12 +409,14 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
 
  done:
        if (!WBC_ERROR_IS_OK(wbc_status)) {
 
  done:
        if (!WBC_ERROR_IS_OK(wbc_status)) {
-               if (*domain_name)
-                       free(*domain_name);
+               if (domain_name)
+                       free(domain_name);
                if (*names)
                        free(*names);
                if (*types)
                        free(*types);
                if (*names)
                        free(*names);
                if (*types)
                        free(*types);
+       } else {
+               *pp_domain_name = domain_name;
        }
 
        return wbc_status;
        }
 
        return wbc_status;