AFS

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

   changed in version 2.4.1 (see POD doku AFS::VLDB)
 * This release does not support any features and interfaces from
   AFSPerl "version 1"

 User-visible changes:
 * compiles now with Perl 5.10.0
 * HTML documentation updated in order to include cross-references


 Developer-visible changes:
 * runs some tests only for module author
 * recognizes "automated tests" from CPAN testers



Version 2.4.1 (released 23 Oct 2008, revision 836/863)
http://www.mpa-garching.mpg.de/~nog/perl/AFS-2.4.1.tar.gz

 NOTICE:
 * This release does not support AFS system libraries version 3.4 or
   version 3.5

INSTALL  view on Meta::CPAN

for the OpenAFS 32-bit version

README
    Read the README file first.


AVAILABILITY
    The latest version of the AFS module bundle is currently available at

        http://www.MPA-Garching.MPG.de/~nog/perl/AFS-<version>.tar.gz
        http://www.cpan.org/authors/id/N/NO/NOG/AFS-<version>.tar.gz


RECOMMENDATIONS
    It is highly recommended to place the installation directory in
    the AFS file system.  Otherwise most of the test cases
    ('make test') are skipped.


REQUIREMENTS
    Before you can build the AFS module bundle you need to have the

INSTALL_64  view on Meta::CPAN

for the OpenAFS 64-bit version

README
    Read the README file first.


AVAILABILITY
    The latest version of the AFS module bundle is currently available at

        http://www.MPA-Garching.MPG.de/~nog/perl/AFS-<version>.tar.gz
        http://www.cpan.org/authors/id/N/NO/NOG/AFS-<version>.tar.gz


RECOMMENDATIONS
    It is highly recommended to place the installation directory in
    the AFS file system.  Otherwise most of the test cases
    ('make test') are skipped.


REQUIREMENTS
    Before you can build the AFS module bundle you need to have the

INSTALL_64  view on Meta::CPAN

    have tested this version of the AFS module bundle only on the
    Linux platform with the following combinations

        OS             @sys         compiler    OpenAFS    Perl   (threaded/non-threaded)
        ---------------------------------------------------------------------------------
        Linux 64-bit   amd64_linux26  gcc       1.4.11     5.10.0  non-threaded
                       amd64_linux26  gcc       1.4.12     5.10.0  non-threaded

                       amd64_linux26  gcc       1.4.12(*)  5.10.0  threaded
                                                (*) => modified libraries libafsrpc.a
                                                       and libafsauthent.a


FEEDBACK
    If you are building the modules on another architecture I would
    appreciate a note to tell me how you got on. Although I am
    particularly interested to hear about any problems you encounter
    when building the system, I would still like to hear from you even
    if you don't.

    Things I particularly would like to know

LICENCES/COPYING  view on Meta::CPAN

 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

LICENCES/COPYING  view on Meta::CPAN

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.


LICENCES/COPYING  view on Meta::CPAN

apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding

LICENCES/COPYING  view on Meta::CPAN


Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN

LICENCES/COPYING  view on Meta::CPAN

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) 19yy name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your

MANIFEST  view on Meta::CPAN

examples/v2/bos/getrestricted
examples/v2/bos/listhosts
examples/v2/bos/listkeys
examples/v2/bos/listusers
examples/v2/bos/prune
examples/v2/bos/removehost
examples/v2/bos/removekey
examples/v2/bos/removeuser
examples/v2/bos/restart
examples/v2/bos/salvage
examples/v2/bos/setauth
examples/v2/bos/setcellname
examples/v2/bos/setrestart
examples/v2/bos/setrestricted
examples/v2/bos/shutdown
examples/v2/bos/start
examples/v2/bos/startup
examples/v2/bos/status
examples/v2/bos/stop
examples/v2/cell/configdir
examples/v2/cell/expandcell

META.json  view on Meta::CPAN

