diff options
author | Volker Lendecke <vl@samba.org> | 2011-03-04 05:49:20 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2011-03-05 14:29:32 +0100 |
commit | e0fae3d49483c33329628534591f966d4841e474 (patch) | |
tree | 762b46399cea554ebf9ec5857d96e156d34a5871 | |
parent | 7ffa7e4bcae0c4e55c91a7a4466eae596d982770 (diff) | |
download | samba-e0fae3d49483c33329628534591f966d4841e474.tar.gz samba-e0fae3d49483c33329628534591f966d4841e474.tar.bz2 samba-e0fae3d49483c33329628534591f966d4841e474.zip |
pam_winbind: Use wbcSidToStringBuf
-rw-r--r-- | nsswitch/pam_winbind.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index e640b711bd..7005c25fae 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -1077,12 +1077,11 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx, char *sid_list_buffer, int sid_list_buffer_size) { - const char* sid_string = NULL; - char *sid_str = NULL; + char sid_string[WBC_SID_STRING_BUFLEN]; /* lookup name? */ if (IS_SID_STRING(name)) { - sid_string = name; + strlcpy(sid_string, name, sizeof(sid_string)); } else { wbcErr wbc_status; struct wbcDomainSid sid; @@ -1098,21 +1097,13 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx, return false; } - wbc_status = wbcSidToString(&sid, &sid_str); - if (!WBC_ERROR_IS_OK(wbc_status)) { - return false; - } - - sid_string = sid_str; + wbcSidToStringBuf(&sid, sid_string, sizeof(sid_string)); } if (!safe_append_string(sid_list_buffer, sid_string, sid_list_buffer_size)) { - wbcFreeMemory(sid_str); return false; } - - wbcFreeMemory(sid_str); return true; } |