1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-23 05:26:07 +03:00

make sure len is always correct

This commit is contained in:
Erik Ekman 2007-06-09 17:48:28 +00:00
parent 77ae2d682a
commit 1e7486bdd2
4 changed files with 15 additions and 13 deletions

View File

@ -1,8 +1,9 @@
CC = gcc 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 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 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"` OS = `uname | tr "a-z" "A-Z"`
ARCH = `uname -m` ARCH = `uname -m`
@ -15,15 +16,15 @@ all: stateos $(CLIENT) $(SERVER) $(TESTSUITE)
stateos: stateos:
@echo OS is $(OS), arch is $(ARCH) @echo OS is $(OS), arch is $(ARCH)
$(CLIENT): $(CLIENTOBJS) $(CLIENT): $(COMMONOBJS) $(CLIENTOBJS)
@echo LD $@ @echo LD $@
@mkdir -p ../bin @mkdir -p ../bin
@$(CC) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS) @$(CC) $(COMMONOBJS) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS)
$(SERVER): $(SERVEROBJS) $(SERVER): $(COMMONOBJS) $(SERVEROBJS)
@echo LD $@ @echo LD $@
@mkdir -p ../bin @mkdir -p ../bin
@$(CC) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS) @$(CC) $(COMMONOBJS) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS)
.c.o: .c.o:
@echo CC $< @echo CC $<

View File

@ -1,7 +1,7 @@
CC = gcc CC = gcc
TEST = test TEST = test
OBJS = test.o base32.o read.o dns.o encoding.o login.o user.o OBJS = test.o base32.o base64.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 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"` OS = `uname | tr "a-z" "A-Z"`

View File

@ -24,7 +24,7 @@
#include "base32.h" #include "base32.h"
#include "test.h" #include "test.h"
struct tuple static struct tuple
{ {
char *a; char *a;
char *b; char *b;
@ -41,9 +41,8 @@ START_TEST(test_base32_encode)
int val; int val;
int i; int i;
len = sizeof(buf);
for (i = 0; testpairs[i].a != NULL; i++) { for (i = 0; testpairs[i].a != NULL; i++) {
len = sizeof(buf);
val = base32_encode(buf, &len, testpairs[i].a, strlen(testpairs[i].a)); val = base32_encode(buf, &len, testpairs[i].a, strlen(testpairs[i].a));
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));
@ -60,9 +59,8 @@ START_TEST(test_base32_decode)
int val; int val;
int i; int i;
len = sizeof(buf);
for (i = 0; testpairs[i].a != NULL; i++) { for (i = 0; testpairs[i].a != NULL; i++) {
len = sizeof(buf);
val = base32_decode(buf, &len, testpairs[i].b, strlen(testpairs[i].b)); val = base32_decode(buf, &len, testpairs[i].b, strlen(testpairs[i].b));
fail_unless(val > 0, strerror(errno)); fail_unless(val > 0, strerror(errno));

View File

@ -49,6 +49,9 @@ main()
test = test_base32_create_tests(); test = test_base32_create_tests();
suite_add_tcase(iodine, test); suite_add_tcase(iodine, test);
test = test_base64_create_tests();
suite_add_tcase(iodine, test);
test = test_dns_create_tests(); test = test_dns_create_tests();
suite_add_tcase(iodine, test); suite_add_tcase(iodine, test);