From 669ff8aba0ce98da1fa9787b4917969cc6fc1e25 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 27 Dec 2021 14:27:08 -0500 Subject: [PATCH] Removed the obsolete 'setup' utility. It is not used by any currently supported installation method. Removed the unfinished 'setup wizard'. Removed the unused 'tests' directory. --- webcit/Makefile.in | 12 +- webcit/auth.c | 38 +- webcit/configure.ac | 2 +- webcit/setup.c | 765 ------------------------------------- webcit/setup_wizard.c | 53 --- webcit/tests/.gitignore | 4 - webcit/tests/Makefile.in | 139 ------- webcit/tests/test_main.c | 232 ----------- webcit/tests/test_tools.c | 322 ---------------- webcit/tests/webcit_test.h | 15 - webcit/webcit.h | 2 - webcit/webserver.c | 34 +- 12 files changed, 18 insertions(+), 1600 deletions(-) delete mode 100644 webcit/setup.c delete mode 100644 webcit/setup_wizard.c delete mode 100644 webcit/tests/.gitignore delete mode 100644 webcit/tests/Makefile.in delete mode 100644 webcit/tests/test_main.c delete mode 100644 webcit/tests/test_tools.c delete mode 100644 webcit/tests/webcit_test.h diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 394f880b2..f6b2f361e 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -23,7 +23,7 @@ HEADERS=calendar.h dav.h messages.h modules_init.h paramhandling.h preferen # End of configuration section -all: buildinfo all-progs-recursive webcit setup +all: buildinfo all-progs-recursive webcit buildinfo: echo @@ -40,7 +40,7 @@ mkdir-init: .SUFFIXES: .cpp .c .o clean: - rm -f *.o webcit webcit setup + rm -f *.o webcit webcit rm -fr locale/* distclean: clean @@ -49,10 +49,6 @@ distclean: clean ical_maps.c \ $(srcdir)/TAGS -setup: setup.o gettext.o - $(CC) $(LDFLAGS) $(LIBOBJS) gettext.o setup.o -o setup \ - $(LIBS) $(SETUP_LIBS) - webcit: webserver.o context_loop.o ical_dezonify.o \ cookie_conversion.o locate_host.o summary.o \ webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o marchlist.o \ @@ -65,7 +61,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \ availability.o iconbar.o icontheme.o crypto.o inetconf.o notes.o wiki.o \ dav_main.o dav_get.o dav_propfind.o dav_report.o fmt_date.o \ dav_options.o autocompletion.o gettext.o tabs.o sieve.o sitemap.o \ - dav_delete.o dav_put.o http_datestring.o setup_wizard.o \ + dav_delete.o dav_put.o http_datestring.o \ downloads.o addressbook_popup.o pushemail.o sysdep.o openid.o \ decode.o modules_init.o paramhandling.o utils.o \ ical_maps.o ical_subst.o static.o feed_generator.o \ @@ -83,7 +79,7 @@ webcit: webserver.o context_loop.o ical_dezonify.o \ availability.o ical_dezonify.o iconbar.o icontheme.o crypto.o inetconf.o notes.o \ dav_main.o dav_get.o dav_propfind.o dav_report.o dav_delete.o \ dav_options.o autocompletion.o tabs.o smtpqueue.o sieve.o sitemap.o \ - dav_put.o http_datestring.o setup_wizard.o fmt_date.o modules_init.o \ + dav_put.o http_datestring.o fmt_date.o modules_init.o \ gettext.o downloads.o addressbook_popup.o pushemail.o sysdep.o decode.o \ paramhandling.o utils.o ical_maps.o ical_subst.o static.o feed_generator.o \ $(LIBS) diff --git a/webcit/auth.c b/webcit/auth.c index c6ee328e4..f63b78f6d 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -409,45 +409,9 @@ void finalize_openid_login(void) /* * Display a welcome screen to the user. - * - * If this is the first time login, and the web based setup is enabled, - * lead the user through the setup routines */ -void do_welcome(void) -{ +void do_welcome(void) { StrBuf *Buf; -#ifdef XXX_NOT_FINISHED_YET_XXX - FILE *fp; - int i; - - /** - * See if we have to run the first-time setup wizard - */ - if (WC->is_aide) { - if (!setup_wizard) { - int len; - sprintf(wizard_filename, "setupwiz.%s.%s", - abs(HashLittle(ctdlhost, strlen(ctdlhost))), - abs(HashLittle(ctdlport, strlen(ctdlport))) - ); - - fp = fopen(wizard_filename, "r"); - if (fp != NULL) { - fgets(buf, sizeof buf, fp); - buf[strlen(buf)-1] = 0; - fclose(fp); - if (atoi(buf) == serv_info.serv_rev_level) { - setup_wizard = 1; /* already run */ - } - } - } - - if (!setup_wizard) { - http_redirect("setup_wizard"); - } - } -#endif - /* * Go to the user's preferred start page */ diff --git a/webcit/configure.ac b/webcit/configure.ac index 8798e8962..88644475f 100644 --- a/webcit/configure.ac +++ b/webcit/configure.ac @@ -577,7 +577,7 @@ if test "$abs_srcdir" != "$abs_builddir"; then CFLAGS="$CFLAGS -I $abs_builddir" fi AC_CONFIG_HEADER(sysdep.h) -AC_OUTPUT(Makefile po/webcit/Makefile tests/Makefile) +AC_OUTPUT(Makefile po/webcit/Makefile) if test "$abs_srcdir" != "$abs_builddir"; then ln -s $abs_srcdir/static $abs_builddir diff --git a/webcit/setup.c b/webcit/setup.c deleted file mode 100644 index ebac8d2ca..000000000 --- a/webcit/setup.c +++ /dev/null @@ -1,765 +0,0 @@ -/* - * WebCit setup utility - * - * (This is basically just an install wizard. It's not required.) - */ - -#include "sysdep.h" -#include "webcit.h" -#include "webserver.h" - - -#define UI_TEXT 0 /* Default setup type -- text only */ -#define UI_DIALOG 2 /* Use the 'dialog' program */ -#define UI_SILENT 3 /* Silent running, for use in scripts */ - -int setup_type; -char setup_directory[SIZ]; -int using_web_installer = 0; -char suggested_url[SIZ]; - -/* some copies... -int syslog(int loglevel, const char *format, ...){return 0;} */ -void wc_printf(const char *format,...){} - -void RegisterNS(const char *NSName, long len, - int nMinArgs, - int nMaxArgs, - WCHandlerFunc HandlerFunc, - WCPreevalFunc PreEvalFunc, - int ContextRequired){} -void StrBufAppendTemplateStr(StrBuf *Target, - WCTemplputParams *TP, - const char *Source, - int FormatTypeIndex){} -void RegisterHeaderHandler(const char *Name, long Len, Header_Evaluator F){} -pthread_key_t MyConKey; - -#ifdef ENABLE_NLS - -#ifdef HAVE_USELOCALE -int localeoffset = 1; -#else -int localeoffset = 0; -#endif - -#endif -/* - * Delete an entry from /etc/inittab - */ -void delete_init_entry(char *which_entry) -{ - char *inittab = NULL; - FILE *fp; - char buf[SIZ]; - char entry[SIZ]; - char levels[SIZ]; - char state[SIZ]; - char prog[SIZ]; - - inittab = strdup(""); - if (inittab == NULL) return; - - fp = fopen("/etc/inittab", "r"); - if (fp == NULL) return; - - while(fgets(buf, sizeof buf, fp) != NULL) { - - if (num_tokens(buf, ':') == 4) { - extract_token(entry, buf, 0, ':', sizeof entry); - extract_token(levels, buf, 1, ':', sizeof levels); - extract_token(state, buf, 2, ':', sizeof state); - extract_token(prog, buf, 3, ':', sizeof prog); /* includes 0x0a LF */ - - if (!strcmp(entry, which_entry)) { - strcpy(state, "off"); /* disable it */ - } - } - - inittab = realloc(inittab, strlen(inittab) + strlen(buf) + 2); - if (inittab == NULL) { - fclose(fp); - return; - } - - strcat(inittab, buf); - } - fclose(fp); - fp = fopen("/etc/inittab", "w"); - if (fp != NULL) { - fwrite(inittab, strlen(inittab), 1, fp); - fclose(fp); - kill(1, SIGHUP); /* Tell init to re-read /etc/inittab */ - } - free(inittab); -} - - - - -/* - * Remove any /etc/inittab entries for webcit, because we don't - * start it that way anymore. - */ -void delete_the_old_way(void) { - FILE *infp; - char buf[1024]; - char looking_for[1024]; - int have_entry = 0; - char entry[1024]; - char prog[1024]; - char init_entry[1024]; - - - strcpy(init_entry, ""); - - /* Determine the fully qualified path name of webcit */ - snprintf(looking_for, sizeof looking_for, "%s/webcit ", setup_directory); - - /* Pound through /etc/inittab line by line. Set have_entry to 1 if - * an entry is found which we believe starts webcit. - */ - infp = fopen("/etc/inittab", "r"); - if (infp == NULL) { - return; - } else { - while (fgets(buf, sizeof buf, infp) != NULL) { - buf[strlen(buf) - 1] = 0; - extract_token(entry, buf, 0, ':', sizeof entry); - extract_token(prog, buf, 3, ':', sizeof prog); - if (!strncasecmp(prog, looking_for, - strlen(looking_for))) { - ++have_entry; - strcpy(init_entry, entry); - } - } - fclose(infp); - } - - /* Bail out if there's nothing to do. */ - if (!have_entry) return; - - delete_init_entry(init_entry); -} - - - -void cleanup(int exitcode) -{ - exit(exitcode); -} - - - -void title(char *text) -{ - if (setup_type == UI_TEXT) { - printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<%s>\n", text); - } -} - - - - -int yesno(char *question, int default_value) -{ - int i = 0; - int answer = 0; - char buf[SIZ] = ""; - - switch (setup_type) { - - case UI_TEXT: - do { - printf("%s\nYes/No [%s] --> ", - question, - ( default_value ? "Yes" : "No" ) - ); - if (fgets(buf, sizeof buf, stdin)) - { - answer = tolower(buf[0]); - if ((buf[0]==0) || (buf[0]==13) || (buf[0]==10)) - answer = default_value; - else if (answer == 'y') - answer = 1; - else if (answer == 'n') - answer = 0; - } - - } while ((answer < 0) || (answer > 1)); - break; - - case UI_DIALOG: - sprintf(buf, "exec %s %s --yesno '%s' 15 75", - getenv("CTDL_DIALOG"), - ( default_value ? "" : "--defaultno" ), - question); - i = system(buf); - if (i == 0) { - answer = 1; - } - else { - answer = 0; - } - break; - - } - return (answer); -} - - - - -void set_value(char *prompt, char str[]) -{ - char buf[SIZ] = ""; - char dialog_result[PATH_MAX]; - char setupmsg[SIZ]; - FILE *fp; - - strcpy(setupmsg, ""); - - switch (setup_type) { - case UI_TEXT: - title("WebCit setup"); - printf("\n%s\n", prompt); - printf("This is currently set to:\n%s\n", str); - printf("Enter new value or press return to leave unchanged:\n"); - if (fgets(buf, sizeof buf, stdin)) { - buf[strlen(buf) - 1] = 0; - } - if (strlen(buf) != 0) - strcpy(str, buf); - break; - case UI_DIALOG: - CtdlMakeTempFileName(dialog_result, sizeof dialog_result); - sprintf(buf, "exec %s --inputbox '%s' 19 72 '%s' 2>%s", - getenv("CTDL_DIALOG"), - prompt, - str, - dialog_result); - system(buf); - fp = fopen(dialog_result, "r"); - if (fp != NULL) { - if (fgets(str, sizeof buf, fp)){ - if (str[strlen(str)-1] == 10) { - str[strlen(str)-1] = 0; - } - } - fclose(fp); - unlink(dialog_result); - } - break; - - } -} - - -extern const char *AvailLang[]; -int GetLocalePrefs(void) -{ - int nLocales; - StrBuf *Buf; - char buf[SIZ]; - char dialog_result[PATH_MAX]; - FILE *fp; - int i = 0; - int offs = 0; - - nLocales = 0; - while (!IsEmptyStr(AvailLang[nLocales])) - nLocales++; - - Buf = NewStrBuf(); - - StrBufAppendBufPlain(Buf, HKEY("Select the locale webcit should use : \n"), 0); -#ifdef HAVE_USELOCALE - StrBufAppendBufPlain(Buf, HKEY(" 0 Let the user select it at the login prompt (default)\n"), 0); - offs ++; -#endif - for (i = 0; i < nLocales; i++) { - StrBufAppendPrintf(Buf, " %ld: %s\n", i + offs, AvailLang[i]); - - } - - switch (setup_type) { - case UI_TEXT: - title("WebCit setup"); - printf("\n%s\n", ChrPtr(Buf)); - printf("This is currently set to:\n%ld\n", 0L); - printf("Enter new value or press return to leave unchanged:\n"); - if (fgets(buf, sizeof buf, stdin)) - return atoi(buf); - break; - - case UI_DIALOG: - CtdlMakeTempFileName(dialog_result, sizeof dialog_result); - sprintf(buf, "exec %s --inputbox '%s' 19 72 '%ld' 2>%s", - getenv("CTDL_DIALOG"), - ChrPtr(Buf), - 0L, - dialog_result); - system(buf); - fp = fopen(dialog_result, "r"); - if (fp != NULL) { - char *str = &buf[0]; - if (fgets(str, sizeof buf, fp)){ - if (str[strlen(str)-1] == 10) { - str[strlen(str)-1] = 0; - } - } - fclose(fp); - unlink(dialog_result); - return atoi(buf); - } - break; - - } - return 0; -} - -void important_message(char *title, char *msgtext) -{ - char buf[SIZ]; - - switch (setup_type) { - - case UI_TEXT: - printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - printf(" %s \n\n%s\n\n", title, msgtext); - printf("Press return to continue..."); - if (fgets(buf, sizeof buf, stdin)); - break; - - case UI_DIALOG: - sprintf(buf, "exec %s --msgbox '%s' 19 72", - getenv("CTDL_DIALOG"), - msgtext); - system(buf); - break; - } -} - - -void display_error(char *error_message) -{ - important_message("Error", error_message); -} - -void progress(char *text, long int curr, long int cmax) -{ - static long dots_printed = 0L; - long a = 0; - char buf[SIZ]; - static FILE *fp = NULL; - - switch (setup_type) { - - case UI_TEXT: - if (curr == 0) { - printf("%s\n", text); - printf(".........................."); - printf(".........................."); - printf("..........................\r"); - fflush(stdout); - dots_printed = 0; - } else if (curr == cmax) { - printf("\r%79s\n", ""); - } else { - a = (curr * 100) / cmax; - a = a * 78; - a = a / 100; - while (dots_printed < a) { - printf("*"); - ++dots_printed; - fflush(stdout); - } - } - break; - - case UI_DIALOG: - if (curr == 0) { - sprintf(buf, "exec %s --gauge '%s' 7 72 0", - getenv("CTDL_DIALOG"), - text); - fp = popen(buf, "w"); - if (fp != NULL) { - fprintf(fp, "0\n"); - fflush(fp); - } - } - else if (curr == cmax) { - if (fp != NULL) { - fprintf(fp, "100\n"); - pclose(fp); - fp = NULL; - } - } - else { - a = (curr * 100) / cmax; - if (fp != NULL) { - fprintf(fp, "%ld\n", a); - fflush(fp); - } - } - break; - } -} - - - - -/* - * install_init_scripts() -- Create and deploy SysV init scripts. - * - */ -void install_init_scripts(void) -{ -#ifdef ENABLE_NLS - int localechoice; -#endif - char question[1024]; - char buf[256]; - char http_port[128]; -#ifdef HAVE_OPENSSL - char https_port[128]; -#endif - char hostname[128]; - char portname[128]; - char command[SIZ]; - struct utsname my_utsname; - struct stat etcinitd; - FILE *fp; - char *initfile = "/etc/init.d/webcit"; - - fp = fopen(initfile, "r"); - if (fp != NULL) { - if (yesno("WebCit already appears to be configured to start at boot.\n" - "Would you like to keep your boot configuration as is?\n", 1) == 1) { - return; - } - fclose(fp); - - } - - /* Otherwise, prompt the user to create an entry. */ - snprintf(question, sizeof question, - "Would you like to automatically start WebCit at boot?" - ); - if (yesno(question, 1) == 0) - return; - - -#ifdef ENABLE_NLS - - localechoice = GetLocalePrefs(); - -#endif - /* Defaults */ - sprintf(http_port, "2000"); -#ifdef HAVE_OPENSSL - sprintf(https_port, "443"); -#endif - sprintf(hostname, "uds"); - sprintf(portname, "/usr/local/citadel"); - - /* This is a very hackish way of learning the port numbers used - * in a previous install, if we are upgrading: read them out of - * the existing init script. - */ - if ((stat("/etc/init.d/", &etcinitd) == -1) && - (errno == ENOENT)) - { - if ((stat("/etc/rc.d/init.d/", &etcinitd) == -1) && - (errno == ENOENT)) - initfile = WEBCITDIR"/webcit.init"; - else - initfile = "/etc/rc.d/init.d/webcit"; - } - - fp = fopen(initfile, "r"); - if (fp != NULL) { - while (fgets(buf, sizeof buf, fp) != NULL) { - if (strlen(buf) > 0) { - buf[strlen(buf)-1] = 0; /* strip trailing cr */ - } - if (!strncasecmp(buf, "HTTP_PORT=", 10)) { - safestrncpy(http_port, &buf[10], sizeof http_port); - } -#ifdef HAVE_OPENSSL - if (!strncasecmp(buf, "HTTPS_PORT=", 11)) { - safestrncpy(https_port, &buf[11], sizeof https_port); - } -#endif - if (!strncasecmp(buf, "CTDL_HOSTNAME=", 14)) { - safestrncpy(hostname, &buf[14], sizeof hostname); - } - if (!strncasecmp(buf, "CTDL_PORTNAME=", 14)) { - safestrncpy(portname, &buf[14], sizeof portname); - } - } - fclose(fp); - } - - /* Now ask for the port numbers */ - snprintf(question, sizeof question, - "On which port do you want WebCit to listen for HTTP " - "requests?\n\nYou can use the standard port (80) if you are " - "not running another\nweb server (such as Apache), otherwise " - "select another port."); - set_value(question, http_port); - uname(&my_utsname); - sprintf(suggested_url, "http://%s:%s/", my_utsname.nodename, http_port); - -#ifdef HAVE_OPENSSL - snprintf(question, sizeof question, - "On which port do you want WebCit to listen for HTTPS " - "requests?\n\nYou can use the standard port (443) if you are " - "not running another\nweb server (such as Apache), otherwise " - "select another port."); - set_value(question, https_port); -#endif - - /* Find out where Citadel is. */ - if ( (using_web_installer) && (getenv("CITADEL") != NULL) ) { - strcpy(hostname, "uds"); - strcpy(portname, getenv("CITADEL")); - } - else { - snprintf(question, sizeof question, - "Is the Citadel service running on the same host as WebCit?"); - if (yesno(question, ((!strcasecmp(hostname, "uds")) ? 1 : 0))) { - strcpy(hostname, "uds"); - if (atoi(portname) != 0) strcpy(portname, "/usr/local/citadel"); - set_value("In what directory is Citadel installed?", portname); - } - else { - if (!strcasecmp(hostname, "uds")) strcpy(hostname, "127.0.0.1"); - if (atoi(portname) == 0) strcpy(portname, "504"); - set_value("Enter the host name or IP address of your " - "Citadel server.", hostname); - set_value("Enter the port number on which Citadel is " - "running (usually 504)", portname); - } - } - - - fp = fopen(initfile, "w"); - - fprintf(fp, "#!/bin/sh\n" - "\n" - "# uncomment this to create coredumps as described in\n" - "# http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files\n" - "# ulimit -c unlimited\n" - "WEBCIT_DIR=%s\n", setup_directory); - fprintf(fp, "HTTP_PORT=%s\n", http_port); -#ifdef HAVE_OPENSSL - fprintf(fp, "HTTPS_PORT=%s\n", https_port); -#endif - fprintf(fp, "CTDL_HOSTNAME=%s\n", hostname); - fprintf(fp, "CTDL_PORTNAME=%s\n", portname); - -#ifdef ENABLE_NLS - - if (localechoice == 0) { -#ifdef HAVE_USELOCALE - fprintf(fp, "unset LANG\n"); -#else - fprintf(fp, "export WEBCIT_LANG=c\n"); -#endif - } - else { - fprintf(fp, "export WEBCIT_LANG=%s\n", AvailLang[localechoice - localeoffset]); - - } -#else - fprintf(fp, "# your system doesn't support locales\n"); -#endif - fprintf(fp, "\n" - "\n" - "case \"$1\" in\n" - "\n" - "start) echo -n \"Starting WebCit... \"\n" - " if $WEBCIT_DIR/webcit " - "-D/var/run/webcit.pid " - "-p$HTTP_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n" - " then\n" - " echo \"ok\"\n" - " else\n" - " echo \"failed\"\n" - " fi\n"); -#ifdef HAVE_OPENSSL - fprintf(fp, " echo -n \"Starting WebCit SSL... \"\n" - " if $WEBCIT_DIR/webcit " - "-D/var/run/webcit-ssl.pid " - "-s -p$HTTPS_PORT $CTDL_HOSTNAME $CTDL_PORTNAME\n" - " then\n" - " echo \"ok\"\n" - " else\n" - " echo \"failed\"\n" - " fi\n"); -#endif - fprintf(fp, " ;;\n" - "stop) echo -n \"Stopping WebCit... \"\n" - " if kill `cat /var/run/webcit.pid 2>/dev/null` 2>/dev/null\n" - " then\n" - " echo \"ok\"\n" - " else\n" - " echo \"failed\"\n" - " fi\n" - " rm -f /var/run/webcit.pid 2>/dev/null\n"); -#ifdef HAVE_OPENSSL - fprintf(fp, " echo -n \"Stopping WebCit SSL... \"\n" - " if kill `cat /var/run/webcit-ssl.pid 2>/dev/null` 2>/dev/null\n" - " then\n" - " echo \"ok\"\n" - " else\n" - " echo \"failed\"\n" - " fi\n" - " rm -f /var/run/webcit-ssl.pid 2>/dev/null\n"); -#endif - fprintf(fp, " ;;\n" - "restart) $0 stop\n" - " $0 start\n" - " ;;\n" - "*) echo \"Usage: $0 {start|stop|restart}\"\n" - " exit 1\n" - " ;;\n" - "esac\n" - ); - - fclose(fp); - chmod(initfile, 0755); - - /* Set up the run levels. */ - system("/bin/rm -f /etc/rc?.d/[SK]??webcit 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/S84webcit ; done 2>/dev/null", initfile); - 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/K15webcit ; done 2>/dev/null", initfile); - system(command); - -} - - - - -/* - * Figure out what type of user interface we're going to use - */ -int discover_ui(void) -{ - - /* Use "dialog" if we have it */ - if (getenv("CTDL_DIALOG") != NULL) { - return UI_DIALOG; - } - - return UI_TEXT; -} - - - - - -int main(int argc, char *argv[]) -{ - int a; - char aaa[256]; - int info_only = 0; - - strcpy(suggested_url, "http://:/"); - - /* set an invalid setup type */ - setup_type = (-1); - - /* Check to see if we're running the web installer */ - if (getenv("CITADEL_INSTALLER") != NULL) { - using_web_installer = 1; - } - - /* parse command line args */ - for (a = 0; a < argc; ++a) { - if (!strncmp(argv[a], "-u", 2)) { - strcpy(aaa, argv[a]); - strcpy(aaa, &aaa[2]); - setup_type = atoi(aaa); - } - if (!strcmp(argv[a], "-i")) { - info_only = 1; - } - if (!strcmp(argv[a], "-q")) { - setup_type = UI_SILENT; - } - } - - - /* If a setup type was not specified, try to determine automatically - * the best one to use out of all available types. - */ - if (setup_type < 0) { - setup_type = discover_ui(); - } - if (info_only == 1) { - important_message("WebCit Setup", "Welcome to WebCit setup"); - cleanup(0); - } - - /* Get started in a valid setup directory. */ - strcpy(setup_directory, WEBCITDIR); - if ( (using_web_installer) && (getenv("WEBCIT") != NULL) ) { - strcpy(setup_directory, getenv("WEBCIT")); - } - else { - set_value("In what directory is WebCit installed?", - setup_directory); - } - if (chdir(setup_directory) != 0) { - important_message("WebCit Setup", - "The directory you specified does not exist."); - cleanup(errno); - } - - /* - * We used to start WebCit by putting it directly into /etc/inittab. - * Since some systems are moving away from init, we can't do this anymore. - */ - progress("Removing obsolete /etc/inittab entries...", 0, 1); - delete_the_old_way(); - progress("Removing obsolete /etc/inittab entries...", 1, 1); - - /* Now begin. */ - switch (setup_type) { - - case UI_TEXT: - printf("\n\n\n" - " *** WebCit setup program ***\n\n"); - break; - - } - - /* - * If we're running on SysV, install init scripts. - */ - if (!access("/var/run", W_OK)) { - install_init_scripts(); - - if (!access("/etc/init.d/webcit", X_OK)) { - system("/etc/init.d/webcit stop"); - system("/etc/init.d/webcit start"); - } - - sprintf(aaa, - "Setup is finished. You may now log in.\n" - "Point your web browser at %s\n", suggested_url - ); - important_message("Setup finished", aaa); - } - - else { - important_message("Setup finished", - "Setup is finished. You may now start the server."); - } - - cleanup(0); - return 0; -} diff --git a/webcit/setup_wizard.c b/webcit/setup_wizard.c deleted file mode 100644 index bbac2183c..000000000 --- a/webcit/setup_wizard.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * First-time setup wizard - */ - -#include "webcit.h" - -void do_setup_wizard(void) -{ - char *step; - FILE *fp; - - step = bstr("step"); - - if (!strcasecmp(step, "Finish")) { - fp = fopen(wizard_filename, "w"); - if (fp != NULL) { - fprintf(fp, "%d\n", WC->serv_info->serv_rev_level); - fclose(fp); - } - do_welcome(); - return; - } - - output_headers(1, 1, 1, 0, 0, 0); - - wc_printf("
\n"); - wc_printf(" First time setup"); - wc_printf("
\n"); - - wc_printf("
\n"); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - - wc_printf("
" - "This is where the setup wizard will be placed.
\n" - "For now, just click Finish.

