]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird.c
Tweak restore path prompt
[bacula/bacula] / bacula / src / dird / dird.c
index 9f1667fc2c15867210b29f6aa65eefd67b50f7a3..1c74ea049170772121247d73a8d595c7431a86f2 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -110,7 +110,7 @@ static void usage()
    fprintf(stderr, _(
 PROG_COPYRIGHT
 "\nVersion: %s (%s)\n\n"
-"Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
+"Usage: bacula-dir [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
 "       -c <file>   set configuration file to file\n"
 "       -d <nn>     set debug level to <nn>\n"
 "       -dt         print timestamp in debug output\n"
@@ -917,6 +917,46 @@ static bool check_resources()
       }
    }
 
+   /* Loop over Storages */
+   STORE *store;
+   foreach_res(store, R_STORAGE) {
+      /* tls_require implies tls_enable */
+      if (store->tls_require) {
+         if (have_tls) {
+            store->tls_enable = true;
+         } else {
+            Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bacula.\n"));
+            OK = false;
+            continue;
+         }
+      }
+
+      need_tls = store->tls_enable || store->tls_authenticate;
+
+      if ((!store->tls_ca_certfile && !store->tls_ca_certdir) && need_tls) {
+         Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
+              " or \"TLS CA Certificate Dir\" are defined for Storage \"%s\" in %s.\n"),
+              store->name(), configfile);
+         OK = false;
+      }
+
+      /* If everything is well, attempt to initialize our per-resource TLS context */
+      if (OK && (need_tls || store->tls_require)) {
+        /* Initialize TLS context:
+         * Args: CA certfile, CA certdir, Certfile, Keyfile,
+         * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
+         store->tls_ctx = new_tls_context(store->tls_ca_certfile,
+            store->tls_ca_certdir, store->tls_certfile,
+            store->tls_keyfile, NULL, NULL, NULL, true);
+
+         if (!store->tls_ctx) {
+            Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Storage \"%s\" in %s.\n"),
+                 store->name(), configfile);
+            OK = false;
+         }
+      }
+   }
+
    UnlockRes();
    if (OK) {
       close_msg(NULL);                /* close temp message handler */
@@ -934,7 +974,6 @@ static bool check_resources()
 static bool check_catalog(cat_op mode)
 {
    bool OK = true;
-   bool need_tls;
 
    /* Loop over databases */
    CAT *catalog;
@@ -1021,15 +1060,15 @@ static bool check_catalog(cat_op mode)
       STORE *store;
       foreach_res(store, R_STORAGE) {
          STORAGE_DBR sr;
-         MEDIATYPE_DBR mr;
+         MEDIATYPE_DBR mtr;
          memset(&sr, 0, sizeof(sr));
-         memset(&mr, 0, sizeof(mr));
+         memset(&mtr, 0, sizeof(mtr));
          if (store->media_type) {
-            bstrncpy(mr.MediaType, store->media_type, sizeof(mr.MediaType));
-            mr.ReadOnly = 0;
-            db_create_mediatype_record(NULL, db, &mr);
+            bstrncpy(mtr.MediaType, store->media_type, sizeof(mtr.MediaType));
+            mtr.ReadOnly = 0;
+            db_create_mediatype_record(NULL, db, &mtr);
          } else {
-            mr.MediaTypeId = 0;
+            mtr.MediaTypeId = 0;
          }
          bstrncpy(sr.Name, store->name(), sizeof(sr.Name));
          sr.AutoChanger = store->autochanger;
@@ -1047,41 +1086,6 @@ static bool check_catalog(cat_op mode)
                OK = false;
             }
          }
-
-         /* tls_require implies tls_enable */
-         if (store->tls_require) {
-            if (have_tls) {
-               store->tls_enable = true;
-            } else {
-               Jmsg(NULL, M_FATAL, 0, _("TLS required but not configured in Bacula.\n"));
-               OK = false;
-            }
-         } 
-
-         need_tls = store->tls_enable || store->tls_authenticate;
-
-         if ((!store->tls_ca_certfile && !store->tls_ca_certdir) && need_tls) {
-            Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
-                 " or \"TLS CA Certificate Dir\" are defined for Storage \"%s\" in %s.\n"),
-                 store->name(), configfile);
-            OK = false;
-         }
-
-         /* If everything is well, attempt to initialize our per-resource TLS context */
-         if (OK && (need_tls || store->tls_require)) {
-           /* Initialize TLS context:
-            * Args: CA certfile, CA certdir, Certfile, Keyfile,
-            * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
-            store->tls_ctx = new_tls_context(store->tls_ca_certfile,
-               store->tls_ca_certdir, store->tls_certfile,
-               store->tls_keyfile, NULL, NULL, NULL, true);
-         
-            if (!store->tls_ctx) {
-               Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Storage \"%s\" in %s.\n"),
-                    store->name(), configfile);
-               OK = false;
-            }
-         }
       }
 
       /* Loop over all counters, defining them in each database */