Merge branch 'master' of hackerspace.pl:q3k/hackfridge
commit
c8b3a0721b
|
@ -1,5 +1,6 @@
|
||||||
import logic
|
import logic
|
||||||
import sys
|
import sys
|
||||||
|
import shlex
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
"initialize": (logic.initialize, [], True),
|
"initialize": (logic.initialize, [], True),
|
||||||
|
@ -19,7 +20,7 @@ def start():
|
||||||
sys.stdout.write("> ")
|
sys.stdout.write("> ")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
line = raw_input().strip()
|
line = raw_input().strip()
|
||||||
command = line.split()[0]
|
command = shlex.split(line)[0]
|
||||||
|
|
||||||
if command == "quit":
|
if command == "quit":
|
||||||
break
|
break
|
||||||
|
@ -42,7 +43,7 @@ def start():
|
||||||
print "[e] Make up your mind."
|
print "[e] Make up your mind."
|
||||||
continue
|
continue
|
||||||
|
|
||||||
given_arguments = line.split()[1:]
|
given_arguments = shlex.split(line)[1:]
|
||||||
if len(given_arguments) != len(arguments):
|
if len(given_arguments) != len(arguments):
|
||||||
print "[e] Syntax: %s %s" % (command, " ".join([argument[0] for argument in arguments]))
|
print "[e] Syntax: %s %s" % (command, " ".join([argument[0] for argument in arguments]))
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
|
||||||
#include "nfc.h"
|
#include "nfc.h"
|
||||||
#include "barcode.h"
|
#include "barcode.h"
|
||||||
#include "ldap.h"
|
#include "ldap.h"
|
||||||
#include "tts.h"
|
#include "tts.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "network.h"
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
SSL_library_init();
|
||||||
|
|
||||||
if (nfc_initialize())
|
if (nfc_initialize())
|
||||||
{
|
{
|
||||||
printf("NFC initialization failed\n");
|
printf("NFC initialization failed\n");
|
||||||
|
@ -65,8 +69,9 @@ int main(int argc, char **argv)
|
||||||
int BarcodeResult = barcode_read(Barcode);
|
int BarcodeResult = barcode_read(Barcode);
|
||||||
if (BarcodeResult == 0)
|
if (BarcodeResult == 0)
|
||||||
{
|
{
|
||||||
tts_speak_cached("bip");
|
tts_speak_cached("Bip, bip!");
|
||||||
printf("Scanned barcode %s\n", Barcode);
|
printf("Scanned barcode %s\n", Barcode);
|
||||||
|
send_purchase(MAINFRAME_HOST, MAINFRAME_PORT, Barcode, UID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,8 +23,13 @@ int initialize_ctx(const char* chainfile, const char* keyfile, const char* passw
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
/* Create our context*/
|
/* Create our context*/
|
||||||
meth=SSLv23_method();
|
meth=TLSv1_client_method();
|
||||||
ctx=SSL_CTX_new(meth);
|
ctx=SSL_CTX_new(meth);
|
||||||
|
if (!ctx)
|
||||||
|
{
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load our keys and certificates*/
|
/* Load our keys and certificates*/
|
||||||
result = SSL_CTX_use_certificate_chain_file(ctx, chainfile);
|
result = SSL_CTX_use_certificate_chain_file(ctx, chainfile);
|
||||||
|
|
Reference in New Issue