1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
part of pfSense (https://www.pfsense.org/)
|
5
|
|
6
|
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
/*
|
31
|
pfSense_MODULE: auth
|
32
|
*/
|
33
|
|
34
|
require("guiconfig.inc");
|
35
|
require_once("auth.inc");
|
36
|
|
37
|
$ous = array();
|
38
|
|
39
|
if($_GET) {
|
40
|
$authcfg = array();
|
41
|
$authcfg['ldap_port'] = $_GET['port'];
|
42
|
$authcfg['ldap_basedn'] = $_GET['basedn'];
|
43
|
$authcfg['host'] = $_GET['host'];
|
44
|
$authcfg['ldap_scope'] = $_GET['scope'];
|
45
|
$authcfg['ldap_binddn'] = $_GET['binddn'];
|
46
|
$authcfg['ldap_bindpw'] = $_GET['bindpw'];
|
47
|
$authcfg['ldap_urltype'] = $_GET['urltype'];
|
48
|
$authcfg['ldap_protver'] = $_GET['proto'];
|
49
|
$authcfg['ldap_authcn'] = explode(";", $_GET['authcn']);
|
50
|
$authcfg['ldap_caref'] = $_GET['cert'];
|
51
|
$ous = ldap_get_user_ous(true, $authcfg);
|
52
|
}
|
53
|
|
54
|
?>
|
55
|
<html>
|
56
|
<head>
|
57
|
<STYLE type="text/css">
|
58
|
TABLE {
|
59
|
border-width: 1px 1px 1px 1px;
|
60
|
border-spacing: 0px;
|
61
|
border-style: solid solid solid solid;
|
62
|
border-color: gray gray gray gray;
|
63
|
border-collapse: separate;
|
64
|
background-color: collapse;
|
65
|
}
|
66
|
TD {
|
67
|
border-width: 0px 0px 0px 0px;
|
68
|
border-spacing: 0px;
|
69
|
border-style: solid solid solid solid;
|
70
|
border-color: gray gray gray gray;
|
71
|
border-collapse: collapse;
|
72
|
background-color: white;
|
73
|
}
|
74
|
</STYLE>
|
75
|
</head>
|
76
|
<script type="text/javascript">
|
77
|
function post_choices() {
|
78
|
|
79
|
var ous = <?php echo count($ous); ?>;
|
80
|
var i;
|
81
|
opener.document.forms[0].ldapauthcontainers.value="";
|
82
|
for (i = 0; i < ous; i++) {
|
83
|
if (document.forms[0].ou[i].checked) {
|
84
|
if (opener.document.forms[0].ldapauthcontainers.value != "")
|
85
|
opener.document.forms[0].ldapauthcontainers.value+=";";
|
86
|
opener.document.forms[0].ldapauthcontainers.value+=document.forms[0].ou[i].value;
|
87
|
}
|
88
|
}
|
89
|
window.close();
|
90
|
-->
|
91
|
}
|
92
|
</script>
|
93
|
|
94
|
<body link="#000000" vlink="#000000" alink="#000000" >
|
95
|
<form method="post" action="system_usermanager_settings_ldapacpicker.php">
|
96
|
<?php if (empty($ous)): ?>
|
97
|
<p><?=gettext("Could not connect to the LDAP server. Please check your LDAP configuration.");?></p>
|
98
|
<input type='button' value='<?=gettext("Close"); ?>' onClick="window.close();">
|
99
|
<?php else: ?>
|
100
|
<b><?=gettext("Please select which containers to Authenticate against:");?></b>
|
101
|
<p/>
|
102
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
103
|
<tr>
|
104
|
<td class="tabnavtbl">
|
105
|
<table width="100%">
|
106
|
<?php
|
107
|
if(is_array($ous)) {
|
108
|
foreach($ous as $ou) {
|
109
|
if(in_array($ou, $authcfg['ldap_authcn']))
|
110
|
$CHECKED=" CHECKED";
|
111
|
else
|
112
|
$CHECKED="";
|
113
|
echo " <tr><td><input type='checkbox' value='{$ou}' id='ou' name='ou[]'{$CHECKED}> {$ou}<br /></td></tr>\n";
|
114
|
}
|
115
|
}
|
116
|
?>
|
117
|
</table>
|
118
|
</td>
|
119
|
</tr>
|
120
|
</table>
|
121
|
|
122
|
<p/>
|
123
|
|
124
|
<input type='button' value='<?=gettext("Save");?>' onClick="post_choices();">
|
125
|
<?php endif; ?>
|
126
|
</form>
|
127
|
</body>
|
128
|
</html>
|