]> git.proxmox.com Git - pve-access-control.git/commitdiff
Auth::LDAP, Auth::AD: ipv6 support
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 2 Dec 2015 15:06:46 +0000 (16:06 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Dec 2015 11:08:56 +0000 (12:08 +0100)
Also had to change server1/server2 schema from a pattern to
the 'address' format.

PVE/Auth/AD.pm
PVE/Auth/LDAP.pm

index d33d3933b62adf38569bb9bfef015fc6b69edaa4..e03d04c8b367b83ad2cc33bbdcc7767675f53154 100755 (executable)
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 use PVE::Auth::Plugin;
 use Net::LDAP;
 use warnings;
 use PVE::Auth::Plugin;
 use Net::LDAP;
+use Net::IP;
 
 use base qw(PVE::Auth::Plugin);
 
 
 use base qw(PVE::Auth::Plugin);
 
@@ -16,14 +17,14 @@ sub properties {
        server1 => { 
            description => "Server IP address (or DNS name)",           
            type => 'string',
        server1 => { 
            description => "Server IP address (or DNS name)",           
            type => 'string',
-           pattern => '[\w\d]+(.[\w\d]+)*',
+           format => 'address',
            maxLength => 256,
        },
        server2 => { 
            description => "Fallback Server IP address (or DNS name)",
            type => 'string',
            optional => 1,
            maxLength => 256,
        },
        server2 => { 
            description => "Fallback Server IP address (or DNS name)",
            type => 'string',
            optional => 1,
-           pattern => '[\w\d]+(.[\w\d]+)*',
+           format => 'address',
            maxLength => 256,
        },
        secure => { 
            maxLength => 256,
        },
        secure => { 
@@ -80,6 +81,7 @@ my $authenticate_user_ad = sub {
     my $default_port = $config->{secure} ? 636: 389;
     my $port = $config->{port} ? $config->{port} : $default_port;
     my $scheme = $config->{secure} ? 'ldaps' : 'ldap';
     my $default_port = $config->{secure} ? 636: 389;
     my $port = $config->{port} ? $config->{port} : $default_port;
     my $scheme = $config->{secure} ? 'ldaps' : 'ldap';
+    $server = "[$server]" if Net::IP::ip_is_ipv6($server);
     my $conn_string = "$scheme://${server}:$port";
     
     my $ldap = Net::LDAP->new($conn_string) || die "$@\n";
     my $conn_string = "$scheme://${server}:$port";
     
     my $ldap = Net::LDAP->new($conn_string) || die "$@\n";
index 3f867ec3891c0c3b3c599363997e6159bc138995..e1161b64e131c1bebc85dfaef37435638f0b6ad8 100755 (executable)
@@ -5,6 +5,7 @@ use warnings;
 
 use PVE::Auth::Plugin;
 use Net::LDAP;
 
 use PVE::Auth::Plugin;
 use Net::LDAP;
+use Net::IP;
 use base qw(PVE::Auth::Plugin);
 
 sub type {
 use base qw(PVE::Auth::Plugin);
 
 sub type {
@@ -50,6 +51,7 @@ my $authenticate_user_ldap = sub {
     my $default_port = $config->{secure} ? 636: 389;
     my $port = $config->{port} ? $config->{port} : $default_port;
     my $scheme = $config->{secure} ? 'ldaps' : 'ldap';
     my $default_port = $config->{secure} ? 636: 389;
     my $port = $config->{port} ? $config->{port} : $default_port;
     my $scheme = $config->{secure} ? 'ldaps' : 'ldap';
+    $server = "[$server]" if Net::IP::ip_is_ipv6($server);
     my $conn_string = "$scheme://${server}:$port";
 
     my $ldap = Net::LDAP->new($conn_string, verify => 'none') || die "$@\n";
     my $conn_string = "$scheme://${server}:$port";
 
     my $ldap = Net::LDAP->new($conn_string, verify => 'none') || die "$@\n";