Commit 93a08815 authored by Mike Gilbert's avatar Mike Gilbert Committed by Ariadne Conill
Browse files

main/musl: getent: add support for the 'shadow' database

This was implemented for Gentoo Linux. We utilize it in the user
management code in the gentoo ebuild repository.
parent 68ed853f
......@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.2.2
pkgrel=0
pkgrel=1
pkgdesc="the musl c library (libc) implementation"
url="https://musl.libc.org/"
arch="all"
......
......@@ -36,6 +36,7 @@
#include <netdb.h>
#include <pwd.h>
#include <grp.h>
#include <shadow.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
......@@ -428,6 +429,29 @@ static int services(int argc, char *argv[])
return rv;
}
static int shadow(int argc, char *argv[])
{
struct spwd *sp;
int i, rv;
rv = RV_OK;
if (argc == 2) {
while ((sp = getspent()) != NULL)
putspent(sp, stdout);
} else {
for (i = 2; i < argc; i++) {
sp = getspnam(argv[i]);
if (sp == NULL) {
rv = RV_NOTFOUND;
break;
}
putspent(sp, stdout);
}
}
endspent();
return rv;
}
static int shells(int argc, char *argv[])
{
const char *sh;
......@@ -471,6 +495,7 @@ static struct getentdb {
{ "passwd", passwd, },
{ "protocols", protocols, },
{ "services", services, },
{ "shadow", shadow, },
{ "shells", shells, },
{ NULL, NULL, },
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment