From: Andre Noll Date: Sat, 23 Apr 2011 13:54:59 +0000 (+0200) Subject: Merge branch 't/crypt_cleanups' X-Git-Tag: v0.4.7~14 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=32e646780461f96682d1191d31e08e4602ab125e;hp=-c Merge branch 't/crypt_cleanups' Conflicts: Makefile.in --- 32e646780461f96682d1191d31e08e4602ab125e diff --combined Makefile.in index 8b33aaac,d7640b6c..8ecc1b8f --- a/Makefile.in +++ b/Makefile.in @@@ -15,15 -15,10 +15,15 @@@ build_date := $(shell date uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS") uname_rs := $(shell uname -rs) cc_version := $(shell $(CC) --version | head -n 1) -codename := deterministic entropy +codename := infinite rollback + +GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h) DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W DEBUG_CPPFLAGS += -Wredundant-decls +DEBUG_CPPFLAGS += -Wall +DEBUG_CPPFLAGS += -Wformat-security +DEBUG_CPPFLAGS += -Wmissing-format-attribute # produces false positives # DEBUG_CPPFLAGS += -Wunreachable-code # DEBUG_CPPFLAGS += -Wwrite-strings @@@ -43,24 -38,28 +43,23 @@@ ifeq ($(uname_s),Linux CPPFLAGS += -Wshadow endif CPPFLAGS += -Os -CPPFLAGS += -Wall CPPFLAGS += -Wuninitialized CPPFLAGS += -Wchar-subscripts -CPPFLAGS += -Wformat-security CPPFLAGS += -DBINDIR='"$(BINDIR)"' CPPFLAGS += -DBUILD_DATE='"$(build_date)"' CPPFLAGS += -DUNAME_RS='"$(uname_rs)"' CPPFLAGS += -DCODENAME='"$(codename)"' CPPFLAGS += -DCC_VERSION='"$(cc_version)"' CPPFLAGS += -Werror-implicit-function-declaration -CPPFLAGS += -Wmissing-format-attribute CPPFLAGS += -Wmissing-noreturn CPPFLAGS += -Wunused-macros CPPFLAGS += -Wbad-function-cast CPPFLAGS += -fno-strict-aliasing CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F) - CPPFLAGS += @SSL_CPPFLAGS@ -CPPFLAGS += @ncurses_cppflags@ CPPFLAGS += @arch_cppflags@ CPPFLAGS += -I/usr/local/include CPPFLAGS += -I$(cmdline_dir) CPPFLAGS += @osl_cppflags@ -CPPFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' man_pages := $(patsubst %, man/man1/%.1, @executables@) man_pages_in := $(patsubst %, web/%.man.in.html, @executables@) @@@ -101,12 -100,18 +100,12 @@@ els Q = endif -.PHONY: dep all clean distclean maintainer-clean install man tarball\ - .FORCE-GIT-VERSION-FILE +.PHONY: dep all clean distclean maintainer-clean install man tarball all: dep @executables@ $(man_pages) dep: $(deps) man: $(man_pages) tarball: $(tarball) -GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE - @./GIT-VERSION-GEN GIT-VERSION-FILE --include GIT-VERSION-FILE -@executables@: GIT-VERSION-FILE - -include $(ggo_dir)/makefile %_command_list.c: %.cmd @@@ -150,6 -155,9 +149,9 @@@ $(object_dir) $(man_dir): mkdir -p $@ + $(object_dir)/crypt.o: crypt.c | $(object_dir) + @[ -z "$(Q)" ] || echo 'CC $<' + $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @openssl_cppflags@ $< $(object_dir)/spx_common.o: spx_common.c | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @ogg_cppflags@ $< @@@ -190,10 -198,6 +192,10 @@@ $(object_dir)/aac_afh.o: aac_afh.c | $( @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @faad_cppflags@ $< +$(object_dir)/gui%.o: gui%.c | $(object_dir) + @[ -z "$(Q)" ] || echo 'CC $<' + $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) @curses_cppflags@ $< + $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir) @[ -z "$(Q)" ] || echo 'CC $<' $(Q) $(CC) -c $(CPPFLAGS) -Wno-unused-function -o $@ $< @@@ -210,7 -214,6 +212,7 @@@ $(object_dir)/%.d: %.c | $(object_dir @[ -z "$(Q)" ] || echo 'DEP $<' $(Q) ./depend.sh $(object_dir) $(cmdline_dir) $(CPPFLAGS) $< > $@ + recv_objs := $(addprefix $(object_dir)/, @recv_objs@) filter_objs := $(addprefix $(object_dir)/, @filter_objs@) client_objs := $(addprefix $(object_dir)/, @client_objs@) @@@ -246,7 -249,7 +248,7 @@@ para_client: $(client_objs para_gui: $(gui_objs) @[ -z "$(Q)" ] || echo 'LD $@' - $(Q) $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lncurses + $(Q) $(CC) $(LDFLAGS) -o $@ $(gui_objs) -lcurses para_audiod: audiod_command_list.c audiod_command_list.h $(audiod_objs) @[ -z "$(Q)" ] || echo 'LD $@' @@@ -304,7 -307,7 +306,7 @@@ $(tarball): $(cmdline_generated git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \ | tar --delete $(tarball_delete) > $(tarball_pfx).tar mkdir -p $(tarball_pfx)/$(cmdline_dir) - echo $(GIT_VERSION) > $(tarball_pfx)/VERSION + ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION cp -r $(autocrap) $(tarball_pfx) cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir) tar rf $(tarball_pfx).tar $(tarball_pfx)/* diff --combined NEWS index c08197f5,23691951..32957386 --- a/NEWS +++ b/NEWS @@@ -1,15 -1,6 +1,16 @@@ ------------------------------------------------ -0.4.6 (to be announced) "deterministic entropy" ------------------------------------------------ +------------------------------------------- +0.4.7 (to be announced) "infinite rollback" +------------------------------------------- + + - configure: improved options for ogg/vorbis/speex. + - The git version reported by --version always matches HEAD. + - The autogen script detects the number of processors and + runs a parallel make if possible. ++ - Major cleanup of the crypto API. + +------------------------------------------ +0.4.6 (2011-03-31) "deterministic entropy" +------------------------------------------ Lots of ogg/vorbis improvements, the new test suite, enhancements for para_gui and a fair amount of other bug fixes. diff --combined afh.c index 37d71224,53c72116..66c4d1ca --- a/afh.c +++ b/afh.c @@@ -7,7 -7,6 +7,6 @@@ /** \file afh.c Paraslash's standalone audio format handler tool. */ #include - #include #include #include "para.h" @@@ -16,7 -15,6 +15,7 @@@ #include "fd.h" #include "afh.h" #include "error.h" +#include "version.h" static struct afh_args_info conf; /** The list of all status items */ diff --combined audioc.c index adcae715,c05bd14e..8c46b46f --- a/audioc.c +++ b/audioc.c @@@ -8,7 -8,6 +8,6 @@@ #include #include - #include #include "audioc.cmdline.h" #include "para.h" @@@ -16,7 -15,6 +15,7 @@@ #include "net.h" #include "string.h" #include "fd.h" +#include "version.h" INIT_AUDIOC_ERRLISTS; diff --combined audiod.c index 5bc22c81,34a41620..9f664e17 --- a/audiod.c +++ b/audiod.c @@@ -7,9 -7,7 +7,7 @@@ /** \file audiod.c the paraslash's audio daemon */ #include #include - #include #include - #include #include #include "para.h" @@@ -33,7 -31,6 +31,7 @@@ #include "write.h" #include "write_common.h" #include "signal.h" +#include "version.h" /** define the array of error lists needed by para_audiod */ INIT_AUDIOD_ERRLISTS; diff --combined client_common.c index 54bb9433,33ad1954..d3a9ede1 --- a/client_common.c +++ b/client_common.c @@@ -8,8 -8,6 +8,6 @@@ #include #include - #include - #include #include "para.h" #include "error.h" @@@ -17,15 -15,12 +15,13 @@@ #include "sched.h" #include "client.cmdline.h" #include "crypt.h" - #include "rc4.h" #include "net.h" #include "fd.h" #include "string.h" #include "client.cmdline.h" #include "client.h" - #include "hash.h" #include "buffer_tree.h" +#include "version.h" /** The size of the receiving buffer. */ #define CLIENT_BUFSIZE 4000 @@@ -41,8 -36,10 +37,10 @@@ void client_close(struct client_task *c { if (!ct) return; - if (ct->rc4c.fd >= 0) - close(ct->rc4c.fd); + if (ct->scc.fd >= 0) + close(ct->scc.fd); + sc_free(ct->scc.recv); + sc_free(ct->scc.send); free(ct->user); free(ct->config_file); free(ct->key_file); @@@ -70,19 -67,19 +68,19 @@@ static void client_pre_select(struct sc struct client_task *ct = container_of(t, struct client_task, task); struct btr_node *btrn = ct->btrn; - if (ct->rc4c.fd < 0) + if (ct->scc.fd < 0) return; switch (ct->status) { case CL_CONNECTED: case CL_SENT_AUTH: case CL_SENT_CH_RESPONSE: case CL_SENT_COMMAND: - para_fd_set(ct->rc4c.fd, &s->rfds, &s->max_fileno); + para_fd_set(ct->scc.fd, &s->rfds, &s->max_fileno); return; case CL_RECEIVED_WELCOME: case CL_RECEIVED_PROCEED: - para_fd_set(ct->rc4c.fd, &s->wfds, &s->max_fileno); + para_fd_set(ct->scc.fd, &s->wfds, &s->max_fileno); return; case CL_RECEIVING: @@@ -91,7 -88,7 +89,7 @@@ if (ret < 0) sched_min_delay(s); else - para_fd_set(ct->rc4c.fd, &s->rfds, + para_fd_set(ct->scc.fd, &s->rfds, &s->max_fileno); } return; @@@ -101,7 -98,7 +99,7 @@@ if (ret < 0) sched_min_delay(s); else - para_fd_set(ct->rc4c.fd, &s->wfds, + para_fd_set(ct->scc.fd, &s->wfds, &s->max_fileno); } return; @@@ -114,12 -111,12 +112,12 @@@ static int client_recv_buffer(struct cl int ret; if (ct->status < CL_SENT_CH_RESPONSE) - return read_nonblock(ct->rc4c.fd, buf, sz, rfds, n); + return read_nonblock(ct->scc.fd, buf, sz, rfds, n); *n = 0; - ret = rc4_recv_buffer(&ct->rc4c, buf, sz); + ret = sc_recv_buffer(&ct->scc, buf, sz); /* - * rc4_recv_buffer is used with blocking fds elsewhere, so it + * sc_recv_buffer is used with blocking fds elsewhere, so it * does not use the nonblock-API. Therefore we need to * check for EOF and EAGAIN. */ @@@ -155,7 -152,7 +153,7 @@@ static void client_post_select(struct s char buf[CLIENT_BUFSIZE]; t->error = 0; - if (ct->rc4c.fd < 0) + if (ct->scc.fd < 0) return; switch (ct->status) { case CL_CONNECTED: /* receive welcome message */ @@@ -167,40 -164,39 +165,39 @@@ case CL_RECEIVED_WELCOME: /* send auth command */ sprintf(buf, AUTH_REQUEST_MSG "%s", ct->user); PARA_INFO_LOG("--> %s\n", buf); - if (!FD_ISSET(ct->rc4c.fd, &s->wfds)) + if (!FD_ISSET(ct->scc.fd, &s->wfds)) return; - ret = send_buffer(ct->rc4c.fd, buf); + ret = send_buffer(ct->scc.fd, buf); if (ret < 0) goto out; ct->status = CL_SENT_AUTH; return; case CL_SENT_AUTH: /* - * Receive challenge and rc4 keys, decrypt the challenge and + * Receive challenge and session keys, decrypt the challenge and * send back the hash of the decrypted challenge. */ { - /* decrypted challenge/rc4 buffer */ + /* decrypted challenge/session key buffer */ unsigned char crypt_buf[1024]; /* the SHA1 of the decrypted challenge */ - unsigned char challenge_sha1[HASH_SIZE]; + unsigned char challenge_hash[HASH_SIZE]; ret = client_recv_buffer(ct, &s->rfds, buf, sizeof(buf), &n); if (ret < 0 || n == 0) goto out; PARA_INFO_LOG("<-- [challenge] (%zu bytes)\n", n); - ret = para_decrypt_buffer(ct->key_file, crypt_buf, + ret = priv_decrypt(ct->key_file, crypt_buf, (unsigned char *)buf, n); if (ret < 0) goto out; - sha1_hash((char *)crypt_buf, CHALLENGE_SIZE, challenge_sha1); - RC4_set_key(&ct->rc4c.send_key, RC4_KEY_LEN, - crypt_buf + CHALLENGE_SIZE); - RC4_set_key(&ct->rc4c.recv_key, RC4_KEY_LEN, - crypt_buf + CHALLENGE_SIZE + RC4_KEY_LEN); - hash_to_asc(challenge_sha1, buf); + hash_function((char *)crypt_buf, CHALLENGE_SIZE, challenge_hash); + ct->scc.send = sc_new(crypt_buf + CHALLENGE_SIZE, SESSION_KEY_LEN); + ct->scc.recv = sc_new(crypt_buf + CHALLENGE_SIZE + SESSION_KEY_LEN, + SESSION_KEY_LEN); + hash_to_asc(challenge_hash, buf); PARA_INFO_LOG("--> %s\n", buf); - ret = send_bin_buffer(ct->rc4c.fd, (char *)challenge_sha1, + ret = send_bin_buffer(ct->scc.fd, (char *)challenge_hash, HASH_SIZE); if (ret < 0) goto out; @@@ -225,7 -221,7 +222,7 @@@ { int i; char *command = NULL; - if (!FD_ISSET(ct->rc4c.fd, &s->wfds)) + if (!FD_ISSET(ct->scc.fd, &s->wfds)) return; for (i = 0; i < ct->conf.inputs_num; i++) { char *tmp = command; @@@ -235,7 -231,7 +232,7 @@@ } command = para_strcat(command, EOC_MSG "\n"); PARA_DEBUG_LOG("--> %s\n", command); - ret = rc4_send_buffer(&ct->rc4c, command); + ret = sc_send_buffer(&ct->scc, command); free(command); if (ret < 0) goto out; @@@ -269,10 -265,10 +266,10 @@@ goto out; if (ret == 0) return; - if (!FD_ISSET(ct->rc4c.fd, &s->wfds)) + if (!FD_ISSET(ct->scc.fd, &s->wfds)) return; sz = btr_next_buffer(btrn, &buf2); - ret = rc4_send_bin_buffer(&ct->rc4c, buf2, sz); + ret = sc_send_bin_buffer(&ct->scc, buf2, sz); if (ret < 0) goto out; btr_consume(btrn, sz); @@@ -290,7 -286,7 +287,7 @@@ * The FD_ISSET() is not strictly necessary, but is allows us * to skip the malloc below if there is nothing to read anyway. */ - if (!FD_ISSET(ct->rc4c.fd, &s->rfds)) + if (!FD_ISSET(ct->scc.fd, &s->rfds)) return; buf2 = para_malloc(CLIENT_BUFSIZE); ret = client_recv_buffer(ct, &s->rfds, buf2, CLIENT_BUFSIZE, &n); @@@ -316,14 -312,14 +313,14 @@@ static int client_connect(struct client { int ret; - ct->rc4c.fd = -1; + ct->scc.fd = -1; ret = para_connect_simple(IPPROTO_TCP, ct->conf.hostname_arg, ct->conf.server_port_arg); if (ret < 0) return ret; - ct->rc4c.fd = ret; + ct->scc.fd = ret; ct->status = CL_CONNECTED; - ret = mark_fd_nonblocking(ct->rc4c.fd); + ret = mark_fd_nonblocking(ct->scc.fd); if (ret < 0) goto err_out; ct->task.pre_select = client_pre_select; @@@ -332,8 -328,8 +329,8 @@@ register_task(&ct->task); return 1; err_out: - close(ct->rc4c.fd); - ct->rc4c.fd = -1; + close(ct->scc.fd); + ct->scc.fd = -1; return ret; } @@@ -364,7 -360,7 +361,7 @@@ int client_open(int argc, char *argv[] ct->btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "client", .parent = parent, .child = child)); *ct_ptr = ct; - ct->rc4c.fd = -1; + ct->scc.fd = -1; ret = -E_CLIENT_SYNTAX; if (client_cmdline_parser(argc, argv, &ct->conf)) goto out; diff --combined command.c index 24ddf789,1a090e49..d82bd5d7 --- a/command.c +++ b/command.c @@@ -10,8 -10,6 +10,6 @@@ #include #include #include - #include - #include #include #include @@@ -27,7 -25,6 +25,6 @@@ #include "list.h" #include "send.h" #include "vss.h" - #include "rc4.h" #include "net.h" #include "daemon.h" #include "fd.h" @@@ -37,7 -34,6 +34,7 @@@ #include "afs_command_list.h" #include "sched.h" #include "signal.h" +#include "version.h" /** Commands including options must be shorter than this. */ #define MAX_COMMAND_LEN 32768 @@@ -45,7 -41,7 +42,7 @@@ extern int mmd_mutex; extern struct misc_meta_data *mmd; extern struct sender senders[]; - int send_afs_status(struct rc4_context *rc4c, int parser_friendly); + int send_afs_status(struct stream_cipher_context *scc, int parser_friendly); const char *status_item_list[] = {STATUS_ITEM_ARRAY}; @@@ -190,7 -186,7 +187,7 @@@ static int check_sender_args(int argc, return 1; } - int com_sender(struct rc4_context *rc4c, int argc, char * const * argv) + int com_sender(struct stream_cipher_context *scc, int argc, char * const * argv) { int i, ret; char *msg = NULL; @@@ -203,7 -199,7 +200,7 @@@ free(msg); msg = tmp; } - ret = rc4_send_buffer(rc4c, msg); + ret = sc_send_buffer(scc, msg); free(msg); return ret; } @@@ -212,7 -208,7 +209,7 @@@ if (scd.sender_num < 0) return ret; msg = senders[scd.sender_num].help(); - ret = rc4_send_buffer(rc4c, msg); + ret = sc_send_buffer(scc, msg); free(msg); return ret; } @@@ -241,7 -237,7 +238,7 @@@ } /* server info */ - int com_si(struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_si(struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { int i, ret; char *ut; @@@ -256,7 -252,7 +253,7 @@@ free(info); } ut = uptime_str(); - ret = rc4_send_va_buffer(rc4c, "version: " GIT_VERSION "\n" + ret = sc_send_va_buffer(scc, "version: " GIT_VERSION "\n" "up: %s\nplayed: %u\n" "server_pid: %d\n" "afs_pid: %d\n" @@@ -281,11 -277,11 +278,11 @@@ } /* version */ - int com_version(struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_version(struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; - return rc4_send_buffer(rc4c, VERSION_TEXT("server") + return sc_send_buffer(scc, VERSION_TEXT("server") "built: " BUILD_DATE "\n" UNAME_RS ", " CC_VERSION "\n" ); @@@ -347,7 -343,7 +344,7 @@@ static char *empty_status_items(int par #undef EMPTY_STATUS_ITEMS /* stat */ - int com_stat(struct rc4_context *rc4c, int argc, char * const * argv) + int com_stat(struct stream_cipher_context *scc, int argc, char * const * argv) { int i, ret; struct misc_meta_data tmp, *nmmd = &tmp; @@@ -382,7 -378,7 +379,7 @@@ for (;;) { mmd_dup(nmmd); s = get_status(nmmd, parser_friendly); - ret = rc4_send_buffer(rc4c, s); + ret = sc_send_buffer(scc, s); free(s); if (ret < 0) goto out; @@@ -390,11 -386,11 +387,11 @@@ static char *esi; if (!esi) esi = empty_status_items(parser_friendly); - ret = rc4_send_buffer(rc4c, esi); + ret = sc_send_buffer(scc, esi); if (ret < 0) goto out; } else - send_afs_status(rc4c, parser_friendly); + send_afs_status(scc, parser_friendly); ret = 1; if (num > 0 && !--num) goto out; @@@ -406,14 -402,14 +403,14 @@@ out return ret; } - static int send_list_of_commands(struct rc4_context *rc4c, struct server_command *cmd, + static int send_list_of_commands(struct stream_cipher_context *scc, struct server_command *cmd, const char *handler) { int ret, i; for (i = 1; cmd->name; cmd++, i++) { char *perms = cmd_perms_itohuman(cmd->perms); - ret = rc4_send_va_buffer(rc4c, "%s\t%s\t%s\t%s\n", cmd->name, + ret = sc_send_va_buffer(scc, "%s\t%s\t%s\t%s\n", cmd->name, handler, perms, cmd->description); @@@ -446,7 -442,7 +443,7 @@@ static struct server_command *get_cmd_p } /* help */ - int com_help(struct rc4_context *rc4c, int argc, char * const * argv) + int com_help(struct stream_cipher_context *scc, int argc, char * const * argv) { struct server_command *cmd; char *perms, *handler; @@@ -454,16 -450,16 +451,16 @@@ if (argc < 2) { /* no argument given, print list of commands */ - if ((ret = send_list_of_commands(rc4c, server_cmds, "server")) < 0) + if ((ret = send_list_of_commands(scc, server_cmds, "server")) < 0) return ret; - return send_list_of_commands(rc4c, afs_cmds, "afs"); + return send_list_of_commands(scc, afs_cmds, "afs"); } /* argument given for help */ cmd = get_cmd_ptr(argv[1], &handler); if (!cmd) return -E_BAD_CMD; perms = cmd_perms_itohuman(cmd->perms); - ret = rc4_send_va_buffer(rc4c, + ret = sc_send_va_buffer(scc, "%s - %s\n\n" "handler: %s\n" "permissions: %s\n" @@@ -482,7 -478,7 +479,7 @@@ } /* hup */ - int com_hup(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_hup(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -491,7 -487,7 +488,7 @@@ } /* term */ - int com_term(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_term(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -499,7 -495,7 +496,7 @@@ return 1; } - int com_play(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_play(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -512,7 -508,7 +509,7 @@@ } /* stop */ - int com_stop(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_stop(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -525,7 -521,7 +522,7 @@@ } /* pause */ - int com_pause(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_pause(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -540,7 -536,7 +537,7 @@@ } /* next */ - int com_next(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_next(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -552,7 -548,7 +549,7 @@@ } /* nomore */ - int com_nomore(__a_unused struct rc4_context *rc4c, int argc, __a_unused char * const * argv) + int com_nomore(__a_unused struct stream_cipher_context *scc, int argc, __a_unused char * const * argv) { if (argc != 1) return -E_COMMAND_SYNTAX; @@@ -564,7 -560,7 +561,7 @@@ } /* ff */ - int com_ff(__a_unused struct rc4_context *rc4c, int argc, char * const * argv) + int com_ff(__a_unused struct stream_cipher_context *scc, int argc, char * const * argv) { long promille; int ret, backwards = 0; @@@ -603,7 -599,7 +600,7 @@@ out } /* jmp */ - int com_jmp(__a_unused struct rc4_context *rc4c, int argc, char * const * argv) + int com_jmp(__a_unused struct stream_cipher_context *scc, int argc, char * const * argv) { long unsigned int i; int ret; @@@ -657,7 -653,7 +654,7 @@@ static struct server_command *parse_cmd return get_cmd_ptr(buf, NULL); } - static int read_command(struct rc4_context *rc4c, char **result) + static int read_command(struct stream_cipher_context *scc, char **result) { int ret; char buf[4096]; @@@ -667,7 -663,7 +664,7 @@@ size_t numbytes; char *p; - ret = rc4_recv_buffer(rc4c, buf, sizeof(buf)); + ret = sc_recv_buffer(scc, buf, sizeof(buf)); if (ret < 0) goto out; if (!ret) @@@ -712,7 -708,7 +709,7 @@@ static void reset_signals(void * calls this function. * * An RSA-based challenge/response is used to authenticate - * the peer. It that authentication succeeds, a random RC4 + * the peer. It that authentication succeeds, a random * session key is generated and sent back to the peer, * encrypted with its RSA public key. From this point on, * all transfers are crypted with this session key. @@@ -726,20 -722,20 +723,20 @@@ * which terminates the function if the connection was not * authenticated when the timeout expires. * - * \sa alarm(2), rc4(3), crypt.c, crypt.h + * \sa alarm(2), crypt.c, crypt.h */ __noreturn void handle_connect(int fd, const char *peername) { int ret, argc; char buf[4096]; - unsigned char rand_buf[CHALLENGE_SIZE + 2 * RC4_KEY_LEN]; - unsigned char challenge_sha1[HASH_SIZE]; + unsigned char rand_buf[CHALLENGE_SIZE + 2 * SESSION_KEY_LEN]; + unsigned char challenge_hash[HASH_SIZE]; struct user *u; struct server_command *cmd = NULL; char **argv = NULL; char *p, *command = NULL; size_t numbytes; - struct rc4_context rc4c = {.fd = fd}; + struct stream_cipher_context scc = {.fd = fd}; reset_signals(); /* we need a blocking fd here as recv() might return EAGAIN otherwise. */ @@@ -769,7 -765,7 +766,7 @@@ u = lookup_user(p); if (u) { get_random_bytes_or_die(rand_buf, sizeof(rand_buf)); - ret = para_encrypt_buffer(u->rsa, rand_buf, sizeof(rand_buf), + ret = pub_encrypt(u->pubkey, rand_buf, sizeof(rand_buf), (unsigned char *)buf); if (ret < 0) goto net_err; @@@ -798,26 -794,25 +795,25 @@@ if (!u) goto net_err; /* - * The correct response is the sha1 of the first CHALLENGE_SIZE bytes + * The correct response is the hash of the first CHALLENGE_SIZE bytes * of the random data. */ ret = -E_BAD_AUTH; if (numbytes != HASH_SIZE) goto net_err; - sha1_hash((char *)rand_buf, CHALLENGE_SIZE, challenge_sha1); - if (memcmp(challenge_sha1, buf, HASH_SIZE)) + hash_function((char *)rand_buf, CHALLENGE_SIZE, challenge_hash); + if (memcmp(challenge_hash, buf, HASH_SIZE)) goto net_err; /* auth successful */ alarm(0); PARA_INFO_LOG("good auth for %s\n", u->name); - /* init rc4 keys with the second part of the random buffer */ - RC4_set_key(&rc4c.recv_key, RC4_KEY_LEN, rand_buf + CHALLENGE_SIZE); - RC4_set_key(&rc4c.send_key, RC4_KEY_LEN, rand_buf + CHALLENGE_SIZE - + RC4_KEY_LEN); - ret = rc4_send_buffer(&rc4c, PROCEED_MSG); + /* init stream cipher keys with the second part of the random buffer */ + scc.recv = sc_new(rand_buf + CHALLENGE_SIZE, SESSION_KEY_LEN); + scc.send = sc_new(rand_buf + CHALLENGE_SIZE + SESSION_KEY_LEN, SESSION_KEY_LEN); + ret = sc_send_buffer(&scc, PROCEED_MSG); if (ret < 0) goto net_err; - ret = read_command(&rc4c, &command); + ret = read_command(&scc, &command); if (ret == -E_COMMAND_SYNTAX) goto err_out; if (ret < 0) @@@ -837,7 -832,7 +833,7 @@@ argc = ret; PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name, peername); - ret = cmd->handler(&rc4c, argc, argv); + ret = cmd->handler(&scc, argc, argv); free_argv(argv); mutex_lock(mmd_mutex); mmd->num_commands++; @@@ -845,11 -840,13 +841,13 @@@ if (ret >= 0) goto out; err_out: - rc4_send_va_buffer(&rc4c, "%s\n", para_strerror(-ret)); + sc_send_va_buffer(&scc, "%s\n", para_strerror(-ret)); net_err: PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); out: free(command); + sc_free(scc.recv); + sc_free(scc.send); mutex_lock(mmd_mutex); if (cmd && (cmd->perms & AFS_WRITE) && ret >= 0) mmd->events++; diff --combined configure.ac index e5a23438,02018963..32381c6b --- a/configure.ac +++ b/configure.ac @@@ -87,7 -87,7 +87,7 @@@ AC_DEFUN([add_cmdline],[$(for i in $@; all_errlist_objs="server mp3_afh afh_common vss command net string signal time daemon stat crypt http_send close_on_fork ipc acl afh fade amp_filter dccp_send fd user_list chunk_queue afs aft mood score attribute blob ringbuffer - playlist sha1 sched audiod grab_client filter_common wav_filter compress_filter + playlist sched audiod grab_client filter_common wav_filter compress_filter http_recv dccp_recv recv_common write_common file_write audiod_command client_common recv stdout filter stdin audioc write client exec send_common ggo udp_recv udp_send color fec fecdec_filter prebuffer_filter mm @@@ -118,7 -118,7 +118,7 @@@ audiod_cmdline_objs="add_cmdline(audio audiod_errlist_objs="audiod signal string daemon stat net time grab_client filter_common wav_filter compress_filter amp_filter http_recv dccp_recv recv_common fd sched write_common file_write audiod_command crypt fecdec_filter - client_common ggo udp_recv color fec prebuffer_filter sha1 audiod_command_list + client_common ggo udp_recv color fec prebuffer_filter audiod_command_list bitstream imdct wma_common wmadec_filter buffer_tree" audiod_ldflags="-lm" audiod_audio_formats="wma" @@@ -131,7 -131,7 +131,7 @@@ server_cmdline_objs="add_cmdline(server server_errlist_objs="server afh_common mp3_afh vss command net string signal time daemon crypt http_send close_on_fork mm ipc dccp_send fd user_list chunk_queue afs aft mood score attribute - blob playlist sha1 sched acl send_common udp_send color fec + blob playlist sched acl send_common udp_send color fec server_command_list afs_command_list wma_afh wma_common" server_ldflags="" server_audio_formats="mp3 wma" @@@ -145,7 -145,7 +145,7 @@@ default_writer="FILE_WRITE client_cmdline_objs="add_cmdline(client)" client_errlist_objs="client net string crypt fd sched stdin stdout time - client_common sha1 buffer_tree" + client_common buffer_tree" client_ldflags="" gui_cmdline_objs="add_cmdline(gui)" @@@ -273,46 -273,52 +273,52 @@@ f CPPFLAGS="$OLD_CPPFLAGS" LDFLAGS="$OLD_LDFLAGS" LIBS="$OLD_LIBS" - ########################################################################### ssl - dnl @synopsis CHECK_SSL - dnl - dnl based on the follwing macro from the autoconf archive - dnl - dnl @category InstalledPackages - dnl @author Mark Ethan Trostler - dnl @version 2003-01-28 - dnl @license AllPermissive - - AC_DEFUN([CHECK_SSL], - [ - for ssldir in $1 /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do - AC_MSG_CHECKING(for openssl in $ssldir) - if test -f "$ssldir/include/openssl/ssl.h"; then - found_ssl="yes" - AC_MSG_RESULT(yes) - SSL_CFLAGS="-I$ssldir/include" - SSL_CPPFLAGS="-I$ssldir/include" - break - fi - AC_MSG_RESULT(no) - done - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find ssl libraries) - else - SSL_LIBS="-lssl -lcrypto"; - SSL_LDFLAGS="-L$ssldir/lib"; + ###################################################################### openssl + OLD_CPPFLAGS="$CPPFLAGS" + OLD_LD_FLAGS="$LDFLAGS" + OLD_LIBS="$LIBS" + have_openssl="yes" + AC_ARG_WITH(openssl_headers, [AC_HELP_STRING(--with-openssl-headers=dir, + [look for openssl headers also in dir])]) + if test -n "$with_openssl_headers"; then + openssl_cppflags="-I$with_openssl_headers" + CPPFLAGS="$CPPFLAGS $openssl_cppflags" + fi + AC_ARG_WITH(openssl_libs, [AC_HELP_STRING(--with-openssl-libs=dir, + [look for openssl libraries also in dir])]) + if test -n "$with_openssl_libs"; then + openssl_libs="-L$with_openssl_libs" + LDFLAGS="$LDFLAGS $openssl_libs" + fi + AC_CHECK_HEADER(openssl/ssl.h, [], [have_openssl="no"]) + AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"]) + if test "$have_openssl" = "no" -a -z "$with_openssl_headers$with_openssl_libs"; then + # try harder: openssl is sometimes installed in /usr/local/ssl + openssl_cppflags="-I/usr/local/ssl/include" + CPPFLAGS="$CPPFLAGS $openssl_cppflags" + openssl_libs="-L/usr/local/ssl/lib" + LDFLAGS="$LDFLAGS $openssl_libs" + # clear cache + unset ac_cv_header_openssl_ssl_h 2> /dev/null + unset ac_cv_lib_crypto_RAND_bytes 2> /dev/null + AC_CHECK_HEADER(openssl/ssl.h, [have_openssl="yes"], []) + if test "$have_openssl" = "yes"; then + AC_CHECK_LIB([crypto], [RAND_bytes], [], [have_openssl="no"]) fi - AC_SUBST(SSL_CPPFLAGS) - ])dnl - - AC_ARG_ENABLE(ssldir, [AS_HELP_STRING(--enable-ssldir=path, - [Search for openssl also in path.])]) - if test "$enable_ssldir" = "yes"; then enable_ssldir=""; fi - CHECK_SSL($enable_ssldir) - server_ldflags="$server_ldflags $SSL_LDFLAGS $SSL_LIBS" - client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS" - audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS" - + fi + if test "$have_openssl" = "yes"; then + AC_DEFINE(HAVE_OPENSSL, 1, [define to 1 to turn on openssl support]) + AC_SUBST(openssl_cppflags) + openssl_libs="$openssl_libs -lssl -lcrypto" + server_ldflags="$server_ldflags $openssl_libs" + client_ldflags="$client_ldflags $openssl_libs" + audiod_ldflags="$audiod_ldflags $openssl_libs" + else + AC_MSG_ERROR([openssl libraries not found]) + fi + CPPFLAGS="$OLD_CPPFLAGS" + LDFLAGS="$OLD_LDFLAGS" + LIBS="$OLD_LIBS" ########################################################################### libsocket AC_CHECK_LIB([c], [socket], [socket_lib=], @@@ -353,31 -359,31 +359,31 @@@ if test ${have_ucred} = yes; the fi ########################################################################### curses -have_ncurses="yes" +have_curses="yes" OLD_CPPFLAGS="$CPPFLAGS" OLD_LD_FLAGS="$LDFLAGS" OLD_LIBS="$LIBS" -AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir, - [look for ncurses.h also in dir])]) -if test -n "$with_ncurses_headers"; then - ncurses_cppflags="-I$with_ncurses_headers" - CPPFLAGS="$CPPFLAGS $ncurses_cppflags" +AC_ARG_WITH(curses_headers, [AC_HELP_STRING(--with-curses-headers=dir, + [look for curses.h also in dir])]) +if test -n "$with_curses_headers"; then + curses_cppflags="-I$with_curses_headers" + CPPFLAGS="$CPPFLAGS $curses_cppflags" fi -AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir, - [look for libncurses also in dir])]) -if test -n "$with_ncurses_libs"; then - ncurses_libs="-L$with_ncurses_libs" - LDFLAGS="$LDFLAGS $ncurses_libs" +AC_ARG_WITH(curses_libs, [AC_HELP_STRING(--with-curses-libs=dir, + [look for libcurses also in dir])]) +if test -n "$with_curses_libs"; then + curses_libs="-L$with_curses_libs" + LDFLAGS="$LDFLAGS $curses_libs" fi AC_CHECK_HEADER(curses.h, [], [ - have_ncurses="no" + have_curses="no" ]) -AC_CHECK_LIB([ncurses], [initscr], [], [ - have_ncurses="no" +AC_CHECK_LIB([curses], [initscr], [], [ + have_curses="no" ]) -if test "$have_ncurses" = "yes"; then - AC_SUBST(ncurses_cppflags) - AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support]) +if test "$have_curses" = "yes"; then + AC_SUBST(curses_cppflags) + AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on curses support]) extras="$extras gui" executables="$executables gui" else @@@ -430,120 -436,86 +436,120 @@@ if test ${have_core_audio} = yes; the fi ########################################################### ogg/vorbis/speex have_ogg="yes" -have_vorbis="yes" -have_speex="yes" OLD_CPPFLAGS="$CPPFLAGS" OLD_LD_FLAGS="$LDFLAGS" OLD_LIBS="$LIBS" -AC_ARG_WITH(oggvorbis_headers, [AC_HELP_STRING(--with-oggvorbis-headers=dir, - [look for ogg/vorbis/speex headers also in dir])]) -if test -n "$with_oggvorbis_headers"; then - ogg_cppflags="-I$with_oggvorbis_headers" +AC_ARG_WITH(ogg_headers, [AC_HELP_STRING(--with-ogg-headers=dir, + [look for ogg headers also in dir])]) +AC_ARG_WITH(ogg_libs, [AC_HELP_STRING(--with-ogg-libs=dir, + [look for ogg libs also in dir])]) +AC_ARG_WITH(vorbis_headers, [AC_HELP_STRING(--with-vorbis-headers=dir, + [look for vorbis headers also in dir])]) +AC_ARG_WITH(vorbis_libs, [AC_HELP_STRING(--with-vorbis-libs=dir, + [look for vorbis libs also in dir])]) +AC_ARG_WITH(speex_headers, [AC_HELP_STRING(--with-speex-headers=dir, + [look for speex headers also in dir])]) +AC_ARG_WITH(speex_libs, [AC_HELP_STRING(--with-speex-libs=dir, + [look for speex libs also in dir])]) + +if test -n "$with_ogg_headers"; then + ogg_cppflags="-I$with_ogg_headers" CPPFLAGS="$CPPFLAGS $ogg_cppflags" fi -AC_ARG_WITH(oggvorbis_libs, [AC_HELP_STRING(--with-oggvorbis-libs=dir, - [look for ogg/vorbis/speex libs also in dir])]) -if test -n "$with_oggvorbis_libs"; then - ogg_libs="-L$with_oggvorbis_libs" +if test -n "$with_ogg_libs"; then + ogg_libs="-L$with_ogg_libs" LDFLAGS="$LDFLAGS $ogg_libs" fi - -AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ]) -AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ]) -AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ]) AC_CHECK_HEADERS([ogg/ogg.h], [], [ have_ogg="no"; ]) -AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ]) -AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ]) +AC_CHECK_LIB([ogg], [ogg_stream_init], [], [ have_ogg="no" ]) + +have_vorbis="yes" +have_speex="yes" +if test "$have_ogg" = "yes"; then + # vorbis + if test -n "$with_vorbis_headers"; then + vorbis_cppflags="-I$with_vorbis_headers" + CPPFLAGS="$CPPFLAGS $vorbis_cppflags" + fi + if test -n "$with_vorbis_libs"; then + vorbis_libs="-L$with_vorbis_libs" + LDFLAGS="$LDFLAGS $vorbis_libs" + fi + AC_CHECK_HEADERS([vorbis/codec.h], [], [ have_vorbis="no" ]) + AC_CHECK_LIB([vorbis], [vorbis_info_init], [], [ have_vorbis="no" ]) + + # speex + if test -n "$with_speex_headers"; then + speex_cppflags="-I$with_speex_headers" + CPPFLAGS="$CPPFLAGS $speex_cppflags" + fi + if test -n "$with_speex_libs"; then + speex_libs="-L$with_speex_libs" + LDFLAGS="$LDFLAGS $speex_libs" + fi + AC_CHECK_LIB([speex], [speex_decoder_init], [], [ have_speex="no" ]) + AC_CHECK_HEADERS([speex/speex.h], [], [ have_speex="no" ]) +else + have_vorbis="no" + have_speex="no" +fi + msg="support in para_server/para_filter/para_afh" -if test "$have_ogg" = "yes" && { test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; }; then +if test "$have_vorbis" = "yes" || test "$have_speex" = "yes"; then AC_SUBST(ogg_cppflags) ogg_libs="$ogg_libs -logg" if test "$OSTYPE" = "Darwin"; then - ogg_libs="-Wl,-bind_at_load $ogg_libs $ogg_libs" + ogg_libs="-Wl,-bind_at_load $ogg_libs" fi server_ldflags="$server_ldflags $ogg_libs" filter_ldflags="$filter_ldflags $ogg_libs" audiod_ldflags="$audiod_ldflags $ogg_libs" - all_errlist_objs="$all_errlist_objs ogg_afh_common" afh_ldflags="$afh_ldflags $ogg_libs" + all_errlist_objs="$all_errlist_objs ogg_afh_common" afh_errlist_objs="$afh_errlist_objs ogg_afh_common" server_errlist_objs="$server_errlist_objs ogg_afh_common" - if test "$have_vorbis" = "yes"; then - all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh" - AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support) - filters="$filters oggdec" - vorbis_libs="-lvorbis -lvorbisfile" - server_ldflags="$server_ldflags $vorbis_libs" - filter_ldflags="$filter_ldflags $vorbis_libs" - audiod_ldflags="$audiod_ldflags $vorbis_libs" - afh_ldflags="$afh_ldflags $vorbis_libs" - - server_errlist_objs="$server_errlist_objs ogg_afh" - filter_errlist_objs="$filter_errlist_objs oggdec_filter" - audiod_errlist_objs="$audiod_errlist_objs oggdec_filter" - afh_errlist_objs="$afh_errlist_objs ogg_afh" - - audiod_audio_formats="$audiod_audio_formats ogg" - server_audio_formats="$server_audio_formats ogg" - else - AC_MSG_WARN([no ogg/vorbis $msg]) - fi - if test "$have_speex" = "yes"; then - all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common" - AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support) - filters="$filters spxdec" - speex_libs="-lspeex" - server_ldflags="$server_ldflags $speex_libs" - filter_ldflags="$filter_ldflags $speex_libs" - audiod_ldflags="$audiod_ldflags $speex_libs" - afh_ldflags="$afh_ldflags $speex_libs" - - server_errlist_objs="$server_errlist_objs spx_afh spx_common" - filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common" - audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common" - afh_errlist_objs="$afh_errlist_objs spx_afh spx_common" - - audiod_audio_formats="$audiod_audio_formats spx" - server_audio_formats="$server_audio_formats spx" - else - AC_MSG_WARN([no ogg/speex $msg]) - fi else - AC_MSG_WARN([no ogg/vorbis ogg/speex $msg]) + AC_MSG_WARN([vorbis/speex require ogg]) +fi +if test "$have_vorbis" = "yes"; then + all_errlist_objs="$all_errlist_objs oggdec_filter ogg_afh" + AC_DEFINE(HAVE_OGGVORBIS, 1, define to 1 to turn on ogg/vorbis support) + filters="$filters oggdec" + vorbis_libs="-lvorbis -lvorbisfile" + server_ldflags="$server_ldflags $vorbis_libs" + filter_ldflags="$filter_ldflags $vorbis_libs" + audiod_ldflags="$audiod_ldflags $vorbis_libs" + afh_ldflags="$afh_ldflags $vorbis_libs" + + server_errlist_objs="$server_errlist_objs ogg_afh" + filter_errlist_objs="$filter_errlist_objs oggdec_filter" + audiod_errlist_objs="$audiod_errlist_objs oggdec_filter" + afh_errlist_objs="$afh_errlist_objs ogg_afh" + + audiod_audio_formats="$audiod_audio_formats ogg" + server_audio_formats="$server_audio_formats ogg" +else + AC_MSG_WARN([no ogg/vorbis $msg]) +fi +if test "$have_speex" = "yes"; then + all_errlist_objs="$all_errlist_objs spxdec_filter spx_afh spx_common" + AC_DEFINE(HAVE_SPEEX, 1, define to 1 to turn on ogg/speex support) + filters="$filters spxdec" + speex_libs="-lspeex" + server_ldflags="$server_ldflags $speex_libs" + filter_ldflags="$filter_ldflags $speex_libs" + audiod_ldflags="$audiod_ldflags $speex_libs" + afh_ldflags="$afh_ldflags $speex_libs" + + server_errlist_objs="$server_errlist_objs spx_afh spx_common" + filter_errlist_objs="$filter_errlist_objs spxdec_filter spx_common" + audiod_errlist_objs="$audiod_errlist_objs spxdec_filter spx_common" + afh_errlist_objs="$afh_errlist_objs spx_afh spx_common" + + audiod_audio_formats="$audiod_audio_formats spx" + server_audio_formats="$server_audio_formats spx" +else + AC_MSG_WARN([no ogg/speex $msg]) fi CPPFLAGS="$OLD_CPPFLAGS" LDFLAGS="$OLD_LDFLAGS" diff --combined error.h index fdd2d3b7,564f1339..2e32c240 --- a/error.h +++ b/error.h @@@ -19,7 -19,6 +19,6 @@@ DEFINE_ERRLIST_OBJECT_ENUM #define GUI_ERRORS #define RINGBUFFER_ERRORS #define SCORE_ERRORS - #define SHA1_ERRORS #define RBTREE_ERRORS #define RECV_ERRORS #define IPC_ERRORS @@@ -273,6 -272,7 +272,6 @@@ extern const char **para_errlist[] #define AUDIOD_COMMAND_ERRORS \ PARA_ERROR(CLIENT_WRITE, "client write error"), \ - PARA_ERROR(AUDIOD_SYNTAX, "syntax error"), \ PARA_ERROR(UCRED_PERM, "permission denied"), \ PARA_ERROR(INVALID_AUDIOD_CMD, "invalid command"), \ PARA_ERROR(TOO_MANY_CLIENTS, "maximal number of stat clients exceeded"), \ @@@ -392,6 -392,7 +391,6 @@@ #define WRITE_ERRORS \ PARA_ERROR(WRITE_SYNTAX, "para_write syntax error"), \ - PARA_ERROR(NO_WAV_HEADER, "wave header not found"), \ #define ALSA_WRITE_ERRORS \ diff --combined fade.c index 41b4a6d7,e0ab967c..04ca9237 --- a/fade.c +++ b/fade.c @@@ -8,7 -8,6 +8,6 @@@ #include #include - #include #include #include #include /* EXIT_SUCCESS */ @@@ -23,7 -22,6 +22,7 @@@ #include "fd.h" #include "string.h" #include "error.h" +#include "version.h" INIT_FADE_ERRLISTS; static struct fade_args_info conf; diff --combined grab_client.c index a85e42a9,0d3b6036..9109c2f8 --- a/grab_client.c +++ b/grab_client.c @@@ -8,7 -8,6 +8,6 @@@ #include #include - #include #include #include "para.h" @@@ -62,9 -61,9 +61,9 @@@ struct grab_client }; /* Grab clients that are attached to a btr node. */ -INITIALIZED_LIST_HEAD(active_grab_client_list); +static INITIALIZED_LIST_HEAD(active_grab_client_list); /* Grab clients that are not currently attached any btr node. */ -INITIALIZED_LIST_HEAD(inactive_grab_client_list); +static INITIALIZED_LIST_HEAD(inactive_grab_client_list); static int gc_write(struct grab_client *gc, char *buf, size_t len) { @@@ -131,12 -130,13 +130,12 @@@ static void gc_activate(struct grab_cli list_move(&gc->node, &active_grab_client_list); gc->btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = name, .parent = parent)); - if (!gc->task.pre_select) { - gc->task.pre_select = gc_pre_select; - gc->task.post_select = gc_post_select; - snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name); - gc->task.status[sizeof(gc->task.status) - 1] = '\0'; - register_task(&gc->task); - } + gc->task.pre_select = gc_pre_select; + gc->task.post_select = gc_post_select; + snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name); + gc->task.status[sizeof(gc->task.status) - 1] = '\0'; + gc->task.error = 0; + register_task(&gc->task); } /** @@@ -155,7 -155,7 +154,7 @@@ void activate_grab_clients(void struct grab_client *gc, *tmp; list_for_each_entry_safe(gc, tmp, &inactive_grab_client_list, node) { - if (gc->task.error < 0) { + if (gc->fd < 0) { list_del(&gc->node); free(gc); continue; @@@ -178,11 -178,11 +177,11 @@@ static int gc_close(struct grab_client * post_select(). */ close(gc->fd); + gc->fd = -1; free(gc->parent); free(gc->name); return 1; } - gc_activate(gc); return 0; } @@@ -209,8 -209,7 +208,8 @@@ static void gc_post_select(__a_unused s btr_consume(btrn, ret); return; err: - t->error = gc_close(gc, ret)? ret : 0; + gc_close(gc, ret); + t->error = ret; } static int gc_check_args(int argc, char **argv, struct grab_client *gc) diff --combined gui.c index 578eeed0,29089244..c8721565 --- a/gui.c +++ b/gui.c @@@ -9,7 -9,6 +9,6 @@@ #include #include #include - #include #include #include "gui.cmdline.h" @@@ -22,7 -21,6 +21,7 @@@ #include "list.h" #include "sched.h" #include "signal.h" +#include "version.h" /** define the array of error lists needed by para_gui */ INIT_GUI_ERRLISTS; @@@ -34,10 -32,10 +33,10 @@@ static int signal_pipe static struct win_data { WINDOW *win; - NCURSES_SIZE_T begx; - NCURSES_SIZE_T begy; - NCURSES_SIZE_T cols; - NCURSES_SIZE_T lines; + size_t begx; + size_t begy; + size_t cols; + size_t lines; } top, bot, sb, in, sep; #define RINGBUFFER_SIZE 512 diff --combined recv.c index ae8a1f66,8e6d75b1..52f457fc --- a/recv.c +++ b/recv.c @@@ -8,7 -8,6 +8,6 @@@ #include #include - #include #include #include "para.h" @@@ -22,7 -21,6 +21,7 @@@ #include "error.h" #include "stdout.h" #include "buffer_tree.h" +#include "version.h" /** The gengetopt args info struct. */ static struct recv_args_info conf; diff --combined server.c index 4d54f74b,0ae888fa..e8dddf5b --- a/server.c +++ b/server.c @@@ -57,15 -57,12 +57,12 @@@ * * - Doubly linked lists: \ref list.h, * - Ring buffer: \ref ringbuffer.c, \ref ringbuffer.h, - * - Hashing: \ref hash.h, \ref sha1.h, \ref sha1.c, - * - Crypto: \ref crypt.c. + * - Crypto: \ref crypt.c, \ref crypt.h. * - Forward error correction: \ref fec.c. */ #include - #include #include - #include #include #include #include @@@ -91,7 -88,6 +88,7 @@@ #include "signal.h" #include "user_list.h" #include "color.h" +#include "version.h" /** Define the array of error lists needed by para_server. */ INIT_SERVER_ERRLISTS; diff --combined write.c index 571dc4ed,8ddd51a9..6b574414 --- a/write.c +++ b/write.c @@@ -8,7 -8,6 +8,6 @@@ #include #include - #include #include #include "para.h" @@@ -23,7 -22,6 +22,7 @@@ #include "write_common.h" #include "fd.h" #include "error.h" +#include "version.h" INIT_WRITE_ERRLISTS;