diff options
author | Volker Lendecke <vl@samba.org> | 2013-11-21 16:16:33 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2013-11-26 22:53:04 +0100 |
commit | ebc157961aa910d84b31e9f7a1b4c99267294999 (patch) | |
tree | d21921390de8961e38e67371bdf74ba910087bde | |
parent | 6b6920b02905661ae661a894e3bd8d2c744d7003 (diff) | |
download | samba-ebc157961aa910d84b31e9f7a1b4c99267294999.tar.gz |
torture3: Reproducer for bug 10284
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Nov 26 22:53:04 CET 2013 on sn-devel-104
-rwxr-xr-x | source3/selftest/tests.py | 1 | ||||
-rw-r--r-- | source3/torture/proto.h | 1 | ||||
-rw-r--r-- | source3/torture/test_msg.c | 86 | ||||
-rw-r--r-- | source3/torture/torture.c | 1 |
4 files changed, 89 insertions, 0 deletions
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index baa0f2fd82c..df88f9dfb97 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -64,6 +64,7 @@ tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7" "CLEANUP1", "CLEANUP2", "CLEANUP4", + "LOCAL-MSG2", "BAD-NBT-SESSION"] for t in tests: diff --git a/source3/torture/proto.h b/source3/torture/proto.h index d430aef5d89..b7eacdf047f 100644 --- a/source3/torture/proto.h +++ b/source3/torture/proto.h @@ -107,6 +107,7 @@ bool run_cleanup3(int dummy); bool run_cleanup4(int dummy); bool run_ctdb_conn(int dummy); bool run_msg_test(int dummy); +bool run_msg_test2(int dummy); bool run_notify_bench2(int dummy); bool run_notify_bench3(int dummy); bool run_dbwrap_watch1(int dummy); diff --git a/source3/torture/test_msg.c b/source3/torture/test_msg.c index 2171598ab8f..d57379ddf09 100644 --- a/source3/torture/test_msg.c +++ b/source3/torture/test_msg.c @@ -129,3 +129,89 @@ bool run_msg_test(int dummy) TALLOC_FREE(ev); return (ret == 0); } + +/* + * Reproducer for bug 10284 + */ + +static void msg_callback(struct tevent_req *subreq); + +struct msg_test2_state { + struct tevent_context *ev; + struct messaging_context *msg; + struct msg_channel *channel; + struct messaging_rec *rec; + struct tevent_req *req; +}; + +bool run_msg_test2(int dummy) +{ + struct msg_test2_state s; + NTSTATUS status; + int i, ret; + + s.ev = samba_tevent_context_init(talloc_tos()); + if (s.ev == NULL) { + fprintf(stderr, "tevent_context_init failed\n"); + return false; + } + + s.msg = messaging_init(s.ev, s.ev); + if (s.msg == NULL) { + fprintf(stderr, "messaging_init failed\n"); + return false; + } + + ret = msg_channel_init(s.ev, s.msg, MSG_PING, &s.channel); + if (ret != 0) { + fprintf(stderr, "msg_channel_init returned %s\n", + strerror(ret)); + return false; + } + + status = messaging_send(s.msg, messaging_server_id(s.msg), MSG_PING, + &data_blob_null); + if (!NT_STATUS_IS_OK(status)) { + fprintf(stderr, "messaging_send returned %s\n", + nt_errstr(status)); + return false; + } + + ret = tevent_loop_once(s.ev); + if (ret == -1) { + fprintf(stderr, "tevent_loop_once failed: %s\n", + strerror(errno)); + return false; + } + + s.req = msg_read_send(s.ev, s.ev, s.channel); + if (s.req == NULL) { + fprintf(stderr, "msg_read_send failed\n"); + return false; + } + tevent_req_set_callback(s.req, msg_callback, &s); + + status = messaging_send(s.msg, messaging_server_id(s.msg), MSG_PING, + &data_blob_null); + if (!NT_STATUS_IS_OK(status)) { + fprintf(stderr, "messaging_send returned %s\n", + nt_errstr(status)); + return false; + } + + for (i=0; i<5; i++) { + tevent_loop_once(s.ev); + } + + return true; +} + +static void msg_callback(struct tevent_req *subreq) +{ + struct msg_test2_state *s = _tevent_req_callback_data(subreq); + struct messaging_rec *rec; + msg_read_recv(subreq, NULL, &rec); + TALLOC_FREE(subreq); + subreq = msg_read_send(s->ev, s->ev, s->channel); + tevent_req_set_callback(subreq, msg_callback, s); +} diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 37a44b2201c..6789d8529d4 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -9573,6 +9573,7 @@ static struct { { "LOCAL-TALLOC-DICT", run_local_talloc_dict, 0}, { "LOCAL-CTDB-CONN", run_ctdb_conn, 0}, { "LOCAL-MSG", run_msg_test, 0}, + { "LOCAL-MSG2", run_msg_test2, 0}, { "LOCAL-DBWRAP-WATCH1", run_dbwrap_watch1, 0 }, { "LOCAL-BASE64", run_local_base64, 0}, { "LOCAL-RBTREE", run_local_rbtree, 0}, |