From e9ccd9b1cb91ef975a11429ec6bc08c1c149c11d Mon Sep 17 00:00:00 2001 From: Bryan Haase Date: Fri, 22 Jul 2011 09:18:20 -0500 Subject: [PATCH] More sanity checking --- etc/inc/vpn.inc | 25 ++++++++++++++++--------- usr/local/www/vpn_ipsec_mobile.php | 8 +++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 47bced9ad8..b01d0309d8 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -420,22 +420,29 @@ function vpn_ipsec_configure($ipchg = false) } /* end mode_cfg section */ - /* begin ldapcfg */ - $authcfg = $config['system']['authserver'][0]; + if ($a_client['user_source'] = "ldap") + { + foreach ($config['system']['authserver'] as $authcfg) { + if ($authcfg['type'] == 'ldap') { + $thisauthcfg = $authcfg; + } + } + + /* begin ldapcfg */ $racoonconf .= "ldapcfg {\n"; $racoonconf .= "\tversion 3;\n"; - $racoonconf .= "\thost \"".$authcfg['host']."\";\n"; + $racoonconf .= "\thost \"".$thisauthcfg['host']."\";\n"; $lport = "389"; if ($authcfg['port'] != "") {$lport = $authcfg['port'];}; $racoonconf .= "\tport ".$lport.";\n"; - $racoonconf .= "\tbase \"".$authcfg['ldap_basedn']."\";\n"; + $racoonconf .= "\tbase \"".$thisauthcfg['ldap_basedn']."\";\n"; $racoonconf .= "\tsubtree on;\n"; - $racoonconf .= "\tbind_dn \"".$authcfg['ldap_binddn']."\";\n"; - $racoonconf .= "\tbind_pw \"".$authcfg['ldap_bindpw']."\";\n"; - $racoonconf .= "\tattr_user \"".$authcfg['ldap_attr_user']."\";\n"; + $racoonconf .= "\tbind_dn \"".$thisauthcfg['ldap_binddn']."\";\n"; + $racoonconf .= "\tbind_pw \"".$thisauthcfg['ldap_bindpw']."\";\n"; + $racoonconf .= "\tattr_user \"".$thisauthcfg['ldap_attr_user']."\";\n"; $racoonconf .= "}\n\n"; - /* end ldapcfg */ - + /* end ldapcfg */ + } /* begin remote sections */ if (is_array($a_phase1) && count($a_phase1)) { /* begin remote */ diff --git a/usr/local/www/vpn_ipsec_mobile.php b/usr/local/www/vpn_ipsec_mobile.php index 281ee5e24e..34b72d11c1 100755 --- a/usr/local/www/vpn_ipsec_mobile.php +++ b/usr/local/www/vpn_ipsec_mobile.php @@ -355,7 +355,13 @@ function login_banner_change() { :