[Fedora-directory-commits] adminserver/admserv/newinst/src ux-update.cc, 1.17, 1.18

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Mon Dec 12 18:34:22 UTC 2005


Author: nhosoi

Update of /cvs/dirsec/adminserver/admserv/newinst/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5217

Modified Files:
	ux-update.cc 
Log Message:
[175418] Admin Server ns-update crashes if necessary attribute-value is not given 
check if the attribute-value is set or not; if not, issue an error and quit. 



Index: ux-update.cc
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/ux-update.cc,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ux-update.cc	7 Dec 2005 22:11:07 -0000	1.17
+++ ux-update.cc	12 Dec 2005 18:34:14 -0000	1.18
@@ -77,7 +77,7 @@
 
 InstallMode installMode = Interactive;
 InstallInfo *installInfo = NULL;
-InstallInfo *adminInfo = NULL;
+InstallInfo *adminInstallInfo = NULL;
 InstallInfo *dsInfo = NULL;
 char *infoFile = NULL;
 char *logFile = NULL;
@@ -100,7 +100,7 @@
    }
    else
    {
-      printf("ERROR: Administration Server configuration failed. See install.log.\n");
+      printf("ERROR: Administration Server configuration failed.\n");
       installLog->logMessage(FATAL, "Admin", format, arg1, arg2);
    }
    exit(1);
@@ -537,18 +537,31 @@
    char *ss;
 
    chdir(sroot);
+   
+   if (NULL == adminInstallInfo) {
+      fatal_error("Admin Info is not set or invalid.", "", "");
+   }
 
    // Get admin port from installInfo
-   s = adminInfo->get("Port");
+   s = adminInstallInfo->get("Port");
+   if (NULL == s) {
+      fatal_error("InstallInfo: Admin Port \"Port\" is missing.", "", "");
+   }
    port = atoi(s);
 
-   s = adminInfo->get("SysUser");
+   s = adminInstallInfo->get("SysUser");
+   if (NULL == s) {
+      fatal_error("InstallInfo: Admin System User \"SysUser\" is missing.", "", "");
+   }
    strcpy(adminUser, s);
 
-   s = adminInfo->get("ApacheDir");
+   s = adminInstallInfo->get("ApacheDir");
+   if (NULL == s) {
+      fatal_error("InstallInfo: Apache Directory \"ApacheDir\" is missing.", "", "");
+   }
    strcpy(apacheDir, s);
 
-   s = adminInfo->get("ApacheRoot");
+   s = adminInstallInfo->get("ApacheRoot");
    if (!s) {
 	   NSString ar = findApacheRoot(apacheDir);
 	   strcpy(apacheRoot, (const char *)ar);
@@ -565,13 +578,18 @@
    }
 
    s = installInfo->get(SS_USER_ID);
-
+   if (NULL == s) {
+      fatal_error("InstallInfo: Server User \"SuiteSpotUserID\" is missing.", "", "");
+   }
    strcpy(SSuser, s);
 
    s = installInfo->get(SS_GROUP);
+   if (NULL == s) {
+      fatal_error("InstallInfo: Server Group \"SuiteSpotGroup\" is missing.", "", "");
+   }
    strcpy(SSgroup,s);
 
-   s = adminInfo->get("ServerIpAddress");
+   s = adminInstallInfo->get("ServerIpAddress");
    if (s == NULL || s[0] == ' ')
       strcpy(serverAddress, "\0");
    else
@@ -580,6 +598,9 @@
    char *p;
 
    p = strdup(installInfo->get(CONFIG_LDAP_URL));
+   if (NULL == p) {
+      fatal_error("Failed to duplicate %s.", installInfo->get(CONFIG_LDAP_URL), "");
+   }
 
    char *cp;
 
@@ -591,7 +612,7 @@
       free(p);
    }
 
-   s = adminInfo->get("ServerAdminID");
+   s = adminInstallInfo->get("ServerAdminID");
    if (s)
    {
       strcpy(httpuser, s);
@@ -603,7 +624,7 @@
 #endif
       strcpy(httpuser, DEFAULT_ADMINUSER);
    }
-   s = adminInfo->get("ServerAdminPwd");
+   s = adminInstallInfo->get("ServerAdminPwd");
 
    if (s)
    {
@@ -619,7 +640,7 @@
 
 #ifdef ORIGINAL_HOST_IP_QUERIES
    // PVO
-   s = adminInfo->get("HostIpAddress");
+   s = installInfo->get("HostIpAddress");
    strcpy(hosts,s);
 #else
    strcpy(hosts, "*");
@@ -1476,9 +1497,9 @@
    {
       switch (opt)
 	 {
-            case 'r':
-               reConfig = True;
-               break;
+	    case 'r':
+	        reConfig = True;
+	        break;
 	    case 's':
 	       installMode = Silent;
 	       break;
@@ -1505,9 +1526,10 @@
 
    if (infoFile == NULL || installInfo == NULL ||
        installInfo->isEmpty() == True ||
-       (adminInfo = installInfo->getSection("admin")) == NULL)
+       (adminInstallInfo = installInfo->getSection("admin")) == NULL)
    {
-      printf("ERROR: Answer cache not found or invalid\n");
+      installLog->logMessage(FATAL, "Admin", "Answer cache (admin section) not found or invalid.");
+      printf("ERROR: Answer cache (admin section) not found or invalid.\n");
       exit(1);
    }
 
@@ -1515,14 +1537,14 @@
    {
       if (infoFile == NULL || (stat(infoFile, &fi) == -1))
       {
-	 installLog->logMessage(FATAL, "Admin", "Installation script not found");
-	 printf("ERROR:Installation script not found.\n");
-	 exit(1);
+        installLog->logMessage(FATAL, "Admin", "Installation script not found");
+        printf("ERROR:Installation script not found.\n");
+        exit(1);
       }
       else
       {
-         // PVO - why ???
-	 installInfo = new InstallInfo (infoFile);
+        // PVO - why ???
+        installInfo = new InstallInfo (infoFile);
       }
 
    }
@@ -1559,11 +1581,19 @@
    }
 
    sroot = installInfo->get(SERVER_ROOT);
+   if (NULL == sroot) {
+      fatal_error("InstallInfo: Server Root \"ServerRoot\" is missing.", "", "");
+   }
 
    /*
     * Get the full hostname.
     */
-   strcpy(hn,installInfo->get(MACHINE_NAME));
+   const char *machine_name;
+   machine_name = installInfo->get(MACHINE_NAME);
+   if (NULL == machine_name) {
+      fatal_error("InstallInfo: Hostname \"FullMachineName\" is missing.", "", "");
+   }
+   strcpy(hn, machine_name);
 
    cleanup_after_upgrade(sroot);
 




More information about the Fedora-directory-commits mailing list