]> git.sur5r.net Git - bacula/bacula/commitdiff
Update for Dan's tests
authorKern Sibbald <kern@sibbald.com>
Fri, 14 Sep 2007 06:30:12 +0000 (06:30 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 14 Sep 2007 06:30:12 +0000 (06:30 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5551 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/dircmd.c
bacula/src/stored/job.c

index dad767bfc082be72825e4a1c0bbb40fba3d39091..ccc54dc16681e12784e333ff69a344e1f9f146d7 100644 (file)
@@ -152,16 +152,17 @@ void *handle_connection_request(void *arg)
 
    if (bs->recv() <= 0) {
       Emsg0(M_ERROR, 0, _("Connection request failed.\n"));
-      bnet_close(bs);
+      bs->close();
       return NULL;
    }
 
    /*
     * Do a sanity check on the message received
     */
-   if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)-25) {
+   if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)+100) {
+      Dmsg1(000, "<filed: %s", bs->msg);
       Emsg1(M_ERROR, 0, _("Invalid connection. Len=%d\n"), bs->msglen);
-      bnet_close(bs);
+      bs->close();
       return NULL;
    }
    /*
@@ -169,6 +170,9 @@ void *handle_connection_request(void *arg)
     *   call FD handler.
     */
    Dmsg1(110, "Conn: %s", bs->msg);
+   if (debug_level == 3) {
+      Dmsg1(000, "<filed: %s", bs->msg);
+   }
    if (sscanf(bs->msg, "Hello Start Job %127s", name) == 1) {
       Dmsg0(110, "Got a FD connection\n");
       handle_filed_connection(bs, name);
@@ -216,7 +220,7 @@ void *handle_connection_request(void *arg)
         if (strncmp(cmds[i].cmd, bs->msg, strlen(cmds[i].cmd)) == 0) {
            if ((!cmds[i].monitoraccess) && (jcr->director->monitor)) {
               Dmsg1(100, "Command \"%s\" is invalid.\n", cmds[i].cmd);
-              bnet_fsend(bs, invalid_cmd);
+              bs->fsend(invalid_cmd);
               bs->signal(BNET_EOD);
               break;
            }
@@ -230,14 +234,14 @@ void *handle_connection_request(void *arg)
         }
       }
       if (!found) {                   /* command not found */
-        bnet_fsend(bs, derrmsg);
+        bs->fsend(derrmsg);
         break;
       }
    }
 bail_out:
    generate_daemon_event(jcr, "JobEnd");
    dequeue_messages(jcr);             /* send any queued messages */
-   bnet_sig(bs, BNET_TERMINATE);
+   bs->signal(BNET_TERMINATE);
    free_jcr(jcr);
    return NULL;
 }
index 9fa0fce53d07519b83322a852ead766af4ccb47e..32cf3441931c364277cf5eaf62bda4dec0393a16 100644 (file)
@@ -201,7 +201,7 @@ bool run_cmd(JCR *jcr)
 }
 
 /*
- * After receiving a connection (in job.c) if it is
+ * After receiving a connection (in dircmd.c) if it is
  *   from the File daemon, this routine is called.
  */
 void handle_filed_connection(BSOCK *fd, char *job_name)
@@ -210,7 +210,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
 
    bmicrosleep(0, 50000);             /* wait 50 millisecs */
    if (!(jcr=get_jcr_by_full_name(job_name))) {
-      Jmsg1(NULL, M_FATAL, 0, _("Job name not found: %s\n"), job_name);
+      Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
       Dmsg1(100, "Job name not found: %s\n", job_name);
       return;
    }
@@ -222,7 +222,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
 
    if (jcr->authenticated) {
       Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s already authenticated.\n"),
-         jcr->JobId, jcr->Job);
+         (uint32_t)jcr->JobId, jcr->Job);
       free_jcr(jcr);
       return;
    }
@@ -230,6 +230,9 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
    /*
     * Authenticate the File daemon
     */
+   if (debug_level == 3) {
+      Dmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
+   }
    if (jcr->authenticated || !authenticate_filed(jcr)) {
       Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
       Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));