Hello,
[email protected] (Okan Demirmen), 2019.04.29 (Mon) 16:19 (CEST):
> On Fri 2019.04.26 at 07:15 +0200, Bruno Fl?ckiger wrote:
> > Hi,
> >
> > The ssh menu of cwm(1) doesn't filter duplicated hostnames when reading
> > them from ~/.ssh/known_hosts. This patch makes sure each hostname is
> > only displayed once to the menu.
>
> Sure, maybe; but why again do we even have this inside a window manager?
> Really, the known_hosts parsing is incomplete at best; either the entire
> parsing code needs to be lifted from ssh or this (mis)feature should be
> removed from cwm. I prefer the latter.
FWIW, i use "M-period" a lot... are there easy alternatives?
Marcus
> > Cheers,
> > Bruno
> >
> >
> > Index: app/cwm/kbfunc.c
> > ===================================================================
> > RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
> > retrieving revision 1.165
> > diff -u -p -r1.165 kbfunc.c
> > --- app/cwm/kbfunc.c 7 Mar 2019 14:28:17 -0000 1.165
> > +++ app/cwm/kbfunc.c 12 Mar 2019 11:24:47 -0000
> > @@ -672,6 +672,7 @@ kbfunc_menu_ssh(void *ctx, struct cargs
> >
> > lbuf = NULL;
> > len = 0;
> > +skip:
> > while ((slen = getline(&lbuf, &len, fp)) != -1) {
> > buf = lbuf;
> > if (buf[slen - 1] == '\n')
> > @@ -686,6 +687,10 @@ kbfunc_menu_ssh(void *ctx, struct cargs
> > if (p - buf + 1 > sizeof(hostbuf))
> > continue;
> > (void)strlcpy(hostbuf, buf, p - buf + 1);
> > + /* skip duplicate hostnames */
> > + TAILQ_FOREACH(mi, &menuq, entry);
> > + if (strcmp(mi->text, hostbuf) == 0)
> > + goto skip;
> > menuq_add(&menuq, NULL, "%s", hostbuf);
> > }
> > free(lbuf);
> >
>