[Fedora-directory-commits] adminserver/admserv/cgi-src40 ds_create.in, 1.6, 1.7

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Dec 17 20:10:07 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/adminserver/admserv/cgi-src40
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20143/adminserver/admserv/cgi-src40

Modified Files:
	ds_create.in 
Log Message:
Resolves: bug 425861
Bug Description: Instance creation through console is broken
Reviewed by: nhosoi (Thanks!)
Fix Description: This was caused by my fix for bug 420751.  When I added the as_uid to fix the ACI for the admin user, I did not add the mapping everywhere it was used.  Unfortunately, I found that the code I added it to could only be used with a live connection to the new directory server, not a FileConn to the dse.ldif.  So I had to add a new function to add this ACI to the new root suffix after the server had been started.
Another problem with instance creation was that the org entries were not being added when creating a new instance in the console.  The default should be to create them if nothing else was specified.
Another problem was that instance creation was leaving temp ldif files around.
I also had to make sure ServerAdminID was specified everywhere it was needed by dirserver.map, or this would also have broken ds_remove.
Platforms tested: RHEL5 x86_64
Flag Day: Yes - autotool file change in adminserver
Doc impact: no



Index: ds_create.in
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/ds_create.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ds_create.in	6 Nov 2007 18:16:02 -0000	1.6
+++ ds_create.in	17 Dec 2007 20:10:05 -0000	1.7
@@ -21,6 +21,7 @@
 
 use strict;
 
+use Mozilla::LDAP::API qw(ldap_explode_dn);
 use CGI qw(:cgi :oldstyle_urls);
 use Inf;
 use AdminUtil;
@@ -45,7 +46,7 @@
 my @errs = createDSInstance($inf);
 if (@errs) {
     print "Content-type: text/plain\n\n";
-    print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
+    print "NMC_ErrInfo: \n", $res->getText(@errs), "\n";
     print "NMC_Status: 1\n";
     exit 1;
 }
@@ -63,28 +64,41 @@
 $inf->{General}->{AdminDomain} = $query->param('admin_domain') ||
     $admConf->{AdminDomain};
 
+# need to get the admin uid
+if (!$inf->{admin}->{ServerAdminID}) {
+    my @rdns = ldap_explode_dn($inf->{General}->{ConfigDirectoryAdminID}, 1);
+    $inf->{admin}->{ServerAdminID} = $rdns[0];
+}
+
 if (!createSubDSNoConn($inf, \@errs)) {
     print "Content-type: text/plain\n\n";
-    print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
+    print "NMC_ErrInfo: \n", $res->getText(@errs), "\n";
     print "NMC_Status: 1\n";
     exit 1;
 }
 
 my $servid = $query->param('servid');
-if (!defined($start_server) or $start_server) {
-    $inf->{slapd}->{start_server} = 1;
-    if (@errs = DSCreate::startServer($inf)) {
-        print "Content-type: text/plain\n\n";
-        print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
-        print "NMC_Status: 1\n";
-        exit 1;
-    }
+# now start the server
+$inf->{slapd}->{start_server} = 1;
+if (@errs = DSCreate::startServer($inf)) {
+    print "Content-type: text/plain\n\n";
+    print "NMC_ErrInfo: \n", $res->getText(@errs), "\n";
+    print "NMC_Status: 1\n";
+    exit 1;
+}
+
+# add the aci that allows the admin user to administer the server
+if (!addConfigACIsToSubDS($inf, \@errs)) {
+    print "Content-type: text/plain\n\n";
+    print "NMC_ErrInfo: \n", $res->getText(@errs), "\n";
+    print "NMC_Status: 1\n";
+    exit 1;
 }
 
 # register the new server with the configuration ds
 if (!registerDSWithConfigDS($servid, \@errs, $inf)) {
     print "Content-type: text/plain\n\n";
-    print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
+    print "NMC_ErrInfo: \n", $res->getText(@errs), "\n";
     print "NMC_Status: 1\n";
     exit 1;
 }




More information about the Fedora-directory-commits mailing list