diff options
author | Volker Lendecke <vl@samba.org> | 2015-08-24 12:33:28 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-08-26 21:41:12 +0200 |
commit | 4a442e2eb7e0b2c62bcc355d461dfd1aaf8c26e8 (patch) | |
tree | 7df0f521ee3a5a4a64538972254aaac64f90743a | |
parent | dba9e631bd1e1c7e00430b72f0c60b32ee4eeb33 (diff) | |
download | samba-4a442e2eb7e0b2c62bcc355d461dfd1aaf8c26e8.tar.gz |
lib: Make sid_parse take a uint8_t
sid_parse takes a binary blob, uint8_t reflects this a bit
better than char * does
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | libcli/security/dom_sid.h | 2 | ||||
-rw-r--r-- | libcli/security/util_sid.c | 2 | ||||
-rw-r--r-- | source3/lib/smbldap.c | 2 | ||||
-rw-r--r-- | source3/lib/tldap_util.c | 2 | ||||
-rw-r--r-- | source3/libads/ldap.c | 8 | ||||
-rw-r--r-- | source3/libsmb/cliquota.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 2 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 5 | ||||
-rw-r--r-- | source3/torture/torture.c | 6 |
9 files changed, 17 insertions, 14 deletions
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h index cf3cedea679..86bbbdf0398 100644 --- a/libcli/security/dom_sid.h +++ b/libcli/security/dom_sid.h @@ -94,7 +94,7 @@ 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); bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid); -bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid); +bool 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); diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c index 7d72d64b7d4..7f628562123 100644 --- a/libcli/security/util_sid.c +++ b/libcli/security/util_sid.c @@ -272,7 +272,7 @@ bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid) Parse a on-the-wire SID to a struct dom_sid. *****************************************************************/ -bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid) +bool sid_parse(const uint8_t *inbuf, size_t len, struct dom_sid *sid) { DATA_BLOB in = data_blob_const(inbuf, len); return sid_blob_parse(in, sid); diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index f2d58a54d19..75116d2cb64 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -237,7 +237,7 @@ &blob)) { return false; } - ret = sid_parse((char *)blob.data, blob.length, sid); + ret = sid_parse(blob.data, blob.length, sid); TALLOC_FREE(blob.data); return ret; } diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 45bf19f50d1..de1d4baf6b4 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -93,7 +93,7 @@ bool tldap_pull_binsid(struct tldap_message *msg, const char *attribute, if (!tldap_get_single_valueblob(msg, attribute, &val)) { return false; } - return sid_parse((char *)val.data, val.length, sid); + return sid_parse(val.data, val.length, sid); } bool tldap_pull_guid(struct tldap_message *msg, const char *attribute, diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 87631641ff1..e8ccfa9c3d4 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2361,7 +2361,8 @@ static void dump_sid(ADS_STRUCT *ads, const char *field, struct berval **values) for (i=0; values[i]; i++) { struct dom_sid sid; fstring tmp; - if (!sid_parse(values[i]->bv_val, values[i]->bv_len, &sid)) { + if (!sid_parse((const uint8_t *)values[i]->bv_val, + values[i]->bv_len, &sid)) { return; } printf("%s: %s\n", field, sid_to_fstring(tmp, &sid)); @@ -2891,7 +2892,8 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) count = 0; for (i=0; values[i]; i++) { - ret = sid_parse(values[i]->bv_val, values[i]->bv_len, &(*sids)[count]); + ret = sid_parse((const uint8_t *)values[i]->bv_val, + values[i]->bv_len, &(*sids)[count]); if (ret) { DEBUG(10, ("pulling SID: %s\n", sid_string_dbg(&(*sids)[count]))); @@ -3456,7 +3458,7 @@ ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx, return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER); } - if (!sid_parse(buf, buf_len, sid)) { + if (!sid_parse((const uint8_t *)buf, buf_len, sid)) { DEBUG(10,("failed to parse sid\n")); return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER); } diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index 21dc72e35c9..bbf16ba8363 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -89,7 +89,7 @@ static bool parse_user_quota_record(const uint8_t *rdata, /* the hard quotas 8 bytes (uint64_t)*/ qt.hardlim = BVAL(rdata,32); - if (!sid_parse((const char *)rdata+40,sid_len,&qt.sid)) { + if (!sid_parse(rdata+40,sid_len,&qt.sid)) { return false; } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index ac1052edb30..460837cc999 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1281,7 +1281,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle, /* unknown 4 bytes: this is not the length of the sid :-( */ /*unknown = IVAL(pdata,0);*/ - if (!sid_parse(in_data + 4, sid_len, &sid)) { + if (!sid_parse(_in_data + 4, sid_len, &sid)) { return NT_STATUS_INVALID_PARAMETER; } DEBUGADD(10, ("for SID: %s\n", sid_string_dbg(&sid))); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 04dddee5c3d..cd7454a1b56 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2433,7 +2433,8 @@ static void call_nt_transact_get_user_quota(connection_struct *conn, break; } - if (!sid_parse(pdata+8,sid_len,&sid)) { + if (!sid_parse((const uint8_t *)(pdata+8), sid_len, + &sid)) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); return; } @@ -2586,7 +2587,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn, /* the hard quotas 8 bytes (uint64_t)*/ qt.hardlim = BVAL(pdata,32); - if (!sid_parse(pdata+40,sid_len,&sid)) { + if (!sid_parse((const uint8_t *)(pdata+40), sid_len, &sid)) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); return; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index e0be44e8e56..914caf8e7dd 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8563,7 +8563,7 @@ static bool run_local_sid_to_string(int dummy) { static bool run_local_binary_to_sid(int dummy) { struct dom_sid *sid = talloc(NULL, struct dom_sid); - static const char good_binary_sid[] = { + static const uint8_t good_binary_sid[] = { 0x1, /* revision number */ 15, /* num auths */ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ @@ -8584,7 +8584,7 @@ static bool run_local_binary_to_sid(int dummy) { 0x1, 0x1, 0x1, 0x1, /* auth[14] */ }; - static const char long_binary_sid[] = { + static const uint8_t long_binary_sid[] = { 0x1, /* revision number */ 15, /* num auths */ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ @@ -8608,7 +8608,7 @@ static bool run_local_binary_to_sid(int dummy) { 0x1, 0x1, 0x1, 0x1, /* auth[17] */ }; - static const char long_binary_sid2[] = { + static const uint8_t long_binary_sid2[] = { 0x1, /* revision number */ 32, /* num auths */ 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ |