mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
lib: Remove "struct sid_parse_ret" again
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
e18610a197
commit
d7de2f7748
@ -112,9 +112,7 @@ bool sid_split_rid(struct dom_sid *sid, uint32_t *rid);
|
||||
bool sid_peek_rid(const struct dom_sid *sid, uint32_t *rid);
|
||||
bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid);
|
||||
void sid_copy(struct dom_sid *dst, const struct dom_sid *src);
|
||||
struct sid_parse_ret { ssize_t len; };
|
||||
struct sid_parse_ret sid_parse(
|
||||
const uint8_t *inbuf, size_t len, struct dom_sid *sid);
|
||||
ssize_t sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid);
|
||||
int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2);
|
||||
NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
|
||||
struct dom_sid **sids, uint32_t *num);
|
||||
|
@ -300,8 +300,7 @@ void sid_copy(struct dom_sid *dst, const struct dom_sid *src)
|
||||
Parse a on-the-wire SID to a struct dom_sid.
|
||||
*****************************************************************/
|
||||
|
||||
struct sid_parse_ret sid_parse(
|
||||
const uint8_t *inbuf, size_t len, struct dom_sid *sid)
|
||||
ssize_t sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid)
|
||||
{
|
||||
DATA_BLOB in = data_blob_const(inbuf, len);
|
||||
enum ndr_err_code ndr_err;
|
||||
@ -309,9 +308,9 @@ struct sid_parse_ret sid_parse(
|
||||
ndr_err = ndr_pull_struct_blob_all(
|
||||
&in, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
return (struct sid_parse_ret) { .len = -1 };
|
||||
return -1;
|
||||
}
|
||||
return (struct sid_parse_ret) { .len = ndr_size_dom_sid(sid, 0) };
|
||||
return ndr_size_dom_sid(sid, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -278,7 +278,7 @@ void smbldap_set_bind_callback(struct smbldap_state *state,
|
||||
struct dom_sid *sid)
|
||||
{
|
||||
DATA_BLOB blob;
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
|
||||
if (!smbldap_talloc_single_blob(talloc_tos(), ld, msg, attrib,
|
||||
&blob)) {
|
||||
@ -286,7 +286,7 @@ void smbldap_set_bind_callback(struct smbldap_state *state,
|
||||
}
|
||||
ret = sid_parse(blob.data, blob.length, sid);
|
||||
TALLOC_FREE(blob.data);
|
||||
return (ret.len != -1);
|
||||
return (ret != -1);
|
||||
}
|
||||
|
||||
static int ldapmsg_destructor(LDAPMessage **result) {
|
||||
|
@ -88,13 +88,13 @@ bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute,
|
||||
struct dom_sid *sid)
|
||||
{
|
||||
DATA_BLOB val;
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
|
||||
if (!tldap_get_single_valueblob(msg, attribute, &val)) {
|
||||
return false;
|
||||
}
|
||||
ret = sid_parse(val.data, val.length, sid);
|
||||
return (ret.len != -1);
|
||||
return (ret != -1);
|
||||
}
|
||||
|
||||
bool tldap_pull_guid(struct tldap_message *msg, const char *attribute,
|
||||
|
@ -2264,12 +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;
|
||||
ssize_t ret;
|
||||
struct dom_sid sid;
|
||||
struct dom_sid_buf tmp;
|
||||
ret = sid_parse((const uint8_t *)values[i]->bv_val,
|
||||
values[i]->bv_len, &sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
return;
|
||||
}
|
||||
printf("%s: %s\n", field, dom_sid_str_buf(&sid, &tmp));
|
||||
@ -2797,10 +2797,10 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
|
||||
|
||||
count = 0;
|
||||
for (i=0; values[i]; i++) {
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
ret = sid_parse((const uint8_t *)values[i]->bv_val,
|
||||
values[i]->bv_len, &(*sids)[count]);
|
||||
if (ret.len != -1) {
|
||||
if (ret != -1) {
|
||||
struct dom_sid_buf buf;
|
||||
DBG_DEBUG("pulling SID: %s\n",
|
||||
dom_sid_str_buf(&(*sids)[count], &buf));
|
||||
@ -3358,7 +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;
|
||||
ssize_t ret;
|
||||
fstring buf;
|
||||
size_t buf_len;
|
||||
|
||||
@ -3368,7 +3368,7 @@ ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
ret = sid_parse((const uint8_t *)buf, buf_len, sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
DEBUG(10,("failed to parse sid\n"));
|
||||
return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
@ -1355,7 +1355,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
|
||||
*
|
||||
* but I have to check that --metze
|
||||
*/
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
struct dom_sid sid;
|
||||
struct dom_sid_buf buf;
|
||||
uid_t uid;
|
||||
@ -1375,7 +1375,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
|
||||
/*unknown = IVAL(pdata,0);*/
|
||||
|
||||
ret = sid_parse(_in_data + 4, sid_len, &sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
DEBUGADD(10, ("for SID: %s\n",
|
||||
|
@ -10878,7 +10878,7 @@ static bool run_local_sid_to_string(int dummy) {
|
||||
}
|
||||
|
||||
static bool run_local_binary_to_sid(int dummy) {
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
struct dom_sid *sid = talloc(NULL, struct dom_sid);
|
||||
static const uint8_t good_binary_sid[] = {
|
||||
0x1, /* revision number */
|
||||
@ -10964,15 +10964,15 @@ static bool run_local_binary_to_sid(int dummy) {
|
||||
};
|
||||
|
||||
ret = sid_parse(good_binary_sid, sizeof(good_binary_sid), sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
return false;
|
||||
}
|
||||
ret = sid_parse(long_binary_sid2, sizeof(long_binary_sid2), sid);
|
||||
if (ret.len != -1) {
|
||||
if (ret != -1) {
|
||||
return false;
|
||||
}
|
||||
ret = sid_parse(long_binary_sid, sizeof(long_binary_sid), sid);
|
||||
if (ret.len != -1) {
|
||||
if (ret != -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -342,7 +342,7 @@ uint32_t samdb_result_rid_from_sid(TALLOC_CTX *mem_ctx, const struct ldb_message
|
||||
struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_message *msg,
|
||||
const char *attr)
|
||||
{
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
const struct ldb_val *v;
|
||||
struct dom_sid *sid;
|
||||
v = ldb_msg_find_ldb_val(msg, attr);
|
||||
@ -354,7 +354,7 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa
|
||||
return NULL;
|
||||
}
|
||||
ret = sid_parse(v->data, v->length, sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
talloc_free(sid);
|
||||
return NULL;
|
||||
}
|
||||
@ -5809,7 +5809,7 @@ static int dsdb_count_domain_callback(
|
||||
case LDB_REPLY_ENTRY:
|
||||
{
|
||||
struct dsdb_count_domain_context *context = NULL;
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
bool in_domain;
|
||||
struct dom_sid sid;
|
||||
const struct ldb_val *v;
|
||||
@ -5826,7 +5826,7 @@ static int dsdb_count_domain_callback(
|
||||
}
|
||||
|
||||
ret = sid_parse(v->data, v->length, &sid);
|
||||
if (ret.len == -1) {
|
||||
if (ret == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -303,13 +303,13 @@ static bool test_against_ldap(struct torture_context *torture, struct ldb_contex
|
||||
|
||||
for (i = 0; i < el->num_values; i++) {
|
||||
struct dom_sid *sid = talloc(torture, struct dom_sid);
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
torture_assert(torture, sid != NULL, "talloc failed");
|
||||
|
||||
ret = sid_parse(el->values[i].data,
|
||||
el->values[i].length, sid);
|
||||
torture_assert(torture,
|
||||
ret.len != -1,
|
||||
ret != -1,
|
||||
"sid parse failed");
|
||||
torture_assert_str_equal(torture, dom_sid_string(sid, sid), dom_sid_string(sid, whoami->sid_list[i]), "SID from LDAP and SID from CIFS does not match!");
|
||||
talloc_free(sid);
|
||||
@ -320,13 +320,13 @@ static bool test_against_ldap(struct torture_context *torture, struct ldb_contex
|
||||
struct dom_sid *dom_sid = talloc(torture, struct dom_sid);
|
||||
struct dom_sid *dc_sids = talloc_array(torture, struct dom_sid, el->num_values);
|
||||
struct dom_sid *member_sids = talloc_array(torture, struct dom_sid, whoami->num_sids);
|
||||
struct sid_parse_ret ret;
|
||||
ssize_t ret;
|
||||
torture_assert(torture, user_sid != NULL, "talloc failed");
|
||||
ret = sid_parse(el->values[0].data,
|
||||
el->values[0].length,
|
||||
user_sid);
|
||||
torture_assert(torture,
|
||||
ret.len != -1,
|
||||
ret != -1,
|
||||
"sid parse failed");
|
||||
torture_assert_ntstatus_equal(torture, dom_sid_split_rid(torture, user_sid, &dom_sid, NULL), NT_STATUS_OK, "failed to split domain SID from user SID");
|
||||
for (i = 0; i < el->num_values; i++) {
|
||||
@ -337,7 +337,7 @@ static bool test_against_ldap(struct torture_context *torture, struct ldb_contex
|
||||
el->values[i].length,
|
||||
sid);
|
||||
torture_assert(torture,
|
||||
ret.len != -1,
|
||||
ret != -1,
|
||||
"sid parse failed");
|
||||
if (dom_sid_in_domain(dom_sid, sid)) {
|
||||
dc_sids[num_domain_sids_dc] = *sid;
|
||||
|
Loading…
Reference in New Issue
Block a user