summaryrefslogtreecommitdiff
path: root/perl/t/keytab.t
diff options
context:
space:
mode:
Diffstat (limited to 'perl/t/keytab.t')
-rwxr-xr-xperl/t/keytab.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/perl/t/keytab.t b/perl/t/keytab.t
index 2d19845..0dd6bc3 100755
--- a/perl/t/keytab.t
+++ b/perl/t/keytab.t
@@ -9,7 +9,7 @@
# See LICENSE for licensing terms.
use POSIX qw(strftime);
-use Test::More tests => 204;
+use Test::More tests => 217;
use Wallet::Config;
use Wallet::Object::Keytab;
@@ -199,6 +199,18 @@ my $dbh = $server->dbh;
my $history = '';
my $date = strftime ('%Y-%m-%d %H:%M:%S', localtime $trace[2]);
+# Do some white-box testing of the principal validation regex.
+for my $bad (qw{service\* = host/foo+bar host/foo/bar /bar bar/
+ rcmd.foo}) {
+ ok (! Wallet::Object::Keytab->valid_principal ($bad),
+ "Invalid principal name $bad");
+}
+for my $good (qw{service service/foo bar foo/bar host/example.org
+ aservice/foo}) {
+ ok (Wallet::Object::Keytab->valid_principal ($good),
+ "Valid principal name $good");
+}
+
# Basic keytab creation and manipulation tests.
SKIP: {
skip 'no keytab configuration', 49 unless -f 't/data/test.keytab';