diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-09-04 14:13:31 +1000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-09-14 14:48:49 -0700 |
commit | 15abd86d54c582edfec29dfd55c256b6565da569 (patch) | |
tree | a309893b5a828b153ed531b8082f7f208f4bce98 /source3/torture | |
parent | 1892df6ca803aed94e91cbd7a12ca1b8470dfc89 (diff) | |
download | samba-15abd86d54c582edfec29dfd55c256b6565da569.tar.gz samba-15abd86d54c582edfec29dfd55c256b6565da569.tar.bz2 samba-15abd86d54c582edfec29dfd55c256b6565da569.zip |
s3-torture Add tests to show that the dom_sid parsing was faulty.
Andrew Bartlett
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 806455ff18..06ed264deb 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -6859,6 +6859,103 @@ static bool run_local_string_to_sid(int dummy) { return true; } +static bool run_local_binary_to_sid(int dummy) { + struct dom_sid *sid = talloc(NULL, struct dom_sid); + static const char good_binary_sid[] = { + 0x1, /* revision number */ + 15, /* num auths */ + 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ + 0x1, 0x1, 0x1, 0x1, /* auth[0] */ + 0x1, 0x1, 0x1, 0x1, /* auth[1] */ + 0x1, 0x1, 0x1, 0x1, /* auth[2] */ + 0x1, 0x1, 0x1, 0x1, /* auth[3] */ + 0x1, 0x1, 0x1, 0x1, /* auth[4] */ + 0x1, 0x1, 0x1, 0x1, /* auth[5] */ + 0x1, 0x1, 0x1, 0x1, /* auth[6] */ + 0x1, 0x1, 0x1, 0x1, /* auth[7] */ + 0x1, 0x1, 0x1, 0x1, /* auth[8] */ + 0x1, 0x1, 0x1, 0x1, /* auth[9] */ + 0x1, 0x1, 0x1, 0x1, /* auth[10] */ + 0x1, 0x1, 0x1, 0x1, /* auth[11] */ + 0x1, 0x1, 0x1, 0x1, /* auth[12] */ + 0x1, 0x1, 0x1, 0x1, /* auth[13] */ + 0x1, 0x1, 0x1, 0x1, /* auth[14] */ + }; + + static const char long_binary_sid[] = { + 0x1, /* revision number */ + 15, /* num auths */ + 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ + 0x1, 0x1, 0x1, 0x1, /* auth[0] */ + 0x1, 0x1, 0x1, 0x1, /* auth[1] */ + 0x1, 0x1, 0x1, 0x1, /* auth[2] */ + 0x1, 0x1, 0x1, 0x1, /* auth[3] */ + 0x1, 0x1, 0x1, 0x1, /* auth[4] */ + 0x1, 0x1, 0x1, 0x1, /* auth[5] */ + 0x1, 0x1, 0x1, 0x1, /* auth[6] */ + 0x1, 0x1, 0x1, 0x1, /* auth[7] */ + 0x1, 0x1, 0x1, 0x1, /* auth[8] */ + 0x1, 0x1, 0x1, 0x1, /* auth[9] */ + 0x1, 0x1, 0x1, 0x1, /* auth[10] */ + 0x1, 0x1, 0x1, 0x1, /* auth[11] */ + 0x1, 0x1, 0x1, 0x1, /* auth[12] */ + 0x1, 0x1, 0x1, 0x1, /* auth[13] */ + 0x1, 0x1, 0x1, 0x1, /* auth[14] */ + 0x1, 0x1, 0x1, 0x1, /* auth[15] */ + 0x1, 0x1, 0x1, 0x1, /* auth[16] */ + 0x1, 0x1, 0x1, 0x1, /* auth[17] */ + }; + + static const char long_binary_sid2[] = { + 0x1, /* revision number */ + 32, /* num auths */ + 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, /* id_auth */ + 0x1, 0x1, 0x1, 0x1, /* auth[0] */ + 0x1, 0x1, 0x1, 0x1, /* auth[1] */ + 0x1, 0x1, 0x1, 0x1, /* auth[2] */ + 0x1, 0x1, 0x1, 0x1, /* auth[3] */ + 0x1, 0x1, 0x1, 0x1, /* auth[4] */ + 0x1, 0x1, 0x1, 0x1, /* auth[5] */ + 0x1, 0x1, 0x1, 0x1, /* auth[6] */ + 0x1, 0x1, 0x1, 0x1, /* auth[7] */ + 0x1, 0x1, 0x1, 0x1, /* auth[8] */ + 0x1, 0x1, 0x1, 0x1, /* auth[9] */ + 0x1, 0x1, 0x1, 0x1, /* auth[10] */ + 0x1, 0x1, 0x1, 0x1, /* auth[11] */ + 0x1, 0x1, 0x1, 0x1, /* auth[12] */ + 0x1, 0x1, 0x1, 0x1, /* auth[13] */ + 0x1, 0x1, 0x1, 0x1, /* auth[14] */ + 0x1, 0x1, 0x1, 0x1, /* auth[15] */ + 0x1, 0x1, 0x1, 0x1, /* auth[16] */ + 0x1, 0x1, 0x1, 0x1, /* auth[17] */ + 0x1, 0x1, 0x1, 0x1, /* auth[18] */ + 0x1, 0x1, 0x1, 0x1, /* auth[19] */ + 0x1, 0x1, 0x1, 0x1, /* auth[20] */ + 0x1, 0x1, 0x1, 0x1, /* auth[21] */ + 0x1, 0x1, 0x1, 0x1, /* auth[22] */ + 0x1, 0x1, 0x1, 0x1, /* auth[23] */ + 0x1, 0x1, 0x1, 0x1, /* auth[24] */ + 0x1, 0x1, 0x1, 0x1, /* auth[25] */ + 0x1, 0x1, 0x1, 0x1, /* auth[26] */ + 0x1, 0x1, 0x1, 0x1, /* auth[27] */ + 0x1, 0x1, 0x1, 0x1, /* auth[28] */ + 0x1, 0x1, 0x1, 0x1, /* auth[29] */ + 0x1, 0x1, 0x1, 0x1, /* auth[30] */ + 0x1, 0x1, 0x1, 0x1, /* auth[31] */ + }; + + if (!sid_parse(good_binary_sid, sizeof(good_binary_sid), sid)) { + return false; + } + if (sid_parse(long_binary_sid2, sizeof(long_binary_sid2), sid)) { + return false; + } + if (sid_parse(long_binary_sid, sizeof(long_binary_sid), sid)) { + return false; + } + return true; +} + /* Split a path name into filename and stream name components. Canonicalise * such that an implicit $DATA token is always explicit. * @@ -7591,6 +7688,7 @@ static struct { { "LOCAL-STREAM-NAME", run_local_stream_name, 0}, { "LOCAL-WBCLIENT", run_local_wbclient, 0}, { "LOCAL-string_to_sid", run_local_string_to_sid, 0}, + { "LOCAL-binary_to_sid", run_local_binary_to_sid, 0}, { "LOCAL-DBTRANS", run_local_dbtrans, 0}, { "LOCAL-TEVENT-SELECT", run_local_tevent_select, 0}, {NULL, NULL, 0}}; |