Author: rmeggins
Update of /cvs/dirsec/setuputil/installer/unix/lib
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv592/setuputil/installer/unix/lib
Modified Files:
ux-util.cc ux-util.h ux-wrapper.cc
Log Message:
Resolves: bug 239494
Description: setuputil: use adm.conf instead of dbswitch.conf, ldap.conf, etc.
Fix Description: We only really need one config file - adm.conf - so just add extra fields
as necessary.
Reviewed by: nhosoi (Thanks!)
Index: ux-util.cc
===================================================================
RCS file: /cvs/dirsec/setuputil/installer/unix/lib/ux-util.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ux-util.cc 23 Mar 2006 15:59:22 -0000 1.2
+++ ux-util.cc 9 May 2007 00:27:48 -0000 1.3
@@ -27,6 +27,12 @@
** UNIX Only
** HISTORY:
** $Log$
+** Revision 1.3 2007/05/09 00:27:48 rmeggins
+** Resolves: bug 239494
+** Description: setuputil: use adm.conf instead of dbswitch.conf, ldap.conf, etc.
+** Fix Description: We only really need one config file - adm.conf - so just add extra
fields as necessary.
+** Reviewed by: nhosoi (Thanks!)
+**
** Revision 1.2 2006/03/23 15:59:22 rmeggins
** Bug(s) fixed: 186280
** Bug Description: Close potential security vulnerabilities in CGI code
@@ -279,45 +285,6 @@
/*********************************************************************
**
-** FUNCTION: getDefaultHostname
-** DESCRIPTION:
-** Get the default hostname as previously configured.
-**
-** INPUTS: hn - input buffer
-** OUTPUTS: hn - host name, if found
-** RETURN: 0 (good), -1 (failure)
-** SIDE EFFECTS:
-** None
-** RESTRICTIONS:
-** None
-** MEMORY:
-** hn is expected to point to a valid memory location.
-**********************************************************************
-*/
-
-NSString
-InstUtil::getDefaultHostName(const char *sroot)
-{
- char tstr[BIG_BUF];
- NSString hn;
- NVPair *admconf;
-
- snprintf(tstr, sizeof(tstr), "%s/%s", sroot, DEFAULT_ADMINCONF);
- tstr[sizeof(tstr)-1] = 0;
-
- admconf = new NVPair(tstr);
-
- if (admconf->isEmpty() == False)
- {
- hn = admconf->get("ServerName");
- }
-
- delete admconf;
- return hn;
-}
-
-/*********************************************************************
-**
** FUNCTION: getHostIpAddress
** DESCRIPTION:
** Get the IP address associated with a given host name
@@ -364,7 +331,7 @@
** Tries to get the SuiteSpot User ID previously configured
** for the existing installation.
**
-** INPUTS: sroot - server root
+** INPUTS: CONFIGDIR - directory path containing the config file DEFAULT_ADMINCONF
** OUTPUTS:
** RETURN: ssUser
** SIDE EFFECTS:
@@ -372,29 +339,28 @@
** RESTRICTIONS:
** None
** MEMORY:
-** ssUser and ssGroup are expected to point to valid memory buf.
+** temp stack NSString is returned
**********************************************************************
*/
NSString
-InstUtil::getDefaultUser(const char *sroot)
+InstUtil::getDefaultUser(const char *configdir)
{
char tstr[BIG_BUF];
- NVPair *ssconf;
+ NVPair admconf;
NSString ssUser;
- snprintf(tstr, sizeof(tstr), "%s/%s", sroot, DEFAULT_SSUSERCONF);
+ snprintf(tstr, sizeof(tstr), "%s/%s", configdir, DEFAULT_ADMINCONF);
tstr[sizeof(tstr)-1] = 0;
- ssconf = new NVPair(tstr);
+ admconf.setFormat(2);
+ admconf.read(tstr);
- if (ssconf->isEmpty() == False)
+ if (admconf.isEmpty() == False)
{
- ssUser = ssconf->get("SuiteSpotUser");
+ ssUser = admconf.get("sysuser");
}
- delete ssconf;
-
return ssUser;
}
@@ -405,7 +371,7 @@
** Tries to get the SuiteSpot User ID previously configured
** for the existing installation.
**
-** INPUTS: sroot - server root
+** INPUTS: CONFIGDIR - directory path containing the config file DEFAULT_ADMINCONF
** OUTPUTS:
** RETURN: default Group
** SIDE EFFECTS:
@@ -413,69 +379,31 @@
** RESTRICTIONS:
** None
** MEMORY:
-**
+** temp stack NSString is returned
**********************************************************************
*/
NSString
-InstUtil::getDefaultGroup(const char *sroot)
+InstUtil::getDefaultGroup(const char *configdir)
{
char tstr[BIG_BUF];
- NVPair *ssconf;
+ NVPair admconf;
NSString ssGroup;
- snprintf(tstr, sizeof(tstr), "%s/%s", sroot, DEFAULT_SSUSERCONF);
+ snprintf(tstr, sizeof(tstr), "%s/%s", configdir, DEFAULT_ADMINCONF);
tstr[sizeof(tstr)-1] = 0;
- ssconf = new NVPair(tstr);
+ admconf.setFormat(2);
+ admconf.read(tstr);
- if (ssconf->isEmpty() == False)
+ if (admconf.isEmpty() == False)
{
- ssGroup = ssconf->get("SuiteSpotGroup");
+ ssGroup = admconf.get("sysgroup");
}
- delete ssconf;
-
return ssGroup;
}
-/*********************************************************************
-**
-** FUNCTION: getAdmPwd
-** DESCRIPTION:
-**
-**
-**
-** INPUTS:
-** OUTPUTS:
-** RETURN:
-** SIDE EFFECTS:
-** none
-** RESTRICTIONS:
-** None
-** MEMORY:
-**
-**********************************************************************
-*/
-NSString
-InstUtil::getAdmPwd(const char *serverRoot)
-{
- char temp[BIG_BUF];
- NVPair admpw;
- const char *pwd = NULL;
-
- snprintf(temp, sizeof(temp), "%s/admin-serv/config/adm.conf", serverRoot);
- temp[sizeof(temp)-1] = 0;
- admpw.setFormat(2);
-
- admpw.read(temp);
- pwd = admpw.get("siepid");
-
- return pwd;
-}
-
-
-
/*********************************************************************
**
Index: ux-util.h
===================================================================
RCS file: /cvs/dirsec/setuputil/installer/unix/lib/ux-util.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- ux-util.h 29 Jul 2005 22:16:33 -0000 1.1.1.1
+++ ux-util.h 9 May 2007 00:27:48 -0000 1.2
@@ -27,6 +27,12 @@
** HISTORY
**
** $Log$
+** Revision 1.2 2007/05/09 00:27:48 rmeggins
+** Resolves: bug 239494
+** Description: setuputil: use adm.conf instead of dbswitch.conf, ldap.conf, etc.
+** Fix Description: We only really need one config file - adm.conf - so just add extra
fields as necessary.
+** Reviewed by: nhosoi (Thanks!)
+**
** Revision 1.1.1.1 2005/07/29 22:16:33 foxworth
** Importing new setup sdk for open source project
**
@@ -161,10 +167,10 @@
* Giving a server root, get the default Ldap information
*/
extern void getDefaultLdapInfo (
- const char *sroot,
- char **ldapURL,
- char **ldapUser,
- char **installDN);
+ const char *configdir, /* dir containing DEFAULT_ADMINCONF */
+ char **ldapURL, /* config DS url */
+ char **ldapUser, /* uid of console/adminserver admin */
+ char **admin_domain); /* admin domain */
void unescape_ldap_basedn(char *str);
@@ -190,8 +196,8 @@
extern int availUser(const char *user);
extern int availGroup(const char *user, const char *group);
extern char *getDefaultHostName(const char *sroot);
-extern char *getDefaultUser(const char *sroot);
-extern char *getDefaultGroup(const char *sroot);
+extern char *getDefaultUser(const char *configdir);
+extern char *getDefaultGroup(const char *configdir);
extern char *getSysVersion();
extern char *getCurrentDir(void);
extern Bool dirWritable(const char *dirName);
@@ -353,28 +359,6 @@
/*
* MEMBER:
- * InstUtil::getDefaultHostName
- * DESCRIPTION:
- * Giving a server root, get the configured FQDN of my machine
- *
- * INPUTS:
- *
- * OUTPUTS:
- *
- * RETURN:
- *
- * EXCEPTION THROWN
- *
- * RESTRICTIONS:
- *
- * MEMORY:
- *
- */
-
- static NSString getDefaultHostName(const char *sroot);
-
- /*
- * MEMBER:
* InstUtil::getHostIpAddress
* DESCRIPTION:
* Giving a host name, get the associated IP address.
@@ -398,8 +382,8 @@
* InstUtil::getDefaultUser
* InstUtil::getDefaultGroup
* DESCRIPTION:
- * Giving a server root, get the configured UNIX user ID/group
- * to run servers as.
+ * Giving the directory path containing the file DEFAULT_ADMINCONF
+ * get the configured UNIX user ID/group to run servers as.
* INPUTS:
*
* OUTPUTS:
@@ -414,30 +398,8 @@
*
*/
- static NSString getDefaultUser(const char *sroot);
- static NSString getDefaultGroup (const char *sroot);
-
- /*
- * MEMBER:
- * InstUtil::getAdmPwd
- * DESCRIPTION:
- * Giving a server root, get the Admin's password that
- * could be used to authenticate with DS
- * INPUTS:
- * server root
- * OUTPUTS:
- * Admin's password
- * RETURN:
- * the admin's password (allocated)
- * EXCEPTION THROWN
- *
- * RESTRICTIONS:
- *
- * MEMORY:
- *
- */
-
- static NSString getAdmPwd(const char *sroot);
+ static NSString getDefaultUser(const char *configdir);
+ static NSString getDefaultGroup (const char *configdir);
/*
* MEMBER:
Index: ux-wrapper.cc
===================================================================
RCS file: /cvs/dirsec/setuputil/installer/unix/lib/ux-wrapper.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ux-wrapper.cc 30 Mar 2006 00:38:29 -0000 1.3
+++ ux-wrapper.cc 9 May 2007 00:27:48 -0000 1.4
@@ -29,6 +29,12 @@
** HISTORY:
**
** $Log$
+** Revision 1.4 2007/05/09 00:27:48 rmeggins
+** Resolves: bug 239494
+** Description: setuputil: use adm.conf instead of dbswitch.conf, ldap.conf, etc.
+** Fix Description: We only really need one config file - adm.conf - so just add extra
fields as necessary.
+** Reviewed by: nhosoi (Thanks!)
+**
** Revision 1.3 2006/03/30 00:38:29 rmeggins
** Add using namespace std; after the include <iostream>
** Remove #include <iostream.h> in files that also include nsdefs.h
@@ -121,21 +127,15 @@
return strdup(sysVersion.data());
}
-char *getDefaultHostName(const char *sroot)
-{
- NSString hn = InstUtil::getDefaultHostName(sroot);
- return strdup(hn.data());
-}
-
-char *getDefaultUser(const char *sroot)
+char *getDefaultUser(const char *configdir)
{
- NSString us = InstUtil::getDefaultUser(sroot);
+ NSString us = InstUtil::getDefaultUser(configdir);
return strdup(us.data());
}
-char *getDefaultGroup(const char *sroot)
+char *getDefaultGroup(const char *configdir)
{
- NSString ug = InstUtil::getDefaultGroup(sroot);
+ NSString ug = InstUtil::getDefaultGroup(configdir);
return strdup(ug.data());
}
char *getCurrentDir(void)