]> git.sur5r.net Git - bacula/bacula/commitdiff
Update the Microsoft Visual Studio build to match the MinGW32 build.
authorRobert Nelson <robertn@the-nelsons.org>
Fri, 1 Sep 2006 00:49:21 +0000 (00:49 +0000)
committerRobert Nelson <robertn@the-nelsons.org>
Fri, 1 Sep 2006 00:49:21 +0000 (00:49 +0000)
Fix precedence problem in an ASSERT.

Put DLL_IMP_EXP macros in the right place so they work with both gcc and msvc.

Change make_session_key on WIN32 to use WIN32 APIs to produce a better seed.

Add sed to external dependencies, it is used only during installation.

Remove unused code from winmain.cpp and winservice.cpp for the three daemons.

Fix /kill for file and storage daemons.

Add bfree to the exports for bacula.dll.

Add new tool scsilist.exe which displays the changer, tape and CD/DVD (1394, SCSI, SATA, ATAPI) devices and the information required to add them to bacula-sd.conf.

Added full configuration generation to the installer.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3392 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/Makefile.in
bacula/src/bacula.h
bacula/src/console/console.c
bacula/src/filed/job.c
bacula/src/findlib/attribs.c
bacula/src/jcr.h
bacula/src/lib/message.h
bacula/src/lib/res.c
bacula/src/lib/util.c
bacula/src/stored/dircmd.c

index 19c2d93c4aa50c226c42fe9652a5e33dabe82ab1..e4a0562cdd718402f8a1788b8fc44e1c5340a1fa 100755 (executable)
@@ -23,7 +23,7 @@ fd_subdirs = src scripts src/lib src/findlib src/filed \
             @GNOME_DIR@ @TRAY_MONITOR_DIR@ @WX_DIR@
 
 # Non-client-only directores
-subdirs =    src/cats @DIRD_DIR@ @STORED_DIR@ src/tools        
+subdirs =    src/cats @DIRD_DIR@ @STORED_DIR@ src/tools
 
 all_subdirs = ${fd_subdirs} ${@ALL_DIRS@} manpages
 
index 5619c0d7f2b041731c8f8d333bb22cfca28f0d96..09291ab3cae38f45fd1b218f9682d77d0111815e 100644 (file)
 #else
 #include "winconfig.h"
 #endif
-#include "winhost.h"
 #else
 #include "config.h"
-#include "host.h"
 #endif
 
 
 #if HAVE_ALLOCA_H
 #include <alloca.h>
 #endif
-
+#if defined(_MSC_VER)
+#include <io.h>
+#include <direct.h>
+#include <process.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
 
 #define O_NOATIME 0
 #endif
 
+#if defined(_MSC_VER)
+extern "C" {
+#include "getopt.h"
+}
+#endif
+
 #ifdef xxxxx
 #ifdef HAVE_GETOPT_LONG
 #include <getopt.h>
 
 #if defined(HAVE_WIN32)
 #include "win32/winapi.h"
+#include "winhost.h"
+#else
+#include "host.h"
 #endif
 
 #ifndef HAVE_ZLIB_H
index bcaf07a9fce9d7162bf648bcab7311166804b630..b7064e0bd299b54d7b4bfcee9dee2f1168909a5b 100644 (file)
@@ -292,8 +292,8 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
 static int tls_pem_callback(char *buf, int size, const void *userdata)
 {
 #ifdef HAVE_TLS
-# ifdef HAVE_MINGW
    const char *prompt = (const char *)userdata;
+# if defined(HAVE_WIN32)
    sendit(prompt);
    if (win32_cgets(buf, size) == NULL) {
       buf[0] = 0;
@@ -302,7 +302,6 @@ static int tls_pem_callback(char *buf, int size, const void *userdata)
       return strlen(buf);
    }
 # else
-   const char *prompt = (const char *)userdata;
    char *passwd;
 
    passwd = getpass(prompt);
index 5d7ec87caf5d2ba16fbe0483a0ca83b8b45d87db..0c81adc143c96e5aeec114a1824e45413e8df81c 100644 (file)
@@ -25,7 +25,7 @@
 #include "filed.h"
 
 #if defined(WIN32_VSS)
-#include "vss.h"   
+#include "vss.h"
 
 static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER;
 static int enable_vss;
index ab9a87f51d61de352d0041bde277d872bd33c411..4c71cc679ec719486621ae43186d6acde1e2c4e9 100755 (executable)
@@ -123,7 +123,7 @@ int select_data_stream(FF_PKT *ff_pkt)
       default:
          /* All stream types that do not support encryption should clear out
           * FO_ENCRYPT above, and this code block should be unreachable. */
-         ASSERT(!ff_pkt->flags & FO_ENCRYPT);
+         ASSERT(!(ff_pkt->flags & FO_ENCRYPT));
          return STREAM_NONE;
       }
    }
