summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/store_fd.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-01-12 18:16:45 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-27 11:51:27 +1100
commit89eaef025376339ef25d07cdc4748920fceaa968 (patch)
treef514f4632c9d54a372a7f1f0ca845a0c3a488fbf /source4/heimdal/lib/krb5/store_fd.c
parentfac8ca52ade6e490eea3cf3d0fc98287da321c13 (diff)
downloadsamba-89eaef025376339ef25d07cdc4748920fceaa968.tar.gz
samba-89eaef025376339ef25d07cdc4748920fceaa968.tar.bz2
samba-89eaef025376339ef25d07cdc4748920fceaa968.zip
s4:heimdal: import lorikeet-heimdal-201001120029 (commit a5e675fed7c5db8a7370b77ed0bfa724196aa84d)
Diffstat (limited to 'source4/heimdal/lib/krb5/store_fd.c')
-rw-r--r--source4/heimdal/lib/krb5/store_fd.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source4/heimdal/lib/krb5/store_fd.c b/source4/heimdal/lib/krb5/store_fd.c
index 4150175927..bd357dbe3b 100644
--- a/source4/heimdal/lib/krb5/store_fd.c
+++ b/source4/heimdal/lib/krb5/store_fd.c
@@ -85,12 +85,26 @@ fd_free(krb5_storage * sp)
* @sa krb5_storage_from_data()
*/
-krb5_storage * KRB5_LIB_FUNCTION
-krb5_storage_from_fd(int fd)
+KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL
+krb5_storage_from_fd(krb5_socket_t fd_in)
{
krb5_storage *sp;
+ int fd;
+
+#ifdef SOCKET_IS_NOT_AN_FD
+#ifdef _MSC_VER
+ if (_get_osfhandle(fd_in) != -1) {
+ fd = dup(fd_in);
+ } else {
+ fd = _open_osfhandle(fd_in, 0);
+ }
+#else
+#error Dont know how to deal with fd that may or may not be a socket.
+#endif
+#else /* SOCKET_IS_NOT_AN_FD */
+ fd = dup(fd_in);
+#endif
- fd = dup(fd);
if (fd < 0)
return NULL;