Commit Graph

31 Commits

Author SHA1 Message Date
Nicolas Williams
52a562a3a4 Misc fixes (coverity) 2016-11-18 22:21:45 -06:00
Jeffrey Altman
84e959a752 gssmask: log_function memory leak
Do not leak 'file' on error and reduce clutter. free() in common exit
path.

Change-Id: Icb187ea50e9c3d405076a192aa61cbade4b6d7d4
2016-11-14 17:02:02 -05:00
Jeffrey Altman
d3fc257245 gssmask: client_connect addrinfo leak
In client_connect() getaddrinfo() stores the head of the allocated
addrinfo structure list in 'res0'.  'res' is used to walk the list
and will be NULL at the end of the for() loop when freeaddrinfo(res)
is executed.  Pass 'res0' to freeaddrinfo() instead of 'res'.

Change-Id: Ie1358c0356b6b0f98470e46e25216cfa0ab4adac
2016-11-14 16:56:08 -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
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 Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07: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
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
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
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
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
3cf6b97bbf Check that the pre-wrapped data is the same as afterward.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18174 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-25 22:33:39 +00:00
Love Hörnquist Åstrand
8cd665242d Remove stray GSS_C_DCE_STYLE.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18169 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-25 19:29:03 +00:00
Love Hörnquist Åstrand
fc0fccde1c Add logsocket support.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18165 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-25 18:20:33 +00:00
Love Hörnquist Åstrand
f103a5431d (build_context): print the step the context exchange.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18151 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-22 14:18:04 +00:00
Love Hörnquist Åstrand
5f4bd93468 Add GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG to all flags
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18143 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-21 10:15:34 +00:00
Love Hörnquist Åstrand
8224705132 Add wrap and mic tests for all elements
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18142 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-21 09:57:53 +00:00
Love Hörnquist Åstrand
597c5e99e5 dont exit early then co-worker is bad.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18138 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-21 08:53:24 +00:00
Love Hörnquist Åstrand
41251ac808 Add tests to wrap/unwrap.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18133 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-21 07:09:49 +00:00
Love Hörnquist Åstrand
ec4137ea11 test self context building and all permutation of clients
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18123 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-20 03:28:13 +00:00
Love Hörnquist Åstrand
99a2e32cad Log port in connection message.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18114 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-09-19 10:20:08 +00:00
Love Hörnquist Åstrand
02a8293b7e Add get_version_capa, cache target_name.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17797 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-03 10:53:21 +00:00
Love Hörnquist Åstrand
40256ad394 break out out the build context function
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17792 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-02 22:35:41 +00:00
Love Hörnquist Åstrand
95ee7df071 externalize slave handling, add GetTargetName glue
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17788 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-01 09:36:14 +00:00
Love Hörnquist Åstrand
afd0ce92a8 externalize principal/password handling
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17784 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-07-01 09:07:02 +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