Completed LDIF support
authorJamie Cameron <jcameron@webmin.com>
Wed, 6 May 2009 20:37:02 +0000 (20:37 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 6 May 2009 20:37:02 +0000 (20:37 +0000)
ldap-server/CHANGELOG
ldap-server/config-Ubuntu-Linux-8.10-*
ldap-server/edit_schema.cgi
ldap-server/edit_sfile.cgi
ldap-server/index.cgi
ldap-server/ldap-server-lib.pl

index 1e27297..b0e7683 100644 (file)
@@ -5,3 +5,5 @@ Added an option to create an example LDAP group, and made the example user a per
 ---- Changes since 1.440 ----
 The protocols served by the LDAP server, such as SSL and non-encrypted, can now be set on the OpenLDAP Server Configuration page. This is only possible on Redhat and Debian-derived systems though, as the protocols are configured in the init script.
 Fixed a bug that prevented browsing of the LDAP database in SSL mode, thanks to Paul R. Ganci.
+---- Changes since 1.480 ----
+Updated the module to support the new OpenLDAP LDIF-format configuration files, as seen on Ubuntu 8.10.
index af45b09..925962b 100644 (file)
@@ -1,5 +1,5 @@
 config_file=/etc/ldap/slapd.d
-schema_dir=/etc/ldap/slapd.d/cn=config/cn=schema
+schema_dir=/etc/ldap/schema
 slapd=slapd
 ldap_user=openldap
 browse_max=100
index 7c7d41a..f6f6a82 100644 (file)
@@ -8,22 +8,27 @@ $access{'schema'} || &error($text{'schema_ecannot'});
 &ReadParse();
 
 # Get included schemas
-$conf = &get_config();
-foreach $i (&find_value("include", $conf)) {
-       if ($i =~ /^(.*)\// && $1 eq $config{'schema_dir'}) {
-               $incs{$i} = ++$n;
+if (&get_config_type() == 1) {
+       $conf = &get_config();
+       foreach $i (&find_value("include", $conf)) {
+               if ($i =~ /^(.*)\// && $1 eq $config{'schema_dir'}) {
+                       $incs{$i} = ++$n;
+                       }
                }
+       $editable = 1;
        }
 
 # Show a table of all known schema files, with checkboxes
 print $text{'schema_pagedesc'},"<p>\n";
-@tds = ( "width=5", "width=20%", "width=65%", "width=10%", "width=5% nowrap" );
+@tds = ( $editable ? ( "width=5" ) : ( ),
+        "width=20%", "width=65%", "width=10%", "width=5% nowrap" );
 print &ui_form_start("save_schema.cgi", "post");
-print &ui_columns_start([ "",
+print &ui_columns_start([ $editable ? ( "" ) : ( ),
                          $text{'schema_file'},
                          $text{'schema_desc'},
                          $text{'schema_act'},
-                         $text{'schema_move'} ], 100, 0, \@tds);
+                         $editable ? ( $text{'schema_move'} ) : ( ) ],
+                       100, 0, \@tds);
 @files = sort { &schema_sorter } &list_schema_files();
 for($i=0; $i<@files; $i++) {
        $s = $files[$i];
@@ -41,17 +46,27 @@ for($i=0; $i<@files; $i++) {
        else {
                $mover = "";
                }
-       print &ui_checked_columns_row(
-               [ $s->{'name'},
-                 $s->{'desc'} || $s->{'file'},
-                 &ui_links_row(\@acts),
-                 $mover,
-               ],
-               \@tds, "d", $s->{'file'}, $incs{$s->{'file'}},
-               $s->{'name'} eq 'core');
+       if ($editable) {
+               # With move / enable checkbox
+               print &ui_checked_columns_row(
+                       [ $s->{'name'},
+                         $s->{'desc'} || $s->{'file'},
+                         &ui_links_row(\@acts),
+                         $mover,
+                       ],
+                       \@tds, "d", $s->{'file'}, $incs{$s->{'file'}},
+                       $s->{'name'} eq 'core');
+               }
+       else {
+               # View files only
+               print &ui_columns_row(
+                       [ $s->{'name'},
+                          $s->{'desc'} || $s->{'file'},
+                          &ui_links_row(\@acts) ], \@tds);
+               }
        }
 print &ui_columns_end();
-print &ui_form_end([ [ undef, $text{'save'} ] ]);
+print &ui_form_end($editable ? [ [ undef, $text{'save'} ] ] : [ ]);
 
 &ui_print_footer("", $text{'index_return'});
 
index d8ac820..b48c71a 100644 (file)
@@ -14,7 +14,7 @@ print $text{'schema_edesc'},"<p>\n";
 
 print &ui_form_start("save_sfile.cgi", "form-data");
 print &ui_hidden("file", $in{'file'});
-print &ui_table_start($text{'schema_eheader'}, undef, 2, [ "width=30%" ]);
+print &ui_table_start($text{'schema_eheader'}, "width=100%", 2);
 
 # Filename
 print &ui_table_row($text{'schema_path'},
@@ -22,7 +22,8 @@ print &ui_table_row($text{'schema_path'},
 
 # Contents
 print &ui_table_row(undef,
-       &ui_textarea("data", &read_file_contents($in{'file'}), 20, 80), 2);
+       &ui_textarea("data", &read_file_contents($in{'file'}), 20, 80,
+                    undef, 0, "style='width:100%'"), 2);
 
 print &ui_table_end();
 print &ui_form_end([ [ undef, $text{'save'} ] ]);
index 75a08e3..5a955b2 100644 (file)
@@ -79,8 +79,7 @@ if ($p && ref($ldap) && $access{'browser'}) {
 if ($local) {
        # All local server icons
        @pages = ( &get_config_type() == 1 ? "slapd" : "ldif",
-                  &get_config_type() == 1 ? ( "schema" ) : ( ),
-                  "acl", "browser", "create" );
+                  "schema", "acl", "browser", "create" );
        }
 else {
        # Just browser and DN creator
index bf866d1..b740b81 100644 (file)
@@ -581,7 +581,7 @@ foreach my $f (readdir(SCHEMA)) {
                local $lref = &read_file_lines("$config{'schema_dir'}/$f", 1);
                local $desc;
                foreach my $l (@$lref) {
-                       if ($l !~ /^\#+\s*\$/ && $l =~ /^\#+\s*(\S.*)/) {
+                       if ($l !~ /^\#+\s*\$/ && $l =~ /^\#+\s*([^#]\S.*)/) {
                                $desc .= $1." ";        # Comment
                                }
                        elsif ($l !~ /\S/) {