id: sanitize arguments better

The -[AMc] flags ignore the user argument.  Better if id rejects
invocations that include a user argument along with any of those flags.

PR:		256554
MFC after:	2 weeks
Reviewed by:	trasz
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D30734
This commit is contained in:
Alan Somers 2021-06-11 10:38:07 -06:00
parent 7d681ad774
commit 4a06e93773

View File

@ -144,6 +144,8 @@ main(int argc, char *argv[])
if (iswhoami && argc > 0)
usage();
if ((cflag || Aflag || Mflag) && argc > 0)
usage();
switch(Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) {
case 1: