]> git.evergreen-ils.org Git - OpenSRF.git/log
OpenSRF.git
10 years agoLP#1180849: test case - ignoring subrequest responses after respond_complete()
Galen Charlton [Mon, 16 Dec 2013 16:08:51 +0000 (08:08 -0800)]
LP#1180849: test case - ignoring subrequest responses after respond_complete()

This patch adds a regression test for verifying that subrequests
ignore additional responses after respond_complete() is called.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
10 years agoAdd some additional boolean-related JSON tests
Jeff Godin [Tue, 3 Dec 2013 18:52:39 +0000 (13:52 -0500)]
Add some additional boolean-related JSON tests

Add some additional boolean-related JSON tests, enable use strict /
use warnings for JSON tests.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
10 years agoLP#1257264: Use the built-in JSON-y test for bools
Mike Rylander [Tue, 3 Dec 2013 14:57:39 +0000 (09:57 -0500)]
LP#1257264: Use the built-in JSON-y test for bools

This removes a dependency on internal details of JSON::XS's
implementation of Boolean types which changed with the release
of JSON::XS 3.0.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jeff Godin <jgodin@tadl.org>
10 years agoLP#1257264: make test cases for JSON::XS Boolean-ness more generic
Galen Charlton [Tue, 3 Dec 2013 17:43:54 +0000 (09:43 -0800)]
LP#1257264: make test cases for JSON::XS Boolean-ness more generic

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jeff Godin <jgodin@tadl.org>
10 years agoLP#1224647: remove two invalid tests
Galen Charlton [Thu, 12 Sep 2013 19:37:57 +0000 (12:37 -0700)]
LP#1224647: remove two invalid tests

The patch for bug 1204123 changes the client_recv()
to not set the transport_client error flag, as most
of the circumstances where it would have been set were
for cases where the call to select() was interrupted
by a signal, which is not an error per se.

This patch removes two tests that were therefore
made invalid, restoring the ability of the test suite
to pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
10 years agoosrf_control --start/stop/restart-services
Bill Erickson [Thu, 5 Sep 2013 14:32:09 +0000 (10:32 -0400)]
osrf_control --start/stop/restart-services

Provide commands for controling non-router services.  This is useful in
a multi-server environment where the router runs on a different server.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
10 years agoLP#1204123 repair makefile.am warning
Bill Erickson [Tue, 3 Sep 2013 18:56:27 +0000 (14:56 -0400)]
LP#1204123 repair makefile.am warning

Avoid trailing space after backslash

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP#1204123 osrf_control warn and exit on bad host
Bill Erickson [Fri, 30 Aug 2013 18:17:02 +0000 (14:17 -0400)]
LP#1204123 osrf_control warn and exit on bad host

Any time a start action is issued (start, start_all, restart,
restart_all), osrf_control will first verify that the selected hostname
(or localhost) hosts the requested service(s).  If not, the user is
warned and the script exits before any action is taken.

Note: we do not make a similar verification for stop and signal actions,
since those may be reasonably be used even when a service is not
configured to run on the selected host.

Thanks to Jason Stephenson for the suggestion.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP#1204123 osrf_control --diagnostic improvements
Bill Erickson [Fri, 30 Aug 2013 17:09:27 +0000 (13:09 -0400)]
LP#1204123 osrf_control --diagnostic improvements

Assessing the state of each PID for each service for error conditions.

Minor cleanup.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP#1204123 osrf_control --diagnostic
Bill Erickson [Fri, 30 Aug 2013 15:27:49 +0000 (11:27 -0400)]
LP#1204123 osrf_control --diagnostic

Command prints information about running services, including
descrepencies between running vs configured and PS listing vs PID files.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 osrf_ctl.sh improvement
Bill Erickson [Tue, 27 Aug 2013 19:56:46 +0000 (15:56 -0400)]
LP1204123 osrf_ctl.sh improvement

Removing no-longer-supported --verbose flag from osrf_ctl.sh stub

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 osrf_control doc updates
Bill Erickson [Tue, 27 Aug 2013 19:52:48 +0000 (15:52 -0400)]
LP1204123 osrf_control doc updates

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoC SIGHUP handling and config reloading
Bill Erickson [Tue, 27 Aug 2013 15:47:52 +0000 (11:47 -0400)]
C SIGHUP handling and config reloading

Sending the HUP signal to a C Listener process now results in the
following:

 * Reload the opensrf_core config
 * update the log file level
 * kill idle child processes
 * child processes that are active when the signal is received are
   tracked and killed once they become idle.
 * New children are spawned per the min child settings

The primary use case for these changes is temporarily changing the log
level for a given service for debug purposes.  It may also
be used, for example, to gracefully recover excess RAM consumed by a
child process.

opensrf.xml (opensrf.settings config) is not reloaded, so min/max child
settings will not be affected.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 more osrf_ctl/control script cleanup
Bill Erickson [Fri, 16 Aug 2013 14:07:10 +0000 (10:07 -0400)]
LP1204123 more osrf_ctl/control script cleanup

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 more osrf_ctl/control script cleanup
Bill Erickson [Fri, 16 Aug 2013 14:04:55 +0000 (10:04 -0400)]
LP1204123 more osrf_ctl/control script cleanup

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 osrf_control improved sample usage
Bill Erickson [Mon, 12 Aug 2013 15:39:28 +0000 (11:39 -0400)]
LP1204123 osrf_control improved sample usage