{
   "abstract" : "Perl interface to AFS programming APIs",
   "author" : [
      "Norbert E Gruener <nog@MPA-Garching.MPG.de>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690",
   "license" : [
      "unknown"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : "2"

META.yml  view on Meta::CPAN

---
abstract: 'Perl interface to AFS programming APIs'
author:
  - 'Norbert E Gruener <nog@MPA-Garching.MPG.de>'
build_requires:
  ExtUtils::MakeMaker: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690'
license: unknown
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html

examples/v2/bos/salvage  view on Meta::CPAN


print "bos->salvage()...\n";

# these are all possible non MR-AFS parameters:
my ($partition, $volume) = ('/vicepa', 'u.vanilla');
my $all                  = 0;
my $outName              = ''; # salvage log output file
my $showlog              = 0;
my ($parallel, $tmpDir)  = ('', '');
my $orphans              = 'ignore'; # ignore | remove | attach
my $localauth            = 0;


$ok = $bos->salvage($partition, $volume);
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Something went wrong\n" unless $ok;

exit;


## some error conditions:

examples/v2/bos/salvage  view on Meta::CPAN

$ok = $bos->salvage($partition, $volume, $all);
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Something went wrong\n" unless $ok;


$all = 0;
$ok = $bos->salvage($partition, $volume, $outName,
                    $all, $showlog,
                    $parallel, $tmpDir,
                    $orphans,
                    $localauth
                   );
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Something went wrong\n" unless $ok;

$bos->DESTROY;

examples/v2/bos/setauth  view on Meta::CPAN


$server   = shift;
$cellname = shift;

if ($cellname) { $bos = AFS::BOS->new($server, 0, 0, $cellname); }
else           { $bos = AFS::BOS->new($server); }
$AFS::CODE and print "AFS::CODE = $AFS::CODE\n" and die;

die "not yet tested ... \n";

print "bos->setauth()...\n";

my $ok = $bos->setauth('on'); # or 'off'
print "Error Code: $AFS::CODE\n" if ($AFS::CODE);
print "Something went wrong\n" unless $ok;

$bos->DESTROY;

examples/v2/kas/Authenticate  view on Meta::CPAN


die "Usage: user\n" if ($#ARGV != 0);

my $user       = AFS::KTC_PRINCIPAL->new(shift);
checkafs('principal new');
my $key        = AFS::KTC_EKEY->ReadPassword($user->name."'s Password:");
checkafs('read passwd');
my $kas        = AFS::KAS->AuthServerConn(AFS::KTC_TOKEN->nulltoken, &AFS::KA_AUTHENTICATION_SERVICE);
checkafs('server conn');
my $token = $kas->Authenticate($user->name, $user->instance, &AFS::KA_TICKET_GRANTING_SERVICE, $key, time, time+600);
checkafs('authenticate');

print " Token  startTime = ", &ctime($token->startTime), "\n";
print "          endTime = ", &ctime($token->endTime), "\n";

examples/v2/kas/GetToken  view on Meta::CPAN

use AFS::Cell qw(localcell);
use AFS qw(raise_exception);

die "Usage: user\n" if ($#ARGV != 0);

raise_exception(1);
my $user       = AFS::KTC_PRINCIPAL->new(shift);
$user->cell(localcell) if ($user ->cell eq'');
my $key        = AFS::KTC_EKEY->ReadPassword($user->name."'s Password:");
my $kas        = AFS::KAS->AuthServerConn(AFS::KTC_TOKEN->nulltoken, &AFS::KA_AUTHENTICATION_SERVICE);
my $auth_token = $kas->Authenticate($user->name, $user->instance, &AFS::KA_TICKET_GRANTING_SERVICE, $key, time, time+600);

undef $kas;
$kas     = AFS::KAS->AuthServerConn($auth_token, &AFS::KA_TICKET_GRANTING_SERVICE);
my $service = AFS::KTC_PRINCIPAL->new("afs", "", localcell);
my $token   = $kas->GetToken($service->name, $service->instance, time, time+600, $auth_token);
print "KAS afs-token: \n";
print "StartTime  = ", ctime($token->startTime), "\n";
print "EndTime    = ", ctime($token->endTime), "\n";
print "Kvno       = ", $token->kvno, "\n";
print "TicketLen  = ", $token->ticketLen, "\n";

examples/v2/kas/examine  view on Meta::CPAN

    print "\t key version is $$entry{'key_version'} ";
}
else {
    print "\t key ($$entry{'key_version'}) cksum is $$entry{'keyCheckSum'}, ";
}

my $cpw_time = $$entry{'change_password_time'};
chomp(my $cpw_date = strftime('%a %b %d %T %Y', localtime($cpw_time)));
print " last cpw: $cpw_date\n";

if (! $$entry{'misc_auth_bytes'}) {
    print "\t password will never expire.\n";
    print "\t An unlimited number of unsuccessful authentications is permitted.\n";
}
else {
    my $packed    = $$entry{'misc_auth_bytes'};
    my $pwexpire  = (($packed >> 24) & 0xff);
    my $is_locked = (($packed >> 16) & 0xff);
    my $nfail     = (($packed >>  8) & 0xff);
    my $locktime  = (($packed >>  0) & 0xff);

    if (! $pwexpire) { print "\t password will never expire.\n"; }
    else             { print "\t password will expire: $pwexpire\n"; }

    if (! $nfail) { print "\t An unlimited number of unsuccessful authentications is permitted.\n"; }
    else          { print "\t $nfail consecutive unsuccessful authentications are permitted.\n";
                    if (! $locktime) { print "\t The lock time for this user is not limited.\n"; }
                    else             { print "\t The lock time for this user is $locktime minutes.  !!! umrechnen !!!\n"; }
                    if (! $is_locked) { print "\t IS_LOCKED: muss noch gecheckt werden !!!\n"; }
                    else              { print "\t IS_LOCKED: uss noch gecheckt werden !!!\n"; }
                }
}

my $exp_date = $$entry{'user_expiration'};
if ($$entry{'user_expiration'} < 0)       { print "\t entry never expires."; }
elsif ($$entry{'user_expiration'} < $now) { print "\t DISABLED entry at $exp_date."; }

examples/v2/kas/getentry  view on Meta::CPAN

my $kas   = AFS::KAS->AuthServerConn($token, &AFS::KA_MAINTENANCE_SERVICE, $cell);
$Debug && print "AFS::CODE 4 = $AFS::CODE \n";

my $user = AFS::KTC_PRINCIPAL->new($usr);
$Debug && print "AFS::CODE 5 = $AFS::CODE \n";
my $entry = $kas->getentry($user->name, $user->instance);
$Debug && print "AFS::CODE 6 = $AFS::CODE \n";
print "\n\ngetentry:\n User data for ", $user->name, $user->instance, ": \n";
foreach my $tp_key (sort keys %$entry) {
    printf("%20s  %s\n",$tp_key, $$entry{$tp_key});
    if ($tp_key =~ 'misc_auth_bytes') {
        if ($$entry{$tp_key}) {
            my $packed    = $$entry{$tp_key};
            my $pwexpire  = (($packed >> 24) & 0xff);
            my $is_locked = (($packed >> 16) & 0xff);
            my $nfail     = (($packed >>  8) & 0xff);
            my $locktime  = (($packed >>  0) & 0xff);
            print "\t\t pwexpire  $pwexpire\n";
            print "\t\t nfail     $nfail\n";
            print "\t\t locktime  $locktime\n";
            print "\t\t is_locked $is_locked\n";

examples/v2/kas/setfields  view on Meta::CPAN

my $packed= (($pwexpire << 24) | ($pw_reuse  << 16) | ($nfail << 8) | $locktime );
#my $ok = $kas->setfields($user->name, $user->instance, $flags, $expire, $lifetime, $maxassoc, $packed);
my $ok = $kas->KAM_SetFields($user->name, $user->instance, $flags, $expire, $lifetime, $maxassoc, $packed);
printf("KAS setfields: %s \n", $ok ? 'yes' : 'no');
checkafs('SetFields');

$entry = $kas->getentry($user->name, $user->instance);
print "\n\nUser data for ", $user->name, $user->instance, ": \n";
foreach my $tp_key (sort keys %$entry) {
    printf("%20s  %s\n",$tp_key, $$entry{$tp_key});
    if ($tp_key =~ 'misc_auth_bytes') {
        if ($$entry{$tp_key}) {
            my $packed    = $$entry{$tp_key};
            my $pwexpire  = (($packed >> 24) & 0xff);
            my $is_locked = (($packed >> 16) & 0xff);
            my $nfail     = (($packed >>  8) & 0xff);
            my $locktime  = (($packed >>  0) & 0xff);
            print "\t\t pwexpire  $pwexpire\n";
            print "\t\t nfail     $nfail\n";
            print "\t\t locktime  $locktime\n";
            print "\t\t is_locked $is_locked\n";

openafs-pic.patch  view on Meta::CPAN

--- ./src/packaging/RedHat/openafs.spec.in.orig	2010-03-08 18:31:42.000000000 +0100
+++ ./src/packaging/RedHat/openafs.spec.in	2010-04-09 13:46:11.000000000 +0200
@@ -1537,6 +1537,8 @@
 %defattr(-,root,root)
 %{_libdir}/libafsauthent.a
 %{_libdir}/libafsrpc.a
+%{_libdir}/libafsauthent_pic.a
+%{_libdir}/libafsrpc_pic.a
 %if %{build_authlibs}
 %{_libdir}/libafsauthent.so
 %{_libdir}/libafsrpc.so
--- ./src/shlibafsauthent/Makefile.in.orig	2010-03-08 18:31:42.000000000 +0100
+++ ./src/shlibafsauthent/Makefile.in	2010-04-09 13:46:11.000000000 +0200
@@ -104,9 +104,12 @@
 	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}
 	-ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
 
-all: ${TOP_LIBDIR}/${LIBAFSAUTHENT}
+${DEST}/lib/libafsauthent_pic.a: libafsauthent_pic.a
+	${INSTALL} libafsauthent_pic.a ${DEST}/lib/libafsauthent_pic.a
 
-install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT}
+all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent_pic.a
+
+install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent_pic.a
 
 ${LIBAFSAUTHENT}: ${LIBOBJS}
 	case ${SYS_NAME} in \
@@ -120,6 +123,11 @@
 		${SHLIB_LINKER} -o ${LIBAFSAUTHENT} ${LIBOBJS} -L${TOP_LIBDIR} -lafsrpc ${MT_LIBS};; \
 	esac
 
+libafsauthent_pic.a: ${LIBOBJS}
+	$(RM) -f $@
+	$(AR) crv $@ ${LIBOBJS}
+	$(RANLIB) $@
+
 audit.o: ${AUDIT}/audit.c
 	${CCRULE}
 
@@ -282,9 +290,15 @@
 	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}
 	-ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
 
+${DESTDIR}${libdir}/libafsauthent_pic.a: libafsauthent_pic.a
+	${INSTALL} libafsauthent_pic.a ${DESTDIR}${libdir}/libafsauthent_pic.a
+
 ${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT}
 	${INSTALL} ${LIBAFSAUTHENT} ${TOP_LIBDIR}/${LIBAFSAUTHENT}
 	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}
 	-ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
 
-dest: ${DEST}/lib/${LIBAFSAUTHENT}
+${TOP_LIBDIR}/libafsauthent_pic.a: libafsauthent_pic.a
+	${INSTALL} libafsauthent_pic.a ${TOP_LIBDIR}/libafsauthent_pic.a
+
+dest: ${DEST}/lib/${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent_pic.a
--- ./src/shlibafsrpc/Makefile.in.orig	2010-03-08 18:31:42.000000000 +0100
+++ ./src/shlibafsrpc/Makefile.in	2010-04-09 13:46:11.000000000 +0200
@@ -134,15 +134,18 @@
 
 LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR}
 
-all: ${TOP_LIBDIR}/${LIBAFSRPC}
+all: ${TOP_LIBDIR}/${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc_pic.a
 
-install: ${DESTDIR}${libdir}/${LIBAFSRPC}

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


  $ok = $bos->exec('/sbin/shutdown -r now');

  my @logentries = $bos->getlog('FileLog');

  my ($all, $bak, $old, $core) = (0, 0, 0, 1);
  $ok = $bos->prune($all, $bak, $old, $core);

  $ok = $bos->salvage('/vicepa');

  $ok = $bos->setauth('on');

  $ok = $bos->setcellname('newcell.example.com');

=head1 DESCRIPTION

This class is used to communicate with a B<AFS Basic Overseer Server>,
which runs on every AFS server machine. It monitors and administers
the other server processes on that machine.  It has also methods to
maintain system configuration files.

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


Creates a new object of the class AFS::BOS and establishes a
connection to the Basic Overseer Server running on the SERVER machine.
An AFS::BOS object is essentially a handle to talk to the Basic
Overseer Server.  Internally an AFS::BOS object is a pointer to a
rx_connection structure, although this may change and the value
returned from AFS::BOS::new should always be treaded as an opaque
handle.

Set LOCALAUTH (default 0) to 1 only when issuing a command on a server
machine.  If NOAUTH is 1 (default 0) it establishes an unauthenticated
connection to the server, in which the server treats the issuer as an
unprivileged user.  CELL (default NULL) specifies the cell in which to
run the command.  Set ENCRYPT (default 1) to 0 if you want to use an
unencrypted connection. HANDLE WITH CARE!

=item B<DESTRUCTOR>

=item S< >

=item B<$bos-E<gt>DESTROY;>

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

??? Here must be a COMPLETE description of all arguments !!!

If your file server runs MR-AFS, a bunch of additional boolean options
are supported: debug, nowrite, force, oktozap, rootfiles, salvagedirs,
blockreads, ListResidencies, SalvageRemote, SalvageArchival,
IgnoreCheck, ForceOnLine, UseRootDirACL, TraceBadLinkCounts,
DontAskFS, LogLevel, rxdebug, Residencies.

Internally, a temporary cron job is created via 'BOZO_CreateBnode>.

=item B<$ok = $bos-E<gt>setauth('on' | 'off');>

Enables ('on') or disables('off') authorization checking for all
server processes on the server machine.  It calls the AFS system
library function I<BOZO_SetNoAuthFlag>.

=item B<$ok = $bos-E<gt>setcellname(NAME);>

B<NOT YET RELEASED>

Establishes the cell's NAME and makes the server machine a member of
it.  And it records the NAME in the two local files C<ThisCell> and
C<CellServDB>.  It calls the AFS system library function

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

  my $nfail    = 4;        #(nfail - 1) tries are allowed; => 3 tries
  my $locktime = 3;        #unit is 8.5 min => 3 * (8.5)
  my $spare2   = 0;

  my $packed = (($pwexpire << 24)|($pw_reuse << 16)|($nfail << 8)|$locktime);

  $ok = $kas->setfields($user->name, $user->instance, $flags,
                        $expire, $lifetime, $maxassoc, $packed);

  my $entry = $kas->getentry($user->name, $user->instance);
  $packed   = $$entry{'misc_auth_bytes'};
  $pwexpire = (($packed >> 24) & 0xff);
  $is_lockd = (($packed >> 16) & 0xff);
  $nfail    = (($packed >>  8) & 0xff);
  $locktime = (($packed >>  0) & 0xff);
  $pw_reuse = $$entry{'passwd_reuse'} - 0x12340000;

  $kas->DESTROY;           # destroy server connection

=head1 DESCRIPTION

This class is used to communicate with the B<AFS Authentication
Server>.  It verifies user identities and provides the facilities
through which participants in transactions prove their identities to
one another (mutually authenticate). It maintains the Authentication
Database, in which it stores user passwords converted into encryption
key form as well as the AFS server encryption key.  It has methods to
query the information held for any given AFS user and to create,
modify, and delete the records in the DB where the above information
is held.

Before you can access any DB record you must establish a connection to
the Authentication Server.  This is done by the constructor methods
I<SingleServerConn> and I<AuthServerConn> which return a KAS object.  A
KAS object is essentially a handle to talk to an Authentication Server

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


=item B<$entry = $kas-E<gt>KAM_Getentry(UNAME, UINST);>

Returns information from the Authentication Database entry for the
user entry UNAME.UINST.  The return value is a reference to a hash
table containing the values from the C structure C<kaentryinfo>.  The
hash table has the following keys

    change_password_time    flags                  keyCheckSum
    key_version             max_ticket_lifetime    minor_version
    misc_auth_bytes         modification_time      modification_user
    user_expiration

It calls the AFS system library function 'KAM_GetEntry'.

=item B<($num_admins, $kasstats, $kadstats) = $kas-E<gt>getstats;>

=item B<($num_admins, $kasstats, $kadstats) = $kas-E<gt>KAM_GetStats(VERSION);>

Returns statistics about the AuthServer and its database. If VERSION
does not match that used by the server, the call returns an error

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

This function alters the miscellaneous parameters associated with the
user entry UNAME.UINST. The FLAGS argument can be set to the following values

   &AFS::KAFNORMAL    regular user
   &AFS::KAFADMIN     an administrator
   &AFS::KAFNOTGS     not allow principal to get or use TGT
   &AFS::KAFNOSEAL    not allow principal as server in GetTicket
   &AFS::KAFNOCPW     not allow principal to change its own key
   &AFS::KAFNEWASSOC  allow user to create associates

EXPIRE is the epoch time after which attempts to authenticate as this user
will fail. The LIFETIME can be set to limit the lifetime of an
authentication ticket created for a user (unit is secs). MAXASSOC
defaults to -1.  PACKED is an array of four bytes. It contains

  PACKED[0]: password lifetime; range must be [0..254] days; 0 = infinity
  PACKED[1]: password reuse; [1 = yes], [2 = no], [0 = not changed]
  PACKED[2]: numb of failed logins; (fail - 1) tries are allowed; 0 = infinity
  PACKED[3]: lock time, must be set in units of 8.5 minutes; 0 = infinity

This call requires a connection encrypted with an AdminTicket.  It
calls the AFS system library function 'KAM_SetFields'.

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


=item B<$ok = AFS::KTC_TOKEN-E<gt>SetToken(SERVICE, TOKEN, USER [, FLAGS]);>

Stores the TOKEN for the given principal SERVICE and the given
principal USER in the memory (kernel token cache). Possible Flags are
C<AFS_SETTOK_SETPAG> and C<AFS_SETTOK_LOGON>.  It calls the AFS system
library function 'ktc_SetToken'.

=item B<$ok = AFS::KTC_TOKEN-E<gt>UserAuthenticateGeneral(USER, PASSWORD, LIFE, FLAGS [, PWEXP [, REASON]]);>

Undertakes all necessary steps for a complete authentication of
principal USER.  It converts the string PASSWORD (the cleartext
password) for the principal USER to an encryption key. Then it creates
a TGT token. After that it asks for a service token for service I<AFS>
with a life time of LIFE (in seconds, given in 5 minute intervals).
Finally it saves the service token in the memory (kernel token cache).

Possible values for FLAGS are C<KA_USERAUTH_VERSION> and
C<KA_USERAUTH_DOSETPAG>.  If PWEXP (default -1) is given it returns the
number of days till the password expires.  On error the error message
is returned in REASON. It calls the AFS system library function

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

  }

  print "Convert(nog): ", $pts->id('nog'), "\n";

=head1 DESCRIPTION

This class is used to communicate with the B<AFS Protection Server> in
order to maintain and to administer the Protection Database maintained
by the Protection Server.  The Protection Database stores information
about AFS users, client machines, and groups which the File Server
process uses to determine whether clients are authorized to access AFS
data.

This class provides methods to map back and forth between user account
names and their internal numerical AFS identifiers. It also manages
the creation, manipulation, and update of user-defined groups suitable
for use on ACLs.  It has methods to query the information held for any
given AFS user or group and to create, modify, and delete the records
in the PDB where the above information is held.

Before you can access any PDB records you must establish a connection

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


Creates a new object of the class AFS::PTS.  An AFS::PTS object is
essentially a handle to talk to the Protection Server in a given
CELL.  Internally an AFS::PTS object is a pointer to a ubik_client
structure, although this may change and the value returned from
AFS::PTS::new should always be treaded as an opaque handle.

CELL defaults to NULL.  The security level SEC (default 1) is a number
from 0 to 2:

   0    un-authenticated connection should be made
   1    try authenticated first, fall back to un-authenticated
   2    fail if an authenticated connection can't be made

=item B<DESTRUCTOR>

=item S< >

=item B<$pts-E<gt>DESTROY;>

Destroys the ubik connection to the Protection Server and frees the ubik
connection structure.

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

structure C<prdebugentry>. If LOOKUP_ID is 1 (default) then the AFS 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_DumpEntry'.

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

Returns the I<Current Protection Subdomain> (CPS) for the given PTS
id. The CPS is the closure of all identities that the given NAME can
use. This list includes all the groups NAME belongs to, the special
AFS ids (system:anyuser and system:authuser), as well as the id
itself. 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
be set to a non-zero value and only &AFS::PR_MAXGROUPS items will be
returned.  It calls the AFS system library function 'PR_GetCPS'.

=item B<$id = $pts-E<gt>id($NAME [, ANON]]);>

=item B<@id = $pts-E<gt>id(\@NAME [, ANON]]);>

=item B<$idref = $pts-E<gt>id(\%NAME [, ANON]]);>

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

(default localhost). If VERBOSE (default 0) is set to 1 some program
trace is printed.

=item B<$version = get_syslib_version;>

Reports the version number of the underlying AFS system library.

=item B<$ok = setpag;>

Creates a new command shell (owned by the issuer of the command) and
associates a new process authentication group (PAG) with the shell and
the user. A PAG is a number guaranteed to identify the issuer of
commands in the new shell uniquely to the local Cache Manager.

=item B<$sysname = sysname([NEWSYSNAME]);>

Reports the CPU/operating system type or sets the CPU/operating system
type to NEWSYSNAME.

=item B<unlog;>

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

essentially a handle to talk to the Volume Location Server.
Internally an AFS::VLDB object is a pointer to a ubik_client
structure, although this may change and the value returned from
AFS::VLDB::new should always be treaded as an opaque handle.

Set VERBOSE (default 0) to 1 to produce on the standard output stream
a detailed trace of the method's execution.  TIMEOUT is the time of
inactivity in seconds before the connection to the VLDB server is
declared dead (default 90 seconds).  Set LOCALAUTH (default 0) to 1
only when issuing a command on a server machine.  If NOAUTH is 1
(default 0) it establishes an unauthenticated connection to the
server, in which the servers treat the issuer as an unprivileged user.
CELL (default NULL) specifies the cell in which to run the
command. Set ENCRYPT to 1 (default 0) to encrypt the connection to the
VLDB server.

=item B<DESTRUCTOR>

=item S< >

=item B<$vldb-E<gt>DESTROY;>

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

essentially a handle to talk to the Volume Server.  Internally an
AFS::VOS object is a pointer to a ubik_client structure, although this
may change and the value returned from AFS::VOS::new should always be
treaded as an opaque handle.

Set VERBOSE (default 0) to 1 to produce on the standard output stream
a detailed trace of the method's execution.  TIMEOUT is the time of
inactivity in seconds before the connection to the VOS server is
declared dead (default 90 seconds).  Set LOCALAUTH (default 0) to 1
only when issuing a command on a server machine.  If NOAUTH is 1
(default 0) it establishes an unauthenticated connection to the
server, in which the servers treat the issuer as an unprivileged user.
CELL (default NULL) specifies the cell in which to run the
command. Set ENCRYPT to 1 (default 0) to encrypt the connection to the
VOS server.

=item B<DESTRUCTOR>

=item S< >

=item B<$vos-E<gt>DESTROY;>

src/AFS.xs  view on Meta::CPAN

#undef INIT
#include <afs/stds.h>
#include <afs/afs.h>
#include <afs/vice.h>
#include <afs/venus.h>
#undef VIRTUE
#undef VICE
#include <afs/prs_fs.h>
#include <afs/afsint.h>

#include <afs/auth.h>
#include <afs/cellconfig.h>
#if defined(AFS_3_4)
#else
#include <afs/dirpath.h>
#endif
#include <ubik.h>
#include <rx/rxkad.h>
#include <afs/vldbint.h>
#include <afs/volser.h>
#ifndef RV_RDONLY

src/AFS.xs  view on Meta::CPAN

#define RV_NOCLONE      0x080000
#define RV_NODEL        0x100000
#endif
#include <afs/vlserver.h>
#include <afs/volint.h>
#include <afs/cmd.h>
#include <afs/usd.h>
#include <afs/ptclient.h>
#include <afs/pterror.h>
#include <afs/print.h>
#include <afs/kauth.h>
#include <afs/kautils.h>
#include <afs/bosint.h>
#include <afs/bnode.h>
#include <afs/ktime.h>
#if defined(AFS_OLD_COM_ERR)
#include <com_err.h>
#else
#include <afs/com_err.h>
#endif
#include <des.h>

src/AFS.xs  view on Meta::CPAN

    }
    return 0;
}

#ifdef AFS_PTHREAD_ENV
void IOMGR_Sleep (seconds)
  int seconds;
{
    double i,j;

    croak("DEBUG: IOMGR_Sleep not available ...\nPlease inform the author...");
    j = 0.0;
    i = 1.0/j;
}

void clock_UpdateTime ()
{
    double i,j;

    croak("DEBUG: clock_UpdateTime not available ...\nPlease inform the author..  .");
    j = 0.0;
    i = 1.0/j;
}

int clock_haveCurrentTime ()
{
    double i,j;

    croak("DEBUG: clock_haveCurrentTime not available...\nPlease inform the auth or...");
    j = 0.0;
    i = 1.0/j;
    return 1;
}
#endif /* AFS_PTHREAD_ENV*/

static int32 not_here(s)
    char *s;
{
    croak("%s not implemented on this architecture or under this AFS version", s);
    return -1;
}

int PrintDiagnostics(astring, acode)
    char *astring;
    afs_int32 acode;
{
    if (acode == EACCES) {
        fprintf(STDERR, "You are not authorized to perform the 'vos %s' command (%d)\n",
                astring, acode);
    }
    else {
        fprintf(STDERR, "Error in vos %s command.\n", astring);
        PrintError("", acode);
    }
    return 0;
}
/* end of error handling macros */

src/AFS.xs  view on Meta::CPAN

	return (0);
    n = *set++;
    while (--n)
	if (*set++ == c)
	    return (af);
    return (!af);
}

