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.
 
    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;
  *  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;
    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;      
       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));
       }
 
    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.
 
  */
 
        */
       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;
 
 
 
 /* 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);