This is an automated email from the ASF dual-hosted git repository.
gstein pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git
The following commit(s) were added to refs/heads/trunk by this push:
new be3831f remove v1 code
be3831f is described below
commit be3831f0695450195004a6a08c9a6028d6a0fbfd
Author: Greg Stein <[email protected]>
AuthorDate: Sat May 21 05:26:50 2022 -0400
remove v1 code
---
cmdline/Makefile | 90 -------
cmdline/check_quorum.pl | 146 -----------
cmdline/close_issue.pl | 157 ------------
cmdline/make_issue.pl | 495 ------------------------------------
cmdline/make_issue.py | 333 ------------------------
cmdline/reminder.pl | 238 -----------------
cmdline/steve.conf | 24 --
cmdline/steve.pm | 255 -------------------
cmdline/templates/explain.ezt | 77 ------
cmdline/templates/info-header.ezt | 23 --
cmdline/templates/monitor-email.ezt | 59 -----
cmdline/vote.pl | 292 ---------------------
cmdline/votegroup.pl | 176 -------------
cmdline/votegroup.py | 149 -----------
cmdline/wrapsuid.c | 42 ---
lib/steve.py | 181 -------------
16 files changed, 2737 deletions(-)
diff --git a/cmdline/Makefile b/cmdline/Makefile
deleted file mode 100644
index 9148965..0000000
--- a/cmdline/Makefile
+++ /dev/null
@@ -1,90 +0,0 @@
-CC = gcc
-INSTALLBIN = /home/voter/bin
-SUIDS = -DTARGET_UID=509 -DTARGET_GID=509
-
-all: votegroup make_issue vote close_issue reminder check_quorum
-
-votegroup: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/votegroup.pl\" $(SUIDS) \
- -o votegroup wrapsuid.c
-
-make_issue: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/make_issue.pl\" $(SUIDS) \
- -o make_issue wrapsuid.c
-
-vote: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/vote.pl\" $(SUIDS) \
- -o vote wrapsuid.c
-
-close_issue: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/close_issue.pl\" $(SUIDS) \
- -o close_issue wrapsuid.c
-
-reminder: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/reminder.pl\" $(SUIDS) \
- -o reminder wrapsuid.c
-
-check_quorum: wrapsuid.c
- $(CC) -DPROGNAME=\"$(INSTALLBIN)/check_quorum.pl\" $(SUIDS) \
- -o check_quorum wrapsuid.c
-
-clean:
- rm -f votegroup make_issue vote close_issue reminder check_quorum
-
-install: check-directory \
- install-votegroup \
- install-make_issue \
- install-vote \
- install-close_issue \
- install-reminder \
- install-check_quorum
-
-check-directory:
- if [ ! -d $(INSTALLBIN) ]; then \
- mkdir $(INSTALLBIN); \
- fi
-
-install-votegroup: votegroup
- rm -f $(INSTALLBIN)/votegroup $(INSTALLBIN)/votegroup.pl
- cp -p votegroup.pl $(INSTALLBIN)/votegroup.pl
- cp -p votegroup $(INSTALLBIN)/votegroup
- chmod 700 $(INSTALLBIN)/votegroup.pl
- chmod 6755 $(INSTALLBIN)/votegroup
-
-install-make_issue: make_issue
- rm -f $(INSTALLBIN)/make_issue $(INSTALLBIN)/make_issue.pl
- cp -p make_issue.pl $(INSTALLBIN)/make_issue.pl
- cp -p make_issue $(INSTALLBIN)/make_issue
- cp -p steve.pm $(INSTALLBIN)/steve.pm
- chmod 700 $(INSTALLBIN)/make_issue.pl
- chmod 6755 $(INSTALLBIN)/make_issue
- chmod 644 $(INSTALLBIN)/steve.pm
-
-install-vote: vote
- rm -f $(INSTALLBIN)/vote $(INSTALLBIN)/vote.pl
- cp -p vote.pl $(INSTALLBIN)/vote.pl
- cp -p vote $(INSTALLBIN)/vote
- chmod 700 $(INSTALLBIN)/vote.pl
- chmod 6755 $(INSTALLBIN)/vote
-
-install-close_issue: close_issue
- rm -f $(INSTALLBIN)/close_issue $(INSTALLBIN)/close_issue.pl
- cp -p close_issue.pl $(INSTALLBIN)/close_issue.pl
- cp -p close_issue $(INSTALLBIN)/close_issue
- chmod 700 $(INSTALLBIN)/close_issue.pl
- chmod 6755 $(INSTALLBIN)/close_issue
-
-install-reminder: reminder
- rm -f $(INSTALLBIN)/reminder $(INSTALLBIN)/reminder.pl
- cp -p reminder.pl $(INSTALLBIN)/reminder.pl
- cp -p reminder $(INSTALLBIN)/reminder
- chmod 700 $(INSTALLBIN)/reminder.pl
- chmod 6755 $(INSTALLBIN)/reminder
-
-install-check_quorum: check_quorum
- rm -f $(INSTALLBIN)/check_quorum $(INSTALLBIN)/check_quorum.pl
- cp -p check_quorum.pl $(INSTALLBIN)/check_quorum.pl
- cp -p check_quorum $(INSTALLBIN)/check_quorum
- chmod 700 $(INSTALLBIN)/check_quorum.pl
- chmod 6755 $(INSTALLBIN)/check_quorum
-
diff --git a/cmdline/check_quorum.pl b/cmdline/check_quorum.pl
deleted file mode 100644
index 0f2e895..0000000
--- a/cmdline/check_quorum.pl
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# check_quorum
-# A program for checking if a closed issue reached quorum and
-# providing a sorted list of people whose vote was received.
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o takes as argument an issue name;
-#
-# o checks to be sure the issue has closed (to prevent abuse);
-#
-# o sends mail to the election monitor(s) indicating the sorted
-# list of voted addresses and ratio of votes cast to voters in group.
-#
-# Originally created by Roy Fielding
-#
-
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-
-use steve;
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [ group-issue-name ]
-
-$pname -- Check for quorum by listing the voters on a closed issue
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options and input from the user
-
-$_ = (shift || &get_input_line("the issue name", 1));
-if (/^(\w+)-(\d+)-(\w+)$/) {
- $group = $1;
- $start_date = $2;
- $issue = $3;
- $issuename = $_;
-}
-else { &usage; }
-
-# ==========================================================================
-# Expand and further validate input
-
-$votersfile = "$issuedir/$group/voters";
-@voters = &get_group($votersfile);
-if ($#voters < 0) {
- die "$pname: group $group must be an existing voter group\n";
-}
-
-$issueaddr = '[email protected]';
-
-$issuedir .= "/$group/$start_date-$issue";
-if (! -d $issuedir) { die "$pname: $issuename doesn't exist\n"; }
-$closerfile = "$issuedir/closed";
-if (! -e $closerfile) { die "$pname: $issuename has not closed voting\n"; }
-$tallyfile = "$issuedir/tally";
-if (! -e $tallyfile) { die "$pname: $issuename not yet open to voting\n"; }
-$issuefile = "$issuedir/issue";
-if (! -e $issuefile) { die "$pname: $issuename lost issue file\n"; }
-
-$monfile = "$issuedir/monitors";
-if (! -e $monfile) { die "$pname: can't find monitors\n"; }
-$monitors = `$CAT $monfile`;
-chomp $monitors;
-
-# ==========================================================================
-# Recreate the table of voter hash-ids
-
-$issid = &filestuff($issuefile);
-foreach $voter (@voters) {
- $h1 = &get_hash_of("$issid:$voter");
- $h2 = &get_hash_of("$issid:$h1");
- $invert2{$h2} = $voter;
-}
-
-# ==========================================================================
-# Read the tally file
-
-@voted = ();
-
-%tally = &read_tally($tallyfile);
-foreach $vkey (keys(%tally)) {
- push(@voted, $invert2{$vkey} || "Yikes, bad key: $vkey");
-}
-$num_voted = scalar(keys(%tally));
-$num_group = scalar(@voters);
-$pct_voted = int( ($num_voted * 100) / $num_group );
-
-# ==========================================================================
-# Send mail to monitors telling them who voted on the issue
-
-# open (MAIL, ">>debug.txt") || die("cannot send mail: $!\n");
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") || die("cannot send mail: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $monitors
-Subject: voters on $issuename
-
-Votes on issue $issuename were received from the following voters,
-representing $num_voted out of the $num_group eligible voters ($pct_voted\%).
-
-EndOutput
-
-foreach $vf (sort(@voted)) {
- print(MAIL " ", $vf, "\n");
-}
-print(MAIL "\nTotal: $num_voted of $num_group ($pct_voted\%)\n");
-close(MAIL);
-
-# ==========================================================================
-print("Quorum information has been sent to the monitors.\n");
-print("Total: $num_voted of $num_group ($pct_voted\%)\n");
-exit(0);
-
diff --git a/cmdline/close_issue.pl b/cmdline/close_issue.pl
deleted file mode 100644
index c5e75d8..0000000
--- a/cmdline/close_issue.pl
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# close_issue.pl
-# o must be run by voter user (see wrapsuid.c for setuid wrapper);
-# o accepts issue name and monitor hash-ID as arguments;
-# o sets a marker indicating no more votes accepted for issue;
-# o reads in tally, counting only last recorded vote per hashed-hash-id;
-# o mails summary to election monitor(s)
-# o [maybe] creates an HTML summary of results as
-# /home/voter/public_html/issue_nnnnnn.html
-#
-# Originally created by Roy Fielding
-#
-
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-
-use steve;
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [ group-issue-name [ hash-id ] ]
-
-$pname -- Close voting on an issue
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options and input from the user
-
-$_ = (shift || &get_input_line("the issue name", 1));
-if (/^(\w+)-(\d+)-(\w+)$/) {
- $group = $1;
- $start_date = $2;
- $issue = $3;
- $issuename = $_;
-}
-else { &usage; }
-
-$_ = (shift || &get_input_line("your monitor hash-ID", 1));
-if (/^(\w+)$/) {
- $mhashid = $1;
-}
-else { die "Invalid hash-ID\n"; }
-
-# ==========================================================================
-# Expand and further validate input
-
-$votersfile = "$issuedir/$group/voters";
-
-$issueaddr = '[email protected]';
-
-$issuedir .= "/$group/$start_date-$issue";
-if (! -d $issuedir) { die "$pname: $issuename doesn't exist\n"; }
-$tallyfile = "$issuedir/tally";
-if (! -e $tallyfile) { die "$pname: $issuename not yet open to voting\n"; }
-$issuefile = "$issuedir/issue";
-if (! -e $issuefile) { die "$pname: $issuename lost issue file\n"; }
-
-$monfile = "$issuedir/monitors";
-if (! -e $monfile) { die "$pname: can't find monitors\n"; }
-$monitors = `$CAT $monfile`;
-chomp $monitors;
-
-$typefile = "$issuedir/vote_type";
-
-# ==========================================================================
-# Recreate the monitor hash-id
-
-$issid = &filestuff($issuefile);
-$monhash = &get_hash_of("$issid:$monitors");
-
-if ($mhashid ne $monhash) { die "I don't recognize your hash-ID\n"; }
-
-# ==========================================================================
-# Indicate that voting is now closed
-
-$closerfile = "$issuedir/closed";
-system($TOUCH, $closerfile);
-
-# ==========================================================================
-# Send mail to monitors telling them that the issue has been closed
-# and enclose the final tally
-
-# open (MAIL, ">>debug.txt") || die("cannot send mail: $!\n");
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") || die("cannot send mail: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $monitors
-Subject: Final tally for $issuename
-
-Issue $issuename is now closed. The summary is not yet implemented.
-
-Here are the raw collected results -- remember to remove old votes from
-those with duplicate entries before counting them.
-
-EndOutput
-
-open(TALLY, $tallyfile) || die "$pname: cannot open tally file: $!\n";
-print MAIL <TALLY>;
-close(TALLY);
-
-# Collect hash signatures of voter files that should not change
-@vfiles = (
- "$votersfile",
- "$issuefile",
- "$monfile",
- "$typefile",
- "$homedir/bin/make_issue",
- "$homedir/bin/make_issue.pl",
- "$homedir/bin/vote",
- "$homedir/bin/vote.pl",
- "$homedir/bin/close_issue",
- "$homedir/bin/close_issue.pl"
-);
-
-print MAIL "\nCurrent file digests:\n\n";
-foreach $vf (@vfiles) {
- $pf = $vf;
- $pf =~ s/^$homedir\///o;
- print(MAIL &hash_file($vf), ': ', $pf, "\n");
-}
-close(MAIL);
-
-# ==========================================================================
-print "Issue closed. Mail has been sent to the vote monitors.\n";
-exit(0);
-
diff --git a/cmdline/make_issue.pl b/cmdline/make_issue.pl
deleted file mode 100644
index c015bff..0000000
--- a/cmdline/make_issue.pl
+++ /dev/null
@@ -1,495 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# make_issue
-# A program for creating issues to be voted upon by the named "group"
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o creates an issue directory (/home/voter/issues/group/YYYYMMDD-name/),
-# and fills it with files for the issue info, election monitors,
-# and tally file;
-#
-# o creates tables of hash-ids and hashed-hash-ids for use in validating
-# votes, verifying that the values are unique;
-#
-# o mails to the vote monitors an alert message to start tallying;
-#
-# o mails to each voter their hash-id to be used, issue number, and
-# some text explaining the issue.
-#
-# Originally created by Roy Fielding
-#
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-require "getopts.pl";
-use steve;
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [-h] [-b] [-g group] [-s start_date] [-i issue] [-f infofile]
- [-m monitors] [-v vote_type )]
-$pname -- Make an issue for managing an on-line, anonymous voting process
-Options:
- -h (help) -- just display this message and quit
- -b (batch) -- batch processing: assume 'ok' unless errors
- -g group -- create an issue for an existing group of voters
- -s date -- YYYYMMDD format of date that voting is allowed to start
- -i issue -- append this alphanumeric string to start date as issue name
- -f file -- send the contents of this file to each voter as explanation
- -m monitors -- e-mail address(es) for sending mail to vote monitor(s)
- -v type -- type of vote: yna = Yes/No/Abstain,
- stvN = single transferable vote for [1-9] slots,
- selectN = vote for [1-9] of the candidates
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options or input from the user
-
-undef $opt_h;
-undef $opt_b;
-
-if (!(&Getopts('hbg:s:i:f:m:v:')) || defined($opt_h)) { &usage; }
-
-if (defined($opt_g)) {
- $group = $opt_g;
-}
-else {
- $group = &get_input_line("group name for voters on this issue", 1);
-}
-if ($group !~ /^\w+$/) {
- die "$pname: group name must be an alphanumeric token\n";
-}
-
-if (defined($opt_s)) {
- $start_date = $opt_s;
-}
-else {
- $start_date = &get_input_line("YYYYMMDD date that voting starts", 1);
-}
-if ($start_date !~ /^[2-9]\d\d\d(0[1-9]|1[012])([012]\d|3[01])$/) {
- die "$pname: start date must be formatted as YYYYMMDD, like 20020930\n";
-}
-
-if (defined($opt_i)) {
- $issue = $opt_i;
-}
-else {
- $issue = &get_input_line("short issue name to append to date", 1);
-}
-if ($issue !~ /^\w+$/) {
- die "$pname: issue name must be an alphanumeric token\n";
-}
-
-if (defined($opt_f)) {
- $infofile = $opt_f;
-}
-else {
- $infofile = &get_input_line("file pathname of issue info on $host", 1);
-}
-if (!(-e $infofile)) {
- die "$pname: info file does not exist: $infofile\n";
-}
-if ($infofile =~ /(\/etc\/|$issuedir)/) {
- die "$pname: forbidden to read info files in that directory\n";
-}
-
-if (defined($opt_m)) {
- $monitors = $opt_m;
-}
-else {
- $monitors = &get_input_line("e-mail address(es) for vote monitors", 1);
-}
-if ($monitors !~ /\@/) {
- die "$pname: vote monitor must be an Internet e-mail address\n";
-}
-
-if (defined($opt_v)) {
- $vote_type = $opt_v;
-}
-else {
- $vote_type = &get_input_line("vote type: yna, stvN, or selectN (N=1-9)",
1);
-}
-if ($vote_type =~ /^yna$/i) {
- $selector = 0;
- $style = "yes, no, or abstain";
-}
-elsif ($vote_type =~ /^stv([1-9])$/i) {
- $selector = $1;
- $style = "single transferable vote for $selector slots";
-}
-elsif ($vote_type =~ /^select([1-9])$/i) {
- $selector = $1;
- $style = "select $selector of the candidates labeled [a-z0-9]";
-}
-else {
- die "$pname: vote type must be yna, stvN, or selectN (N=[1-9])\n";
-}
-
-if (defined($opt_b)) {
- $batch = 1;
-}
-else {
- $batch = 0;
-}
-
-# ==========================================================================
-# Check the voter group and read the list of voter addresses
-
-die "$pname: cannot find $issuedir\n" unless (-d $issuedir);
-$issuedir .= "/$group";
-if (-d $issuedir) {
- die "$pname: you lack permissions on $issuedir\n"
- unless (-o _ && -r _ && -w _ && -x _);
-}
-else {
- die "$pname: group $group has not been created yet, see votegroup\n";
-}
-
-$votersfile = "$issuedir/voters";
-@voters = &get_group($votersfile);
-if ($#voters < 0) {
- die "$pname: $group must be an existing voter group: see votegroup\n";
-}
-
-# ==========================================================================
-# Create directory for new issue only if it doesn't exist
-
-$issuename = "$group-$start_date-$issue";
-print "Creating new issue: $issuename\n";
-
-$issuedir .= "/$start_date-$issue";
-if (-e $issuedir) { die "$pname: $issuedir already exists\n"; }
-mkdir($issuedir, 0700) || die "$pname: cannot mkdir $issuedir: $!\n";
-
-# ==========================================================================
-# Create issue information file (needs to be done before voter hash)
-
-$issueaddr = '[email protected]';
-
-$issuefile = "$issuedir/issue";
-
-open(ISF, ">$issuefile") || die "$pname: cannot open issue file: $!\n";
-print ISF <<"EndOutput";
-Hello Apache $group,
-
-A call for votes has been declared for the following:
-
- Issue: $issuename
- Voting style: $style
-
-EndOutput
-
-open(INFILE, $infofile) || die "$pname: cannot open info file: $!\n";
-print ISF <INFILE>;
-close(INFILE);
-close(ISF);
-
-# ==========================================================================
-# Create a table of voter hash-ids and verify uniqueness
-
-for (;;) {
- $issid = &filestuff($issuefile);
- $monhash = &get_hash_of("$issid:$monitors");
- foreach $voter (@voters) {
- $h1 = &get_hash_of("$issid:$voter");
- $h2 = &get_hash_of("$issid:$h1");
- $hash1{$voter} = $h1;
- $hash2{$voter} = $h2;
- $invert1{$h1} = $voter;
- $invert2{$h2} = $voter;
- }
- $numh1 = scalar(keys(%hash1));
- $numh2 = scalar(keys(%hash2));
- $numi1 = scalar(keys(%invert1));
- $numi2 = scalar(keys(%invert2));
- last if (($numh1 == $numi1) && ($numh2 == $numi2));
- $h1 = &get_input_line("anything to retry collision-free hash", 1);
- system($TOUCH, $issuefile);
-}
-# &debug_hash;
-
-# ==========================================================================
-# Write list of monitors to issuedir/monitors
-$monfile = "$issuedir/monitors";
-
-open(MON, ">$monfile") || die "$pname: cannot open monitors file: $!\n";
-print MON "$monitors\n";
-close(MON);
-
-# ==========================================================================
-# Write type of vote to issuedir/vote_type
-$typefile = "$issuedir/vote_type";
-
-open(MON, ">$typefile") || die "$pname: cannot open vote type file: $!\n";
-print MON "$vote_type\n";
-if ($selector == 0) {
- @ballots = ( "yes\n", "no\n", "abstain\n");
-} else {
- open(INFILE, $issuefile) || die "$pname: cannot open issue file: $!\n";
- @ballots = ballots(<INFILE>);
- close(INFILE);
-}
-print MON @ballots;
-close(MON);
-
-# ==========================================================================
-# Verify with user that the info file is okay before mailing everyone.
-
-print "Here is the issue information to be sent to each voter:\n";
-print "==============================================================\n";
-system($CAT, $issuefile);
-&explain_vote(*STDOUT, 'unique-hash-key');
-print "==============================================================\n";
-do {
- $_ = ($batch ? "ok" : &get_input_line('"ok" to accept or "abort" to delete
issue', 0));
- if (/^abort$/i) {
- system('rm', '-rf', $issuedir);
- exit(1);
- }
-} until (/^ok/i);
-
-# ==========================================================================
-# Verify with user that the voters file is okay before mailing everyone.
-
-print "Here is the list of voter e-mail addresses:\n";
-print "==============================================================\n";
-for $voter (@voters) {
- print $voter, "\n";
-}
-print "==============================================================\n";
-do {
- $_ = ($batch ? "ok" : &get_input_line('"ok" to accept or "abort" to delete
issue', 0));
- if (/^abort$/i) {
- system('rm', '-rf', $issuedir);
- exit(1);
- }
-} until (/^ok/i);
-
-# ==========================================================================
-# Send mail to monitors telling them that the issue has been put to
-# a vote, including the list of valid hashed hash-ids, sigs of files,
-# and the issue info file.
-
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") || die("cannot send mail: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $monitors
-Subject: Monitoring vote on $issuename
-
-You have been selected as a vote monitor for Apache
-
- Issue: $issuename
- Voting style: $style
-
-EndOutput
-open(INFILE, $infofile) || die "$pname: cannot open info file: $!\n";
-print MAIL <INFILE>;
-close(INFILE);
-
-print MAIL <<"EndOutput";
-
-= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
-The voting system will record a tally of the votes as they are received
-and will report that to you when the voting is closed. To close voting,
-use ssh to login to $host and then run
-
- /home/voter/bin/close_issue $issuename $monhash
-
-For verification purposes, you will be receiving an e-mail notification
-of each vote submitted by the voters. Repeat votes should be considered
-a complete replacement of the person's prior vote. Your primary role in
-all of this is to compare the votes you received with the results that
-are tallied automatically, letting the group know if there is a
-significant difference. Any change made to the issue files during the
-voting process will immediately invalidate the hash IDs and kill voting.
-
-The following $numh2 voters are valid, as identified by the double-hashed ID
-that will be sent to you when a vote is recorded. Note that these IDs are
-different from the single-hash IDs used by the voters when voting.
-
-EndOutput
-
-foreach $voter (sort(values(%hash2))) {
- print MAIL " voter: $voter\n";
-}
-
-# Collect hash signatures of voter files that should not change
-@vfiles = (
- "$votersfile",
- "$issuefile",
- "$monfile",
- "$typefile",
- "$homedir/bin/make_issue",
- "$homedir/bin/make_issue.pl",
- "$homedir/bin/vote",
- "$homedir/bin/vote.pl",
- "$homedir/bin/close_issue",
- "$homedir/bin/close_issue.pl"
-);
-
-print MAIL "\nThe following explains the voting process to voters:\n";
-&explain_vote(*MAIL, 'unique-hash-key');
-print MAIL "\nCurrent file digests:\n\n";
-foreach $vf (@vfiles) {
- $pf = $vf;
- $pf =~ s/^$homedir\///o;
- print(MAIL &hash_file($vf), ': ', $pf, "\n");
-}
-close(MAIL);
-
-# ==========================================================================
-# Touch tally file to allow voting to begin
-# -- Theoretically, this could be done by a another program with "at"
-# scheduling to prevent people from voting too early, but why bother?
-
-system($TOUCH, "$issuedir/tally");
-
-# ==========================================================================
-# Send mail to voters telling them that the issue has been put to vote,
-# including the info file and their commands.
-
-while (($voter, $h1) = each %hash1) {
- print "Sending mail to voter: $voter\n";
-########################################### for debugging
-# print " hash1: $h1\n";
-# open (MAIL, ">>debug.txt") ||
-########################################### replace next line
- open (MAIL, "|$SENDMAIL -t -f$issueaddr") ||
- die("cannot send mail to $voter: $!\n");
-
- print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $voter
-Subject: Apache vote on $issuename
-Reply-To: $monitors
-
-EndOutput
- open(INFILE, $issuefile) || die "$pname: cannot open issue file: $!\n";
- print MAIL randomize(<INFILE>);
- close(INFILE);
- &explain_vote(*MAIL, $h1);
- close(MAIL);
-}
-
-# ==========================================================================
-print "Issue $issuename with hashcode of $monhash\nhas been successfully
created.\n";
-exit(0);
-
-
-# ==========================================================================
-# ==========================================================================
-sub explain_vote {
- local (*FDES, $hashid) = @_;
-
- print FDES <<"EndOut1";
-
-= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
-Your voting key for this issue: $hashid
-
-In order to vote, either visit
-
- https://vote.apache.org/cast/$issuename/$hashid
-
-or use ssh to login to $host and then run
-
- /home/voter/bin/vote $issuename $hashid "vote"
-
-EndOut1
-
- if ($selector == 0) {
- print FDES <<"EndYNA";
-where "vote" must be replaced by "yes", "no", or "abstain".
-EndYNA
- }
- elsif ($vote_type =~ /^stv/i) {
- print FDES <<"EndSTV";
-where "vote" must be replaced by a single word containing the
-concatenated labels of candidates in the order that you wish them
-to be selected. In other words, if you want to vote for the candidates
-labeled [x], [s], and [p], in that order, then your vote should be "xsp".
-
-This election will be decided according to the Single Transferable Vote
-rules described at
-
- http://wiki.apache.org/general/BoardVoting
- http://www.electoral-reform.org.uk/votingsystems/stvi.htm
- http://www.cix.co.uk/~rosenstiel/stvrules/index.htm
-
-for an election with $selector open slots.
-
-You have one vote. Use your vote by entering the label of your
-first preference candidate followed by, if desired, the label of your
-second preference candidate, and so on until you are indifferent about
-the remaining candidates. The sequence of your preferences is crucial.
-You should continue to express preferences only as long as you are able
-to place successive candidates in order. A later preference is considered
-only if an earlier preference has a surplus above the quota required for
-election, or is excluded because of insufficient support. Under no
-circumstances will a later preference count against an earlier preference.
-
-You may list as many candidates as you wish, but no more than once per
-vote (e.g., "xsxp" would be rejected).
-EndSTV
- }
- else {
- print FDES <<"EndSelect";
-where "vote" must be replaced by a single word containing the
-concatenated labels of your $selector choices. In other words,
-if you want to vote for the candidates labeled [x], [s], and [p],
-then your vote should be "xsp" (order does not matter).
-EndSelect
- }
-
- print FDES <<"EndExplain";
-If for some reason you are unable to use ssh to access $host,
-then you can vote by proxy: simply send your voting key to some
-person with ssh access that you trust, preferably with instructions
-on how you wish them to place your vote.
-
-For verification purposes, you will be receiving an e-mail notification
-each time your voting key is used. Repeat votes will be considered
-a complete replacement of your prior vote. Your vote will be
-recorded in a tally file and sent to the vote monitors along with
-a different unique key, minimizing the chance that the contents of
-your vote will be accidentally seen by someone else while associated
-to you. That is why the verification e-mail will only state that you
-have voted, rather than including how you voted.
-
-If you have any problems or questions, send a reply to the vote monitors
-for this issue: $monitors
-
-EndExplain
-}
-
diff --git a/cmdline/make_issue.py b/cmdline/make_issue.py
deleted file mode 100755
index 12934a6..0000000
--- a/cmdline/make_issue.py
+++ /dev/null
@@ -1,333 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-# make_issue
-#
-# A program for creating issues to be voted upon by the named "group"
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o creates an issue directory (/home/voter/issues/group/YYYYMMDD-name/),
-# and fills it with files for the issue info, election monitors,
-# and tally file;
-#
-# o creates tables of hash-ids and hashed-hash-ids for use in validating
-# votes, verifying that the values are unique;
-#
-# o mails to the vote monitors an alert message to start tallying;
-#
-# o mails to each voter their hash-id to be used, issue number, and
-# some text explaining the issue.
-#
-
-import sys
-import os
-import argparse
-import re
-import shutil
-import cStringIO
-
-### how do we want to "properly" adjust path?
-sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
'../lib')))
-import steve
-import ezt
-
-
-def main():
- args = parse_argv()
-
- ### where should we look for this config file?
- config = steve.load_config('steve.conf')
-
- # Expand the set of arguments (as a side-effect), if they were not provided
- # on the cmdline.
- augment_args(args, config)
-
- issue_name = '%s-%s-%s' % (args.group, args.start, args.issue)
-
- # Note: config.issue_dir updated as a side-effect
- voters = get_voters(args, config)
-
- # Note: config.issue_dir updated as a side-effect
- create_issue_dir(issue_name, args, config)
-
- info_fname = create_info_file(issue_name, args, config)
- monitors_hash, hash = build_hash(info_fname, voters, args)
-
- monitors_fname = create_monitors_file(args, config)
- type_fname = create_type_file(info_fname, args, config)
- verify_email(issue_name, info_fname, args, config)
- verify_voters(voters, args, config)
-
- email_monitors(issue_name, info_fname, monitors_hash, hash, args, config)
- email_voters()
-
- print "Issue %s with hashcode of %s\nhas been successfully created." \
- % (issue_name, monitors_hash)
-
-
-def parse_argv():
- parser = argparse.ArgumentParser(
- prog=steve.PROG,
- description='Make an issue for managing an on-line, '
- 'anonymous voting process',
- )
- parser.add_argument('-b', '--batch', action='store_true',
- help='batch processing: assume "ok" unless errors')
- parser.add_argument('-g', '--group',
- help='create an issue for an existing group of voters')
- parser.add_argument('-s', '--start',
- help='YYYYMMDD format of date that voting is allowed to
start')
- parser.add_argument('-i', '--issue',
- help='append this alphanumeric string to start date '
- 'as issue name')
- parser.add_argument('-f', '--file',
- help='send the contents of this file to each voter '
- 'as explanation')
- parser.add_argument('-m', '--monitors',
- help='e-mail address(es) for sending mail to vote
monitor(s)')
- parser.add_argument('-v', '--votetype',
- help='type of vote: yna = Yes/No/Abstain, '
- 'stvN = single transferable vote for [1-9] slots, '
- 'selectN = vote for [1-9] of the candidates')
-
- return parser.parse_args()
-
-
-def augment_args(args, config):
- "Update ARGS in-place with missing values."
-
- if args.group is None:
- args.group = steve.get_input_line('group name for voters on this issue',
True)
- if not re.match(r'^\w+$', args.group):
- steve.die('group name must be an alphanumeric token')
-
- if args.start is None:
- args.start = steve.get_input_line('YYYYMMDD date that voting starts', True)
- if not re.match(r'^[2-9]\d\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$',
- args.start):
- steve.die('start date must be formatted as YYYYMMDD, like 20090930')
-
- if args.issue is None:
- args.issue = steve.get_input_line('short issue name to append to date',
True)
- if not re.match(r'^\w+$', args.issue):
- steve.die('issue name must be an alphanumeric token')
-
- if args.file is None:
- args.file = steve.get_input_line('file pathname of issue info on %s'
- % (config.hostname,),
- True)
- args.file = os.path.realpath(args.file)
- if not os.path.exists(args.file):
- steve.die('info file does not exist: %s', args.file)
- if args.file.startswith('/etc/'):
- steve.die('forbidden to read info files from: /etc')
- issue_dir = os.path.realpath(config.issue_dir)
- if args.file.startswith(issue_dir + '/'):
- steve.die('forbidden to read info files from: %s', issue_dir)
-
- if args.monitors is None:
- args.monitors = steve.get_input_line('e-mail address(es) for vote
monitors', True)
- if '@' not in args.monitors:
- steve.die('vote monitor must be an Internet e-mail address')
-
- if args.votetype is None:
- args.votetype = steve.get_input_line('vote type; yna, stvN, or selectN
(N=1-9)',
- True)
- args.votetype = args.votetype.lower()
- if args.votetype == 'yna':
- args.selector = 0
- args.style = 'yes, no, or abstain'
- elif args.votetype.startswith('stv') and args.votetype[3:].isdigit():
- args.selector = int(args.votetype[3:])
- args.style = 'single transferable vote for %d slots' % (args.selector,)
- elif args.votetype.startswith('select') and args.votetype[6:].isdigit():
- args.selector = int(args.votetype[6:])
- args.style = 'select %d of the candidates labeled [a-z0-9]' %
(args.selector,)
- else:
- steve.die('vote type must be yna, stvN, or selectN (N=[1-9])')
-
-
-def get_voters(args, config):
- if not os.path.isdir(config.issue_dir):
- steve.die('cannot find: %s', config.issue_dir)
-
- config.issue_dir += '/' + args.group
- if not os.path.isdir(config.issue_dir):
- steve.die('group "%s" has not been created yet, see votegroup', args.group)
- if not os.access(config.issue_dir, os.R_OK | os.W_OK | os.X_OK):
- steve.die('you lack permissions on: %s', config.issue_dir)
- uid = os.stat(config.issue_dir).st_uid
- if uid != os.geteuid():
- steve.die('you are not the effective owner of: %s', config.issue_dir)
-
- voters = steve.get_group(config.issue_dir + '/voters')
- if not voters:
- steve.die('"%s" must be an existing voter group: see votegroup',
args.group)
-
- return voters
-
-
-def create_issue_dir(issue_name, args, config):
- print 'Creating new issue:', issue_name
-
- # Note that .issue_dir already has the group.
- config.issue_dir += '/%s-%s' % (args.start, args.issue)
- if os.path.exists(config.issue_dir):
- steve.die('already exists: %s', config.issue_dir)
- os.mkdir(config.issue_dir, 0700)
-
-
-def create_info_file(issue_name, args, config):
- info_fname = config.issue_dir + '/issue'
-
- contents = _use_template('templates/info-header.ezt', None, issue_name,
- None, None, None, args, config)
- open(info_fname, 'w').write(contents)
-
- return info_fname
-
-
-def build_hash(info_fname, voters, args):
- while True:
- issue_id = steve.filestuff(info_fname)
- monitors_hash = steve.get_hash_of('%s:%s' % (issue_id, args.monitors))
-
- hash = { }
- for voter in voters:
- h1 = steve.get_hash_of('%s:%s' % (issue_id, voter))
- h2 = steve.get_hash_of('%s:%s' % (issue_id, h1))
-
- hash[voter] = (h1, h2)
- hash[h1] = (voter, None)
- hash[h2] = (voter, None)
-
- if len(hash) == 3 * len(voters):
- return monitors_hash, hash
-
- _ = steve.get_input_line('anything to retry collision-free hash', True)
- open(info_fname, 'a').write('')
-
-
-def create_monitors_file(args, config):
- monitors_fname = config.issue_dir + '/monitors'
-
- open(monitors_fname, 'w').write(args.monitors + '\n')
-
- return monitors_fname
-
-
-def create_type_file(info_fname, args, config):
- type_fname = config.issue_dir + '/vote_type'
-
- f = open(type_fname, 'w')
- f.write('%s\n' % (args.votetype,))
-
- if args.selector == 0:
- ballots = ('yes', 'no', 'abstain')
- else:
- ballots = steve.ballots(open(info_fname).readlines())
-
- f.writelines(option + '\n' for option in ballots)
-
- return type_fname
-
-
-def verify_email(issue_name, info_fname, args, config):
- print 'Here is the issue information to be sent to each voter:'
-
- contents = open(info_fname).read() \
- + _use_template('templates/explain.ezt', 'unique-hash-key',
issue_name,
- None, None, None, args, config)
- _basic_verify(contents, args, config)
-
-
-def verify_voters(voters, args, config):
- print 'Here is the list of voter e-mail addresses:'
-
- contents = '\n'.join(voters)
- _basic_verify(contents, args, config)
-
-
-def _basic_verify(contents, args, config):
- print '=============================================================='
- print contents
- print '=============================================================='
-
- # No need to stop and verify.
- if args.batch:
- return
-
- while True:
- answer = steve.get_input_line('"ok" to accept, or "abort" to delete
issue', False)
- answer = answer.lower()
- if answer == 'abort':
- shutil.rmtree(config.issue_dir)
- sys.exit(1)
- if answer == 'ok':
- return
-
-
-def email_monitors(issue_name, info_fname, monitors_hash, hash, args, config):
- # Collect hash signatures of voter files that should not change
- ### need to expand this. allow some to be missing during dev/test.
- sigs = ['%s: %s' % (steve.hash_file('make_issue.py'), 'make_issue.py'),
- ]
-
- msg = _use_template('templates/monitor-email.ezt', 'unique-hash-key',
- issue_name, monitors_hash, hash, sigs,
- args, config)
-
- ### mail the result. for now, print out what would have been mailed.
- print '### DEBUG'
- print msg
- print '###'
-
-
-def email_voters():
- pass
-
-
-def _use_template(template_fname, key, issue_name, monitors_hash, hash, sigs,
- args, config):
- data = {
- 'hashid': key,
- 'type': args.votetype.strip('0123456789'),
- 'issue_name': issue_name,
- 'group': args.group,
- 'selector': args.selector,
- 'style': args.style,
- 'hostname': config.hostname,
- 'monitors': args.monitors,
- 'monitors_hash': monitors_hash,
- 'email': config.email,
- 'file': args.file,
- 'sigs': sigs,
- }
- if hash:
- data['count'] = len(hash)
- data['hash2'] = sorted(v[1] for v in hash.values() if v[1])
-
- buf = cStringIO.StringIO()
- ezt.Template(template_fname, compress_whitespace=False).generate(buf, data)
- return buf.getvalue()
-
-
-if __name__ == '__main__':
- os.umask(0077)
- main()
diff --git a/cmdline/reminder.pl b/cmdline/reminder.pl
deleted file mode 100644
index 6116c0c..0000000
--- a/cmdline/reminder.pl
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# reminder.pl
-# A program for reminding a voter about their voting key
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-# o a simple program that takes as arguments an issue name and voter
-# o sends mail to voter repeating the vote instructions
-#
-# Originally created by Roy Fielding
-#
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-use steve;
-
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [ group-issue-name [ voter ] ] ]
-
-$pname -- Remind a voter of their voting key for the given issue
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options and input from the user
-
-$_ = (shift || &get_input_line("the issue name", 1));
-if (/^(\w+)-(\d+)-(\w+)$/) {
- $group = $1;
- $start_date = $2;
- $issue = $3;
- $issuename = $_;
-}
-else { &usage; }
-
-$_ = (shift || &get_input_line("the voter's e-mail address", 1));
-if (/^(\S+\@\S+)$/) {
- $voter = $1;
-}
-else { die "Invalid voter\n"; }
-
-# ==========================================================================
-# Check to see if the voter is in the voting group
-
-if (! &found_in_group($voter, "$issuedir/$group/voters")) {
- die "$voter is not in group $group\n";
-}
-
-# ==========================================================================
-# Expand and further validate input
-
-$issueaddr = '[email protected]';
-
-$issuedir .= "/$group/$start_date-$issue";
-if (! -d $issuedir) { die "$pname: $issuename doesn't exist\n"; }
-$closerfile = "$issuedir/closed";
-if (-e $closerfile) { die "$pname: $issuename already closed voting\n"; }
-$tallyfile = "$issuedir/tally";
-if (! -e $tallyfile) { die "$pname: $issuename not yet open to voting\n"; }
-$issuefile = "$issuedir/issue";
-if (! -e $issuefile) { die "$pname: $issuename lost issue file\n"; }
-
-$monfile = "$issuedir/monitors";
-if (! -e $monfile) { die "$pname: can't find monitors\n"; }
-$monitors = `$CAT $monfile`;
-chomp $monitors;
-
-$typefile = "$issuedir/vote_type";
-if (! -e $typefile) { die "$pname: can't find vote_type\n"; }
-$vote_type = (`$CAT $typefile`)[0];
-chomp $vote_type;
-
-if ($vote_type =~ /^yna$/i) {
- $selector = 0;
- $style = "yes, no, or abstain";
-}
-elsif ($vote_type =~ /^stv([1-9])$/i) {
- $selector = $1;
- $style = "single transferable vote for $selector slots";
-}
-elsif ($vote_type =~ /^select([1-9])$/i) {
- $selector = $1;
- $style = "select $selector of the identified candidates, labeled [a-z0-9]";
-}
-else {
- die "$pname: failed to read vote_type\n";
-}
-
-# ==========================================================================
-# Recreate the table of voter hash-ids
-
-$issid = &filestuff($issuefile);
-$h1 = &get_hash_of("$issid:$voter");
-
-# ==========================================================================
-# Send mail to voter telling them that the issue has been put to vote,
-# including the info file and their commands.
-
-########################################### for debugging
-# print " hash1: $h1\n";
-# open (MAIL, ">>debug.txt") ||
-########################################### replace next line
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") ||
- die("cannot send mail to $voter: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $voter
-Subject: Reminder: Apache vote on $issuename
-Reply-To: $monitors
-
-EndOutput
-open(INFILE, $issuefile) || die "$pname: cannot open issue file: $!\n";
-print MAIL randomize(<INFILE>);
-close(INFILE);
-&explain_vote(*MAIL, $h1);
-close(MAIL);
-
-# ==========================================================================
-print "Sent mail to voter: $voter\n";
-exit(0);
-
-
-# ==========================================================================
-# ==========================================================================
-sub explain_vote {
- local (*FDES, $hashid) = @_;
-
- print FDES <<"EndOut1";
-
-= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-APACHE VOTE REMINDER:
-
-Your voting key for this issue: $hashid
-
-In order to vote, either visit
-
- https://vote.apache.org/cast/$issuename/$hashid
-
-or use ssh to login to $host and then run
-
- /home/voter/bin/vote $issuename $hashid "vote"
-
-EndOut1
-
- if ($selector == 0) {
- print FDES <<"EndYNA";
-where "vote" must be replaced by "yes", "no", or "abstain".
-EndYNA
- }
- elsif ($vote_type =~ /^stv/i) {
- print FDES <<"EndSTV";
-where "vote" must be replaced by a single word containing the
-concatenated labels of candidates in the order that you wish them
-to be selected. In other words, if you want to vote for the candidates
-labeled [x], [s], and [p], in that order, then your vote should be "xsp".
-
-This election will be decided according to the Single Transferable Vote
-rules described at
-
- http://wiki.apache.org/general/BoardVoting
- http://www.electoral-reform.org.uk/votingsystems/stvi.htm
- http://www.cix.co.uk/~rosenstiel/stvrules/index.htm
-
-for an election with $selector open slots.
-
-You have one vote. Use your vote by entering the label of your
-first preference candidate followed by, if desired, the label of your
-second preference candidate, and so on until you are indifferent about
-the remaining candidates. The sequence of your preferences is crucial.
-You should continue to express preferences only as long as you are able
-to place successive candidates in order. A later preference is considered
-only if an earlier preference has a surplus above the quota required for
-election, or is excluded because of insufficient support. Under no
-circumstances will a later preference count against an earlier preference.
-
-You may list as many candidates as you wish, but no more than once per
-vote (e.g., "xsxp" would be rejected).
-EndSTV
- }
- else {
- print FDES <<"EndSelect";
-where "vote" must be replaced by a single word containing the
-concatenated labels of your $selector choices. In other words,
-if you want to vote for the candidates labeled [x], [s], and [p],
-then your vote should be "xsp" (order does not matter).
-EndSelect
- }
-
- print FDES <<"EndExplain";
-If for some reason you are unable to use ssh to access $host,
-then you can vote by proxy: simply send your voting key to some
-person with ssh access that you trust, preferably with instructions
-on how you wish them to place your vote.
-
-For verification purposes, you will be receiving an e-mail notification
-each time your voting key is used. Repeat votes will be considered
-a complete replacement of your prior vote. Your vote will be
-recorded in a tally file and sent to the vote monitors along with
-a different unique key, minimizing the chance that the contents of
-your vote will be accidentally seen by someone else while associated
-to you. That is why the verification e-mail will only state that you
-have voted, rather than including how you voted.
-
-If you have any problems or questions, send a reply to the vote monitors
-for this issue: $monitors
-
-EndExplain
-}
-
diff --git a/cmdline/steve.conf b/cmdline/steve.conf
deleted file mode 100644
index aad6fd6..0000000
--- a/cmdline/steve.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-[general]
-UID_NAME = voter
-GID_NAME = voter
-HOME = /tmp
-ISSUE_DIR = %(HOME)s/issues
-HOSTNAME = people.apache.org
-EMAIL = [email protected]
diff --git a/cmdline/steve.pm b/cmdline/steve.pm
deleted file mode 100644
index 53ccb02..0000000
--- a/cmdline/steve.pm
+++ /dev/null
@@ -1,255 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# steve.pm
-# shared functions for Apache Steve.
-#
-
-##use strict;
-
-use Fcntl qw(:flock SEEK_END);
-use Digest::MD5;
-
-$ECHO = '/bin/echo';
-$CAT = '/bin/cat';
-$MD5 = '/sbin/md5';
-$OPENSSL = '/usr/bin/openssl';
-$TOUCH = '/usr/bin/touch';
-$SENDMAIL = '/usr/sbin/sendmail';
-$DIFF = '/usr/bin/diff';
-$MV = '/bin/mv';
-
-
-$homedir = '/home/voter';
-$issuedir = "$homedir/issues";
-$host = 'people.apache.org';
-
-$ENV{'PATH'} = "$homedir/bin:/usr/bin:/usr/sbin:/bin:/sbin";
-$ENV{'LOGNAME'} = 'voter';
-$ENV{'GROUP'} = 'voter';
-$ENV{'USER'} = 'voter';
-$ENV{'HOME'} = '/home/voter';
-$ENV{'MAIL'} = '/var/mail/voter';
-
-# ==========================================================================
-sub get_input_line {
- local ($prompt, $quit_able) = @_;
- local ($_);
-
- do {
- print("Enter ", $prompt, $quit_able ? " (q=quit): " : ": ");
- $_ = <STDIN>;
- chomp;
- exit(0) if ($quit_able && /^q$/i);
- } while (/^$/);
-
- return $_;
-}
-
-# ==========================================================================
-sub get_group {
- local ($groupfile) = @_;
- local ($_, @rv);
-
- open(INFILE, $groupfile) || die "$pname: cannot open $groupfile: $!\n";
- while ($_ = <INFILE>) {
- chomp;
- s/#.*$//;
- s/\s+$//;
- s/^\s+//;
- next if (/^$/);
- die "$pname: voter must be an Internet e-mail address\n"
- unless (/\@/);
- push(@rv, $_);
- }
- close(INFILE);
- return @rv;
-}
-
-# ==========================================================================
-sub filestuff {
- local ($filename) = @_;
- local ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks);
-
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks) = stat($filename);
-
- return "$ino:$mtime";
-}
-
-# ==========================================================================
-
-sub get_hash_of {
- local ($item) = @_;
- local $md5 = Digest::MD5->new;
-
- $md5->add($item);
- return $md5->hexdigest;
-}
-
-# ==========================================================================
-
-sub hash_file {
- local ($filename) = @_;
-
- open(INFILE, $filename) || die "$pname: cannot open $filename: $!\n";
- local $/; # Set input to "slurp" mode.
- local $item = <INFILE>;
- close(INFILE);
- return get_hash_of($item);
-}
-
-# ==========================================================================
-sub debug_hash {
- print "==============================================================\n";
- foreach $voter (@voters) {
- print "$hash1{$voter} $hash2{$voter} $voter\n";
- }
- print "==============================================================\n";
-}
-
-# ==========================================================================
-sub read_tally {
- local ($filename) = @_;
- local ($_, %rv);
-
- %rv = ();
-
- open(INFILE, $filename) || die "$pname: cannot open $filename: $!\n";
- while ($_ = <INFILE>) {
- chomp;
- if (/\] (\S+) (\S+)$/o) {
- $rv{$1} = $2;
- }
- else {
- warn "Invalid vote in tally: $_";
- }
- }
- close(INFILE);
-
- return %rv;
-}
-
-# ==========================================================================
-sub found_in_group {
- local ($voter, $groupfile) = @_;
- local ($_);
-
- open(INFILE, $groupfile) || return 0;
- while ($_ = <INFILE>) {
- chomp;
- s/#.*$//;
- s/\s+$//;
- s/^\s+//;
- if ($_ eq $voter) {
- close(INFILE);
- return 1;
- }
- }
- close(INFILE);
- return 0;
-}
-
-# ==========================================================================
-sub get_date {
- local ($sec, $min, $hour, $mday, $mon, $year) = gmtime(time);
-
- return sprintf("%04d/%02d/%02d %02d:%02d:%02d", 1900 + $year,
- $mon+1, $mday, $hour, $min, $sec);
-}
-
-# ==========================================================================
-sub contains_duplicates {
- local ($str) = @_;
- local (%ctr, $ch);
-
- foreach $ch (split(//, $str)) {
- $ctr{$ch} = 1;
- }
- return (length($str) != scalar(keys(%ctr)));
-}
-
-# ==========================================================================
-
-sub not_valid {
- my (@votes, %valid);
- @votes = split(//, shift(@_));
- for (@_) {
- chomp;
- $valid{$_} = 1;
- }
- for (@votes) {
- return 1 unless $valid{$_} == 1;
- }
- return 0;
-}
-
-# randomize the order in which candidates are listed
-#
-# candidates are identified with a single alphanumeric character surrounded
-# by square brackets as the first non-blank on a line.
-#
-# candidates are to be listed consecutively, one per line. If this is
-# found not to be the case, NO reordering is performed.
-sub randomize {
- my (@prolog, @choices, @epilog);
-
- push @prolog, shift while @_ && not $_[0] =~ /^\s*\[[a-z0-9]\]\s/;
- unshift @epilog, pop while @_ && not $_[-1] =~ /^\s*\[[a-z0-9]\]\s/;
- return @prolog, @_, @epilog if grep !/^\s*\[\S\]\s/, @_;
- push @choices, splice(@_, rand @_, 1) while @_;
- return @prolog, @choices, @epilog;
-}
-
-# return the ballot identifiers for each candidate in an issue.
-#
-# candidates are identified with a single alphanumeric character surrounded
-# by square brackets as the first non-blank on a line.
-#
-# candidates are to be listed consecutively, one per line.
-#
-sub ballots {
- my (@ballots);
-
- shift while @_ && not $_[0] =~ /^\s*\[[a-z0-9]\]\s/;
- for (@_) {
- if (/^\s*\[([a-z0-9])\]\s/) {
- push @ballots, "$1\n";
- } else {
- last;
- }
- }
- return @ballots;
-}
-
-# ==========================================================================
-
-sub lock {
- my ($f) = @_;
- flock($f, LOCK_EX) || die "Cannot lock file: $!\n";
- seek($f, 0, SEEK_END) || die "Cannot seek: $!\n";
-}
-
-# ==========================================================================
-
-sub unlock {
- my ($f) = @_;
- flock($f, LOCK_UN) || die "Cannot unlock file: $!\n";
-}
-
-1;
diff --git a/cmdline/templates/explain.ezt b/cmdline/templates/explain.ezt
deleted file mode 100644
index 1fdbf0a..0000000
--- a/cmdline/templates/explain.ezt
+++ /dev/null
@@ -1,77 +0,0 @@
-[#
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-]= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
-Your voting key for this issue: [hashid]
-
-In order to vote, either visit
-
- https://vote.apache.org/cast/[issue_name]/[hashid]
-
-or use ssh to login to [hostname] and then run
-
- /home/voter/bin/vote [issue_name] [hashid] "vote"
-[is type "yna"]
-where "vote" must be replaced by "yes", "no", or "abstain".
-[else][is type "stv"]
-where "vote" must be replaced by a single word containing the
-concatenated labels of candidates in the order that you wish them
-to be selected. In other words, if you want to vote for the candidates
-labeled [[]x], [[]s], and [[]p], in that order, then your vote should be "xsp".
-
-This election will be decided according to the Single Transferable Vote
-rules described at
-
- http://wiki.apache.org/general/BoardVoting
- http://www.electoral-reform.org.uk/votingsystems/stvi.htm
- http://www.cix.co.uk/~rosenstiel/stvrules/index.htm
-
-for an election with [selector] open slots.
-
-You have one vote. Use your vote by entering the label of your
-first preference candidate followed by, if desired, the label of your
-second preference candidate, and so on until you are indifferent about
-the remaining candidates. The sequence of your preferences is crucial.
-You should continue to express preferences only as long as you are able
-to place successive candidates in order. A later preference is considered
-only if an earlier preference has a surplus above the quota required for
-election, or is excluded because of insufficient support. Under no
-circumstances will a later preference count against an earlier preference.
-
-You may list as many candidates as you wish, but no more than once per
-vote (e.g., "xsxp" would be rejected).
-[else]
-where "vote" must be replaced by a single word containing the
-concatenated labels of your [selector] choices. In other words,
-if you want to vote for the candidates labeled [[]x], [[]s], and [[]p],
-then your vote should be "xsp" (order does not matter).
-[end][end]
-If for some reason you are unable to use ssh to access [hostname],
-then you can vote by proxy: simply send your voting key to some
-person with ssh access that you trust, preferably with instructions
-on how you wish them to place your vote.
-
-For verification purposes, you will be receiving an e-mail notification
-each time your voting key is used. Repeat votes will be considered
-a complete replacement of your prior vote. Your vote will be
-recorded in a tally file and sent to the vote monitors along with
-a different unique key, minimizing the chance that the contents of
-your vote will be accidentally seen by someone else while associated
-to you. That is why the verification e-mail will only state that you
-have voted, rather than including how you voted.
-
-If you have any problems or questions, send a reply to the vote monitors
-for this issue: [monitors]
diff --git a/cmdline/templates/info-header.ezt
b/cmdline/templates/info-header.ezt
deleted file mode 100644
index 29e6c0b..0000000
--- a/cmdline/templates/info-header.ezt
+++ /dev/null
@@ -1,23 +0,0 @@
-[#
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-]Hello Apache [group],
-
-A call for votes has been declared for the following:
-
- Issue: [issue_name]
- Voting style: [style]
-
-[insertfile file]
diff --git a/cmdline/templates/monitor-email.ezt
b/cmdline/templates/monitor-email.ezt
deleted file mode 100644
index 4a2d5e0..0000000
--- a/cmdline/templates/monitor-email.ezt
+++ /dev/null
@@ -1,59 +0,0 @@
-[#
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-][#
-
-Note that we are generating header fields to push into Sendmail.
-
-]From: "Apache voting tool" <[email]>
-To: [monitors]
-Subject: Monitoring vote on [issue_name]
-
-You have been selected as a vote monitor for Apache
-
- Issue: [issue_name]
- Voting style: [style]
-
-[insertfile file]
-= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
-The voting system will record a tally of the votes as they are received
-and will report that to you when the voting is closed. To close voting,
-use ssh to login to $host and then run
-
- /home/voter/bin/close_issue [issue_name] [monitors_hash]
-
-For verification purposes, you will be receiving an e-mail notification
-of each vote submitted by the voters. Repeat votes should be considered
-a complete replacement of the person's prior vote. Your primary role in
-all of this is to compare the votes you received with the results that
-are tallied automatically, letting the group know if there is a
-significant difference. Any change made to the issue files during the
-voting process will immediately invalidate the hash IDs and kill voting.
-
-The following [count] voters are valid, as identified by the double-hashed ID
-that will be sent to you when a vote is recorded. Note that these IDs are
-different from the single-hash IDs used by the voters when voting.
-
-[for hash2] voter: [hash2]
-[end]
-The following explains the voting process to voters:
-
-[include "explain.ezt"]
-
-Current file digests:
-
-[for sigs][sigs]
-[end]
diff --git a/cmdline/vote.pl b/cmdline/vote.pl
deleted file mode 100644
index 0a2f5c7..0000000
--- a/cmdline/vote.pl
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# vote
-# A program for mostly-anonyous voting.
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o a simple program that takes as arguments an issue name,
-# voter hash-id, and vote (yes/no/abstain or a multi-selection word);
-#
-# o validates arguments based on type of issue;
-#
-# o appends timestamp, hashed-hash-id, and vote to the tally;
-#
-# o sends mail to the election monitor(s) indicating the vote that
-# was received and the hashed-hash-id (to identify repeats).
-#
-# o sends mail to voter indicating that their vote has been received
-# (but not the contents of the vote);
-#
-# I do not claim that this is the perfect voting solution. Some of the
-# problems:
-#
-# - it allows voter and root users the ability to modify
-# the votes after they have been received, though this should be
-# detected unless they also spoof or intercept mail to the monitors.
-#
-# - it allows several ways for an observer to connect-the-dots
-# between the voting persons and their hash-id, and thus to their
-# vote, particularly if the observer has access to the mail queue
-# or user command history.
-#
-# - it allows the sudo users and root users the ability to modify
-# the vote or close_issue commands, changing the results.
-#
-# However, these drawbacks are not significantly worse than a
-# traditional ballot box and manual counting at a meeting, at least
-# when we compare it to the stockholder votes by proxy that are
-# commonly done for public companies. I think this will be sufficient
-# to keep votes accurate and anonymous given a trusting environment.
-#
-# Originally created by Roy Fielding
-#
-
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-
-use steve;
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [ group-issue-name [ hash-id [ vote ] ] ]
-
-$pname -- Vote anonymously using the Apache on-line voter process
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options and input from the user
-
-$_ = (shift || &get_input_line("the issue name", 1));
-if (/^(\w+)-(\d+)-(\w+)$/) {
- $group = $1;
- $start_date = $2;
- $issue = $3;
- $issuename = $_;
-}
-else { &usage; }
-
-$_ = (shift || &get_input_line("your voting key", 1));
-if (/^(\w+)$/) {
- $vhashid = $1;
-}
-else { die "Invalid voting key\n"; }
-
-$_ = (shift || &get_input_line("your vote on issue $issuename", 0));
-# Allow vote to be quoted, i.e. allow "yes" as well as yes
-if (/^"?(\w+)"?$/) {
- $vote = $1;
-}
-else { die "Invalid vote; please read the voting instructions.\n"; }
-
-# ==========================================================================
-# Expand and further validate input
-
-$votersfile = "$issuedir/$group/voters";
-@voters = &get_group($votersfile);
-if ($#voters < 0) {
- die "$pname: group $group must be an existing voter group\n";
-}
-
-$issueaddr = '[email protected]';
-
-$issuedir .= "/$group/$start_date-$issue";
-if (! -d $issuedir) { die "$pname: $issuename doesn't exist\n"; }
-$closerfile = "$issuedir/closed";
-if (-e $closerfile) { die "$pname: $issuename already closed voting\n"; }
-$tallyfile = "$issuedir/tally";
-if (! -e $tallyfile) { die "$pname: $issuename not yet open to voting\n"; }
-$issuefile = "$issuedir/issue";
-if (! -e $issuefile) { die "$pname: $issuename lost issue file\n"; }
-
-$monfile = "$issuedir/monitors";
-if (! -e $monfile) { die "$pname: can't find monitors\n"; }
-$monitors = `$CAT $monfile`;
-chomp $monitors;
-
-# ==========================================================================
-# validate vote based on voting style
-chomp $vote;
-$typefile = "$issuedir/vote_type";
-if (! -e $typefile) { die "$pname: can't find vote_type\n"; }
-@valid_votes = `$CAT $typefile`;
-$vote_type = shift @valid_votes;
-chomp $vote_type;
-
-if ($vote_type =~ /^yna$/i) {
- $selector = 0;
- $style = "yes, no, or abstain";
- $vote =~ tr/A-Z/a-z/;
- die "This issue only allows $style as votes\n"
- unless ($vote =~ /^(no|yes|abstain)$/);
-}
-elsif ($vote_type =~ /^stv([1-9])$/i) {
- $selector = $1;
- $style = "single transferable vote for $selector slots";
- $vote =~ tr/A-Z/a-z/;
- die "You cannot vote for the same candidate more than once\n"
- if (&contains_duplicates($vote));
- die "You have an invalid vote - no such candidate\n"
- if (¬_valid($vote, @valid_votes));
-}
-elsif ($vote_type =~ /^select([1-9])$/i) {
- $selector = $1;
- $style = "select $selector of the identified candidates, labeled [a-z0-9]";
- $vote =~ tr/A-Z/a-z/;
- die "You cannot vote for the same candidate more than once\n"
- if (&contains_duplicates($vote));
- die "You can only vote for at most $selector candidates\n"
- unless (length($vote) <= $selector);
- die "You have an invalid vote - no such candidate\n"
- if (¬_valid($vote, @valid_votes));
-}
-else {
- die "$pname: failed to read vote_type\n";
-}
-
-# ==========================================================================
-# Recreate the table of voter hash-ids
-
-$issid = &filestuff($issuefile);
-foreach $voter (@voters) {
- $h1 = &get_hash_of("$issid:$voter");
- $h2 = &get_hash_of("$issid:$h1");
- $hash2{$voter} = $h2;
- $invert1{$h1} = $voter;
-}
-
-$voter = $invert1{$vhashid};
-if (!defined($voter)) { die "I don't recognize your voting key\n"; }
-
-$vhash2 = $hash2{$voter};
-if (!defined($vhash2)) { die "I can't find your hashed-hash-ID\n"; }
-
-# ==========================================================================
-# construct vote entry
-$date = &get_date;
-####$entry = "[$date] $vhash2 $vote";
-$entry = "[$date] $vhash2 $vote\n";
-
-# ==========================================================================
-# write vote entry to tally file -- this should be atomic (ensure w/ flock)
-
-if (-e $closerfile) { die "$pname: $issuename already closed voting\n"; }
-
-open(TALLY, ">>$tallyfile") || die "$pname: cannot open tally: $!\n";
-lock(TALLY);
-$len = length($entry);
-$off = 0;
-do {
- $written = syswrite(TALLY, $entry, $len, $off);
- if (!defined($written)) { die "$pname: cannot write to tally: $!\n"; }
- $len -= $written;
- $off -= $written;
-} while ($len > 0);
-unlock(TALLY);
-close(TALLY);
-
-print "Your vote has been accepted on issue $issuename\n";
-
-# ==========================================================================
-# Send mail to monitors telling them that the issue has been put to
-# a vote, including the list of valid hashed hash-ids, sigs of files,
-# and the issue info file.
-
-# open (MAIL, ">>debug.txt") || die("cannot send mail: $!\n");
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") || die("cannot send mail: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $monitors
-Subject: $issuename
-
-The following vote was received at $date
-
- issue: $issuename
- voter: $vhash2 vote: $vote
-
-EndOutput
-
-# Collect hash signatures of voter files that should not change
-@vfiles = (
- "$votersfile",
- "$issuefile",
- "$monfile",
- "$typefile",
- "$homedir/bin/make_issue",
- "$homedir/bin/make_issue.pl",
- "$homedir/bin/vote",
- "$homedir/bin/vote.pl",
- "$homedir/bin/close_issue",
- "$homedir/bin/close_issue.pl"
-);
-
-print MAIL "Current file digests:\n\n";
-foreach $vf (@vfiles) {
- $pf = $vf;
- $pf =~ s/^$homedir\///o;
- print(MAIL &hash_file($vf), ': ', $pf, "\n");
-}
-close(MAIL);
-
-
-# ==========================================================================
-# Send mail to voter telling them that someone voted using their hash-ID
-
-# open (MAIL, ">>debug.txt") ||
-open (MAIL, "|$SENDMAIL -t -f$issueaddr") ||
- die("cannot send mail to $voter: $!\n");
-
-print MAIL <<"EndOutput";
-From: "Apache voting tool" <$issueaddr>
-To: $voter
-Subject: Recorded your vote on $issuename
-Reply-To: $monitors
-
-Somebody (hopefully you or your proxy) has recorded a vote on
-
- issue: $issuename
-
-using the voting key assigned to you.
-
-If you have any problems or questions, send a reply to the vote monitors
-for this issue: $monitors
-
-EndOutput
-close(MAIL);
-
-# ==========================================================================
-print "Vote on $issuename received: $vote\n";
-print "Mail has been sent to voter and the vote monitors.\n";
-print "You may re-vote until issue is closed; only last vote is counted.\n";
-exit(0);
-
diff --git a/cmdline/votegroup.pl b/cmdline/votegroup.pl
deleted file mode 100644
index e22d064..0000000
--- a/cmdline/votegroup.pl
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/usr/bin/perl
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-# votegroup
-# A program for creating a list of voters in the given issue group
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o creates a group directory (/home/voter/issues/group/),
-# and adds to it a "voters" file containing a list of e-mail addresses.
-#
-# Originally created by Roy Fielding
-#
-BEGIN {
- unshift @INC, "/home/voter/bin";
-}
-
-require "getopts.pl";
-use steve;
-
-$ENV{'PATH'} = "$homedir/bin:/usr/bin:/usr/sbin:/bin:/sbin";
-
-umask(0077);
-$| = 1; # Make STDOUT unbuffered
-
-$pname = $0; # executable name for errors
-$pname =~ s#^.*/##;
-
-# ==========================================================================
-# ==========================================================================
-# Print the usage information if help requested (-h) or a bad option given.
-#
-sub usage
-{
- die <<"EndUsage";
-usage: $pname [-h] [-b] [-g group] [-f votersfile]
-
-$pname -- Make a group of voters for an on-line, anonymous voting process
-
-Options:
- -h (help) -- just display this message and quit
- -b (batch) -- batch processing: assume 'ok' unless errors
- -g group -- create the named group of voters
- -f file -- contains the list of voter e-mail addresses, one per line
-
-EndUsage
-}
-
-# ==========================================================================
-# Get the command-line options or input from the user
-
-undef $opt_h;
-undef $opt_b;
-
-if (!(&Getopts('hbg:f:')) || defined($opt_h)) { &usage; }
-
-if (defined($opt_g)) {
- $group = $opt_g;
-}
-else {
- $group = &get_input_line("group name for the voters", 1);
-}
-if ($group !~ /^\w+$/) {
- die "$pname: group name must be an alphanumeric token\n";
-}
-
-if (defined($opt_f)) {
- $infofile = $opt_f;
-}
-else {
- $infofile = &get_input_line("file pathname of voter e-mail addresses", 1);
-}
-if (!(-e $infofile)) {
- die "$pname: voters file does not exist: $infofile\n";
-}
-if ($infofile =~ /(\/etc\/|$issuedir)/) {
- die "$pname: forbidden to read files in that directory\n";
-}
-
-if (defined($opt_b)) {
- $batch = 1;
-}
-else {
- $batch = 0;
-}
-# ==========================================================================
-# Check the voter group and read the list of voter addresses
-
-die "$pname: cannot find $issuedir\n" unless (-d $issuedir);
-$issuedir .= "/$group";
-if (-d $issuedir) {
- die "$pname: you lack permissions on $issuedir\n"
- unless (-o _ && -r _ && -w _ && -x _);
- print "Updating existing voting group: $group\n";
-}
-else {
- print "Creating new voting group: $group\n";
- mkdir($issuedir, 0700) || die "$pname: cannot mkdir $issuedir: $!\n";
-}
-
-@voters = &get_group($infofile);
-if ($#voters < 0) {
- die "$pname: no valid e-mail addresses were found\n";
-}
-
-# ==========================================================================
-# Verify with user that the voters file is okay
-
-print "Here is the list of voter e-mail addresses:\n";
-print "==============================================================\n";
-foreach $voter (@voters) {
- print $voter, "\n";
- $hash1{$voter} = 1;
-}
-print "==============================================================\n";
-
-$dupes = scalar(@voters) - scalar(keys(%hash1));
-if ($dupes != 0) {
- die "$pname: $dupes duplicate voters must be removed from the list\n";
-}
-do {
- $_ = ($batch ? "ok" : &get_input_line('"ok" to accept or "abort" to exit',
0));
- if (/^abort$/i) {
- exit(1);
- }
-} until (/^ok/i);
-
-# ==========================================================================
-# Diff an existing voters file
-
-$votersfile = "$issuedir/voters";
-
-if (-e $votersfile) {
- print "Differences from existing list of voters:\n";
- print "==============================================================\n";
- system($DIFF, "-u", $votersfile, $infofile);
- print "==============================================================\n";
- do {
- $_ = ($batch ? "ok" : &get_input_line('"ok" to accept or "abort" to
exit', 0));
- if (/^abort$/i) {
- exit(1);
- }
- } until (/^ok/i);
- system($MV, "-f", $votersfile, "$votersfile.old");
-}
-
-# ==========================================================================
-# Create voters file
-
-open(ISF, ">$votersfile") || die "$pname: cannot write to voters file: $!\n";
-open(INFILE, $infofile) || die "$pname: cannot read voters file: $!\n";
-print ISF <INFILE>;
-close(INFILE);
-close(ISF);
-
-# ==========================================================================
-print "Voting group $group has been successfully created.\n";
-$pf = $votersfile;
-$pf =~ s/^$homedir\///o;
-print &hash_file($votersfile), ': ', $pf, "\n";
-
-exit(0);
diff --git a/cmdline/votegroup.py b/cmdline/votegroup.py
deleted file mode 100755
index 3a461b4..0000000
--- a/cmdline/votegroup.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# votegroup
-# A program for creating a list of voters in the given issue group
-#
-# o must be run by voter user (see wrapsuid.c for setuid wrapper)
-#
-# o creates a group directory (/home/voter/issues/group/),
-# and adds to it a "voters" file containing a list of e-mail addresses.
-#
-# Originally created by Roy Fielding
-#
-from collections import Counter
-import os
-import re
-import subprocess
-import sys
-import argparse
-
-import steve
-
-
-def accept_or_exit():
- while True:
- answer = steve.get_input_line('"ok" to accept, or "abort" to exit', False)
- answer = answer.lower()
- if answer == 'abort':
- sys.exit(1)
- if answer == 'ok':
- return
-
-
-def main():
- args = parse_argv()
-
- # Expand the set of arguments (as a side-effect), if they were not provided
- # on the cmdline.
- augment_args(args)
-
- voters = steve.get_group(args.file)
- if not voters:
- steve.die('No valid e-mail addresses were found in %s' % (args.file,))
-
- print 'Here is the list of voter e-mail addresses:'
- print '=============================================================='
- for voter in voters:
- print voter
- print '=============================================================='
-
- duplicates = len(voters) - len(set(voters))
- if duplicates:
- print 'Found duplicates:\n %s' % '\n '.join([x for x, y in
Counter(voters).items() if y > 1])
- steve.die('%s duplicate voter%s must be removed from the list' %
(duplicates, 's' if duplicates > 1 else ''))
-
- if not args.batch:
- accept_or_exit()
-
- diff_voters_file(args)
-
- create_voters_file(args)
-
-
-def parse_argv():
- parser = argparse.ArgumentParser(
- prog=steve.PROG,
- description='Make an issue for managing an on-line, '
- 'anonymous voting process',
- )
- parser.add_argument('-b', '--batch', action='store_true',
- help='batch processing: assume "ok" unless errors')
- parser.add_argument('-g', '--group',
- help='create an issue for an existing group of voters')
- parser.add_argument('-f', '--file',
- help='contains the list of voter e-mail addresses, one
per line')
-
- return parser.parse_args()
-
-
-def augment_args(args):
- "Update ARGS in-place with missing values."
-
- if args.group is None:
- args.group = steve.get_input_line('group name for voters on this issue',
True)
- if not re.match(r'^\w+$', args.group):
- steve.die('group name must be an alphanumeric token')
-
- if args.file is None:
- args.file = steve.get_input_line('file pathname voter e-mail addresses',
True)
- args.file = os.path.realpath(args.file)
- if not os.path.exists(args.file):
- steve.die('info file does not exist: %s', args.file)
- if args.file.startswith('/etc/'):
- steve.die('forbidden to read info files from: /etc')
- if args.file.startswith(steve.ISSUE_DIR + os.path.sep):
- steve.die('forbidden to read info files from: %s', steve.ISSUE_DIR)
-
-
-def _run_cmd(cmd, cwd=None):
- process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- (stdout, stderr) = process.communicate()
-
- return process.returncode, stdout + stderr
-
-
-def diff_voters_file(args):
- VOTERS_FILE = os.path.join(steve.ISSUE_DIR, 'voters')
- VOTERS_FILE = os.path.join('.', 'voters')
- if os.path.exists(VOTERS_FILE):
- _, stdout = _run_cmd(['diff', '-u', VOTERS_FILE, args.file])
-
- print 'Differences from existing list of voters:'
- print '=============================================================='
- print stdout
- print '=============================================================='
-
- if not args.batch:
- accept_or_exit()
-
- _run_cmd(['mv', '-f', VOTERS_FILE, VOTERS_FILE + os.path.extsep + 'old'])
-
-
-def create_voters_file(args):
- VOTERS_FILE = os.path.join(steve.ISSUE_DIR, 'voters')
- VOTERS_FILE = os.path.join('.', 'voters')
-
- _run_cmd(['cp', args.file, VOTERS_FILE])
-
- print '\n\n%s: %s' % (steve.hash_file(VOTERS_FILE), VOTERS_FILE)
-
-
-if __name__ == '__main__':
- main()
diff --git a/cmdline/wrapsuid.c b/cmdline/wrapsuid.c
deleted file mode 100644
index aff2ffe..0000000
--- a/cmdline/wrapsuid.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * wrapsuid.c: simple setuid wrapper for perl scripts
- * Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
- *
- * You need to compile this with a command like
- *
- * CC = gcc
- * INSTALLBIN = /home/voter/bin
- * SUIDS = -DTARGET_UID=508 -DTARGET_GID=508
- *
- * $(CC) -DPROGNAME=\"$(INSTALLBIN)/vote.pl\" $(SUIDS) -o vote wrapsuid.c
- *
- * Note that the perl script must be careful about using the arguments.
- *
- * Originally created by Roy Fielding
- */
- /* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv, char **envp) {
-
- setuid((uid_t )TARGET_UID);
- setgid((gid_t )TARGET_GID);
- execve(PROGNAME, argv, envp);
-}
diff --git a/lib/steve.py b/lib/steve.py
deleted file mode 100644
index 5da21d4..0000000
--- a/lib/steve.py
+++ /dev/null
@@ -1,181 +0,0 @@
-#####
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#####
-#
-# steve.py -- shared code for Apache Steve
-#
-
-import sys
-import os
-import hashlib
-import re
-import time
-import random
-import ConfigParser
-
-HOME_DIR = os.path.join('home', 'voter')
-ISSUE_DIR = os.path.join(HOME_DIR, 'issues')
-
-# Strip the .py extension, producing the setuid program name.
-PROG = os.path.splitext(os.path.basename(sys.argv[0]))[0]
-
-
-def get_input_line(prompt, quittable=False):
- "Prompt and fetch a line of input."
-
- if quittable:
- prompt += ' (q=quit)'
- prompt += ': '
- while True:
- line = raw_input(prompt).strip()
- if quittable and line == 'q':
- sys.exit(0)
- if line:
- return line
- # loop until we get an answer
-
-
-def get_group(filename):
- """ Return the group of voters, as a list of email addresses
- :param str filename: name of file that contains the group of voter email
addresses
- :rtype list(str): list of voter email addresses
- """
-
- group = []
- for line in open(filename).readlines():
- i = line.find('#')
- if i >= 0:
- line = line[:i]
- line = line.strip()
- if not line:
- continue
- if '@' not in line:
- raise ValueError('%s: voter must be an Internet e-mail address.' %
(line,))
- group.append(line)
-
- return group
-
-
-def filestuff(fname):
- "Compute a unique key for FNAME based on its file info."
- s = os.stat(fname)
- return '%d:%d' % (s.st_ino, s.st_mtime)
-
-
-def get_hash_of(datum):
- "Compute the (hex) MD5 hash of the string DATUM."
- return hashlib.md5(datum).hexdigest()
-
-
-def hash_file(fname):
- "Compute the (hex) MD5 hash of the file FNAME."
- return get_hash_of(open(fname).read())
-
-
-_RE_TALLY = re.compile('] (\\S+) (\\S+)$')
-
-def read_tally(fname):
- result = { }
- for line in open(fname).readlines():
- match = _RE_TALLY.search(line)
- if match:
- result[match.group(1)] = match.group(2)
- else:
- print 'WARNING: Invalid vote in tally:', line
-
- return result
-
-
-def found_in_group(voter, fname):
- "Returns True if the given VOTER is in the group specified in FNAME."
- group = get_group(fname)
- return voter in group
-
-
-def get_date():
- "Format and return the current time."
- return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime())
-
-
-def contains_duplicates(s):
- "Returns True if any characters in S are duplicated."
- return len(set(s)) != len(s)
-
-
-def not_valid(votes, valid):
- "Returns True if any vote in VOTES is not in VALID."
- for v in votes:
- if v not in valid:
- return True
- return False
-
-
-_RE_CHOICE = re.compile(r'\s*\[([a-z0-9])\]\s')
-
-def randomize(text):
- "Break TEXT into a prolog, randomized set of choices, and an epilog."
- ### assumes TEXT is a list of strings. correct?
-
- found = False
-
- prolog = [ ]
- choices = [ ]
- epilog = [ ]
-
- for line in text:
- match = _RE_CHOICE.match(line)
- if match:
- found = True
- choices.append(line)
- elif found:
- epilog.append(line)
- else:
- prolog.append(line)
-
- random.shuffle(choices)
- return prolog, choices, epilog
-
-
-def ballots(text):
- "Return the list of possible ballot choices within TEXT."
- ### assumes TEXT is a list of strings. correct?
-
- choices = [ ]
-
- for line in text:
- match = _RE_CHOICE.match(line)
- if match:
- choices.append(match.group(1))
-
- return choices
-
-
-def load_config(fname):
- "Load installation/configuration values."
-
- parser = ConfigParser.SafeConfigParser()
- parser.readfp(open(fname)) # use .readfp() since config is required
- class _config(object):
- def __init__(self, items):
- vars(self).update(items)
- return _config(parser.items('general'))
-
-
-def die(msg, *args):
- "Print an error message and exit with failure."
-
- print '%s: %s' % (PROG, msg % args)
- sys.exit(1)