* add hint to ulimit into the init scripts, so enabling it gets easier for novice users
# placed in /etc/init.d.
### END INIT INFO
# placed in /etc/init.d.
### END INIT INFO
+# uncomment this to create coredumps as described in
+# http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files
+# ulimit -c unlimited
+
# Author: Wilfried Goesgens <citadel@outgesourced.org>
RUNDIR=/var/run/webcit
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# Author: Wilfried Goesgens <citadel@outgesourced.org>
RUNDIR=/var/run/webcit
PATH=/sbin:/usr/sbin:/bin:/usr/bin
{
int i = 0;
int answer = 0;
{
int i = 0;
int answer = 0;
question,
( default_value ? "Yes" : "No" )
);
question,
( default_value ? "Yes" : "No" )
);
- 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;
+ 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;
} while ((answer < 0) || (answer > 1));
break;
void set_value(char *prompt, char str[])
{
void set_value(char *prompt, char str[])
{
char dialog_result[PATH_MAX];
char setupmsg[SIZ];
FILE *fp;
char dialog_result[PATH_MAX];
char setupmsg[SIZ];
FILE *fp;
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");
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");
- fgets(buf, sizeof buf, stdin);
- buf[strlen(buf) - 1] = 0;
+ if (fgets(buf, sizeof buf, stdin)) {
+ buf[strlen(buf) - 1] = 0;
+ }
if (strlen(buf) != 0)
strcpy(str, buf);
break;
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",
case UI_DIALOG:
CtdlMakeTempFileName(dialog_result, sizeof dialog_result);
sprintf(buf, "exec %s --inputbox '%s' 19 72 '%s' 2>%s",
system(buf);
fp = fopen(dialog_result, "r");
if (fp != NULL) {
system(buf);
fp = fopen(dialog_result, "r");
if (fp != NULL) {
- fgets(str, sizeof buf, fp);
- if (str[strlen(str)-1] == 10) {
- str[strlen(str)-1] = 0;
+ if (fgets(str, sizeof buf, fp)){
+ if (str[strlen(str)-1] == 10) {
+ str[strlen(str)-1] = 0;
+ }
}
fclose(fp);
unlink(dialog_result);
}
fclose(fp);
unlink(dialog_result);
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");
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");
- fgets(buf, sizeof buf, stdin);
- return atoi(buf);
+ if (fgets(buf, sizeof buf, stdin))
+ return atoi(buf);
fp = fopen(dialog_result, "r");
if (fp != NULL) {
char *str = &buf[0];
fp = fopen(dialog_result, "r");
if (fp != NULL) {
char *str = &buf[0];
- fgets(str, sizeof buf, fp);
- if (str[strlen(str)-1] == 10) {
- str[strlen(str)-1] = 0;
+ if (fgets(str, sizeof buf, fp)){
+ if (str[strlen(str)-1] == 10) {
+ str[strlen(str)-1] = 0;
+ }
}
fclose(fp);
unlink(dialog_result);
}
fclose(fp);
unlink(dialog_result);
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...");
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...");
- fgets(buf, sizeof buf, stdin);
+ if (fgets(buf, sizeof buf, stdin));
fp = fopen(initfile, "r");
if (fp != NULL) {
if (yesno("WebCit already appears to be configured to start at boot.\n"
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) {
+ "Would you like to keep your boot configuration as is?\n", 1) == 1) {
/* Otherwise, prompt the user to create an entry. */
snprintf(question, sizeof question,
/* Otherwise, prompt the user to create an entry. */
snprintf(question, sizeof question,
- "Would you like to automatically start WebCit at boot?"
- );
+ "Would you like to automatically start WebCit at boot?"
+ );
if (yesno(question, 1) == 0)
return;
if (yesno(question, 1) == 0)
return;
/* Now ask for the port numbers */
snprintf(question, sizeof question,
/* 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.");
+ "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,
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.");
+ "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
set_value(question, https_port);
#endif
}
else {
snprintf(question, sizeof question,
}
else {
snprintf(question, sizeof question,
- "Is the Citadel service running on the same host as WebCit?");
+ "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");
if (yesno(question, ((!strcasecmp(hostname, "uds")) ? 1 : 0))) {
strcpy(hostname, "uds");
if (atoi(portname) != 0) strcpy(portname, "/usr/local/citadel");
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 "
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);
+ "Citadel server.", hostname);
set_value("Enter the port number on which Citadel is "
set_value("Enter the port number on which Citadel is "
- "running (usually 504)", portname);
+ "running (usually 504)", portname);
fp = fopen(initfile, "w");
fprintf(fp, "#!/bin/sh\n"
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
"WEBCIT_DIR=%s\n", setup_directory);
fprintf(fp, "HTTP_PORT=%s\n", http_port);
#ifdef HAVE_OPENSSL