From 8814894874402cf19d6dadd2a7519e0e684c8227 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Mon, 16 Jul 2012 11:38:01 +0100 Subject: [PATCH] Test setting an ACL --- src/control.c | 4 +++- src/serve.c | 2 +- tests/acceptance/test_happy_path.rb | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/control.c b/src/control.c index a756f4c..bf23637 100644 --- a/src/control.c +++ b/src/control.c @@ -412,6 +412,7 @@ int control_acl(struct control_client* client, int linesc, char** lines) struct acl * new_acl = acl_create( linesc, lines, default_deny ); if (new_acl->len != linesc) { + warn("Bad ACL spec: %s", lines[new_acl->len] ); write(client->socket, "1: bad spec: ", 13); write(client->socket, lines[new_acl->len], strlen(lines[new_acl->len])); @@ -420,7 +421,8 @@ int control_acl(struct control_client* client, int linesc, char** lines) } else { flexnbd_replace_acl( flexnbd, new_acl ); - write( client->socket, "0: updated", 10); + info("ACL set"); + write( client->socket, "0: updated\n", 11); } return 0; diff --git a/src/serve.c b/src/serve.c index f408dbf..aee69cc 100644 --- a/src/serve.c +++ b/src/serve.c @@ -494,7 +494,7 @@ void accept_nbd_client( return; } - debug( "Client %s accepted.", s_client_address ); + info( "Client %s accepted.", s_client_address ); client_params = client_create( params, client_fd ); params->nbd_client[slot].client = client_params; diff --git a/tests/acceptance/test_happy_path.rb b/tests/acceptance/test_happy_path.rb index 0eadc9c..1df12b1 100644 --- a/tests/acceptance/test_happy_path.rb +++ b/tests/acceptance/test_happy_path.rb @@ -92,4 +92,14 @@ class TestHappyPath < Test::Unit::TestCase assert_equal "12345678", @env.nbd1.read( 2**31+2**29, 8 ) end + + def test_set_acl + # Just check that we get sane feedback here + @env.writefile1( "f"*4 ) + @env.serve1 + + _,stderr = @env.acl1("127.0.0.1") + assert_no_match( /^(F|E):/, stderr ) + end + end