summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/store_fd.c
diff options
context:
space:
mode:
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;