\n" - ); - - wc_printf("\n"); - wc_printf("\n"); - - wc_printf("
\n"); - wDumpContent(1); -} - -void -InitModule_SETUP_WIZARD -(void) -{ - WebcitAddUrlHandler(HKEY("setup_wizard"), "", 0, do_setup_wizard, 0); -} diff --git a/webcit/tests/.gitignore b/webcit/tests/.gitignore deleted file mode 100644 index 3512ccacf..000000000 --- a/webcit/tests/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -msg_renderers.o paramhandling.o preferences.o siteconfig.o summary.o test_main.o test_tools.o useredit.o -.*.swp -Makefile -test diff --git a/webcit/tests/Makefile.in b/webcit/tests/Makefile.in deleted file mode 100644 index 36ece72f8..000000000 --- a/webcit/tests/Makefile.in +++ /dev/null @@ -1,139 +0,0 @@ -prefix=@prefix@ -srcdir=@srcdir@/../ -VPATH=$(srcdir) - -AUTOCONF=@AUTOCONF@ -CC=@CC@ -CFLAGS=@CFLAGS@ -DEFS=@DEFS@ -INSTALL=@INSTALL@ -LIBOBJS=@LIBOBJS@ -LIBS=@LIBS@ -lcunit -LDFLAGS=@LDFLAGS@ -SED=@SED@ -SETUP_LIBS=@SETUP_LIBS@ -PTHREAD_DEFS=@PTHREAD_DEFS@ -LIB_SUBDIRS= -PROG_SUBDIRS=@PROG_SUBDIRS@ -SUBDIRS=$(LIB_SUBDIRS) $(PROG_SUBDIRS) -LOCALEDIR=@LOCALEDIR@ -WWWDIR=@WWWDIR@ - -TEST_OBJECTS= \ - ../webcit.o \ - ../context_loop.o \ - ../modules_init.o \ - \ - ../cookie_conversion.o \ - \ - ../locate_host.o \ - ../sysdep.o \ - ../utils.o \ - ../decode.o \ - ../html2html.o \ - ../http_datestring.o \ - ../fmt_date.o \ - \ - ../subst.o \ - ../preferences.o \ - ../paramhandling.o \ - ../serv_func.o \ - ../tcp_sockets.o \ - ../crypto.o \ - ../gettext.o \ - ../tabs.o \ - \ - ../netconf.o \ - ../inetconf.o \ - ../siteconfig.o \ - ../smtpqueue.o \ - ../pushemail.o \ - ../sieve.o \ - \ - ../static.o \ - ../graphics.o \ - ../downloads.o \ - \ - ../auth.o \ - ../openid.o \ - ../who.o \ - ../userlist.o \ - ../useredit.o \ - ../sysmsgs.o \ - \ - ../listsub.o \ - \ - ../setup_wizard.o \ - ../summary.o \ - ../mainmenu.o \ - ../iconbar.o \ - \ - ../floors.o \ - ../roomops.o \ - ../roomlist.o \ - ../marchlist.o \ - \ - ../messages.o \ - ../msg_renderers.o \ - ../bbsview_renderer.o \ - ../wiki.o \ - \ - ../paging.o \ - ../roomchat.o \ - \ - ../vcard_edit.o \ - ../addressbook_popup.o \ - ../autocompletion.o \ - \ - ../ical_maps.o \ - ../ical_subst.o \ - ../ical_dezonify.o \ - ../calendar.o \ - ../calendar_tools.o \ - ../calendar_view.o \ - ../tasks.o \ - ../event.o \ - ../availability.o \ - ../notes.o \ - \ - ../groupdav_main.o \ - ../groupdav_get.o \ - ../groupdav_propfind.o \ - ../groupdav_options.o \ - ../groupdav_delete.o \ - ../groupdav_put.o - -TEST_COMMON_OBJECTS = \ - test_tools.o - -# End of configuration section - -all: test - -.SUFFIXES: .cpp .c .o - -clean: - rm -f $(WEBCIT_OBJECTS) - - -test: $(TEST_OBJECTS) $(TEST_COMMON_OBJECTS) $(LIBOBJS) test_main.o - $(CC) $(LDFLAGS) -o test $(LIBOBJS) test_main.o \ - $(TEST_OBJECTS) $(TEST_COMMON_OBJECTS) $(LIBS) - -.c.o: - $(CC) $(CFLAGS) -I ../ $(DEFS) -c $(PTHREAD_DEFS) $< - -.cpp.o: - $(CC) $(CFLAGS) -I ../ $(DEFS) -c $(PTHREAD_DEFS) $< - -Makefile: $(srcdir)/Makefile.in $(srcdir)/config.status - CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) $(srcdir)/config.status - -config.status: $(srcdir)/configure - $(SHELL) $(srcdir)/config.status --recheck - -$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 - cd $(srcdir) && $(AUTOCONF) - -$(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4 - cd $(srcdir) && $(ACLOCAL) diff --git a/webcit/tests/test_main.c b/webcit/tests/test_main.c deleted file mode 100644 index a0de76722..000000000 --- a/webcit/tests/test_main.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * This contains a simple multithreaded TCP server manager. It sits around - * waiting on the specified port for incoming HTTP connections. When a - * connection is established, it calls context_loop() from context_loop.c. - * - * Copyright (c) 1996-2016 by the citadel.org developers. - * This program is released under the terms of the GNU General Public License v3. - */ - -#include "../webcit.h" -#include "../webserver.h" -#include "../modules_init.h" - - -#include -#include -#include - - -CU_EXPORT void CU_automated_run_tests(void); -CU_EXPORT CU_ErrorCode CU_list_tests_to_file(void); -CU_EXPORT void CU_set_output_filename(const char* szFilenameRoot); - -extern int msock; /* master listening socket */ -extern int verbosity; /* Logging level */ -extern char static_icon_dir[PATH_MAX]; /* where should we find our mime icons */ - -int is_https = 0; /* Nonzero if I am an HTTPS service */ -int follow_xff = 0; /* Follow X-Forwarded-For: header */ -int home_specified = 0; /* did the user specify a homedir? */ -int DisableGzip = 0; -extern pthread_mutex_t SessionListMutex; -extern pthread_key_t MyConKey; - -extern void run_tests(void); -extern int ig_tcp_server(char *ip_addr, int port_number, int queue_len); -extern int ig_uds_server(char *sockpath, int queue_len); -extern void webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdir, char *relhome); - - -char socket_dir[PATH_MAX]; /* where to talk to our citadel server */ - -char *server_cookie = NULL; /* our Cookie connection to the client */ -int http_port = PORT_NUM; /* Port to listen on */ -char *ctdlhost = DEFAULT_HOST; /* our name */ -char *ctdlport = DEFAULT_PORT; /* our Port */ -int running_as_daemon = 0; /* should we deamonize on startup? */ -char wizard_filename[PATH_MAX]; - -StrBuf *Username = NULL; /* the test user... */ -StrBuf *Passvoid = NULL; /* the test user... */ - - -extern int dbg_analyze_msg; -extern int dbg_bactrace_template_errors; -extern int DumpTemplateI18NStrings; -extern StrBuf *I18nDump; -void InitTemplateCache(void); -extern int LoadTemplates; - - - -/* - * Here's where it all begins. - */ -int main(int argc, char **argv) -{ - pthread_attr_t attr; /* Thread attributes */ - int a; /* General-purpose variables */ - char tracefile[PATH_MAX]; - char ip_addr[256]="0.0.0.0"; - int relh=0; - int home=0; - int home_specified=0; - char relhome[PATH_MAX]=""; - char webcitdir[PATH_MAX] = DATADIR; - char *hdir; - const char *basedir = NULL; - char uds_listen_path[PATH_MAX]; /* listen on a unix domain socket? */ - FILE *rvfp = NULL; - - WildFireInitBacktrace(argv[0], 2); - - start_modules (); - - /* Ensure that we are linked to the correct version of libcitadel */ - if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) { - fprintf(stderr, " You are running libcitadel version %d\n", (libcitadel_version_number())); - fprintf(stderr, "WebCit was compiled against version %d\n", LIBCITADEL_VERSION_NUMBER); - return(1); - } - - strcpy(uds_listen_path, ""); - - /* Parse command line */ - while ((a = getopt(argc, argv, "h:i:p:t:T:B:x:U:P:cf:Z")) != EOF) - switch (a) { - case 'U': - Username = NewStrBufPlain(optarg, -1); - break; - case 'P': - Passvoid = NewStrBufPlain(optarg, -1); - break; - case 'h': - hdir = strdup(optarg); - relh=hdir[0]!='/'; - if (!relh) { - safestrncpy(webcitdir, hdir, sizeof webcitdir); - } - else { - safestrncpy(relhome, relhome, sizeof relhome); - } - /* free(hdir); TODO: SHOULD WE DO THIS? */ - home_specified = 1; - home=1; - break; - case 'B': /* deprecated */ - break; - case 'i': - safestrncpy(ip_addr, optarg, sizeof ip_addr); - break; - case 'p': - http_port = atoi(optarg); - if (http_port == 0) { - safestrncpy(uds_listen_path, optarg, sizeof uds_listen_path); - } - break; - case 't': - safestrncpy(tracefile, optarg, sizeof tracefile); - rvfp = freopen(tracefile, "w", stdout); - rvfp = freopen(tracefile, "w", stderr); - rvfp = freopen(tracefile, "r", stdin); - break; - case 'T': - LoadTemplates = atoi(optarg); - dbg_analyze_msg = (LoadTemplates && (1<<1)) != 0; - dbg_bactrace_template_errors = (LoadTemplates && (1<<2)) != 0; - break; - case 'Z': - DisableGzip = 1; - break; - case 'x': - verbosity = atoi(optarg); - break; - case 'f': - follow_xff = 1; - break; - case 'c': - server_cookie = malloc(256); - if (server_cookie != NULL) { - safestrncpy(server_cookie, - "Set-cookie: wcserver=", - 256); - if (gethostname - (&server_cookie[strlen(server_cookie)], - 200) != 0) { - syslog(2, "gethostname: %s\n", - strerror(errno)); - free(server_cookie); - } - } - break; - default: - fprintf(stderr, "usage: webcit " - "[-i ip_addr] [-p http_port] " - "[-t tracefile] [-c] [-f] " - "[-T Templatedebuglevel] " - "[-Z] [-G i18ndumpfile] " -#ifdef HAVE_OPENSSL - "[-s] [-S cipher_suites]" -#endif - "[-U Username -P Password]" - "" - "[remotehost [remoteport]]\n"); - return 1; - } - - if (optind < argc) { - ctdlhost = argv[optind]; - if (++optind < argc) - ctdlport = argv[optind]; - } - - webcit_calc_dirs_n_files(relh, basedir, home, webcitdir, relhome); - LoadIconDir(static_icon_dir); - - /* Tell 'em who's in da house */ - syslog(1, PACKAGE_STRING "\n"); - syslog(1, "Copyright (C) 1996-2009 by the Citadel development team.\n" - "This software is distributed under the terms of the " - "GNU General Public License.\n\n" - ); - - - /* initialize the International Bright Young Thing */ - - initialise_modules(); - initialize_viewdefs(); - initialize_axdefs(); - - InitTemplateCache(); - - /* Use our own prefix on tzid's generated from system tzdata */ - icaltimezone_set_tzid_prefix("/citadel.org/"); - - /* - * Set up a place to put thread-specific data. - * We only need a single pointer per thread - it points to the - * wcsession struct to which the thread is currently bound. - */ - if (pthread_key_create(&MyConKey, NULL) != 0) { - syslog(1, "Can't create TSD key: %s\n", strerror(errno)); - } - InitialiseSemaphores (); - - - /* - * Start up the housekeeping thread - */ - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - run_tests(); - - ShutDownWebcit(); - FreeStrBuf(&Username); - FreeStrBuf(&Passvoid); - - return 0; -} - - diff --git a/webcit/tests/test_tools.c b/webcit/tests/test_tools.c deleted file mode 100644 index 9a9654779..000000000 --- a/webcit/tests/test_tools.c +++ /dev/null @@ -1,322 +0,0 @@ -#include "webcit_test.h" -#include -#include -#include - - -#include "webcit.h" -#include "webserver.h" -#include "modules_init.h" -#include - - -wcsession *TestSessionList = NULL; - - -ParsedHttpHdrs Hdr; -wcsession *TheSession; - -extern StrBuf *Username; -extern StrBuf *Passvoid; - - -extern int ReadHttpSubject(ParsedHttpHdrs *Hdr, StrBuf *Line, StrBuf *Buf); -extern wcsession *CreateSession(int Lockable, wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t *ListMutex); -extern void groupdav_main(void); - - - -void SetUpContext(void) -{ - memset(&Hdr, 0, sizeof(ParsedHttpHdrs)); - Hdr.HR.eReqType = eGET; - http_new_modules(&Hdr); - - - Hdr.http_sock = 1; /* STDOUT */ -/* Context loop */ - Hdr.HR.dav_depth = 32767; /* TODO: find a general way to have non-0 defaults */ - TheSession = CreateSession(1, &TestSessionList, &Hdr, NULL); - TheSession->lastreq = time(NULL); /* log */ - TheSession->Hdr = &Hdr; - Hdr.HTTPHeaders = NewHash(1, NULL); - session_attach_modules(TheSession); -} - -int SetUpConnection(void) -{ - StrBuf *Response; - if (!GetConnected ()) - { - Response = NewStrBuf(); - become_logged_in(Username, Passvoid, Response); - return 1; - - } - else { - CU_FAIL("Establishing session failed!"); - return 0; - } -} - -void SetHttpURL(ParsedHttpHdrs *Hdr, const char *Title, long tlen, StrBuf *Buf) -{ - StrBuf *Line = NewStrBufPlain (Title, tlen); - FreeStrBuf(&Line); -} - -/* from context_loop.c: */ -extern void DestroyHttpHeaderHandler(void *V); -extern int ReadHttpSubject(ParsedHttpHdrs *Hdr, StrBuf *Line, StrBuf *Buf); -void SetUpRequest(const char *UrlPath) -{ - OneHttpHeader *pHdr; - wcsession *WCC = WC; - StrBuf *Buf; - StrBuf *Line, *HeaderName; - - HeaderName = NewStrBuf(); - Buf = NewStrBuf(); - Line = NewStrBuf(); - StrBufPrintf(Line, "GET %s HTTP/1.0\r\n", UrlPath); - - WCC->Hdr->HTTPHeaders = NewHash(1, NULL); - pHdr = (OneHttpHeader*) malloc(sizeof(OneHttpHeader)); - memset(pHdr, 0, sizeof(OneHttpHeader)); - pHdr->Val = Line; - Put(Hdr.HTTPHeaders, HKEY("GET /"), pHdr, DestroyHttpHeaderHandler); - syslog(9, "%s\n", ChrPtr(Line)); - - if (ReadHttpSubject(&Hdr, Line, HeaderName)) - CU_FAIL("Failed to parse Request line / me is bogus!"); - - FreeStrBuf(&Buf); -} - - - -void TearDownRequest(void) -{ -/* End Context loop */ - http_detach_modules(&Hdr); -} - -void TearDownContext(void) -{ - http_destroy_modules(&Hdr); -/* End Session Loop */ - session_detach_modules(TheSession); - session_destroy_modules(&TheSession); - -/* End Session loop */ -/* now shut it down clean. */ -// shutdown_sessions(); - do_housekeeping(); -} - -void test_worker_entry(StrBuf *UrlPath) -{ - - -} - - -void SetGroupdavHeaders(int DavDepth) -{ - Hdr.HR.dav_depth = DavDepth; -} - -void FlushHeaders(void) -{ - -} - -void test_groupdav_directorycommands(void) -{ - SetUpContext(); - if (SetUpConnection()) - { - SetUpRequest("/"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - - SetUpRequest("/groupdav"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - - SetUpRequest("/groupdav/My%20Folders"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/Calendar"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/Calendar"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/Calendar/"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/groupdav/My%20Folders/Calendar/"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - - SetUpRequest("/"); - SetGroupdavHeaders(0); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - - SetUpRequest("/"); - SetGroupdavHeaders(1); - groupdav_main(); - FlushHeaders(); - TearDownRequest(); - } - - - TearDownContext(); -} - -extern void httplang_to_locale(StrBuf *LocaleString, wcsession *sess); - -static void test_gettext(const char *str, long len) -{ - StrBuf *Test = NewStrBufPlain(str, len); - - SetUpContext(); - httplang_to_locale(Test, TheSession); - TearDownContext(); - - FreeStrBuf(&Test); -} - -void test_gettext_headerevaluation_Opera(void) -{ - test_gettext(HKEY("sq;q=1.0,de;q=0.9,as;q=0.8,ar;q=0.7,bn;q=0.6,zh-cn;q=0.5,kn;q=0.4,ch;q=0.3,fo;q=0.2,gn;q=0.1,ce;q=0.1,ie;q=0.1")); -} - -void test_gettext_headerevaluation_firefox1(void) -{ - test_gettext(HKEY("de-de,en-us;q=0.7,en;q=0.3")); -} - -void test_gettext_headerevaluation_firefox2(void) -{ - test_gettext(HKEY("de,en-ph;q=0.8,en-us;q=0.5,de-at;q=0.3")); -} - -void test_gettext_headerevaluation_firefox3(void) -{ - test_gettext(HKEY("de,en-us;q=0.9,it;q=0.9,de-de;q=0.8,en-ph;q=0.7,de-at;q=0.7,zh-cn;q=0.6,cy;q=0.5,ar-om;q=0.5,en-tt;q=0.4,xh;q=0.3,nl-be;q=0.3,cs;q=0.2,sv;q=0.1,tk;q=0.1")); -} - -void test_gettext_headerevaluation_ie7(void) -{ -// ie7???? -// User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; FBSMTWB; GTB6.3; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; Seekmo 10.3.86.0) - - test_gettext(HKEY("en-us,x-ns1MvoLpRxbNhu,x-ns2F0f0NnyPOPN")); -} - -static void AddTests(void) -{ - CU_pSuite pGroup = NULL; - CU_pTest pTest = NULL; -/* - pGroup = CU_add_suite("TestLocaleEvaluator", NULL, NULL); - pTest = CU_add_test(pGroup, "Test ie7", test_gettext_headerevaluation_ie7); - pTest = CU_add_test(pGroup, "Test Opera", test_gettext_headerevaluation_Opera); - pTest = CU_add_test(pGroup, "Test firefox1", test_gettext_headerevaluation_firefox1); - pTest = CU_add_test(pGroup, "Test firefox2", test_gettext_headerevaluation_firefox2); - pTest = CU_add_test(pGroup, "Test firefox3", test_gettext_headerevaluation_firefox3); -*/ - pGroup = CU_add_suite("TestUrlPatterns", NULL, NULL); - pTest = CU_add_test(pGroup, "Test", test_groupdav_directorycommands); - - -} - - - - - - - -void run_tests(void) -{ - setvbuf(stdout, NULL, _IONBF, 0); - - CU_set_output_filename("TestAutomated"); - if (CU_initialize_registry()) { - printf("\nInitialize of test Registry failed."); - } - - AddTests(); - - printf("\nTests completed with return value %d.\n", CU_basic_run_tests()); - CU_cleanup_registry(); - -} diff --git a/webcit/tests/webcit_test.h b/webcit/tests/webcit_test.h deleted file mode 100644 index adea2ed68..000000000 --- a/webcit/tests/webcit_test.h +++ /dev/null @@ -1,15 +0,0 @@ - -#ifndef CUNIT_AUTOMATED_H_SEEN -#define CUNIT_AUTOMATED_H_SEEN - -#include -#include -#include - - -CU_EXPORT void CU_automated_run_tests(void); -CU_EXPORT CU_ErrorCode CU_list_tests_to_file(void); -CU_EXPORT void CU_set_output_filename(const char* szFilenameRoot); - - -#endif /* CUNIT_AUTOMATED_H_SEEN */ diff --git a/webcit/webcit.h b/webcit/webcit.h index b3ac6730c..f625e1da1 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -548,8 +548,6 @@ extern char *ctdlhost, *ctdlport; extern char *axdefs[]; extern int num_threads_existing; extern int num_threads_executing; -extern int setup_wizard; -extern char wizard_filename[]; void InitialiseSemaphores(void); void begin_critical_section(int which_one); diff --git a/webcit/webserver.c b/webcit/webserver.c index 96adf01c5..411e06e3a 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -1,18 +1,15 @@ -/* - * Copyright (c) 1996-2021 by the citadel.org team - * - * This program is open source software. You can redistribute it and/or - * modify it under the terms of the GNU General Public License version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// Copyright (c) 1996-2021 by the citadel.org team +// +// This program is open source software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License version 3. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. #include "webcit.h" #include "webserver.h" - #include "modules_init.h" extern int msock; /* master listening socket */ @@ -38,8 +35,6 @@ char *server_cookie = NULL; /* our Cookie connection to the client */ int http_port = PORT_NUM; /* Port to listen on */ char *ctdlhost = DEFAULT_HOST; /* Host name or IP address of Citadel server */ char *ctdlport = DEFAULT_PORT; /* Port number of Citadel server */ -int setup_wizard = 0; /* should we run the setup wizard? */ -char wizard_filename[PATH_MAX]; /* location of file containing the last webcit version against which we ran setup wizard */ int running_as_daemon = 0; /* should we deamonize on startup? */ /* #define DBG_PRINNT_HOOKS_AT_START */ @@ -61,8 +56,7 @@ void LoadMimeBlacklist(void); /* * Here's where it all begins. */ -int main(int argc, char **argv) -{ +int main(int argc, char **argv) { uid_t UID = -1; pthread_t SessThread; /* Thread descriptor */ pthread_attr_t attr; /* Thread attributes */ @@ -159,12 +153,8 @@ int main(int argc, char **argv) case 'c': server_cookie = malloc(256); if (server_cookie != NULL) { - safestrncpy(server_cookie, - "Set-cookie: wcserver=", - 256); - if (gethostname - (&server_cookie[strlen(server_cookie)], - 200) != 0) { + safestrncpy(server_cookie, "Set-cookie: wcserver=", 256); + if (gethostname (&server_cookie[strlen(server_cookie)], 200) != 0) { syslog(LOG_INFO, "gethostname: %s", strerror(errno)); free(server_cookie); } -- 2.30.2