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#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#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>
Eliminate the daemonize_write_pid function (thereby reverting a previous change). It works better, and is less convoluted, to write the PID file from the child process instead of from the parent process. M include/opensrf/utils.h M src/libopensrf/utils.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1955 9efc2488-bf62-4759-914b-345cdb29e865
Fix a bug that occasionally caused OSRF not to shut down cleanly. The osrf_ctl.sh script had been using ps + grep to capture the process ID (PID) of the opensrf-c daemon so that it could send a SIGINT signal to it later to shut it down. However the script was also capturing the PIDs of the daemon's child processes (i.e. the listener processes), which hadn't yet changed to application-specific names. As a result, when shutting down, the listener processes would receive signals from two different sources: from the opensrf-c daemon and from the surrounding shell script. If the signal from opensrf-c got there first, the kill from the script would fail, and the script would abort, even though the process had been successfully killed. The solution is for opensrf.c to write the daemon's PID directly to a file, instead of relying on ps + grep to capture it. The file name is specified by an additional command line parameter, which (for upward compatibility) is currently optional. Because this change involves a change to the osrf_ctl.sh script, it will be necessary to run configure before the usual make and make install. If you are using the usual configuration, run the following from within the OSRF trunk directory: ./configure --prefix=/openils --sysconfdir=/openils/conf If you don't run configure, the old osrf_ctl.sh script will continue to work as it has in the past, and you won't get the benefit of the change. M include/opensrf/utils.h M include/opensrf/osrf_system.h M src/libopensrf/utils.c M src/libopensrf/opensrf.c M src/libopensrf/osrf_system.c M bin/osrf_ctl.sh.in git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1953 9efc2488-bf62-4759-914b-345cdb29e865
No substantive changes. Corrected some erroneous comments, and tweaked the white space here and there. M include/opensrf/utils.h git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1847 9efc2488-bf62-4759-914b-345cdb29e865
1. A minor streamlining of va_list_to_string(), to eliminate a layer of copying. 2. Corrected some faulty comments for doxygen. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1765 9efc2488-bf62-4759-914b-345cdb29e865
1. Add comments to be recognized by doxygen or other such documentation generators. 2. Change the values returned by buffer_fadd(), buffer_add(), buffer_add_n(), and buffer_add_char() to make them more consistent. In practice we never pay any attention to the return values anyway. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1763 9efc2488-bf62-4759-914b-345cdb29e865
Prepare for #inclusion in C++ programs git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1579 9efc2488-bf62-4759-914b-345cdb29e865
Rewrote the OSRF_MALLOC macro so that it evaluates each of its arguments only once. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1578 9efc2488-bf62-4759-914b-345cdb29e865
Eliminated four dead functions that are never called except by each other: json_parse_file() jsonParseFile() legacy_jsonParseFile() file_to_string() The files affected: utils.h utils.c osrf_json.h osrf_json_tools.c osrf_legacy_json.h osrf_legacy_json.c git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1574 9efc2488-bf62-4759-914b-345cdb29e865
Tinkering with macros. 1. In OSRF_BUFFER_ADD, OSRF_BUFFER_ADD_CHAR, and OSRF_BUFFER_RESET: eliminated multiple evaluations of macro arguments. 2. In OSRF_BUFFER_ADD: renamed local variable __tl to _tl, since identifiers beginning with two underscores are reserved. 3. In OSRF_BUFFER_RESET: applied the do/while(0) trick so that the macro will be work as intended when subject to an "if". 4. Added new macro OSRF_BUFFER_C_STR to return a const pointer to the internal buffer of a growing_buffer. This new macro will enable safe and direct access to the buffer contents without violating encapsulation and without incurring a malloc and free. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1572 9efc2488-bf62-4759-914b-345cdb29e865
Add a new function buffer_add_n(), and the corresponding function-like macro OSRF_BUFFER_ADD_N. These facilities append a specified number of characters from an input string to a growing_buffer. They are intended for situations where the length of the input string is already known, or where the input string is not nul-terminated in the right place. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1568 9efc2488-bf62-4759-914b-345cdb29e865
Patch from Scott McKellar: -- Adds a new macro buffer_length to return the n_used member of a growing buffer. -- Changed buffer_chomp() to return the character removed instead of the new string length. -- Removed the newly obsolete buffer_append_uescape function. -- In utils.c: removed a commented-out version of the OSRF_BUFFER_ADD_CHAR macro, which has long resided in utils.h. -- In the OSRF_BUFFER_ADD macro: replaced strcat() with strcpy(), as I had done earlier in the corresponding function buffer_add(). git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1519 9efc2488-bf62-4759-914b-345cdb29e865
Patch from Scott McKellar: This patch fixes a bug in the OSRF_BUFFER_ADD_CHAR macro. Like the corresponding buffer_add_char function, this macro appends a specified character to a growing_buffer. Unlike the function, however, the existing version of the macro does not also append a terminal nul. This bug had gone unnoticed because, most of the time, the rest of the buffer is already filled with nuls, left over from the initial creation of the growing_buffer. I stumbled across the problem when, in the course of writing a test harness for some other changes, I called buffer_reset() in order to reuse an existing growing_buffer instead of destroying and re-creating it. With debugging turned on, buffer_reset() fills the buffer with exclamation points, leaving a nul only in the very last byte. Later, if we use buffer_add() or buffer_fadd() to extend the string stored in the growing_buffer, it uses strcat() to append the new characters. The result is a buffer overflow. Actually buffer_reset() should place a nul in the first byte of the buffer. Tomorrow I shall submit a patch to that effect. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1494 9efc2488-bf62-4759-914b-345cdb29e865
added a buffer_chomp function to drop the last character from the buffer git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1363 9efc2488-bf62-4759-914b-345cdb29e865
as it turns out, this was actually a problem with the makefile, not the utils.h macro def. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1281 9efc2488-bf62-4759-914b-345cdb29e865
rolling back change in changeset 1277 for default osrf_clearbuf handling. not sure of the exact problem yet, suffice to say the services wont start with the "!!!..." version of clearbuf enabled git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1280 9efc2488-bf62-4759-914b-345cdb29e865
Parially, a patch from Scott McKellar: 1. In socket_open_unix_server() and socket_open_unix_client(), I added checks to make sure that the path parameter doesn't point to aomething too big to fit into the receiving buffer of the struct sockaddr_un. 2. In _socket_handle_client_data() I add a terminal nul to the data received by recv(). Also, reversing the semantics and default of NDEBUG per. To turn on debugging code, set DEBUG to 1 durring the build: $ DEBUG=1 make clean all git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1277 9efc2488-bf62-4759-914b-345cdb29e865