Project

General

Profile

« Previous | Next » 

Revision 96267107

Added by Ermal LUÇI about 14 years ago

Correct whitespace and some problems in the just merged ldap auth sorce for racoon

View differences:

etc/inc/upgrade_config.inc
1139 1139

  
1140 1140
		if (isset($config['ipsec']['mobileclients']['enable'])) {
1141 1141
			$config['ipsec']['client']['enable'] = true;
1142
			$config['ipsec']['client']['enable'] = $config['ipsec']['mobileclients']['user_source'];
1142
			$config['ipsec']['client']['user_source'] = 'system';
1143 1143
			$config['ipsec']['client']['group_source'] = 'system';
1144 1144
		}
1145 1145

  
etc/inc/vpn.inc
416 416
			}
417 417
			/* end mode_cfg section */
418 418
			
419
			if ($a_client['user_source'] != "system")
420
            {
421
				foreach ($config['system']['authserver'] as $authcfg) {
422
                     if ($authcfg['type'] == 'ldap' and $authcfg['name'] == $a_client['user_source']) 
423
					{
424
                        $thisauthcfg = $authcfg;
425
                    }
426
                }
427

  
428
				/* begin ldapcfg */                        
429
                        $racoonconf .= "ldapcfg {\n";
430
                        $racoonconf .= "\tversion 3;\n";
431
                        $racoonconf .= "\thost \"".$thisauthcfg['host']."\";\n";
432
                        $lport = "389";
433
                        if ($authcfg['port'] != "") {$lport = $authcfg['port'];};
434
                        $racoonconf .= "\tport ".$lport.";\n";
435
                        $racoonconf .= "\tbase \"".$thisauthcfg['ldap_basedn']."\";\n";
436
                        $racoonconf .= "\tsubtree on;\n";
437
                        $racoonconf .= "\tbind_dn \"".$thisauthcfg['ldap_binddn']."\";\n";
438
                        $racoonconf .= "\tbind_pw \"".$thisauthcfg['ldap_bindpw']."\";\n";
439
                        $racoonconf .= "\tattr_user \"".$thisauthcfg['ldap_attr_user']."\";\n";
440
                        $racoonconf .= "}\n\n";
441
				/* end ldapcfg */
419
			if ($a_client['user_source'] != "system") {
420
				if (is_array($config['system']['authserver'])) {
421
					foreach ($config['system']['authserver'] as $authcfg) {
422
						if ($authcfg['type'] == 'ldap' and $authcfg['name'] == $a_client['user_source']) 
423
							$thisauthcfg = $authcfg;
424
					}
425

  
426
					/* begin ldapcfg */                        
427
					$racoonconf .= "ldapcfg {\n";
428
					$racoonconf .= "\tversion 3;\n";
429
					$racoonconf .= "\thost \"".$thisauthcfg['host']."\";\n";
430
					$lport = "389";
431
					if ($authcfg['port'] != "")
432
						$lport = $authcfg['port'];
433
					$racoonconf .= "\tport ".$lport.";\n";
434
					$racoonconf .= "\tbase \"".$thisauthcfg['ldap_basedn']."\";\n";
435
					$racoonconf .= "\tsubtree on;\n";
436
					$racoonconf .= "\tbind_dn \"".$thisauthcfg['ldap_binddn']."\";\n";
437
					$racoonconf .= "\tbind_pw \"".$thisauthcfg['ldap_bindpw']."\";\n";
438
					$racoonconf .= "\tattr_user \"".$thisauthcfg['ldap_attr_user']."\";\n";
439
					$racoonconf .= "}\n\n";
440
					/* end ldapcfg */
441
				}
442 442
			}
443

  
443 444
			/* begin remote sections */
444 445
			if (is_array($a_phase1) && count($a_phase1)) {
445 446
				/* begin remote */
usr/local/www/vpn_ipsec_mobile.php
356 356
							<?=gettext("Source"); ?>:&nbsp;&nbsp;
357 357
							<select name="user_source" class="formselect" id="user_source">
358 358
								<option value="system" <?php if ($pconfig['user_source'] == 'system') echo "selected"; ?>><?=gettext("system"); ?></option>
359
								<?
360
									if (isset($config['system']['authserver']))
361
                                    {
359
								<?php
360
									if (is_array($config['system']['authserver'])) {
362 361
										foreach ($config['system']['authserver'] as $authcfg) {
363 362
											if ($authcfg['type'] == 'ldap') {
364 363
												$selected = "";
365
												if ($pconfig['user_source'] == $authcfg['name'])  $selected = "selected";
366
												print '<option value="'.$authcfg['name'].'" '. $selected.'>'.$authcfg['name'].'</option>';
364
												if ($pconfig['user_source'] == $authcfg['name'])
365
													$selected = "selected";
366
												echo "<option value='{$authcfg['name']}' {$selected} >{$authcfg['name']}</option>\n";
367 367
											}
368 368
										}
369 369
									}
370
                                ?>								
370
								?>
371 371
							</select>
372 372
						</td>
373 373
					</tr>

Also available in: Unified diff