Use a more realistic default usage message.  --config and --pid-dir have
sane defaults, so people will not normally need to specify those.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 install opensrf-perl.pl as osrf_control
Bill Erickson [Mon, 12 Aug 2013 15:33:11 +0000 (11:33 -0400)]
LP1204123 install opensrf-perl.pl as osrf_control

Symlink osrf_control to opensrf-perl.pl to act as the replacement for
osrf_ctl.sh.  I chose "osrf_control" since it matches more closely to
"osrf_config" -- also it's probably less confusing than calling it
osrf_ctl, which would likely get confused w/ osrf_ctl.sh

TODO: documentation

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 opensrf-perl.pl improve logging
Bill Erickson [Mon, 12 Aug 2013 15:31:56 +0000 (11:31 -0400)]
LP1204123 opensrf-perl.pl improve logging

Log messages by default.  Replace --verbose flag with --quiet flag.

Also treat all messages the same, instead of separating them into info
and debug.  They're all pretty useful.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 opensrf-perl.pl expansion continued
Bill Erickson [Fri, 9 Aug 2013 14:40:29 +0000 (10:40 -0400)]
LP1204123 opensrf-perl.pl expansion continued

* improved cleanup of stale pid files during startup
* added --force-clean-process option to kill orphan (no pidfile)
  processes during startup
* other minor cleanup

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 opensrf-perl.pl expansion / replace osrf_ctl
Bill Erickson [Mon, 5 Aug 2013 20:58:26 +0000 (16:58 -0400)]
LP1204123 opensrf-perl.pl expansion / replace osrf_ctl

opensrf-perl.pl can now stop/start/signal/etc. all opensrf services,
regardless of language.  It is in effect a replacement for osrf_ctl.sh
with considerably broader powers.

To ease transition, osrf_ctl.sh has been taught to pass
start/stop/restart_all commands through to opensrf-perl.pl.

The layout of commands has changed some (e.g. --start-all instead of
--action start_all) and a host of new commands have been added.

Below are the full set of commands.  See --help for full descriptions:

--config
--pid-dir
--settings-startup-pause
--localhost
--service
--verbose
--no-daemon
--help
--start-all
--start
--restart-all
--restart
--stop-all
--stop
--graceful-shutdown-all
--graceful-shutdown
--fast-shutdown-all
--fast-shutdown
--immediate-shutdown-all
--immediate-shutdown
--kill-with-fire
--signal-all
--signal
--signal-timeout

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 Remove osrf_ctl debug echos
Bill Erickson [Thu, 1 Aug 2013 14:39:21 +0000 (10:39 -0400)]
LP1204123 Remove osrf_ctl debug echos

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 Improved per-service control (C/Perl)
Bill Erickson [Wed, 31 Jul 2013 21:43:12 +0000 (17:43 -0400)]
LP1204123 Improved per-service control (C/Perl)

C opensrf no longer mantains a single master process.  Instead, like
Perl, each Listener process writes its own PID file and can be managed
individually.  Related to this, much code was cleaned up in
osrf_system.c.

osrf_ctl.sh now has the ability to stop/start individual services for
Perl and C, using the new -s <service> option.  Examples:

osrf_ctl.sh -l -a restart_c -s opensrf.math
osrf_ctl.sh -l -a restart_perl -s opensrf.settings

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 osrf_ctl.sh supports sending signals
Bill Erickson [Wed, 31 Jul 2013 13:34:19 +0000 (09:34 -0400)]
LP1204123 osrf_ctl.sh supports sending signals

Using the following new options to osrf_ctl.sh, the script can now send
signals to any/all OpenSRF Listener processes:

-a signal / signal_all
-k <signal> [value passed to 'kill -s']
-s <service>

With an action of 'signal' and service provided by -s, the specified
signal is sent only to the listener process of the service.

With an action of 'signal_all', the specified signal is sent to all
listener prcesses.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 Don't treat interrupts as errors
Bill Erickson [Wed, 24 Jul 2013 20:28:15 +0000 (16:28 -0400)]
LP1204123 Don't treat interrupts as errors

Interrupted calls to select() are generally not errors, but more likely
signals received by the process.  Avoid setting the transport_client
error flag to true in these cases.  Otherwise, after one signal is
received, no other outbound communication can occur on the client
connection.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 SIGUSR2 causes router re-register (Perl/C)
Bill Erickson [Tue, 23 Jul 2013 16:06:48 +0000 (12:06 -0400)]
LP1204123 SIGUSR2 causes router re-register (Perl/C)

When a listener process receives the USR2 signal, the 'register' command
is sent to all known routers.  This allows for the addition of new
routers to running opensrf services.

If a register command is sent to a router for which the process is
already successfully register, the router will safely discard it, so
multiple SIGUSR2 calls are safe.

Minor int => bool clarification repair to existing C shutdown
(prefork_clear) code.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 opensrf.settings reload file option
Bill Erickson [Tue, 23 Jul 2013 15:31:34 +0000 (11:31 -0400)]
LP1204123 opensrf.settings reload file option

