From: Eric Bollengier Date: Mon, 31 Oct 2011 15:38:34 +0000 (+0100) Subject: bvfs: fix filter for pattern= bvfs parameter X-Git-Tag: Release-7.0.0~482 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c1acac3f027eada540ab142426256109c96fbd98;p=bacula%2Fbacula bvfs: fix filter for pattern= bvfs parameter --- diff --git a/bacula/src/cats/bvfs.c b/bacula/src/cats/bvfs.c index 0e75beb8c0..1cfcc93485 100644 --- a/bacula/src/cats/bvfs.c +++ b/bacula/src/cats/bvfs.c @@ -660,10 +660,8 @@ bool Bvfs::ls_dirs() POOL_MEM query; POOL_MEM filter; if (*pattern) { - int len = strlen(pattern); - query.check_size(len*2+1); - db_escape_string(jcr, db, query.c_str(), pattern, len); - Mmsg(filter, " AND Path2.Path %s '%s' ", match_query[db_get_type_index(db)], query.c_str()); + Mmsg(filter, " AND Path2.Path %s '%s' ", + match_query[db_get_type_index(db)], pattern); } if (!dir_filenameid) { @@ -756,10 +754,8 @@ bool Bvfs::ls_files() edit_uint64(pwd_id, pathid); if (*pattern) { - int len = strlen(pattern); - query.check_size(len*2+1); - db_escape_string(jcr, db, query.c_str(), pattern, len); - Mmsg(filter, " AND Filename.Name %s '%s' ", match_query[db_get_type_index(db)], query.c_str()); + Mmsg(filter, " AND Filename.Name %s '%s' ", + match_query[db_get_type_index(db)], pattern); } build_ls_files_query(db, query, diff --git a/bacula/src/cats/bvfs.h b/bacula/src/cats/bvfs.h index 7156874f6a..0d85b2bf62 100644 --- a/bacula/src/cats/bvfs.h +++ b/bacula/src/cats/bvfs.h @@ -84,8 +84,8 @@ public: } void set_pattern(char *p) { - uint32_t len = strlen(p)*2+1; - pattern = check_pool_memory_size(pattern, len); + uint32_t len = strlen(p); + pattern = check_pool_memory_size(pattern, len*2+1); db_escape_string(jcr, db, pattern, p, len); } diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index 3c91aa449c..a756dae65c 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -1001,7 +1001,7 @@ const char *match_query[] = { "~", /* SQLite3 */ - "MATCH", + "LIKE", /* MATCH doesn't seems to work anymore... */ /* Ingres */ "~"