]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.4.3-getmsg.patch
ebl Update for scratchpool-pool-test
[bacula/bacula] / bacula / patches / 2.4.3-getmsg.patch
1  
2  This patch used the jcr stored in the BSOCK packet during callbacks
3  to the Director rather than looking them up in the JCR list.
4
5  It can be applied to Bacula version 2.4.3 (or earlier) with:
6
7  cd <bacula-source>
8  patch -p0 <2.4.3-getmsg.patch
9  ./configure <your options>
10  make
11  ...
12  make install
13
14
15 Index: src/dird/getmsg.c
16 ===================================================================
17 --- src/dird/getmsg.c   (revision 7970)
18 +++ src/dird/getmsg.c   (working copy)
19 @@ -1,7 +1,7 @@
20  /*
21     Bacula® - The Network Backup Solution
22  
23 -   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
24 +   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
25  
26     The main author of Bacula is Kern Sibbald, with contributions from
27     many others, a complete list can be found in the file AUTHORS.
28 @@ -20,7 +20,7 @@
29     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
30     02110-1301, USA.
31  
32 -   Bacula® is a registered trademark of John Walker.
33 +   Bacula® is a registered trademark of Kern Sibbald.
34     The licensor of Bacula is the Free Software Foundation Europe
35     (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
36     Switzerland, email:ftf@fsfeurope.org.
37 @@ -102,12 +102,12 @@
38     char Job[MAX_NAME_LENGTH];
39     char MsgType[20];
40     int type, level;
41 -   JCR *jcr;
42 +   JCR *jcr = bs->jcr();
43     char *msg;
44  
45     for (;;) {
46        n = bs->recv();
47 -      Dmsg2(100, "bget_dirmsg %d: %s", n, bs->msg);
48 +      Dmsg2(300, "bget_dirmsg %d: %s\n", n, bs->msg);
49  
50        if (is_bnet_stop(bs)) {
51           return n;                    /* error or terminate */
52 @@ -142,7 +142,7 @@
53              bs->fsend("btime %s\n", edit_uint64(get_current_btime(),ed1));
54              break;
55           default:
56 -            Emsg1(M_WARNING, 0, _("bget_dirmsg: unknown bnet signal %d\n"), bs->msglen);
57 +            Jmsg1(jcr, M_WARNING, 0, _("bget_dirmsg: unknown bnet signal %d\n"), bs->msglen);
58              return n;
59           }
60           continue;
61 @@ -160,21 +160,13 @@
62         *  Try to fulfill it.
63         */
64        if (sscanf(bs->msg, "%020s Job=%127s ", MsgType, Job) != 2) {
65 -         Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
66 +         Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
67           continue;
68        }
69 -      if (strcmp(Job, "*System*") == 0) {
70 -         jcr = NULL;                  /* No jcr */
71 -      } else if (!(jcr=get_jcr_by_full_name(Job))) {
72 -         Emsg1(M_ERROR, 0, _("Job not found: %s\n"), bs->msg);
73 -         continue;
74 -      }
75 -      Dmsg1(900, "Getmsg got jcr 0x%x\n", jcr);
76  
77        /* Skip past "Jmsg Job=nnn" */
78        if (!(msg=find_msg_start(bs->msg))) {
79 -         Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
80 -         free_jcr(jcr);
81 +         Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
82           continue;
83        }
84  
85 @@ -185,8 +177,7 @@
86        if (bs->msg[0] == 'J') {           /* Job message */
87           if (sscanf(bs->msg, "Jmsg Job=%127s type=%d level=%d",
88                      Job, &type, &level) != 3) {
89 -            Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
90 -            free_jcr(jcr);
91 +            Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
92              continue;
93           }
94           Dmsg1(900, "Got msg: %s\n", bs->msg);
95 @@ -199,7 +190,6 @@
96           }
97           Dmsg1(900, "Dispatch msg: %s", msg);
98           dispatch_message(jcr, type, level, msg);
99 -         free_jcr(jcr);
100           continue;
101        }
102        /*
103 @@ -209,21 +199,16 @@
104        if (bs->msg[0] == 'C') {        /* Catalog request */
105           Dmsg2(900, "Catalog req jcr 0x%x: %s", jcr, bs->msg);
106           catalog_request(jcr, bs);
107 -         Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
108 -         free_jcr(jcr);
109           continue;
110        }
111        if (bs->msg[0] == 'U') {        /* SD sending attributes */
112           Dmsg2(900, "Catalog upd jcr 0x%x: %s", jcr, bs->msg);
113           catalog_update(jcr, bs);
114 -         Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
115 -         free_jcr(jcr);
116           continue;
117        }
118        if (bs->msg[0] == 'M') {        /* Mount request */
119           Dmsg1(900, "Mount req: %s", bs->msg);
120           mount_request(jcr, bs, msg);
121 -         free_jcr(jcr);
122           continue;
123        }
124        if (bs->msg[0] == 'S') {       /* Status change */
125 @@ -232,9 +217,8 @@
126           if (sscanf(bs->msg, Job_status, &Job, &JobStatus) == 2) {
127              jcr->SDJobStatus = JobStatus; /* current status */
128           } else {
129 -            Emsg1(M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
130 +            Jmsg1(jcr, M_ERROR, 0, _("Malformed message: %s\n"), bs->msg);
131           }
132 -         free_jcr(jcr);
133           continue;
134        }
135  #ifdef needed