opensrf.settings API calls

opensrf.settings.host_config.get
opensrf.settings.default_config.get

now sport an additional "reload" boolean parameter.  When set, the settings
file (opensrf.xml) will be reloaded from the file system to pick up any
changes which have occurred since the last load/reload.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 SIGTERM graceful shutdown (C)
Bill Erickson [Mon, 22 Jul 2013 20:44:26 +0000 (16:44 -0400)]
LP1204123 SIGTERM graceful shutdown (C)

When a TERM signal is received, the listener parent process will wait
for all child processes to complete any active tasks before killing the
child processes and shutting down.

Receiving a SIGINT or SIGQUIT results in a non-graceful shutdown.

In all cases, the system first un-registers with all routers.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 SIGUSR1 causes router unregister (Perl/C)
Bill Erickson [Tue, 23 Jul 2013 14:40:09 +0000 (10:40 -0400)]
LP1204123 SIGUSR1 causes router unregister (Perl/C)

$ kill -s USR1 <listener_pid>

The listener process will unregister all router connections.  This
allows services to remove themselves from consideration for new
inbound requests while allowing their drone processes to complete
any currently running tasks.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 SIGTERM causes graceful shutdown (Perl)
Bill Erickson [Fri, 21 Jun 2013 20:43:01 +0000 (16:43 -0400)]
LP1204123 SIGTERM causes graceful shutdown (Perl)

When sent the SIGTERM signal, listener processes will wait for all child
processes to complete their currently running tasks before killing all
child processes and exiting.

SIGQUIT and SIGINT can still be used for semi-graceful shutdowns, where
the listener de-registers and cleans up child processes, but does not
wait for child processes to finish their tasks.

To kill with fire, SIGKILL is still your friend.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agoLP1204123 Set SIGCHLD handler to DEFAULT for children (perl)
Bill Erickson [Wed, 26 Jun 2013 18:51:52 +0000 (14:51 -0400)]
LP1204123 Set SIGCHLD handler to DEFAULT for children (perl)

Remove the special SIGCHLD handler applied to the parent/listener
process from spawned child processes (drones) by setting child handler to
DEFAULT.  Otherwise, if an OpenSRF drone process spawns a sub-process,
the drone will execute the SIGCHLD handler meant for the Listener when
the sub-process dies, wherein hijinks ensue.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
10 years agosilence some uninitialized warnings
Jason Etheridge [Thu, 1 Aug 2013 18:15:14 +0000 (14:15 -0400)]
silence some uninitialized warnings

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
10 years agoLP#1188195: add tests for setting default client locale
Galen Charlton [Tue, 6 Aug 2013 22:00:15 +0000 (22:00 +0000)]
LP#1188195: add tests for setting default client locale

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
10 years agoLP#1188195: Default per-process client locale (Perl)
Bill Erickson [Thu, 23 May 2013 19:17:12 +0000 (15:17 -0400)]
LP#1188195: Default per-process client locale (Perl)

Get/set the locale used by all new client sessions
for the current process.  This is primarily useful
for clients that wish to make a series of opensrf
calls and don't wish to set the locale for each new
AppSession object.

The caller should reset the locale when done using
reset_locale(), as the locale will otherwise persist
for the current process until set/reset again.

This is not for SERVER processes, since they
adopt the locale of their respective callers.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
10 years agoLP#1208860: fix sprintf without format string.
Pasi Kallinen [Tue, 6 Aug 2013 13:56:06 +0000 (16:56 +0300)]
LP#1208860: fix sprintf without format string.

Fixes error preventing installation on Debian testing and
removes warning on earlier versions of Debian.

Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
10 years agoLP1198983 disable multipart/mixed for Firefox
Bill Erickson [Thu, 11 Jul 2013 20:36:43 +0000 (16:36 -0400)]
LP1198983 disable multipart/mixed for Firefox

Only allow multipart mixed/replace message within the Evergreen staff
client for now.  Eventually, multi-part messages will be wholly
deprecated.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoLP#1162907: don't require installing RPC::XML
Galen Charlton [Fri, 5 Apr 2013 03:01:49 +0000 (23:01 -0400)]
LP#1162907: don't require installing RPC::XML

RPC::XML is not required by OpenSRF, although it is an
Evergreen dependency.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
11 years agoMultisession blocking repair
Bill Erickson [Fri, 15 Mar 2013 19:56:55 +0000 (15:56 -0400)]
Multisession blocking repair

The new socket blocking code for multisession failed to take into
account that socket activity outside of the main block could lead to a
deadlock situation.  For example:

* Check status of request A -> not complete
* Check status of request B -> whatever
* Request A may now be complete, since checking the status of any request
  affects all requests
* Return to blocking loop because we think there is pending data, but in
  fact all data has already been pulled from the socket.

The solution is for session_reap() to make a sweep and check for changes
in requests that are now complete as a side-effect of checking for
completed requests.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoWhen running methods for clients, send plain warnings to "real" logs
Lebbeous Fogle-Weekley [Wed, 14 Nov 2012 19:50:46 +0000 (14:50 -0500)]
When running methods for clients, send plain warnings to "real" logs

