cygserver patch

Conrad Scott
Thu Jun 20 14:11:00 GMT 2002

"Robert Collins" <> wrote:
> I'm short on time (still!).

I fully understand: it's the basic human condition this century :-)

> Can you generate a patch including the following changes:
> > * Conditionalize the security code so that cygserver works on
> > platforms.
> > * Add definitions of the strace XXX_printf macros to allow code to
> > these whether it's compiled for the DLL or for the daemon.
> > * Several minor C++ related changes: for example, making some
> > pure virtual, and adding virtual destructors throughout as
> > * Add --version and --help options.
> > * Add checking for an existing instance of the daemon to avoid
> > multiple copies running.
> > * Some more error checking throughout.
> > * Refactor the client request classes for greater encapsulation
and to
> > support variable length requests.
> I need to review the last above change, as variable length requests
> already supported.

What I've done is to hold a buffer length and a message length
separate: the message length is in the header and is what is
transmitted back and forth; the buffer length is stored in the
client_request object. Thus when a request arrives, the base class can
check whether the message is too long for the buffer provided by the
base class. I've set things up so that the classes that have no out
parameters, e.g. the version query, set up a buffer big enough to
receive the reply but send a zero-sized body (i.e. no body is sent).
Also, the shmop CREATE request only sends as much of the security
descriptor buffer as necessary, using the length returned by sd_alloc

Previously client requests couldn't be of variable size since the code
checked whether they the message bodies were the same size as the
buffer provided for their receipt. Given your comment, maybe I'm
missing something here?

> I think that the ipcs preparation changes should stay
> on the branch for now.

Fair enough: when I've got any code that needs it, i.e. ipcs(8), I'll
bundle it up again.

> If you can generate such a patch, I will review
> it asap (ie a few days :[).

Coming along. Two questions:

*) I've got a better check for the duplicate servers on NT using a
special flag on CreateNamedPipe (introduced in NT5 SP2 and in XP for
security reasons). Would you accept this too?

*) I wasn't clear whether you wanted the client_request changes in the
patch? or, were you just saying to include them and you'd review them?
which is what I'd like you to have meant :-)

Thanks for the reply.

// Conrad

More information about the Cygwin-patches mailing list