Author: rmeggins
Update of /cvs/dirsec/adminserver/admserv/cgi-src40
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24009/adminserver/admserv/cgi-src40
Modified Files:
config.c start_config_ds.c
Log Message:
Resolves: bug 239502
Description: adminserver: autotools, FHS, and many bug fixes
Fix Description: 1) Added the admin.inf file, which contains information about the brand,
product name, vendor, build number, and other information. This gets put in an inf/
subdir of the ds datadir. The update program reads this information and updates the info
in the ISIE and SIE entries. This allows us to remove some of the branded code.
2) We need to set the cgisock path for mod_cgid and mod_restartd.
3) The update program needs to modify some http style conf file parameters. The config
CGI program already does this. I modified the config CGI program so that it could be run
from the command line and modify the parameters that the update program needs.
4) Removed lots of dead code from ux-update.cc. The way it works now is that the config
files are generated at build time, not at install time, so a lot of that logic could be
removed. We still need to update a few parameters at install time - see 3 above.
5) User can specify configdir, securitydir, logdir, and piddir in the setup.inf file at
install time, or can specify environment variables for those, or it will just use the
hardcoded values set at build time. This makes it work like the ds instance creation
code.
Index: config.c
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/config.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- config.c 11 May 2007 19:44:05 -0000 1.9
+++ config.c 15 May 2007 00:30:49 -0000 1.10
@@ -120,6 +120,7 @@
char error_info[128];
char *valsbuf[2];
int setFlag = 0, getFlag = 0, forceSetFlag = 0;
+ int ignorePsetErrors = 0;
AttributeList resultList, updateList, addList, nvl;
AttrNameList nl;
AttributePtr nv;
@@ -145,13 +146,11 @@
/* Get new port number */
if (!method || !*method) {
- /* non UI CGI */
- if (i18nResource)
- rpt_err(SYSTEM_ERROR,
- res_getstring(i18nResource, DBT_NO_METHOD, acceptLanguage,
- msgbuf, sizeof(msgbuf), NULL),
- NULL, NULL);
- else rpt_err(SYSTEM_ERROR, "No method is specified", NULL, NULL);
+ /* run from command line - args are attr=value .... attr=value */
+ /* fake out code below to set */
+ operation = "set";
+ inputs = &argv[1]; /* everything after argv[0] */
+ ignorePsetErrors = 1; /* we don't care about pset errors during install/upgrade
*/
}
else if (!strcmp(method, "GET")) {
/* UI CGI - either upgrade or normal admin CGI */
@@ -249,7 +248,7 @@
/* passwd */ bindpw,
/* errorcode */ &rv);
- if (!pset) {
+ if (!pset && !ignorePsetErrors) {
PR_snprintf(error_info, sizeof(error_info),
"PSET_ERROR_NUMBER: %d\nPSET_ERROR_INFO: %s",
rv,
@@ -264,9 +263,13 @@
/* Process the input */
- inputs = get_input_ptr();
+ if (!inputs) {
+ inputs = get_input_ptr();
+ }
- operation = get_cgi_var("op", NULL, NULL);
+ if (!operation) {
+ operation = get_cgi_var("op", NULL, NULL);
+ }
if (!operation) {
psetDelete(pset);
@@ -586,7 +589,7 @@
errorCode = PSET_OP_OK;
val = psetGetAttrSingleValue(pset, nameptr, &errorCode);
- if (errorCode) {
+ if (errorCode && !ignorePsetErrors) {
if (forceSetFlag)
addSingleValueAttribute(addList, j++, nameptr, valptr);
else j++;
@@ -599,7 +602,7 @@
}
errorCode = PSET_OP_OK;
if (i) errorCode = psetSetAttrList(pset, updateList);
- if (errorCode) {
+ if (errorCode && !ignorePsetErrors) {
psetDelete(pset);
PR_snprintf(error_info, sizeof(error_info),
"PSET_ERROR_NUMBER: %d\nPSET_ERROR_INFO: %s\n",
@@ -619,7 +622,7 @@
errorCode = psetAddAttribute(pset,
addList[i]->attrName,
addList[i]->attrVal);
- if (errorCode) {
+ if (errorCode && !ignorePsetErrors) {
psetDelete(pset);
pset = NULL;
PR_snprintf(error_info, sizeof(error_info),
@@ -811,7 +814,13 @@
"configuration.nsPidLog",
&errorCode);
- if (olduname != NULL && strcmp(olduname, newuname) != 0) {
+ newuid = verify_server_uname(newuname);
+
+ if (newuid < 0) {
+ return -1;
+ } else if (update_conf("console.conf", "User", newuname)) {
+ return -1;
+ } else if ((olduname != NULL) && (strcmp(olduname, newuname) != 0)) {
/* Can change uid only id running as a root */
if (getuid() != 0) {
@@ -820,18 +829,10 @@
NULL,NULL);
}
- newuid = verify_server_uname(newuname);
- if (newuid >= 0) {
- if (change_uid_all(configdir, 0, newuid) || change_uid_all(secdir, 0, newuid) ||
- change_uid_all(logdir, 0, newuid) || (pidfile && change_uid(pidfile, 0,
newuid))) {
- return -1;
- } else {
- return update_conf("console.conf", "User", newuname);
- }
- }
- else {
- return -1;
+ if (change_uid_all(configdir, 0, newuid) || change_uid_all(secdir, 0, newuid) ||
+ change_uid_all(logdir, 0, newuid) || (pidfile && change_uid(pidfile, 0,
newuid))) {
+ return -1;
}
}
@@ -869,7 +870,7 @@
destroyAdmldap(admInfo);
if (!grpname) {
- rpt_err(SYSTEM_ERROR, "sysgropup not found in adm.conf", NULL, NULL);
+ rpt_err(SYSTEM_ERROR, "sysgroup not found in adm.conf", NULL, NULL);
return -1;
}
Index: start_config_ds.c
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/start_config_ds.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- start_config_ds.c 11 May 2007 19:44:05 -0000 1.7
+++ start_config_ds.c 15 May 2007 00:30:49 -0000 1.8
@@ -35,6 +35,7 @@
#include <config.h>
#include <libadminutil/admutil.h>
+#include <libadmin/libadmin.h>
int
error_exit(char *msg)