r41446 - in /trunk/libauthen-krb5-simple-perl: CONFIG Changes META.yml Makefile.PL README Simple.xs debian/changelog debian/compat debian/control debian/copyright debian/rules 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:57:54 UTC 2009


Author: jawnsy-guest
Date: Fri Aug  7 01:57:45 2009
New Revision: 41446

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=41446
Log:
* New upstream release
  + Added internal error message handling
  + Check for null/empty passwords
* Updated to machine-readable copyright file
* Bumped compat/debhelper dependency to 7
* Use new short debhelper rules format
* Standards-Version 3.8.2 (no changes)
* Added myself to Copyright and Uploaders

Modified:
    trunk/libauthen-krb5-simple-perl/CONFIG
    trunk/libauthen-krb5-simple-perl/Changes
    trunk/libauthen-krb5-simple-perl/META.yml
    trunk/libauthen-krb5-simple-perl/Makefile.PL
    trunk/libauthen-krb5-simple-perl/README
    trunk/libauthen-krb5-simple-perl/Simple.xs
    trunk/libauthen-krb5-simple-perl/debian/changelog
    trunk/libauthen-krb5-simple-perl/debian/compat
    trunk/libauthen-krb5-simple-perl/debian/control
    trunk/libauthen-krb5-simple-perl/debian/copyright
    trunk/libauthen-krb5-simple-perl/debian/rules
    trunk/libauthen-krb5-simple-perl/lib/Authen/Krb5/Simple.pm
    trunk/libauthen-krb5-simple-perl/t/01-compile.t
    trunk/libauthen-krb5-simple-perl/t/02-ops.t

Modified: trunk/libauthen-krb5-simple-perl/CONFIG
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/CONFIG?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/CONFIG (original)
+++ trunk/libauthen-krb5-simple-perl/CONFIG Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/Changes?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/Changes (original)
+++ trunk/libauthen-krb5-simple-perl/Changes Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/META.yml?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/META.yml (original)
+++ trunk/libauthen-krb5-simple-perl/META.yml Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/Makefile.PL?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/Makefile.PL (original)
+++ trunk/libauthen-krb5-simple-perl/Makefile.PL Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/README?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/README (original)
+++ trunk/libauthen-krb5-simple-perl/README Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/Simple.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/Simple.xs?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/Simple.xs (original)
+++ trunk/libauthen-krb5-simple-perl/Simple.xs Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/debian/changelog?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/debian/changelog (original)
+++ trunk/libauthen-krb5-simple-perl/debian/changelog Fri Aug  7 01:57:45 2009
@@ -1,4 +1,14 @@
-libauthen-krb5-simple-perl (0.40-2) UNRELEASED; urgency=low
+libauthen-krb5-simple-perl (0.42-1) UNRELEASED; urgency=low
+
+  [ Jonathan Yu ]
+  * New upstream release
+    + Added internal error message handling
+    + Check for null/empty passwords
+  * Updated to machine-readable copyright file
+  * Bumped compat/debhelper dependency to 7
+  * Use new short debhelper rules format
+  * Standards-Version 3.8.2 (no changes)
+  * Added myself to Copyright and Uploaders
 
   [ gregor herrmann ]
   * debian/control: Changed: Switched Vcs-Browser field to ViewSVN
