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 Hörnquist Åstrand
bc07938965
(emem_trunc): if offset is NULL, free all memory
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25281 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-06-08 21:57:56 +00: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
00debe0edd
update ->ptr on rebase, return -1 on failure
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24248 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:43:21 +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
056fc8cf87
make sure emem_trunc doesnt point past end
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24230 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:40:23 +00:00
Love Hörnquist Åstrand
0e46e8afa2
clear memory before returning it
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24229 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:40:12 +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
ad1bddbf1d
Make compile on-pre c99 compilers. From Dennis Davis.
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22574 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-02-05 20:31:55 +00:00
Love Hörnquist Åstrand
8d40c2994b
check return value of alloc functions, from Charles Longeau
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21745 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-31 16:11:25 +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
5ee773037f
(emem_store): limit how much we allocate (from Olaf Kirch)
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11512 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-10-21 15:36:23 +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
Johan Danielsson
7786b864da
(emem_free): clear memory before freeing (this should perhaps be
...
selectable with a flag)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10826 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-02-11 13:03:25 +00:00
Assar Westerlund
4d96aa82b2
(emem_store): make it write-compatible
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8273 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-05-19 14:39:49 +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
c45bf5ec42
(krb5_storage_emem): zero flags
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6029 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-04-24 16:35:55 +00:00
Johan Danielsson
a3cfac4221
(krb5_storage_emem): initialize host_byteorder
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5960 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-04-15 15:42:54 +00:00
Assar Westerlund
c145f0f8e4
const and char cleanup
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3699 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-10-29 01:30:15 +00:00
Johan Danielsson
100df34250
Fix reallocation bug.
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2974 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-08-14 19:28:56 +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
6dd7ff76fb
Fix some bugs.
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1378 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-03-12 16:39:54 +00:00
Johan Danielsson
f6223a8d77
New resizable memory storage.
...
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1360 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-03-12 07:29:34 +00:00