Test setting an ACL
This commit is contained in:
@@ -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 );
|
struct acl * new_acl = acl_create( linesc, lines, default_deny );
|
||||||
|
|
||||||
if (new_acl->len != linesc) {
|
if (new_acl->len != linesc) {
|
||||||
|
warn("Bad ACL spec: %s", lines[new_acl->len] );
|
||||||
write(client->socket, "1: bad spec: ", 13);
|
write(client->socket, "1: bad spec: ", 13);
|
||||||
write(client->socket, lines[new_acl->len],
|
write(client->socket, lines[new_acl->len],
|
||||||
strlen(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 {
|
else {
|
||||||
flexnbd_replace_acl( flexnbd, new_acl );
|
flexnbd_replace_acl( flexnbd, new_acl );
|
||||||
write( client->socket, "0: updated", 10);
|
info("ACL set");
|
||||||
|
write( client->socket, "0: updated\n", 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -494,7 +494,7 @@ void accept_nbd_client(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug( "Client %s accepted.", s_client_address );
|
info( "Client %s accepted.", s_client_address );
|
||||||
client_params = client_create( params, client_fd );
|
client_params = client_create( params, client_fd );
|
||||||
|
|
||||||
params->nbd_client[slot].client = client_params;
|
params->nbd_client[slot].client = client_params;
|
||||||
|
@@ -92,4 +92,14 @@ class TestHappyPath < Test::Unit::TestCase
|
|||||||
assert_equal "12345678", @env.nbd1.read( 2**31+2**29, 8 )
|
assert_equal "12345678", @env.nbd1.read( 2**31+2**29, 8 )
|
||||||
end
|
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
|
end
|
||||||
|
Reference in New Issue
Block a user