From: Robert Nelson Date: Fri, 1 Dec 2006 08:45:40 +0000 (+0000) Subject: Fix path issues. X-Git-Tag: Release-7.0.0~7315 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7c719e9e506d14185327e177d09af28383be42e3;p=bacula%2Fbacula Fix path issues. 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 --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index d1c533fe0a..67f88f498f 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -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 */ diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 838ad5d243..9fd557174f 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -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, diff --git a/bacula/src/findlib/enable_priv.c b/bacula/src/findlib/enable_priv.c index f7cc045a89..ff6623f70a 100755 --- a/bacula/src/findlib/enable_priv.c +++ b/bacula/src/findlib/enable_priv.c @@ -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; } diff --git a/bacula/src/lib/tree.c b/bacula/src/lib/tree.c index 0d8f24db8c..708e524c53 100755 --- a/bacula/src/lib/tree.c +++ b/bacula/src/lib/tree.c @@ -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; diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 06566e7327..051be3d1ab 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -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); diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 904ddacaa9..f3f0270a89 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -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) { diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 8f43ec09ef..ae512567e6 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -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,