Corinna Vinschen
e94fa4ebf3
Cygwin: AF_UNIX: fix comments and move a macro
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-07 15:43:26 +01:00
Corinna Vinschen
4cd57934be
Cygwin: AF_UNIX: Implement listen, accept4, connect, and others
...
* Implement helper functions
* Improve bind
* Implement setting blocking, ioctl(FIONBIO), fcntl(F_SETFL)
* Implement close_on_exec and fixup_after_fork
* Allow overriding sun_path and peer_sun_path
* Improve comments
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 19:10:54 +01:00
Corinna Vinschen
e2909e2805
Cygwin: AF_UNIX: fix a couple of thinkos and typos
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:42:12 +01:00
Corinna Vinschen
cabfef78e9
Cygwin: AF_UNIX: create/open pipes relativ to NPFS rootdir handle
...
Only store and manipulate pipe basename.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:37:09 +01:00
Corinna Vinschen
c502700231
Cygwin: AF_UNIX: initialize rmem/wmem to 256K and use in pipe creation
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:28:15 +01:00
Corinna Vinschen
c0df506b83
Cygwin: ntdll.h: Add some missing pipe-related definitions
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:24:13 +01:00
Corinna Vinschen
f6ce72e623
Cygwin: sys/socket.h: define MSG_CMSG_CLOEXEC
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:23:48 +01:00
Corinna Vinschen
6d2f1d79a8
Cygwin: export hires counter ntod
...
Needed it new AF_UNIX socket code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-06 18:23:23 +01:00
Corinna Vinschen
ae67198d55
Cygwin: move sun_name_t constructors into fhandler_socket_unix.cc
...
They are only used there anyway and it allows to use the AF_UNIX
macro without tweaking header files. While at it, improve
both constructors. The default constructor now creates the name
of an unnamed socket, the constructor taking parameters carefully
checks its input.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-05 18:08:47 +01:00
Corinna Vinschen
a2c02d78be
Cygwin: sockets: add bind state, and split out connect state to allow atomic operation
...
The connect state was stored in a bitfield which is not safe
to do atomic operations on.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-05 17:59:04 +01:00
Corinna Vinschen
fe8e2c9b1f
Cygwin: drop debug_printf statement from start_transaction
...
start_transaction is now defined in ntdll.h and we can't rely
on debug_printf being available
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-05 17:50:52 +01:00
Corinna Vinschen
011fc3b508
Cygwin: cygwait.cc: fix formatting of debug statement
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-05 17:49:50 +01:00
Corinna Vinschen
df14d97fff
Cygwin: AF_UNIX: drop try/except block in bind method
...
The caller already does it anyway.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 23:40:36 +01:00
Corinna Vinschen
be6da79713
Cygwin: AF_UNIX: create pipes with file attribute R/W access
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 23:39:15 +01:00
Corinna Vinschen
00e8707830
Cygwin: accept4: Fix resource leak
...
The new implementation neglected to release the file descriptor
in case of error.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 23:33:05 +01:00
Corinna Vinschen
984c8beeff
Cygwin: remove outdated comment
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:22:45 +01:00
Corinna Vinschen
97b7aaaeb7
Cygwin: fhandler_socket_unix: implement socket, bind, and close
...
...plus lots of helper functions. Add comment to explain how everything
works. This comment will be improved while implementing the yet missing
parts.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:17 +01:00
Corinna Vinschen
7d260cfac4
Cygwin: add transform_chars_af_unix helper
...
This function is going to be used for transposing sun_path of
abstract sockets. This also adds a transposition of the NUL
character to tfx_chars since NUL-bytes in abstract socket names
are perfectly valid.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:17 +01:00
Corinna Vinschen
488221cf5c
Cygwin: small_s[w]printf: add '_' modifier to print lower case hex digits
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:17 +01:00
Corinna Vinschen
1949db7829
Cygwin: drop CYGWIN_SOCKET_UUID, define CYGWIN_SOCKET_GUID as GUID pointer
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:17:13 +01:00
Corinna Vinschen
d87ef0dac9
Cygwin: ntdll.h: add definitions required for pipe-based AF_UNIX
...
Also remove redundant declaration of RtlInitEmptyUnicodeString
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-02 18:08:05 +01:00
Corinna Vinschen
dc3928fc75
Cygwin: convert sun_name_t into class
...
Add constructors and new/delete operators to make sure sun_name_t
objects are allocated on the cygheap.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 18:14:23 +01:00
Corinna Vinschen
aa467e6e33
Cygwin: add AF_UNIX reparse points to path handling
...
* check_reparse_point_target returns a path flag mask, rather than
just 1. Return PATH_SYMLINK | PATH_REP for symlinks and directory
mount points, PATH_SOCKET | PATH_REP for AF_UNIX sockets.
* Define Cygwin AF_UNIX socket reparse tag and GUID in ntdll.h.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 16:54:57 +01:00
Corinna Vinschen
65267a9a34
Cygwin: move transaction helpers into ntdll.h
...
We'll need them elsewhere in future.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de
2018-03-01 16:51:12 +01:00
Corinna Vinschen
3e16fd6986
Cygwin: ntdll.h: drop macros available in mingw-w64 headers
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 16:50:41 +01:00
Corinna Vinschen
28cf818c2e
Cygwin: path.cc: clean up includes
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 16:44:09 +01:00
Corinna Vinschen
7ae89fe708
Cygwin: path_conv: rename is_rep_symlink to is_known_reparse_point
...
...in preparation of reusing this flag for other types of
reparse points, not only symlinks.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-03-01 16:41:45 +01:00
Corinna Vinschen
a27a7752ec
Cygwin: improve storage and handling of AF_UNIX socket path
...
Define new struct sun_name_t and use throughout internally.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-28 19:06:53 +01:00
Corinna Vinschen
892efccb25
Cygwin: fhandler_socket_unix: store peer credentials in ucred member
...
* Split out cygwin/_ucred.h file
* drop local credentials
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-28 19:01:29 +01:00
Corinna Vinschen
25ea6af172
Cygwin: cleanup header including within network-releated files
...
* Rearrange includes and drop unneccessary ones.
* Don't pull in cygwin/socket.h into sys/un.h just to get
sa_family_t. Include sys/types.h and use __sa_family_t instead.
* start including Windows headers using the w32api/ path prefix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-28 18:56:13 +01:00
Corinna Vinschen
d02f3a1238
Cygwin: sockets: Fix fstat on unnamed sockets
...
Calling fhandler_socket::fstat from fhandler_socket::fstat recursively
is not a good idea...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-27 15:30:13 +01:00
Corinna Vinschen
fbdae2c216
Cygwin: reduce size of fhandler_cygdrive
...
fhandler_cygdrive has a size of 696 bytes on x86_64, while the next
biggest fhandler type, fhandler_pty_master, is 584 bytes. The members
responsible for the size are private to opendir/readdir/closedir usage.
fhandler_disk_file stores private readdir data in DIR->__d_internal
instead. Use equivalent method with fhandler_cygdrive. This drops
the size to 464 bytes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26 20:39:48 +01:00
Corinna Vinschen
b995936ab5
Cygwin: sockets: Add missing cleanup if socket/socketpair creation fails
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26 18:02:36 +01:00
Corinna Vinschen
4d75035244
Cygwin: fhandler_socket_unix: Tiny cleanup
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26 17:58:46 +01:00
Corinna Vinschen
d35bd22992
Cygwin: sockets: move type and proto checks into fhandler_socket classes
...
Encapsulation required
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26 17:56:47 +01:00
Corinna Vinschen
1e5e44a9a5
Cygwin: fhandler_socket: define socketpair as virtual function
...
...in preparation of moving the type and protocol test into the
actual classes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-26 17:56:09 +01:00
David Macek
5b6cbef9e0
doc/faq-using.xml: Add BeyondTrust and Cylance to BLODA
...
Cylance:
- https://github.com/git-for-windows/git/issues/1244
- https://cygwin.com/ml/cygwin/2017-04/msg00238.html
BeyondTrust:
- https://cygwin.com/ml/cygwin/2017-04/msg00092.html
- https://cygwin.com/ml/cygwin/2017-05/msg00422.html
2018-02-23 21:35:39 +01:00
Corinna Vinschen
c70761df66
Cygwin: Define SO_PASSCRED and SCM_CREDENTIALS
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 21:00:43 +01:00
Corinna Vinschen
7f7532fafb
Cygwin: Create empty fhandler_socket_unix
...
* Make distinct from AF_LOCAL for testing purposes. This will have
to be reverted as soon as fhandler_socket_unix goes life.
* Move saw_reuseaddr flag back to fhandler_socket status
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 21:00:43 +01:00
Corinna Vinschen
5acadbe8af
Cygwin: fix upcalls in some fhandler_socket_local methods
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 21:00:43 +01:00
Corinna Vinschen
eaf359574d
Cygwin: Introduce FH_SOCKET for generic socket file ops
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 19:45:59 +01:00
Corinna Vinschen
b79018ee3a
Cygwin: encapsulate Winsock based fhandler_socket classes
...
Insert another class fhandler_socket_wsock between fhandler_socket
and fhandler_socket_inet/fhandler_socket_local.
Also, add a new method fhandler::is_wsock_socket to allow asking
for sockets in general (is_socket) vs. Winsock-based sockets
(is_wsock_socket).
This allows to develop a new handler_socket_unix class as derived
class from fhandler_socket without any trace of wsock code left
in fhandler_socket.
While this is basically a temporary measure at this time, it may
prove useful for later interoperability with the upcoming Windows 10
AF_UNIX implementation at one point.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 15:24:18 +01:00
Corinna Vinschen
cc9fe2c716
Cygwin: eliminate unused fhandler method hclose
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 14:56:30 +01:00
Corinna Vinschen
7bcab422e5
Cygwin: fix fhandler_socket_local::fchmod
...
Rather than just returning 0, return the result of calling
the base class fchmod.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 13:34:08 +01:00
Corinna Vinschen
b89b6f4349
Cygwin: socket.h: Add SIOCINQ, equivalent to FIONREAD
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 13:33:23 +01:00
Corinna Vinschen
03f380c2bc
Cygwin: drop unused device nodes and clean up socket devices
...
* Rename DEV_TCP_MAJOR to DEV_SOCK_MAJOR
* Drop FH_TCP, FH_UDP, FH_ICMP in favor of single FH_INET
* Drop FH_UNIX, FH_STREAM, FH_DGRAM in favor of single FH_LOCAL
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 13:32:51 +01:00
Corinna Vinschen
b8a57a2d2a
Cygwin: fhandler_socket: Move select functions into derived classes
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-22 16:59:55 +01:00
Corinna Vinschen
479080baec
Cygwin: fhandler_socket: Rearrange methods
...
Follow the same pattern in all fhandler_socket classes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-22 16:54:08 +01:00
Corinna Vinschen
9c593d9b39
Cygwin: fhandler_socket: Add derived fcntl methods
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-22 16:37:12 +01:00
Corinna Vinschen
79598f94f7
Cygwin: fhandler_socket: Add derived ioctl methods
...
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-22 16:31:07 +01:00