From: Howard Chu Date: Mon, 26 Aug 2002 08:48:40 +0000 (+0000) Subject: Import ITS#2007,#2009 fixes from HEAD (snprintf, O_EXCL) X-Git-Tag: OPENLDAP_REL_ENG_2_0_26~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07dd4d39f8fbf2b961241cc803aef19e8ae5e5b8;p=thirdparty%2Fopenldap.git Import ITS#2007,#2009 fixes from HEAD (snprintf, O_EXCL) --- diff --git a/servers/slurpd/reject.c b/servers/slurpd/reject.c index e5ce9a76b6..c381204baa 100644 --- a/servers/slurpd/reject.c +++ b/servers/slurpd/reject.c @@ -52,13 +52,13 @@ write_reject( int rc; ldap_pvt_thread_mutex_lock( &sglob->rej_mutex ); - sprintf( rejfile, "%s/%s:%d.rej", sglob->slurpd_rdir, - ri->ri_hostname, ri->ri_port ); + snprintf( rejfile, sizeof(rejfile), "%s" LDAP_DIRSEP "%s:%d.rej", + sglob->slurpd_rdir, ri->ri_hostname, ri->ri_port ); if ( access( rejfile, F_OK ) < 0 ) { /* Doesn't exist - try to create */ int rjfd; - if (( rjfd = open( rejfile, O_RDWR | O_APPEND | O_CREAT, + if (( rjfd = open( rejfile, O_RDWR | O_APPEND | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )) < 0 ) { Debug( LDAP_DEBUG_ANY, "Error: write_reject: Cannot create \"%s\": %s\n",