Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 158879 Details for
Bug 247215
Reimplement ds_remove (cgi) and ds_removal (command line wrapper) without setuputil code
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
cvs diff (adminserver)
as.diffs (text/plain), 19.05 KB, created by
Noriko Hosoi
on 2007-07-10 18:35:45 UTC
(
hide
)
Description:
cvs diff (adminserver)
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-07-10 18:35:45 UTC
Size:
19.05 KB
patch
obsolete
>Index: Makefile.am >=================================================================== >RCS file: /cvs/dirsec/adminserver/Makefile.am,v >retrieving revision 1.22 >diff -t -w -U4 -r1.22 Makefile.am >--- Makefile.am 4 Jul 2007 01:31:32 -0000 1.22 >+++ Makefile.am 10 Jul 2007 18:21:07 -0000 >@@ -135,8 +135,9 @@ > ldif_DATA = admserv/schema/ldif/00nsroot_backend.ldif.tmpl \ > admserv/schema/ldif/01nsroot.ldif.tmpl \ > admserv/schema/ldif/02globalpreferences.ldif.tmpl \ > admserv/schema/ldif/10dsdata.ldif.tmpl \ >+ admserv/schema/ldif/10rm_dsdata.ldif.tmpl \ > admserv/schema/ldif/11dstasks.ldif.tmpl \ > admserv/schema/ldif/12dsconfig.mod.tmpl \ > admserv/schema/ldif/13dsschema.mod.tmpl \ > admserv/schema/ldif/14dsmonitor.mod.tmpl \ >@@ -157,12 +158,12 @@ > cgibin_PROGRAMS = admpw security ugdsconfig ReadLog start_config_ds \ > config statpingserv viewdata dsconfig monreplication restartsrv \ > statusping viewlog htmladmin sec-activate stopsrv download help \ > ds_start ds_restart ds_shutdown ds_ldif2db ds_db2ldif ds_bak2db \ >- ds_db2bak ds_listdb ds_rmdb ds_remove ds_snmpctrl ds_vlvindex ds_addindex >+ ds_db2bak ds_listdb ds_rmdb ds_snmpctrl ds_vlvindex ds_addindex > > bin_SCRIPTS = admserv/newinst/src/register_server.pl >-cgibin_SCRIPTS = admserv/cgi-src40/ds_create >+cgibin_SCRIPTS = admserv/cgi-src40/ds_create admserv/cgi-src40/ds_remove > nodist_cmdbin_SCRIPTS = admserv/cfgstuff/start-ds-admin admserv/cfgstuff/stop-ds-admin admserv/cfgstuff/restart-ds-admin > > cmdbin_SCRIPTS = admserv/newinst/src/setup-ds-admin.pl \ > admserv/newinst/src/migrate-ds-admin.pl >@@ -293,13 +294,8 @@ > ds_rmdb_CPPFLAGS = -I$(srcdir)/include/libdsa $(AM_CPPFLAGS) > ds_rmdb_LDADD = libdsa.a $(DEFAULT_LIBS) > ds_rmdb_LINK = $(MYLINK) > >-ds_remove_SOURCES = admserv/cgi-ds/ds_remove.c admserv/cgi-ds/init_ds_env.c >-ds_remove_CPPFLAGS = -I$(srcdir)/include/libdsa $(AM_CPPFLAGS) >-ds_remove_LDADD = libdsa.a $(DEFAULT_LIBS) >-ds_remove_LINK = $(MYLINK) >- > ds_snmpctrl_SOURCES = admserv/cgi-ds/ds_snmpctrl.c admserv/cgi-ds/init_ds_env.c > ds_snmpctrl_CPPFLAGS = -I$(srcdir)/include/libdsa $(AM_CPPFLAGS) > ds_snmpctrl_LDADD = libdsa.a $(DEFAULT_LIBS) > ds_snmpctrl_LINK = $(MYLINK) >@@ -373,9 +369,10 @@ > nodist_property_DATA = $(RESOURCE_BUNDLES_ROOT) > # regular property files go here > property_DATA = admserv/newinst/src/setup-ds-admin.res \ > admserv/newinst/src/migrate-ds-admin.res \ >- admserv/cgi-src40/ds_create.res >+ admserv/cgi-src40/ds_create.res \ >+ admserv/cgi-src40/ds_remove.res > > # French resource bundles (for the French localization in the future) > #RESOURCE_BUNDLES_FR = foo_fr.res > >Index: admserv/newinst/src/AdminUtil.pm.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/AdminUtil.pm.in,v >retrieving revision 1.8 >diff -t -w -U4 -r1.8 AdminUtil.pm.in >--- admserv/newinst/src/AdminUtil.pm.in 4 Jul 2007 01:31:33 -0000 1.8 >+++ admserv/newinst/src/AdminUtil.pm.in 10 Jul 2007 18:21:07 -0000 >@@ -41,13 +41,15 @@ > @ISA = qw(Exporter); > @EXPORT = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS >- registerManyDSWithConfigDS createSubDSNoConn); >+ registerManyDSWithConfigDS createSubDSNoConn >+ unregisterDSWithConfigDS); > @EXPORT_OK = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS >- registerManyDSWithConfigDS createSubDSNoConn); >+ registerManyDSWithConfigDS createSubDSNoConn >+ unregisterDSWithConfigDS); > > # load perldap > use Mozilla::LDAP::Conn; > use Mozilla::LDAP::Utils qw(normalizeDN); >@@ -632,8 +634,34 @@ > my $inf = shift; > my $conn = shift; > my $admConf = shift; > my $configdir = shift || "@instconfigdir@"; >+ >+ my $rc = registerDSWithConfigDSExt(1, $servid, $errs, $inf, >+ $conn, $admConf, $configdir); >+ return $rc; >+} >+ >+sub unregisterDSWithConfigDS { >+ my $servid = shift; >+ my $errs = shift; >+ my $inf = shift; >+ my $conn = shift; >+ my $admConf = shift; >+ my $configdir = shift || "@instconfigdir@"; >+ my $rc = registerDSWithConfigDSExt(0, $servid, $errs, $inf, >+ $conn, $admConf, $configdir); >+ return $rc; >+} >+ >+sub registerDSWithConfigDSExt { >+ my $isRegister = shift; >+ my $servid = shift; >+ my $errs = shift; >+ my $inf = shift; >+ my $conn = shift; >+ my $admConf = shift; >+ my $configdir = shift || "@instconfigdir@"; > my $inst; > my $needclose; > > if ($servid =~ /^slapd-/) { >@@ -681,12 +709,21 @@ > return 0; > } > } > >+ my @ldiffiles = (); >+ if ($isRegister) >+ { > # add the Admin Server configuration entries >- my @ldiffiles = ("@ldifdir@/10dsdata.ldif.tmpl", >+ @ldiffiles = ("@ldifdir@/10dsdata.ldif.tmpl", > "@ldifdir@/11dstasks.ldif.tmpl" > ); >+ } >+ else >+ { >+ # remove the Admin Server configuration entries >+ @ldiffiles = ("@ldifdir@/10rm_dsdata.ldif.tmpl"); >+ } > my $setupinf = new Inf("@infdir@/setup.inf"); > my $slapdinf = new Inf("@infdir@/slapd.inf"); > > my $mapper = new Inf("@infdir@/dirserver.map"); >@@ -707,5 +744,4 @@ > } > > return @{$errs} ? 0 : 1; > } >- >Index: admserv/newinst/src/adminserver.map.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/adminserver.map.in,v >retrieving revision 1.5 >diff -t -w -U4 -r1.5 adminserver.map.in >--- admserv/newinst/src/adminserver.map.in 6 Jul 2007 18:06:19 -0000 1.5 >+++ admserv/newinst/src/adminserver.map.in 10 Jul 2007 18:21:07 -0000 >@@ -47,8 +47,11 @@ > # The output should be stored in $returnvalue to pass to the internal hash. > # * If the right-hand value is in " (doublequote), the value is passed as is. > # * If the right-hand value is not in any quote, the value should be found > # in either of the setup inf file (static) or the install inf file (dynamic). >+# * The right-hand value could have the format Key:"default_value". >+# In this case, Key is searched in the inf files first. >+# If the Key is not found, the default_value is set. > # * Variables surrounded by @ (e.g., @configdir@) are replaced with the > # system path at the compile time. > # * The right-hand value can contain variables surrounded by % (e.g., %asid%) > # which refers the right-hand value (key) of this map file. >Index: admserv/newinst/src/configdsroot.map.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/configdsroot.map.in,v >retrieving revision 1.4 >diff -t -w -U4 -r1.4 configdsroot.map.in >--- admserv/newinst/src/configdsroot.map.in 25 Jun 2007 18:23:53 -0000 1.4 >+++ admserv/newinst/src/configdsroot.map.in 10 Jul 2007 18:21:07 -0000 >@@ -44,8 +44,11 @@ > # The output should be stored in $returnvalue to pass to the internal hash. > # * If the right-hand value is in " (doublequote), the value is passed as is. > # * If the right-hand value is not in any quote, the value should be found > # in either of the setup inf file (static) or the install inf file (dynamic). >+# * The right-hand value could have the format Key:"default_value". >+# In this case, Key is searched in the inf files first. >+# If the Key is not found, the default_value is set. > # * Variables surrounded by @ (e.g., @configdir@) are replaced with the > # system path at the compile time. > # * The right-hand value can contain variables surrounded by % (e.g., %asid%) > # which refers the right-hand value (key) of this map file. >@@ -65,9 +68,9 @@ > > ds_version = Version > ds_baseversion = BaseVersion > ds_port = ServerPort >-ds_secure_port = "636" >+ds_secure_port = SecureServerPort:"636" > ds_suffix = Suffix > dsid = ServerIdentifier > > ds_console_jar = "%normbrand%-ds-%ds_baseversion%.jar" >Index: admserv/newinst/src/dirserver.map.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/dirserver.map.in,v >retrieving revision 1.5 >diff -t -w -U4 -r1.5 dirserver.map.in >--- admserv/newinst/src/dirserver.map.in 28 Jun 2007 16:24:41 -0000 1.5 >+++ admserv/newinst/src/dirserver.map.in 10 Jul 2007 18:21:07 -0000 >@@ -47,8 +47,11 @@ > # The output should be stored in $returnvalue to pass to the internal hash. > # * If the right-hand value is in " (doublequote), the value is passed as is. > # * If the right-hand value is not in any quote, the value should be found > # in either of the setup inf file (static) or the install inf file (dynamic). >+# * The right-hand value could have the format Key:"default_value". >+# In this case, Key is searched in the inf files first. >+# If the Key is not found, the default_value is set. > # * Variables surrounded by @ (e.g., @configdir@) are replaced with the > # system path at the compile time. > # * The right-hand value can contain variables surrounded by % (e.g., %asid%) > # which refers the right-hand value (key) of this map file. >@@ -66,9 +69,9 @@ > ds_baseversion = BaseVersion > dsid = ServerIdentifier > ds_user = SuiteSpotUserID > ds_port = ServerPort >-ds_secure_port = "636" >+ds_secure_port = SecureServerPort:"636" > rootdn = RootDN > ds_suffix = Suffix > ds_buildnum = BuildNumber > ds_console_jar ="%normbrand%-ds-%ds_baseversion%.jar" >Index: admserv/newinst/src/register_param.map.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/register_param.map.in,v >retrieving revision 1.6 >diff -t -w -U4 -r1.6 register_param.map.in >--- admserv/newinst/src/register_param.map.in 6 Jul 2007 18:06:19 -0000 1.6 >+++ admserv/newinst/src/register_param.map.in 10 Jul 2007 18:21:07 -0000 >@@ -47,8 +47,11 @@ > # The output should be stored in $returnvalue to pass to the internal hash. > # * If the right-hand value is in " (doublequote), the value is passed as is. > # * If the right-hand value is not in any quote, the value should be found > # in either of the setup inf file (static) or the install inf file (dynamic). >+# * The right-hand value could have the format Key:"default_value". >+# In this case, Key is searched in the inf files first. >+# If the Key is not found, the default_value is set. > # * Variables surrounded by @ (e.g., @configdir@) are replaced with the > # system path at the compile time. > # * The right-hand value can contain variables surrounded by % (e.g., %asid%) > # which refers the right-hand value (key) of this map file. >@@ -83,9 +86,9 @@ > ds_baseversion = BaseVersion > dsid = ServerIdentifier > ds_user = SuiteSpotUserID > ds_port = ServerPort >-ds_secure_port = "636" >+ds_secure_port = SecureServerPort:"636" > rootdn = RootDN > ds_suffix = Suffix > ds_buildnum = BuildNumber > ds_passwd = RootDNPwd >Index: admserv/schema/ldif/10rm_dsdata.ldif.tmpl >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/schema/ldif/10rm_dsdata.ldif.tmpl,v >retrieving revision 1.1 >diff -t -w -U4 -r1.1 10rm_dsdata.ldif.tmpl >--- admserv/schema/ldif/10rm_dsdata.ldif.tmpl 6 Jul 2007 17:41:18 -0000 1.1 >+++ admserv/schema/ldif/10rm_dsdata.ldif.tmpl 10 Jul 2007 18:21:07 -0000 >@@ -26,11 +26,8 @@ > changetype: modify > delete: uniqueMember > uniqueMember: cn=slapd-%dsid%, cn=%brand% Directory Server, cn=Server Group, cn=%fqdn%, ou=%domain%, o=NetscapeRoot > >-dn: cn=slapd-%dsid%, cn=%brand% Directory Server, cn=Server Group, cn=%fqdn%, ou=%domain%, o=NetscapeRoot >-changetype: delete >- > dn: cn=configuration,cn=slapd-%dsid%, cn=%brand% Directory Server, cn=Server Group, cn=%fqdn%, ou=%domain%, o=NetscapeRoot > changetype: delete > > dn: ou="cn=slapd-%dsid%, cn=%brand% Directory Server, cn=Server Group, cn=%fqdn%, ou=%domain%, o=NetscapeRoot",ou=UserPreferences, ou=%domain%, o=NetscapeRoot > >============================== >admserv/cgi-src40/ds_remove.in >============================== >#!/usr/bin/env perl ># BEGIN COPYRIGHT BLOCK ># This Program is free software; you can redistribute it and/or modify it under ># the terms of the GNU General Public License as published by the Free Software ># Foundation; version 2 of the License. ># ># This Program is distributed in the hope that it will be useful, but WITHOUT ># ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ># FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ># ># You should have received a copy of the GNU General Public License along with ># this Program; if not, write to the Free Software Foundation, Inc., 59 Temple ># Place, Suite 330, Boston, MA 02111-1307 USA. ># ># In addition, as a special exception, Red Hat, Inc. gives You the additional ># right to link the code of this Program with code not covered under the GNU ># General Public License ("Non-GPL Code") and to distribute linked combinations ># including the two, subject to the limitations in this paragraph. Non-GPL Code ># permitted under this exception must only link to the code of this Program ># through those well defined interfaces identified in the file named EXCEPTION ># found in the source code files (the "Approved Interfaces"). The files of ># Non-GPL Code may instantiate templates or use macros or inline functions from ># the Approved Interfaces without causing the resulting work to be covered by ># the GNU General Public License. Only Red Hat, Inc. may make changes or ># additions to the list of Approved Interfaces. You must obey the GNU General ># Public License in all respects for all of the Program code and other code used ># in conjunction with the Program except the Non-GPL Code covered by this ># exception. If you modify this file, you may extend this exception to your ># version of the file, but you are not obligated to do so. If you do not wish to ># provide this exception without modification, you must delete this exception ># statement from your version and license this file solely under the GPL without ># exception. ># ># ># Copyright (C) 2007 Red Hat, Inc. ># All rights reserved. ># END COPYRIGHT BLOCK ># > >use lib '@perldir@'; > >use strict; > >use File::Basename; >use File::Path; >use CGI qw(:cgi :oldstyle_urls); >use Inf; >use AdminUtil; >use Util; >use FileConn; >use Resource; > >sub remove_tree >{ > my $centry = shift; > my $key = shift; > my $instname = shift; > my $isparent = shift; > > foreach my $path ( @{$centry->{$key}} ) > { > my $rmdir = ""; > if ( 1 == $isparent ) > { > $rmdir = dirname($path); > } > else > { > $rmdir = $path; > } > if ( -d $rmdir && $rmdir =~ /$instname/ ) > { > my $rc = rmtree($rmdir); > print STDERR "rmtree: $rmdir => RC: $rc\n"; > } > } >} > >sub remove_pidfile >{ > my ($type, $instdir, $instname) = @_; > > my $pattern = "^" . $type . ".*="; > my $pidline = `grep $pattern $instdir/start-slapd`; > chomp($pidline); > my ($key, $pidfile) = split(/=/, $pidline); > if ( -e $pidfile && $pidfile =~ /$instname/ ) > { > unlink($pidfile); > } >} > >my $res = new Resource("@propertydir@/ds_remove.res", > "@propertydir@/setup-ds-admin.res", > "@propertydir@/setup-ds.res"); > ># parse the input parameters >my $query = new CGI; > ># call ds_newinst as a GET (GET or POST works, GET is simpler) >$ENV{REQUEST_METHOD} = "GET"; >$ENV{QUERY_STRING} = $query->query_string(); > >my $instname = $query->param('InstanceName'); >my ($slapd, $inst) = split(/-/, $instname, 2); >my @errs; >my $inf = createInfFromConfig("@instconfigdir@/slapd-$inst", $inst, \@errs); >if (@errs) { > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: ", $res->getText(@errs), "\n"; > print "NMC_Status: 1\n"; > exit 1; >} > ># add the parmeters necessary to configure this DS to be managed ># by the console and to be registered with the config DS - these ># are usually passed in via the CGI params, or use reasonable ># default values >my $admConf = getAdmConf("@instconfigdir@/admin-serv"); >$inf->{General}->{ConfigDirectoryLdapURL} = $query->param('ldap_url') || > $admConf->{ldapurl}; >$inf->{General}->{AdminDomain} = $query->param('admin_domain') || > $admConf->{AdminDomain}; > ># read the config file to find out the paths >my $dseldif = "@instconfigdir@/$instname/dse.ldif"; >my $conn = new FileConn($dseldif); > >my $dn = "cn=config"; >my $entry = $conn->search($dn, "base", "(cn=*)", 0); >if (!$entry) { > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: Search $dn in $dseldif failed: $entry\n"; > print "NMC_Status: 1\n"; > exit 1; >} > ># stop the server first >my $instdir = ""; >foreach my $path ( @{$entry->{"nsslapd-instancedir"}} ) >{ > if ( -d $path ) > { > my $prog = $path . "/stop-slapd"; > if (-x $prog) { > $? = 0; > # run the CGI > my $output = `$prog 2>&1`; > my $status = $?; > if ($status) { > # Ignore the stop failure > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: Could not stop directory server: $output\n"; > } > $instdir = $path; # need to use it later... > } else { > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: The program $prog does not exist\n"; > print "NMC_Status: 1\n"; > exit 1; > } > } >} > ># Unregister the server from the configuration ds ># get config ds url from input or admconf ># get admin id from input or admconf ># must get admin password from input (PASSWORD_PIPE?) ># get admin domain ># config ds info >if (!unregisterDSWithConfigDS($inst, \@errs, $inf)) { > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: ", $res->getText(@errs), "\n"; > print "NMC_Status: 1\n"; > exit 1; >} > ># remove physical dirs/files >$dn = "cn=config,cn=ldbm database,cn=plugins,cn=config"; >my $dbentry = $conn->search($dn, "base", "(cn=*)", 0); >if (!$dbentry) { > print "Content-type: text/html\n\n"; > print "NMC_ErrInfo: Search $dn in $dseldif failed: $dbentry\n"; > print "NMC_Status: 1\n"; > exit 1; >} >remove_tree($dbentry, "nsslapd-directory", $instname, 1); >remove_tree($dbentry, "nsslapd-db-logdirectory", $instname, 1); >remove_tree($entry, "nsslapd-lockdir", $instname); >remove_tree($entry, "nsslapd-tmpdir", $instname); >remove_tree($entry, "nsslapd-bakdir", $instname, 1); >remove_tree($entry, "nsslapd-errorlog", $instname, 1); >remove_tree($entry, "nsslapd-schemadir", $instname, 1); > ># instance dir >if ( -d $instdir ) >{ > # clean up pid files (if any) > remove_pidfile("STARTPIDFILE", $instdir, $instname); > remove_pidfile("PIDFILE", $instdir, $instname); > > my $rc = rmtree($instdir); >} > ># if we got here, report success >print "Content-type: text/html\n\n"; >print "NMC_Status: 0\n"; >exit 0; > >=============================== >admserv/cgi-src40/ds_remove.res >=============================== ># resources for ds_remove
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247215
:
158634
|
158635
|
158676
|
158876
| 158879 |
158913
|
158917
|
158918
|
158919
|
159392
|
159393
|
159487
|
160087