summaryrefslogtreecommitdiff
path: root/perl/lib
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-16 16:32:07 -0700
committerRuss Allbery <eagle@eyrie.org>2014-07-16 16:32:07 -0700
commit6b4fbafa3edd99045b8eba896dd8642aa6bd6113 (patch)
tree79124a4bccc49a0b8bf3e2b5189b0e7b18a635ee /perl/lib
parente4adb8cde42b91110c2d283aa3712f89afc78ead (diff)
parent27f4e81ddb42440345e6dd01a4943cb57ee5da39 (diff)
Merge tag 'upstream/1.1' into debian
Upstream version 1.1
Diffstat (limited to 'perl/lib')
-rw-r--r--perl/lib/Wallet/Admin.pm18
-rw-r--r--perl/lib/Wallet/Object/Duo.pm4
2 files changed, 6 insertions, 16 deletions
diff --git a/perl/lib/Wallet/Admin.pm b/perl/lib/Wallet/Admin.pm
index 8481979..33e2a7d 100644
--- a/perl/lib/Wallet/Admin.pm
+++ b/perl/lib/Wallet/Admin.pm
@@ -98,20 +98,10 @@ sub initialize {
$self->default_data;
# Create a default admin ACL.
- eval {
- my $guard = $self->{schema}->txn_scope_guard;
- $self->{schema}->resultset ('Acl')->populate ([
- [ qw/ac_id ac_name/ ],
- [ 1, 'ADMIN' ],
- ]);
- $self->{schema}->resultset ('AclEntry')->populate ([
- [ qw/ae_id ae_scheme ae_identifier/ ],
- [ 1, 'krb5', $user ],
- ]);
- $guard->commit;
- };
- if ($@) {
- $self->error ("cannot add ADMIN ACL: $@");
+ my $schema = $self->{schema};
+ my $acl = Wallet::ACL->create ('ADMIN', $schema, $user, 'localhost');
+ unless ($acl->add ('krb5', $user, $user, 'localhost')) {
+ $self->error ($acl->error);
return;
}
return 1;
diff --git a/perl/lib/Wallet/Object/Duo.pm b/perl/lib/Wallet/Object/Duo.pm
index e3fe2da..6edc4fa 100644
--- a/perl/lib/Wallet/Object/Duo.pm
+++ b/perl/lib/Wallet/Object/Duo.pm
@@ -105,7 +105,7 @@ sub create {
# Create the object in Duo.
require Net::Duo::Admin::Integration;
my %data = (
- name => $name,
+ name => "$name ($Wallet::Config::DUO_TYPE)",
notes => 'Managed by wallet',
type => $Wallet::Config::DUO_TYPE,
);
@@ -190,7 +190,7 @@ sub get {
# We also need the admin server name, which we can get from the Duo object
# configuration with a bit of JSON decoding.
- my $json = JSON->new->utf8 (1);
+ my $json = JSON->new->utf8 (1)->relaxed (1);
my $config = $json->decode (scalar slurp $Wallet::Config::DUO_KEY_FILE);
# Construct the returned file.