Partial support for SSL
This commit is contained in:
parent
6692f11590
commit
937e2536f0
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "lib/libircclient"]
|
||||
path = lib/libircclient
|
||||
url = https://git.lain.church/emil/libircclient
|
@ -15,3 +15,6 @@ VERSION X
|
||||
Added -identify
|
||||
ircmsg is now more useful
|
||||
Fixed some error return values being too high
|
||||
Changed NVULN to NO_VULN
|
||||
Added ENABLE_SSL=1 to enable SSL incomplete support
|
||||
Added libircclient submodule
|
||||
|
22
Makefile
22
Makefile
@ -3,9 +3,10 @@
|
||||
PROGN:=probotic
|
||||
|
||||
CFLAGS:=-std=c99 -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef
|
||||
CPPFLAGS:=-I/usr/include/libircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"${PROGN}\" -D_FORTIFY_SOURCE=2
|
||||
CPPFLAGS:=-I./lib/libircclient/include/ -Iinclude -D_GNU_SOURCE -DPROGN=\"${PROGN}\" -D_FORTIFY_SOURCE=2
|
||||
|
||||
LDLIBS:=-lircclient -lsqlite3
|
||||
LDLIBS:=-lsqlite3
|
||||
LIB:=./lib/libircclient/src/libircclient.o
|
||||
|
||||
SRC := api.c irc.c main.c parse.c unity.c
|
||||
HDR := api.h error.h irc.h irccolors.h parse.h stmt.h
|
||||
@ -20,16 +21,27 @@ ifdef SAN
|
||||
CFLAGS += -fsanitize=${SAN}
|
||||
endif
|
||||
|
||||
ifeq (${NVULN},1)
|
||||
ifeq (${NO_VULN},1)
|
||||
CPPFLAGS += -DNO_VULN_COMMANDS
|
||||
endif
|
||||
|
||||
ifeq (${ENABLE_SSL},1)
|
||||
LDLIBS += -lssl -lcrypto
|
||||
CPPFLAGS += -DIRC_SSL_SUPPORT
|
||||
endif
|
||||
|
||||
all: ${PROGN}
|
||||
|
||||
${PROGN}: ${HDR} ${SRC}
|
||||
${LINK.c} src/unity.c -o $@ ${LDLIBS}
|
||||
${LINK.c} -pipe ${LIB} src/unity.c -o $@ ${LDLIBS}
|
||||
|
||||
# do nothing but update them...
|
||||
$(SRC) $(HDR):
|
||||
|
||||
.PHONY: clean
|
||||
submodules:
|
||||
git submodule update --init --recursive
|
||||
|
||||
clean:
|
||||
-rm ${OBJ}
|
||||
|
||||
.PHONY: submodules clean
|
||||
|
1
lib/libircclient
Submodule
1
lib/libircclient
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 76ae5fd5e7a3789756bcf07c42d10a9685987ae9
|
17
src/api.c
17
src/api.c
@ -7,7 +7,8 @@ VARDECL char const * db = DBFILE;
|
||||
|
||||
VARDECL sqlite3 * connection = NULL;
|
||||
|
||||
DECL void DBERR(const int l){
|
||||
DECL void DBERR(const int l)
|
||||
{
|
||||
if(l != SQLITE_OK && l != SQLITE_ROW && l != SQLITE_DONE)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -34,13 +35,13 @@ api_init(void)
|
||||
DECL void
|
||||
api_rope(void)
|
||||
{
|
||||
DBERR(sqlite3_finalize(remind_stmt));
|
||||
DBERR(sqlite3_finalize(set_repo_stmt));
|
||||
DBERR(sqlite3_finalize(get_nth_id_stmt));
|
||||
DBERR(sqlite3_finalize(new_assignment_stmt));
|
||||
DBERR(sqlite3_finalize(purge_assignments_stmt));
|
||||
DBERR(sqlite3_finalize(is_no_assignment_stmt));
|
||||
sqlite3_close(connection);
|
||||
DBERR(sqlite3_finalize(remind_stmt));
|
||||
DBERR(sqlite3_finalize(set_repo_stmt));
|
||||
DBERR(sqlite3_finalize(get_nth_id_stmt));
|
||||
DBERR(sqlite3_finalize(new_assignment_stmt));
|
||||
DBERR(sqlite3_finalize(purge_assignments_stmt));
|
||||
DBERR(sqlite3_finalize(is_no_assignment_stmt));
|
||||
sqlite3_close(connection);
|
||||
}
|
||||
|
||||
DECL void
|
||||
|
12
src/irc.c
12
src/irc.c
@ -159,13 +159,17 @@ init(void)
|
||||
ERRMSG("Error creating IRC session");
|
||||
goto fail;
|
||||
}
|
||||
atexit(rope);
|
||||
assert(creds.username != NULL);
|
||||
assert(creds.server != NULL);
|
||||
irc_connect(session,
|
||||
creds.server, creds.port, creds.password,
|
||||
creds.username, creds.username, creds.username);
|
||||
if (irc_connect(session,
|
||||
creds.server, creds.port, creds.password,
|
||||
creds.username, creds.username, creds.username))
|
||||
{
|
||||
fprintf(stderr, "IRC ERROR: %s\n", irc_strerror(irc_errno(session)));
|
||||
exit(1);
|
||||
}
|
||||
FULL_FREE(creds.password);
|
||||
atexit(rope);
|
||||
return 0;
|
||||
fail:
|
||||
FULL_FREE(creds.password);
|
||||
|
BIN
src/unity.o
Normal file
BIN
src/unity.o
Normal file
Binary file not shown.
Reference in New Issue
Block a user