Implemented send_with_timeout()
This commit is contained in:
@@ -216,7 +216,7 @@ install: $(EXECS)
|
||||
ifeq ($(OSTYPE),darwin)
|
||||
@$(INSTALL) -v -m 0644 elogd.plist /Library/LaunchDaemons/ch.psi.elogd.plist
|
||||
@echo The elogd service can now be started with
|
||||
@echo " launchctl load /Library/LaunchDaemons/ch.psi.elogd.plist"
|
||||
@echo " sudo launchctl load /Library/LaunchDaemons/ch.psi.elogd.plist"
|
||||
else
|
||||
@sed "s#\@PREFIX\@#$(PREFIX)#g" elogd.init_template > elogd.init
|
||||
@mkdir -p -m 0755 $(RCDIR)
|
||||
|
||||
+2
-12
@@ -1,26 +1,16 @@
|
||||
Checklist for new ELOG version
|
||||
==============================
|
||||
|
||||
On RS32:
|
||||
On Mac (MPC1865):
|
||||
|
||||
- Put all new options in doc/config.html
|
||||
- Increase version in elog-version.h
|
||||
- Do the same in doc/index.html and index_nd.html
|
||||
- Modify ChangeLog
|
||||
- Add release date to ChangeLog
|
||||
|
||||
On VPC6562-1:
|
||||
|
||||
- "svn update"
|
||||
- "make loc"
|
||||
- Translate new strings in eloglang.german
|
||||
- "make indent"
|
||||
- svn -m "Run indent" commit
|
||||
|
||||
On RS32:
|
||||
|
||||
- "svn update"
|
||||
- c:\elog> svn ci -m "Release x.x.x-y"
|
||||
- "git commit -a -m "Release x.x.x-y"
|
||||
|
||||
On VPC6562-1:
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
Version 3.0.0, released December 23th, 2014
|
||||
===========================================
|
||||
|
||||
- Replaced insecure SSLv23 with TLSv1 method
|
||||
- Switched from SVN to GIT versioning
|
||||
- Implemented service under Mac OSC via launchd
|
||||
- Added LDAP support for authentication
|
||||
- Don’t overwrite certificated, themes and init scrip during ‘make install’
|
||||
- Create one logbook subdirectory pear year
|
||||
- Switched to CKEditor with Drag & Drop Upload (courtesy of Dario Milicic)
|
||||
|
||||
|
||||
Version 2.9.2, released April 27th 2012
|
||||
=======================================
|
||||
|
||||
|
||||
+32
-13
@@ -38,10 +38,7 @@
|
||||
<div class=Sub><i>How to set up and run your very own ELOG server</i></div>
|
||||
|
||||
<hr><a name="unix">
|
||||
<div class=section> Installing and running on UNIX </div>
|
||||
<p>
|
||||
<b>ELOG</b> is being developed and tested under Linux, and is being used on (Sparc) Solaris
|
||||
workstations. It should also compile and run on other UNIX flavours.
|
||||
<div class=section> Installing and running on Linux </div>
|
||||
<p>
|
||||
|
||||
<h3><hr><i>Installation from the RPM file</i>:</h3>
|
||||
@@ -162,6 +159,37 @@ described <a href="#config">below</a>.
|
||||
|
||||
<div class=section> Notes for various platforms </div>
|
||||
<p>
|
||||
<h3><i>Mac OS X</i>:</h3>
|
||||
<p>
|
||||
Under Mac OSX, <b>ELOG</b> must be compiled from the source code. The OSX command line tools (compiler & Co)
|
||||
must be available, which can be done thought he free Xcode package which can be obtained though the App Store.
|
||||
Once Xcode is installed, you can do a <code>xcode-select --install</code> to install the command line tools.
|
||||
After that, a simple <code>make</code> in in the elog directory does the job of compiling ELOG.
|
||||
If SSL support is needed (access via https://...), you have to install OpenSSL and turn on SSL support in the
|
||||
Makefile by setting <code>USE_SSL = 1</code>. You can install OpenSSL for example through the
|
||||
<a href="https://www.macports.org">MacPorts</a> project. After having installed MacPorts, you do a
|
||||
<code>sudo port install openssl</code>.<p>
|
||||
|
||||
After successful compilation, you do a <code>sudo make install</code> to install all required files under
|
||||
the installation directory, which is by default <code>/usr/local/</code>. A subdirectory <code>/usr/local/elog</code>
|
||||
is created which contains a simple example logbook. The ELOG server can now be started either manually with
|
||||
<p>
|
||||
<code>/usr/local/sbin/elogd</code>
|
||||
<p>
|
||||
or through the daemon servics with
|
||||
<p>
|
||||
<code>sudo launchctl load /Library/LaunchDaemons/ch.psi.elogd.plist</code>
|
||||
<p>
|
||||
To stop the service, use
|
||||
<p>
|
||||
<code>sudo launchctl unload /Library/LaunchDaemons/ch.psi.elogd.plist</code>
|
||||
<p>
|
||||
<hr>
|
||||
<h3><i>Debian</i>:</h3>
|
||||
<p>
|
||||
A Debian package is available under <a href="https://tracker.debian.org/pkg/elog">https://tracker.debian.org/pkg/elog</a>.
|
||||
|
||||
<hr>
|
||||
<h3><i>Solaris</i>:</h3>
|
||||
|
||||
<p><a href="mailto:huber@secaron.de">Martin Huber</a> reports that
|
||||
@@ -174,15 +202,6 @@ been problems with <b>ELOG</b>'s <I>keep-alive</I> feature. In such a case you n
|
||||
the "<B>-k</B>" flag to the <code><b>elogd</b></code> command line to turn keep-alives off.
|
||||
<p>
|
||||
|
||||
<h3><hr><i>Mac OS X</i>:</h3>
|
||||
|
||||
<p><a href="mailto:sak@essc.psu.edu">Sridhar Anandakrishnan</a> and
|
||||
<a href="mailto:roktas@emu.edu.tr">Recai Oktas</a> report that under Mac OS X there is a problem with
|
||||
the default stack size. The command <i><b>limit stacksize unlimited</b></i> (for tcsh) or
|
||||
<i><b>ulimit -s unlimited</b></i> (for bash) increases the stacksize and fixes this problem.
|
||||
Read the according <a href="http://midas.psi.ch/elogs/Forum/379">thread</a> in the forum.
|
||||
<p>
|
||||
|
||||
<h3><hr><i>FreeBSD</i>:</h3>
|
||||
|
||||
<p><a href="mailto:ottodavid@gmx.net">David Otto</a> maintains the
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
body {
|
||||
font-family: Verdana,Arial,Helvetica,Sans-Serif;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Courier,Fixed,monospace;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-left: 10px;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
[<a class="nav" href="#links">Links</a>] * </div>
|
||||
<P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt@psi.ch">
|
||||
Stefan Ritt</a></P>
|
||||
<div class="version">Current version is : 2.9.2</div>
|
||||
<div class="version">Current version is : 3.0.0</div>
|
||||
<center>
|
||||
<a href="http://www.softpedia.com/progClean/ELOG-Clean-30897.html"><img border="0" src="http://www.softpedia.com/images/spyward/softpedia_free_award_f.gif" alt="certificate" title="certificate" /></a>
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
[<a class="nav" href="#links">Links</a>] * </div>
|
||||
<P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt@psi.ch">
|
||||
Stefan Ritt</a></P>
|
||||
<div class="version">Current version is : 2.9.2</div>
|
||||
<div class="version">Current version is : 3.0.0</div>
|
||||
<center>
|
||||
<a href="http://www.softpedia.com/progClean/ELOG-Clean-30897.html"><img border="0" src="http://www.softpedia.com/images/spyward/softpedia_free_award_f.gif" alt="certificate" title="certificate" /></a>
|
||||
</center>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# German translation by stefan.ritt@psi.ch
|
||||
# A more recent version may be available at :
|
||||
# http://savannah.psi.ch/viewcvs/trunk/resources/eloglang.german?root=elog
|
||||
# A more recent version may be available at:
|
||||
# https://bitbucket.org/ritt/elog
|
||||
#
|
||||
|
||||
New = Neu
|
||||
@@ -476,4 +476,3 @@ CSV (";" separated) + Text = CSV (mit ";" getreent) + Text
|
||||
Entry can only be deleted %1.2lg hours after creation = Eintrag kann nur %1.2lg Stunden nach dem Anlegen gelöscht werden
|
||||
Drop attachments here... = Anhänge bitte hier ablegen...
|
||||
Insert Timestamp = Aktuelle Zeit einfügen
|
||||
|
||||
|
||||
+461
-1
File diff suppressed because one or more lines are too long
+74
-79
@@ -1768,6 +1768,36 @@ int setuser(char *str)
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
int send_with_timeout(void *p, int sock, char *buf, int size)
|
||||
{
|
||||
int status;
|
||||
time_t start, now;
|
||||
|
||||
time(&start);
|
||||
|
||||
do {
|
||||
#ifdef HAVE_SSL
|
||||
SSL *ssl = (SSL *)p;
|
||||
if (ssl)
|
||||
status = SSL_write(ssl, buf, size);
|
||||
else
|
||||
#endif
|
||||
status = send(sock, buf, size, 0);
|
||||
|
||||
time(&now);
|
||||
|
||||
// abort after 10 seconds
|
||||
if (now > start+10)
|
||||
break;
|
||||
|
||||
// repeat if we were interrupted by alarm() signal
|
||||
} while (status == -1 && errno == EINTR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
int recv_string(int sock, char *buffer, int buffer_size, int millisec)
|
||||
{
|
||||
int i, n;
|
||||
@@ -2421,7 +2451,9 @@ int retrieve_url(LOGBOOK * lbs, const char *url, int ssl, char **buffer)
|
||||
fd_set readfds;
|
||||
struct timeval timeout;
|
||||
#ifdef HAVE_SSL
|
||||
static SSL *ssl_con;
|
||||
static SSL *ssl_con = NULL;
|
||||
#else
|
||||
static void *ssl_con = NULL;
|
||||
#endif
|
||||
static int sock, last_port;
|
||||
static char last_host[256];
|
||||
@@ -2491,13 +2523,8 @@ int retrieve_url(LOGBOOK * lbs, const char *url, int ssl, char **buffer)
|
||||
|
||||
strcat(str, "\r\n");
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (ssl)
|
||||
SSL_write(ssl_con, str, strlen(str));
|
||||
else
|
||||
#endif
|
||||
send(sock, str, strlen(str), 0);
|
||||
|
||||
send_with_timeout(ssl_con, sock, (char *)str, strlen(str));
|
||||
|
||||
bufsize = TEXT_SIZE + 1000;
|
||||
*buffer = xmalloc(bufsize);
|
||||
memset(*buffer, 0, bufsize);
|
||||
@@ -6675,12 +6702,10 @@ void rsprintf(const char *format, ...)
|
||||
void flush_return_buffer()
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
if (_ssl_flag) {
|
||||
SSL_write(_ssl_con, return_buffer, strlen_retbuf);
|
||||
} else
|
||||
send_with_timeout(_ssl_con, _sock, return_buffer, strlen_retbuf);
|
||||
#else
|
||||
send_with_timeout(NULL, _sock, return_buffer, strlen_retbuf);
|
||||
#endif
|
||||
send(_sock, return_buffer, strlen_retbuf, 0);
|
||||
|
||||
memset(return_buffer, 0, return_buffer_size);
|
||||
strlen_retbuf = 0;
|
||||
}
|
||||
@@ -15432,6 +15457,8 @@ int submit_message(LOGBOOK * lbs, char *host, int message_id, char *error_str)
|
||||
char *content, *p, boundary[80], request[10000], response[10000];
|
||||
#ifdef HAVE_SSL
|
||||
SSL *ssl_con = NULL;
|
||||
#else
|
||||
void *ssl_con = NULL;
|
||||
#endif
|
||||
|
||||
text = (char *) xmalloc(TEXT_SIZE);
|
||||
@@ -15593,29 +15620,19 @@ int submit_message(LOGBOOK * lbs, char *host, int message_id, char *error_str)
|
||||
|
||||
header_length = strlen(request);
|
||||
|
||||
send_with_timeout(ssl_con, sock, request, header_length);
|
||||
send_with_timeout(ssl_con, sock, content, content_length);
|
||||
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (ssl) {
|
||||
/* send request */
|
||||
SSL_write(ssl_con, request, header_length);
|
||||
|
||||
/* send content */
|
||||
SSL_write(ssl_con, content, content_length);
|
||||
|
||||
if (ssl)
|
||||
/* receive response */
|
||||
i = SSL_read(ssl_con, response, 10000);
|
||||
|
||||
} else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* send request */
|
||||
send(sock, request, header_length, 0);
|
||||
|
||||
/* send content */
|
||||
send_tcp(sock, content, content_length, 0);
|
||||
|
||||
/* receive response */
|
||||
i = recv(sock, response, 10000, 0);
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
closesocket(sock);
|
||||
@@ -15825,6 +15842,8 @@ void submit_config(LOGBOOK * lbs, char *server, char *buffer, char *error_str)
|
||||
char *content, *p, boundary[80], request[10000], response[10000];
|
||||
#ifdef HAVE_SSL
|
||||
SSL *ssl_con = NULL;
|
||||
#else
|
||||
void *ssl_con = NULL;
|
||||
#endif
|
||||
|
||||
error_str[0] = 0;
|
||||
@@ -15895,29 +15914,18 @@ void submit_config(LOGBOOK * lbs, char *server, char *buffer, char *error_str)
|
||||
|
||||
header_length = strlen(request);
|
||||
|
||||
send_with_timeout(ssl_con, sock, request, header_length);
|
||||
send_with_timeout(ssl_con, sock, content, content_length);
|
||||
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (ssl) {
|
||||
/* send request */
|
||||
SSL_write(ssl_con, request, header_length);
|
||||
|
||||
/* send content */
|
||||
SSL_write(ssl_con, content, content_length);
|
||||
|
||||
if (ssl)
|
||||
/* receive response */
|
||||
i = SSL_read(ssl_con, response, 10000);
|
||||
|
||||
} else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* send request */
|
||||
send(sock, request, header_length, 0);
|
||||
|
||||
/* send content */
|
||||
send_tcp(sock, content, content_length, 0);
|
||||
|
||||
/* receive response */
|
||||
i = recv(sock, response, 10000, 0);
|
||||
}
|
||||
|
||||
if (i < 0) {
|
||||
closesocket(sock);
|
||||
@@ -28652,6 +28660,12 @@ void send_return(int _sock, const char *net_buffer)
|
||||
int length, header_length;
|
||||
char str[NAME_LENGTH];
|
||||
char *p;
|
||||
#ifndef HAVE_SSL
|
||||
void *ssl_con = NULL;
|
||||
#endif
|
||||
|
||||
if (!_ssl_flag)
|
||||
ssl_con = NULL;
|
||||
|
||||
if (return_length != -1) {
|
||||
if (return_length == 0)
|
||||
@@ -28681,18 +28695,10 @@ void send_return(int _sock, const char *net_buffer)
|
||||
header_length = sizeof(header_buffer) - 100;
|
||||
memcpy(header_buffer, return_buffer, header_length);
|
||||
sprintf(header_buffer + header_length, "\r\nContent-Length: %d\r\n\r\n", length);
|
||||
#ifdef HAVE_SSL
|
||||
if (_ssl_flag) {
|
||||
SSL_write(ssl_con, header_buffer, strlen(header_buffer));
|
||||
SSL_write(ssl_con, p + 4, length);
|
||||
} else {
|
||||
send(_sock, header_buffer, strlen(header_buffer), 0);
|
||||
send(_sock, p + 4, length, 0);
|
||||
}
|
||||
#else
|
||||
send(_sock, header_buffer, strlen(header_buffer), 0);
|
||||
send(_sock, p + 4, length, 0);
|
||||
#endif
|
||||
|
||||
send_with_timeout(ssl_con, _sock, header_buffer, strlen(header_buffer));
|
||||
send_with_timeout(ssl_con, _sock, p + 4, length);
|
||||
|
||||
if (get_verbose() < VERBOSE_DEBUG) {
|
||||
if (get_verbose() > 0)
|
||||
eprintf("Returned %d bytes\n", length);
|
||||
@@ -28727,27 +28733,14 @@ void send_return(int _sock, const char *net_buffer)
|
||||
memcpy(header_buffer, return_buffer, header_length);
|
||||
sprintf(header_buffer + header_length, "\r\nConnection: Close\r\n\r\n");
|
||||
}
|
||||
#ifdef HAVE_SSL
|
||||
if (_ssl_flag) {
|
||||
SSL_write(ssl_con, header_buffer, strlen(header_buffer));
|
||||
SSL_write(ssl_con, p + 4, length);
|
||||
} else {
|
||||
send(_sock, header_buffer, strlen(header_buffer), 0);
|
||||
send(_sock, p + 4, length, 0);
|
||||
}
|
||||
#else
|
||||
send(_sock, header_buffer, strlen(header_buffer), 0);
|
||||
send(_sock, p + 4, length, 0);
|
||||
#endif
|
||||
|
||||
send_with_timeout(ssl_con, _sock, header_buffer, strlen(header_buffer));
|
||||
send_with_timeout(ssl_con, _sock, p + 4, length);
|
||||
|
||||
} else {
|
||||
#ifdef HAVE_SSL
|
||||
if (_ssl_flag)
|
||||
SSL_write(ssl_con, return_buffer, return_length);
|
||||
else
|
||||
send(_sock, return_buffer, return_length, 0);
|
||||
#else
|
||||
send(_sock, return_buffer, return_length, 0);
|
||||
#endif
|
||||
|
||||
send_with_timeout(ssl_con, _sock, return_buffer, return_length);
|
||||
|
||||
}
|
||||
|
||||
if (get_verbose() < VERBOSE_DEBUG) {
|
||||
@@ -29327,7 +29320,9 @@ void server_loop(void)
|
||||
_ssl_con = NULL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else
|
||||
_ssl_con = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
/* find new entry in socket table */
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
HAVE_SSL,
|
||||
HAVE_SSL1,
|
||||
HAVE_KRB5,
|
||||
DEBUG,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user