Code inside an OpenSRF application method may use Perl libraries that warn
and carp like most Perl code is wont to do.  Instead of letting
those message go to STDERR where they can be easily missed (and take up
lots of disk space on application boxes), why not catch them and
redirect them to our "real" logs using OpenSRF::Utils::Logger ?

Deployment of this change would probably have the side effect of bringing
to light bugs in applications (Evergreen) that will suddenly seem very
noisy.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoMinor whitespace repairs in Server.pm
Bill Erickson [Tue, 16 Oct 2012 13:28:20 +0000 (09:28 -0400)]
Minor whitespace repairs in Server.pm

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoPerl SIGHUP handling and config reloading
Bill Erickson [Mon, 15 Oct 2012 21:23:19 +0000 (17:23 -0400)]
Perl SIGHUP handling and config reloading

Sending the HUP signal to a Perl Listener process now results in the
following:

 * Reload the opensrf_core config
 * re-init the logger
 * kill idle child processes
 * child processes that are active when the signal is received are
   tracked and killed once they become idle.
 * New children are spawned per the min child settings

The primary use case for these changes is temporarily changing the log
level (or log file) for a given service for debug purposes.  It may also
be used, for example, to gracefully recover excess RAM consumed by a
child process.

Not all values in opensrf_core.xml are affected by a SIGHUP.  Since the
goal is a gracful reload, no attempt is made by the listener process to
re-connect to jabber or re-register with the opensrf router(s).  Child
processes will by necessity connect to Jabber during startup, though, so
any changes to the jabber configuration will affect child processes.  In
general, it's best to affect jabber configuration changes with a true
service restart.

opensrf.xml (opensrf.settings config) is not reloaded, so min/max child
settings will not be affected.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoLP#1101254: remove memory leak in HTTP translator
Galen Charlton [Fri, 18 Jan 2013 18:12:35 +0000 (13:12 -0500)]
LP#1101254: remove memory leak in HTTP translator

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
11 years agoDebian wheezy Makefile.install target
Bill Erickson [Tue, 19 Jun 2012 19:36:25 +0000 (15:36 -0400)]
Debian wheezy Makefile.install target

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoBlock on recv instead of loop/polling in MultiSession
Bill Erickson [Thu, 31 Jan 2013 20:05:53 +0000 (15:05 -0500)]
Block on recv instead of loop/polling in MultiSession

When the time comes to wait for responses to arrive, block on the XMPP
socket (which uses select() under the covers) until data arrives,
instead of looping furiously and calling receive in non-blocking mode.
Before this change, waiting on responses resulted in long-running CPU
spikes.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
11 years agoStop using a non-standard default PREFIX for installs
Dan Scott [Fri, 19 Oct 2012 20:28:59 +0000 (16:28 -0400)]
Stop using a non-standard default PREFIX for installs

Working towards packaging, we will be better off if we start getting used to
installing OpenSRF in standard FHS directories.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
11 years agoLP#1132247: fix compilation warnings in C test cases
Galen Charlton [Sat, 23 Feb 2013 08:26:06 +0000 (00:26 -0800)]
LP#1132247: fix compilation warnings in C test cases

Also, since osrfList maintains a list of pointers, not
values, adjust some of the test cases to discourage
anybody inclined to copy-and-paste from the test cases
from storing pointers to stack variables in an osrfList.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
11 years agoLogger.pm whitespace cleanup
Bill Erickson [Wed, 17 Oct 2012 18:37:01 +0000 (14:37 -0400)]
Logger.pm whitespace cleanup

Apply 4-space "tabs" consistently.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
11 years agoEnable client logtrace with environment vars
Bill Erickson [Wed, 17 Oct 2012 18:31:02 +0000 (14:31 -0400)]
Enable client logtrace with environment vars

Supports a new environment variable OSRF_LOG_CLIENT which, if true,
enables control and generation of the client log trace value.  This is
the same as setting <client>true</client> within the opensrf core
configuration file.

As a shortcut, if the MOD_PERL environment variable is set, assume
client=true.

This allows clients and non-clients to share an opensrf core
configuration file, when previously the only difference between the two
was the <client> setting.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
11 years agoTest for Apache executable in sbin dirs
Dan Scott [Sun, 27 Jan 2013 16:08:12 +0000 (11:08 -0500)]
Test for Apache executable in sbin dirs

Debian apparently doesn't include /usr/sbin in the default user PATH, so
add an APXS2-like lookup with likely locations if we don't find the
apache executable in our standard path.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
11 years agoSupport Apache 2.4 client IP address lookups
Dan Scott [Thu, 17 Jan 2013 02:59:22 +0000 (21:59 -0500)]
Support Apache 2.4 client IP address lookups

The Apache 2.4 API replaces the conn_rec->remote_ip member with
conn_rec->client_ip or conn_rec->useragent_ip (per
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html). client_ip
seems to be the best choice for us, to avoid everything being logged
from the load balancer or proxy instead of the client's address.

This code detects the version of Apache and uses client_ip if it is 2.4
or greater.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
11 years agoPrevent "uninitialized value" warnings in parameter logging
Bill Erickson [Tue, 26 Jun 2012 13:21:57 +0000 (09:21 -0400)]
Prevent "uninitialized value" warnings in parameter logging

