AFS-PAG

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

# Create the directory that will be used for config.h and stub files.
remove_tree('glue');
mkdir('glue');

# Write out the config.h file and get the list of files to add to the build.
my @c_files = config_kafs($build);

# We can't just add the C source files directly to the build for a couple of
# reasons.  First, Perl ships its own config.h, so we need to be sure we
# include our own instead of Perl's before building any source, since all of
# the files (copied from rra-c-util, so we don't want to change them) include
# config.h as the first action.  Second, Module::Build can only handle one
# directory of supplemental source files.
#
# We deal with both of these issues by creating stub files in a subdirectory
# named glue that include glue/config.h and then the actual C source file.
for my $file (@c_files) {
    my $glue_file = File::Spec->catfile('glue', basename($file));
    open(my $wrapper, '>', $glue_file);
    say {$wrapper} '#include <glue/config.h>'
      or die "Cannot write to $glue_file: $!\n";

kafs/kafs.c  view on Meta::CPAN

#elif defined(HAVE_KAFS_SOLARIS)
# include <kafs/sys-solaris.c>
#elif defined(HAVE_KAFS_SYSCALL)
# include <kafs/sys-syscall.c>
#else
# error "Unknown AFS system call implementation"
#endif

/*
 * On some platforms, k_hasafs needs to try a system call.  This attempt may
 * fail with SIGSYS.  We therefore set a signal handler that changes a static
 * variable if SIGSYS is received.
 *
 * It's really ugly to do this in library or PAM module in so many ways.
 * Static variables are evil, changing signal handlers out from under an
 * application is evil, and the interaction of signals and threads is probably
 * nasty.  The only things that make this better is that this case will never
 * be triggered in the normal case of AFS being loaded and the only time that
 * we change this static variable is to say that the call failed, so there
 * shouldn't be a collision of updates from multiple calls.
 *
 * It's probably safe to just ignore SIGSYS instead, but this feels more
 * thorough.
 */
static volatile sig_atomic_t syscall_okay = 1;


/*
 * Signal handler to catch failed system calls and change the okay flag.
 */
#ifdef SIGSYS
static void
sigsys_handler(int s UNUSED)
{
    syscall_okay = 0;
    signal(SIGSYS, sigsys_handler);
}
#endif /* SIGSYS */

portable/kafs.h  view on Meta::CPAN


/* Default to a hidden visibility for all portability functions. */
#pragma GCC visibility push(hidden)

int k_hasafs(void);
int k_haspag(void);
int k_pioctl(char *, int, struct ViceIoctl *, int);
int k_setpag(void);
int k_unlog(void);

/* Undo default visibility change. */
#pragma GCC visibility pop

/* We have no kafs implementation available. */
#else
# undef HAVE_KAFS
# define k_hasafs()           (0)
# define k_haspag()           (0)
# define k_pioctl(p, c, a, f) (errno = ENOSYS, -1)
# define k_setpag()           (errno = ENOSYS, -1)
# define k_unlog()            (errno = ENOSYS, -1)

t/data/perlcriticrc  view on Meta::CPAN

# This sounds interesting but is actually useless.  Any large blocks of
# literal text, which does not add to the complexity of the regex, will set it
# off.
[-RegularExpressions::ProhibitComplexRegexes]

# I generally don't want to require Readonly as a prerequisite for all my Perl
# modules.
[-ValuesAndExpressions::ProhibitConstantPragma]

# A good idea, but there are too many places where this would be more
# confusing than helpful.  Pull out numbers if one might change them
# independent of the algorithm, but don't do so for mathematical formulae.
[-ValuesAndExpressions::ProhibitMagicNumbers]

# Increase this to six digits so that I'm not told to add underscores to
# port numbers (which is just silly).
[ValuesAndExpressions::RequireNumberSeparators]
min_value = 100000

# Text::Wrap has a broken interface that requires use of package variables.
[Variables::ProhibitPackageVars]

t/pag/isolation.t  view on Meta::CPAN

#!/usr/bin/perl
#
# Test that creating a PAG isolates token changes from the caller
#
# Written by Russ Allbery <rra@cpan.org>
# Copyright 2013
#     The Board of Trustees of the Leland Stanford Junior University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the



( run in 0.489 second using v1.01-cache-2.11-cpan-c333fce770f )