*
*/
+#include "ctdl_module.h"
+
+
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <execinfo.h>
#endif
+#ifdef ENABLE_NLS
+#ifdef HAVE_XLOCALE_H
+#include <xlocale.h>
+#endif
+#include <libintl.h>
+#include <locale.h>
+#define _(string) gettext(string)
+#else
+#define _(string) (string)
+#endif
+
#define MAXSETUP 11 /* How many setup questions to ask */
#define PROTO_NAME "tcp"
#define NSSCONF "/etc/nsswitch.conf"
+
+typedef enum _SetupStep {
+ eSysAdminName = 1,
+ eSysAdminPW = 2,
+ eUID = 3,
+ eIP_ADDR = 4,
+ eCTDL_Port = 5,
+ eAuthType = 6,
+ eLDAP_Host = 7,
+ eLDAP_Port = 8,
+ eLDAP_Base_DN = 9,
+ eLDAP_Bind_DN =10,
+ eLDAP_Bind_PW =11
+} eSteupStep;
+
+
int setup_type;
char setup_directory[PATH_MAX];
int using_web_installer = 0;
void important_message(char *title, char *msgtext)
{
char buf[SIZ];
+ int rv;
switch (setup_type) {
sprintf(buf, "exec %s --msgbox '%s' 19 72",
getenv("CTDL_DIALOG"),
msgtext);
- system(buf);
+ rv = system(buf);
break;
case UI_SILENT:
fprintf(stderr, "%s\n", msgtext);
char buf[1024];
char outfilename[32];
int changes_made = 0;
+ int rv;
/* Determine the fully qualified path name of citserver */
snprintf(looking_for,
while (fgets(buf, sizeof buf, infp) != NULL) {
if (strstr(buf, looking_for) != NULL) {
- fwrite("#", 1, 1, outfp);
+ rv = fwrite("#", 1, 1, outfp);
++changes_made;
}
- fwrite(buf, strlen(buf), 1, outfp);
+ rv = fwrite(buf, strlen(buf), 1, outfp);
}
fclose(infp);
if (changes_made) {
sprintf(buf, "/bin/mv -f %s /etc/inittab 2>/dev/null", outfilename);
- system(buf);
- system("/sbin/init q 2>/dev/null");
+ rv = system(buf);
+ rv = system("/sbin/init q 2>/dev/null");
}
else {
unlink(outfilename);
FILE *fp;
char *initfile = "/etc/init.d/citadel";
char command[SIZ];
+ int rv;
if ((stat("/etc/init.d/", &etcinitd) == -1) &&
(errno == ENOENT))
chmod(initfile, 0755);
/* Set up the run levels. */
- system("/bin/rm -f /etc/rc?.d/[SK]??citadel 2>/dev/null");
+ rv = system("/bin/rm -f /etc/rc?.d/[SK]??citadel 2>/dev/null");
snprintf(command, sizeof(command), "for x in 2 3 4 5 ; do [ -d /etc/rc$x.d ] && ln -s %s /etc/rc$x.d/S79citadel ; done 2>/dev/null", initfile);
- system(command);
+ rv = system(command);
snprintf(command, sizeof(command),"for x in 0 6 S; do [ -d /etc/rc$x.d ] && ln -s %s /etc/rc$x.d/K30citadel ; done 2>/dev/null", initfile);
- system(command);
+ rv = system(command);
}
FILE *fp;
char buf[SIZ];
int already_citadel = 0;
+ int rv;
fp = fopen(filename, "r+");
if (fp == NULL) return; /* Not there. Oh well... */
fclose(fp);
/* Now try to restart the service */
- system("/etc/init.d/xinetd restart >/dev/null 2>&1");
+ rv = system("/etc/init.d/xinetd restart >/dev/null 2>&1");
}
char buf[SIZ];
FILE *fp;
int lines = 0;
+ int rv;
sprintf(buf, "/bin/ls -l /etc/rc*.d/S*%s 2>/dev/null; "
"/bin/ls -l /etc/rc.d/rc*.d/S*%s 2>/dev/null",
sprintf(buf, "for x in /etc/rc*.d/S*%s; do mv $x `echo $x |sed s/S/K/g`; done >/dev/null 2>&1", mta);
- system(buf);
+ rv = system(buf);
sprintf(buf, "/etc/init.d/%s stop >/dev/null 2>&1", mta);
- system(buf);
+ rv = system(buf);
}
char setupmsg[SIZ];
char dialog_result[PATH_MAX];
FILE *fp = NULL;
+ int rv;
strcpy(setupmsg, "");
prompt_text,
str,
dialog_result);
- system(buf);
+ rv = system(buf);
fp = fopen(dialog_result, "r");
if (fp != NULL) {
if (fgets(str, sizeof buf, fp)) {
switch (curr) {
- case 1:
+ case eSysAdminName:
if (setup_type == UI_SILENT)
{
if (getenv("SYSADMIN_NAME")) {
}
break;
- case 2:
+ case eSysAdminPW:
if (setup_type == UI_SILENT)
{
if (getenv("SYSADMIN_PW")) {
}
break;
- case 3:
+ case eUID:
if (setup_type == UI_SILENT)
{
if (getenv("CITADEL_UID")) {
}
break;
- case 4:
+ case eIP_ADDR:
if (setup_type == UI_SILENT)
{
if (getenv("IP_ADDR")) {
}
break;
- case 5:
+ case eCTDL_Port:
if (setup_type == UI_SILENT)
{
if (getenv("CITADEL_PORT")) {
}
break;
- case 6:
+ case eAuthType:
if (setup_type == UI_SILENT)
{
const char *auth;
}
break;
- case 7:
+ case eLDAP_Host:
if (setup_type == UI_SILENT)
{
if (getenv("LDAP_HOST")) {
}
break;
- case 8:
+ case eLDAP_Port:
if (setup_type == UI_SILENT)
{
if (getenv("LDAP_PORT")) {
}
else
{
+ if (config.c_ldap_port == 0) {
+ config.c_ldap_port = 389;
+ }
set_int_val(curr, &config.c_ldap_port);
}
break;
- case 9:
+ case eLDAP_Base_DN:
if (setup_type == UI_SILENT)
{
if (getenv("LDAP_BASE_DN")) {
}
break;
- case 10:
+ case eLDAP_Bind_DN:
if (setup_type == UI_SILENT)
{
if (getenv("LDAP_BIND_DN")) {
}
break;
- case 11:
+ case eLDAP_Bind_PW:
if (setup_type == UI_SILENT)
{
if (getenv("LDAP_BIND_PW")) {
{
FILE *fp;
int fd;
+ int rv;
if ((fd = creat(file_citadel_config, S_IRUSR | S_IWUSR)) == -1) {
display_error("setup: cannot open citadel.config");
display_error("setup: cannot open citadel.config");
cleanup(1);
}
- fwrite((char *) &config, sizeof(struct config), 1, fp);
+ rv = fwrite((char *) &config, sizeof(struct config), 1, fp);
fclose(fp);
}
int changed = 0;
int file_changed = 0;
char new_filename[64];
+ int rv;
fp_read = fopen(NSSCONF, "r");
if (fp_read == NULL) {
if (yesno(question, 1)) {
sprintf(buf, "/bin/mv -f %s %s", new_filename, NSSCONF);
- system(buf);
+ rv = system(buf);
chmod(NSSCONF, 0644);
}
unlink(new_filename);