Skip to content

Commit

Permalink
nss_tacplus: Provide dummy setpwent(), getpwent_r(), endpwent().
Browse files Browse the repository at this point in the history
These aren't really needed, since TACACS+ does not support enumeration, but providing placeholders keeps nsdispatch() from complaining that they're missing.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41658
  • Loading branch information
dag-erling committed Aug 31, 2023
1 parent 872e894 commit 56b74a2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/nss_tacplus/nss_tacplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,43 @@ nss_tacplus_getpwnam_r(void *retval, void *mdata __unused, va_list ap)
return (ret);
}

static int
nss_tacplus_setpwent(void *retval __unused, void *mdata __unused,
va_list ap __unused)
{
return (NS_SUCCESS);
}

static int
nss_tacplus_getpwent_r(void *retval, void *mdata __unused, va_list ap)
{
struct passwd *pwd __unused = va_arg(ap, struct passwd *);
char *buffer __unused = va_arg(ap, char *);
size_t bufsize __unused = va_arg(ap, size_t);
int *result = va_arg(ap, int *);

*(void **)retval = NULL;
*result = 0;
return (NS_SUCCESS);

}

static int
nss_tacplus_endpwent(void *retval __unused, void *mdata __unused,
va_list ap __unused)
{
return (NS_SUCCESS);
}

ns_mtab *
nss_module_register(const char *name __unused, unsigned int *plen,
nss_module_unregister_fn *unreg)
{
static ns_mtab mtab[] = {
{ "passwd", "getpwnam_r", &nss_tacplus_getpwnam_r, NULL },
{ "passwd", "setpwent", &nss_tacplus_setpwent, NULL },
{ "passwd", "getpwent_r", &nss_tacplus_getpwent_r, NULL },
{ "passwd", "endpwent", &nss_tacplus_endpwent, NULL },
};

*plen = nitems(mtab);
Expand Down

0 comments on commit 56b74a2

Please sign in to comment.