From 457a259ffa6cf40a3aefadfc9402abeac71644a2 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 14 Sep 2007 06:30:12 +0000 Subject: [PATCH] Update for Dan's tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5551 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dircmd.c | 16 ++++++++++------ bacula/src/stored/job.c | 9 ++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index dad767bfc0..ccc54dc166 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -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, "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, "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; } diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 9fa0fce53d..32cf344193 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -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")); -- 2.39.5