index f37b6f68650fa35f728feb48dd4feef0b7366b42..6a2dad36e4d23f6a47fb9b41a204a5f709c40929 100644 (file)
@@ -353,7 +353,7 @@ struct s_last_job {
 };
 
 extern struct s_last_job last_job;
-extern dlist * DLL_IMP_EXP last_jobs;
+extern DLL_IMP_EXP dlist * last_jobs;
 
 
 /* The following routines are found in lib/jcr.c */
index 1d144bb74af11158dfa9d16421dc00eec55d911e..66b0f82dd89bfbe8a3617ac525487dcafd4efba2 100644 (file)
@@ -133,14 +133,14 @@ void Qmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...);
 bool get_trace(void);
 
 typedef void (*sql_query)(JCR *jcr, const char *cmd);
-extern sql_query     DLL_IMP_EXP p_sql_query;
+extern DLL_IMP_EXP sql_query     p_sql_query;
 
-extern int           DLL_IMP_EXP debug_level;
-extern int           DLL_IMP_EXP verbose;
-extern char          DLL_IMP_EXP my_name[];
-extern const char *  DLL_IMP_EXP working_directory;
-extern time_t        DLL_IMP_EXP daemon_start_time;
+extern DLL_IMP_EXP int           debug_level;
+extern DLL_IMP_EXP int           verbose;
+extern DLL_IMP_EXP char          my_name[];
+extern DLL_IMP_EXP const char *  working_directory;
+extern DLL_IMP_EXP time_t        daemon_start_time;
 
-extern int           DLL_IMP_EXP console_msg_pending;
-extern FILE *        DLL_IMP_EXP con_fd;                 /* Console file descriptor */
-extern brwlock_t     DLL_IMP_EXP con_lock;               /* Console lock structure */
+extern DLL_IMP_EXP int           console_msg_pending;
+extern DLL_IMP_EXP FILE *        con_fd;                 /* Console file descriptor */
+extern DLL_IMP_EXP brwlock_t     con_lock;               /* Console lock structure */
index c35fb68ee5c7d4dd8ecbb59c44060f22354bba68..670b61fe59466592e5b1accf263f7f1b0567d9c7 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "bacula.h"
 
-extern int debug_level;
-
 /* Each daemon has a slightly different set of
  * resources, so it will define the following
  * global values.
index 505851583fd4a2f094316627dd2372c211f45fdf..f991483202662a0cc2737eaaaadf1e9f2c6dedb5 100644 (file)
@@ -428,63 +428,86 @@ int do_shell_expansion(char *name, int name_len)
 
 void make_session_key(char *key, char *seed, int mode)
 {
-     int j, k;
-     struct MD5Context md5c;
-     unsigned char md5key[16], md5key1[16];
-     char s[1024];
-
-     s[0] = 0;
-     if (seed != NULL) {
-        bstrncat(s, seed, sizeof(s));
-     }
+   int j, k;
+   struct MD5Context md5c;
+   unsigned char md5key[16], md5key1[16];
+   char s[1024];
+
+   s[0] = 0;
+   if (seed != NULL) {
+     bstrncat(s, seed, sizeof(s));
+   }
+
+   /* The following creates a seed for the session key generator
+     based on a collection of volatile and environment-specific
+     information unlikely to be vulnerable (as a whole) to an
+     exhaustive search attack.  If one of these items isn't
+     available on your machine, replace it with something
+     equivalent or, if you like, just delete it. */
 
