mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 09:43:32 +08:00
parent
233a182b9e
commit
c518f9a4b4
@ -1,5 +1,8 @@
|
||||
2009-06-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #10207]
|
||||
* nss/getent.c: Add support for print gshadow data.
|
||||
|
||||
[BZ #10203]
|
||||
* nis/nss_nis/nis-pwd.c (internal_nis_endpwent): Free all buffers,
|
||||
not just the currently used one and those which follow.
|
||||
|
66
nss/getent.c
66
nss/getent.c
@ -24,6 +24,7 @@
|
||||
#include <ctype.h>
|
||||
#include <error.h>
|
||||
#include <grp.h>
|
||||
#include <gshadow.h>
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
#include <mcheck.h>
|
||||
@ -232,6 +233,70 @@ group_keys (int number, char *key[])
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is for gshadow */
|
||||
static void
|
||||
print_gshadow (struct sgrp *sg)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
printf ("%s:%s:",
|
||||
sg->sg_namp ? sg->sg_namp : "",
|
||||
sg->sg_passwd ? sg->sg_passwd : "");
|
||||
|
||||
while (sg->sg_adm[i] != NULL)
|
||||
{
|
||||
fputs_unlocked (sg->sg_adm[i], stdout);
|
||||
++i;
|
||||
if (sg->sg_adm[i] != NULL)
|
||||
putchar_unlocked (',');
|
||||
}
|
||||
|
||||
putchar_unlocked (':');
|
||||
|
||||
i = 0;
|
||||
while (sg->sg_mem[i] != NULL)
|
||||
{
|
||||
fputs_unlocked (sg->sg_mem[i], stdout);
|
||||
++i;
|
||||
if (sg->sg_mem[i] != NULL)
|
||||
putchar_unlocked (',');
|
||||
}
|
||||
|
||||
putchar_unlocked ('\n');
|
||||
}
|
||||
|
||||
static int
|
||||
gshadow_keys (int number, char *key[])
|
||||
{
|
||||
int result = 0;
|
||||
int i;
|
||||
|
||||
if (number == 0)
|
||||
{
|
||||
struct sgrp *sg;
|
||||
|
||||
setsgent ();
|
||||
while ((sg = getsgent ()) != NULL)
|
||||
print_gshadow (sg);
|
||||
endsgent ();
|
||||
return result;
|
||||
}
|
||||
|
||||
for (i = 0; i < number; ++i)
|
||||
{
|
||||
struct sgrp *sg;
|
||||
|
||||
sg = getsgnam (key[i]);
|
||||
|
||||
if (sg == NULL)
|
||||
result = 2;
|
||||
else
|
||||
print_gshadow (sg);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is for hosts */
|
||||
static void
|
||||
print_hosts (struct hostent *host)
|
||||
@ -756,6 +821,7 @@ D(ahostsv6)
|
||||
D(aliases)
|
||||
D(ethers)
|
||||
D(group)
|
||||
D(gshadow)
|
||||
D(hosts)
|
||||
D(netgroup)
|
||||
D(networks)
|
||||
|
Loading…
Reference in New Issue
Block a user