94 Commits

Author SHA1 Message Date
Taylor R Campbell
fdbf355be0 ipc/client.c: Make never-modified global ipcstable const. 2023-06-20 12:19:48 -05:00
Luke Howard
44e52a32b3 ipc: fix Solaris build
Link libheim_ipcc against -lsocket on Solaris
2023-01-07 12:08:39 +11:00
Nicolas Williams
ede0c59d4b ipc: Quiet warning about ignoring fcntl() and chmod() return values 2023-01-04 16:05:38 -06:00
Nicolas Williams
0c08fb9e3a ipc: Exclude UNIX: prefix in socket name
Otherwise we don't format the same socket name as the client.
2022-11-30 00:29:25 -06:00
Jeffrey Altman
88eb44fd8b ipc: mach_complete_[a]sync avoid 'ret' set but not used warning
The variable 'ret' is set but not used.   As the value is ignored
remove it.  Restructure the initialization of 'replyinCnt', 'replyout',
and 'replyoutCnt' such that a failure of vm_read() results in a
properly initialized reply structure.
2022-09-16 15:58:45 -04:00
Romain F
5dd29ecd2c KCM: Memory leak in handle_read
The `inmsg` field of the client structure is malloc/realloc'ed in `handle_read` but never free'ed in `maybe_close`.
Seems like Apple already fixed that with this.
2022-03-21 13:54:04 -05:00
Nicolas Williams
66e1a8baf2 osx: Disable GCD deprecation warning 2022-02-09 23:49:40 -06:00
Nicolas Williams
f3517c0d01 ipc: Handle POLLIN/OUT even when ERR 2022-01-24 18:26:55 -06:00
Nicolas Williams
4eec82dc52 ipc: Ignore setsockopt result 2022-01-19 23:37:01 -06:00
Jeffrey Altman
32e1604e76 lib/ipc: heim_sipc_stream_listener 'ct' lifecycle
return failure if calloc() fails

do not leak 'ct' if called with invalid 'type'

Change-Id: I384f80a51c6ec1d0980cce645c41ff3f6006fd3e
2022-01-16 00:56:16 -05:00
Andrew Bartlett
7686028718 Use UTF-8 in KTH copyright notice
Samba is starting to protect against bi-di attacks and the starting point
is to require that input files be fully UTF-8.  In 2021 this is a reasonable
starting point anyway.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2021-11-29 12:50:26 +11:00
Nicolas Williams
ec858b3a46 ipc: Get socket dir via secure_getenv()
Using /var/run means needing privilege to run.
2019-11-02 18:49:42 -05:00
Nicolas Williams
c838abdf1a ipc: fix warning 2019-10-09 20:53:30 -05:00
Nicolas Williams
06773bba48 Fix warning in lib/ipc/tc.c 2018-12-28 01:09:38 -06:00
Jeffrey Altman
60b25dd9c5 lib/ipc: client double close of socket file descriptor
When connect() fails in connect_unix() the path_ctx.fd is not
set to -1 after close().  When common_release() is executed due
to the error return from connect_unix() it calls close() a second
time.

There is no need to call close() from connect_unix(). Remove the
duplicate request.

This issue was reported by YASUOKA Masahiko.

Change-Id: I825e274cc7f12e50a8779a2b62ddb756817cdb52
2018-12-26 15:13:28 -05:00
Luke Howard
927185e732 IPC: Solaris doors backend: avoid using TLS where possible
Optimistically delay using thread-local storage for the door reply
buffer until we actually need to allocate from the heap.
2018-05-14 12:14:59 +10:00
Luke Howard
c5db6e691a IPC: Solaris doors backend: fix uninitialized variables
When replying to a door call, if allocating the buffer using malloc()
fails, we return EAGAIN to the client to avoid it hanging, using a
variable on the stack. However in this case the code did not reset the
reply length, which would result in it reading past the end of the stack.
At the expense of a goto, this patch uses the same path for returning an
error as if it was generating by the application.

