]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add code to catalog_update to detect NULL db pointer.
authorKern Sibbald <kern@sibbald.com>
Mon, 26 Sep 2005 14:37:35 +0000 (14:37 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 26 Sep 2005 14:37:35 +0000 (14:37 +0000)
- Remove char *msg argument from catalog_request and
  catalog_update().

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2403 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.37
bacula/src/dird/catreq.c
bacula/src/dird/getmsg.c
bacula/src/dird/protos.h

index 854a4e65c132ca17f32bdf55c87dd044decf150d..cf4ea53e1f60a05da8e44a5a64aaad7248d68dc8 100644 (file)
@@ -4,6 +4,10 @@
 General:
 
 Changes to 1.37.40:
+26Sep05
+- Add code to catalog_update to detect NULL db pointer.
+- Remove char *msg argument from catalog_request and   
+  catalog_update().
 24Sep05
 - Fix mode change open in btape.c
 - Use nonblocking opens on Linux only.
index c563d35eace0ded4e37351142a0fe6e3a50c3267..605094195966c2c67ce2e4afd8cb9c89c4182c9b 100644 (file)
@@ -85,7 +85,7 @@ static int send_volume_info_to_storage_daemon(JCR *jcr, BSOCK *sd, MEDIA_DBR *mr
    return stat;
 }
 
-void catalog_request(JCR *jcr, BSOCK *bs, char *msg)
+void catalog_request(JCR *jcr, BSOCK *bs)
 {
    MEDIA_DBR mr, sdmr;
    JOBMEDIA_DBR jm;
@@ -311,7 +311,7 @@ void catalog_request(JCR *jcr, BSOCK *bs, char *msg)
  *  VolSessionId, VolSessionTime, FileIndex, and file name
  *  to store in the catalog.
  */
-void catalog_update(JCR *jcr, BSOCK *bs, char *msg)
+void catalog_update(JCR *jcr, BSOCK *bs)
 {
    unser_declare;
    uint32_t VolSessionId, VolSessionTime;
@@ -322,10 +322,20 @@ void catalog_update(JCR *jcr, BSOCK *bs, char *msg)
    int len;
    char *fname, *attr;
    ATTR_DBR *ar = NULL;
+   POOLMEM *omsg;
 
    if (!jcr->pool->catalog_files) {
       return;                         /* user disabled cataloging */
    }
+   if (!jcr->db) {
+      omsg = get_memory(bs->msglen+1);
+      pm_strcpy(omsg, bs->msg);
+      bnet_fsend(bs, _("1991 Invalid Catalog Update: %s"), omsg);    
+      Jmsg1(jcr, M_FATAL, 0, _("Invalid Catalog Update; DB not open: %s"), omsg);
+      free_memory(omsg);
+      return;
+   }
+
    /* Start transaction allocates jcr->attr and jcr->ar if needed */
    db_start_transaction(jcr, jcr->db);     /* start transaction if not already open */
    ar = jcr->ar;      
@@ -387,7 +397,7 @@ void catalog_update(JCR *jcr, BSOCK *bs, char *msg)
       Dmsg2(400, "dird<filed: stream=%d %s\n", Stream, fname);
       Dmsg1(400, "dird<filed: attr=%s\n", attr);
 
-#ifdef xxx
+#ifdef xxx_old_code
       if (!db_create_file_attributes_record(jcr, jcr->db, ar)) {
          Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), db_strerror(jcr->db));
       }
index b9d4247080c23e06f41f8e46d4992eda4a414028..8150cb89727998543fce92491b2d8526fbbdaa4a 100644 (file)
    Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
@@ -198,14 +193,14 @@ int bget_dirmsg(BSOCK *bs)
        */
       if (bs->msg[0] == 'C') {        /* Catalog request */
          Dmsg2(900, "Catalog req jcr 0x%x: %s", jcr, bs->msg);
-         catalog_request(jcr, bs, msg);
+         catalog_request(jcr, bs);
          Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
          free_jcr(jcr);
          continue;
       }
       if (bs->msg[0] == 'U') {        /* Catalog update */
          Dmsg2(900, "Catalog upd jcr 0x%x: %s", jcr, bs->msg);
-         catalog_update(jcr, bs, msg);
+         catalog_update(jcr, bs);
          Dmsg1(900, "Calling freejcr 0x%x\n", jcr);
          free_jcr(jcr);
          continue;
index 8917124961b5cf028fbad1418b2f3b32036d7ece..5938e0e14bc690e73088fd287994b51f06d0238f 100644 (file)
@@ -56,8 +56,8 @@ void make_unique_restore_filename(UAContext *ua, POOLMEM **fname);
 
 
 /* catreq.c */
-extern void catalog_request(JCR *jcr, BSOCK *bs, char *buf);
-extern void catalog_update(JCR *jcr, BSOCK *bs, char *buf);
+extern void catalog_request(JCR *jcr, BSOCK *bs);
+extern void catalog_update(JCR *jcr, BSOCK *bs);
 
 /* dird_conf.c */
 extern const char *level_to_str(int level);