diff options
author | Volker Lendecke <vl@samba.org> | 2019-03-11 16:55:57 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-03-12 00:42:19 +0000 |
commit | e18610a197aab80a32cae8c1e09b96496679bbad (patch) | |
tree | 2868943bc213731d1c8c6ff4afbb1120bf35873d /source3/libads | |
parent | a27c39c2c9fd3161f5bf3ae5dba687c8d49519ef (diff) | |
download | samba-e18610a197aab80a32cae8c1e09b96496679bbad.tar.gz |
lib: Make sid_parse return the parsed length
Use a temporary struct as a return value to make the compiler catch all
callers. If we just changed bool->ssize_t, this would just generate a
warning. struct sid_parse_ret will go away in the next commit
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ldap.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 728c821f32d..8e0ecb87569 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2264,10 +2264,12 @@ static void dump_sid(ADS_STRUCT *ads, const char *field, struct berval **values) { int i; for (i=0; values[i]; i++) { + struct sid_parse_ret ret; struct dom_sid sid; struct dom_sid_buf tmp; - if (!sid_parse((const uint8_t *)values[i]->bv_val, - values[i]->bv_len, &sid)) { + ret = sid_parse((const uint8_t *)values[i]->bv_val, + values[i]->bv_len, &sid); + if (ret.len == -1) { return; } printf("%s: %s\n", field, dom_sid_str_buf(&sid, &tmp)); @@ -2773,7 +2775,6 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) LDAPMessage *msg, const char *field, struct dom_sid **sids) { struct berval **values; - bool ret; int count, i; values = ldap_get_values_len(ads->ldap.ld, msg, field); @@ -2796,9 +2797,10 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) count = 0; for (i=0; values[i]; i++) { + struct sid_parse_ret ret; ret = sid_parse((const uint8_t *)values[i]->bv_val, values[i]->bv_len, &(*sids)[count]); - if (ret) { + if (ret.len != -1) { struct dom_sid_buf buf; DBG_DEBUG("pulling SID: %s\n", dom_sid_str_buf(&(*sids)[count], &buf)); @@ -3356,6 +3358,7 @@ ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx, } break; case ADS_EXTENDED_DN_HEX_STRING: { + struct sid_parse_ret ret; fstring buf; size_t buf_len; @@ -3364,7 +3367,8 @@ ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx, return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER); } - if (!sid_parse((const uint8_t *)buf, buf_len, sid)) { + ret = sid_parse((const uint8_t *)buf, buf_len, sid); + if (ret.len == -1) { DEBUG(10,("failed to parse sid\n")); return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER); } |