Exemple #1
0
 has_poll = form.has_key(evcommon.POST_MID_POLL)
 if has_sess:
     if cgivalidator.validate_sessionid(form):
         sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))
     if has_poll:
         req_params = [evcommon.POST_MID_POLL, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             result = mid.poll()
         else:
             evlog.log_error(logline)
     else:
         req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             cgilog.do_log("vote/auth")
             result = mid.init_sign(form)
         else:
             cgilog.do_log_error('vote/auth/err')
             evlog.log_error(logline)
 else:
     req_params = [evcommon.POST_PHONENO]
     res, logline = cgivalidator.validate_form(form, req_params)
     if res:
         cgilog.do_log("cand/auth")
         phoneno = form.getvalue(evcommon.POST_PHONENO)
         evlog.log("PHONENO: " + phoneno)
         if election.Election().allow_new_voters():
             result = mid.init_auth(phoneno)
         else:
             a, b = protocol.plain_error_election_off_after()
Exemple #2
0
    os.umask(007)
    hesd = hesdisp.HESVoterDispatcher()
    form = cgi.FieldStorage()
    result = protocol.msg_error_technical()
    evlog.AppLog().set_app('HES')

    try:
        if form.has_key(evcommon.POST_EVOTE):
            req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]

            if cgivalidator.validate_sessionid(form):
                sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))

            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('vote/auth')
                result = hesd.hts_vote(form.getvalue(evcommon.POST_EVOTE))
            else:
                cgilog.do_log_error('vote/auth/err')
                evlog.log_error(logline)
        else:
            req_params = []
            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('cand/auth')
                if election.Election().allow_new_voters():
                    result = hesd.get_candidate_list()
                else:
                    evlog.log_error('nonewvoters')
                    a, b = protocol.plain_error_election_off_after()
                    result = protocol.msg_error(a, b)
import sessionid
import cgivalidator
import urllib
import os

if not evcommon.testrun():
    os.umask(007)
    form = cgi.FieldStorage()
    result = protocol.msg_error_technical()
    evlog.AppLog().set_app("VERIFY")

    try:
        req_params = [evcommon.POST_VERIFY_VOTE]
        res, logline = cgivalidator.validate_form(form, req_params)
        if res:
            cgilog.do_log("verif/auth")
            elec = election.Election()
            params = ((evcommon.POST_SESS_ID, sessionid.voting()),
                      (evcommon.POST_VERIFY_VOTE,
                       form.getvalue(evcommon.POST_VERIFY_VOTE)))

            evlog.log("verif/auth VOTE-ID: " +
                      urllib.quote_plus(params[1][1])[:200])

            url = ("http://" + elec.get_hts_ip() + "/" +
                   elec.get_hts_verify_path())
            conn = urllib.urlopen(url, urllib.urlencode(params))
            result = conn.read()
        else:
            cgilog.do_log_error("verif/err")
            evlog.log_error(logline)
Exemple #4
0
    os.umask(007)
    hesd = hesdisp.HESVoterDispatcher()
    form = cgi.FieldStorage()
    result = protocol.msg_error_technical()
    evlog.AppLog().set_app('HES')

    try:
        if evcommon.POST_EVOTE in form:
            req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]

            if cgivalidator.validate_sessionid(form):
                sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))

            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('vote/auth')
                result = hesd.hts_vote(form.getvalue(evcommon.POST_EVOTE))
            else:
                cgilog.do_log_error('vote/auth/err')
                evlog.log_error(logline)
        else:
            req_params = []
            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('cand/auth')
                if election.Election().allow_new_voters():
                    result = hesd.get_candidate_list()
                else:
                    evlog.log_error('nonewvoters')
                    a, b = protocol.plain_error_election_off_after()
                    result = protocol.msg_error(a, b)
Exemple #5
0
 has_poll = form.has_key(evcommon.POST_MID_POLL)
 if has_sess:
     if cgivalidator.validate_sessionid(form):
         sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))
     if has_poll:
         req_params = [evcommon.POST_MID_POLL, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             result = mid.poll()
         else:
             evlog.log_error(logline)
     else:
         req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             cgilog.do_log("vote/auth")
             result = mid.init_sign(form)
         else:
             cgilog.do_log_error('vote/auth/err')
             evlog.log_error(logline)
 else:
     req_params = [evcommon.POST_PHONENO]
     res, logline = cgivalidator.validate_form(form, req_params)
     if res:
         cgilog.do_log("cand/auth")
         phoneno = form.getvalue(evcommon.POST_PHONENO)
         evlog.log("PHONENO: " + phoneno)
         if election.Election().allow_new_voters():
             result = mid.init_auth(phoneno)
         else:
             evlog.log_error('nonewvoters')
import sessionid
import cgivalidator
import urllib
import os

if not evcommon.testrun():
    os.umask(007)
    form = cgi.FieldStorage()
    result = protocol.msg_error_technical()
    evlog.AppLog().set_app("VERIFY")

    try:
        req_params = [evcommon.POST_VERIFY_VOTE]
        res, logline = cgivalidator.validate_form(form, req_params)
        if res:
            cgilog.do_log("verif/auth")
            elec = election.Election()
            params = ((evcommon.POST_SESS_ID, sessionid.voting()),
                      (evcommon.POST_VERIFY_VOTE,
                       form.getvalue(evcommon.POST_VERIFY_VOTE)))

            evlog.log("verif/auth VOTE-ID: " +
                      urllib.quote_plus(params[1][1])[:200])

            url = ("http://" + elec.get_hts_ip() + "/" +
                   elec.get_hts_verify_path())
            conn = urllib.urlopen(url, urllib.urlencode(params))
            result = conn.read()
        else:
            cgilog.do_log_error("verif/err")
            evlog.log_error(logline)