-/* Copyright (c) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1997-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <alloca.h>
#include <string.h>
char buf[grouplen + 50];
char leafbuf[grouplen + 3];
char domainbuf[grouplen + 3];
- unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
- unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
- char **mem_exp, **mem_imp, **mem_rec;
- char **nomem_exp, **nomem_imp, **nomem_rec;
nis_result *res;
char *cp, *cp2;
u_int i;
}
res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME);
- if (NIS_RES_STATUS(res) != NIS_SUCCESS)
+ if (res == NULL)
return;
- if ((NIS_RES_NUMOBJ (res) != 1) ||
- (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
- return;
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS
+ || NIS_RES_NUMOBJ (res) != 1
+ || __type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ)
+ {
+ nis_freeresult (res);
+ return;
+ }
- mem_exp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
- mem_imp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
- mem_rec = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
- nomem_exp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
- nomem_imp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
- nomem_rec = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ char *mem_exp[NIS_RES_NUMOBJ (res)];
+ char *mem_imp[NIS_RES_NUMOBJ (res)];
+ char *mem_rec[NIS_RES_NUMOBJ (res)];
+ char *nomem_exp[NIS_RES_NUMOBJ (res)];
+ char *nomem_imp[NIS_RES_NUMOBJ (res)];
+ char *nomem_rec[NIS_RES_NUMOBJ (res)];
+ unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
+ unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
for (i = 0;
i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
{
fputs (_(" Implicit nonmembers:\n"), stdout);
for (i = 0; i < nomem_imp_cnt; ++i)
- printf ("\t%s\n", &mem_imp[i][3]);
+ printf ("\t%s\n", &nomem_imp[i][3]);
}
else
fputs (_(" No implicit nonmembers\n"), stdout);
if (nomem_rec_cnt)
{
- fputs (_(" Explicit nonmembers:\n"), stdout);
+ fputs (_(" Recursive nonmembers:\n"), stdout);
for (i = 0; i < nomem_rec_cnt; ++i)
printf ("\t%s=n", &nomem_rec[i][2]);
}