From nobody Wed Dec 13 20:06:18 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sr61l3g9kz54FnJ; Wed, 13 Dec 2023 20:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sr61l1nwzz4Yhg; Wed, 13 Dec 2023 20:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702497979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=myafYLLpQUjqPetfBToFxtkf9S4qToaSpbiEQSt014M=; b=ORgkHz7IfO42XRbxzBSoT3rzO6ol71L7GGTNyoN7jrMrOm8n/NkWrp6qCXPYSoQ2DAoyWj W60LeOIK6Uf5c/a1u3fNTjqwUAE0fVxwKRQykjQmfrBl5PsdyriaSzY8QewLJMpzCHTNQ0 WomWOBuV3SHO1jQZvSAtwn7OOXHUZ7EnlwPXXrAeYnCQh89BUSstNAwn4kGd4e4+REvve+ AYcj9wxiB7cLB/Opx6L4RWj9K9YhSDwk4tfz90wX/NaJwsNkdQ5YLUGkqMlzYr57R2fcqr Yp7jgtWp7rTd9SCsWpoost1uyyN6vYIHb+2+tCYDYY1EkZTVLJWVoGTMqgf8ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702497979; a=rsa-sha256; cv=none; b=P8Po5WJq246XsN1yjm4qOk3bZUhtDxYdEnrJQPnPyLzXIiJri3vIRvXsSDc5/UyFVJ8fZs GbeN4Z4+JcvpZwZn9T7zKxVkJSBEMwoPo0C4eQUJJZj/XeFTpMzhTm8q3J9gAxzxmdheNG 0V/oDfzdYEPE90ivcFXz5C1hJbIwearfllaXNDYV2fnT7LUM7i1sfd4Hq0WRJvoSg97bTj Uqo3y3sWnCsCbQlpBGhLZ1nyL31FcMY761UFhTmqYUo0lnNa+qNTI8ihd1Ye98u4WynuCZ wzOFuEnqub8nbcRkFIGCGid9s4ubJwjCpYWTOzswfkjmyvqfN4PbuMSuH1yHCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702497979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=myafYLLpQUjqPetfBToFxtkf9S4qToaSpbiEQSt014M=; b=VMtvrvbMmffesAlAszMjlZiupFJqxA+Eq91O6+CTTmw4rl+5cUip/p1+UR7OM6zVf+GHOm TQAlg3wjm4cpmhACnP4Cd/dRzVPGOTzHn/yEsM63JndgXrjuRclsJODzgpD483VgS531js nHXlnixljyBewK5J8W++cOEPEaDsjIoDvlCjRuSVELMQSBwaIlq2YREYW5kZ2KZhAl1xX5 /WO9s/ZGmiqEz/zm8rLrJQnntANoTW4pcTJQN/VqZGotyPzmQAPwDRhXUyYqX/rfIy3cPA cxCObU0l168O0RcgAFyYXcIms2m0LM07D2cGfiCI0sTV9tBzq91IRwGGglPiMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sr61k742nz1Bxc; Wed, 13 Dec 2023 20:06:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BDK6Ilb086917; Wed, 13 Dec 2023 20:06:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BDK6IOv086914; Wed, 13 Dec 2023 20:06:18 GMT (envelope-from git) Date: Wed, 13 Dec 2023 20:06:18 GMT Message-Id: <202312132006.3BDK6IOv086914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 4437c6a18825 - stable/13 - nss_tacplus: Support setting the login class. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4437c6a1882570ab54acf70d7d91e82fbd2a05b7 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4437c6a1882570ab54acf70d7d91e82fbd2a05b7 commit 4437c6a1882570ab54acf70d7d91e82fbd2a05b7 Author: Dag-Erling Smørgrav AuthorDate: 2023-06-13 16:06:27 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-12-13 16:08:13 +0000 nss_tacplus: Support setting the login class. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: thj Differential Revision: https://reviews.freebsd.org/D40376 (cherry picked from commit 246aec9a3ce305272f35e6416910024f602a03c1) --- lib/nss_tacplus/nss_tacplus.8 | 5 ++++- lib/nss_tacplus/nss_tacplus.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/nss_tacplus/nss_tacplus.8 b/lib/nss_tacplus/nss_tacplus.8 index 4aaff4b5dd3a..f5c87a836f9a 100644 --- a/lib/nss_tacplus/nss_tacplus.8 +++ b/lib/nss_tacplus/nss_tacplus.8 @@ -3,7 +3,7 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause .\" -.Dd May 17, 2023 +.Dd June 13, 2023 .Dt NSS_TACPLUS 8 .Os .Sh NAME @@ -57,6 +57,9 @@ Numeric primary group ID. Must be between 0 and .Dv GID_MAX . Defaults to 65534. +.It Va CLASS +Login class. +Left blank if not provided. .It Va GECOS Display name. If not provided, the user name is used instead. diff --git a/lib/nss_tacplus/nss_tacplus.c b/lib/nss_tacplus/nss_tacplus.c index a59332504bc0..e18ffe2315ce 100644 --- a/lib/nss_tacplus/nss_tacplus.c +++ b/lib/nss_tacplus/nss_tacplus.c @@ -24,6 +24,7 @@ extern int __isthreaded; #define DEF_UID 65534 #define DEF_GID 65534 +#define DEF_CLASS "" #define DEF_DIR "/" #define DEF_SHELL "/bin/sh" @@ -192,6 +193,13 @@ tacplus_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, return (NS_RETURN); } pwd->pw_gid = num; + } else if (strcasecmp(av, "class") == 0) { + pwd->pw_class = tacplus_copystr(value, &buffer, + &bufsize); + if (pwd->pw_class == NULL) { + free(av); + return (NS_RETURN); + } } else if (strcasecmp(av, "gecos") == 0) { pwd->pw_gecos = tacplus_copystr(value, &buffer, &bufsize); @@ -217,6 +225,10 @@ tacplus_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, free(av); } + /* default class if none was provided */ + if (pwd->pw_class == NULL) + pwd->pw_class = tacplus_copystr(DEF_CLASS, &buffer, &bufsize); + /* gecos equal to name if none was provided */ if (pwd->pw_gecos == NULL) pwd->pw_gecos = pwd->pw_name;