projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #699 from marekbecka/innodb_stats
[collectd.git]
/
src
/
libcollectdclient
/
network_buffer.c
diff --git
a/src/libcollectdclient/network_buffer.c
b/src/libcollectdclient/network_buffer.c
index
5553d82
..
61c7c22
100644
(file)
--- a/
src/libcollectdclient/network_buffer.c
+++ b/
src/libcollectdclient/network_buffer.c
@@
-44,12
+44,19
@@
*/
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# endif
*/
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# endif
+/* FreeBSD's copy of libgcrypt extends the existing GCRYPT_NO_DEPRECATED
+ * to properly hide all deprecated functionality.
+ * http://svnweb.freebsd.org/ports/head/security/libgcrypt/files/patch-src__gcrypt.h.in
+ */
+# define GCRYPT_NO_DEPRECATED
# include <gcrypt.h>
# if defined __APPLE__
/* Re enable deprecation warnings */
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# endif
# include <gcrypt.h>
# if defined __APPLE__
/* Re enable deprecation warnings */
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# endif
+# if GCRYPT_VERSION_NUMBER < 0x010600
GCRY_THREAD_OPTION_PTHREAD_IMPL;
GCRY_THREAD_OPTION_PTHREAD_IMPL;
+# endif
#endif
#include "collectd/network_buffer.h"
#endif
#include "collectd/network_buffer.h"
@@
-101,9
+108,11
@@
struct lcc_network_buffer_s
char *username;
char *password;
char *username;
char *password;
+#if HAVE_LIBGCRYPT
gcry_cipher_hd_t encr_cypher;
size_t encr_header_len;
char encr_iv[16];
gcry_cipher_hd_t encr_cypher;
size_t encr_header_len;
char encr_iv[16];
+#endif
};
#define SSTRNCPY(dst,src,sz) do { \
};
#define SSTRNCPY(dst,src,sz) do { \
@@
-123,7
+132,10
@@
static _Bool have_gcrypt (void) /* {{{ */
return (result);
need_init = 0;
return (result);
need_init = 0;
+#if HAVE_LIBGCRYPT
+# if GCRYPT_VERSION_NUMBER < 0x010600
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+# endif
if (!gcry_check_version (GCRYPT_VERSION))
return (0);
if (!gcry_check_version (GCRYPT_VERSION))
return (0);
@@
-133,8
+145,12
@@
static _Bool have_gcrypt (void) /* {{{ */
result = 1;
return (1);
result = 1;
return (1);
+#else
+ return(0);
+#endif
} /* }}} _Bool have_gcrypt */
} /* }}} _Bool have_gcrypt */
+#ifndef HAVE_HTONLL
static uint64_t htonll (uint64_t val) /* {{{ */
{
static int config = 0;
static uint64_t htonll (uint64_t val) /* {{{ */
{
static int config = 0;
@@
-164,6
+180,7
@@
static uint64_t htonll (uint64_t val) /* {{{ */
return ((((uint64_t) lo) << 32) | ((uint64_t) hi));
} /* }}} uint64_t htonll */
return ((((uint64_t) lo) << 32) | ((uint64_t) hi));
} /* }}} uint64_t htonll */
+#endif
static double htond (double val) /* {{{ */
{
static double htond (double val) /* {{{ */
{
@@
-489,6
+506,7
@@
static int nb_add_value_list (lcc_network_buffer_t *nb, /* {{{ */
return (0);
} /* }}} int nb_add_value_list */
return (0);
} /* }}} int nb_add_value_list */
+#if HAVE_LIBGCRYPT
static int nb_add_signature (lcc_network_buffer_t *nb) /* {{{ */
{
char *buffer;
static int nb_add_signature (lcc_network_buffer_t *nb) /* {{{ */
{
char *buffer;
@@
-615,6
+633,7
@@
static int nb_add_encryption (lcc_network_buffer_t *nb) /* {{{ */
return (0);
} /* }}} int nb_add_encryption */
return (0);
} /* }}} int nb_add_encryption */
+#endif
/*
* Public functions
/*
* Public functions
@@
-715,6
+734,7
@@
int lcc_network_buffer_initialize (lcc_network_buffer_t *nb) /* {{{ */
nb->ptr = nb->buffer;
nb->free = nb->size;
nb->ptr = nb->buffer;
nb->free = nb->size;
+#if HAVE_LIBGCRYPT
if (nb->seclevel == SIGN)
{
size_t username_len;
if (nb->seclevel == SIGN)
{
size_t username_len;
@@
-760,6
+780,7
@@
int lcc_network_buffer_initialize (lcc_network_buffer_t *nb) /* {{{ */
ADD_GENERIC (nb, hash, sizeof (hash));
assert ((nb->encr_header_len + nb->free) == nb->size);
}
ADD_GENERIC (nb, hash, sizeof (hash));
assert ((nb->encr_header_len + nb->free) == nb->size);
}
+#endif
return (0);
} /* }}} int lcc_network_buffer_initialize */
return (0);
} /* }}} int lcc_network_buffer_initialize */
@@
-769,10
+790,12
@@
int lcc_network_buffer_finalize (lcc_network_buffer_t *nb) /* {{{ */
if (nb == NULL)
return (EINVAL);
if (nb == NULL)
return (EINVAL);
+#if HAVE_LIBGCRYPT
if (nb->seclevel == SIGN)
nb_add_signature (nb);
else if (nb->seclevel == ENCRYPT)
nb_add_encryption (nb);
if (nb->seclevel == SIGN)
nb_add_signature (nb);
else if (nb->seclevel == ENCRYPT)
nb_add_encryption (nb);
+#endif
return (0);
} /* }}} int lcc_network_buffer_finalize */
return (0);
} /* }}} int lcc_network_buffer_finalize */