@@ -10,7 +20,7 @@
   [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
 
- -- gregor herrmann <gregoa at debian.org>  Sun, 16 Nov 2008 20:39:45 +0100
+ -- Jonathan Yu <frequency at cpan.org>  Thu, 06 Aug 2009 17:42:07 -0400
 
 libauthen-krb5-simple-perl (0.40-1) unstable; urgency=low
 

Modified: trunk/libauthen-krb5-simple-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/debian/compat?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/debian/compat (original)
+++ trunk/libauthen-krb5-simple-perl/debian/compat Fri Aug  7 01:57:45 2009
@@ -1,1 +1,1 @@
-6
+7

Modified: trunk/libauthen-krb5-simple-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/debian/control?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/debian/control (original)
+++ trunk/libauthen-krb5-simple-perl/debian/control Fri Aug  7 01:57:45 2009
@@ -1,10 +1,11 @@
 Source: libauthen-krb5-simple-perl
 Section: perl
 Priority: optional
+Build-Depends: debhelper (>= 7), perl (>= 5.6.0-16), libkrb5-dev 
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Damyan Ivanov <dmn at debian.org>, Xavier Oswald <x.oswald at free.fr>
-Build-Depends: debhelper (>= 6), perl (>= 5.6.0-16), libkrb5-dev 
-Standards-Version: 3.7.3
+Uploaders: Damyan Ivanov <dmn at debian.org>, Xavier Oswald <xoswald at debian.org>,
+ Jonathan Yu <frequency at cpan.org>
+Standards-Version: 3.8.2
 Homepage: http://search.cpan.org/dist/Authen-Krb5-Simple/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libauthen-krb5-simple-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/
@@ -12,7 +13,7 @@
 Package: libauthen-krb5-simple-perl
 Architecture: any
 Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
-Description: Authenticate a user/password using Kerberos 5
- The Authen::Krb5::Simple module provides a means to authenticate a 
- user/password using Kerberos 5. Simply use this module and call its 
- authenticate function with a username (or user at KRB_REALM) and a password.
+Description: Perl module for authentication using Kerberos 5
+ Authen::Krb5::Simple is a Perl module that provides a way to authenticate a
+ username/password combination using Kerberos 5. Simply use this module and
+ call its authentication function (or user at KRB_REALM) and a password.

Modified: trunk/libauthen-krb5-simple-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/debian/copyright?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/debian/copyright (original)
+++ trunk/libauthen-krb5-simple-perl/debian/copyright Fri Aug  7 01:57:45 2009
@@ -1,23 +1,35 @@
-This package was debianized by Xavier Oswald <x.oswald at free.fr> on
-Thu,  8 Feb 2007 19:57:25 +0100.
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Maintainer: Damien Stuart <dstuart at dstuart.org>
+Upstream-Source: http://search.cpan.org/dist/Authen-Krb5-Simple/
+Upstream-Name: Authen-Krb5-Simple
 
-It was downloaded from: http://search.cpan.org/~dstuart/Authen-Krb5-Simple-0.32/ 
+Files: *
+Copyright: 2003-2009, Damien S. Stuart <dstuart at dstuart.org>
+License-Alias: Perl
+License: Artistic | GPL-1+
 
-Upstream Author: Damien S. Stuart, <damien.stuart at usi.net>
+Files: debian/*
+Copyright: 2009, Jonathan Yu <frequency at cpan.org>
+ 2008, Damyan Ivanov <dmn at debian.org>
+ 2007-2008, Xavier Oswald <xoswald at debian.org>
+License: Artistic | GPL-1+
 
-Copyright: Copyright (c) 2003 Damien S. Stuart. All rights reserved.
+Files: inc/Devel/CheckLib.pm
+Copyright: 2007, David Cantrell <david at cantrell.org.uk>
+ 2007, David Golden <dagolden at cpan.org>
+License: Artistic | GPL-1+
 
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
+License: Artistic
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Artistic License, which comes with Perl.
+    On Debian GNU/Linux systems, the complete text of the Artistic License
+    can be found in `/usr/share/common-licenses/Artistic'
 
-License:
-
-    a) the GNU General Public License as published by the Free Software
-       Foundation; either version 1, or (at your option) any later
-       version, or
-
-    b) the "Artistic License" which comes with Perl.
-
+License: GPL-1+
+    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 1, or (at your option)
+    any later version.
     On Debian GNU/Linux systems, the complete text of the GNU General
-    Public License can be found in /usr/share/common-licenses/GPL' and
-    the Artistic Licence in /usr/share/common-licenses/Artistic'.
+    Public License can be found in `/usr/share/common-licenses/GPL'

Modified: trunk/libauthen-krb5-simple-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/debian/rules?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/debian/rules (original)
+++ trunk/libauthen-krb5-simple-perl/debian/rules Fri Aug  7 01:57:45 2009
@@ -1,59 +1,4 @@
 #!/usr/bin/make -f
 
-PACKAGE=$(shell dh_listpackages)
-TMP = $(CURDIR)/debian/$(PACKAGE)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-CFLAGS = -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-    CFLAGS += -O0
-else
-    CFLAGS += -O2
-endif
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-	$(PERL) Makefile.PL INSTALLDIRS=vendor
-	$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH="" 
-	touch $@
-
-install: install-stamp
-install-stamp: build-stamp
-	dh_testdir
-	dh_testroot
-	$(MAKE) test
-	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-	[ ! -d $(TMP)/usr/share/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/share/perl5
-	touch $@
-
-clean:
-	dh_testdir
-	dh_testroot
-	[ ! -f Makefile ] || $(MAKE) realclean
-	dh_clean build-stamp install-stamp
-
-binary-indep: build install
-
-binary: binary-indep binary-arch
-
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs README
-	dh_installchangelogs Changes
-	dh_compress
-	dh_fixperms
-	dh_strip
-	dh_installdeb
-	dh_perl
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: binary clean ibinary-indep binary-arch build clean install
+%:
+	dh $@

Modified: trunk/libauthen-krb5-simple-perl/lib/Authen/Krb5/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/lib/Authen/Krb5/Simple.pm?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/lib/Authen/Krb5/Simple.pm (original)
+++ trunk/libauthen-krb5-simple-perl/lib/Authen/Krb5/Simple.pm Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/t/01-compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/t/01-compile.t?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/t/01-compile.t (original)
+++ trunk/libauthen-krb5-simple-perl/t/01-compile.t Fri Aug  7 01:57:45 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: trunk/libauthen-krb5-simple-perl/t/02-ops.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-krb5-simple-perl/t/02-ops.t?rev=41446&op=diff
==============================================================================
--- trunk/libauthen-krb5-simple-perl/t/02-ops.t (original)
+++ trunk/libauthen-krb5-simple-perl/t/02-ops.t Fri Aug  7 01:57:45 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