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
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user