Use of uninitialized value $p[0] in join or string at
/usr/local/share/perl/5.10.1/OpenSRF/Application.pm line 130.

This is caused when the array of method params contains null/undef
values.  Prevent the warnings by replacing these values w/ empty
strings.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoChange OSRF_JAVA_DEPSDIR so building Java just works.
Jason Stephenson [Wed, 31 Oct 2012 14:21:18 +0000 (10:21 -0400)]
Change OSRF_JAVA_DEPSDIR so building Java just works.

OSRF_JAVA_DEPSDIR was being set to /opt/java by configure without any
documentation to that effect. The src/java/deps.sh downloads the deps files
to src/java/deps. This means that you cannot just build java without either
copying the jars from src/java/deps or altering src/java/Makefile.

This edit changes the AC_SUBST call to replace OSRF_JAVA_DEPSDIR with deps,
so that you can at least build java without making any changes.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
11 years agoSafer casting in java config parsing
Bill Erickson [Thu, 1 Nov 2012 13:41:52 +0000 (09:41 -0400)]
Safer casting in java config parsing

Java config parsing, in particular getString and getInt, no longer fail
when encountering a number value in the internl JSON->Map object.

Java does not allow the following cast:

String s = (String) someNumber;

Instead, rely on the object's toString() which is safe and guaranteed
to exist.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoTypo in configure.ac: 'framweork'
Dan Scott [Mon, 19 Nov 2012 15:51:26 +0000 (10:51 -0500)]
Typo in configure.ac: 'framweork'

Reported by David Busby of edoceo in
https://bugs.launchpad.net/opensrf/+bug/1080458 - thanks David!

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoAdd 2.1.2 ChangeLog entries
Dan Scott [Sun, 18 Nov 2012 12:49:28 +0000 (07:49 -0500)]
Add 2.1.2 ChangeLog entries

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoBump version numbers for 2.1.2
Dan Scott [Sun, 18 Nov 2012 12:41:46 +0000 (07:41 -0500)]
Bump version numbers for 2.1.2

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoWhitespace in OpenSRF/System.pm
Dan Scott [Fri, 16 Nov 2012 15:36:28 +0000 (10:36 -0500)]
Whitespace in OpenSRF/System.pm

Spaces not tabs.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoMove setting of OpenSRF::Application::shared_conf to load_bootstrap_config.
Jason Stephenson [Thu, 15 Nov 2012 17:20:11 +0000 (12:20 -0500)]
Move setting of OpenSRF::Application::shared_conf to load_bootstrap_config.

shared_conf was not available and broke clients that were not in a
service, such as the Evergreen CStoreEditor.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoBump release numbers, create 2.1.1 change log
Dan Scott [Wed, 31 Oct 2012 03:39:25 +0000 (23:39 -0400)]
Bump release numbers, create 2.1.1 change log

Signed-off-by: Dan Scott <dan@coffeecode.net>
Conflicts:
ChangeLog

11 years agoChopChop is dead, long live ChopChop.
Bill Erickson [Mon, 21 May 2012 20:42:12 +0000 (16:42 -0400)]
ChopChop is dead, long live ChopChop.

It was never fully baked, nor was it secure, nor does it compile cleanly
with -Wall, nor does it provide any useful examples for working with
opensrf, etc.  Time to clear out.  So long, chopchop.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoBump libopensrf version-info revision and age
Dan Scott [Tue, 6 Nov 2012 17:32:48 +0000 (12:32 -0500)]
Bump libopensrf version-info revision and age

The log redaction functionality changed the source files (thus 'age'
gets bumped) and is backwards-compatible (thus 'revision' gets bumped)
but maintains the same interface (thus 'current' stays the same).

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoPurge the wildly out-of-date Roadmap document
Dan Scott [Wed, 31 Oct 2012 03:27:34 +0000 (23:27 -0400)]
Purge the wildly out-of-date Roadmap document

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoProtect against empty/invalid log_protect sections
Dan Wells [Wed, 31 Oct 2012 14:21:14 +0000 (10:21 -0400)]
Protect against empty/invalid log_protect sections

Connectivity would fail if the log_protect section of opensrf_core.xml
was empty, or contained only comments, as it does in the default
example. Add a simple guard against this potential problem.  This fix
will also protect against cases where the 'log_protect' section
contains text rather than separate configuration elements.

Credit to Dan Scott for finding the bug and working out how to fix it.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoConsolidate duplicate osrfMethodVerifyContext handler
Bill Erickson [Wed, 17 Oct 2012 19:57:14 +0000 (15:57 -0400)]
Consolidate duplicate osrfMethodVerifyContext handler

Log redaction was not occuring in some cases because the code was using
the OSRF_METHOD_VERIFY_CONTEXT macro instead of the similarly named
function which does the same thing.  This change points the macro at the
function so that all code uses the same underlying code.

