Date: Thu, 3 Jul 2025 12:01:12 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8e4db537c34f - main - pfctl: Use uid_from_user(3) and gid_from_group(3) Message-ID: <202507031201.563C1CEL052112@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8e4db537c34fcdea2a14afc84f6bd5ccaa086ddb commit 8e4db537c34fcdea2a14afc84f6bd5ccaa086ddb Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2025-06-30 08:09:22 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2025-07-03 07:16:15 +0000 pfctl: Use uid_from_user(3) and gid_from_group(3) in utilities that do repeated lookups. OK tb@ Obtained from: OpenBSD, millert <millert@openbsd.org>, a0f924b8c9 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index f05e5608ba9d..c939b5ae7cce 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -3926,14 +3926,14 @@ uid : STRING { if (!strcmp($1, "unknown")) $$ = UID_MAX; else { - struct passwd *pw; + uid_t uid; - if ((pw = getpwnam($1)) == NULL) { + if (uid_from_user($1, &uid) == -1) { yyerror("unknown user %s", $1); free($1); YYERROR; } - $$ = pw->pw_uid; + $$ = uid; } free($1); } @@ -4004,14 +4004,14 @@ gid : STRING { if (!strcmp($1, "unknown")) $$ = GID_MAX; else { - struct group *grp; + gid_t gid; - if ((grp = getgrnam($1)) == NULL) { + if (gid_from_group($1, &gid) == -1) { yyerror("unknown group %s", $1); free($1); YYERROR; } - $$ = grp->gr_gid; + $$ = gid; } free($1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507031201.563C1CEL052112>