diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-09-30 23:05:11 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-09-30 23:05:11 (GMT) |
commit | 6f1943313a0e503189dd9685483a9ecd1bd7cc6e (patch) | |
tree | 7461bd743125feb61a7f977a06e7698bb184d333 /utils/update-rd-tokens | |
parent | 88ba274e7841fedffe9ef98b0933c0610ac6997c (diff) |
introduced rhrd context
Diffstat (limited to 'utils/update-rd-tokens')
-rwxr-xr-x | utils/update-rd-tokens | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/update-rd-tokens b/utils/update-rd-tokens index 8983b17..4004e5d 100755 --- a/utils/update-rd-tokens +++ b/utils/update-rd-tokens @@ -39,9 +39,9 @@ my %EXCLUDED_USERS = map { $_ => 1 } @ARGV; $EXCLUDED_USERS{'admin'} = 1; my $ret = 0; -my ($dbh, undef, $errorstring) = RHRD::rddb::opendb(); -if(defined $dbh) { - my @users = RHRD::rddb::list_users($dbh); +my ($ctx, undef, $errorstring) = RHRD::rddb::init(); +if(defined $ctx) { + my @users = RHRD::rddb::list_users($ctx); if(!defined $users[0] && defined $users[2]) { print STDERR "$users[2]\n"; $ret = 1; @@ -49,12 +49,12 @@ if(defined $dbh) { foreach my $user (@users) { next if(exists($EXCLUDED_USERS{$user})); my $token = mkpasswd(-length => 16, -minnum => 3, -minupper => 3, -minspecial => 0); - RHRD::rddb::set_token($dbh, $user, $token); + RHRD::rddb::set_token($ctx, $user, $token); print "$user -> $token\n"; } } - RHRD::rddb::closedb($dbh); + RHRD::rddb::destroy($ctx); } else { print STDERR "$errorstring\n"; $ret = 1; |