Server IP : 195.201.23.43 / Your IP : 18.190.219.146 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/usermin/gnupg/ |
Upload File : |
#!/usr/bin/perl # Change a key's trust level, add an email address, or set the passphrase require './gnupg-lib.pl'; &ReadParse(); @keys = &list_keys(); $key = $keys[$in{'idx'}]; ($del) = grep { /^delete_(\d+)$/ } keys %in; if ($in{'add'}) { # Add an owner &error_setup($text{'owner_err1'}); $in{'name'} =~ /\S/ || &error($text{'owner_ename'}); if ($in{'name'} =~ s/\((.*)\)\s*$//) { $cmt = $1; $in{'name'} =~ s/\s+$//; } $cmd = "$gpgpath --edit-key \"$key->{'name'}->[0]\""; ($fh, $fpid) = &foreign_call("proc", "pty_process_exec", $cmd); &wait_for($fh, "command>"); syswrite($fh, "adduid\n"); &wait_for($fh, "name:"); syswrite($fh, "$in{'name'}\n"); &wait_for($fh, "address:"); syswrite($fh, "$in{'email'}\n"); &wait_for($fh, "comment:"); syswrite($fh, "$cmt\n"); &wait_for($fh, "\\?"); syswrite($fh, "o\n"); $rv = &wait_for($fh, "command>", "passphrase:"); if ($rv == 1) { $pass = &get_passphrase($key); syswrite($fh, $pass."\n"); &wait_for($fh, "command>"); } syswrite($fh, "quit\n"); if (&wait_for($fh, "save changes") == 0) { syswrite($fh, "y\n"); } sleep(1); close($fh); &redirect("edit_key.cgi?idx=$in{'idx'}"); } elsif ($del =~ /^delete_(\d+)$/) { # Remove an owner $main::wait_for_debug = 1; $delidx = $1; &error_setup($text{'owner_err2'}); if (@{$key->{'name'}} == 1) { &error($text{'owner_elast'}); } $cmd = "$gpgpath --edit-key \"$key->{'name'}->[0]\""; ($fh, $fpid) = &foreign_call("proc", "pty_process_exec", $cmd); local %keymap; while(1) { local $rv = &wait_for($fh, "command>", '\\((\d+)\\)[\\. ]+(.*)\\n'); last if ($rv == 0); $matches[2] =~ s/<.*$//; $matches[2] =~ s/\s+$//; $keymap{$matches[2]} = $matches[1]; } local $idx = $keymap{$key->{'name'}->[$delidx]}; syswrite($fh, "uid $idx\n"); &wait_for($fh, "command>"); syswrite($fh, "deluid\n"); &wait_for($fh, "\\?"); syswrite($fh, "y\n"); $rv = &wait_for($fh, "command>", "passphrase:"); if ($rv == 1) { $pass = &get_passphrase($key); syswrite($fh, $pass."\n"); &wait_for($fh, "command>"); } syswrite($fh, "quit\n"); if (&wait_for($fh, "save changes") == 0) { syswrite($fh, "y\n"); } sleep(1); close($fh); &redirect("edit_key.cgi?idx=$in{'idx'}"); } elsif ($key->{'secret'}) { # Set passphrase &put_passphrase($in{'pass'}, $keys[$in{'idx'}]); &redirect("list_keys.cgi"); } else { # Set trust level $in{'trust'} || &error($text{'trust_echoice'}); &ui_print_header(undef, $text{'trust_title'}, ""); $cmd = "$gpgpath --edit-key \"$key->{'name'}->[0]\""; ($fh, $fpid) = &foreign_call("proc", "pty_process_exec", $cmd); &wait_for($fh, "command>"); syswrite($fh, "trust\n"); &wait_for($fh, "decision"); syswrite($fh, $in{'trust'}."\n"); syswrite($fh, "quit\n"); sleep(1); close($fh); print &text('trust_done', "<tt>$key->{'name'}->[0]</tt>"),"<p>\n"; } &ui_print_footer("list_keys.cgi", $text{'keys_return'}, "", $text{'index_return'});Private