]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Merge branch 'feat_misc' into beta2.2
authorDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 18 Nov 2010 21:17:58 +0000 (22:17 +0100)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 18 Nov 2010 21:17:58 +0000 (22:17 +0100)
Conflicts:
acinclude.m4
config-win32.h
configure.ac
misc.c
thread.c
thread.h
        - These conflicts was mainly due to feat_misc getting old
          and mostly caused by the pthread clean-up patches in
          feat_misc

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
41 files changed:
1  2 
Makefile.am
buffer.c
buffer.h
configure.ac
crypto.c
error.c
error.h
forward.c
init.c
list.c
list.h
mbuf.c
mbuf.h
misc.c
mroute.c
mroute.h
mtcp.c
mudp.c
multi.c
multi.h
openvpn.h
options.c
options.h
otime.c
otime.h
perf.c
pf.c
pkcs11.c
plugin.c
pool.h
ps.c
reliable.c
route.c
schedule.c
schedule.h
sig.c
socket.c
socks.c
ssl.c
ssl.h
syshead.h

diff --cc Makefile.am
Simple merge
diff --cc buffer.c
Simple merge
diff --cc buffer.h
Simple merge
diff --cc configure.ac
Simple merge
diff --cc crypto.c
Simple merge
diff --cc error.c
Simple merge
diff --cc error.h
Simple merge
diff --cc forward.c
Simple merge
diff --cc init.c
Simple merge
diff --cc list.c
Simple merge
diff --cc list.h
Simple merge
diff --cc mbuf.c
Simple merge
diff --cc mbuf.h
Simple merge
diff --cc misc.c
index 94e9efe899151c2574714b0a27fcc6ea50789b37,815c057cfab554aa8519177ba0e20eefcf444199..4067d85abb77802745f16edfbedc7aecf7aed003
--- 1/misc.c
--- 2/misc.c
+++ b/misc.c
  
  #include "buffer.h"
  #include "misc.h"
 +#include "base64.h"
  #include "tun.h"
  #include "error.h"
- #include "thread.h"
  #include "otime.h"
  #include "plugin.h"
  #include "options.h"
