Christian Franke | 16 Oct 23:34 2014
Picon

Cygwin AF_UNIX emulation

Hi Corinna,

Corinna Vinschen wrote:
> On Oct 13 07:37, Christian Franke wrote:
>>> I
>>> also added a comment to explain why we do this and a FIXME comment so we
>>> don't forget we're still looking for a more generic solution for the
>>> SO_PEERCRED exchange.
>> Definitely, at least because the current AF_LOCAL emulation has some
>> security issues.
> -v?

With the secret+cred exchange, the current implementation is IMO 
reasonably safe. The client cannot connect without access to the socket 
file.

Nasty detail: At least postfix sets the all AF_UNIX sockets to rw-rw-rw- 
and relies only on directory permissions (private: rwx------, public: 
rwx--x---) for access control. This is not effective on Cygwin. Due to 
the rw-rw-rw-, the 'secret' is world readable on Cygwin and another 
Cygwin specific patch is required :-)

After new setsockopt(sd, ., SO_PEERCRED, .), AF_UNIX sockets are 
definitely vulnerable. Any local process could "guess" the TCP port and 
connect to any emulated AF_UNIX server regardless of user account.

Two draft ideas for a new AF_UNIX emulation:

1)
Keep the current secret+cred exchange, but handle accept() and connect() 
(Continue reading)

Ryan Johnson | 12 Jul 19:53 2014
Picon
Picon

Broken header dirent.h

Hi all,

Please CC me in replies, I'm no longer a list member.

I recently tried to use <sys/dirent.h> in a C++ program and got linker 
errors. Turns out the header is neither C++-aware (extern "C") nor 
cygwin-aware (_EXFUN).

The attached patch fixes the problem for me.

Regards,
Ryan

--- dirent.h.orig	2014-05-23 04:36:40.000000000 -0400
+++ dirent.h	2014-07-12 12:31:44.904628400 -0400
 <at>  <at>  -15,6 +15,10  <at>  <at> 
 #include <sys/types.h>
 #include <limits.h>

+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define __DIRENT_VERSION	2

 #ifndef __x86_64__
 <at>  <at>  -62,32 +66,32  <at>  <at> 
 #pragma pack(pop)
(Continue reading)

Jon TURNEY | 20 Jun 15:04 2014
Picon

cygwin-doc and newlib manpages


The man page for the printf family of functions in the cygwin-doc 
package is only installed under the name sprintf, and not any of the 
names of other functions it also documents (printf, fprintf, etc.)

Looking into this, it seems that the cygwin-doc scripts are supposed to 
do this, but have been broken for some time, as the index in the .info 
file the manpages are generated from has a different header ('Document 
Index') to that expected ('Index').

First attached patch is to fix that.

Unfortunately, I needed to do a bit more fixing up of cygwin-doc for a 
working build, and it also seems that it needs some updating for last 
year's Docbook XML  modernization.

Trying to to do that, the cygwin2info Makefile rule has some problem I 
don't understand.

On the .sgml files, it dies with "Can't call method "ext" without a 
package or object reference at 
/usr/share/sgml/docbook/utils-0.6.14/helpers/docbook2texi-spec.pl line 
320, <STDIN> line 2."

Also, I think this probably needs to be (somehow) updated to use 
docbook2x-texi on the .xml files

Fix generation of aliased manpages with current info files
(Continue reading)

Lukas Haase | 10 May 04:50 2014
Picon
Picon

Cygwin socket internals and WinAPI interface

Hi,

From my application I would like to create ("export") a socket in native Windows API which can then be used by
cygwin programs.

I.e., if I would write the "server" in cygwin, I would use socket(PF_LOCAL), select, read, write etc.
However, I cannot use cygwin because the application is developed in VC and C++ so I want to emulate this
functionality using only WinAPI functions.

Socket files are just plain files containing stuff like:

!<socket >54359 s 7B499653-622A1EB9-83E6B83E-A4E8D0C1

The first number is a port number as I understand, the 's' stands for socket I guess but what is the GUID number for?
What steps do I need to perform except creating a windows socket on localhost at this port and writing the
socket file?

Thanks
Luke

Alexey Pavlov | 28 Nov 09:03 2013
Picon

Fix invalid use of restrict

In CVS version I get error: invalid use of restrict. Patch for it is below

From 2a2164e5ed7cf6220ae7b2f7dac3016e1bf9293e Mon Sep 17 00:00:00 2001
From: Alexpux <alexey.pawlow@...>
Date: Thu, 28 Nov 2013 12:01:15 +0400
Subject: [PATCH] Fix invalid use of 'restrict' error.

---
 winsup/cygwin/include/glob.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h
index 4ad200f..59f0efc 100644
--- a/winsup/cygwin/include/glob.h
+++ b/winsup/cygwin/include/glob.h
 <at>  <at>  -103,7 +103,7  <at>  <at>  __BEGIN_DECLS
 # define DLLEXPORT __declspec(dllimport)
 #endif

-int DLLEXPORT glob (const char __restrict *, int, int (*)(const char
*, int), glob_t *__restrict);
+int DLLEXPORT glob (const char *__restrict, int, int (*)(const char
*, int), glob_t *__restrict);
 void DLLEXPORT globfree (glob_t *);
 int DLLEXPORT glob_pattern_p (const char *, int);
 __END_DECLS
--

-- 
1.8.3.4 (Apple Git-47)

(Continue reading)

Christopher Faylor | 23 Nov 19:38 2013

Splitting up cygwin packages

I'll probably regret mentioning this because it is a potential bikeshed
issue but, here goes:

I suggested to Corinna that it would be nice to break up the cygwin package
into four different packages:

- cygwin		Category: base

containing the dll

- cygwin-devel		Category: devel

containing headers and import libraries

- cygwin-server		Category: base(?)

containing cygserver and cyglsa

- cygwin-utils		Category: base

containing the content of winsup/utils

The versioning for all of the above would reflect the dll version.

There are two motivations here:

1) Allow updating non-dll packages for important bug fixes which
do not require a dll version bump (like the recent cygcheck bug).
This would be a rare occurrence but it means that there could be,
e.g., a cygwin-utils-1.7.27-2 package.  The utilities would report
(Continue reading)

