allow port 0 to use default value

This commit is contained in:
Dietmar Maurer 2012-01-13 09:13:41 +01:00
parent a0492cd61b
commit af4a8a8522
2 changed files with 17 additions and 7 deletions

View File

@ -94,9 +94,9 @@ __PACKAGE__->register_method ({
optional => 1,
},
port => {
description => "Server port",
description => "Server port. Use '0' if you want to use default settings'",
type => 'integer',
minimum => 1,
minimum => 0,
maximum => 65535,
optional => 1,
},
@ -149,6 +149,11 @@ __PACKAGE__->register_method ({
$cfg->{$realm}->{$p} = $param->{$p};
}
# port 0 ==> use default
if (defined($param->{port}) && !$param->{port}) {
delete $cfg->{$realm}->{port};
}
cfs_write_file($domainconfigfile, $cfg);
}, "add auth server failed");
@ -190,9 +195,9 @@ __PACKAGE__->register_method ({
optional => 1,
},
port => {
description => "Server port",
description => "Server port. Use '0' if you want to use default settings'",
type => 'integer',
minimum => 1,
minimum => 0,
maximum => 65535,
optional => 1,
},
@ -245,6 +250,11 @@ __PACKAGE__->register_method ({
$cfg->{$realm}->{$p} = $param->{$p};
}
# port 0 ==> use default
if (defined($param->{port}) && !$param->{port}) {
delete $cfg->{$realm}->{port};
}
cfs_write_file($domainconfigfile, $cfg);
}, "update auth server failed");

View File

@ -552,7 +552,7 @@ my $valid_attributes = {
server1 => '[\w\d]+(.[\w\d]+)*',
server2 => '[\w\d]+(.[\w\d]+)*',
domain => '\S+',
port => '\d*',
port => '\d+',
secure => '',
comment => '.*',
},
@ -562,7 +562,7 @@ my $valid_attributes = {
base_dn => '\w+=[\w\s]+(,\s*\w+=[\w\s]+)*',
user_attr => '\S{2,}',
secure => '',
port => '\d*',
port => '\d+',
comment => '.*',
}
};