Commit Graph

42 Commits

Author SHA1 Message Date
Taylor R Campbell
f051c36471 Pass NI_NUMERICSERV|NI_NUMERICSCOPE if NI_NUMERICHOST to getnameinfo.
This addresses part of https://github.com/heimdal/heimdal/issues/1214
to audit potential network leaks with [libdefaults] block_dns = yes.

NI_NUMERICHOST is _probably_ sufficient -- we probably won't see many
systems using NIS to look up service names by number if we fail to
specify NI_NUMERICSERV, and such systems probably require careful
auditing of their own.  And I don't know of any way NI_NUMERICSCOPE
could trigger network leaks.  But named scope ids are such a niche
option with IPv6 that setting it to forestall concerns can't hurt
much, and it makes reviewing easier if we just unconditionally flip
on all the numeric-only options.
2024-01-09 21:19:30 -06:00
Taylor R Campbell
1d2233f907 gssmask: Use asprintf to avoid having to think about max uname.
This way there is no truncation and no build failure due to
-Werror=format-truncation as is the default in some compilers, such
as gcc7.4 with -Wall -Werror.

This is presumably not space-constrained or performance-critical; the
very next thing it does is another asprintf and frees it immediately.
And uname is not usually under any adversary's control.

fix https://github.com/heimdal/heimdal/issues/1105
2023-06-20 23:18:08 -05:00
Nicolas Williams
96b7ea671d gss: Fix warnings 2022-01-14 17:39:05 -06:00
Jeffrey Altman
d4622f12e5 gssmask: HandleOp unused var principal
Always NULL.

Change-Id: I65074562b029effcec62c4edb5d33e3289a634db
2016-11-18 21:59:18 -05:00
Jeffrey Altman
22c5327287 gssmask: check return of krb5_init_context
Check the return value so that a more obtuse error does not occur
later on.

Change-Id: I2115cc58e6fc24b63272b2ae811d64a4966de5d4
2016-04-17 15:11:14 -05:00
Nicolas Williams
73c4db7269 coverity 745505 2015-04-18 23:19:25 -05:00
Jeffrey Altman
dba026b5ef Introduce and apply krb5_storage_from_socket
On Windows a file descriptor is an int value allocated by the
local module instance of the C Run Time Library.  A socket handle is a
SOCKET value allocated by a Winsock Provider for the requested family and
protocol.   These two values cannot be mixed and there is no mechanism for
converting between the two.   The _get_osfhandle() and _open_osfhandle()
functions can work with a standard HANDLE (file, pipe, etc) but cannot be
used for a SOCKET.

The Heimdal krb5_storage_from_fd() routine counted on the osf conversion
functions working on SOCKET values.  Since they do not any attempt to call
krb5_storage_from_fd() on a socket resulted in an assertion being thrown
by the C RTL.

Another problem is SOCKET value truncation when storing a 64-bit value
into a 32-bit int.

To address these problems a new krb5_storage_from_socket() routine is
introduced.  This routine setups a krb5_storage that stores a socket value
as a rk_socket_t and provides a set of helper routines that always use
network ready functions.

The krb5_storage_from_fd() routines no longer use net_read() and
net_write() but provide helpers that follow their logic so that pipes can
be processed.

All call sites that allocate a socket now store the socket as rk_socket_t
and call krb5_storage_from_socket().

All locations that previously called the bare close() on a socket value
now call rk_closesocket().

Change-Id: I045f775b2a5dbf5cf803751409490bc27fffe597
2014-02-04 23:20:08 -05: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
Nicolas Williams
40a7d4b62f More fixes for -Werror (GCC 4.6 catches more stuff) 2011-11-02 23:20:55 -05:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
aa750c33d1 remove unused variables 2010-11-20 14:13:58 -08:00
Love Hornquist Astrand
65a1ee8163 dont use private prototype 2010-11-20 14:13:31 -08:00
Asanka Herath
d00f9984a5 Make roken build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-11-24 21:42:02 -08:00
Love Hörnquist Åstrand
428949990f uniquify error messages
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24782 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:26:07 +00:00
Love Hörnquist Åstrand
aa64f90c1c implement UnwrapExt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24781 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:57 +00:00
Love Hörnquist Åstrand
d44779d9d0 make compile
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24778 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:28 +00:00
Love Hörnquist Åstrand
d5f371960e use WRAP_EXP_ONLY_HEADER
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24776 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:01 +00:00
Love Hörnquist Åstrand
dc3e6ad589 change seqno to bflag to allow testing dce style
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24775 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:24:49 +00:00
Love Hörnquist Åstrand
5089b9c84b Code to handle WrapExt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24770 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:23:55 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
832a72e67b Use unsigned where appropriate.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22887 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-07 18:51:38 +00:00
Love Hörnquist Åstrand
e270dfd78e (AcquirePKInitCreds): fail more gracefully
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21229 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-20 10:19:19 +00:00
Love Hörnquist Åstrand
ece5f9603e Make krb5_get_init_creds_opt_free take a context argument.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19078 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-11-20 18:12:41 +00:00
Love Hörnquist Åstrand
32df330c53 Only log when there are resources left.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18891 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-24 23:30:56 +00:00
Love Hörnquist Åstrand
653bb59432 Try free all resources.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18890 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-24 23:29:34 +00:00
Love Hörnquist Åstrand
cb603a5624 Avoid leaking memory. rename ->handle to ->handles.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18887 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-24 22:35:53 +00:00
Love Hörnquist Åstrand
ef5a0a83f1 make compile
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18880 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-24 21:01:40 +00:00
Love Hörnquist Åstrand
a79baec2e3 (AcquireCreds): free krb5_get_init_creds_opt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18879 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-24 20:16:29 +00:00
Love Hörnquist Åstrand
bcf5576db0 handle more bits
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18493 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-17 03:08:22 +00:00
Love Hörnquist Åstrand
77a889cd29 Don't announce spn if there is non.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18175 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-25 23:33:54 +00:00
Love Hörnquist Åstrand
58de1f16ce Fix logging.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18164 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-25 16:28:40 +00:00
Love Hörnquist Åstrand
d8bc0ea463 Add mic tests
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18141 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-21 09:57:26 +00:00
Love Hörnquist Åstrand
6f5411adfa Add wrap/unwrap ops
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18130 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-20 12:16:15 +00:00
Love Hörnquist Åstrand
e8d7e48ab5 use new flags, return moniker
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18124 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-20 03:31:50 +00:00
Love Hörnquist Åstrand
c1e7cda8e8 add --logfile option, use htons() on port number
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18115 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-19 10:20:50 +00:00
Love Hörnquist Åstrand
0822bf8ae4 use utname() to find the local hostname
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17796 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-03 10:52:05 +00:00
Love Hörnquist Åstrand
fffc248c1f break out creation of a client and make handleServer pthread_create compatible
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17793 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-02 22:36:37 +00:00
Love Hörnquist Åstrand
f409403b7d AcquireCreds: set principal to NULL to avoid memory corruption
GetTargetName: always send a string, even though we don't have a targetname


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17786 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-01 09:28:42 +00:00
Love Hörnquist Åstrand
88c076e738 break out common function; add gssmaestro (that only tests one context for now)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17780 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-01 08:44:30 +00:00
Love Hörnquist Åstrand
1a7f7f4e24 split out fetching of credentials for easier reuse for pk-init testing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17772 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-30 20:21:24 +00:00
Love Hörnquist Åstrand
cbad9c5477 gssapi maggot replacement, handles context testing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17771 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-30 20:05:42 +00:00