libwbclient: Use winbindd_free_response()
authorVolker Lendecke <vl@samba.org>
Sat, 23 Jan 2010 18:38:28 +0000 (19:38 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 24 Jan 2010 13:52:33 +0000 (14:52 +0100)
nsswitch/libwbclient/wbc_pam.c
nsswitch/libwbclient/wbc_pwd.c
nsswitch/libwbclient/wbc_sid.c

index 00863a0d54a85066ccd606adb2fd7a2e2692be20..1f76c0a143f6d0d78dc8c7a1baa4c089d243b464 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
+#include "../winbind_client.h"
 
 /* Authenticate a username/password pair */
 wbcErr wbcAuthenticateUser(const char *username,
@@ -487,8 +488,7 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
        }
 
 done:
-       if (response.extra_data.data)
-               free(response.extra_data.data);
+       winbindd_free_response(&response);
 
        talloc_free(request.extra_data.data);
 
@@ -1107,8 +1107,7 @@ wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
        }
 
 done:
-       if (response.extra_data.data)
-               free(response.extra_data.data);
+       winbindd_free_response(&response);
 
        return wbc_status;
 }
index 897bf1f5c345b01102017ba157092fb892e9d8fe..bae6bf91ead5b88d5f7399cd49a996ead4e22c27 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
+#include "../winbind_client.h"
 
 /** @brief The maximum number of pwent structs to get from winbindd
  *
@@ -261,8 +262,7 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
        BAIL_ON_PTR_ERROR(*grp, wbc_status);
 
  done:
-       if (response.extra_data.data)
-               free(response.extra_data.data);
+       winbindd_free_response(&response);
 
        return wbc_status;
 }
@@ -296,8 +296,7 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
        BAIL_ON_PTR_ERROR(*grp, wbc_status);
 
  done:
-       if (response.extra_data.data)
-               free(response.extra_data.data);
+       winbindd_free_response(&response);
 
        return wbc_status;
 }
@@ -324,9 +323,7 @@ wbcErr wbcSetpwent(void)
 
        if (pw_cache_size > 0) {
                pw_cache_idx = pw_cache_size = 0;
-               if (pw_response.extra_data.data) {
-                       free(pw_response.extra_data.data);
-               }
+               winbindd_free_response(&pw_response);
        }
 
        ZERO_STRUCT(pw_response);
@@ -346,9 +343,7 @@ wbcErr wbcEndpwent(void)
 
        if (pw_cache_size > 0) {
                pw_cache_idx = pw_cache_size = 0;
-               if (pw_response.extra_data.data) {
-                       free(pw_response.extra_data.data);
-               }
+               winbindd_free_response(&pw_response);
        }
 
        wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT,
@@ -375,10 +370,7 @@ wbcErr wbcGetpwent(struct passwd **pwd)
 
        pw_cache_idx = 0;
 
-       if (pw_response.extra_data.data) {
-               free(pw_response.extra_data.data);
-               ZERO_STRUCT(pw_response);
-       }
+       winbindd_free_response(&pw_response);
 
        ZERO_STRUCT(request);
        request.data.num_entries = MAX_GETPWENT_USERS;
@@ -426,9 +418,7 @@ wbcErr wbcSetgrent(void)
 
        if (gr_cache_size > 0) {
                gr_cache_idx = gr_cache_size = 0;
-               if (gr_response.extra_data.data) {
-                       free(gr_response.extra_data.data);
-               }
+               winbindd_free_response(&gr_response);
        }
 
        ZERO_STRUCT(gr_response);
@@ -448,9 +438,7 @@ wbcErr wbcEndgrent(void)
 
        if (gr_cache_size > 0) {
                gr_cache_idx = gr_cache_size = 0;
-               if (gr_response.extra_data.data) {
-                       free(gr_response.extra_data.data);
-               }
+               winbindd_free_response(&gr_response);
        }
 
        wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT,
@@ -478,10 +466,7 @@ wbcErr wbcGetgrent(struct group **grp)
 
        gr_cache_idx = 0;
 
-       if (gr_response.extra_data.data) {
-               free(gr_response.extra_data.data);
-               ZERO_STRUCT(gr_response);
-       }
+       winbindd_free_response(&gr_response);
 
        ZERO_STRUCT(request);
        request.data.num_entries = MAX_GETGRENT_GROUPS;
@@ -527,10 +512,8 @@ wbcErr wbcGetgrlist(struct group **grp)
 
        gr_cache_idx = 0;
 
-       if (gr_response.extra_data.data) {
-               free(gr_response.extra_data.data);
-               ZERO_STRUCT(gr_response);
-       }
+       winbindd_free_response(&gr_response);
+       ZERO_STRUCT(gr_response);
 
        ZERO_STRUCT(request);
        request.data.num_entries = MAX_GETGRENT_GROUPS;
@@ -600,9 +583,7 @@ wbcErr wbcGetGroups(const char *account,
        wbc_status = WBC_ERR_SUCCESS;
 
  done:
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
        if (groups) {
                talloc_free(groups);
        }
index 99c9d8e1521fa9cd7c51fcddf5b8a2d4fd8342bf..7aab04b86f744e2174969446fc89d6939ac94065 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "replace.h"
 #include "libwbclient.h"
-
+#include "../winbind_client.h"
 
 /* Convert a binary SID to a character string */
 wbcErr wbcSidToString(const struct wbcDomainSid *sid,
@@ -396,9 +396,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
        wbc_status = WBC_ERR_SUCCESS;
 
  done:
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
 
        if (WBC_ERROR_IS_OK(wbc_status)) {
                *pp_domain_name = domain_name;
@@ -486,9 +484,7 @@ wbcErr wbcLookupUserSids(const struct wbcDomainSid *user_sid,
        wbc_status = WBC_ERR_SUCCESS;
 
  done:
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
        if (sids) {
                talloc_free(sids);
        }
@@ -624,9 +620,7 @@ wbcErr wbcGetSidAliases(const struct wbcDomainSid *dom_sid,
        if (extra_data) {
                talloc_free(extra_data);
        }
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
        if (rids) {
                talloc_free(rids);
        }
@@ -694,9 +688,7 @@ wbcErr wbcListUsers(const char *domain_name,
        wbc_status = WBC_ERR_SUCCESS;
 
  done:
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
        if (users) {
                talloc_free(users);
        }
@@ -762,9 +754,7 @@ wbcErr wbcListGroups(const char *domain_name,
        wbc_status = WBC_ERR_SUCCESS;
 
  done:
-       if (response.extra_data.data) {
-               free(response.extra_data.data);
-       }
+       winbindd_free_response(&response);
        if (groups) {
                talloc_free(groups);
        }