Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/common/tio.c
Commit message (Collapse)AuthorAgeFilesLines
* Various spelling fixesArthur de Jong2019-09-171-3/+3
|
* Fix formatting of size_t valuesPatrick McLean2015-03-141-2/+2
| | | | | | | | In several places the code used a %d format to print a size_t variable. On amd64 at least size_t is an unsigned long, so use %lu instead. An alternative would be to use %ud for size_t and %zd fo ssize_t but not all platforms seem to support that formatter.
* Clear proper buffer lengthArthur de Jong2014-06-061-2/+2
| | | | This fixes 3d29861.
* Clear buffers before free-ingArthur de Jong2014-05-171-1/+3
| | | | | This clears most buffers that may hold credentials at one point before free()ing the memory.
* Also support poll() returning EAGAINArthur de Jong2013-09-151-3/+3
|
* Use clock_gettime() instead of gettimeofday()Arthur de Jong2013-09-021-12/+21
| | | | | | | | | | | This avoids problems with system clock changes (though there are some safeguards in place to avoid waiting too long on clock changes). Thanks to John Sullivan for pointing this out. We can't easily use CLOCK_MONOTONIC_RAW or CLOCK_MONOTONIC_COARSE even on platforms that define the clock because we can get runtime errors. CLOCK_MONOTONIC seems to work on all tested platforms that provide it.
* Use normal timeout handling in tio_skipall()Arthur de Jong2013-08-311-13/+5
| | | | | Use the same mechanism in tio_skipall() as in tio_read(), except use a different timeout value.
* Refactor tio_wait()Arthur de Jong2013-08-311-21/+11
| | | | | This changes the function to accept a file descriptor, an event and timeout parameter directly instead of a confusing flag.
* Fix buffer overflow on interupted readArthur de Jong2013-08-311-2/+2
| | | | | | | | | | | | | The tio_read() function will read past its buffer and return garbadge to the calling function if the call to read() was interrupted by a signal. The likelyhood of read() being interupted is low because previously a call to poll() has determined that data is available to be read. Thanks to John Sullivan for pointing this out. See: https://bugzilla.redhat.com/show_bug.cgi?id=1003011
* Use a timeout when skipping remaining result dataArthur de Jong2013-08-301-2/+2
| | | | | | | | When the NSS modules closes the connection and skips any remaining result data, wait for up to 500 msec to read any available data. See: https://bugzilla.redhat.com/show_bug.cgi?id=1003011
* fix the description of the tio_time_remaining() functionArthur de Jong2013-03-091-2/+3
|
* restructure timeout calculation in tio to reduce the ↵Arthur de Jong2013-01-181-41/+30
| | | | | | number of times gettimeofday() is called git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1923 ef36b2f9-881f-0410-afb5-c4e39611909c
* update C coding style to a more commonly used styleArthur de Jong2012-12-221-155/+165
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1873 ef36b2f9-881f-0410-afb5-c4e39611909c
* update microseconds when setting deadline, not seconds ↵Arthur de Jong2012-12-081-1/+1
| | | | | | (thanks Julien Cristau) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1848 ef36b2f9-881f-0410-afb5-c4e39611909c
* make test even more verbose and set number of writes ↵Arthur de Jong2012-12-061-1/+1
| | | | | | back at 10000 to avoid issues with systems with large buffers git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1846 ef36b2f9-881f-0410-afb5-c4e39611909c
* use poll() instead of select() for checking file ↵Arthur de Jong2012-10-121-92/+42
| | | | | | descriptor activity to also correctly work if more than FD_SETSIZE files are already open git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1783 ef36b2f9-881f-0410-afb5-c4e39611909c
* check if the file descriptor can be stored in the ↵Arthur de Jong2012-10-121-0/+15
| | | | | | select() file descriptor set git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1781 ef36b2f9-881f-0410-afb5-c4e39611909c
* split the functionality to read everything from the ↵Arthur de Jong2012-04-261-9/+24
| | | | | | stream into a separate function and don't assume we use non-blocking IO (fix r1637) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1659 ef36b2f9-881f-0410-afb5-c4e39611909c
* read any remaining available data from the stream when ↵Arthur de Jong2012-03-141-2/+31
| | | | | | closing the connection in a normal way to prevent Broken pipe messages in nslcd git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1637 ef36b2f9-881f-0410-afb5-c4e39611909c
* ensure that we don't try to read more than SSIZE_MAX bytesArthur de Jong2012-03-141-2/+9
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1636 ef36b2f9-881f-0410-afb5-c4e39611909c
* tv_usec in struct timeval must be lower than 1000000 ↵Arthur de Jong2011-03-311-1/+1
| | | | | | (patch by SATOH Fumiyasu) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1421 ef36b2f9-881f-0410-afb5-c4e39611909c
* fix a problem in the timeout paramater that was being ↵Arthur de Jong2011-03-141-1/+1
| | | | | | passed to select() and could contain too many µsec (fixes Solaris runtime issue) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1393 ef36b2f9-881f-0410-afb5-c4e39611909c
* update copyright headers to add missing yearsArthur de Jong2011-03-101-1/+1
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1384 ef36b2f9-881f-0410-afb5-c4e39611909c
* return connection reset when connection was closed by ↵Arthur de Jong2010-12-261-1/+6
| | | | | | the other end git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1344 ef36b2f9-881f-0410-afb5-c4e39611909c
* remove commented out memberOf and ipNetmaskNumber ↵Arthur de Jong2010-06-121-1/+0
| | | | | | attributes and small cleanups git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1138 ef36b2f9-881f-0410-afb5-c4e39611909c
* rename software to nss-pam-ldapdArthur de Jong2009-08-311-1/+1
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@978 ef36b2f9-881f-0410-afb5-c4e39611909c
* restore the old writing code which masks SIGPIPE on ↵Arthur de Jong2008-06-121-0/+21
| | | | | | platforms that can't use send() git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@758 ef36b2f9-881f-0410-afb5-c4e39611909c
* use send() with a flag to ignore SIGPIPE instead of ↵Arthur de Jong2008-05-171-15/+3
| | | | | | write() so we don't have to muck with signal handlers git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@740 ef36b2f9-881f-0410-afb5-c4e39611909c
* add sanity checks to sleep calls to never sleep too long ↵Arthur de Jong2008-05-161-4/+14
| | | | | | (problems could occur when the clock moves backwards) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@738 ef36b2f9-881f-0410-afb5-c4e39611909c
* split out the flushing of the buffers to separate ↵Arthur de Jong2008-02-151-38/+84
| | | | | | functions and see if we can flush some data from the buffer if it is overflowing before growing the buffer git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@635 ef36b2f9-881f-0410-afb5-c4e39611909c
* implement resizable I/O buffers and tune buffer sizes to ↵Arthur de Jong2008-02-121-26/+65
| | | | | | normal requests git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@630 ef36b2f9-881f-0410-afb5-c4e39611909c
* always allocate the read and write buffers and make the ↵Arthur de Jong2008-02-121-85/+61
| | | | | | struct tio_buffer inline in struct tio_fileinfo git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@629 ef36b2f9-881f-0410-afb5-c4e39611909c
* when including stdint.h check if we actually have itArthur de Jong2008-01-271-0/+2
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@571 ef36b2f9-881f-0410-afb5-c4e39611909c
* add limited implementation of tio_mark() and tio_reset() ↵Arthur de Jong2008-01-011-14/+51
| | | | | | functions to do limited seeks in the read stream, clean up header file comments and write tests for new code git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@547 ef36b2f9-881f-0410-afb5-c4e39611909c
* fix memory leak in I/O module not free()ing allocated ↵Arthur de Jong2007-10-271-3/+6
| | | | | | storage for file info on file close git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@462 ef36b2f9-881f-0410-afb5-c4e39611909c
* portability improvement to fall back to ETIMEDOUT when ↵Arthur de Jong2007-10-271-0/+5
| | | | | | ETIME is unavailable git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@461 ef36b2f9-881f-0410-afb5-c4e39611909c
* fix usage of DEBUG_TIO_STATSArthur de Jong2007-10-191-2/+3
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@440 ef36b2f9-881f-0410-afb5-c4e39611909c
* also initialize sa_sigaction although it's not usedArthur de Jong2007-09-241-0/+1
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@423 ef36b2f9-881f-0410-afb5-c4e39611909c
* some small improvements to the code based on some source ↵Arthur de Jong2007-09-231-0/+2
| | | | | | code checks git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@418 ef36b2f9-881f-0410-afb5-c4e39611909c
* fix typoArthur de Jong2007-07-151-1/+1
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@306 ef36b2f9-881f-0410-afb5-c4e39611909c
* fix bug with buffer magic in writing codeArthur de Jong2007-07-151-11/+18
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@305 ef36b2f9-881f-0410-afb5-c4e39611909c
* add const and add FIXME about a to-be-fixed race conditionArthur de Jong2007-07-131-1/+5
| | | | git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@301 ef36b2f9-881f-0410-afb5-c4e39611909c
* implement our own stdio-like library that handles IO ↵Arthur de Jong2007-06-091-0/+365
with a simple configurable timeout mechanism with buffering git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@272 ef36b2f9-881f-0410-afb5-c4e39611909c