From e439f4985356eddf73a16f25a88164604ef8bf64 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 28 Apr 2004 20:48:15 +0000 Subject: [PATCH] Remove old comments git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1321 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 1 + bacula/src/cats/grant_bacula_privileges.in | 1 - bacula/src/cats/make_bacula_tables.in | 1 - bacula/src/dird/fd_cmds.c | 134 +++++++++++++++++++-- bacula/src/filed/job.c | 17 +++ 5 files changed, 140 insertions(+), 14 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index c5b4b497be..33dc4e148b 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -43,6 +43,7 @@ For 1.33 Testing/Documentation: For version 1.35: +- Document writing to a CD/DVD with Bacula. - Add check for tape alerts. - Add a "base" package to the window installer for pthreadsVCE.dll which is needed by all packages. diff --git a/bacula/src/cats/grant_bacula_privileges.in b/bacula/src/cats/grant_bacula_privileges.in index d7e66f1224..73b5c18af6 100755 --- a/bacula/src/cats/grant_bacula_privileges.in +++ b/bacula/src/cats/grant_bacula_privileges.in @@ -14,7 +14,6 @@ else else if test xsqlite = x@DB_NAME@ ; then echo "Granting SQLite privileges" - # hard coded database name @scriptdir@/grant_sqlite_privileges $* fi fi diff --git a/bacula/src/cats/make_bacula_tables.in b/bacula/src/cats/make_bacula_tables.in index 29615e906e..6360980abb 100755 --- a/bacula/src/cats/make_bacula_tables.in +++ b/bacula/src/cats/make_bacula_tables.in @@ -12,7 +12,6 @@ else @scriptdir@/make_mysql_tables $* else echo "Making PostgreSQL tables" - # hard coded database name @scriptdir@/make_postgresql_tables $* fi fi diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index b47e223796..e43a87df54 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -234,11 +234,10 @@ static int send_list(JCR *jcr, int list) for (int i=0; i < num; i++) { BPIPE *bpipe; FILE *ffd; - char buf[1000]; + char buf[2000]; char *p; int optlen, stat; INCEXE *ie; - FOPTS *fo; if (list == INC_LIST) { @@ -246,12 +245,6 @@ static int send_list(JCR *jcr, int list) } else { ie = fileset->exclude_items[i]; } - if (ie->num_opts) { - fo = ie->opts_list[0]; - for (int j=0; jregex.size(); j++) { - Dmsg1(100, "Regex=%s\n", fo->regex.get(j)); - } - } for (int j=0; jname_list.size(); j++) { p = (char *)ie->name_list.get(j); switch (*p) { @@ -349,14 +342,132 @@ bail_out: } + +/* + * Send either an Included or an Excluded list to FD + */ +static int send_incopts(JCR *jcr) +{ + FILESET *fileset = jcr->fileset; + BSOCK *fd = jcr->file_bsock; + int num = fileset->num_includes; + + for (int i=0; iinclude_items[i]; + + for (j=0; jnum_opts; j++) { + FOPTS *fo = ie->opts_list[j]; + bnet_fsend(fd, "O %s\n", fo->opts); + for (k=0; kregex.size(); k++) { + bnet_fsend(fd, "R %s\n", fo->regex.get(k)); + } + for (k=0; kwild.size(); k++) { + bnet_fsend(fd, "W %s\n", fo->wild.get(k)); + } + for (k=0; kbase.size(); k++) { + bnet_fsend(fd, "B %s\n", fo->base.get(k)); + } + bnet_fsend(fd, "N\n"); + } + + for (j=0; jname_list.size(); j++) { + p = (char *)ie->name_list.get(j); + switch (*p) { + case '|': + p++; /* skip over the | */ + fd->msg = edit_job_codes(jcr, fd->msg, p, ""); + bpipe = open_bpipe(fd->msg, 0, "r"); + if (!bpipe) { + Jmsg(jcr, M_FATAL, 0, _("Cannot run program: %s. ERR=%s\n"), + p, strerror(errno)); + goto bail_out; + } + bstrncpy(buf, "I ", sizeof(buf)); + Dmsg1(100, "Opts=%s\n", buf); + optlen = strlen(buf); + while (fgets(buf+optlen, sizeof(buf)-optlen, bpipe->rfd)) { + fd->msglen = Mmsg(&fd->msg, "%s", buf); + Dmsg2(200, "Inc/exc len=%d: %s", fd->msglen, fd->msg); + if (!bnet_send(fd)) { + Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); + goto bail_out; + } + } + if ((stat=close_bpipe(bpipe)) != 0) { + Jmsg(jcr, M_FATAL, 0, _("Error running program: %s. RtnStat=%d ERR=%s\n"), + p, stat, strerror(errno)); + goto bail_out; + } + break; + case '<': + p++; /* skip over < */ + if ((ffd = fopen(p, "r")) == NULL) { + Jmsg(jcr, M_FATAL, 0, _("Cannot open included file: %s. ERR=%s\n"), + p, strerror(errno)); + goto bail_out; + } + bstrncpy(buf, "I ", sizeof(buf)); + Dmsg1(100, "Opts=%s\n", buf); + optlen = strlen(buf); + while (fgets(buf+optlen, sizeof(buf)-optlen, ffd)) { + fd->msglen = Mmsg(&fd->msg, "%s", buf); + if (!bnet_send(fd)) { + Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); + goto bail_out; + } + } + fclose(ffd); + break; + case '\\': + p++; /* skip over \ */ + /* Note, fall through wanted */ + default: + pm_strcpy(&fd->msg, "I "); + fd->msglen = pm_strcat(&fd->msg, p); + Dmsg1(100, "Inc/Exc name=%s\n", fd->msg); + if (!bnet_send(fd)) { + Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n")); + goto bail_out; + } + break; + } + } + bnet_fsend(fd, "N\n"); + } + + bnet_sig(fd, BNET_EOD); /* end of data */ + if (!response(jcr, fd, OKinc, "Include", DISPLAY_ERROR)) { + goto bail_out; + } + return 1; + +bail_out: + set_jcr_job_status(jcr, JS_ErrorTerminated); + return 0; + +} + + /* * Send include list to File daemon */ int send_include_list(JCR *jcr) { BSOCK *fd = jcr->file_bsock; - fd->msglen = pm_strcpy(&fd->msg, inc); - bnet_send(fd); + if (jcr->fileset->new_include) { + bnet_fsend(fd, incopts); + return send_incopts(jcr); + } else { + bnet_fsend(fd, inc); + } return send_list(jcr, INC_LIST); } @@ -367,8 +478,7 @@ int send_include_list(JCR *jcr) int send_exclude_list(JCR *jcr) { BSOCK *fd = jcr->file_bsock; - fd->msglen = pm_strcpy(&fd->msg, exc); - bnet_send(fd); + bnet_fsend(fd, exc); return send_list(jcr, EXC_LIST); } diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 458e3a5a8b..abcb6f24e5 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -45,6 +45,7 @@ static int exclude_cmd(JCR *jcr); static int hello_cmd(JCR *jcr); static int job_cmd(JCR *jcr); static int include_cmd(JCR *jcr); +static int incopts_cmd(JCR *jcr); static int level_cmd(JCR *jcr); static int verify_cmd(JCR *jcr); static int restore_cmd(JCR *jcr); @@ -77,6 +78,7 @@ static struct s_cmds cmds[] = { {"exclude", exclude_cmd}, {"Hello", hello_cmd}, {"include", include_cmd}, + {"incopts", incopts_cmd}, {"JobId=", job_cmd}, {"level = ", level_cmd}, {"restore", restore_cmd}, @@ -525,6 +527,21 @@ static int include_cmd(JCR *jcr) return bnet_fsend(dir, OKinc); } +static int incopts_cmd(JCR *jcr) +{ + BSOCK *dir = jcr->dir_bsock; + + while (bnet_recv(dir) >= 0) { + strip_trailing_junk(dir->msg); + Dmsg1(000, "Incopt: %s\n", dir->msg); +// add_fname_to_list(jcr, dir->msg, INC_LIST); + + } + + return bnet_fsend(dir, OKinc); +} + + /* * Get list of files to exclude from Director * -- 2.39.5