[389-devel] Please Review: Fix parsing of start-slapd scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The admin server CGIs parse the start-slapd scripts to determine the DS instance names. A recent format change to start-slapd caused this parsing to break. These patches make the instance name easier to parse from the script. One patch is for DS itself and one is for the Admin Server.

-NGK
>From c0a27702f9fce2828a9f695c5f985d6ddbd79614 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@xxxxxxxxxx>
Date: Wed, 31 Mar 2010 16:07:40 -0700
Subject: [PATCH] Allow instance name to be parsed from start-slapd

The admin server CGIs need to be able to easily parse the
instance name from the start-slapd script.  Recent format
changes have caused the existing parsing to break, so this
patch makes the parsing of the instance name easier.
---
 ldap/admin/src/scripts/template-start-slapd.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ldap/admin/src/scripts/template-start-slapd.in b/ldap/admin/src/scripts/template-start-slapd.in
index 444a37f..0c9ac63 100755
--- a/ldap/admin/src/scripts/template-start-slapd.in
+++ b/ldap/admin/src/scripts/template-start-slapd.in
@@ -5,6 +5,7 @@
 #       0: Server started successfully
 #       1: Server could not be started
 #       2: Server already running
+INSTANCE={{SERV-ID}}
 
-@sbindir@/start-dirsrv -d {{INITCONFIG-DIR}} {{SERV-ID}} "$@"
+@sbindir@/start-dirsrv -d {{INITCONFIG-DIR}} $INSTANCE "$@"
 exit $?
-- 
1.6.2.5

>From 12a4b6be267519edb3f1c28ea726e210c4b99bd0 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@xxxxxxxxxx>
Date: Wed, 31 Mar 2010 16:11:16 -0700
Subject: [PATCH] Change parsing of start-slapd for instance name

The format of start-slapd changed recently, causing the
parsing of the instance name from that script in the CGIs
to break.  This corrects the parsing.
---
 lib/libdsa/dsalib_location.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/libdsa/dsalib_location.c b/lib/libdsa/dsalib_location.c
index 8cccd0f..7b4bfff 100644
--- a/lib/libdsa/dsalib_location.c
+++ b/lib/libdsa/dsalib_location.c
@@ -110,13 +110,10 @@ ds_get_run_dir()
         fp = fopen(start_script, "r");
         if (fp) {
             while(fgets(line, BIG_LINE, fp)) {
-                /* Find the line that calls start-dirsrv */
-                if ((start = strstr(line, "start-dirsrv"))) {
+                /* Find the line with the instance name */
+                if ((start = strstr(line, "INSTANCE"))) {
                     /* skip any spaces after start-dirsrv */
-                    start += strlen("start-dirsrv");
-                    while (isspace(*start)) {
-                        start++;
-                    }
+                    start += strlen("INSTANCE=");
 
                     /* find the end of the instance name */
                     p = start;
@@ -128,6 +125,8 @@ ds_get_run_dir()
                     if (strlen(start) > 0) {
                         inst_name = PR_smprintf("%s", start);
                     }
+
+                    break;
                 }
             }
             fclose(fp);
-- 
1.6.2.5

--
389-devel mailing list
389-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/389-devel

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux