diff options
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | glusterfs.spec.in | 4 | ||||
-rw-r--r-- | libglusterfs/src/Makefile.am | 7 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/checksum.c | 34 | ||||
-rw-r--r-- | libglusterfs/src/checksum.h | 6 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 14 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/Makefile.am | 16 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/Makefile.am | 24 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 26 | ||||
-rw-r--r-- | xlators/nfs/server/src/Makefile.am | 10 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/Makefile.am | 1 | ||||
-rw-r--r-- | xlators/protocol/server/src/Makefile.am | 3 | ||||
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 5 | ||||
-rw-r--r-- | xlators/storage/posix/src/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 1 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.c | 10 |
19 files changed, 100 insertions, 93 deletions
diff --git a/configure.ac b/configure.ac index 6605deace..2d3dea10f 100644 --- a/configure.ac +++ b/configure.ac @@ -198,8 +198,10 @@ fi AC_CHECK_TOOL([LD],[ld]) +AC_CHECK_LIB([crypto], [MD5], , AC_MSG_ERROR([OpenSSL crypto library is required to build glusterfs])) + AC_CHECK_LIB([pthread], [pthread_mutex_init], , AC_MSG_ERROR([Posix threads library is required to build glusterfs])) - + AC_CHECK_FUNC([dlopen], [has_dlopen=yes], AC_CHECK_LIB([dl], [dlopen], , AC_MSG_ERROR([Dynamic linking library required to build glusterfs]))) @@ -207,6 +209,8 @@ AC_CHECK_HEADERS([sys/xattr.h]) AC_CHECK_HEADERS([sys/extattr.h]) +AC_CHECK_HEADERS([openssl/md5.h]) + case $host_os in darwin*) if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 5; then @@ -481,7 +485,7 @@ case $host_os in GF_LDADD="${ARGP_STANDALONE_LDADD}" if test "x$ac_cv_header_execinfo_h" = "xyes"; then GF_GLUSTERFS_LDFLAGS="-lexecinfo" - fi + fi BUILD_FUSE_CLIENT=no ;; darwin*) @@ -522,7 +526,7 @@ AC_SUBST(CONTRIBDIR) INCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid' AC_SUBST(INCLUDES) -AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS") +AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS") AC_OUTPUT diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 23ef8fae2..4c9a3b411 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -48,11 +48,12 @@ Requires(postun): /sbin/service BuildRequires: bison flex BuildRequires: gcc make automake libtool -BuildRequires: ncurses-devel readline-devel +BuildRequires: ncurses-devel readline-devel openssl-devel BuildRequires: python-ctypes %if 0%{?suse_version} BuildRequires: python-devel %endif +Requires: openssl Obsoletes: %{name}-libs <= 2.0.0 Obsoletes: %{name}-common < %{version}-%{release} @@ -139,6 +140,7 @@ Summary: Clustered file-system server Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Requires: %{name}-fuse = %{version}-%{release} +Requires: openssl %description server GlusterFS is a clustered file-system capable of scaling to several diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index c7f3d9ba7..2dab8735c 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -4,8 +4,7 @@ libglusterfs_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) \ libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 \ -D_GNU_SOURCE -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \ -D$(GF_HOST_OS) -I$(CONTRIBDIR)/rbtree \ - -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" \ - -I$(CONTRIBDIR)/md5 + -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" libglusterfs_la_LIBADD = @LEXLIB@ @@ -17,7 +16,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ hashfn.c defaults.c common-utils.c timer.c inode.c call-stub.c \ compat.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c \ iobuf.c globals.c statedump.c stack.c checksum.c daemon.c \ - $(CONTRIBDIR)/md5/md5.c $(CONTRIBDIR)/rbtree/rb.c rbthash.c latency.c \ + $(CONTRIBDIR)/rbtree/rb.c rbthash.c latency.c \ graph.c $(CONTRIBDIR)/uuid/clear.c $(CONTRIBDIR)/uuid/copy.c \ $(CONTRIBDIR)/uuid/gen_uuid.c $(CONTRIBDIR)/uuid/pack.c \ $(CONTRIBDIR)/uuid/parse.c $(CONTRIBDIR)/uuid/unparse.c \ @@ -33,7 +32,7 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h \ logging.h xlator.h stack.h timer.h list.h inode.h call-stub.h compat.h \ fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h \ gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h \ - checksum.h daemon.h $(CONTRIBDIR)/md5/md5.h $(CONTRIBDIR)/rbtree/rb.h \ + checksum.h daemon.h $(CONTRIBDIR)/rbtree/rb.h \ rbthash.h iatt.h latency.h mem-types.h $(CONTRIBDIR)/uuid/uuidd.h \ $(CONTRIBDIR)/uuid/uuid.h $(CONTRIBDIR)/uuid/uuidP.h \ $(CONTRIB_BUILDDIR)/uuid/uuid_types.h syncop.h graph-utils.h trie.h run.h \ diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 01e919d69..308a9ad1f 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -22,9 +22,9 @@ #include "config.h" #endif +#include <openssl/md5.h> #include <inttypes.h> -#include "md5.h" #include "call-stub.h" #include "mem-types.h" @@ -2124,7 +2124,7 @@ fop_rchecksum_cbk_stub (call_frame_t *frame, weak_checksum; stub->args.rchecksum_cbk.strong_checksum = - memdup (strong_checksum, MD5_DIGEST_LEN); + memdup (strong_checksum, MD5_DIGEST_LENGTH); } if (xdata) stub->xdata = dict_ref (xdata); diff --git a/libglusterfs/src/checksum.c b/libglusterfs/src/checksum.c index cea782293..7575b2f15 100644 --- a/libglusterfs/src/checksum.c +++ b/libglusterfs/src/checksum.c @@ -17,12 +17,10 @@ <http://www.gnu.org/licenses/>. */ -#include <inttypes.h> +#include <openssl/md5.h> +#include <stdint.h> #include "glusterfs.h" -#include "md5.h" -#include "checksum.h" - /* * The "weak" checksum required for the rsync algorithm, @@ -31,22 +29,26 @@ * * "a simple 32 bit checksum that can be upadted from either end * (inspired by Mark Adler's Adler-32 checksum)" + * + * Note: these functions are only called to compute checksums on + * pathnames; they don't need to handle arbitrarily long strings of + * data. Thus int32_t and uint32_t are sufficient */ uint32_t -gf_rsync_weak_checksum (char *buf1, int32_t len) +gf_rsync_weak_checksum (unsigned char *buf, size_t len) { - int32_t i; + int32_t i = 0; uint32_t s1, s2; - signed char *buf = (signed char *) buf1; uint32_t csum; s1 = s2 = 0; - for (i = 0; i < (len-4); i+=4) { - s2 += 4*(s1 + buf[i]) + 3*buf[i+1] + 2*buf[i+2] + buf[i+3]; - - s1 += buf[i+0] + buf[i+1] + buf[i+2] + buf[i+3]; + if (len >= 4) { + for (; i < (len-4); i+=4) { + s2 += 4*(s1 + buf[i]) + 3*buf[i+1] + 2*buf[i+2] + buf[i+3]; + s1 += buf[i+0] + buf[i+1] + buf[i+2] + buf[i+3]; + } } for (; i < len; i++) { @@ -66,13 +68,7 @@ gf_rsync_weak_checksum (char *buf1, int32_t len) */ void -gf_rsync_strong_checksum (char *buf, int32_t len, uint8_t *sum) +gf_rsync_strong_checksum (unsigned char *data, size_t len, unsigned char *md5) { - md_context m; - - md5_begin (&m); - md5_update (&m, (unsigned char *) buf, len); - md5_result (&m, (unsigned char *) sum); - - return; + MD5(data, len, md5); } diff --git a/libglusterfs/src/checksum.h b/libglusterfs/src/checksum.h index 3542036bf..19221b922 100644 --- a/libglusterfs/src/checksum.h +++ b/libglusterfs/src/checksum.h @@ -20,8 +20,10 @@ #ifndef __CHECKSUM_H__ #define __CHECKSUM_H__ -uint32_t gf_rsync_weak_checksum (char *buf, int32_t len); +uint32_t +gf_rsync_weak_checksum (unsigned char *buf, size_t len); -void gf_rsync_strong_checksum (char *buf, int32_t len, uint8_t *sum); +void +gf_rsync_strong_checksum (unsigned char *buf, size_t len, unsigned char *sum); #endif /* __CHECKSUM_H__ */ diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index f26d2bdc3..c5080246a 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -52,7 +52,6 @@ #include "glusterfs.h" #include "stack.h" #include "globals.h" -#include "md5.h" #include "lkowner.h" #ifndef AI_ADDRCONFIG @@ -1786,19 +1785,6 @@ lkowner_utoa_r (gf_lkowner_t *lkowner, char *dst, int len) return dst; } -void _get_md5_str (char *out_str, size_t outlen, - const uint8_t *input, int n) -{ - uint8_t out[MD5_DIGEST_LEN] = {0}; - int j = 0; - - GF_ASSERT (outlen >= (2*MD5_DIGEST_LEN + 1)); - get_md5 (out, input, n); - for (j = 0; j < MD5_DIGEST_LEN; j++) - snprintf(out_str + j * 2, outlen-j*2, "%02x", out[j]); - -} - void* gf_array_elem (void *a, int index, size_t elem_size) { uint8_t* ptr = a; diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 3aa0143d2..9d98975e1 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -482,8 +482,6 @@ char *uuid_utoa_r (uuid_t uuid, char *dst); char *lkowner_utoa (gf_lkowner_t *lkowner); char *lkowner_utoa_r (gf_lkowner_t *lkowner, char *dst, int len); -void _get_md5_str (char *out_str, size_t outlen, - const uint8_t *input, int n); void gf_array_insertionsort (void *a, int l, int r, size_t elem_size, gf_cmp cmp); int gf_is_str_int (const char *value); diff --git a/xlators/cluster/afr/src/Makefile.am b/xlators/cluster/afr/src/Makefile.am index ed0901813..95db5dd96 100644 --- a/xlators/cluster/afr/src/Makefile.am +++ b/xlators/cluster/afr/src/Makefile.am @@ -1,7 +1,11 @@ xlator_LTLIBRARIES = afr.la pump.la xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/cluster -afr_common_source = afr-dir-read.c afr-dir-write.c afr-inode-read.c afr-inode-write.c afr-open.c afr-transaction.c afr-self-heal-data.c afr-self-heal-common.c afr-self-heal-metadata.c afr-self-heal-entry.c afr-self-heal-algorithm.c afr-lk-common.c afr-self-heald.c $(top_builddir)/xlators/lib/src/libxlator.c +afr_common_source = afr-dir-read.c afr-dir-write.c afr-inode-read.c \ + afr-inode-write.c afr-open.c afr-transaction.c afr-self-heal-data.c \ + afr-self-heal-common.c afr-self-heal-metadata.c afr-self-heal-entry.c \ + afr-self-heal-algorithm.c afr-lk-common.c afr-self-heald.c \ + $(top_builddir)/xlators/lib/src/libxlator.c afr_la_LDFLAGS = -module -avoidversion afr_la_SOURCES = $(afr_common_source) afr.c @@ -11,11 +15,15 @@ pump_la_LDFLAGS = -module -avoidversion pump_la_SOURCES = $(afr_common_source) pump.c pump_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -noinst_HEADERS = afr.h afr-transaction.h afr-inode-write.h afr-inode-read.h afr-dir-read.h afr-dir-write.h afr-self-heal.h afr-self-heal-common.h afr-self-heal-algorithm.h pump.h afr-mem-types.h afr-common.c afr-self-heald.h $(top_builddir)/xlators/lib/src/libxlator.h $(top_builddir)/glusterfsd/src/glusterfsd.h +noinst_HEADERS = afr.h afr-transaction.h afr-inode-write.h afr-inode-read.h \ + afr-dir-read.h afr-dir-write.h afr-self-heal.h afr-self-heal-common.h \ + afr-self-heal-algorithm.h pump.h afr-mem-types.h afr-common.c \ + afr-self-heald.h $(top_builddir)/xlators/lib/src/libxlator.h \ + $(top_builddir)/glusterfsd/src/glusterfsd.h AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \ - -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/contrib/md5 -shared -nostartfiles $(GF_CFLAGS) \ - -I$(top_srcdir)/xlators/lib/src -I$(top_srcdir)/rpc/rpc-lib/src + -I$(top_srcdir)/libglusterfs/src -I$(top_srcdir)/xlators/lib/src \ + -I$(top_srcdir)/rpc/rpc-lib/src -shared -nostartfiles $(GF_CFLAGS) CLEANFILES = diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index bf787339b..6bd0adcd8 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -18,6 +18,7 @@ */ +#include <openssl/md5.h> #include "glusterfs.h" #include "afr.h" #include "xlator.h" @@ -33,7 +34,6 @@ #include "compat-errno.h" #include "compat.h" #include "byte-order.h" -#include "md5.h" #include "afr-transaction.h" #include "afr-self-heal.h" @@ -239,7 +239,7 @@ sh_loop_frame_create (call_frame_t *sh_frame, xlator_t *this, gf_afr_mt_char); if (!new_loop_sh->write_needed) goto out; - new_loop_sh->checksum = GF_CALLOC (priv->child_count, MD5_DIGEST_LEN, + new_loop_sh->checksum = GF_CALLOC (priv->child_count, MD5_DIGEST_LENGTH, gf_afr_mt_uint8_t); if (!new_loop_sh->checksum) goto out; @@ -590,8 +590,8 @@ sh_diff_checksum_cbk (call_frame_t *loop_frame, void *cookie, xlator_t *this, strerror (op_errno)); sh->op_failed = 1; } else { - memcpy (loop_sh->checksum + child_index * MD5_DIGEST_LEN, - strong_checksum, MD5_DIGEST_LEN); + memcpy (loop_sh->checksum + child_index * MD5_DIGEST_LENGTH, + strong_checksum, MD5_DIGEST_LENGTH); } call_count = afr_frame_return (loop_frame); @@ -601,9 +601,9 @@ sh_diff_checksum_cbk (call_frame_t *loop_frame, void *cookie, xlator_t *this, if (sh->sources[i] || !sh_local->child_up[i]) continue; - if (memcmp (loop_sh->checksum + (i * MD5_DIGEST_LEN), - loop_sh->checksum + (sh->source * MD5_DIGEST_LEN), - MD5_DIGEST_LEN)) { + if (memcmp (loop_sh->checksum + (i * MD5_DIGEST_LENGTH), + loop_sh->checksum + (sh->source * MD5_DIGEST_LENGTH), + MD5_DIGEST_LENGTH)) { /* Checksums differ, so this block must be written to this sink diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am index 8a9248daa..d11dd2af2 100644 --- a/xlators/mgmt/glusterd/src/Makefile.am +++ b/xlators/mgmt/glusterd/src/Makefile.am @@ -1,10 +1,11 @@ xlator_LTLIBRARIES = glusterd.la xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt glusterd_la_CPPFLAGS = "-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\"" -glusterd_la_LDFLAGS = -module -avoidversion $(LIBXML2_LIBS) -glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c glusterd-op-sm.c \ - glusterd-utils.c glusterd-rpc-ops.c glusterd-store.c glusterd-handshake.c \ - glusterd-pmap.c glusterd-volgen.c glusterd-rebalance.c glusterd-quota.c \ +glusterd_la_LDFLAGS = -module -avoidversion $(LIBXML2_LIBS) -lcrypto +glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \ + glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \ + glusterd-store.c glusterd-handshake.c glusterd-pmap.c \ + glusterd-volgen.c glusterd-rebalance.c glusterd-quota.c \ glusterd-geo-rep.c glusterd-replace-brick.c glusterd-log-ops.c \ glusterd-volume-ops.c glusterd-brick-ops.c glusterd-mountbroker.c \ glusterd-syncop.c @@ -13,15 +14,18 @@ glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ $(top_builddir)/rpc/xdr/src/libgfxdr.la \ $(top_builddir)/rpc/rpc-lib/src/libgfrpc.la -noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h glusterd-sm.h \ - glusterd-store.h glusterd-mem-types.h glusterd-pmap.h glusterd-volgen.h \ - glusterd-mountbroker.h glusterd-syncop.h +noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \ + glusterd-sm.h glusterd-store.h glusterd-mem-types.h \ + glusterd-pmap.h glusterd-volgen.h glusterd-mountbroker.h \ + glusterd-syncop.h AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\ -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)\ - -I$(rpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/rpc/xdr/src\ - -I$(top_srcdir)/rpc/rpc-lib/src -I$(CONTRIBDIR)/uuid -I$(top_srcdir)/contrib/md5 -DSBIN_DIR=\"$(sbindir)\"\ - -DDATADIR=\"$(localstatedir)\" -DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\ + -I$(rpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree \ + -I$(top_srcdir)/rpc/xdr/src -I$(top_srcdir)/rpc/rpc-lib/src \ + -I$(CONTRIBDIR)/uuid \ + -DSBIN_DIR=\"$(sbindir)\" -DDATADIR=\"$(localstatedir)\" \ + -DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\ -DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) $(LIBXML2_CFLAGS) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 37899d4be..38e9a987d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -21,6 +21,7 @@ #define _CONFIG_H #include "config.h" #endif +#include <openssl/md5.h> #include <inttypes.h> #include "globals.h" @@ -32,7 +33,6 @@ #include "timer.h" #include "defaults.h" #include "compat.h" -#include "md5.h" #include "run.h" #include "compat-errno.h" #include "statedump.h" @@ -81,6 +81,17 @@ char *glusterd_sock_dir = "/tmp"; static glusterd_lock_t lock; +static void +md5_wrapper(const unsigned char *data, size_t len, char *md5) +{ + unsigned short i = 0; + unsigned short lim = MD5_DIGEST_LENGTH*2+1; + unsigned char scratch[MD5_DIGEST_LENGTH] = {0,}; + MD5(data, len, scratch); + for (; i < MD5_DIGEST_LENGTH; i++) + snprintf(md5 + i * 2, lim-i*2, "%02x", scratch[i]); +} + int32_t glusterd_get_lock_owner (uuid_t *uuid) { @@ -1036,14 +1047,14 @@ glusterd_set_brick_socket_filepath (glusterd_volinfo_t *volinfo, { char export_path[PATH_MAX] = {0,}; char sock_filepath[PATH_MAX] = {0,}; - char md5_sum[MD5_DIGEST_LEN*2+1] = {0,}; + char md5_sum[MD5_DIGEST_LENGTH*2+1] = {0,}; char volume_dir[PATH_MAX] = {0,}; xlator_t *this = NULL; glusterd_conf_t *priv = NULL; int expected_file_len = 0; expected_file_len = strlen (glusterd_sock_dir) + strlen ("/") + - MD5_DIGEST_LEN*2 + strlen (".socket") + 1; + MD5_DIGEST_LENGTH*2 + strlen (".socket") + 1; GF_ASSERT (len >= expected_file_len); this = THIS; GF_ASSERT (this); @@ -1054,9 +1065,7 @@ glusterd_set_brick_socket_filepath (glusterd_volinfo_t *volinfo, GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, export_path); snprintf (sock_filepath, PATH_MAX, "%s/run/%s-%s", volume_dir, brickinfo->hostname, export_path); - _get_md5_str (md5_sum, sizeof (md5_sum), - (uint8_t*)sock_filepath, strlen (sock_filepath)); - + md5_wrapper ((unsigned char *) sock_filepath, strlen(sock_filepath), md5_sum); snprintf (sockpath, len, "%s/%s.socket", glusterd_sock_dir, md5_sum); } @@ -2678,12 +2687,11 @@ glusterd_nodesvc_set_socket_filepath (char *rundir, uuid_t uuid, char *socketpath, int len) { char sockfilepath[PATH_MAX] = {0,}; - char md5_str[PATH_MAX] = {0,}; + char md5_str[MD5_DIGEST_LENGTH*2+1] = {0,}; snprintf (sockfilepath, sizeof (sockfilepath), "%s/run-%s", rundir, uuid_utoa (uuid)); - _get_md5_str (md5_str, sizeof (md5_str), - (uint8_t *)sockfilepath, sizeof (sockfilepath)); + md5_wrapper ((unsigned char *) sockfilepath, strlen (sockfilepath), md5_str); snprintf (socketpath, len, "%s/%s.socket", glusterd_sock_dir, md5_str); return 0; diff --git a/xlators/nfs/server/src/Makefile.am b/xlators/nfs/server/src/Makefile.am index a2c76a502..b5fd8586d 100644 --- a/xlators/nfs/server/src/Makefile.am +++ b/xlators/nfs/server/src/Makefile.am @@ -2,16 +2,18 @@ xlator_LTLIBRARIES = server.la xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/nfs nfsrpclibdir = $(top_srcdir)/rpc/rpc-lib/src server_la_LDFLAGS = -module -avoidversion -server_la_SOURCES = nfs.c nfs-common.c nfs-fops.c nfs-inodes.c nfs-generics.c mount3.c nfs3-fh.c nfs3.c nfs3-helpers.c nlm4.c nlmcbk_svc.c +server_la_SOURCES = nfs.c nfs-common.c nfs-fops.c nfs-inodes.c \ + nfs-generics.c mount3.c nfs3-fh.c nfs3.c nfs3-helpers.c nlm4.c \ + nlmcbk_svc.c server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -noinst_HEADERS = nfs.h nfs-common.h nfs-fops.h nfs-inodes.h nfs-generics.h mount3.h nfs3-fh.h nfs3.h nfs3-helpers.h nfs-mem-types.h nlm4.h +noinst_HEADERS = nfs.h nfs-common.h nfs-fops.h nfs-inodes.h nfs-generics.h \ + mount3.h nfs3-fh.h nfs3.h nfs3-helpers.h nfs-mem-types.h nlm4.h AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\ -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)\ -I$(nfsrpclibdir) -L$(xlatordir)/ -I$(CONTRIBDIR)/rbtree\ - -I$(top_srcdir)/rpc/xdr/src/ \ - -I$(top_srcdir)/contrib/md5/ + -I$(top_srcdir)/rpc/xdr/src/ CLEANFILES = diff --git a/xlators/protocol/legacy/server/src/Makefile.am b/xlators/protocol/legacy/server/src/Makefile.am index 262fec9ea..bfc0b7eb6 100644 --- a/xlators/protocol/legacy/server/src/Makefile.am +++ b/xlators/protocol/legacy/server/src/Makefile.am @@ -15,7 +15,6 @@ noinst_HEADERS = server-protocol.h server-helpers.h server-mem-types.h \ AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \ -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles \ - -I$(top_srcdir)/contrib/md5/ \ -DDATADIR=\"$(localstatedir)\" -DCONFDIR=\"$(sysconfdir)/glusterfs\" \ -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ $(GF_CFLAGS) -I$(top_srcdir)/xlators/protocol/legacy/lib/src \ diff --git a/xlators/protocol/server/src/Makefile.am b/xlators/protocol/server/src/Makefile.am index 72a581ddf..0df5894ec 100644 --- a/xlators/protocol/server/src/Makefile.am +++ b/xlators/protocol/server/src/Makefile.am @@ -18,7 +18,6 @@ AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall \ -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ $(GF_CFLAGS) -I$(top_srcdir)/xlators/protocol/lib/src \ -I$(top_srcdir)/rpc/rpc-lib/src/ \ - -I$(top_srcdir)/rpc/xdr/src/ \ - -I$(top_srcdir)/contrib/md5/ + -I$(top_srcdir)/rpc/xdr/src/ CLEANFILES = *~ diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 1c40a12cf..6ce0b27af 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -23,13 +23,14 @@ #include "config.h" #endif +#include <openssl/md5.h> + #include "server.h" #include "server-helpers.h" #include "glusterfs3-xdr.h" #include "glusterfs3.h" #include "compat-errno.h" -#include "md5.h" #include "xdr-nfs3.h" @@ -1471,7 +1472,7 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, rsp.weak_checksum = weak_checksum; rsp.strong_checksum.strong_checksum_val = (char *)strong_checksum; - rsp.strong_checksum.strong_checksum_len = MD5_DIGEST_LEN; + rsp.strong_checksum.strong_checksum_len = MD5_DIGEST_LENGTH; } if (op_ret == -1) gf_log (this->name, GF_LOG_INFO, diff --git a/xlators/storage/posix/src/Makefile.am b/xlators/storage/posix/src/Makefile.am index d1d420017..408dcb80d 100644 --- a/xlators/storage/posix/src/Makefile.am +++ b/xlators/storage/posix/src/Makefile.am @@ -11,7 +11,7 @@ noinst_HEADERS = posix.h posix-mem-types.h posix-handle.h AM_CFLAGS = -fPIC -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \ -D$(GF_HOST_OS) -Wall -I$(top_srcdir)/libglusterfs/src -shared \ - -nostartfiles -I$(top_srcdir)/contrib/md5 -I$(top_srcdir)/rpc/xdr/src \ + -nostartfiles -I$(top_srcdir)/rpc/xdr/src \ -I$(top_srcdir)/rpc/rpc-lib/src $(GF_CFLAGS) CLEANFILES = diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 20a9528b0..04c166c54 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -38,7 +38,6 @@ #endif /* GF_BSD_HOST_OS */ #include "glusterfs.h" -#include "md5.h" #include "checksum.h" #include "dict.h" #include "logging.h" diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index bf38bd6ce..2452ddc4d 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -24,6 +24,7 @@ #define __XOPEN_SOURCE 500 +#include <openssl/md5.h> #include <stdint.h> #include <sys/time.h> #include <sys/resource.h> @@ -42,7 +43,6 @@ #endif /* HAVE_LINKAT */ #include "glusterfs.h" -#include "md5.h" #include "checksum.h" #include "dict.h" #include "logging.h" @@ -3739,13 +3739,13 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this, int ret = 0; int32_t weak_checksum = 0; - uint8_t strong_checksum[MD5_DIGEST_LEN]; + unsigned char strong_checksum[MD5_DIGEST_LENGTH]; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); VALIDATE_OR_GOTO (fd, out); - memset (strong_checksum, 0, MD5_DIGEST_LEN); + memset (strong_checksum, 0, MD5_DIGEST_LENGTH); buf = GF_CALLOC (1, len, gf_posix_mt_char); if (!buf) { @@ -3773,8 +3773,8 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this, goto out; } - weak_checksum = gf_rsync_weak_checksum (buf, len); - gf_rsync_strong_checksum (buf, len, strong_checksum); + weak_checksum = gf_rsync_weak_checksum ((unsigned char *) buf, (size_t) len); + gf_rsync_strong_checksum ((unsigned char *) buf, (size_t) len, (unsigned char *) strong_checksum); GF_FREE (buf); |