Merge branch 'master' of hackerspace.pl:q3k/hackfridge

master
Tomek Dubrownik 2012-05-22 20:47:33 +02:00
commit c8b3a0721b
3 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import logic
import sys
import shlex
actions = {
"initialize": (logic.initialize, [], True),
@ -19,7 +20,7 @@ def start():
sys.stdout.write("> ")
sys.stdout.flush()
line = raw_input().strip()
command = line.split()[0]
command = shlex.split(line)[0]
if command == "quit":
break
@ -42,7 +43,7 @@ def start():
print "[e] Make up your mind."
continue
given_arguments = line.split()[1:]
given_arguments = shlex.split(line)[1:]
if len(given_arguments) != len(arguments):
print "[e] Syntax: %s %s" % (command, " ".join([argument[0] for argument in arguments]))
continue

View File

@ -1,14 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <openssl/ssl.h>
#include "nfc.h"
#include "barcode.h"
#include "ldap.h"
#include "tts.h"
#include "config.h"
#include "network.h"
int main(int argc, char **argv)
{
SSL_library_init();
if (nfc_initialize())
{
printf("NFC initialization failed\n");
@ -65,8 +69,9 @@ int main(int argc, char **argv)
int BarcodeResult = barcode_read(Barcode);
if (BarcodeResult == 0)
{
tts_speak_cached("bip");
tts_speak_cached("Bip, bip!");
printf("Scanned barcode %s\n", Barcode);
send_purchase(MAINFRAME_HOST, MAINFRAME_PORT, Barcode, UID);
}
else
{

View File

@ -23,8 +23,13 @@ int initialize_ctx(const char* chainfile, const char* keyfile, const char* passw
int result = 1;
/* Create our context*/
meth=SSLv23_method();
meth=TLSv1_client_method();
ctx=SSL_CTX_new(meth);
if (!ctx)
{
ERR_print_errors_fp(stderr);
return -1;
}
/* Load our keys and certificates*/
result = SSL_CTX_use_certificate_chain_file(ctx, chainfile);