]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix path issues.
authorRobert Nelson <robertn@the-nelsons.org>
Fri, 1 Dec 2006 08:45:40 +0000 (08:45 +0000)
committerRobert Nelson <robertn@the-nelsons.org>
Fri, 1 Dec 2006 08:45:40 +0000 (08:45 +0000)
Fix SQLite3 build error.

Don't enable unnecessary privileges, its a security problem.

Fix bextract and bscan on Windows.

Fix comment typos.

Fix copyright changes in the tray-monitor so it builds.

Add SQLite3 support to the Windows build.

Remove bdb support from Windows version.

Reworked the installer to facilitate the regression tests.

Improved the database support in the installer.

Automatically detect installed database and program paths.

Start external programs minimized so they don't bother the user.

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

bacula/src/baconfig.h
bacula/src/cats/sqlite.c
bacula/src/findlib/enable_priv.c
bacula/src/lib/tree.c
bacula/src/stored/bextract.c
bacula/src/stored/bscan.c
bacula/src/stored/read_record.c

index d1c533fe0a2f9e20c2bf68f7c9af2b42e7aa2975..67f88f498f6c5c5ccdfad23ce6d5ef2a071392a9 100644 (file)
@@ -618,8 +618,8 @@ extern "C" int mknod ( const char *path, int mode, dev_t device );
 #define DEFAULT_CONFIGDIR "C:\\Documents and Settings\\All Users\\Application Data\\Bacula"
 
 inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; }
-inline char *first_path_separator(char *path) { return strpbrk(path, ":/\\"); }
-inline const char *first_path_separator(const char *path) { return strpbrk(path, ":/\\"); }
+inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); }
+inline const char *first_path_separator(const char *path) { return strpbrk(path, "/\\"); }
 
 #else
 /* Define Winsock functions if we aren't on Windows */
index 838ad5d2436a431c1a7365177004915f3d051838..9fd557174fc9c0894cfe9480eab08d5668414e3b 100644 (file)
@@ -353,7 +353,11 @@ int my_sqlite_query(B_DB *mdb, const char *cmd)
    int stat;
 
    if (mdb->sqlite_errmsg) {
+#ifdef HAVE_SQLITE3
+      sqlite3_free(mdb->sqlite_errmsg);
+#else
       actuallyfree(mdb->sqlite_errmsg);
+#endif
       mdb->sqlite_errmsg = NULL;
    }
    stat = sqlite_get_table(mdb->db, (char *)cmd, &mdb->result, &mdb->nrow, &mdb->ncolumn,
index f7cc045a89ff325f7a3df539e663ce919c306f39..ff6623f70a1570ba48d6c283bb6439d9d58368c0 100755 (executable)
@@ -124,15 +124,16 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors)
     }
 
     /* Return a bit map of permissions set. */
-    if (enable_priv(jcr, hToken, SE_SECURITY_NAME, ignore_errors)) {
-       stat |= 1<<0;
-    }
     if (enable_priv(jcr, hToken, SE_BACKUP_NAME, ignore_errors)) {
        stat |= 1<<1;
     }
     if (enable_priv(jcr, hToken, SE_RESTORE_NAME, ignore_errors)) {
        stat |= 1<<2;
     }
+#if 0
+    if (enable_priv(jcr, hToken, SE_SECURITY_NAME, ignore_errors)) {
+       stat |= 1<<0;
+    }
     if (enable_priv(jcr, hToken, SE_TAKE_OWNERSHIP_NAME, ignore_errors)) {
        stat |= 1<<3;
     }
@@ -154,6 +155,7 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors)
     if (enable_priv(jcr, hToken, SE_CREATE_PERMANENT_NAME, ignore_errors)) {
        stat |= 1<<10;
     }
+#endif
     if (stat) {
        stat |= 1<<9;
     }
index 0d8f24db8c155fa51b6bb543b8058eb73196adea..708e524c53b88fe149bee937122354d6117b527f 100755 (executable)
@@ -352,11 +352,11 @@ int tree_getpath(TREE_NODE *node, char *buf, int buf_size)
  */
 TREE_NODE *tree_cwd(char *path, TREE_ROOT *root, TREE_NODE *node)
 {
-   if (strcmp(path, ".") == 0) {
+   if (path[0] == '.' && path[1] == '\0') {
       return node;
    }
    /* Handle relative path */
-   if (strncmp(path, "..", 2) == 0 && (path[2] == '/' || path[2] == 0)) {
+   if (path[0] == '.' && path[1] == '.' && (IsPathSeparator(path[2]) || path[2] == '\0')) {
       TREE_NODE *parent = node->parent ? node->parent : node;
       if (path[2] == 0) { 
          return parent;
index 06566e7327a902f14d7a6cf056421da05c0a60e4..051be3d1ab3badad5f03e243a7a725bc78dda92f 100644 (file)
@@ -220,6 +220,9 @@ int main (int argc, char *argv[])
 static void do_extract(char *devname)
 {
    struct stat statp;
+
+   enable_backup_privileges(NULL, 1);
+
    jcr = setup_jcr("bextract", devname, bsr, VolumeName, 1); /* acquire for read */
    if (!jcr) {
       exit(1);
index 904ddacaa965f7cfa0ecbdfb7d54685706e2ace6..f3f0270a89a5fbd4796a0de439569c434d00375d 100644 (file)
@@ -147,6 +147,7 @@ int main (int argc, char *argv[])
    my_name_is(argc, argv, "bscan");
    init_msg(NULL, NULL);
 
+   OSDependentInit();
 
    while ((ch = getopt(argc, argv, "b:c:d:h:mn:pP:rsSu:vV:w:?")) != -1) {
       switch (ch) {
index 8f43ec09ef76eeb9f15663679de576d5ae129463..ae512567e6ac686b0e2d01ca48ca9ec6586322ce 100644 (file)
@@ -275,7 +275,7 @@ bool read_records(DCR *dcr,
          /*
           * If we have a digest stream, we check to see if we have 
           *  finished the current bsr, and if so, repositioning will
-          *  be truned on.
+          *  be turned on.
           */
          if (crypto_digest_stream_type(rec->Stream) != CRYPTO_DIGEST_NONE) {
             Dmsg3(dbglvl, "Have digest FI=%u before bsr check pos %u:%u\n", rec->FileIndex,