diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-12-21 05:51:29 -0600 |
---|---|---|
committer | Bjoern Jacke <bj@sernet.de> | 2018-12-22 03:11:14 +0100 |
commit | a9b71194fb1842be09841f0f29470f42f2ea97c2 (patch) | |
tree | 335f5d63a9d2f3455d86a8f45d06add31d6e68c6 /nsswitch | |
parent | b9496ddb39e685d1f742c26ba390d26f5a3eabfb (diff) | |
download | samba-a9b71194fb1842be09841f0f29470f42f2ea97c2.tar.gz |
nsswitch/winbind_nss_aix: reimplement fetching the SID of a user
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Bjoern Jacke <bj@sernet.de>
Diffstat (limited to 'nsswitch')
-rw-r--r-- | nsswitch/winbind_nss_aix.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/nsswitch/winbind_nss_aix.c b/nsswitch/winbind_nss_aix.c index 943a1973ef3..459269c496c 100644 --- a/nsswitch/winbind_nss_aix.c +++ b/nsswitch/winbind_nss_aix.c @@ -605,34 +605,39 @@ static attrval_t pwd_to_groupsids(struct passwd *pwd) static attrval_t pwd_to_sid(struct passwd *pwd) { + char buf[(1 /* U/G */ + 10 /* 2^32 */ + 1 /* \n */) + 1] = { 0, }; + int len; struct winbindd_request request; struct winbindd_response response; - attrval_t r; + NSS_STATUS result; + attrval_t r = { + .attr_flag = ENOENT, + }; - ZERO_STRUCT(request); - ZERO_STRUCT(response); + len = snprintf(buf, sizeof(buf), + "U%"PRIu32"\n", + (uint32_t)pwd->pw_uid); + if (len >= sizeof(buf)) { + r = (attrval_t) { + .attr_flag = EINVAL, + }; + return r; + } - request.data.uid = pwd->pw_uid; - -#if 0 - /* - * Removed because WINBINDD_UID_TO_SID is replaced by - * WINBINDD_XIDS_TO_SIDS. I don't have an AIX build - * environment around, so I did not convert this call. If - * someone stumbles over this, please contact me: - * vl@samba.org, I'll convert this. - */ - if (winbindd_request_response(NULL, WINBINDD_UID_TO_SID, - &request, &response) != - NSS_STATUS_SUCCESS) { - r.attr_flag = ENOENT; - } else { + request = (struct winbindd_request) { + .extra_data.data = buf, + .extra_len = strlen(buf)+1, + }; + response = (struct winbindd_response) { + .length = 0, + }; + + result = winbindd_request_response(NULL, WINBINDD_XIDS_TO_SIDS, + &request, &response); + if (result == NSS_STATUS_SUCCESS) { r.attr_flag = 0; r.attr_un.au_char = strdup(response.data.sid.sid); } -#else - r.attr_flag = ENOENT; -#endif return r; } |