LP1999823: Additional growing_buffer function names If mod_shib is installed on Ubuntu our apache modules will crash because of a function name collision with libssh. This patch adds additional names for our growing_buffer manipulation functions so the modules can use them but the old names are still available for other users. Signed-off-by: Jason Boyer <jboyer@equinoxOLI.org> Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop> Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
LP1830642 Remove variable args from md5sum() Remove support for passing variable args to the md5sum() function, since no code currently uses this, and it causes problems processing strings with '%' characters. Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
LP#1729610: return new OpenSRF status if backlog queue fills up This patch teaches Perl services how to return a new OpenSRF status, OSRF_STATUS_SERVICEUNAVAILABLE (code 503) if the backlog queue for a service gets full. To test ------- [1] Set a low max_backlog_queue for opensrf.sloooow and a low max_children. [2] Arrange for srfsh to fire off a bunch of opensrf.sloooow.wait requests. [3] Verify that requests that come in after the backlog queue fills up immediately get 503 exceptions. Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Mike Rylander <mrylander@gmail.com>
LP#1709710: Make chunk sizing smart about XML quoting XML inside JSON as a quoted string that's itself inside XML causes quite the pile up of nested excaping of certain characters in OpenSRF PARTIAL_RESPONSE messages. Here we check for the worst offenders (<, >, &, and ") and account for the cost of escaping them in chunked response stanzas. Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jason Stephenson <jason@sigio.com> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
LP#1612771: fix chunking for atomic C methods This patch also refactors the code that actually does the splitting and sending of chunked responses into a new public function, osrfSendChunkedResult(). Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Ben Shum <ben@evergreener.net> Signed-off-by: Mike Rylander <miker@esilibrary.com>
LP#1612771: set Perl / C max_chunk_size default sizes default max bundle size == 25K default max chunk size == 50K Note with Ejabberd using 65536 as the default max stanza size, these new OpenSRF defaults mean that all messages will fit the default message size constraints -- i.e. no more need to raise the max_stanza_size. Signed-off-by: Bill Erickson <berick@esilibrary.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
LP#1485371: Use client-supplied TZ Currently, there is no protocol-level mechanism for passing the client's desired timezone to the server. In much the same way we pass the locale, we can let the server know what timezone it should use when interpreting time stamps. To do this we: * Teach perl server code to live in the client TZ, if supplied * Teach perl client code to send the current $ENV{TZ} * Teach javascript library to include client TZ in gateway/translator/websocket communication * Teach C code to pull the incoming TZ and apply it to outgoing messages * Teach srfsh to pull TZ from the environment and pass it with requests Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
LP#1343578: Add support for log tagging The ability to provide instance-specific log tagging via syslog would make running multiple instances much easier to manage. So this branch does that. Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
LP#1268619: websocket : apache gateway minor fixes Replace remaining remote_ip calls with a get_client_ip() function which operates for apache2 and apache4. Make log functions for applying a log trace value accept const char*'s Signed-off-by: Bill Erickson <berick@esilibrary.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
LP#1234816: improve const-correctness of osrfCachePutString and osrfCachePutObject Since the cache key is not modified by osrfCachePutString and osrfCachePutObject, this patch changes the key parameter of those two functions from char* to const char*. It also updates one caller osrfCachePutObject to not cast away const-ness. This patch has no functional impact, but enables future callers of osrfCachePut* to pass constant strings without having to cast away the const-ness. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: Bill Erickson <berick@esilibrary.com>
LP#1286198: Teach osrf_router to (optionally) write its own PID files Also, tiny bit of noise squelching on osrf_control/opensrf-perl.pl Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com> Signed-off-by: Mike Rylander <mrylander@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
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>
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>
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>
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>