@@@ -1172,53 -1151,19 +1151,51 @@@ create_temp_file (const char *directory
  {
    static unsigned int counter;
    struct buffer fname = alloc_buf_gc (256, gc);
 +  int fd;
 +  const char *retfname = NULL;
 +  unsigned int attempts = 0;
  
 -  ++counter;
 -
 -  {
 -    uint8_t rndbytes[16];
 -    const char *rndstr;
 -
 -    prng_bytes (rndbytes, sizeof (rndbytes));
 -    rndstr = format_hex_ex (rndbytes, sizeof (rndbytes), 40, 0, NULL, gc);
 -    buf_printf (&fname, PACKAGE "_%s_%s.tmp", prefix, rndstr);
 -  }
 +  do
 +    {
 +      uint8_t rndbytes[16];
 +      const char *rndstr;
 +
 +      ++attempts;
-       mutex_lock_static (L_CREATE_TEMP);
 +      ++counter;
-       mutex_unlock_static (L_CREATE_TEMP);
 +
 +      prng_bytes (rndbytes, sizeof rndbytes);
 +      rndstr = format_hex_ex (rndbytes, sizeof rndbytes, 40, 0, NULL, gc);
 +      buf_printf (&fname, PACKAGE "_%s_%s.tmp", prefix, rndstr);
 +
 +      retfname = gen_path (directory, BSTR (&fname), gc);
 +      if (!retfname)
 +        {
 +          msg (M_FATAL, "Failed to create temporary filename and path");
 +          return NULL;
 +        }
 +
 +      /* Atomically create the file.  Errors out if the file already
 +         exists.  */
 +      fd = open (retfname, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
 +      if (fd != -1)
 +        {
 +          close (fd);
 +          return retfname;
 +        }
 +      else if (fd == -1 && errno != EEXIST)
 +        {
 +          /* Something else went wrong, no need to retry.  */
 +          struct gc_arena gcerr = gc_new ();
 +          msg (M_FATAL, "Could not create temporary file '%s': %s",
 +               retfname, strerror_ts (errno, &gcerr));
 +          gc_free (&gcerr);
 +          return NULL;
 +        }
 +    }
 +  while (attempts < 6);
  
 -  return gen_path (directory, BSTR (&fname), gc);
 +  msg (M_FATAL, "Failed to create temporary file after %i attempts", attempts);
 +  return NULL;
  }
  
  /*
diff --cc mroute.c
Simple merge
diff --cc mroute.h
Simple merge
diff --cc mtcp.c
Simple merge
diff --cc mudp.c
Simple merge
diff --cc multi.c
index 57310f6d32582d05a257a9474d218655f2927b21,4cd7468d6d09c1503a9e895ef0be56dd329b1f0f..22c0a3f9362f2a7b9786092dbcc68c9dc18ce72d
+++ b/multi.c
@@@ -721,10 -720,10 +720,10 @@@ multi_print_status (struct multi_contex
          /*
           * Status file version 1
           */
 -        status_printf (so, PACKAGE_NAME " CLIENT LIST");
 +        status_printf (so, "OpenVPN CLIENT LIST");
          status_printf (so, "Updated,%s", time_string (0, 0, false, &gc_top));
          status_printf (so, "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
-         hash_iterator_init (m->hash, &hi, true);
+         hash_iterator_init (m->hash, &hi);
          while ((he = hash_iterator_next (&hi)))
            {
              struct gc_arena gc = gc_new ();
diff --cc multi.h
Simple merge
diff --cc openvpn.h
Simple merge
diff --cc options.c
index 3aa68200e0b138b2a2b8ad9d1053cdb424fc45c9,d0cec7dc6ea9818a88f8442fd09e33839c339214..524c7817804f27c612dc29fa3638313671acf447
+++ b/options.c
@@@ -73,14 -69,8 +73,11 @@@ const char title_string[] 
  #ifdef PRODUCT_TAP_DEBUG
    " [TAPDBG]"
  #endif
- #ifdef USE_PTHREAD
-   " [PTHREAD]"
- #endif
  #ifdef ENABLE_PKCS11
    " [PKCS11]"
 +#endif
 +#ifdef ENABLE_EUREPHIA
 +  " [eurephia]"
  #endif
    " built on " __DATE__
  ;
diff --cc options.h
Simple merge
diff --cc otime.c
Simple merge
diff --cc otime.h
Simple merge
diff --cc perf.c
Simple merge
diff --cc pf.c
Simple merge
diff --cc pkcs11.c
Simple merge
diff --cc plugin.c
Simple merge
diff --cc pool.h
Simple merge
diff --cc ps.c
Simple merge
diff --cc reliable.c
Simple merge
diff --cc route.c
Simple merge
diff --cc schedule.c
Simple merge
diff --cc schedule.h
Simple merge
diff --cc sig.c
Simple merge
diff --cc socket.c
Simple merge
diff --cc socks.c
Simple merge
diff --cc ssl.c
Simple merge
diff --cc ssl.h
Simple merge
diff --cc syshead.h
index 6479b2057fc416ca6800e9a1fdc509ee41c4508e,3b8ab89eb05981680b50a89eade95bdff0a20522..d75f881934d18ca6e61599da67a366875f36aef5
+++ b/syshead.h
@@@ -535,28 -531,12 +535,10 @@@ socket_defined (const socket_descriptor
  #endif
  
  /*
 - * Don't compile the struct buffer_list code unless something needs it
 + * Compile the struct buffer_list code
   */
 -#if defined(ENABLE_MANAGEMENT) || defined(ENABLE_PF)
  #define ENABLE_BUFFER_LIST
 -#endif
  
- /*
-  * Do we have pthread capability?
-  */
- #ifdef USE_PTHREAD
- #if defined(USE_CRYPTO) && defined(USE_SSL) && P2MP
- #include <pthread.h>
- #else
- #undef USE_PTHREAD
- #endif
- #endif
- /*
-  * Pthread support is currently experimental (and quite unfinished).
-  */
- #if 1 /* JYFIXME -- if defined, disable pthread */
- #undef USE_PTHREAD
- #endif
  /*
   * Should we include OCC (options consistency check) code?
   */