Note this change turns on CALL param logging unconditionally, whereas
users of the macro would previously have been able to avoid CALL logging
via the OSRF_LOG_PARAMS variable.  In practice, little code uses the
macro and all code enables OSRF_LOG_PARAMS.  If we need to add this
control back, it can be added directly to osrfMethodVerifyContext().
For now, it's one less env variable we need to define.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoLog redaction for sensitive input values, Perl side
Dan Wells [Fri, 12 Oct 2012 13:45:35 +0000 (09:45 -0400)]
Log redaction for sensitive input values, Perl side

This commit attempts to do the same as the C log redaction fix,
but now at the Perl level.  The Perl configuration code was a
little more crufty than the C side, so an additional feature was
added to Config.pm to support the new 'shared' section.  At some
point we should consider a ground-up rewrite of Config.pm, as the
code seems to suffer some from its INI file roots.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoLog redaction for sensitive input values, C side
Dan Wells [Wed, 10 Oct 2012 21:28:07 +0000 (17:28 -0400)]
Log redaction for sensitive input values, C side

Some service/methods deal with sensitive information (passwords,
financial, etc.).  All input values (e.g. gateway method params)
are currently logged in the activity log regardless of your log
level.  This commit will allow you to redact the params of any
method which matches a configurable set of left-anchored string
values.

This commit adds the initial config, and covers redaction of method
parameters sent through the gateway, the translator, and more general
OpenSRF C applications.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoFix installation on Ubuntu Precise.
Jason Stephenson [Tue, 6 Nov 2012 14:16:18 +0000 (09:16 -0500)]
Fix installation on Ubuntu Precise.

Remove libreadline5-dev and replace with libreadline-dev for Ubuntu
and Debian.  This installs libreadline6, but everything still works
since there's nothing version specific in our use of libreadline.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoUse apt-get instead of aptitude on Debian / Ubuntu
Dan Scott [Mon, 22 Oct 2012 15:50:21 +0000 (11:50 -0400)]
Use apt-get instead of aptitude on Debian / Ubuntu

Reports from the field state that aptitude is not installed by default on
Ubuntu any longer; thus go with the sure thing.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoRemove the reference to Evergreen in the README
Dan Scott [Mon, 22 Oct 2012 15:53:24 +0000 (11:53 -0400)]
Remove the reference to Evergreen in the README

Stephen Wills reported problems installing Evergreen because of missing
dependencies, and reading the OpenSRF README shows that it refers to the
Evergreen prerequisite installer in a confusing way that might lead to
users using only the Evergreen Makefile.install, rather than using the
OpenSRF Makefile.install.

In addition, Fedora 16 is going to be out of support soon, and Fedora 17
and 18 are well-tested targets now.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoNo, Ubuntu Hardy is not well-tested for 2.1.0
Dan Scott [Thu, 31 May 2012 03:12:32 +0000 (23:12 -0400)]
No, Ubuntu Hardy is not well-tested for 2.1.0

One more reference to Ubuntu Hardy that we can remove from the
README/INSTALL.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoBump version numbers to help with library compatibility
Dan Scott [Thu, 31 May 2012 02:33:17 +0000 (22:33 -0400)]
Bump version numbers to help with library compatibility

By bumping the OpenSRF version numbers for Perl libs, Python libraries,
and the libtool versioning for the libopensrf library, projects that
build on OpenSRF will be able to flag the minimum required version and
bail out early if an older version of OpenSRF has been installed.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoAdd "tar" to base prereqs to appease autotools
Dan Scott [Tue, 22 May 2012 20:45:33 +0000 (16:45 -0400)]
Add "tar" to base prereqs to appease autotools

On a minimal install of Fedora 17, I was running into the perplexing
error message whilst running 'autoreconf -i':

libtoolize: can not copy `/usr/share/libtool/config/ltmain.sh' to `./'

This was confusing because a manual copy would, in fact, copy the file
just fine.

http://lists.gnu.org/archive/html/libtool/2009-07/msg00030.html finally
lead to enlightenment: autotools uses "tar" to copy files, not "cp".
Thus, to avoid similar head-scratching install problems in the future,
add "tar" to the base prerequisites for building OpenSRF (both to the
DEBs list and the RPMs list).

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoUpdate OS support in README / Makefile.install
Dan Scott [Tue, 22 May 2012 06:26:04 +0000 (02:26 -0400)]
Update OS support in README / Makefile.install

Kick Debian Lenny, Ubuntu Hardy, and RHEL 5 / CentOS 5 to the curb.

Also change the name of the README to the more generic & instructive
"Installing OpenSRF" rather than "README for OpenSRF #.#.#".

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoNagios Example Plugin for monitoring services
Thomas Berezansky [Wed, 23 May 2012 14:13:41 +0000 (10:13 -0400)]
Nagios Example Plugin for monitoring services

Does not check that all drones in a brick are fully up, just that the
entire brick will respond to each service, even if only one drone happens
to be running the listener properly (and said listener is responding).

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoDetect and repair multipart/mixed message delivery errors
Bill Erickson [Mon, 2 Apr 2012 18:55:56 +0000 (14:55 -0400)]
Detect and repair multipart/mixed message delivery errors

For unknown reasons, the Content-Type header will occasionally be
included in the XHR.responseText for multipart/mixed messages.  When
this happens, strip the header and newlines from the message body and
re-parse.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoRemove Evergreen 2.0 from automated builds
Dan Scott [Wed, 23 May 2012 04:50:49 +0000 (00:50 -0400)]
Remove Evergreen 2.0 from automated builds

