diff options
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/libwbclient/wbc_pam.c | 7 | ||||
-rw-r--r-- | nsswitch/libwbclient/wbc_pwd.c | 43 | ||||
-rw-r--r-- | nsswitch/libwbclient/wbc_sid.c | 22 |
3 files changed, 21 insertions, 51 deletions
diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c index 00863a0d54..1f76c0a143 100644 --- a/nsswitch/libwbclient/wbc_pam.c +++ b/nsswitch/libwbclient/wbc_pam.c @@ -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; } diff --git a/nsswitch/libwbclient/wbc_pwd.c b/nsswitch/libwbclient/wbc_pwd.c index 897bf1f5c3..bae6bf91ea 100644 --- a/nsswitch/libwbclient/wbc_pwd.c +++ b/nsswitch/libwbclient/wbc_pwd.c @@ -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); } diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c index 99c9d8e152..7aab04b86f 100644 --- a/nsswitch/libwbclient/wbc_sid.c +++ b/nsswitch/libwbclient/wbc_sid.c @@ -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); } |