From: Adam Dickmeiss Date: Mon, 1 Aug 2011 11:05:13 +0000 (+0200) Subject: Use rand rather than mkstemp for session X-Git-Tag: v1.3.2~2 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;ds=sidebyside;h=844c0b8ab1de859d3c1052b81c0fc056b2cd5437;p=metaproxy-moved-to-github.git Use rand rather than mkstemp for session Problem is that the generated URL is not case sensitive so we need a temporary file name without case mix. --- diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 17065a0..1c2ff9a 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -17,6 +17,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config.hpp" + +#include +#include +#include #include "filter_zoom.hpp" #include #include @@ -365,6 +369,8 @@ yf::Zoom::Impl::Impl() : apdu_log(false), element_transform("pz2") , element_raw("raw") { bibset = ccl_qual_mk(); + + srand(time(0)); } yf::Zoom::Impl::~Impl() @@ -843,7 +849,11 @@ yf::Zoom::BackendPtr yf::Zoom::Frontend::get_backend_from_databases( xx = fname + strlen(fname); strcat(fname, "XXXXXX"); } - int fd = mkstemps(fname, suffixlen); + char tmp_char = xx[6]; + sprintf(xx, "%06d", ((unsigned) rand()) % 1000000); + xx[6] = tmp_char; + + int fd = creat(fname, 0666); if (fd == -1) { yaz_log(YLOG_WARN|YLOG_ERRNO, "create %s", fname);