2 # Show a form for editing the LDAP server to connect to
4 require './ldap-client-lib.pl';
5 &ui_print_header(undef, $text{'server_title'}, "", "server");
8 print &ui_form_start("save_server.cgi", "post");
9 print &ui_table_start($text{'server_header'}, "width=100%", 2);
11 $uri = &find_svalue("uri", $conf);
13 # Show LDAP servers as URIs
14 $utable = &ui_columns_start([
15 $text{'server_uhost'},
16 $text{'server_uport'},
17 $text{'server_uproto'} ]);
19 foreach $u (split(/\s+/, $uri), undef) {
20 local ($proto, $host, $port);
21 if ($u =~ /^(ldap|ldaps|ldapi):\/\/([a-z0-9\_\-\.]+)(:(\d+))?/) {
22 ($proto, $host, $port) = ($1, $2, $4);
24 $utable .= &ui_columns_row([
25 &ui_textbox("uhost_$i", $host, 20),
26 &ui_opt_textbox("uport_$i", $port, 5, $text{'default'}),
27 &ui_select("uproto_$i", $proto,
28 [ [ 'ldap', $text{'server_ldap'} ],
29 [ 'ldaps', $text{'server_ldaps'} ],
30 [ 'ldapi', $text{'server_ldapi'} ] ]),
34 $utable .= &ui_columns_end();
35 print &ui_table_row($text{'server_uri'}, $utable);
38 # Show LDAP servers from host and port
39 print &ui_table_row($text{'server_host'},
40 &ui_textarea("host", join("\n", split(/\s+/,
41 &find_svalue("host", $conf))), 3, 50));
43 print &ui_table_row($text{'server_port'},
44 &ui_opt_textbox("port", &find_svalue("port", $conf), 5,
48 print &ui_table_row($text{'server_version'},
49 &ui_radio("version", &find_svalue("ldap_version", $conf),
50 [ [ "", $text{'default'} ],
51 [ 1, "V1" ], [ 2, "V2" ], [ 3, "V3" ] ]));
53 print &ui_table_row($text{'server_timelimit'},
54 &ui_opt_textbox("timelimit", &find_svalue("bind_timelimit", $conf), 5,
55 $text{'default'})." ".$text{'base_secs'});
57 print &ui_table_row($text{'server_binddn'},
58 &ui_opt_textbox("binddn", &find_svalue("binddn", $conf), 40,
59 $text{'server_anon'}));
61 print &ui_table_row($text{'server_bindpw'},
62 &ui_opt_textbox("bindpw", &find_svalue("bindpw", $conf), 20,
63 $text{'server_none'}));
65 print &ui_table_row($text{'server_rootbinddn'},
66 &ui_opt_textbox("rootbinddn", &find_svalue("rootbinddn", $conf), 40,
67 $text{'server_same'}));
69 print &ui_table_row($text{'server_rootbindpw'},
70 &ui_opt_textbox("rootbindpw", &get_rootbinddn_secret(), 20,
71 $text{'server_none'}));
76 $ssl = &find_svalue("ssl", $conf);
77 $ssl = "" if ($ssl eq "no");
78 print &ui_table_row($text{'server_ssl'},
79 &ui_radio("ssl", &find_svalue("ssl", $conf),
80 [ [ "yes", $text{'yes'} ],
81 [ "start_tls", $text{'server_tls'} ],
82 [ "", $text{'no'} ] ]));
84 print &ui_table_row($text{'server_peer'},
85 &ui_radio("peer", &find_svalue("tls_checkpeer", $conf),
86 [ [ "", &text('server_def', $text{'no'}) ],
87 [ "yes", $text{'yes'} ],
88 [ "no", $text{'no'} ] ]));
90 print &ui_table_row($text{'server_cacert'},
91 &ui_opt_textbox("cacert", &find_svalue("tls_cacertfile", $conf),
92 40, $text{'server_none'})." ".
93 &file_chooser_button("cacert"));
95 print &ui_table_end();
96 print &ui_form_end([ [ "save", $text{'save'} ] ]);
98 &ui_print_footer("", $text{'index_return'});