mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-22 21:33:33 +02:00
make sure len is always correct
This commit is contained in:
parent
77ae2d682a
commit
1e7486bdd2
4 changed files with 15 additions and 13 deletions
13
src/Makefile
13
src/Makefile
|
@ -1,8 +1,9 @@
|
|||
CC = gcc
|
||||
COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o md5.o common.o
|
||||
CLIENTOBJS = iodine.o
|
||||
CLIENT = ../bin/iodine
|
||||
CLIENTOBJS = iodine.o tun.o dns.o read.o encoding.o login.o base32.o md5.o common.o
|
||||
SERVEROBJS = iodined.o user.o
|
||||
SERVER = ../bin/iodined
|
||||
SERVEROBJS = iodined.o tun.o dns.o read.o encoding.o login.o base32.o md5.o common.o user.o
|
||||
|
||||
OS = `uname | tr "a-z" "A-Z"`
|
||||
ARCH = `uname -m`
|
||||
|
@ -15,15 +16,15 @@ all: stateos $(CLIENT) $(SERVER) $(TESTSUITE)
|
|||
stateos:
|
||||
@echo OS is $(OS), arch is $(ARCH)
|
||||
|
||||
$(CLIENT): $(CLIENTOBJS)
|
||||
$(CLIENT): $(COMMONOBJS) $(CLIENTOBJS)
|
||||
@echo LD $@
|
||||
@mkdir -p ../bin
|
||||
@$(CC) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS)
|
||||
@$(CC) $(COMMONOBJS) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS)
|
||||
|
||||
$(SERVER): $(SERVEROBJS)
|
||||
$(SERVER): $(COMMONOBJS) $(SERVEROBJS)
|
||||
@echo LD $@
|
||||
@mkdir -p ../bin
|
||||
@$(CC) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS)
|
||||
@$(CC) $(COMMONOBJS) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS)
|
||||
|
||||
.c.o:
|
||||
@echo CC $<
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CC = gcc
|
||||
TEST = test
|
||||
OBJS = test.o base32.o read.o dns.o encoding.o login.o user.o
|
||||
SRCOBJS = ../src/base32.o ../src/read.o ../src/dns.o ../src/encoding.o ../src/login.o ../src/md5.o ../src/user.o
|
||||
OBJS = test.o base32.o base64.o read.o dns.o encoding.o login.o user.o
|
||||
SRCOBJS = ../src/base32.o ../src/base64.o ../src/read.o ../src/dns.o ../src/encoding.o ../src/login.o ../src/md5.o ../src/user.o
|
||||
|
||||
OS = `uname | tr "a-z" "A-Z"`
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "base32.h"
|
||||
#include "test.h"
|
||||
|
||||
struct tuple
|
||||
static struct tuple
|
||||
{
|
||||
char *a;
|
||||
char *b;
|
||||
|
@ -41,9 +41,8 @@ START_TEST(test_base32_encode)
|
|||
int val;
|
||||
int i;
|
||||
|
||||
len = sizeof(buf);
|
||||
|
||||
for (i = 0; testpairs[i].a != NULL; i++) {
|
||||
len = sizeof(buf);
|
||||
val = base32_encode(buf, &len, testpairs[i].a, strlen(testpairs[i].a));
|
||||
|
||||
fail_unless(val > 0, strerror(errno));
|
||||
|
@ -60,9 +59,8 @@ START_TEST(test_base32_decode)
|
|||
int val;
|
||||
int i;
|
||||
|
||||
len = sizeof(buf);
|
||||
|
||||
for (i = 0; testpairs[i].a != NULL; i++) {
|
||||
len = sizeof(buf);
|
||||
val = base32_decode(buf, &len, testpairs[i].b, strlen(testpairs[i].b));
|
||||
|
||||
fail_unless(val > 0, strerror(errno));
|
||||
|
|
|
@ -49,6 +49,9 @@ main()
|
|||
test = test_base32_create_tests();
|
||||
suite_add_tcase(iodine, test);
|
||||
|
||||
test = test_base64_create_tests();
|
||||
suite_add_tcase(iodine, test);
|
||||
|
||||
test = test_dns_create_tests();
|
||||
suite_add_tcase(iodine, test);
|
||||
|
||||
|
|
Loading…
Reference in a new issue