Commit Graph

80 Commits

Author SHA1 Message Date
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
5459558dea Move #undef ENABLE_PTHREAD_SUPPORT lower in appl/gssmask/common.h
This wasn't having the intended effect because after we #include
config.h and #undef ENABLE_PTHREAD_SUPPORT we then #include other
headers that also #include config.h.  I've moved this lower so that
it has the effect that appears to be intended but the correct answer
may be to make it work but this will require #including pthread.h
as the build fails with -Werror when pthread functions are called.
2012-06-07 16:57:51 +01: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
Nicolas Williams
40a7d4b62f More fixes for -Werror (GCC 4.6 catches more stuff) 2011-11-02 23:20:55 -05:00
Love Hörnquist Åstrand
7aaba443bc add NTMakefile and windows directories 2011-07-17 12:16:59 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Jelmer Vernooij
1bc55fab42 Explicitly link against required libraries.
This breaks on some newer systems which enable --as-needed by default.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-12-19 22:50:00 -08: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 Hornquist Astrand
c6bbdb545b First drop of Windows build infrastructure from Secure Endpoints 2009-11-24 12:12:53 -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
3e82b4199c add flags to test WrapExt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24780 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:47 +00:00
Love Hörnquist Åstrand
4e31a0c423 test
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24779 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:37 +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
bd98ea9e81 define WRAP_EXP_ONLY_HEADER, and bflags, flags is used.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24777 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:25:16 +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
cf8d08fcd3 {,un}wrapExt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24769 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:23:42 +00:00
Love Hörnquist Åstrand
33c7cda835 use gssapi/*.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24394 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:37:00 +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
7e35f69377 Init val to avoid gss error.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21605 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-17 06:51:57 +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
cc4333b758 remove cvs ignore files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-09 03:09:59 +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
38270cde9d (add_list): fix alloc statement, From Alex Deiter
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18900 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-11-03 05:21:01 +00:00
Love Hörnquist Åstrand
7a23f47ef3 (add_list): fix alloc statement
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18899 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-11-03 05:17:56 +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
5d1ff600c0 Add explit depenency on libroken.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18468 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-14 13:50:51 +00:00
Love Hörnquist Åstrand
d30cf34043 Clarify protocol.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18352 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-08 13:53:28 +00:00
Love Hörnquist Åstrand
58514ca826 Print how wrong the lenght are. Try more context token exchanges.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18255 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-06 09:17:25 +00:00
Love Hörnquist Åstrand
b46809c9f1 Maybe include <sys/wait.h>.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18250 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-06 07:22:00 +00:00
Love Hörnquist Åstrand
78af8860e0 disable ENABLE_PTHREAD_SUPPORT and explain why
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18245 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-05 18:13:13 +00:00
Love Hörnquist Åstrand
fd557f4d6c Add ret16.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18185 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-01 17:52:36 +00:00
Love Hörnquist Åstrand
000e414563 Handle FIRST_CALL in the context building, better error handling.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18178 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-26 19:39:20 +00:00
Love Hörnquist Åstrand
76548e0fd2 switch from wrap/unwrap to encrypt/decrypt
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18177 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-26 09:55:55 +00:00
Love Hörnquist Åstrand
e4bf1ed0e8 make less exit() happy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18176 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-26 01:21:37 +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