-     /* The following creates a seed for the session key generator
-        based on a collection of volatile and environment-specific
-        information unlikely to be vulnerable (as a whole) to an
-        exhaustive search attack.  If one of these items isn't
-        available on your machine, replace it with something
-        equivalent or, if you like, just delete it. */
-
-     sprintf(s + strlen(s), "%lu", (unsigned long)getpid());
-     sprintf(s + strlen(s), "%lu", (unsigned long)getppid());
-     (void)getcwd(s + strlen(s), 256);
-     sprintf(s + strlen(s), "%lu", (unsigned long)clock());
-     sprintf(s + strlen(s), "%lu", (unsigned long)time(NULL));
+#if defined(HAVE_WIN32)
+   {
+      LARGE_INTEGER     li;
+      DWORD             length;
+      FILETIME          ft;
+      char             *p;
+
+      p = s;
+      sprintf(s + strlen(s), "%lu", (unsigned long)GetCurrentProcessId());
+      (void)getcwd(s + strlen(s), 256);
+      sprintf(s + strlen(s), "%lu", (unsigned long)GetTickCount());
+      QueryPerformanceCounter(&li);
+      sprintf(s + strlen(s), "%lu", (unsigned long)li.LowPart);
+      GetSystemTimeAsFileTime(&ft);
+      sprintf(s + strlen(s), "%lu", (unsigned long)ft.dwLowDateTime);
+      sprintf(s + strlen(s), "%lu", (unsigned long)ft.dwHighDateTime);
+      length = 256;
+      GetComputerName(s + strlen(s), &length);
+      length = 256;
+      GetUserName(s + strlen(s), &length);
+   }
+#else
+   sprintf(s + strlen(s), "%lu", (unsigned long)getpid());
+   sprintf(s + strlen(s), "%lu", (unsigned long)getppid());
+   (void)getcwd(s + strlen(s), 256);
+   sprintf(s + strlen(s), "%lu", (unsigned long)clock());
+   sprintf(s + strlen(s), "%lu", (unsigned long)time(NULL));
 #if defined(Solaris)
-     sysinfo(SI_HW_SERIAL,s + strlen(s), 12);
+   sysinfo(SI_HW_SERIAL,s + strlen(s), 12);
 #endif
 #if defined(HAVE_GETHOSTID)
-     sprintf(s + strlen(s), "%lu", (unsigned long) gethostid());
+   sprintf(s + strlen(s), "%lu", (unsigned long) gethostid());
 #endif
-     gethostname(s + strlen(s), 256);
-     sprintf(s + strlen(s), "%u", (unsigned)getuid());
-     sprintf(s + strlen(s), "%u", (unsigned)getgid());
-     MD5Init(&md5c);
-     MD5Update(&md5c, (unsigned char *)s, strlen(s));
-     MD5Final(md5key, &md5c);
-     sprintf(s + strlen(s), "%lu", (unsigned long)((time(NULL) + 65121) ^ 0x375F));
-     MD5Init(&md5c);
-     MD5Update(&md5c, (unsigned char *)s, strlen(s));
-     MD5Final(md5key1, &md5c);
+   gethostname(s + strlen(s), 256);
+   sprintf(s + strlen(s), "%u", (unsigned)getuid());
+   sprintf(s + strlen(s), "%u", (unsigned)getgid());
+#endif
+   MD5Init(&md5c);
+   MD5Update(&md5c, (unsigned char *)s, strlen(s));
+   MD5Final(md5key, &md5c);
+   sprintf(s + strlen(s), "%lu", (unsigned long)((time(NULL) + 65121) ^ 0x375F));
+   MD5Init(&md5c);
+   MD5Update(&md5c, (unsigned char *)s, strlen(s));
+   MD5Final(md5key1, &md5c);
 #define nextrand    (md5key[j] ^ md5key1[j])
-     if (mode) {
-        for (j = k = 0; j < 16; j++) {
-           unsigned char rb = nextrand;
+   if (mode) {
+     for (j = k = 0; j < 16; j++) {
+        unsigned char rb = nextrand;
 
 #define Rad16(x) ((x) + 'A')
-           key[k++] = Rad16((rb >> 4) & 0xF);
-           key[k++] = Rad16(rb & 0xF);
+        key[k++] = Rad16((rb >> 4) & 0xF);
+        key[k++] = Rad16(rb & 0xF);
 #undef Rad16
-           if (j & 1) {
-              key[k++] = '-';
-           }
-        }
-        key[--k] = 0;
-     } else {
-        for (j = 0; j < 16; j++) {
-           key[j] = nextrand;
+        if (j & 1) {
+           key[k++] = '-';
         }
      }
+     key[--k] = 0;
+   } else {
+     for (j = 0; j < 16; j++) {
+        key[j] = nextrand;
+     }
+   }
 }
 #undef nextrand
 
index d1134f140e15a11392d7e0d923b79452bd93852b..877b4b01b2cfc66c6ee3a12c70a09abb35e57ec4 100644 (file)
@@ -43,8 +43,6 @@
 extern BSOCK *filed_chan;
 extern int r_first, r_last;
 extern struct s_res resources[];
-extern char my_name[];
-extern time_t daemon_start_time;
 extern struct s_last_job last_job;
 extern bool init_done;