]> code.citadel.org Git - citadel.git/blobdiff - citadel/setup.c
* initiall sieve listing support. authentication works now, we at least answer with...
[citadel.git] / citadel / setup.c
index 82b35f304f5930b3b60062c8bd9ec0ae81f79712..e2c6e644c48775f8d83f4a3ee629dae114a0e853 100644 (file)
@@ -85,7 +85,7 @@ char *setup_text[] = {
 "specify a directory other than the default, you will need to\n"
 "specify the -h flag to the server when you start it up.\n",
 #else
-"Enter the subdirectoryname for an alternating installation of "
+"Enter the subdirectory name for an alternate installation of "
 "Citadel. To do a default installation just leave it blank."
 "If you specify a directory other than the default, you will need to\n"
 "specify the -h flag to the server when you start it up.\n"
@@ -929,13 +929,7 @@ void write_config_to_disk(void)
        FILE *fp;
        int fd;
 
-       if ((fd = creat(
-#ifndef HAVE_ETC_DIR
-                                       "."
-#else
-                                       ETC_DIR
-#endif
-                                       "/citadel.config", S_IRUSR | S_IWUSR)) == -1) {
+       if ((fd = creat(file_citadel_config, S_IRUSR | S_IWUSR)) == -1) {
                display_error("setup: cannot open citadel.config");
                cleanup(1);
        }
@@ -1093,7 +1087,7 @@ int main(int argc, char *argv[])
                fclose(fp);
        }
 
-        /* Check to see if we're running the web installer */
+       /* Check to see if we're running the web installer */
        if (getenv("CITADEL_INSTALLER") != NULL) {
                using_web_installer = 1;
        }
@@ -1142,20 +1136,26 @@ int main(int argc, char *argv[])
 
        home=(setup_directory[1]!='\0');
        relh=home&(setup_directory[1]!='/');
-       if (!relh) safestrncpy(ctdl_home_directory, setup_directory,
-                                                                  sizeof ctdl_home_directory);
-       else
-               safestrncpy(relhome, ctdl_home_directory,
-                                       sizeof relhome);
+       if (!relh) {
+               safestrncpy(ctdl_home_directory, setup_directory, sizeof ctdl_home_directory);
+       }
+       else {
+               safestrncpy(relhome, ctdl_home_directory, sizeof relhome);
+       }
 
        calc_dirs_n_files(relh, home, relhome, ctdldir);
        
        enable_home=(relh|home);
 
-       if ((home) && (chdir(setup_directory) != 0)) {
-               important_message("Citadel Setup",
-                         "The directory you specified does not exist.");
-               cleanup(errno);
+       if (home) {
+               if (chdir(setup_directory) == 0) {
+                       strcpy(file_citadel_config, "./citadel.config");
+               }
+               else {
+                       important_message("Citadel Setup",
+                               "The directory you specified does not exist.");
+                       cleanup(errno);
+               }
        }
 
        /* Determine our host name, in case we need to use it as a default */
@@ -1184,7 +1184,7 @@ int main(int argc, char *argv[])
 
        case UI_TEXT:
                printf("\n\n\n"
-                       "               *** Citadel setup program ***\n\n");
+                       "              *** Citadel setup program ***\n\n");
                break;
 
        }
@@ -1299,6 +1299,8 @@ int main(int argc, char *argv[])
        if (config.c_smtps_port == 0) config.c_smtps_port = 465;
        if (config.c_pop3s_port == 0) config.c_pop3s_port = 995;
        if (config.c_imaps_port == 0) config.c_imaps_port = 993;
+       if (config.c_pftcpdict_port == 0) config.c_pftcpdict_port = -1;
+       if (config.c_managesieve_port == 0) config.c_managesieve_port = -1;
 
        /* Go through a series of dialogs prompting for config info */
        if (setup_type != UI_SILENT) {
@@ -1359,6 +1361,18 @@ NEW_INST:
        chmod(ctdl_image_dir, 0700);
        chown(ctdl_image_dir, config.c_ctdluid, -1);
 
+       mkdir(ctdl_bb_dir, 0700);
+       chmod(ctdl_bb_dir, 0700);
+       chown(ctdl_bb_dir, config.c_ctdluid, -1);
+
+       mkdir(ctdl_file_dir, 0700);
+       chmod(ctdl_file_dir, 0700);
+       chown(ctdl_file_dir, config.c_ctdluid, -1);
+
+       mkdir(ctdl_netcfg_dir, 0700);
+       chmod(ctdl_netcfg_dir, 0700);
+       chown(ctdl_netcfg_dir, config.c_ctdluid, -1);
+
        /* TODO: where to put this? */
        mkdir("netconfigs", 0700);
        chmod("netconfigs", 0700);
@@ -1401,6 +1415,9 @@ NEW_INST:
        disable_other_mta("zimbra");
 #endif
 
+       /* Check for the 'db' nss and offer to disable it */
+       fixnss();
+
        if ((pw = getpwuid(config.c_ctdluid)) == NULL)
                gid = getgid();
        else
@@ -1428,8 +1445,6 @@ NEW_INST:
        sleep(1);
        progress("Setting file permissions", 4, 4);
 
-       fixnss();
-
 #ifdef HAVE_LDAP
        /* Contemplate the possibility of auto-configuring OpenLDAP */
        contemplate_ldap();