rel_2_0 is no longer in support, thus it's time to remove it from the
automated testing builds.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agofix up index/position type for calls of various osrfList* functions
Galen Charlton [Mon, 21 May 2012 21:29:05 +0000 (17:29 -0400)]
fix up index/position type for calls of various osrfList* functions

osrfListSet, osrfListRemove, osrfListGetIndex, and osrfListExtract
all expect unsigned ints for the index/position parameter.

src/jserver is ignored by this commit as its removal is pending.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoRemove comparisons that can never evaluate to true
Dan Scott [Sat, 5 May 2012 05:58:22 +0000 (01:58 -0400)]
Remove comparisons that can never evaluate to true

Using clang as the compiler results in 4 warnings like the following:

osrf_list.c:106:23: warning: comparison of unsigned expression < 0 is
always false [-Wtautological-compare]
        if(!list || position < 0) return NULL;
                    ~~~~~~~~ ^ ~

(Explanation: "position" is an unsigned int; thus the comparison to < 0
can never evaluate to true).

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoLP954059: Silence uninitialized var warning
Dan Scott [Sat, 5 May 2012 05:32:25 +0000 (01:32 -0400)]
LP954059: Silence uninitialized var warning

Compiling osrf_utf8.c generates the following warning:

osrf_utf8.c:510:29: warning: utf8_char may be used uninitialized in this
function [-Wuninitialized]

So... initialize utf8_char when we declare it, and make the compiler
happy.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years agoLP# 953299 - defend against null and zero-length cache keys
Galen Charlton [Mon, 21 May 2012 21:02:34 +0000 (17:02 -0400)]
LP# 953299 - defend against null and zero-length cache keys

Ignore undefined and zero-length (after key normalization) cache
keys.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoLP# 953299 - Prevent get/set of invalid cache keys
Dan Scott [Mon, 21 May 2012 16:18:41 +0000 (12:18 -0400)]
LP# 953299 - Prevent get/set of invalid cache keys

Clients of OpenSRF::Utils::Cache occasionally request cache keys that
contain invalid characters (a particular case is ISBNs that contain
spaces), so strip those out of incoming get/set requests to avoid ugly
memcached errors.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
11 years ago.gitignore - ignore more built stuff in fewer lines
Dan Scott [Mon, 21 May 2012 16:41:25 +0000 (12:41 -0400)]
.gitignore - ignore more built stuff in fewer lines

Use the power of glob to catch more built files that we want to ignore,
while simplifying the .gitignore file significantly.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoRevert inadvertently introduced debugging code
Dan Scott [Mon, 21 May 2012 15:48:26 +0000 (11:48 -0400)]
Revert inadvertently introduced debugging code

In commit 91b8790c, several debugging lines were accidentally committed
to the OpenSRF caching utility. Revert that change.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoMinor cleanups to Java dependency build process
Dan Scott [Wed, 2 May 2012 02:11:00 +0000 (22:11 -0400)]
Minor cleanups to Java dependency build process

While configure.ac still hardcodes the expected location of the Java
dependencies (JSON and Memcached classes), we can clean up some of the
lower-level challenges with the Java build.

* StAX and WSTX were rolled into the core Java environment long ago,
  so there's no need to download them and even less need to verify
  that the downloaded version exist.
* The Memcached class is now up to 2.0.1, per deps.sh, but the deps.inc
  file was pointing at 1.5.1.
* Speaking of the deps.inc file, nothing seems to use it; delete it.
* The Makefile was dying because the variables for the Memcached and
  JSON classes weren't defined. Define those at the top of the Makefile.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoClean up root directory: INSTALL, .gitignore, autoreconf
Dan Scott [Wed, 2 May 2012 02:08:23 +0000 (22:08 -0400)]
Clean up root directory: INSTALL, .gitignore, autoreconf

* Update the README to avoid running autoreconf with the "-f" flag.
* Make the INSTALL file a symbolic link to the README to avoid
  creating a generic INSTALL file each time autoreconf is run.
* Add a .gitignore file that ignores all of the built files.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoChange Java deps.sh to include . in CLASSPATH
Dan Scott [Wed, 2 May 2012 01:31:38 +0000 (21:31 -0400)]
Change Java deps.sh to include . in CLASSPATH

Following the directions given by running deps.sh was a little bit
frustrating; we need to work in some documentation on how to use the
Java bits of OpenSRF - and perhaps look at a more standard option like
maven for dependencies.

Signed-off-by: Dan Scott <dan@coffeecode.net>
11 years agoJava Gateway interface improved exception handling
Bill Erickson [Fri, 16 Mar 2012 13:56:13 +0000 (09:56 -0400)]
Java Gateway interface improved exception handling

Handle any exceptions that should not reasonably occur in normal
operation under the covers.  Bubble the rest up.  Update test code with
examples.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoJava gateway interface test class
Bill Erickson [Thu, 15 Mar 2012 21:26:16 +0000 (17:26 -0400)]
Java gateway interface test class

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoJava HTTP gateway interface
Bill Erickson [Mon, 27 Feb 2012 23:05:07 +0000 (18:05 -0500)]
Java HTTP gateway interface

