AFS

 view release on metacpan or  search on metacpan

examples/v2/pts/PR_AddToGroup  view on Meta::CPAN

#!/usr/local/bin/perl

use blib;
use strict;
use warnings;

use AFS::PTS;

die "Usage: $0 uid gid\n" if $#ARGV != 1;

my $uid = shift;
my $gid = shift;

my $pts = AFS::PTS->new;
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n";

my $ok = $pts->PR_AddToGroup($uid, $gid);
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else            { print "success  = $ok\n"; }

examples/v2/pts/PR_IsAMemberOf  view on Meta::CPAN

#!/usr/local/bin/perl

use blib;
use strict;
use warnings;

use AFS::PTS;

die "Usage: $0 uid gid\n" if $#ARGV != 1;

my $pts = AFS::PTS->new;
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n";

my $uid = shift;
my $gid = shift;

my $ok = $pts->PR_IsAMemberOf($uid, $gid);
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else            { print "OK = $ok\n"; }

examples/v2/pts/PR_ListMax  view on Meta::CPAN


use blib;
use strict;
use warnings;

use AFS::PTS;

my $pts = AFS::PTS->new;
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n";

my ($uid, $gid) = $pts->PR_ListMax;
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else            { print "UID = $uid  GID = $gid\n"; }

examples/v2/pts/PR_RemoveFromGroup  view on Meta::CPAN

#!/usr/local/bin/perl

use blib;
use strict;
use warnings;

use AFS::PTS;

die "Usage: $0 uid gid\n" if $#ARGV !=1;

my $uid = shift;
my $gid = shift;

my $pts = AFS::PTS->new;
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n";

my $ok = $pts->PR_RemoveFromGroup($uid, $gid);
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else            { print "success  = $ok\n"; }

examples/v2/pts/listmax  view on Meta::CPAN


use blib;
use strict;
use warnings;

use AFS::PTS;

my $pts = AFS::PTS->new;
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n";

my ($uid, $gid) = $pts->listmax;
if ($AFS::CODE) { print "AFS::CODE = $AFS::CODE\n"; }
else            { print "UID = $uid  GID = $gid\n"; }

pod/v2/afsperlpts.pod  view on Meta::CPAN

AFS system library function 'PR_IsAMemberOf'.

=item B<$entry = $pts-E<gt>listentry(NAME [, LOOKUP_ID [, CONV]]);>

Returns a reference to a hash table containing the values from the C
structure C<prcheckentry>.  If LOOKUP_ID is 1 (default) then the PTS
ids in the hash table will be converted to names. If CONV is 1
(default) then flags will be converted to its ASCII representation.
It calls the AFS system library function 'PR_ListEntry'.

=item B<($uid, $gid) = $pts-E<gt>listmax;>

Returns the largest allocated user ID and group ID.  It calls the AFS
system library function 'PR_ListMax'.

=item B<@members = $pts-E<gt>members(NAME [, LOOKUP_ID [, OVER]]);>

Returns the list of groups in which the user NAME is a member. If NAME
is a group, this method returns a list of users which are in that
group. If LOOKUP_ID is 1 (default) then names will be returned.  If
the size of the list is greater then &AFS::PR_MAXGROUPS then OVER will

pod/v2/afsperlpts.pod  view on Meta::CPAN

numerical ids, not names.  If the size of the generated list has
overflowed the maximum list size, PR_MAXGROUPS (5,000), then the OVER
argument is set to a non­zero value.

=item B<$entry = $pts-E<gt>PR_ListEntry(ID);>

Returns a reference to a hash table containing the values from the C
structure C<prcheckentry> for the PDB entry ID. No conversion is done
on ids or flags.

=item B<($uid, $gid) = $pts-E<gt>PR_ListMax;>

Returns the largest allocated user id and group id.

=item B<@members = $pts-E<gt>PR_ListOwned(ID, OVER);>

Returns a list of AFS ids owned by the given user or group ID.  If the
ID parameter is set to zero, then the PDB orphan list is returned. If
the size of the generated list has overflowed the maximum list size,
PR_MAXGROUPS (5,000), then the OVER argument is set to a non­zero
value.

src/AFS.xs  view on Meta::CPAN

        XSRETURN(1);
    }

