Permalink
Browse files

Switch to dzil

  • Loading branch information...
1 parent 8d89087 commit 5d23a3586b5408a33c2358dad946221564b5a799 Jonathan Steinert committed Apr 1, 2012
Showing with 95 additions and 56 deletions.
  1. +0 −1 .gitignore
  2. +3 −0 Changes
  3. +0 −23 MANIFEST
  4. +3 −0 MANIFEST.SKIP
  5. +0 −5 README
  6. +23 −0 dist.ini
  7. +41 −23 Makefile.PL → inc/PAMMakeMaker.pm
  8. +13 −4 lib/PAM.pm
  9. +6 −0 lib/PAM/Constants.pm
  10. +6 −0 lib/PAM/Handle.pm
View
@@ -1,7 +1,6 @@
blib/
const-c.inc
const-xs.inc
-inc/
MANIFEST.bak
Makefile
Makefile.old
View
@@ -1,3 +1,6 @@
+ -- dzil fixed build environment from last build, META files were out of date.
+ -- Switch to dzil
+
0.30
-- Make it actually compile and work on OSX
-- Make constants problems show up at compile time
View
@@ -1,23 +0,0 @@
-Changes
-compat.h
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-lib/PAM.pm
-lib/PAM/Constants.pm
-lib/PAM/Handle.pm
-Makefile.PL
-MANIFEST This list of files
-META.yml
-PAM.xs
-pam_perl.c
-perl_helper.h
-perl_helper.c
-ppport.h
-README
-typemap
View
@@ -0,0 +1,3 @@
+inc/PAMMakeMaker.pm
+MANIFEST.SKIP
+dist.ini
View
5 README
@@ -1,5 +0,0 @@
-This PAM module is available under the same terms as perl itself.
-
-I would however point out that you shouldn't use it as-is right now, many return codes and inputs are not checked for validity and safety.
-
-It compiles, it works... but I don't trust it yet.
View
@@ -0,0 +1,23 @@
+name = PAM
+version = 0.30
+author = Jonathan Steinert <hachi@cpan.org>
+license = Perl_5
+copyright_holder = Jonathan Steinert
+
+[@Filter]
+ -bundle = @Classic
+ -remove = MakeMaker
+
+[=inc::PAMMakeMaker / PAMMakeMaker]
+
+[Prereqs / ConfigureRequires ]
+ExtUtils::Depends = 0
+XS::Object::Magic = 0
+
+[Prereqs / BuildRequires ]
+ExtUtils::Constant = 0
+ExtUtils::Embed = 0
+XS::Object::Magic = 0
+
+[Prereqs / RuntimeRequires ]
+XS::Object::Magic = 0
@@ -1,32 +1,48 @@
-use inc::Module::Install;
-use ExtUtils::Depends;
+package inc::PAMMakeMaker;
-# Define metadata
-name 'PAM';
-all_from 'lib/PAM.pm';
+use strict;
+use warnings;
-requires 'ExtUtils::Constant' => 0;
-requires 'ExtUtils::Embed' => 0;
-requires 'ExtUtils::Depends' => 0;
-requires 'XS::Object::Magic' => 0;
+use Moose;
-my $pkg = ExtUtils::Depends->new('PAM', 'XS::Object::Magic');
+extends 'Dist::Zilla::Plugin::MakeMaker::Awesome';
-makemaker_args(
- $pkg->get_makefile_vars,
- depend => { 'PAM.c' => 'const-xs.inc', '$(OBJECT)' => 'const-c.inc' },
+override _build_WriteMakefile_args => sub { +{
+ %{ super() },
LIBS => [ '-lpam' ],
-);
+ clean => { FILES => "perlxsi.c perlxsi.o perl_helper.o perl_helper.so pam_perl.o pam_perl.so const-c.inc const-xs.inc" },
+} };
-my $pam_lib_dir = "/lib/security/";
+override _build_WriteMakefile_dump => sub {
+ return super() . <<'EOT';
-$pam_lib_dir = "/usr/lib/pam" if $^O eq 'darwin';
+use ExtUtils::Depends;
+my $pkg = ExtUtils::Depends->new('PAM', 'XS::Object::Magic');
-preamble(<<"EOT");
-PAM_LIB_DIR = $pam_lib_dir
+%WriteMakefileArgs = ($pkg->get_makefile_vars, %WriteMakefileArgs);
EOT
+};
+
+override _build_MakeFile_PL_template => sub {
+ my ($self) = @_;
+ my $template = super();
+
+ $template .= <<'TEMPLATE';
+package MY;
-postamble(<<'EOT');
+sub depend {
+ return <<'EOT';
+PAM.c : const-xs.inc
+$(OBJECT) : const-c.inc
+EOT
+}
+
+sub postamble {
+ my $pam_lib_dir = "/lib/security/";
+
+ $pam_lib_dir = "/usr/lib/pam" if $^O eq 'darwin';
+
+ return "PAM_LIB_DIR = $pam_lib_dir\n" . <<'EOT'
CCOPTS = $(shell $(PERLRUN) -MExtUtils::Embed -e ccopts)
LDOPTS = $(shell $(PERLRUN) -MExtUtils::Embed -e ldopts)
@@ -55,15 +71,17 @@ pam-install: pam_perl.so perl_helper.so
const-xs.inc const-c.inc :: pm_to_blib
$(PERLRUN) -MExtUtils::Constant=WriteConstants -Mblib -MPAM::Constants \
- -e 'WriteConstants(NAME => "PAM", NAMES => [ map { { name => $$_, macro => 1 } } @PAM::Constants::EXPORT_OK ])'
+ -e 'WriteConstants(NAME => "PAM", NAMES => [ map { { name => $$_, macro => 1 } } @PAM::Constants::EXPORT_OK ])'
all :: pam
install :: pam-install
-
EOT
+}
+TEMPLATE
-clean_files(qw(perlxsi.c perlxsi.o perl_helper.o perl_helper.so pam_perl.o pam_perl.so const-c.inc const-xs.inc));
+ return $template;
+};
-WriteAll;
+__PACKAGE__->meta->make_immutable;
View
@@ -25,19 +25,28 @@ This Perl and PAM module allow you to invoke a perl interpreter and call package
methods during pam phases. It also includes bindings for most of the pam functions
and constants.
+=head1 STATUS
+
+Most of the interface is working at this point. I expect to be compatible at this
+point with both Linux PAM and OSX (Darwin) PAM. The major functions in pam_*
+should all be working. Some of the pam_{get,set}_item items are not implemented yet.
+
+I wouldn't call this module secure just yet. I will mark version 1.0 when I feel
+that is the case.
+
+This all said, the module is safe enough to be used. It should be cleaning up all
+memory that it consumes and barring mistakes in the perl code it invokes there
+should be no chance of it causing unexpected failures.
+
=cut
require 5.008001;
use parent qw(DynaLoader);
-our $VERSION = '0.30';
-
sub dl_load_flags {0x01}
__PACKAGE__->bootstrap($VERSION);
-$VERSION = eval $VERSION;
-
1;
=head1 COPYRIGHT
View
@@ -1,5 +1,11 @@
package PAM::Constants;
+=head1 NAME
+
+PAM::Constants - Module to import constants for use with PAM
+
+=cut
+
use strict;
use warnings;
View
@@ -1,5 +1,11 @@
package PAM::Handle;
+=head1 NAME
+
+PAM::Handle - Perl representation of pam_handle_t object
+
+=cut
+
use PAM;
1;

0 comments on commit 5d23a35

Please sign in to comment.