Date: Thu, 23 May 2013 21:00:01 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-bugs@FreeBSD.org Subject: Re: bin/132692: commit references a PR Message-ID: <201305232100.r4NL01I4053915@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/132692; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: bin/132692: commit references a PR Date: Thu, 23 May 2013 20:52:43 +0000 (UTC) Author: ghelmer Date: Thu May 23 20:52:30 2013 New Revision: 250942 URL: http://svnweb.freebsd.org/changeset/base/250942 Log: Add support for netgroup, based on patch in the PR but made consistent with existing style. PR: bin/132692 Modified: head/usr.bin/getent/getent.c Modified: head/usr.bin/getent/getent.c ============================================================================== --- head/usr.bin/getent/getent.c Thu May 23 19:50:36 2013 (r250941) +++ head/usr.bin/getent/getent.c Thu May 23 20:52:30 2013 (r250942) @@ -61,6 +61,7 @@ static int parsenum(const char *, unsign static int ethers(int, char *[]); static int group(int, char *[]); static int hosts(int, char *[]); +static int netgroup(int, char *[]); static int networks(int, char *[]); static int passwd(int, char *[]); static int protocols(int, char *[]); @@ -89,6 +90,7 @@ static struct getentdb { { "rpc", rpc, }, { "services", services, }, { "shells", shells, }, + { "netgroup", netgroup, }, { "utmpx", utmpx, }, { NULL, NULL, }, @@ -571,6 +573,47 @@ shells(int argc, char *argv[]) } /* + * netgroup + */ +static int +netgroup(int argc, char *argv[]) +{ + char *host, *user, *domain; + int first; + int rv, i; + + assert(argc > 1); + assert(argv != NULL); + +#define NETGROUPPRINT(s) (((s) != NULL) ? (s) : "") + + rv = RV_OK; + if (argc == 2) { + fprintf(stderr, "Enumeration not supported on netgroup\n"); + rv = RV_NOENUM; + } else { + for (i = 2; i < argc; i++) { + setnetgrent(argv[i]); + first = 1; + while (getnetgrent(&host, &user, &domain) != 0) { + if (first) { + first = 0; + (void)fputs(argv[i], stdout); + } + (void)printf(" (%s,%s,%s)", + NETGROUPPRINT(host), + NETGROUPPRINT(user), + NETGROUPPRINT(domain)); + } + if (!first) + (void)putchar('\n'); + endnetgrent(); + } + } + return rv; +} + +/* * utmpx */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305232100.r4NL01I4053915>