test_fail
}
+# Check we can't set a value on a tied hash
+perl.set_on_hash {
+ fail = 1
+}
+if (!fail) {
+ test_fail
+}
+
+# Check that setting an attribute instance more than one beyond the existing fails
+perl.set_beyond_limit {
+ fail = 1
+}
+if (!fail) {
+ test_fail
+}
+if (reply.Reply-Message[3] != 'Will set') {
+ test_fail
+}
+
+# Check that setting an invalid attribute fails
+perl.invalid_attr {
+ fail = 1
+}
+if (!fail) {
+ test_fail
+}
+
reply := {}
test_pass
return RLM_MODULE_OK;
}
+sub set_on_hash {
+ my $p = shift();
+ $p->{'reply'}{'User-Name'} = 'bob';
+}
+
+sub set_beyond_limit {
+ my $p = shift();
+ $p->{'reply'}{'Reply-Message'}[3] = 'Will set';
+ $p->{'reply'}{'Reply-Message'}[10] = 'Will not set';
+}
+
+sub invalid_attr {
+ my $p = shift();
+ $p->{'reply'}{'Invalid-Attr'}[0] = 'Hello';
+}
+
sub log_attributes {
my %hash = %{$_[0]};
my $indent = $_[1];