Commit Graph

26 Commits

Author SHA1 Message Date
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
df42274d96 Add krb5_storage_fsync().
We add a function to cause krb5_storage's to be sync'd to their backing
store.  For memory backed storages, this is a NOP.  For files, it calls
fsync on the file descriptor.
2012-05-28 13:14:55 +01:00
Love Hornquist Astrand
bd2d4c2f79 ->max_alloc to krb5_storage and use it 2011-05-08 00:16:02 -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
687db64c56 Patch from Secure Endpoints/Asanka Herath for windows support 2009-12-21 08:45:28 +01:00
Love Hornquist Astrand
1edcea7811 more text 2009-08-18 10:47:02 -07:00
Love Hornquist Astrand
e5c42ba42f rename krb5_storage_from_emem in documentation 2009-07-28 17:51:53 +02:00
Love Hörnquist Åstrand
942a821fab remove RCSID
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25171 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-04 06:17:40 +00:00
Love Hörnquist Åstrand
77d0314d51 fixup krb5_storage_truncate return value, add krb5_{store,ret}_data_xdr, doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24234 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:41:04 +00:00
Love Hörnquist Åstrand
a54887f054 Add krb5_storage_truncate
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24226 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:39:41 +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
e2571a3178 indent.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20307 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-04-11 11:16:28 +00:00
Love Hörnquist Åstrand
0868717d3c Add krb5_storage_from_readonly_mem that is safe to use on
const/readonly buffers (it doesn't support write).


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18948 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-11-07 23:02:53 +00:00
Love Hörnquist Åstrand
91351971f7 add KRB5_LIB_FUNCTION to all exported functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13863 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-05-25 21:46:46 +00:00
Johan Danielsson
ce19f448ae make the krb5_storage opaque, and add function wrappers for
store/fetch/seek, and also make the eof-code configurable


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10931 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-04-18 14:00:44 +00:00
Assar Westerlund
5f8f9e00e8 (mem_store): make it write-compatible
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8271 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-05-19 14:39:02 +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
99da56bf7a lots of changes from size_t to ssize_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6554 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-07-26 00:50:43 +00:00
Johan Danielsson
43aa4ffc00 (krb5_storage_from_mem): zero flags
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6030 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-04-24 16:36:29 +00:00
Johan Danielsson
2f3f002dcf (krb5_storage_from_mem): check malloc, initialize host_byteorder
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5962 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-04-15 15:43:44 +00:00
Johan Danielsson
ff2f6ef4e5 Add `krb5_storage_from_data'.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4699 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-04-03 02:16:08 +00:00
Johan Danielsson
8e6c395388 make static
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3272 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-08-29 01:25:00 +00:00
Johan Danielsson
539ccc8bab Fix seek bug.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2975 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-08-14 19:37:19 +00:00
Johan Danielsson
5a32a5c8e7 Add copyright notice.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2389 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-16 21:40:05 +00:00
Johan Danielsson
2e846c7099 Split of store.c
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1359 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-03-12 07:28:36 +00:00