Corinna Vinschen
2019-Mar-12 13:59 UTC
[PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
On Mar 12 11:32, Darren Tucker wrote:> On Fri, Feb 22, 2019 at 10:29:46AM +0100, Corinna Vinschen wrote: > > On Feb 22 16:02, Darren Tucker wrote: > [...] > > > How's this? If we push the match_usergroup_pattern_list() function up > > > to OpenBSD it should mean most future diffs will apply cleanly. > > > > I like this a lot. > > > > But that also means the cygwin_match_pattern_list function will be > > called only for user and group names, and that in turn means the cygwin > > function is always called for case-insensitive operation. > > > > How's this? It's just tweaking your patch a bit, simplifying the Cygwin > > code. > > Looks good, I've committed it.Thanks!> One final tweak: replace alloca with > xcalloc since it checks for integer overflow, will fail instead of blowing > the stack on large allocs and is likely at a less well-known location. > Also include stdlib.h for the prototype for free(). > > diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c > index 1e4cdc92..54628e26 100644 > --- a/openbsd-compat/bsd-cygwin_util.c > +++ b/openbsd-compat/bsd-cygwin_util.c > @@ -37,6 +37,7 @@ > #include <string.h> > #include <unistd.h> > #include <stdarg.h> > +#include <stdlib.h> > #include <wchar.h> > #include <wctype.h> > > @@ -191,16 +192,20 @@ _match_pattern(const char *s, const char *pattern) > wchar_t *ws; > wchar_t *wpattern; > size_t len; > + int ret; > > if ((len = mbstowcs(NULL, s, 0)) < 0) > return 0; > - ws = (wchar_t *) alloca((len + 1) * sizeof (wchar_t)); > + ws = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t)); > mbstowcs(ws, s, len + 1); > if ((len = mbstowcs(NULL, pattern, 0)) < 0) > return 0; > - wpattern = (wchar_t *) alloca((len + 1) * sizeof (wchar_t)); > + wpattern = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t)); > mbstowcs(wpattern, pattern, len + 1); > - return __match_pattern (ws, wpattern); > + ret = __match_pattern (ws, wpattern); > + free(ws); > + free(wpattern); > + return ret; > }Great idea. I just built and tested it. Please go ahead. What about my other patch to contrib/cygwin/ssh-host-config? Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20190312/2485fa47/attachment.asc>
Darren Tucker
2019-Mar-12 23:53 UTC
[PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
On Wed, 13 Mar 2019 at 00:59, Corinna Vinschen <vinschen at redhat.com> wrote: [...]> Great idea. I just built and tested it. Please go ahead.Applied, thanks.> What about my other patch to contrib/cygwin/ssh-host-config?The last message I have said "The commit message isn't quite right, V3 of the patch is forthcoming." Was there one after that? -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Corinna Vinschen
2019-Mar-13 12:15 UTC
[PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
On Mar 13 10:53, Darren Tucker wrote:> On Wed, 13 Mar 2019 at 00:59, Corinna Vinschen <vinschen at redhat.com> wrote: > [...] > > Great idea. I just built and tested it. Please go ahead. > > Applied, thanks. > > > What about my other patch to contrib/cygwin/ssh-host-config? > > The last message I have said "The commit message isn't quite right, V3 > of the patch is forthcoming." Was there one after that?I sent v3 at more or less the same time: https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-February/037609.html Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20190313/039a3e43/attachment.asc>
Seemingly Similar Threads
- [PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
- [PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
- [PATCH 2/2] Cygwin: implement case-insensitive Unicode user and group name matching
- [PATCH 0/2] Cygwin: allow user and group case-insensitive Unicode strings
- [PATCH] Cygwin: Change service name to cygsshd