/* copy taken from <src/ubik/uinit.c> OpenAFS-1.4.14.1 */
static afs_int32
internal_ugen_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 sauth,
	       struct ubik_client **uclientp, int (*secproc) (),
	       char *funcName, afs_int32 gen_rxkad_level,
	       afs_int32 maxservers, char *serviceid, afs_int32 deadtime,
	       afs_uint32 server, afs_uint32 port, afs_int32 usrvid)
{
    afs_int32 code, scIndex, i;
    struct afsconf_cell info;
    struct afsconf_dir *tdir;
    struct ktc_principal sname;
    struct ktc_token ttoken;

src/AFS.xs  view on Meta::CPAN

        if (code) {
            char buffer[256];
            sprintf(buffer, "%s: could not initialize rx.\n", funcName);
            VSETCODE(code, buffer);
            return (code);
        }
        rx_initialized = 1;
    }
    rx_SetRxDeadTime(deadtime);

    if (sauth) {		/* -localauth */
	tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
	if (!tdir) {
            char buffer[256];
            sprintf(buffer,
		    "%s: Could not process files in configuration directory (%s).\n",
		    funcName, AFSDIR_SERVER_ETC_DIRPATH);
	    code = -1;
            VSETCODE(code, buffer);
            return (code);
	}

src/AFS.xs  view on Meta::CPAN

	if (code) {
	    afsconf_Close(tdir);
            char buffer[256];
            sprintf(buffer,
		    "%s: can't find cell %s's hosts in %s/%s\n",
		    funcName, cellName, AFSDIR_SERVER_ETC_DIRPATH,
		    AFSDIR_CELLSERVDB_FILE);
            VSETCODE(code, buffer);
            return (code);
	}
    } else {			/* not -localauth */
	tdir = afsconf_Open(confDir);
	if (!tdir) {
            char buffer[256];
            sprintf(buffer,
		    "%s: Could not process files in configuration directory (%s).\n",
		    funcName, confDir);
	    code = -1;
            VSETCODE(code, buffer);
            return (code);
	}

src/AFS.xs  view on Meta::CPAN


	code = afsconf_GetCellInfo(tdir, cellName, serviceid, &info);
	if (code) {
            char buffer[256];
            sprintf(buffer,
		    "%s: can't find cell %s's hosts in %s/%s\n",
		    funcName, cellName, confDir, AFSDIR_CELLSERVDB_FILE);
            VSETCODE(code, buffer);
            return (code);
	}
	if (noAuthFlag)		/* -noauth */
	    scIndex = 0;
	else {			/* not -noauth */
	    strcpy(sname.cell, info.name);
	    sname.instance[0] = 0;
	    strcpy(sname.name, "afs");
	    code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
	    if (code) {		/* did not get ticket */
		fprintf(stderr,
			"%s: Could not get afs tokens, running unauthenticated.\n",
			funcName);
		scIndex = 0;
	    } else {		/* got a ticket */
		scIndex = 2;
		if ((ttoken.kvno < 0) || (ttoken.kvno > 256)) {
		    fprintf(stderr,
			    "%s: funny kvno (%d) in ticket, proceeding\n",
			    funcName, ttoken.kvno);
		}
	    }

src/AFS.xs  view on Meta::CPAN

		    funcName, scIndex);
	    code = 1;
            VSETCODE(code, buffer);
            return (code);
	    break;
	}
    }

    afsconf_Close(tdir);

    if (secproc)	/* tell UV module about default authentication */
	(*secproc) (sc, scIndex);
    if (server) {
	serverconns[0] = rx_NewConnection(server, port,
					  usrvid, sc, scIndex);
    } else {
	if (info.numServers > maxservers) {
            char buffer[256];
            sprintf(buffer,
		    "%s: info.numServers=%d (> maxservers=%d)\n",
		    funcName, info.numServers, maxservers);

src/AFS.xs  view on Meta::CPAN

            sprintf(buffer, "%s: ubik client init failed.\n", funcName);
            VSETCODE(code, buffer);
            return (code);
	}
    }
    return 0;
}

