Membership of group

Membership of group

Post by Khri » Fri, 18 Jul 2003 04:07:45



        Hi All,

    I know that exist "innetgr" function in C, to test the membership of an
user to a netgroup.

    I would like to know if a similar function exist ( in C ) to test the
membership to a group ...

                            Thanx all

Bob

 
 
 

Membership of group

Post by Anthony Mandi » Fri, 18 Jul 2003 18:39:59



>     I know that exist "innetgr" function in C, to test the membership of an
> user to a netgroup.

>     I would like to know if a similar function exist ( in C ) to test the
> membership to a group ...

        I wouldn't say it was similar, but look at getgrent and the
        related functions.

-am     ? 2003

 
 
 

1. checking membership of group in filesystems

Replace your sh script with a more efficient perl script. For example:

#!/usr/bin/perl -w

$\ = "\n";
$, = " ";
for ($n = 0; <>; $n += 1) {



        open(FIND, "find $dir -type d -ls |") or die;
FILE:   while (<FIND>) {
                ($owner, $group, $file) = (split())[4,5,10];
                next FILE unless defined($list{$group});

                        next FILE if $member eq $owner;
                }
                print($owner, $group, $file);
        }
        close(FIND);

Which would be invoked as `script_name dir1 dir2 ... < grouplist',
where grouplist contains lines of the form `group userA userB ...'.

Regards,
Waldi


--
God created the world in six days, and was arrested on the seventh.

2. C Compiler

3. Group membership for a group

4. newbie tar question

5. Group membership problem

6. Proxim Symphony PCI Card

7. How to do automatic group membership?

8. Website indexer

9. More than 32 group membership problem

10. group memberships

11. file permissions & group membership when uploading files via FTP

12. Problem with multi-group membership? SOLVED

13. Group Membership