]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/bacula-dir-B.patch
Attempt to fix bug #1128 InChanger flag cleared during Migration
[bacula/bacula] / bacula / patches / testing / bacula-dir-B.patch
1 Index: src/dird/dird.c
2 ===================================================================
3 --- src/dird/dird.c     (révision 7482)
4 +++ src/dird/dird.c     (copie de travail)
5 @@ -40,7 +40,7 @@
6  /* Forward referenced subroutines */
7  void terminate_dird(int sig);
8  static bool check_resources();
9 -static bool check_catalog();
10 +static bool check_catalog(bool printit=false);
11  static void dir_sql_query(JCR *jcr, const char *cmd);
12    
13  /* Exported subroutines */
14 @@ -99,6 +99,7 @@
15  "       -r <job>    run <job> now\n"
16  "       -s          no signals\n"
17  "       -t          test - read configuration and exit\n"
18 +"       -B          print catalog configuration and exit\n"
19  "       -u          userid\n"
20  "       -v          verbose user messages\n"
21  "       -?          print this message.\n"
22 @@ -124,6 +125,7 @@
23     JCR *jcr;
24     bool no_signals = false;
25     bool test_config = false;
26 +   bool print_catalog = false;
27     char *uid = NULL;
28     char *gid = NULL;
29  
30 @@ -140,7 +142,7 @@
31  
32     console_command = run_console_command;
33  
34 -   while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) {
35 +   while ((ch = getopt(argc, argv, "c:d:fg:r:stu:vB?")) != -1) {
36        switch (ch) {
37        case 'c':                    /* specify config file */
38           if (configfile != NULL) {
39 @@ -186,6 +188,11 @@
40           test_config = true;
41           break;
42  
43 +      case 'B':                    /* print catalog config */
44 +         test_config = true;
45 +         print_catalog = true;
46 +         break;
47 +         
48        case 'u':                    /* set uid */
49           uid = optarg;
50           break;
51 @@ -249,7 +256,7 @@
52  
53     drop(uid, gid);                    /* reduce privileges if requested */
54  
55 -   if (!check_catalog()) {
56 +   if (!check_catalog(print_catalog)) {
57        Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
58     }
59  
60 @@ -876,7 +883,7 @@
61     return OK;
62  }
63  
64 -static bool check_catalog()
65 +static bool check_catalog(bool printit)
66  {
67     bool OK = true;
68     bool need_tls;
69 @@ -907,6 +914,18 @@
70           continue;
71        }
72  
73 +      if (printit) {       /* print catalog information for scripting purpose */
74 +         fprintf(stdout, 
75 +                 "catalog=%s\ndb_type=%s\ndb_name=%s\ndb_driver=%s\ndb_user=%s\n"
76 +                 "db_password=%s\ndb_address=%s\ndb_port=%i\n"
77 +                 "db_socket=%s\n",
78 +                 catalog->name(), db_get_type(), NPRTB(catalog->db_name),
79 +                 NPRTB(catalog->db_driver), 
80 +                 NPRTB(catalog->db_user), NPRTB(catalog->db_password), 
81 +                 NPRTB(catalog->db_address), catalog->db_port,
82 +                 NPRTB(catalog->db_socket));
83 +      }
84 +
85        /* Loop over all pools, defining/updating them in each database */
86        POOL *pool;
87        foreach_res(pool, R_POOL) {
88 Index: src/cats/sqlite.c
89 ===================================================================
90 --- src/cats/sqlite.c   (révision 7482)
91 +++ src/cats/sqlite.c   (copie de travail)
92 @@ -59,14 +59,17 @@
93  
94  int QueryDB(const char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
95  
96 -
97  /*
98   * Retrieve database type
99   */
100  const char *
101  db_get_type(void)
102  {
103 +#ifdef HAVE_SQLITE3
104 +   return "SQLite3";
105 +#else
106     return "SQLite";
107 +#endif
108  }
109  
110  /*
111 Index: src/baconfig.h
112 ===================================================================
113 --- src/baconfig.h      (révision 7482)
114 +++ src/baconfig.h      (copie de travail)
115 @@ -79,7 +79,8 @@
116  
117  /* Allow printing of NULL pointers */
118  #define NPRT(x) (x)?(x):_("*None*")
119
120 +#define NPRTB(x) (x)?(x):""
121 +
122  #if defined(HAVE_WIN32)
123  
124  #define WIN32_REPARSE_POINT 1