void
pts_adduser(server,name,group)
        AFS::PTS server
        char *  name
        char *  group
    PPCODE:
    {
        int32 code, id, gid;

        code = internal_pr_id(server, name, &id, 0);
        if (code == 0)
            code = internal_pr_id(server, group, &gid, 0);
        if (code == 0)
            code = ubik_Call(PR_AddToGroup, server, 0, id, gid);
        SETCODE(code);

        ST(0) = sv_newmortal();
        sv_setiv(ST(0), (code == 0));
        XSRETURN(1);
    }

void
pts_PR_AddToGroup(server,uid,gid)
        AFS::PTS server
        int32   uid
        int32   gid
    PPCODE:
    {
        int32 code;
        code = ubik_Call(PR_AddToGroup, server, 0, uid, gid);
        SETCODE(code);
        ST(0) = sv_newmortal();
        sv_setiv(ST(0), (code == 0));
        XSRETURN(1);
    }

void
pts_removeuser(server,name,group)
        AFS::PTS server
        char *  name
        char *  group
    PPCODE:
    {
        int32 code, id, gid;

        code = internal_pr_id(server, name, &id, 0);
        if (code == 0)
            code = internal_pr_id(server, group, &gid, 0);
        if (code == 0)
            code = ubik_Call(PR_RemoveFromGroup, server, 0, id, gid);
        SETCODE(code);

        ST(0) = sv_newmortal();
        sv_setiv(ST(0), (code == 0));
        XSRETURN(1);
    }

void
pts_PR_RemoveFromGroup(server,uid,gid)
        AFS::PTS server
        int     uid
        int     gid
    PPCODE:
    {
        int32 code;

        code = ubik_Call(PR_RemoveFromGroup, server, 0, uid, gid);
        SETCODE(code);
        ST(0) = sv_newmortal();
        sv_setiv(ST(0), (code == 0));
        XSRETURN(1);
    }

void
pts_delete(server,name)
        AFS::PTS server
        char *  name

src/AFS.xs  view on Meta::CPAN

        if (code == 0)
            sv_setiv(ST(0), pos);
        XSRETURN(1);
    }

void
pts_listmax(server)
        AFS::PTS server
    PPCODE:
    {
        int32 code, uid, gid;

        code = ubik_Call(PR_ListMax, server, 0, &uid, &gid);
        SETCODE(code);
        if (code == 0) {
            EXTEND(sp, 2);
            PUSHs(sv_2mortal(newSViv(uid)));
            PUSHs(sv_2mortal(newSViv(gid)));
        }
    }

void
pts_PR_ListMax(server)
        AFS::PTS server
    PPCODE:
    {
        int32 code, uid, gid;

        code = ubik_Call(PR_ListMax, server, 0, &uid, &gid);
        SETCODE(code);
        if (code == 0) {
            EXTEND(sp, 2);
            PUSHs(sv_2mortal(newSViv(uid)));
            PUSHs(sv_2mortal(newSViv(gid)));
        }
    }

void
pts_setmax(server,id,isgroup=0)
        AFS::PTS server
        int32   id
        int32   isgroup
    PPCODE:
    {

src/AFS.xs  view on Meta::CPAN

        XSRETURN(1);
    }

void
pts_ismember(server,name,group)
        AFS::PTS server
        char *  name
        char *  group
    PPCODE:
    {
        int32 code, id, gid, flag;

        code = internal_pr_id(server, name, &id, 0);
        if (code == 0)
            code = internal_pr_id(server, group, &gid, 0);
        if (code == 0)
            code = ubik_Call(PR_IsAMemberOf, server, 0, id, gid, &flag);
        SETCODE(code);

        ST(0) = sv_newmortal();
        if (code == 0)
            sv_setiv(ST(0), (flag != 0));
        XSRETURN(1);
    }

void
pts_PR_IsAMemberOf(server,uid,gid)
        AFS::PTS server
        int32   uid
        int32   gid
    PPCODE:
    {
        int32 code, flag;

        code = ubik_Call(PR_IsAMemberOf, server, 0, uid, gid, &flag);
        SETCODE(code);
        ST(0) = sv_newmortal();
        if (code == 0)
            sv_setiv(ST(0), (flag != 0));
        XSRETURN(1);
    }


MODULE = AFS            PACKAGE = AFS::KAS      PREFIX = kas_



( run in 1.540 second using v1.01-cache-2.11-cpan-5735350b133 )