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 160066 Details for
Bug 249739
Implement a script registering DS to the Configuration DS
[?]
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 diffs (adminserver)
as.diffs (text/plain), 12.79 KB, created by
Noriko Hosoi
on 2007-07-26 19:41:46 UTC
(
hide
)
Description:
cvs diffs (adminserver)
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-07-26 19:41:46 UTC
Size:
12.79 KB
patch
obsolete
>Index: Makefile.am >=================================================================== >RCS file: /cvs/dirsec/adminserver/Makefile.am,v >retrieving revision 1.23 >diff -t -w -U4 -r1.23 Makefile.am >--- Makefile.am 11 Jul 2007 01:20:21 -0000 1.23 >+++ Makefile.am 26 Jul 2007 18:58:22 -0000 >@@ -162,18 +162,20 @@ > 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 admserv/cgi-src40/ds_remove >-nodist_cmdbin_SCRIPTS = admserv/cfgstuff/start-ds-admin admserv/cfgstuff/stop-ds-admin admserv/cfgstuff/restart-ds-admin >+nodist_cmdbin_SCRIPTS = admserv/cfgstuff/start-ds-admin admserv/cfgstuff/stop-ds-admin admserv/cfgstuff/restart-ds-admin admserv/cfgstuff/ds_removal > > cmdbin_SCRIPTS = admserv/newinst/src/setup-ds-admin.pl \ >- admserv/newinst/src/migrate-ds-admin.pl >+ admserv/newinst/src/migrate-ds-admin.pl \ >+ admserv/newinst/src/register-ds-admin.pl > > perl_SCRIPTS = admserv/newinst/src/ASDialogs.pm \ > admserv/newinst/src/AdminUtil.pm \ > admserv/newinst/src/AdminServer.pm \ > admserv/newinst/src/ConfigDSDialogs.pm \ >- admserv/newinst/src/AdminMigration.pm >+ admserv/newinst/src/AdminMigration.pm \ >+ admserv/newinst/src/RegDSDialogs.pm > > libds_admin_serv_la_SOURCES = $(libbase_a_SOURCES) $(libsi18n_a_SOURCES) $(libadmin_a_SOURCES) > libds_admin_serv_la_LINK = $(MYLINK) > >@@ -369,8 +371,9 @@ > 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/newinst/src/register-ds-admin.res \ > admserv/cgi-src40/ds_create.res \ > admserv/cgi-src40/ds_remove.res > > # French resource bundles (for the French localization in the future) >Index: admserv/newinst/src/AdminServer.pm.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/AdminServer.pm.in,v >retrieving revision 1.7 >diff -t -w -U4 -r1.7 AdminServer.pm.in >--- admserv/newinst/src/AdminServer.pm.in 24 Jul 2007 20:10:16 -0000 1.7 >+++ admserv/newinst/src/AdminServer.pm.in 26 Jul 2007 18:58:22 -0000 >@@ -190,9 +190,9 @@ > # being added > sub registercb { > my ($context, $entry, $errs) = @_; > >- my $rc = check_and_add_entry([$context->{conn}], $entry, $errs); >+ my $rc = check_and_add_entry([$context->{conn}, $context->{reconfig}], $entry, $errs); > my $setup = $context->{setup}; > if ($rc) { > if ($entry->hasValue('objectclass', 'nsApplication', 1)) { > $context->{isie} = $entry->getDN(); >@@ -217,8 +217,9 @@ > sub registerASWithConfigDS { > my $setup = shift; > my $inf = $setup->{inf}; > my $configdir = shift; >+ my $reconfig = shift; > my @errs; > > $setup->msg('registering_adminserver'); > # open a connection to the configuration directory server >@@ -259,9 +260,9 @@ > if (!open(LOCALCONF, ">$localconf")) { > $setup->msg($FATAL, 'error_updating_localconf', $localconf, $!); > return 0; > } >- my $context = {conn => $conn, localfh => \*LOCALCONF, setup => $setup}; >+ my $context = {conn => $conn, localfh => \*LOCALCONF, setup => $setup, reconfig => $reconfig}; > getMappedEntries($mapper, \@ldiffiles, \@errs, \®istercb, $context); > close(LOCALCONF); > > if ($isnew) { >@@ -407,9 +408,9 @@ > if (!makeConfFiles($setup, $configdir)) { > return 0; > } > >- if (!registerASWithConfigDS($setup, $configdir)) { >+ if (!registerASWithConfigDS($setup, $configdir, $reconfig)) { > return 0; > } > > $setup->msg('updating_httpconf'); >Index: admserv/newinst/src/AdminUtil.pm.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/AdminUtil.pm.in,v >retrieving revision 1.11 >diff -t -w -U4 -r1.11 AdminUtil.pm.in >--- admserv/newinst/src/AdminUtil.pm.in 24 Jul 2007 20:10:16 -0000 1.11 >+++ admserv/newinst/src/AdminUtil.pm.in 26 Jul 2007 18:58:22 -0000 >@@ -22,14 +22,14 @@ > @EXPORT = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS > registerManyDSWithConfigDS createSubDSNoConn >- unregisterDSWithConfigDS); >+ unregisterDSWithConfigDS isConfigDS); > @EXPORT_OK = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS > registerManyDSWithConfigDS createSubDSNoConn >- unregisterDSWithConfigDS); >+ unregisterDSWithConfigDS isConfigDS); > > # load perldap > use Mozilla::LDAP::Conn; > use Mozilla::LDAP::Utils qw(normalizeDN); >@@ -129,8 +129,21 @@ > # for now, same as admin server config dir > return "$configdir/admin-serv"; > } > >+sub isConfigDS { >+ my $inst = shift; >+ my $configdir = shift; >+ my $admConf = getAdmConf ($configdir); >+ my $ldapstart = $admConf->{ldapStart}; >+ my $expected = $inst . "/start-slapd"; >+ if ( "$ldapstart" eq "$expected" ) { >+ return 1; >+ } else { >+ return 0; >+ } >+} >+ > sub getConfigDSConn { > my $url = shift; > my $id = shift; > my $pwd = shift; >@@ -228,8 +241,12 @@ > $inf->{slapd}->{ServerPort}, > $inf->{slapd}->{RootDN}, > $inf->{slapd}->{RootDNPwd}, > $inf->{General}->{certdir}); >+ if (!$conn) { >+ @{$errs} = ('error_connection_failed'); >+ return 0; >+ } > > # add the NetscapeRoot suffix > @{$errs} = addSuffix($conn, "o=NetscapeRoot", "NetscapeRoot"); > if (@{$errs}) { >@@ -596,8 +613,9 @@ > my $instinf = createInfFromConfig("$configdir/$inst", $inst); > unlink($instinf->{filename}); > $instinf->{General}->{ConfigDirectoryLdapURL} = > $inf->{General}->{ConfigDirectoryLdapURL}; >+ $instinf->{General}->{AdminDomain} = $inf->{General}->{AdminDomain}; > if (!registerDSWithConfigDS($inst, $errs, $instinf, > $conn, $admConf, $configdir)) { > return 0; > } >Index: admserv/newinst/src/ConfigDSDialogs.pm >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/ConfigDSDialogs.pm,v >retrieving revision 1.5 >diff -t -w -U4 -r1.5 ConfigDSDialogs.pm >--- admserv/newinst/src/ConfigDSDialogs.pm 24 Jul 2007 20:10:16 -0000 1.5 >+++ admserv/newinst/src/ConfigDSDialogs.pm 26 Jul 2007 18:58:22 -0000 >@@ -166,8 +166,110 @@ > ['dialog_configdsinfo_pwd_prompt', 1], ['dialog_configdsinfo_domain_prompt'], > ['dialog_configdsinfo_ca_prompt'] > ); > >+my $regconfigdsinfo = new Dialog ( >+ $EXPRESS, >+ 'dialog_configdsinfo_text', >+ sub { >+ my $self = shift; >+ my $index = shift; >+ if ($index == 0) { # the url >+ my $url = $self->{manager}->{inf}->{General}->{ConfigDirectoryLdapURL}; >+ if (!defined($url)) { >+ my $host = $self->{manager}->{inf}->{General}->{FullMachineName} || >+ hostfqdn; >+ my $port = $self->{manager}->{inf}->{slapd}->{ServerPort} || 389; >+ if (!portAvailable($port)) { >+ $port = getAvailablePort(); >+ } >+ my $suffix = "o=NetscapeRoot"; >+ $url = "ldap://$host:$port/$suffix"; >+ } >+ return $url; >+ } elsif ($index == 1) { # the id >+ return $self->{manager}->{inf}->{General}->{ConfigDirectoryAdminID} || >+ "admin"; >+ } elsif ($index == 2 || $index == 3) { # the password >+ return undef; >+ } elsif ($index == 4) { # admin domain >+ my $admindomain = $self->{manager}->{inf}->{General}->{AdminDomain}; >+ if (!defined($admindomain)) { >+ $admindomain = $self->{manager}->{inf}->{General}->{FullMachineName} || >+ hostfqdn; >+ $admindomain =~ s/^[^\.]*\.//; # just the domain part >+ } >+ return $admindomain; >+ } else { # the CA cert >+ my $url = $self->{manager}->{inf}->{General}->{ConfigDirectoryLdapURL}; >+ my $cert = $self->{manager}->{inf}->{General}->{CACertificate}; >+ if (($url !~ /^ldaps/) or $self->{manager}->{inf}->{General}->{certdb} or >+ ($cert =~ /^-----BEGIN CERTIFICATE-----/)) { >+ # not using LDAPS, or already have a certdb - hide CA prompt >+ $self->{prompts}->[5]->[2] = 1; >+ } else { >+ $self->{prompts}->[5]->[2] = 0; # unhide CA prompt >+ } >+ return $self->{manager}->{inf}->{General}->{CACertificate}; >+ } >+ }, >+ sub { >+ my $self = shift; >+ my $ans = shift; >+ my $index = shift; >+ >+ my $res = $DialogManager::SAME; >+ if ($index == 0) { >+ # validate URL? >+ $self->{manager}->{inf}->{General}->{ConfigDirectoryLdapURL} = $ans; >+ my $url = $self->{manager}->{inf}->{General}->{ConfigDirectoryLdapURL}; >+ if (($url !~ /^ldaps/) or $self->{manager}->{inf}->{General}->{certdb}) { >+ # not using LDAPS, or already have a certdb - hide CA prompt >+ $self->{prompts}->[5]->[2] = 1; >+ } else { >+ $self->{prompts}->[5]->[2] = 0; # unhide CA prompt >+ } >+ $res = $DialogManager::NEXT; >+ } elsif ($index == 1) { # id >+ $self->{manager}->{inf}->{General}->{ConfigDirectoryAdminID} = $ans; >+ $res = $DialogManager::NEXT; >+ } elsif ($index == 2) { # pwd >+ my $test = $ans; >+ if ($test) { >+ $test =~ s/\s//g; >+ } >+ if (!$ans or (length($test) != length($ans))) { >+ $self->{manager}->alert("dialog_configdsadmin_invalid"); >+ } else { >+ $self->{firstpassword} = $ans; # save for next index >+ $res = $DialogManager::NEXT; >+ } >+ } elsif ($index == 3) { # verify second password >+ if ($ans ne $self->{firstpassword}) { >+ $self->{manager}->alert("dialog_configdsadmin_nomatch"); >+ } else { >+ $self->{manager}->{inf}->{General}->{ConfigDirectoryAdminPwd} = $ans; >+ $res = $DialogManager::NEXT; >+ } >+ } elsif ($index == 4) { # admin domain >+ $self->{manager}->{inf}->{General}->{AdminDomain} = $ans; >+ $res = $DialogManager::NEXT; >+ } else { # CA cert filename >+ if ($ans && length($ans) && >+ ($ans !~ /^-----BEGIN CERTIFICATE-----/) && ! -f $ans) { >+ $self->{manager}->alert("dialog_configdsinfo_ca_error", $ans); >+ } else { >+ $self->{manager}->{inf}->{General}->{CACertificate} = $ans; >+ $res = $DialogManager::NEXT; >+ } >+ } >+ return $res; >+ }, >+ ['dialog_configdsinfo_url_prompt'], ['dialog_configdsinfo_id_prompt'], >+ ['dialog_configdsinfo_pwd_prompt', 1], ['dialog_configdsinfo_pwd2_prompt', 1], >+ ['dialog_configdsinfo_domain_prompt', 0, 0], ['dialog_configdsinfo_ca_prompt'] >+); >+ > my $configdsadmin = new Dialog ( > $EXPRESS, > 'dialog_configdsadmin_text', > sub { >@@ -310,5 +412,9 @@ > sub getDialogs { > return ($useconfigds, $configdsinfo, $configdsadmin, $configdsadmindomain); > } > >+sub getRegDialogs { >+ return ($regconfigdsinfo, $configdsadmindomain); >+} >+ > 1; >Index: admserv/newinst/src/setup-ds-admin.res.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/setup-ds-admin.res.in,v >retrieving revision 1.5 >diff -t -w -U4 -r1.5 setup-ds-admin.res.in >--- admserv/newinst/src/setup-ds-admin.res.in 13 Jul 2007 18:39:15 -0000 1.5 >+++ admserv/newinst/src/setup-ds-admin.res.in 26 Jul 2007 18:58:22 -0000 >@@ -45,8 +45,9 @@ > > dialog_configdsinfo_url_prompt = Configuration directory server URL > dialog_configdsinfo_id_prompt = Configuration directory server admin ID > dialog_configdsinfo_pwd_prompt = Configuration directory server admin password >+dialog_configdsinfo_pwd2_prompt = Configuration directory server admin password (again) > dialog_configdsinfo_domain_prompt = Configuration directory server admin domain > dialog_configdsinfo_ca_prompt = CA certificate filename > dialog_configdsinfo_ca_error = '%s' is not a valid CA certificate file. Please choose another one.\n\n > dialog_configdsinfo_nocacert = You chose to use LDAPS but there is no CA certificate or certificate database. Please chose ldap for the protocol or provide a valid CA certificate.\n\n
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 249739
:
160062
|
160063
|
160064
| 160066 |
160067
|
160068
|
160088