1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
This patch would make ng-utils divert from the NetBSD tools they are built
on. Someone should try to get the change into NetBSD as well before the
patch is applied to this source.
- Petter Reinholdtsen, 2004-12-19
From: "Paul Lussier" <p.lussier@comcast.net>
Subject: ng-utils patch
To: pere@debian.org
Date: Fri, 03 Dec 2004 14:57:05 -0500
Reply-To: p.lussier@comcast.net
Hi,
I've recently been playing with ng-utils, and found it delightfully
wonderful :) One of the things I found lacking however, was the ability
to list a netgroup, but exclude members of sub-netgroup.
For example, if netgroups 'linux', 'solaris', 'irix' comprises netgroup
'desktops', I may want to see all but those which are solaris. I
quickly hacked this in, and seems to do exactly what I need (for now :)
I added a '-n' option to "negate" the sub-netgroup. There probably
needs to be a lot more error-checking, but it works for my puposes :)
If you think this is a useful thing, I'd be most appreciative if my
patch (below), or at least idea could make it into package.
Thanks,
Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE
It may look like I'm just sitting here doing nothing,
but I'm really actively waiting for all my problems to go away.
If you're not having fun, you're not doing it right!
-----------------------------------------------------------------------
--- netgroup.c 2004-12-03 14:51:42.000000000 -0500
+++ netgroup.c.orig 2003-01-25 05:55:39.000000000 -0500
@@ -81,15 +81,12 @@
int memberindex = 0;
const char *netgroup = NULL;
int opt;
- char *exclude_group = (char *)malloc(BUFSIZ);
- int retval = 0;
-
#ifdef HAVE_GETOPT_LONG
int option_index;
#endif /* HAVE_GETOPT_LONG */
do {
- opt = GETOPT_LONG(argc, argv, "dhuVn", long_options, &option_index);
+ opt = GETOPT_LONG(argc, argv, "dhuV", long_options, &option_index);
switch (opt)
{
case 'h':
@@ -105,8 +102,6 @@
version();
return 0;
break;
- case 'n':
- exclude_group = argv[optind++];
case -1:
break;
default:
@@ -132,12 +127,8 @@
while ( getnetgrent(&member[0], &member[1], &member[2]) )
{
- if (exclude_group) {
- retval = innetgr(exclude_group, member[0], member[1], member[2]);
- }
- if ((member[memberindex]) && (! retval)) {
+ if (member[memberindex])
printf("%s\n", member[memberindex]);
- }
}
endnetgrent();
|