Commit Graph

16 Commits

Author SHA1 Message Date
Jeffrey Altman
db859520b4 lib/kadm5: use krb5_enomem() where possible
Change-Id: I487fbc640a8f793f0aa02ef4c94099e09241d616
2018-12-25 16:57:55 -06: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
Love Hörnquist Åstrand
8cf907f08a switch to krb5_clear_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23912 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-14 02:55: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
988af20ec2 set and clear error string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17311 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-27 11:10:07 +00:00
Love Hörnquist Åstrand
58eb3ca46b check return values from krb5_data_alloc
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12065 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-04-16 17:58:59 +00:00
Johan Danielsson
4fa94362ee fix for storage change
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11021 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-05-24 15:23:43 +00:00
Johan Danielsson
1b175ce198 assert that we have a connected socket
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8656 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-07-11 16:00:58 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Assar Westerlund
e41684063c (_kadm5_client_recv): return result in a `krb5_data' so that we avoid
copying it and don't need to dimension in advance.  change all callers.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6950 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-13 02:54:59 +00:00
Johan Danielsson
2a79092a1d cleanup _kadm5_client_{send,recv}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6140 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-05 10:58:08 +00:00
Johan Danielsson
fd92b75e07 (_kadm5_client_recv): handle arbitrarily sized packets, check for errors
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6122 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-04 10:18:50 +00:00
Assar Westerlund
c264b952a5 fix calls to krb5_net_{read,write}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3910 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-11 01:37:57 +00:00
Johan Danielsson
a6d0c03d74 don't free local data
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3831 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-09 01:15:27 +00:00
Johan Danielsson
54378aee2e Add client support.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3789 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-05 23:32:43 +00:00