=== modified file 'TODO' --- TODO 2008-08-02 10:48:24 +0000 +++ TODO 2008-08-02 14:33:47 +0000 @@ -1,31 +1,35 @@ -[Mandos client] -configuration for OpenPGP key dir -header files/symbols tally -check exit codes of all system calls -IPv4 support -protocol version header -use strsep instead of strtok? - -[Pluginbasedclient] -header files/symbols tally -check exit codes of all system calls -change uid to nobody:nogroup - other drop privs stuff? -pass things in environment, like device name, etc - Does cryptsetup already do this? -use strsep instead of strtok? - -[Server] -config for: - TXT record -protocol version header -Run-time communication with server - probably using D-Bus - -[Mandos-tools/utilities] - List clients - Enable client - Disable client - -[Installer] -... +-*- org -*- + +* Mandos client +** header files/symbols tally +** check exit codes of all system calls +** IPv4 support +** protocol version header +** use strsep instead of strtok? + +* Pluginbasedclient +** header files/symbols tally +** check exit codes of all system calls +** change uid to nobody:nogroup + other drop privs stuff? +** pass things in environment, like device name, etc + Does cryptsetup already do this? +** use strsep instead of strtok? + +* Server +** config for: +*** TXT record +** protocol version header +** Run-time communication with server + probably using D-Bus + +* Mandos-tools/utilities + All of this probably using D-Bus +** List clients +** Enable client +** Disable client + +* Installer + + +#+STARTUP: showall === modified file 'plugins.d/mandosclient.c' --- plugins.d/mandosclient.c 2008-08-01 06:33:15 +0000 +++ plugins.d/mandosclient.c 2008-08-02 14:33:47 +0000 @@ -69,9 +69,9 @@ #define BUFFER_SIZE 256 #define DH_BITS 1024 -const char *certdir = "/conf/conf.d/cryptkeyreq/"; -const char *certfile = "openpgp-client.txt"; -const char *certkey = "openpgp-client-key.txt"; +static const char *certdir = "/conf/conf.d/mandos"; +static const char *certfile = "openpgp-client.txt"; +static const char *certkey = "openpgp-client-key.txt"; bool debug = false; @@ -82,8 +82,9 @@ } encrypted_session; -ssize_t pgp_packet_decrypt (char *packet, size_t packet_size, - char **new_packet, const char *homedir){ +static ssize_t pgp_packet_decrypt (char *packet, size_t packet_size, + char **new_packet, + const char *homedir){ gpgme_data_t dh_crypto, dh_plain; gpgme_ctx_t ctx; gpgme_error_t rc; @@ -245,12 +246,12 @@ return ret; } -void debuggnutls(__attribute__((unused)) int level, - const char* string){ +static void debuggnutls(__attribute__((unused)) int level, + const char* string){ fprintf(stderr, "%s", string); } -int initgnutls(encrypted_session *es){ +static int initgnutls(encrypted_session *es){ const char *err; int ret; @@ -344,11 +345,11 @@ return 0; } -void empty_log(__attribute__((unused)) AvahiLogLevel level, - __attribute__((unused)) const char *txt){} +static void empty_log(__attribute__((unused)) AvahiLogLevel level, + __attribute__((unused)) const char *txt){} -int start_mandos_communication(const char *ip, uint16_t port, - AvahiIfIndex if_index){ +static int start_mandos_communication(const char *ip, uint16_t port, + AvahiIfIndex if_index){ int ret, tcp_sd; struct sockaddr_in6 to; encrypted_session es; @@ -627,19 +628,23 @@ } } -/* combinds file name and path and returns the malloced new string. som sane checks could/should be added */ -const char *combinepath(const char *first, const char *second){ - char *tmp; - tmp = malloc(strlen(first) + strlen(second) + 2); +/* Combines file name and path and returns the malloced new + string. some sane checks could/should be added */ +static const char *combinepath(const char *first, const char *second){ + size_t f_len = strlen(first); + size_t s_len = strlen(second); + char *tmp = malloc(f_len + s_len + 2); if (tmp == NULL){ - perror("malloc"); return NULL; } - strcpy(tmp, first); - if (first[0] != '\0' and first[strlen(first) - 1] != '/'){ - strcat(tmp, "/"); - } - strcat(tmp, second); + if(f_len > 0){ + memcpy(tmp, first, f_len); + } + tmp[f_len] = '/'; + if(s_len > 0){ + memcpy(tmp + f_len + 1, second, s_len); + } + tmp[f_len + 1 + s_len] = '\0'; return tmp; } @@ -694,9 +699,10 @@ exit(EXIT_FAILURE); } } - + certfile = combinepath(certdir, certfile); if (certfile == NULL){ + perror("combinepath"); goto exit; } @@ -734,6 +740,7 @@ certkey = combinepath(certdir, certkey); if (certkey == NULL){ + perror("combinepath"); goto exit; }