Corinna Vinschen | 18 Nov 12:05 2013

IDN support in getaddrinfo/getnameinfo

Hi guys,

I'd like to have your opinion.

Yesterday I started a small fun-project.  For a while now we have
International Domain Names (IDNs) per RFC 3490.

IDN support usally works like this: There's the libidn project which
provides the "idna_to_ascii" and "idna_to_unicode" functions.  And then
there are the getaddinfo and getnameinfo functions.  Typically the
getaddinfo and getnameinfo functions don't support IDNs directly, so
IDNs are converted to and from punycode using the libidn functions.

But then there's glibc.  Since version 2.3.4, it supports an extension
to the getaddrinfo and getnameinfo functions.  Without going into too
much detail, glibc introduced AI_IDN* flags for getaddrinfo and NI_IDN*
flags for getnameinfo which cover the full functionality provided by
the libidn calls.  That means, a glibc-aware project does not have to
link against libidn, if it uses the new getaddrinfo/getnameinfo flags.

My small fun-project is adding the AI_IDN* and NI_IDN* flags to Cygwin.
The required libidn functionality exists 100% identically in
kernel32.dll since Windows Vista(1) (IdnToAscii/IdnToUnicode) including
the modifier flags, so it's just a matter of calling the UNICODE
functions GetAddrInfoW/GetNameInfoW and calling these IdnToXXX
functions, just like glibc additionally calls idna_to_ascii_lz, etc.  My
new getnameinfo already works with IDNs, the getaddrinfo isn't quite
finished yet.

However, is that really worth the effort?  A portable project won't
(Continue reading)

Bryan Chua | 25 Oct 20:16 2013

Conflicting definition of THREAD_INFORMATION_CLASS?

I am trying to build cygwin DLL and I keep running into a conflicting definition of THREAD_INFORMATION_CLASS:

From /usr/include/w32api/winbase.h
typedef enum _THREAD_INFORMATION_CLASS {
  ThreadMemoryPriority,
  ThreadAbsoluteCpuPriority,
  ThreadInformationClassMax
} THREAD_INFORMATION_CLASS;

From src/winsup/cygwin/ntdll.h
typedef enum _THREAD_INFORMATION_CLASS
{
  ThreadBasicInformation = 0,
  ThreadTimes = 1,
  ThreadImpersonationToken = 5
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;

Which one is correct, or have I installed too many/too few packages?

Thanks!

-- bryan

Christopher Faylor | 21 Oct 17:10 2013

[tromey: starting git migration]

----- Forwarded message from Tom Tromey -----

From: Tom Tromey
To: Binutils Development <binutils>
CC: GDB Development <gdb>
Subject: starting git migration
Date: Mon, 21 Oct 2013 07:23:56 -0600

I'm starting the git migration now.

I've disabled commit access to binutils and gdb in CVS.
Please don't change that.

I expect the outage to last all day.

Tom

----- End forwarded message -----

This means that we will be migrating cygwin to git too RSN.

FYI.

cgf

Reini Urban | 8 Oct 18:31 2013
Picon

pthread_barrier

In http://cygwin.com/ml/cygwin/2011-07/msg00406.html
Corinna hinted that pthread_barrier is a bit hard to implement.

I found 2 nice non-GPL implementations, but I'm not sure about the license.
There's one in libuv (which I need it for), which is
https://github.com/joyent/libuv/blob/master/src/unix/pthread-fixes.c
provided by Sony and Google (for Android), which seems to be MIT licensed.

And there's http://www.cs.berkeley.edu/~bvs/cs267_hw2/particles/pthread_barrier.c
without any license, looks it's some berkeley course material.

Doesn't look too hard to implement.
Should I ask the berkeley guy Brian Van Straalen
or is the libuv version good enough for us?

The GPL pthreads-win32 version looks awful in comparison.
--

-- 
Reini Urban
http://cpanel.net/   http://www.perl-compiler.org/

James Gregurich | 1 Oct 17:49 2013
Picon

followup on native symlink support

hi.

I've been using a recent version of cygwin with CYGWIN=winsymlinks:native setting for daily work for some
weeks. I haven't experienced any problems with the feature. Its always worked as expected. I think you
made a good choice to depart from my original design recommendation on converting relative paths that
exceed PATH_MAX to "\??\" tagged absolute paths. We have since run into some use cases where that caused
undesirable behavior. It caused symlinks that were specific to particular users on particular systems
to get committed to our repository.

I wanted to write in to thank Corrina and the other cygwin maintainers involved for finally getting tired of
hearing me whine and implementing the feature.  :)

I still need to implement a utility to update existing cygwin symlinks to native symlinks, but that isn't a
hard task…its drudgery…but not hard. 

thanks,
James


Gmane