[Fedora-directory-commits] ldapserver/ldap/admin/src create_instance.c, 1.56, 1.57 create_instance.h, 1.16, 1.17 ds_newinst.pl.in, 1.5, 1.6

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Thu Jun 7 21:23:57 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/admin/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv3722/ldap/admin/src

Modified Files:
	create_instance.c create_instance.h ds_newinst.pl.in 
Log Message:
Resolves: bug 239765
Description: Allow mimimum schema in ds_newinst.pl
Fix Description: Fixed by abartlet.  Add a new configuration param to create_instance - install_full_schema.  By default this is 1, meaning the traditional behavior of installing all of the schema.  If set to 0, this will only install the 00core.ldif schema file.  This also required enhancements to ds_newinst.pl as well as a bug fix to allow passing in a 0 value.
Reviewed by: nhosoi, rmeggins



Index: create_instance.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- create_instance.c	16 May 2007 19:45:26 -0000	1.56
+++ create_instance.c	7 Jun 2007 21:23:54 -0000	1.57
@@ -300,6 +300,7 @@
     conf->upgradingServer = 0;
     
     conf->start_server = "1";
+    conf->install_full_schema = 1;
     conf->admin_domain = NULL;
     conf->config_ldap_url = NULL;
     conf->user_ldap_url = NULL;
@@ -3530,14 +3531,27 @@
     fclose(srcf);
     fclose(f);
 
-    /*
-     * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
-     */
-    PR_snprintf(src, sizeof(src), "%s%c%s%cschema", 
-        cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
-    if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
-        return t;
-        
+    if (cf->install_full_schema) {
+	/*
+         * <sysconfdir>/PACKAGE_NAME/schema to schema_dir
+         */
+        PR_snprintf(src, sizeof(src), "%s%c%s%cschema", 
+            cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
+        if (NULL != (t = ds_copy_group_files_using_mode_owner(src, cf->schema_dir, 0, NEWFILE_MODE, pw)))
+            return t;
+    } else {
+        PR_snprintf(src, sizeof(src),  "%s%c%s%cschema%c00core.ldif", 
+		    cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP, FILE_PATHSEP);
+        PR_snprintf(dest, sizeof(dest), "%s%c00core.ldif", 
+		    cf->schema_dir, FILE_PATHSEP);
+	if( (t = create_instance_copy(src, dest, NEWFILE_MODE, 0 )) ) {
+            return t;
+	} else {
+	    if (pw) {
+		chownfile(pw, dest);
+	    }
+        }
+    }
 #if defined (BUILD_PRESENCE)
     PR_snprintf(src, sizeof(src), "%s%c%s%c/config/presence",
                 cf->sysconfdir, FILE_PATHSEP, cf->package_name, FILE_PATHSEP);
@@ -4490,6 +4504,9 @@
         return 1;
     }
     cf->start_server = ds_a_get_cgi_var("start_server", NULL, NULL);
+    if (temp = ds_a_get_cgi_var("install_full_schema", NULL, NULL)) {
+	    cf->install_full_schema = atoi(temp);
+    }
     cf->secserv = ds_a_get_cgi_var("secserv", NULL, NULL);
     if (cf->secserv && strcmp(cf->secserv, "off"))
         cf->secservport = ds_a_get_cgi_var("secservport", NULL, NULL);


Index: create_instance.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/create_instance.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- create_instance.h	1 Mar 2007 03:34:23 -0000	1.16
+++ create_instance.h	7 Jun 2007 21:23:54 -0000	1.17
@@ -185,6 +185,7 @@
 #if defined(ENABLE_LDAPI)
     char *ldapifilepath;
 #endif
+    int install_full_schema;
 } server_config_s;
 
 


Index: ds_newinst.pl.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/ds_newinst.pl.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ds_newinst.pl.in	1 Mar 2007 03:34:23 -0000	1.5
+++ ds_newinst.pl.in	7 Jun 2007 21:23:54 -0000	1.6
@@ -54,7 +54,7 @@
   my $content = "";
   my $firsttime = 1;
   while (my ($kk, $vv) = each %{$args}) {
-    next if (!$kk || !$vv);
+    next if (!defined($kk) || !defined($vv));
 	if ($firsttime) {
 	  $firsttime = 0;
 	} else {
@@ -277,14 +277,29 @@
 $cgiargs{install_ldif_file} = $table{slapd}->{InstallLdifFile};
 
 # if for some reason you do not want the server started after instance creation
-# the following line can be commented out - NOTE that if you are creating the
+# then you can set
+# [slapd] 
+# start_server = 0
+# NOTE that if you are creating the
 # Configuration DS, it will be started anyway
+
 if (defined($table{"slapd"}->{"start_server"})) {
     $cgiargs{start_server} = $table{"slapd"}->{"start_server"};
 } else { # default is on
     $cgiargs{start_server} = 1;
 }
 
+# if for some reason you do not want the full schema to be installed, 
+# (such as needing to replace much of it with an AD-like schema), then set
+# [slapd]
+# install_full_schema = 0
+
+if (defined($table{"slapd"}->{"install_full_schema"})) {
+    $cgiargs{install_full_schema} = $table{"slapd"}->{"install_full_schema"};
+} else { 
+    # server-side default is on
+}
+
 my $sroot = $cgiargs{sroot};
 
 my $prog = "@bindir@/ds_newinst";




More information about the Fedora-directory-commits mailing list