From: Jim Jagielski <jim@apache.org> Date: Fri, 8 Nov 2013 20:48:16 +0000 (+0000) Subject: Allow for backwards compatibility for the md5 check... X-Git-Tag: 2.5.0-alpha~4875 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33ea79e4d78789868c6b1053574e1ed420e904cb;p=apache Allow for backwards compatibility for the md5 check... if we've read the slotmem data and we are at EOF, then don't bother checking the md5 and assume all is OK. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1540178 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/slotmem/mod_slotmem_shm.c b/modules/slotmem/mod_slotmem_shm.c index 43c1c7fc86..8f1fcb29ff 100644 --- a/modules/slotmem/mod_slotmem_shm.c +++ b/modules/slotmem/mod_slotmem_shm.c @@ -234,15 +234,25 @@ static apr_status_t restore_slotmem(void *ptr, const char *name, apr_size_t size pool); if (rv == APR_SUCCESS) { rv = apr_file_read(fp, ptr, &nbytes); - if (rv == APR_SUCCESS) { - rv = apr_file_gets(digest, APR_MD5_DIGESTSIZE, fp); - if (rv == APR_SUCCESS) { - apr_md5((unsigned char*)digest2, ptr, nbytes); - if (!strcasecmp(digest, digest2)) { - rv = APR_EGENERAL; + if ((rv == APR_SUCCESS || rv == APR_EOF) && nbytes == size) { + /* + * if at EOF, don't bother checking md5 + * - backwards compatibility + * */ + if (apr_file_eof(fp) != APR_EOF) { + rv = apr_file_gets(digest, APR_MD5_DIGESTSIZE, fp); + if (rv == APR_SUCCESS) { + apr_md5((unsigned char*)digest2, ptr, nbytes); + if (!strcasecmp(digest, digest2)) { + rv = APR_EGENERAL; + } } } } + else if (nbytes != size) { + /* didn't get it all */ + rv = APR_EGENERAL; + } apr_file_close(fp); } }