Andreas Kusalananda K?h?ri([email protected]) on 2018.06.17 12:41:13
+0200:
> >Synopsis: finger does not expand '&' to username
> >Category: documentation
> >Environment:
> System : OpenBSD 6.3
> Details : OpenBSD 6.3-current (GENERIC.MP) #63: Thu Jun 14
> 15:08:23 CEST 2018
>
> [email protected]:/extra/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine : amd64
> >Description:
>
> The passwd(5) documentation says:
>
> The full name may contain an ampersand (???&???), which will be replaced
> by
> the capitalized login name when the gecos field is displayed or used by
> various programs such as finger(1), sendmail(8), etc.
>
> But finger(1) does not do this.
>
> >How-To-Repeat:
>
> $ getent passwd operator
> operator:*:2:5:System &:/operator:/sbin/nologin
>
> $ finger operator
> Login: operator Name: System &
> Directory: /operator Shell: /sbin/nologin
> Never logged in.
> No Mail.
> No Plan.
>
> >Fix:
>
> Update the documentation in passwd(5) (or fix finger(1) behaviour).
i think rev 1.29 on 2014/11/19 broke this.
Here is a fix:
diff --git usr.bin/finger/util.c usr.bin/finger/util.c
index 380c06682aa..32d7b7c04bb 100644
--- usr.bin/finger/util.c
+++ usr.bin/finger/util.c
@@ -104,7 +104,7 @@ userinfo(PERSON *pn, struct passwd *pw)
if (!(p = strsep(&bp, ",")))
return;
expandusername(p, pw->pw_name, name, sizeof(name));
- if (stravis(&pn->realname, p, VIS_SAFE|VIS_NOSLASH) == -1)
+ if (stravis(&pn->realname, name, VIS_SAFE|VIS_NOSLASH) == -1)
err(1, "stravis");
if ((p = strsep(&bp, ",")) && *p) {
if (stravis(&pn->office, p, VIS_SAFE|VIS_NOSLASH) == -1)