]> git.proxmox.com Git - pve-access-control.git/commitdiff
allow port 0 to use default value
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Jan 2012 08:13:41 +0000 (09:13 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Jan 2012 08:13:41 +0000 (09:13 +0100)
PVE/API2/Domains.pm
PVE/AccessControl.pm

index f080c716e92eeeecfdcdeae113166aa228001102..117ef3c92fd58a5f020349507b0789aee7c0e102 100644 (file)
@@ -94,9 +94,9 @@ __PACKAGE__->register_method ({
                optional => 1,
            },
            port => {
                optional => 1,
            },
            port => {
-               description => "Server port",
+               description => "Server port. Use '0' if you want to use default settings'",
                type => 'integer',
                type => 'integer',
-               minimum => 1,
+               minimum => 0,
                maximum => 65535,
                optional => 1,
            },
                maximum => 65535,
                optional => 1,
            },
@@ -137,7 +137,7 @@ __PACKAGE__->register_method ({
                if (defined($param->{secure})) {
                    $cfg->{$realm}->{secure} = $param->{secure} ? 1 : 0;
                }
                if (defined($param->{secure})) {
                    $cfg->{$realm}->{secure} = $param->{secure} ? 1 : 0;
                }
-       
+
                if ($param->{default}) {
                    foreach my $r (keys %$cfg) {
                        delete $cfg->{$r}->{default};
                if ($param->{default}) {
                    foreach my $r (keys %$cfg) {
                        delete $cfg->{$r}->{default};
@@ -149,6 +149,11 @@ __PACKAGE__->register_method ({
                    $cfg->{$realm}->{$p} = $param->{$p};
                }
 
                    $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");
 
                cfs_write_file($domainconfigfile, $cfg);
            }, "add auth server failed");
 
@@ -190,9 +195,9 @@ __PACKAGE__->register_method ({
                optional => 1,
            },
            port => {
                optional => 1,
            },
            port => {
-               description => "Server port",
+               description => "Server port. Use '0' if you want to use default settings'",
                type => 'integer',
                type => 'integer',
-               minimum => 1,
+               minimum => 0,
                maximum => 65535,
                optional => 1,
            },
                maximum => 65535,
                optional => 1,
            },
@@ -245,6 +250,11 @@ __PACKAGE__->register_method ({
                    $cfg->{$realm}->{$p} = $param->{$p};
                }
 
                    $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");
 
                cfs_write_file($domainconfigfile, $cfg);
            }, "update auth server failed");
 
index 3bdc7de1a7b664348f90ff9276b1a2d733890a53..3db2bff9e5dbaaf2e4cef014279fd9583d4543b5 100644 (file)
@@ -552,7 +552,7 @@ my $valid_attributes = {
        server1 => '[\w\d]+(.[\w\d]+)*',
        server2 => '[\w\d]+(.[\w\d]+)*',
        domain => '\S+',
        server1 => '[\w\d]+(.[\w\d]+)*',
        server2 => '[\w\d]+(.[\w\d]+)*',
        domain => '\S+',
-       port => '\d*',
+       port => '\d+',
        secure => '',
        comment => '.*',
     },
        secure => '',
        comment => '.*',
     },
@@ -562,7 +562,7 @@ my $valid_attributes = {
        base_dn => '\w+=[\w\s]+(,\s*\w+=[\w\s]+)*',
        user_attr => '\S{2,}',
        secure => '',
        base_dn => '\w+=[\w\s]+(,\s*\w+=[\w\s]+)*',
        user_attr => '\S{2,}',
        secure => '',
-       port => '\d*',
+       port => '\d+',
        comment => '.*',
     }
 };
        comment => '.*',
     }
 };