Supports sync and async requests.  Async requests support onResponse,
onComplete, and onError handlers.

Supports a max-threads value to limit the number of activately
communicating threads over any connection.  When max-threads is reached,
requests are queued and delivered as soon as there is room.

Note that since this is talking to the OpenSRF gateway and not the
translater, responses are simply collected and passed one at a time to
onResponse.  They are not streamed.  The goal of supporting onResponse
is to provide the same client API for both the gateway and translator.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoRemove GNU default INSTALL file
Dan Scott [Mon, 23 Apr 2012 18:17:35 +0000 (14:17 -0400)]
Remove GNU default INSTALL file

GNU autotools generate an INSTALL file that is generic and which
conflicts with the instructions given in the README. Installation is
already hard enough without conflicting instructions, so delete the
INSTALL file.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoautotools - do not explicitly include m4 directory
Dan Scott [Mon, 23 Apr 2012 18:13:37 +0000 (14:13 -0400)]
autotools - do not explicitly include m4 directory

Some versions of autotools complain bitterly if an m4 include directory
is specified that does not exist.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoName the bootstrapping steps in buildbot
Dan Scott [Mon, 23 Apr 2012 17:45:14 +0000 (13:45 -0400)]
Name the bootstrapping steps in buildbot

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoFix buildbot configuration
Dan Scott [Mon, 23 Apr 2012 17:16:25 +0000 (13:16 -0400)]
Fix buildbot configuration

Need to define our tests before they're called; also, can't blindly
invoke a step out of the proper scope. Duh.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
11 years agoSwitch to autoreconf instead of autogen.sh
Dan Scott [Mon, 23 Apr 2012 16:52:57 +0000 (12:52 -0400)]
Switch to autoreconf instead of autogen.sh

Update the buildbot config accordingly to avoid erroneous errors of
erroneosity.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
12 years agoUpdated buildbot.cfg for current build environments
Dan Scott [Sun, 8 Apr 2012 18:53:36 +0000 (14:53 -0400)]
Updated buildbot.cfg for current build environments

* Drop Ubuntu 8.04 from the list of build environments.
* OpenSRF: drop rel_1_6, add rel_2_1
* Evergreen: drop rel_1_6_1, add rel_2_2
* Adjust for buildbot 0.86 API changes to avoid deprecation
* Improve PEP8 compliance

Signed-off-by: Dan Scott <dan@coffeecode.net>
12 years agoAdd trailing period, "localhost" to ejabberd.cfg example
Dan Scott [Fri, 23 Mar 2012 17:05:31 +0000 (13:05 -0400)]
Add trailing period, "localhost" to ejabberd.cfg example

Thanks to Yamil Suarez for noticing a discrepancy between the older wiki
instructions and the README.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
12 years agoPrevent undef warnings on perl socket read nbytes test
Bill Erickson [Wed, 14 Mar 2012 15:38:18 +0000 (11:38 -0400)]
Prevent undef warnings on perl socket read nbytes test

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
12 years agoDetect remote disconnect in Perl XMPP reader
Bill Erickson [Mon, 20 Feb 2012 19:40:30 +0000 (14:40 -0500)]
Detect remote disconnect in Perl XMPP reader

When the jabber server severs the connection, it leaves the Perl libs
with a socket that perpetually appears ready for reading, but always
returns 0 bytes.  This produces a loop in the client code.  This change
detects this situation, logs an error, and throws an exception.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
12 years agoProtect gateway from format-string crashes in data
Dan Wells [Tue, 6 Mar 2012 20:08:33 +0000 (15:08 -0500)]
Protect gateway from format-string crashes in data

As a common security measure, printf-style formatting codes are
not allowed to be directly interpreted from a writable segment.
The gateway code currently has the following function call:

osrfLogActivity( OSRF_LOG_MARK, act->buf );

This is a variadic function which expects the 'act->buf' position
to contain a format string and any trailing arguments to be the
values passed to the formatter.  Since act->buf is the value of
what we passed in, some data inadvertantly contains format strings,
and since it is a writable segment, the program crashes.  Here is
an example of a crash-causing call:

http://localhost/osrf-gateway-v1?service=test&method=test&param=%22%251n%22

The param is interpreted as "%1n" and abruptly fails.

The simple solution is to include a formatter so that our param gets
demoted to being mere data, i.e.:

osrfLogActivity( OSRF_LOG_MARK, "%s", act->buf );

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
12 years agoStop warning about missing parentheses...
Thomas Berezansky [Wed, 7 Mar 2012 21:42:21 +0000 (16:42 -0500)]
Stop warning about missing parentheses...

...by adding them.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
12 years agoRefresh child file handles on status read
Bill Erickson [Thu, 16 Feb 2012 22:31:29 +0000 (17:31 -0500)]
Refresh child file handles on status read

If a child process dies while the parent is attempting to read status
information from the child, the pipe connecting the two will be cleaned
up.  The parent mustn't attempt to read from the dead pipe or it will
result in a bad file descriptor error, culminating in a high-cpu
infinite loop on the parent (Listener) process.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>