mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Improved debugging output
SVN revision: 2051
This commit is contained in:
parent
6ba4b7e94d
commit
2b440db3cd
@ -17,7 +17,6 @@ Global
|
|||||||
{8D6EBED8-48F3-4719-907E-7BE46A3C0FA4}.Debug|Win32.ActiveCfg = Debug|Win32
|
{8D6EBED8-48F3-4719-907E-7BE46A3C0FA4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{8D6EBED8-48F3-4719-907E-7BE46A3C0FA4}.Release|Win32.ActiveCfg = Release|Win32
|
{8D6EBED8-48F3-4719-907E-7BE46A3C0FA4}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{FD6FCAF3-A94B-40FA-AE52-07705DE2E519}.Debug|Win32.ActiveCfg = Debug|Win32
|
{FD6FCAF3-A94B-40FA-AE52-07705DE2E519}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{FD6FCAF3-A94B-40FA-AE52-07705DE2E519}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{FD6FCAF3-A94B-40FA-AE52-07705DE2E519}.Release|Win32.ActiveCfg = Release|Win32
|
{FD6FCAF3-A94B-40FA-AE52-07705DE2E519}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{CB6EB7FE-CC3D-4548-B8B8-8DDA05916759}.Debug|Win32.ActiveCfg = Debug|Win32
|
{CB6EB7FE-CC3D-4548-B8B8-8DDA05916759}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{CB6EB7FE-CC3D-4548-B8B8-8DDA05916759}.Debug|Win32.Build.0 = Debug|Win32
|
{CB6EB7FE-CC3D-4548-B8B8-8DDA05916759}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="\mxml;\openssl\include;"
|
AdditionalIncludeDirectories="\mxml;\openssl\include;"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_SSL1"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_SSL"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
|
|||||||
158
src/elogd.c
158
src/elogd.c
@ -132,7 +132,7 @@ char pidfile[256]; /* Pidfile name
|
|||||||
#include "strlcpy.h"
|
#include "strlcpy.h"
|
||||||
|
|
||||||
BOOL running_as_daemon; /* Running as a daemon/service? */
|
BOOL running_as_daemon; /* Running as a daemon/service? */
|
||||||
int elog_tcp_port = (int) DEFAULT_PORT; /* Server's TCP port */
|
int elog_tcp_port; /* Server's TCP port */
|
||||||
|
|
||||||
static void (*printf_handler) (const char *); /* Handler to printf for logging */
|
static void (*printf_handler) (const char *); /* Handler to printf for logging */
|
||||||
static void (*fputs_handler) (const char *); /* Handler to fputs for logging */
|
static void (*fputs_handler) (const char *); /* Handler to fputs for logging */
|
||||||
@ -6162,9 +6162,12 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
else
|
else
|
||||||
sprintf(hattrib, "%s", attrib + 5);
|
sprintf(hattrib, "%s", attrib + 5);
|
||||||
|
|
||||||
} else if (strstr(attrib, "://") == 0 && attrib[0] != '#') /* add http:// if missing */
|
} else if (strstr(attrib, "://") == 0 && attrib[0] != '#') { /* add http:// if missing */
|
||||||
sprintf(hattrib, "http://%s", attrib);
|
if (_ssl_flag)
|
||||||
else
|
sprintf(hattrib, "https://%s", attrib);
|
||||||
|
else
|
||||||
|
sprintf(hattrib, "http://%s", attrib);
|
||||||
|
} else
|
||||||
strlcpy(hattrib, attrib, sizeof(hattrib));
|
strlcpy(hattrib, attrib, sizeof(hattrib));
|
||||||
|
|
||||||
strextract(str + i, '[', value, sizeof(value));
|
strextract(str + i, '[', value, sizeof(value));
|
||||||
@ -6213,11 +6216,15 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add http:// if missing */
|
/* add http:// if missing */
|
||||||
else if (!strnieq(attrib, "http://", 7) &&
|
else if ((!strnieq(attrib, "http://", 7) && !strnieq(attrib, "https://", 8)) &&
|
||||||
strstr(pattern_list[l].subst, "mailto") == NULL &&
|
strstr(pattern_list[l].subst, "mailto") == NULL &&
|
||||||
strstr(pattern_list[l].subst, "img") == NULL &&
|
strstr(pattern_list[l].subst, "img") == NULL &&
|
||||||
strncmp(pattern_list[l].subst, "<a", 2) != 0)
|
strncmp(pattern_list[l].subst, "<a", 2) != 0) {
|
||||||
sprintf(hattrib, "http://%s", attrib);
|
if (_ssl_flag)
|
||||||
|
sprintf(hattrib, "https://%s", attrib);
|
||||||
|
else
|
||||||
|
sprintf(hattrib, "http://%s", attrib);
|
||||||
|
}
|
||||||
|
|
||||||
strlcpy(subst, pattern_list[l].subst, sizeof(subst));
|
strlcpy(subst, pattern_list[l].subst, sizeof(subst));
|
||||||
strsubst(subst, sizeof(subst), "%#", hattrib);
|
strsubst(subst, sizeof(subst), "%#", hattrib);
|
||||||
@ -6633,7 +6640,10 @@ void compose_base_url(LOGBOOK * lbs, char *base_url, int size, BOOL email_notify
|
|||||||
if (strrchr(base_url, '/'))
|
if (strrchr(base_url, '/'))
|
||||||
*(strrchr(base_url, '/') + 1) = 0;
|
*(strrchr(base_url, '/') + 1) = 0;
|
||||||
} else {
|
} else {
|
||||||
strcpy(base_url, "http://");
|
if (_ssl_flag)
|
||||||
|
strcpy(base_url, "https://");
|
||||||
|
else
|
||||||
|
strcpy(base_url, "http://");
|
||||||
|
|
||||||
if (elog_tcp_port == 80)
|
if (elog_tcp_port == 80)
|
||||||
sprintf(base_url + strlen(base_url), "%s/", host_name);
|
sprintf(base_url + strlen(base_url), "%s/", host_name);
|
||||||
@ -6732,7 +6742,10 @@ void set_location(LOGBOOK * lbs, char *rel_path)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* assemble absolute path from host name and port */
|
/* assemble absolute path from host name and port */
|
||||||
sprintf(str, "http://%s", http_host);
|
if (_ssl_flag)
|
||||||
|
sprintf(str, "https://%s", http_host);
|
||||||
|
else
|
||||||
|
sprintf(str, "http://%s", http_host);
|
||||||
if (elog_tcp_port != 80 && strchr(str, ':') == NULL)
|
if (elog_tcp_port != 80 && strchr(str, ':') == NULL)
|
||||||
sprintf(str + strlen(str), ":%d", elog_tcp_port);
|
sprintf(str + strlen(str), ":%d", elog_tcp_port);
|
||||||
strlcat(str, "/", sizeof(str));
|
strlcat(str, "/", sizeof(str));
|
||||||
@ -6774,7 +6787,10 @@ void set_location(LOGBOOK * lbs, char *rel_path)
|
|||||||
/* if HTTP request comes from localhost, use localhost as
|
/* if HTTP request comes from localhost, use localhost as
|
||||||
absolute link (needed if running on DSL at home) */
|
absolute link (needed if running on DSL at home) */
|
||||||
if (!str[0] && strstr(http_host, "localhost")) {
|
if (!str[0] && strstr(http_host, "localhost")) {
|
||||||
strlcpy(str, "http://localhost", sizeof(str));
|
if (_ssl_flag)
|
||||||
|
strlcpy(str, "https://localhost", sizeof(str));
|
||||||
|
else
|
||||||
|
strlcpy(str, "http://localhost", sizeof(str));
|
||||||
if (elog_tcp_port != 80)
|
if (elog_tcp_port != 80)
|
||||||
sprintf(str + strlen(str), ":%d", elog_tcp_port);
|
sprintf(str + strlen(str), ":%d", elog_tcp_port);
|
||||||
strlcat(str, "/", sizeof(str));
|
strlcat(str, "/", sizeof(str));
|
||||||
@ -7314,14 +7330,14 @@ void show_upgrade_page(LOGBOOK * lbs)
|
|||||||
|
|
||||||
rsprintf("It is of course possible to change the attributes or add new ones. The new\n");
|
rsprintf("It is of course possible to change the attributes or add new ones. The new\n");
|
||||||
rsprintf("options in the configuration file are described under <a href=\"\n");
|
rsprintf("options in the configuration file are described under <a href=\"\n");
|
||||||
rsprintf("http://midas.psi.ch/elog/config.html\">http://midas.psi.ch/elog/config.html\n");
|
rsprintf("https://midas.psi.ch/elog/config.html\">https://midas.psi.ch/elog/config.html\n");
|
||||||
rsprintf("</a>.\n");
|
rsprintf("</a>.\n");
|
||||||
|
|
||||||
rsprintf("</td></tr></table>\n\n");
|
rsprintf("</td></tr></table>\n\n");
|
||||||
|
|
||||||
rsprintf("<hr>\n");
|
rsprintf("<hr>\n");
|
||||||
rsprintf("<address>\n");
|
rsprintf("<address>\n");
|
||||||
rsprintf("<a href=\"http://midas.psi.ch/~stefan\">S. Ritt</a>, 18 October 2001");
|
rsprintf("<a href=\"https://midas.psi.ch/~stefan\">S. Ritt</a>, 18 October 2001");
|
||||||
rsprintf("</address>");
|
rsprintf("</address>");
|
||||||
show_bottom_text(lbs);
|
show_bottom_text(lbs);
|
||||||
rsprintf("</body></html>\r\n");
|
rsprintf("</body></html>\r\n");
|
||||||
@ -7825,7 +7841,7 @@ void show_bottom_text(LOGBOOK * lbs)
|
|||||||
} else
|
} else
|
||||||
/* add little logo */
|
/* add little logo */
|
||||||
rsprintf
|
rsprintf
|
||||||
("<center><a class=\"bottomlink\" title=\"%s\" href=\"http://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
|
("<center><a class=\"bottomlink\" title=\"%s\" href=\"https://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
|
||||||
loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
|
loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7875,7 +7891,7 @@ void show_bottom_text_login(LOGBOOK * lbs)
|
|||||||
} else
|
} else
|
||||||
/* add little logo */
|
/* add little logo */
|
||||||
rsprintf
|
rsprintf
|
||||||
("<center><a class=\"bottomlink\" title=\"%s\" href=\"http://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
|
("<center><a class=\"bottomlink\" title=\"%s\" href=\"https://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
|
||||||
loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
|
loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11787,7 +11803,7 @@ void show_admin_page(LOGBOOK * lbs, char *top_group)
|
|||||||
rsprintf("</textarea>\n");
|
rsprintf("</textarea>\n");
|
||||||
|
|
||||||
/* put link for config page */
|
/* put link for config page */
|
||||||
rsprintf("<br><a target=\"_blank\" href=\"http://midas.psi.ch/elog/config.html\">Syntax Help</a>");
|
rsprintf("<br><a target=\"_blank\" href=\"https://midas.psi.ch/elog/config.html\">Syntax Help</a>");
|
||||||
|
|
||||||
rsprintf("</td></tr>\n");
|
rsprintf("</td></tr>\n");
|
||||||
|
|
||||||
@ -12505,10 +12521,17 @@ int save_user_config(LOGBOOK * lbs, char *user, BOOL new_user, BOOL activate)
|
|||||||
if (referer[0])
|
if (referer[0])
|
||||||
strcpy(url, referer);
|
strcpy(url, referer);
|
||||||
else {
|
else {
|
||||||
if (elog_tcp_port == 80)
|
if (elog_tcp_port == 80) {
|
||||||
sprintf(url, "http://%s/", http_host);
|
if (_ssl_flag)
|
||||||
else
|
sprintf(url, "https://%s/", http_host);
|
||||||
sprintf(url, "http://%s:%d/", http_host, elog_tcp_port);
|
else
|
||||||
|
sprintf(url, "http://%s/", http_host);
|
||||||
|
} else {
|
||||||
|
if (_ssl_flag)
|
||||||
|
sprintf(url, "https://%s:%d/", http_host, elog_tcp_port);
|
||||||
|
else
|
||||||
|
sprintf(url, "http://%s:%d/", http_host, elog_tcp_port);
|
||||||
|
}
|
||||||
if (lbs) {
|
if (lbs) {
|
||||||
strlcat(url, lbs->name_enc, sizeof(url));
|
strlcat(url, lbs->name_enc, sizeof(url));
|
||||||
strlcat(url, "/", sizeof(url));
|
strlcat(url, "/", sizeof(url));
|
||||||
@ -12990,10 +13013,17 @@ void show_forgot_pwd_page(LOGBOOK * lbs)
|
|||||||
if (referer[0])
|
if (referer[0])
|
||||||
strcpy(url, referer);
|
strcpy(url, referer);
|
||||||
else {
|
else {
|
||||||
if (elog_tcp_port == 80)
|
if (elog_tcp_port == 80) {
|
||||||
sprintf(url, "http://%s/", http_host);
|
if (_ssl_flag)
|
||||||
else
|
sprintf(url, "https://%s/", http_host);
|
||||||
sprintf(url, "http://%s:%d/", http_host, elog_tcp_port);
|
else
|
||||||
|
sprintf(url, "http://%s/", http_host);
|
||||||
|
} else {
|
||||||
|
if (_ssl_flag)
|
||||||
|
sprintf(url, "https://%s:%d/", http_host, elog_tcp_port);
|
||||||
|
else
|
||||||
|
sprintf(url, "http://%s:%d/", http_host, elog_tcp_port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (url[strlen(url) - 1] != '/')
|
if (url[strlen(url) - 1] != '/')
|
||||||
@ -18338,7 +18368,10 @@ void show_rss_feed(LOGBOOK * lbs)
|
|||||||
/* if HTTP request comes from localhost, use localhost as
|
/* if HTTP request comes from localhost, use localhost as
|
||||||
absolute link (needed if running on DSL at home) */
|
absolute link (needed if running on DSL at home) */
|
||||||
if (!url[0] && strstr(http_host, "localhost")) {
|
if (!url[0] && strstr(http_host, "localhost")) {
|
||||||
strcpy(url, "http://localhost");
|
if (_ssl_flag)
|
||||||
|
strcpy(url, "https://localhost");
|
||||||
|
else
|
||||||
|
strcpy(url, "http://localhost");
|
||||||
if (elog_tcp_port != 80)
|
if (elog_tcp_port != 80)
|
||||||
sprintf(url + strlen(url), ":%d", elog_tcp_port);
|
sprintf(url + strlen(url), ":%d", elog_tcp_port);
|
||||||
strcat(url, "/");
|
strcat(url, "/");
|
||||||
@ -18346,7 +18379,10 @@ void show_rss_feed(LOGBOOK * lbs)
|
|||||||
|
|
||||||
if (!url[0]) {
|
if (!url[0]) {
|
||||||
/* assemble absolute path from host name and port */
|
/* assemble absolute path from host name and port */
|
||||||
sprintf(url, "http://%s", host_name);
|
if (_ssl_flag)
|
||||||
|
sprintf(url, "https://%s", host_name);
|
||||||
|
else
|
||||||
|
sprintf(url, "http://%s", host_name);
|
||||||
if (elog_tcp_port != 80)
|
if (elog_tcp_port != 80)
|
||||||
sprintf(url + strlen(url), ":%d", elog_tcp_port);
|
sprintf(url + strlen(url), ":%d", elog_tcp_port);
|
||||||
strcat(url, "/");
|
strcat(url, "/");
|
||||||
@ -25465,7 +25501,7 @@ void interprete(char *lbook, char *path)
|
|||||||
if (getcfg(lbs->name, "Help URL", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Help URL", str, sizeof(str))) {
|
||||||
|
|
||||||
/* if URL is given, redirect */
|
/* if URL is given, redirect */
|
||||||
if (strstr(str, "http://")) {
|
if (strstr(str, "http://") || strstr(str, "https://")) {
|
||||||
redirect(lbs, str);
|
redirect(lbs, str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -25500,7 +25536,7 @@ void interprete(char *lbook, char *path)
|
|||||||
strlcat(file_name, ".html", sizeof(file_name));
|
strlcat(file_name, ".html", sizeof(file_name));
|
||||||
f = fopen(file_name, "r");
|
f = fopen(file_name, "r");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
redirect(lbs, "http://midas.psi.ch/elog/eloghelp_english.html");
|
redirect(lbs, "https://midas.psi.ch/elog/eloghelp_english.html");
|
||||||
else {
|
else {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
send_file_direct(file_name);
|
send_file_direct(file_name);
|
||||||
@ -25523,7 +25559,7 @@ void interprete(char *lbook, char *path)
|
|||||||
strlcat(file_name, ".html", sizeof(file_name));
|
strlcat(file_name, ".html", sizeof(file_name));
|
||||||
f = fopen(file_name, "r");
|
f = fopen(file_name, "r");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
redirect(lbs, "http://midas.psi.ch/elog/elcode_english.html");
|
redirect(lbs, "https://midas.psi.ch/elog/elcode_english.html");
|
||||||
else {
|
else {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
send_file_direct(file_name);
|
send_file_direct(file_name);
|
||||||
@ -26081,7 +26117,7 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
|
|||||||
if (file_name[0] && (p - string) == 0) {
|
if (file_name[0] && (p - string) == 0) {
|
||||||
|
|
||||||
/* check for URL */
|
/* check for URL */
|
||||||
if (stristr(file_name, "http://")) {
|
if (stristr(file_name, "http://") || stristr(file_name, "https://")) {
|
||||||
size = retrieve_url(file_name, &buffer, NULL);
|
size = retrieve_url(file_name, &buffer, NULL);
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
strencode2(str2, file_name, sizeof(str2));
|
strencode2(str2, file_name, sizeof(str2));
|
||||||
@ -26786,10 +26822,21 @@ void send_return(int _sock, const char *net_buffer)
|
|||||||
send(_sock, header_buffer, strlen(header_buffer), 0);
|
send(_sock, header_buffer, strlen(header_buffer), 0);
|
||||||
send(_sock, p + 4, length, 0);
|
send(_sock, p + 4, length, 0);
|
||||||
#endif
|
#endif
|
||||||
if (verbose > 1) {
|
if (verbose == 1) {
|
||||||
|
eprintf("Returned %d bytes\n", length);
|
||||||
|
} else if (verbose == 2) {
|
||||||
|
if (strrchr(net_buffer, '/'))
|
||||||
|
strlcpy(str, strrchr(net_buffer, '/') + 1, sizeof(str));
|
||||||
|
else
|
||||||
|
str[0] = 0;
|
||||||
eprintf("==== Return ================================\n");
|
eprintf("==== Return ================================\n");
|
||||||
eputs(header_buffer);
|
eputs(header_buffer);
|
||||||
eputs(p + 2);
|
if (chkext(net_buffer, ".gif") || chkext(net_buffer, ".jpg")
|
||||||
|
|| chkext(net_buffer, ".png") || chkext(net_buffer, ".ico")
|
||||||
|
|| chkext(net_buffer, ".pdf") || return_length > 10000)
|
||||||
|
eprintf("\n<%d bytes of %s>\n\n", length, str);
|
||||||
|
else
|
||||||
|
eputs(p+4);
|
||||||
eprintf("\n");
|
eprintf("\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -26805,7 +26852,9 @@ void send_return(int _sock, const char *net_buffer)
|
|||||||
#else
|
#else
|
||||||
send(_sock, return_buffer, return_length, 0);
|
send(_sock, return_buffer, return_length, 0);
|
||||||
#endif
|
#endif
|
||||||
if (verbose > 1) {
|
if (verbose == 1) {
|
||||||
|
eprintf("Returned %d bytes\n", return_length);
|
||||||
|
} else if (verbose == 2) {
|
||||||
if (strrchr(net_buffer, '/'))
|
if (strrchr(net_buffer, '/'))
|
||||||
strlcpy(str, strrchr(net_buffer, '/') + 1, sizeof(str));
|
strlcpy(str, strrchr(net_buffer, '/') + 1, sizeof(str));
|
||||||
else
|
else
|
||||||
@ -27023,6 +27072,23 @@ void server_loop(void)
|
|||||||
else
|
else
|
||||||
_logging_level = 2;
|
_logging_level = 2;
|
||||||
|
|
||||||
|
/* initialize SSL if requested */
|
||||||
|
_ssl_flag = 0;
|
||||||
|
if (getcfg("global", "SSL", str, sizeof(str)) &&
|
||||||
|
atoi(str) == 1) {
|
||||||
|
#ifdef HAVE_SSL
|
||||||
|
ssl_ctx = init_ssl();
|
||||||
|
if (ssl_ctx == NULL) {
|
||||||
|
eprintf("Cannot initialize SSL\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
_ssl_flag = 1;
|
||||||
|
#else
|
||||||
|
eprintf("SLL support not compiled into elogd\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* create a new socket */
|
/* create a new socket */
|
||||||
lsock = socket(AF_INET, SOCK_STREAM, 0);
|
lsock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (lsock == -1) {
|
if (lsock == -1) {
|
||||||
@ -27079,23 +27145,6 @@ void server_loop(void)
|
|||||||
/* open configuration file */
|
/* open configuration file */
|
||||||
getcfg("dummy", "dummy", str, sizeof(str));
|
getcfg("dummy", "dummy", str, sizeof(str));
|
||||||
|
|
||||||
/* initialize SSL if requested */
|
|
||||||
_ssl_flag = 0;
|
|
||||||
if (getcfg("global", "SSL", str, sizeof(str)) &&
|
|
||||||
atoi(str) == 1) {
|
|
||||||
#ifdef HAVE_SSL
|
|
||||||
ssl_ctx = init_ssl();
|
|
||||||
if (ssl_ctx == NULL) {
|
|
||||||
eprintf("Cannot initialize SSL\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
_ssl_flag = 1;
|
|
||||||
#else
|
|
||||||
eprintf("SLL support not compiled into elogd\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now, initiate daemon/service */
|
/* now, initiate daemon/service */
|
||||||
if (running_as_daemon) {
|
if (running_as_daemon) {
|
||||||
/* Redirect all messages handled with eprintf/efputs to syslog */
|
/* Redirect all messages handled with eprintf/efputs to syslog */
|
||||||
@ -27235,7 +27284,10 @@ void server_loop(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(str, "Server listening on port %d ...\n", elog_tcp_port);
|
if (_ssl_flag)
|
||||||
|
sprintf(str, "SSLServer listening on port %d ...\n", elog_tcp_port);
|
||||||
|
else
|
||||||
|
sprintf(str, "Server listening on port %d ...\n", elog_tcp_port);
|
||||||
eprintf("%s", str);
|
eprintf("%s", str);
|
||||||
if (_logging_level > 0)
|
if (_logging_level > 0)
|
||||||
write_logfile(NULL, str);
|
write_logfile(NULL, str);
|
||||||
@ -28551,6 +28603,12 @@ int main(int argc, char *argv[])
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get default port */
|
||||||
|
if (getcfg("global", "SSL", str, sizeof(str)) && atoi(str) == 1)
|
||||||
|
elog_tcp_port = 443;
|
||||||
|
else
|
||||||
|
elog_tcp_port = 80;
|
||||||
|
|
||||||
/* get port from configuration file */
|
/* get port from configuration file */
|
||||||
if (tcp_port_cl != 0)
|
if (tcp_port_cl != 0)
|
||||||
elog_tcp_port = tcp_port_cl;
|
elog_tcp_port = tcp_port_cl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user