]> git.sur5r.net Git - openldap/commitdiff
Import ITS#2007 and ITS#2009 bug fixes from HEAD
authorKurt Zeilenga <kurt@openldap.org>
Mon, 5 Aug 2002 21:06:05 +0000 (21:06 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 5 Aug 2002 21:06:05 +0000 (21:06 +0000)
servers/slurpd/reject.c

index 91e1c6a11e42daaf4075f738db85893930d7e6f8..130b828d1ee3caaa15dacb1114f5aa02d1e0944c 100644 (file)
@@ -57,13 +57,13 @@ write_reject(
     int                rc;
 
     ldap_pvt_thread_mutex_lock( &sglob->rej_mutex );
-    sprintf( rejfile, "%s" LDAP_DIRSEP "%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 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG ( SLURPD, ERR, "write_reject: "