From: Eric Bollengier Date: Wed, 22 Sep 2021 16:11:38 +0000 (+0200) Subject: Add 'list metadata' help usage and add Name search for attachment X-Git-Tag: Beta-15.0.0~870 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fb489b8701efbcb441293057bfe33395f78c3df;p=thirdparty%2Fbacula.git Add 'list metadata' help usage and add Name search for attachment --- diff --git a/bacula/src/cats/cats.c b/bacula/src/cats/cats.c index eed9b5237..8cef8a602 100644 --- a/bacula/src/cats/cats.c +++ b/bacula/src/cats/cats.c @@ -773,7 +773,12 @@ void META_DBR::create_db_filter(JCR *jcr, BDB *db, POOLMEM **where) } } else { if (Id[0] != 0) { - db->search_op(jcr, "MetaAttachment.AttachmentEmailId", Id, esc.handle(), tmp.handle()); + db_escape_string(jcr, jcr->db, esc.c_str(), Id, strlen(Id)); + Mmsg(tmp, " MetaAttachment.AttachmentEmailId = '%s'", esc.c_str()); + append_AND_OR_filter(and_or, where, tmp.c_str()); + } + if (Name[0] != 0) { + db->search_op(jcr, "MetaAttachment.AttachmentName", Name, esc.handle(), tmp.handle()); append_AND_OR_filter(and_or, where, tmp.c_str()); } } diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 74c3d66d5..419d979c8 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -667,13 +667,14 @@ public: char MinTime[MAX_NAME_LENGTH]; char MaxTime[MAX_NAME_LENGTH]; char Plugin[MAX_NAME_LENGTH]; + char Name[MAX_SEARCH_LENGTH]; META_DBR(): JobId(0), MinSize(-1), MaxSize(-1), HasAttachment(-1), isDraft(-1), isRead(-1), offset(0), limit(512), order(0), orderby(0), all(false) { *Id = *Tenant = *Owner = 0; *ClientName = *From = *To = *Cc = *Subject = *Tags = 0; *BodyPreview = *Type = *ConversationId = *Category = 0; - *MinTime = *MaxTime = *Plugin = 0; + *Name = *MinTime = *MaxTime = *Plugin = 0; }; ~META_DBR() {}; void get_important_keys(POOLMEM **dest); diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 264167b63..a2f6f7382 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -138,6 +138,11 @@ static struct cmdstruct commands[] = { /* C "\tevents [type= | limit= | order= | days= | start= | end= |\n" "\t\t source= | code= | type= ]\n" "\tobjects [jobid= client= type= | category= | status= | limit= | order= ]\n" + "\tmetadata type= [jobid= client= order= limit= orderby=