diff options
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; |