Also, ensure that reply->length is set to zero when returning an error;
it shouldn't affect the client as it will not read this in the event of
a non-zero return code, but it avoids leaking uninitialized memory.
2018-05-13 21:15:21 +10:00
Luke Howard
defde8be68 IPC: do not use alloca() in Solaris doors backend 2018-05-13 17:50:30 +10:00
Luke Howard
73fde33757 KCM: restore support for Solaris doors IPC mechanism ()
This patch restores support for the Solaris doors IPC mechanism, removed
from KCM when lib/ipc was added.
2018-05-13 15:31:13 +10:00
Luke Howard
fef64ade9f IPC: fail gracefully in heim_ipc_cred_get_XXX if cred is NULL () 2018-05-12 14:42:25 +10:00
Luke Howard
0c51e7c6ab IPC: use getpeerucred() API correctly ()
The ucred_t argument must be initialized to zero otherwise it is assumed to
point to allocated memory. Also, the logic is inverted: getpeerucred()
returns zero on success, not failure.
2018-05-12 14:40:56 +10:00
David Mulder
3f36b4ad68 On hpux, pthread_cond_t is undefined when pthread is disabled 2017-03-09 14:11:19 -05:00
Nicolas Williams
4a9d1782de More missing dist files 2016-12-15 12:40:23 -06:00
Nicolas Williams
f38089257b Misc fixes (coverity) 2016-11-20 17:43:51 -06:00
Love Hörnquist Åstrand
37afa01be3 rename roken base64, fixes 2014-08-22 20:57:24 -07:00
Love Hornquist Astrand
060474df16 quel 64bit warnings, fixup implicit encoding for template, fix spelling 2013-06-03 21:46:20 -07:00
Love Hörnquist Åstrand
6294c36526 avoid -Wshadow 2012-11-22 17:27:21 -08:00
Love Hörnquist Åstrand
25e533421a wrap SOL_SOCKET, SO_PEERCRED in ifdef __linux__ 2012-03-11 10:18:43 -07:00
Roland C. Dowdeswell
e8779d5d4a Add -Wshadow and deal with the warnings. 2012-02-21 11:17:55 +00:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Love Hörnquist Åstrand
5829bfe476 add LIB_heimbase 2011-05-22 17:28:24 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
46444695f6 include <sys/socket.h> and fix ifdef wrapping for <sys/un.h> 2011-03-21 22:23:21 -07:00
Love Hornquist Astrand
ef045438c9 no support for semaphores w/o pthreads 2011-03-12 11:37:13 -08:00
Love Hornquist Astrand
cb2aa28c7d Include <heimbase.h> 2011-03-12 11:37:12 -08:00
Love Hornquist Astrand
b50919b853 Include <ucred.h> if we have getpeerucred() 2010-11-26 11:37:17 -08:00
Love Hornquist Astrand
88d0a76209 wrap older mach code with __MAC_OS_X_VERSION_MIN_REQUIRED 2010-11-25 10:29:32 -08:00
Love Hornquist Astrand
3789b1111e stop if there is not enough data 2010-10-07 00:01:06 -07:00
Love Hornquist Astrand
a3746c9f07 handle unix credentials 2010-10-06 23:32:36 -07:00
Love Hornquist Astrand
b5bc5c1d84 add PTHREAD_LIBADD 2010-09-19 00:55:36 -07:00
Love Hornquist Astrand
1205b35297 remove extra b 2010-09-12 23:22:41 -07:00
Love Hornquist Astrand
3af3dd2673 add heim_ipc_types.h 2010-09-12 23:18:02 -07:00
Love Hornquist Astrand
e80ef86fe4 include hi_locl.h 2010-09-12 23:11:47 -07:00
Love Hornquist Astrand
da24828d50 add heim_ipc_reply.defs 2010-09-12 23:05:51 -07:00
Love Hornquist Astrand
615257472b add heim_ipc_async.defs 2010-09-12 23:02:01 -07:00
Love Hornquist Astrand
d1943f6860 add heim_ipc.defs 2010-09-12 22:53:33 -07:00
Love Hornquist Astrand
63b6dd1943 make work w/o gcd 2010-09-08 09:49:03 -07:00
Love Hornquist Astrand
bac0598ce6 cancel sources 2010-09-08 09:45:40 -07:00
Love Hornquist Astrand
d615f77834 condition gcd on HAVE_GCD 2010-09-08 09:18:03 -07:00