r41444 - in /branches/upstream/libauthen-krb5-simple-perl/current: CONFIG Changes META.yml Makefile.PL README Simple.xs lib/Authen/Krb5/Simple.pm t/01-compile.t t/02-ops.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Fri Aug 7 01:39:58 UTC 2009
Author: jawnsy-guest
Date: Fri Aug 7 01:39:52 2009
New Revision: 41444
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=41444
Log:
[svn-upgrade] Integrating new upstream version, libauthen-krb5-simple-perl (0.42)
Modified:
branches/upstream/libauthen-krb5-simple-perl/current/CONFIG
branches/upstream/libauthen-krb5-simple-perl/current/Changes
branches/upstream/libauthen-krb5-simple-perl/current/META.yml
branches/upstream/libauthen-krb5-simple-perl/current/Makefile.PL
branches/upstream/libauthen-krb5-simple-perl/current/README
branches/upstream/libauthen-krb5-simple-perl/current/Simple.xs
branches/upstream/libauthen-krb5-simple-perl/current/lib/Authen/Krb5/Simple.pm
branches/upstream/libauthen-krb5-simple-perl/current/t/01-compile.t
branches/upstream/libauthen-krb5-simple-perl/current/t/02-ops.t
Modified: branches/upstream/libauthen-krb5-simple-perl/current/CONFIG
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/CONFIG?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/CONFIG (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/CONFIG Fri Aug 7 01:39:52 2009
@@ -1,4 +1,3 @@
-# $Id: CONFIG,v 1.1.1.1 2003-01-19 20:33:34 dstuart Exp $
###############################################################################
#
# File: CONFIG
@@ -16,7 +15,7 @@
# Note: TEST_REALM is optional. If omitted, the default realm for the
# local system will be used.
#
-# ** If you use these amek sure the realm and user exist and the password
+# ** If you use these make sure the realm and user exist and the password
# is correct. Otherwise, the test will fail.
#
#TEST_REALM TESTREALM.COM
Modified: branches/upstream/libauthen-krb5-simple-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/Changes?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/Changes (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/Changes Fri Aug 7 01:39:52 2009
@@ -1,4 +1,12 @@
Revision history for Perl extension Authen::Krb5::Simple.
+
+0.42 Mon Aug 03 23:41 2009
+ - Changed handling of null/empty passwords.
+ - Added internal (non-krb) error message handling.
+ - Added null/empty password tests.
+ - Updated tests to use Test::More.
+ - Minor code refactoring.
+ - Updated docs.
0.40 Sun Feb 24 18:35:42 2008
- Added the Devel::CheckLib.
Modified: branches/upstream/libauthen-krb5-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/META.yml?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/META.yml (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/META.yml Fri Aug 7 01:39:52 2009
@@ -1,10 +1,14 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Authen-Krb5-Simple
-version: 0.40
-version_from: lib/Authen/Krb5/Simple.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+--- #YAML:1.0
+name: Authen-Krb5-Simple
+version: 0.42
+abstract: Perl module that performs Kerberos 5 authentication
+license: ~
+author:
+ - Damien S. Stuart <dstuart at dstuart.org>
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
+ Test::More:
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Modified: branches/upstream/libauthen-krb5-simple-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/Makefile.PL?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/Makefile.PL (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/Makefile.PL Fri Aug 7 01:39:52 2009
@@ -1,4 +1,3 @@
-# $Id: Makefile.PL,v 1.2 2005-02-21 23:49:42 dstuart Exp $
###############################################################################
#
# File: Makefile.PL
@@ -56,23 +55,25 @@
# locations for these libs.
#
check_lib_or_exit(
- lib => [qw( krb5 k5crypto com_err )],
+ lib => [qw( krb5 )],
libpath => \@kr_lib_dirs
-);
+) unless($ENV{skip_lib_check});
# Write out the Makefile
#
WriteMakefile(
'NAME' => 'Authen::Krb5::Simple',
'VERSION_FROM' => 'lib/Authen/Krb5/Simple.pm',
- 'PREREQ_PM' => {},
+ 'PREREQ_PM' => {
+ 'Test::More',
+ },
($] >= 5.006
? (
ABSTRACT => 'Perl module that performs Kerberos 5 authentication',
AUTHOR => 'Damien S. Stuart <dstuart at dstuart.org>')
: ()
),
- 'LIBS' => ["$krb5_lib -lkrb5 -lk5crypto"],
+ 'LIBS' => ["$krb5_lib -lkrb5"],
'DEFINE' => '',
'INC' => $krb5_inc,
);
Modified: branches/upstream/libauthen-krb5-simple-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/README?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/README (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/README Fri Aug 7 01:39:52 2009
@@ -1,4 +1,4 @@
-Authen::Krb5::Simple version 0.32
+Authen::Krb5::Simple version 0.42
===============================================================================
The Authen::Krb5::Simple module provides a means to authenticate a
@@ -30,9 +30,18 @@
Note: In the absence of the KRB5_INCLUDE and KRB4LIB environment variables
mentioned above, the module will make an attempt to try and find
- out the location of the Kerberos 5 include and lib files. If that
- doesn't work, you will need to manually override by setting the
- environment variables or editing Makfile.PL to directly.
+ out the location of the Kerberos 5 include and lib files.
+
+ If you continue to get "Can't build and link to 'xxx'" errors from
+ the "perl Makefile.PL" command. you can try setting the skip_lib_check
+ environment variable to skip the lib check (this was necessary on some
+ FreeBSD systems that had conflicting libkrb5.so files). For example:
+
+ skip_lib_check=1 perl Makefile.PL
+
+ If that doesn't work, you will need to manually override by setting
+ the environment variables (if not already set) or editing Makfile.PL
+ to directly.
DEPENDENCIES
@@ -43,7 +52,7 @@
COPYRIGHT AND LICENCE
-Copyright (c) 2003-2008 Damien S. Stuart. All rights reserved.
+Copyright (c) 2003-2009 Damien S. Stuart. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Modified: branches/upstream/libauthen-krb5-simple-perl/current/Simple.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/Simple.xs?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/Simple.xs (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/Simple.xs Fri Aug 7 01:39:52 2009
@@ -1,37 +1,34 @@
-/* $Id: Simple.xs,v 1.1.1.1 2003-01-19 20:33:34 dstuart Exp $
-*******************************************************************************
-**
-** File: Simple.xs
-**
-** Author: Damien S. Stuart
-**
-** Purpose: .xs file for the Authen::Krb5::Simple Perl module.
-**
-**
-*******************************************************************************
+/*
+ ******************************************************************************
+ *
+ * File: Simple.xs
+ *
+ * Author: Damien S. Stuart
+ *
+ * Purpose: .xs file for the Authen::Krb5::Simple Perl module.
+ *
+ *
+ ******************************************************************************
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
-#include <stdio.h>
-#include <strings.h>
-
#include <krb5.h>
int _krb5_auth(char* user, char* pass)
{
- int krbret;
- krb5_context ctx;
- krb5_creds creds;
- krb5_principal princ;
+ int krbret;
+ krb5_context ctx;
+ krb5_creds creds;
+ krb5_principal princ;
- int ret = 0;
+ int ret = 0;
/* Initialize krb5 context...
*/
if ((krbret = krb5_init_context(&ctx))) {
- return krbret;
+ return krbret;
}
memset(&creds, 0, sizeof(krb5_creds));
@@ -39,29 +36,27 @@
/* Get principal name...
*/
if ((krbret = krb5_parse_name(ctx, user, &princ))) {
- ret = krbret;
- goto cleanup2;
+ ret = krbret;
+ goto free_context;
}
/* Check the user's pasword...
*/
if ((krbret = krb5_get_init_creds_password(
ctx, &creds, princ, pass, 0, NULL, 0, NULL, NULL))) {
- ret = krbret;
- goto cleanup;
+ ret = krbret;
}
-cleanup:
krb5_free_cred_contents(ctx, &creds);
krb5_free_principal(ctx, princ);
-cleanup2:
+free_context:
krb5_free_context(ctx);
return(ret);
}
-MODULE = Authen::Krb5::Simple PACKAGE = Authen::Krb5::Simple
+MODULE = Authen::Krb5::Simple PACKAGE = Authen::Krb5::Simple
PROTOTYPES: DISABLE
@@ -85,3 +80,4 @@
RETVAL = result;
OUTPUT:
RETVAL
+
Modified: branches/upstream/libauthen-krb5-simple-perl/current/lib/Authen/Krb5/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/lib/Authen/Krb5/Simple.pm?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/lib/Authen/Krb5/Simple.pm (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/lib/Authen/Krb5/Simple.pm Fri Aug 7 01:39:52 2009
@@ -1,4 +1,3 @@
-# $Id: Simple.pm,v 1.6 2005-02-21 23:50:37 dstuart Exp $
###############################################################################
#
# File: Simple.pm
@@ -21,7 +20,7 @@
our @ISA = qw(DynaLoader);
-our $VERSION = '0.40';
+our $VERSION = '0.42';
bootstrap Authen::Krb5::Simple $VERSION;
@@ -44,10 +43,11 @@
my $user = shift || croak "Missing arg: username\n";
my $pw = shift;
- croak "Missing arg: password\n" unless(defined($pw));
-
- if($pw eq '') {
- carp "Empty passwords are not supported.\n";
+ if(!defined($pw) or $pw eq '') {
+ # Codes staring with 'e' are internal to this module.
+ #
+ $self->{_err_code} = 'e1';
+
return 0;
}
@@ -58,12 +58,23 @@
$user .= "\@$self->{_realm}";
}
- return(($self->{_err_code} = krb5_auth($user, $pw)) == 0);
+ $self->{_err_code} = krb5_auth($user, $pw);
+
+ return(($self->{_err_code} == 0) ? 1 : 0);
}
# Return the error string from the most recent authenticate function.
#
sub errstr {
+ # Check for module internal (non-krb) error. If it is return the
+ # appropriate error string (there is only one at present).
+ #
+ if($_[0]->{_err_code} =~ /^e(\d+)/) {
+ return('Null or empty password not supported') if($1 == 1);
+ }
+
+ # Otherwise, let krb5_errstr tell us...
+ #
return ($_[0]->{_err_code} == 0) ? '' : krb5_errstr($_[0]->{_err_code});
}
@@ -132,8 +143,8 @@
to allow perl scripts to perform authentication against a Microsoft Active
Directory (AD) server configured to accept Kerberos client requests.
-B<It is important to note:> This module only performs simple authentication. It
-does not get, grant, use, or retain any kerberos tickets. It will check
+B<It is important to note:> This module only performs simple authentication.
+It does not get, grant, use, or retain any kerberos tickets. It will check
user credentials against the Kerberos server (as configured on the local
system) each time the I<authenticate> method is called.
@@ -184,12 +195,14 @@
=back
-B<realm([NEW.REALM])>
+B<realm( )>
+
+B<realm(NEW.REALM)>
=over
The I<realm> method is used to set or get the current default realm. If an
-argument is passed to this method, the default realm is set to its value. If
+argument is passed to this method, the default realm is set to that value. If
no argument is supplied, the current realm is returned.
=back
@@ -215,14 +228,14 @@
=head1 BUGS
-This version of I<Authen::Krb5::Simple> does not support empty passwords.
-If you pass an empty string (C<''>) as a password, I<authenticate> will print
-a warning and return false, but there will be no error code or string returned
-if the I<errstr> method is called.
+This version of I<Authen::Krb5::Simple> does not support null or
+empty passwords. If you pass an undefined value or empty string (C<''>)
+as a password, I<authenticate> return false and set the error to indicate
+that null or empty passwords are not supported.
=head1 AUTHOR
-Damien S. Stuart, E<lt>damien.stuart at usi.netE<gt>
+Damien S. Stuart, E<lt>dstuart at dstuart.orgE<gt>
=head1 SEE ALSO
Modified: branches/upstream/libauthen-krb5-simple-perl/current/t/01-compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/t/01-compile.t?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/t/01-compile.t (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/t/01-compile.t Fri Aug 7 01:39:52 2009
@@ -1,4 +1,3 @@
-# $Id: 01-compile.t,v 1.1.1.1 2003-01-19 20:33:34 dstuart Exp $
###############################################################################
# Authen::Krb5::Simple Test Script
#
@@ -8,16 +7,19 @@
#
###############################################################################
#
-my $loaded;
+use Test::More tests => 3;
-BEGIN { print "1..1\n" }
+# 1 - Use test.
+#
+BEGIN { use_ok('Authen::Krb5::Simple') }
-use Authen::Krb5::Simple;
+# 2 - Require test.
+#
+require_ok( Authen::Krb5::Simple );
-$loaded++;
-
-print "ok 1\n";
-
-END { print "not ok 1\n" unless $loaded }
+# 3 - Is what we is.
+#
+my $krb = Authen::Krb5::Simple->new();
+isa_ok( $krb, 'Authen::Krb5::Simple');
###EOF###
Modified: branches/upstream/libauthen-krb5-simple-perl/current/t/02-ops.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauthen-krb5-simple-perl/current/t/02-ops.t?rev=41444&op=diff
==============================================================================
--- branches/upstream/libauthen-krb5-simple-perl/current/t/02-ops.t (original)
+++ branches/upstream/libauthen-krb5-simple-perl/current/t/02-ops.t Fri Aug 7 01:39:52 2009
@@ -1,4 +1,3 @@
-# $Id: 02-ops.t,v 1.1.1.1 2003-01-19 20:33:34 dstuart Exp $
###############################################################################
# Authen::Krb5::Simple Test Script
#
@@ -9,12 +8,8 @@
###############################################################################
#
use strict;
-
-use Test;
-
+use Test::More tests => 16;
use Authen::Krb5::Simple;
-
-BEGIN { plan tests => 10 };
# Get test user params (if any)
#
@@ -22,73 +17,94 @@
my $krb = Authen::Krb5::Simple->new();
-# Valid object.
+# (1) Valid object.
#
-ok(ref($krb) =~ /Authen::Krb5::Simple/);
+isa_ok($krb, 'Authen::Krb5::Simple', 'Valid object check');
-my $verbose = $ENV{verbose} || 0;
-
+my $errcode;
+my $errstr;
my $ret;
-# Good pw
+# (2-7) Good pw
#
-if(defined($tdata->{user}) and defined($tdata->{password})) {
+my $no_user_data = (!defined($tdata->{user}) and !defined($tdata->{password}));
+
+SKIP: {
+ skip "No user/password data provided", 6 if($no_user_data);
+
my $tuser = $tdata->{user};
my $tpass = $tdata->{password};
$tuser .= "\@$tdata->{realm}" if(defined($tdata->{realm}));
- $ret = $krb->authenticate($tuser, $tpass);
-
- my $errcode = $krb->errcode();
- my $errstr = $krb->errstr();
-
- print STDERR "\nGPW RET: $ret (code=$errcode, str=$errstr)\n" if($verbose);
-
- ok($ret);
-
- # Valid error conditions
- ok($errcode == 0);
- ok($errstr eq '');
-
- # Now munge the pw and make sure we get the expected responses
- #
- $ret = $krb->authenticate($tuser, "x$tpass");
+ $ret = $krb->authenticate($tuser, $tpass) unless($no_user_data);
$errcode = $krb->errcode();
$errstr = $krb->errstr();
- print STDERR "\nGPW2 RET: $ret (code=$errcode, str=$errstr)\n" if($verbose);
+ ok($ret, 'Good username and password authentication');
- ok(!$ret);
+ # Valid error conditions
+ #
+ ok($errcode == 0, "Error code 0 check: Got '$errcode'");
+ ok($errstr eq '', "Error string empty check: Got '$errstr'");
- ok($errcode != 0);
- ok($errstr ne '');
+ # Now munge the pw and make sure we get the expected responses
+ #
+ $ret = $krb->authenticate($tuser, "x$tpass") unless($no_user_data);
-} else {
- skip(1,'Skipped good auth');
- skip(1,'Skipped good auth errcode');
- skip(1,'Skipped good auth errstr');
- skip(1,'Skipped bad auth');
- skip(1,'Skipped bad auth errcode');
- skip(1,'Skipped bad auth errstr');
+ $errcode = $krb->errcode();
+ $errstr = $krb->errstr();
+
+ ok(!$ret, "Return value 'true' check: Got '$ret'");
+
+ ok($errcode != 0, "Non-zero error code check: Got '$errcode'");
+ ok($errstr ne '', "Non-empty error string check: Got '$errstr'");
}
-# Bad user and pw
+# (8-13) Null and Empty password
+#
+$ret = $krb->authenticate('_not_a_user_');
+ok($ret==0, "Null password returns 0 check: Got '$ret'");
+
+$errcode = $krb->errcode();
+$errstr = $krb->errstr();
+
+ok($errcode eq 'e1', "Null password error code of 'e1' check: Got '$errcode'");
+ok($errstr =~ /Null or empty password not supported/,
+ "Null password error string check: Got '$errstr'");
+
+$ret = $krb->authenticate('_not_a_user_', '');
+ok($ret==0, "Empty password should return 0: Got '$ret'");
+
+$errcode = $krb->errcode();
+$errstr = $krb->errstr();
+
+ok($errcode eq 'e1', "Empty password error code of 'e1' check: Got '$errcode'");
+ok($errstr =~ /Null or empty password not supported/,
+ "Null password error string check: Got '$errstr'");
+
+# (14) Bad user and pw
#
$ret = $krb->authenticate('_xxx', '_xxx');
-print STDERR "\nBPW RET: $ret\n" if($verbose);
-ok($ret == 0);
+ok($ret == 0, "Bad user and PW Check returns '0': Got '$ret'");
-# Valid error conditions
-ok($krb->errcode() != 0);
-ok($krb->errstr());
+$errcode = $krb->errcode();
+$errstr = $krb->errstr();
+
+# (15-16) Valid error conditions
+#
+ok($errcode != 0, "Bad user and PW check non-zero error code: Got '$errcode'");
+ok($errstr, "Bad user and PW error string check");
+
+### End of Tests ###
sub get_test_data {
my %tdata;
- unless(open(CONF, "<CONFIG")) {
- print STDERR "\nUnable to read CONFIG file: $!\nSkipping user auth tests\n";
+ unless(open(CONF, "< CONFIG")) {
+ diag("** Unable to read CONFIG file: $!");
+ diag("** Skipping user auth tests");
return undef;
}
More information about the Pkg-perl-cvs-commits
mailing list