]> git.samba.org - obnox/samba/samba-obnox.git/commitdiff
lib: Make sid_parse take a uint8_t
authorVolker Lendecke <vl@samba.org>
Mon, 24 Aug 2015 10:33:28 +0000 (12:33 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 26 Aug 2015 19:41:12 +0000 (21:41 +0200)
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>
libcli/security/dom_sid.h
libcli/security/util_sid.c
source3/lib/smbldap.c
source3/lib/tldap_util.c
source3/libads/ldap.c
source3/libsmb/cliquota.c
source3/modules/vfs_default.c
source3/smbd/nttrans.c
source3/torture/torture.c

index cf3cedea67953bd443f6d6dc0cb9e5e1bb33c5ef..86bbbdf0398aee725c10e34bb765f746598e50d7 100644 (file)
@@ -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);
index 7d72d64b7d41e822b177f016348104aa87469d7f..7f628562123a4b0e49966b28c5dbcd0e01b62055 100644 (file)
@@ -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);
index f2d58a54d19a8f38d154af3451dee3b665437492..75116d2cb647a26e3773707aa62c4e4122fcde91 100644 (file)
                                        &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;
 }
index 45bf19f50d13a34a13e1337c58483640a25de97d..de1d4baf6b47df9d8470a1fb0fde7bbe6dc972da 100644 (file)
@@ -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,
index 87631641ff1953e5194d30ce0ff10cddd0a18f44..e8ccfa9c3d4c0826f3bec33cb7b9cb662e52589c 100644 (file)
@@ -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);
                }
index 21dc72e35c9874745c7e608dd6aebfaaa5bd2480..bbf16ba83634059c79d0957bfe69cb362c3204a9 100644 (file)
@@ -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;
        }
 
index ac1052edb3077b7a42b479c142729208809d03d6..460837cc999bd6cf87ff559ea97c4d3c06f1f3f1 100644 (file)
@@ -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)));
index 04dddee5c3db66f9a4c2cf01ab6d978a89ed0330..cd7454a1b566420ec841ce88da8389585e1ecffb 100644 (file)
@@ -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;
        }
index e0be44e8e56b4782488ecf580b1f5c4d9fc190a0..914caf8e7ddde005a5d72f3595afa434c7304ffd 100644 (file)
@@ -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 */