/* copy taken from <src/volser/vsutils.c> OpenAFS-1.4.14.1 */
static afs_int32
internal_vsu_ClientInit(int noAuthFlag, const char *confDir, char *cellName, afs_int32 sauth,
	       struct ubik_client **uclientp, int (*secproc)())
{
    return internal_ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp,
			   secproc, "internal_vsu_ClientInit", vsu_rxkad_level,
			   VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 90,
			   0, 0, USER_SERVICE_ID);
}
/* end of helper functions for VOS && VLDB class */


/* helper functions for VOS class: */

#ifndef OpenAFS
void vsu_SetCrypt(cryptflag)
    int cryptflag;
{
    if (cryptflag) {
        vsu_rxkad_level = rxkad_crypt;
    }
    else {
        vsu_rxkad_level = rxkad_auth;
    }
}
#endif

int32 GetVolumeInfo(volid, server, part, voltype, rentry)
    afs_int32 volid, *server, *part, *voltype;
    register struct nvldbentry *rentry;
{
    afs_int32 vcode;
    int i, index = -1;

src/AFS.xs  view on Meta::CPAN

        if (!a_xInfoP->updateDate) {
            safe_hv_store(stats, "updateDate", 10, newSVpv("Never", 5), 0);
        }
        else {
            safe_hv_store(stats, "updateDate", 10, newSViv(a_xInfoP->updateDate), 0);
        }

        safe_hv_store(stats, "dayUse", 6, newSViv(a_xInfoP->dayUse), 0);
        safe_hv_store(stat1, "samenet", 7,
                 newSViv(a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET]), 0);
        safe_hv_store(stat1, "samenetauth", 11,
                 newSViv(a_xInfoP->stat_reads[VOLINT_STATS_SAME_NET_AUTH]), 0);
        safe_hv_store(stat1, "diffnet", 7,
                 newSViv(a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET]), 0);
        safe_hv_store(stat1, "diffnetauth", 11,
                 newSViv(a_xInfoP->stat_reads[VOLINT_STATS_DIFF_NET_AUTH]), 0);
        safe_hv_store(stats, "Reads", 5, newRV_inc((SV *) (stat1)), 0);

        safe_hv_store(stat2, "samenet", 7,
                 newSViv(a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET]), 0);
        safe_hv_store(stat2, "samenetauth", 11,
                 newSViv(a_xInfoP->stat_writes[VOLINT_STATS_SAME_NET_AUTH]), 0);
        safe_hv_store(stat2, "diffnet", 7,
                 newSViv(a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET]), 0);
        safe_hv_store(stat2, "diffnetauth", 11,
                 newSViv(a_xInfoP->stat_writes[VOLINT_STATS_DIFF_NET_AUTH]), 0);
        safe_hv_store(stats, "Writes", 6, newRV_inc((SV *) (stat2)), 0);

        safe_hv_store(stat3, "fileSameAuthor", 12,
                 newSViv(a_xInfoP->stat_fileSameAuthor[VOLINT_STATS_TIME_IDX_0]), 0);
        safe_hv_store(stat3, "fileDiffAuthor", 12,
                 newSViv(a_xInfoP->stat_fileDiffAuthor[VOLINT_STATS_TIME_IDX_0]), 0);
        safe_hv_store(stat3, "dirSameAuthor", 11,
                 newSViv(a_xInfoP->stat_dirSameAuthor[VOLINT_STATS_TIME_IDX_0]), 0);
        safe_hv_store(stat3, "dirDiffAuthor", 11,

src/AFS.xs  view on Meta::CPAN

    afs_int32 acode;
{
    if (acode == -1)
        return "communications failure (-1)";
    else if (acode == -3)
        return "communications timeout (-3)";
    else
        return (char *) error_message(acode);
}

static struct rx_connection *internal_bos_new(code, hostname, localauth, noauth, aencrypt,
                                              tname)
    int32 *code;
    char *hostname;
    int localauth;
    int noauth;
    int aencrypt;
    char *tname;
{
    struct hostent *th;
    register struct rx_connection *tconn;
    struct rx_securityClass *sc[3];
    int scIndex;
    afs_int32 addr;
    int encryptLevel;
    struct ktc_principal sname;

src/AFS.xs  view on Meta::CPAN

        char buffer[256];
        sprintf(buffer, "AFS::BOS: can't find address for host '%s'\n", hostname);
        *code = -1;
        BSETCODE(code, buffer);
/*         printf("bos DEBUG-1: %s\n", buffer); */
        return NULL;
    }
    /* Copy(th->h_addr, &addr, sizeof(afs_int32), afs_int32); */
    Copy(th->h_addr, &addr, th->h_length, char);

    /* get tokens for making authenticated connections */
    if (!rx_initialized) {
        /* printf("bos DEBUG rx_Init\n"); */
        *code = rx_Init(0);
        if (*code) {
            char buffer[256];
            sprintf(buffer, "AFS::BOS: could not initialize rx (%d)\n", *code);
            BSETCODE(code, buffer);
/*          printf("bos DEBUG-2\n"); */
            return NULL;
        }

src/AFS.xs  view on Meta::CPAN


    *code = ka_Init(0);
    if (*code) {
        char buffer[256];
        sprintf(buffer, "AFS::BOS: could not initialize ka (%d)\n", *code);
        BSETCODE(code, buffer);
/*          printf("bos DEBUG-3\n"); */
        return NULL;
    }

    if (localauth)
        internal_GetServerConfigDir();
    else
        internal_GetConfigDir();
    /* printf("bos DEBUG-2: %s\n", cdir->name); */

    if (!cdir) {
        *code = errno;
        SETCODE(code);
/*         printf("bos DEBUG-4\n"); */
        return NULL;

src/AFS.xs  view on Meta::CPAN

    }

    strcpy(sname.cell, info.name);
    sname.instance[0] = 0;
    strcpy(sname.name, "afs");
    sc[0] = (struct rx_securityClass *) rxnull_NewClientSecurityObject();
    sc[1] = 0;
    sc[2] = (struct rx_securityClass *) NULL;
    scIndex = 0;

    if (!noauth) {              /* not -noauth */
        if (localauth) {        /* -localauth */
            *code = afsconf_GetLatestKey(cdir, 0, 0);
            if (*code)
                fprintf(stderr, "AFS::BOS %d (getting key from local KeyFile)", *code);
            else {
                if (aencrypt)
                    *code = afsconf_ClientAuthSecure(cdir, &sc[2], &scIndex);
                else
                    *code = afsconf_ClientAuth(cdir, &sc[2], &scIndex);
                if (*code)
                    fprintf(stderr, "AFS::BOS %d (calling ClientAuth)", *code);
                else if (scIndex != 2)  /* this shouldn't happen */
                    sc[scIndex] = sc[2];
            }
        }
        else {                  /* not -localauth, check for tickets */
            *code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
            if (*code == 0) {
                /* have tickets, will travel */
                if (ttoken.kvno >= 0 && ttoken.kvno <= 256);
                else {
                    fprintf(stderr,
                            "AFS::BOS: funny kvno (%d) in ticket, proceeding\n",
                            ttoken.kvno);
                }
                /* kerberos tix */

src/AFS.xs  view on Meta::CPAN

                sc[2] = (struct rx_securityClass *)
                    rxkad_NewClientSecurityObject
                    (encryptLevel, &ttoken.sessionKey,
                     ttoken.kvno, ttoken.ticketLen, ttoken.ticket);
                scIndex = 2;
            }
            else
                fprintf(stderr, "AFS::BOS %d (getting tickets)", *code);
        }
        if ((scIndex == 0) || (sc[scIndex] == 0)) {
            fprintf(stderr, "AFS::BOS: running unauthenticated\n");
            scIndex = 0;
        }
    }
    tconn = rx_NewConnection(addr, htons(AFSCONF_NANNYPORT), 1, sc[scIndex], scIndex);
    if (!tconn) {
        char buffer[256];
        sprintf(buffer, "AFS::BOS: could not create rx connection\n");
        *code = -1;
        BSETCODE(code, buffer);
/*         printf("bos DEBUG-7\n"); */

src/AFS.xs  view on Meta::CPAN


    safe_hv_store(stats, "modification_user", 17, newSVpv(buffer, strlen(buffer)), 0);
    safe_hv_store(stats, "minor_version", 13, newSViv(ka->minor_version), 0);
    safe_hv_store(stats, "flags", 5, newSViv(ka->flags), 0);
    safe_hv_store(stats, "user_expiration", 15, newSViv(ka->user_expiration), 0);
    safe_hv_store(stats, "modification_time", 17, newSViv(ka->modification_time), 0);
    safe_hv_store(stats, "change_password_time", 20, newSViv(ka->change_password_time), 0);
    safe_hv_store(stats, "max_ticket_lifetime", 19, newSViv(ka->max_ticket_lifetime), 0);
    safe_hv_store(stats, "key_version", 11, newSViv(ka->key_version), 0);
    safe_hv_store(stats, "keyCheckSum", 11, newSVuv(ka->keyCheckSum), 0);
    safe_hv_store(stats, "misc_auth_bytes", 15, newSVuv(ka->misc_auth_bytes), 0);
    safe_hv_store(stats, "passwd_reuse", 12, newSViv(ka->reserved3), 0);
    /*               1234567890123456789012345 */
    return 1;
}

static int parse_ka_getstats(stats, dstats, kas, kad)
    HV *stats;
    HV *dstats;
    struct kasstats *kas;
    struct kadstats *kad;

src/AFS.xs  view on Meta::CPAN

    PPCODE:
    {
        EXTEND(sp,1);
        PUSHs(sv_2mortal(newSVpv((char*)k,sizeof(*k))));
    }


MODULE = AFS     PACKAGE = AFS::VOS       PREFIX = vos_

AFS::VOS
vos_new(class=0, verb=Nullsv, timeout=Nullsv, noauth=Nullsv, localauth=Nullsv, tcell=NULL, crypt=Nullsv)
        char * class
        SV *   verb
        SV *   timeout
        SV *   noauth
        SV *   localauth
        char * tcell
        SV *   crypt
    PREINIT:
        int32 code;
        extern int verbose;
        int itimeout, inoauth, ilocalauth, icrypt;

    PPCODE:
    {
        if (!verb) {
            verb = newSViv(0);
        }
        if (!timeout) {
            timeout = newSViv(90);
        }
        if (!noauth) {
            noauth = newSViv(0);
        }
        if (!localauth) {
            localauth = newSViv(0);
        }
        if (!crypt) {
            crypt = newSViv(0);
        }
        if (tcell && (tcell[0] == '\0' || tcell[0] == '0'))
            tcell = NULL;
        if ((verb) && (!SvIOKp(verb))) {
            char buffer[256];
            sprintf(buffer, "Flag \"verb\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);

src/AFS.xs  view on Meta::CPAN

        verbose = SvIV(verb);

        if ((timeout) && (!SvIOKp(timeout))) {
            char buffer[256];
            sprintf(buffer, "Flag \"timeout\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        itimeout = SvIV(timeout);

        if ((noauth) && (!SvIOKp(noauth))) {
            char buffer[256];
            sprintf(buffer, "Flag \"noauth\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        inoauth = SvIV(noauth);

        if ((localauth) && (!SvIOKp(localauth))) {
            char buffer[256];
            sprintf(buffer, "Flag \"localauth\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        ilocalauth = SvIV(localauth);

        if ((crypt) && (!SvIOKp(crypt))) {
            char buffer[256];
            sprintf(buffer, "Flag \"crypt\" should be numeric.\n");
            VSETCODE(EINVAL, buffer);
            XSRETURN_UNDEF;
        }
        icrypt = SvIV(crypt);

                /* Initialize the ubik_client connection */
        rx_SetRxDeadTime(itimeout);      /* timeout seconds inactivity before declared dead */

        cstruct = (struct ubik_client *) 0;

        if (icrypt)                      /* -crypt specified */
            vsu_SetCrypt(1);
        code = internal_vsu_ClientInit((inoauth != 0),
                                       AFSDIR_CLIENT_ETC_DIRPATH, tcell, ilocalauth,
                                       &cstruct, UV_SetSecurity);
        if (code == 0) {
            ST(0) = sv_newmortal();
            sv_setref_pv(ST(0), "AFS::VOS", (void *) cstruct);
            XSRETURN(1);
        }
        else {
            XSRETURN_UNDEF;
        }
    } 

src/AFS.xs  view on Meta::CPAN


        SETCODE(0);
        ST(0) = sv_2mortal(newRV_inc((SV *) volinfo));
        XSRETURN(1);
    }


MODULE = AFS     PACKAGE = AFS::VLDB       PREFIX = vldb_

AFS::VLDB
vldb_new(class=0, verb=0, timeout=90, noauth=0, localauth=0, tcell=NULL, crypt=0)
        char *  class
        int     verb
        int     timeout
        int     noauth
        int     localauth
        char *  tcell
        int     crypt
    PREINIT:
        int32 code = -1;
        extern int verbose;
    PPCODE:
    {
        if (tcell && (tcell[0] == '\0' || tcell[0] == '0'))
            tcell = NULL;

                /* Initialize the ubik_client connection */
        rx_SetRxDeadTime(timeout);      /* timeout seconds inactivity before declared dead */
        cstruct = (struct ubik_client *) 0;
        verbose = verb;
        if (crypt)                      /* -crypt specified */
            vsu_SetCrypt(1);
        code = internal_vsu_ClientInit((noauth != 0),
                                       AFSDIR_CLIENT_ETC_DIRPATH, tcell, localauth,
                                       &cstruct, UV_SetSecurity);
        if (code == 0) {
            ST(0) = sv_newmortal();
            sv_setref_pv(ST(0), "AFS::VLDB", (void *) cstruct);
            XSRETURN(1);
        }
        else
            XSRETURN_UNDEF;
    }

src/AFS.xs  view on Meta::CPAN

        done:
        ;
    }
    OUTPUT:
        RETVAL


MODULE = AFS            PACKAGE = AFS::BOS      PREFIX = bos_

AFS::BOS
bos_new(class=0, servname, noauth=0, localauth=0, cell=0, aencrypt=1)
        char *  class
        char *servname
        int noauth
        int localauth
        char *cell
        int aencrypt
    PREINIT:
        int32 code = -1;
        AFS__BOS server;
    PPCODE:
    {
        /* printf("bos new DEBUG-1 \n"); */
        if (cell && (cell[0] == '\0' || cell[0] == '0'))
            cell = NULL;

        /* printf("bos new call internal_new DEBUG-2 \n"); */
        server = internal_bos_new(&code, servname, localauth, noauth, aencrypt, cell);
            /* SETCODE(code); */
        /* printf("bos new return internal_new DEBUG-3 \n"); */

        if (code == 0) {
            ST(0) = sv_newmortal();
            sv_setref_pv(ST(0), "AFS::BOS", (void *) server);
            XSRETURN(1);
        }
        else
            XSRETURN_UNDEF;

src/AFS.xs  view on Meta::CPAN


        ST(0) = sv_2mortal(newRV_inc((SV *) status));
        SETCODE(0);
        XSRETURN(1);

        done:
        ;
  }

int32
bos_setauth(self, tp)
        AFS::BOS self
        char *tp
    PREINIT:
        int32 code = 0;
        int32 flag;
    CODE: 
    {
        not_here("AFS::BOS::setauth");

        RETVAL = 42;
        if (strcmp(tp, "on") == 0)
            flag = 0;                   /* auth req.: noauthflag is false */
        else if (strcmp(tp, "off") == 0)
            flag = 1;
        else {
            char buffer[256];
            sprintf(buffer,
                    "AFS::BOS: illegal authentication specifier '%s', must be 'off' or 'on'.\n",
                    tp);
            BSETCODE(-1, buffer);
            RETVAL = 0;
        }

        if (RETVAL == 42) {
            code = BOZO_SetNoAuthFlag(self, flag);
            if (code) {
                char buffer[256];
                sprintf(buffer, "AFS::BOS %d (failed to set authentication flag)", code);
                BSETCODE(code, buffer);
            }
            SETCODE(code);
            RETVAL = (code == 0);
        }
    }
    OUTPUT:
        RETVAL

int32

src/AFS.xs  view on Meta::CPAN

        RETVAL = (code == 0);
#else
        RETVAL = 0;
        not_here("AFS::BOS::setrestricted");
#endif
    }
    OUTPUT:
        RETVAL

int32
bos_salvage(self, partition=NULL, volume=NULL, all=0, outName=NULL, showlog=0, parallel=NULL, tmpDir=NULL, orphans=NULL, localauth=0, tmpname=NULL, debug=0, nowrite=0, force=0, oktozap=0, rootfiles=0, salvagedirs=0, blockreads=0, ListResidencies=0, S...
        AFS::BOS self
        char *partition
        char *volume
        int32 all
        char *outName
        int32 showlog
        char *parallel
        char *tmpDir
        char *orphans
        int32 localauth
        char *tmpname
        int32 debug
        int32 nowrite
        int32 force
        int32 oktozap
        int32 rootfiles
        int32 salvagedirs
        int32 blockreads
        int32 ListResidencies
        int32 SalvageRemote

src/AFS.xs  view on Meta::CPAN

                goto done;
            }
        }
        else {
            /* salvage individual volume (don't shutdown fs first), just use
             * single-shot cron bnode.  Must leave server running when using this
             * option, since salvager will ask file server for the volume */
            afs_int32 err;
            const char *confdir;

            confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
            code = internal_vsu_ClientInit( /* noauth */ 1, confdir, tmpname,
                                  /* server auth */ 0, &cstruct, (int (*)()) 0);
            if (code == 0) {
                newID = vsu_GetVolumeID(volume, cstruct, &err);
                if (newID == 0) {
                    char buffer[256];
                    sprintf(buffer, "AFS::BOS: can't interpret %s as volume name or ID\n",
                            volume);
                    BSETCODE(-1, buffer);
                    goto done;
                }
                sprintf(tname, "%u", newID);

src/AFS.xs  view on Meta::CPAN

        sv_setiv(ST(3), (IV) count);
        SETCODE(code);
        if (code == 0 && count >= 0) {
            EXTEND(sp, 2);
            PUSHs(sv_2mortal(newSVpv(ki.name, strlen(ki.name))));
            PUSHs(sv_2mortal(newSVpv(ki.instance, strlen(ki.instance))));
        }
    }

void
kas_KAM_SetFields(server,name,instance,flags,user_expire,max_ticket_life, maxAssoc, misc_auth_bytes, spare2=0)
        AFS::KAS        server
        char *  name
        char *  instance
        int32   flags
        int32   user_expire
        int32   max_ticket_life
        int32   maxAssoc
        uint32  misc_auth_bytes
        int32   spare2
    PPCODE:
    {
        int32 code;

        #  tpf nog 03/29/99
        #  wrong argument list: max_ticket_life was missing
        #       code = ubik_Call(KAM_SetFields, server, 0, name, instance,
        #               flags, user_expire, maxAssoc, spare1,spare2);
        code = ubik_Call(KAM_SetFields, server, 0, name, instance,
                         flags, user_expire, max_ticket_life, maxAssoc, misc_auth_bytes, spare2);
        SETCODE(code);
        EXTEND(sp, 1);
        PUSHs(sv_2mortal(newSViv(code == 0)));
    }

void
kas_ka_ChangePassword(server,name,instance,oldkey,newkey)
        AFS::KAS        server
        char *  name
        char *  instance

src/AFS.xs  view on Meta::CPAN

    {
        int32 code;

        code = ka_ChangePassword(name, instance, server, oldkey, newkey);
        SETCODE(code);
        EXTEND(sp, 1);
        PUSHs(sv_2mortal(newSViv(code == 0)));
    }

void
kas_ka_GetToken(server,name,instance,start,end,auth_token,auth_domain="")
        AFS::KAS        server
        char *  name
        char *  instance
        int32   start
        int32   end
        AFS::KTC_TOKEN  auth_token
        char *  auth_domain
    PPCODE:
    {
        int32 code;
        struct ktc_token *t;
#if defined(AFS_3_4)
#else
        char *cname = NULL;
        char *cinst = NULL;
        char *cell = NULL;
#endif

        t = (struct ktc_token *) safemalloc(sizeof(struct ktc_token));
#if defined(AFS_3_4)
        code = ka_GetToken(name, instance, server, start, end, auth_token, auth_domain, t);
#else
        if (cell == 0) {
            cell = internal_GetLocalCell(&code);
            if (code)
                XSRETURN_UNDEF;
        }
        code = ka_GetToken(name, instance, cell, cname, cinst, server,
                           start, end, auth_token, auth_domain, t);
#endif
        if (code == 0) {
            SV *st;
            EXTEND(sp, 1);
            st = sv_newmortal();
            sv_setref_pv(st, "AFS::KTC_TOKEN", (void *) t);
            PUSHs(st);
            XSRETURN(1);
        }
        else {

src/BOS/t/BOS.t  view on Meta::CPAN

can_ok('AFS::BOS', qw(getrestricted));
can_ok('AFS::BOS', qw(listkeys));
can_ok('AFS::BOS', qw(prune));
$bos->removehost(\%h);
like($AFS::CODE, qr/HOST not an array reference/, 'bos->removehost(HASH)');

$host = 'z';
$bos->removehost($host);
SKIP: {
	skip "You lack rights for this test", 1 
		if $AFS::CODE =~ /you are not authorized for this operation/;
	like($AFS::CODE, qr/no such entity/, 'bos->removehost(unknown host)');
}
can_ok('AFS::BOS', qw(removekey));

$bos->removeuser(\%h);
like($AFS::CODE, qr/USER not an array reference/, 'bos->removeuser(HASH)');

my $user = 'z';
$bos->removeuser($user);
SKIP: {
	skip "You lack rights for this test", 1 
		if $AFS::CODE =~ /you are not authorized for this operation/;
	like($AFS::CODE, qr/no such user/, 'bos->removeuser(unknown user)');
}

can_ok('AFS::BOS', qw(restart_bos));
can_ok('AFS::BOS', qw(restart_all));
can_ok('AFS::BOS', qw(restart));
can_ok('AFS::BOS', qw(setauth));
can_ok('AFS::BOS', qw(setrestricted));
can_ok('AFS::BOS', qw(shutdown));
can_ok('AFS::BOS', qw(start));
can_ok('AFS::BOS', qw(startup));
can_ok('AFS::BOS', qw(stop));

$bos->DESTROY;
ok(! defined $bos, 'bos->DESTROY');

sub leak_test {

src/Makefile.PL  view on Meta::CPAN


if ($Config{usethreads}) {
    # use the threaded version of the AFS libraries for threaded Perl...
    $libs = join (" ", qw(
                          -lbos
                          -lvolser
                          -lvldb
                          -lcmd
                          -lusd
                          -laudit
                          -lc -lafsauthent -lc
                          -lc -lafsrpc -lc
                          -lutil
                         )
                 );
    $p_flag = '-DAFS_PTHREAD_ENV';
}
else {
    # use the unthreaded version of the AFS libraries for unthreaded Perl...
    $libs = join (" ", qw(
                          -lkauth
                          -lprot
                          -lbos
                          -lrx
                          -lvolser
                          -lvldb

                          -lcmd
                          -lubik
                          -lauth

                          -lrxkad
                          -lrxstat
                          -lrx

                          -lsys
                          -ldes
                          -llwp
                          -lcom_err
                          -lutil

src/Makefile.PL  view on Meta::CPAN

#    warn "\nAFS modules on AMD Opteron platforms are currently not supported ...\n";
#    if ($ENV{AUTOMATED_TESTING}) { exit 0; }
#    die "Script terminated ...\n";
#}
elsif ($Config{usethreads} and $v_string !~ /openafs/) {
    warn "\nAFS modules (Threaded Perl) in conjunction with Transarc/IBM AFS is not supported ...\n";
    if ($ENV{AUTOMATED_TESTING}) { exit 0; }
    die "Script terminated ...\n";
}
elsif ($Config{usethreads} and $alpha_sys =~ /amd64_linux2/) {
    if (! -e "$AFSPath/lib/libafsauthent_pic.a" or ! -e "$AFSPath/lib/libafsrpc_pic.a") {
        warn "\nAFS system libraries libafsrpc and/or libafsauthent (PIC) not found ...\n";
        if ($ENV{AUTOMATED_TESTING}) { exit 0; }
        die "Script terminated ...\n";
    }
}
elsif ($Config{usethreads} and $alpha_sys =~ /rs_aix4/) {
    warn "\nAFS modules (Threaded Perl) on AIX platforms are currently not supported ...\n";
    if ($ENV{AUTOMATED_TESTING}) { exit 0; }
    die "Script terminated ...\n";
}

src/Makefile.PL  view on Meta::CPAN


# change the library name of the AFS system library "-lafsrpc"
if ($alpha_sys =~ /linux/ && $alpha_sys !~ /i386_linux2/) {
    $command = "\'s#-lc -lafsrpc -lc#$AFSPath/lib/libafsrpc_pic.a#g\'";
}
else {
    $command = "\'s#-lc -lafsrpc -lc#$AFSPath/lib/libafsrpc.a#g\'";
}
system("perl -p -i.bak -e $command Makefile");

# change the library name of the AFS system library "-lafsauthent"
if ($alpha_sys =~ /linux/ && $alpha_sys !~ /i386_linux2/) {
    $command = "\'s#-lc -lafsauthent -lc#$AFSPath/lib/libafsauthent_pic.a#g\'";
}
else {
    $command = "\'s#-lc -lafsauthent -lc#$AFSPath/lib/libafsauthent.a#g\'";
}
system("perl -p -i.bak -e $command Makefile");

# make changes to the typemap file if Perl < 5.6.0
$command = "\'s#T_UV#T_IV#\'";
system("perl -p -i.bak -e $command typemap") unless $] >= 5.006;

src/VLDB/t/VLDB.t  view on Meta::CPAN

    if (AFS::FS::isafs('./')) { plan tests => 56; }
    else { plan skip_all => 'Working directory is not in AFS file system ...'; }

    use_ok('AFS::VLDB');
}

my $vldb = AFS::VLDB->new;
is(ref($vldb), 'AFS::VLDB', 'vldb->new()');
undef $vldb;

# vldb->new(verbose=0, timeout=90, noauth=0, localauth=0, tcell=NULL, crypt=0)
$vldb = AFS::VLDB->new(0, 90, 0, 0, 'xyz');
like($AFS::CODE, qr/can\'t find cell/, 'vldb->new(0 90 0 0 no_cell)');

$vldb = AFS::VLDB->new(0, 90, 0, 0, '');
is(ref($vldb), 'AFS::VLDB', 'vldb->new(0 90 0 0 no_cell)');
undef $vldb;

is(leak_test(), 1210, 'vldb leak_test');

$vldb = AFS::VLDB->new;

src/VOS/t/VOS.t  view on Meta::CPAN

use Test::More;

BEGIN {
    use AFS::FS;
    if (AFS::FS::isafs('./')) { plan tests => 61; }
    else { plan skip_all => 'Working directory is not in AFS file system ...'; }

    use_ok('AFS::VOS');
}

# vos->new(verbose=0, timeout=90, noauth=0, localauth=0, tcell=NULL, crypt=0)
my $vos = AFS::VOS->new('no_verb');
like($AFS::CODE, qr/Flag "verb" should be numeric/, 'vos->new(no_verb)');
$vos = AFS::VOS->new(0, 'no_timeout');
like($AFS::CODE, qr/Flag "timeout" should be numeric/, 'vos->new(0 no_timeout)');
$vos = AFS::VOS->new(0, 90, 'no_auth');
like($AFS::CODE, qr/Flag "noauth" should be numeric/, 'vos->new(0 90 no_auth)');
$vos = AFS::VOS->new(0, 90, 0, 'no_localauth');
like($AFS::CODE, qr/Flag "localauth" should be numeric/, 'vos->new(0 90 0 no_localauth)');
$vos = AFS::VOS->new(0, 90, 0, 0, 'xyz');
like($AFS::CODE, qr/can\'t find cell/, 'vos->new(0 90 0 0 no_cell)');
$vos = AFS::VOS->new(0, 90, 0, 0, '', 'no_crypt');
like($AFS::CODE, qr/Flag "crypt" should be numeric/, 'vos->new(0 90 0 0 empty_cell no_crypt)');
$vos = AFS::VOS->new;
is(ref($vos), 'AFS::VOS', 'vos->new()');
undef $vos;
$vos = AFS::VOS->new(0, 90, 0, 0, '');
is(ref($vos), 'AFS::VOS', 'vos->new(0 90 0 0 empty_cell)');
undef $vos;

src/inc/Test/Builder.pm  view on Meta::CPAN

    _whoa($Curr_Test != @Test_Results,
          'Somehow you got a different number of results than tests ran!');
}


sub _whoa {
    my($check, $desc) = @_;
    if( $check ) {
        die <<WHOA;
WHOA!  $desc
This should never happen!  Please contact the author immediately!
WHOA
    }
}


sub _my_exit {
    $? = $_[0];

    return 1;
}

src/inc/Test/More.pm  view on Meta::CPAN

        my $rslt = eval { $object->isa($class) };
        if( $@ ) {
            if( $@ =~ /^Can't call method "isa" on unblessed reference/ ) {
                if( !UNIVERSAL::isa($object, $class) ) {
                    my $ref = ref $object;
                    $diag = "$obj_name isn't a '$class' it's a '$ref'";
                }
            } else {
                die <<WHOA;
WHOA! I tried to call ->isa on your object and got some weird error.
This should never happen.  Please contact the author immediately.
Here's the error.
$@
WHOA
            }
        }
        elsif( !$rslt ) {
            my $ref = ref $object;
            $diag = "$obj_name isn't a '$class' it's a '$ref'";
        }
    }

src/t/pod.t  view on Meta::CPAN

use strict;

use lib qw(../../inc ../inc ./inc);

use Test::More;

plan skip_all => "This test is only run for the module author"
  unless -d '.svn' || $ENV{IS_MAINTAINER};

eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;

my @poddirs = qw(../blib);
all_pod_files_ok(Test::Pod::all_pod_files(@poddirs));



( run in 3.656 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )