2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Network Utility Routines
41 #ifndef ENODATA /* not defined on BSD systems */
46 #define socketRead(fd, buf, len) ::recv(fd, buf, len, 0)
47 #define socketWrite(fd, buf, len) ::send(fd, buf, len, 0)
48 #define socketClose(fd) ::closesocket(fd)
50 #define socketRead(fd, buf, len) ::read(fd, buf, len)
51 #define socketWrite(fd, buf, len) ::write(fd, buf, len)
52 #define socketClose(fd) ::close(fd)
56 * This is a non-class BSOCK "constructor" because we want to
57 * call the Bacula smartalloc routines instead of new.
61 BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK));
68 memset(this, 0, sizeof(BSOCK));
70 msg = get_pool_memory(PM_MESSAGE);
71 errmsg = get_pool_memory(PM_MESSAGE);
73 * ****FIXME**** reduce this to a few hours once
74 * heartbeats are implemented
76 timeout = 60 * 60 * 6 * 24; /* 6 days timeout */
80 * This is our "class destructor" that ensures that we use
81 * smartalloc rather than the system free().
83 void BSOCK::free_bsock()
88 void BSOCK::free_tls()
90 free_tls_connection(this->tls);
95 * Try to connect to host for max_retry_time at retry_time intervals.
96 * Note, you must have called the constructor prior to calling
99 bool BSOCK::connect(JCR * jcr, int retry_interval, utime_t max_retry_time,
101 const char *name, char *host, char *service, int port,
107 time_t begin_time = time(NULL);
109 btimer_t *tid = NULL;
111 /* Try to trap out of OS call when time expires */
112 if (max_retry_time) {
113 tid = start_thread_timer(jcr, pthread_self(), (uint32_t)max_retry_time);
116 for (i = 0; !open(jcr, name, host, service, port, heart_beat, &fatal);
117 i -= retry_interval) {
119 if (fatal || (jcr && job_canceled(jcr))) {
122 Dmsg4(100, "Unable to connect to %s on %s:%d. ERR=%s\n",
123 name, host, port, be.bstrerror());
125 i = 60 * 5; /* complain again in 5 minutes */
127 Qmsg4(jcr, M_WARNING, 0, _(
128 "Could not connect to %s on %s:%d. ERR=%s\n"
129 "Retrying ...\n"), name, host, port, be.bstrerror());
131 bmicrosleep(retry_interval, 0);
133 if (begin_time + max_retry_time <= now) {
134 Qmsg4(jcr, M_FATAL, 0, _("Unable to connect to %s on %s:%d. ERR=%s\n"),
135 name, host, port, be.bstrerror());
143 stop_thread_timer(tid);
150 * Finish initialization of the pocket structure.
152 void BSOCK::fin_init(JCR * jcr, int sockfd, const char *who, const char *host, int port,
153 struct sockaddr *lclient_addr)
155 Dmsg3(100, "who=%s host=%s port=%d\n", who, host, port);
157 set_who(bstrdup(who));
158 set_host(bstrdup(host));
160 memcpy(&client_addr, lclient_addr, sizeof(client_addr));
165 * Copy the address from the configuration dlist that gets passed in
167 void BSOCK::set_source_address(dlist *src_addr_list)
171 // delete the object we already have, if it's allocated
178 addr = (IPADDR*) src_addr_list->first();
179 src_addr = New( IPADDR(*addr));
185 * Open a TCP connection to the server
187 * Returns BSOCK * pointer on success
190 bool BSOCK::open(JCR *jcr, const char *name, char *host, char *service,
191 int port, utime_t heart_beat, int *fatal)
196 bool connected = false;
202 * Fill in the structure serv_addr with the address of
203 * the server that we want to connect with.
205 if ((addr_list = bnet_host2ipaddrs(host, 0, &errstr)) == NULL) {
206 /* Note errstr is not malloc'ed */
207 Qmsg2(jcr, M_ERROR, 0, _("gethostbyname() for host \"%s\" failed: ERR=%s\n"),
209 Dmsg2(100, "bnet_host2ipaddrs() for host %s failed: ERR=%s\n",
215 foreach_dlist(ipaddr, addr_list) {
216 ipaddr->set_port_net(htons(port));
217 char allbuf[256 * 10];
219 Dmsg2(100, "Current %sAll %s\n",
220 ipaddr->build_address_str(curbuf, sizeof(curbuf)),
221 build_addresses_str(addr_list, allbuf, sizeof(allbuf)));
222 /* Open a TCP socket */
223 if ((sockfd = socket(ipaddr->get_family(), SOCK_STREAM, 0)) < 0) {
227 Pmsg3(000, _("Socket open error. proto=%d port=%d. ERR=%s\n"),
228 ipaddr->get_family(), ipaddr->get_port_host_order(), be.bstrerror());
232 /* Bind to the source address if it is set */
234 if (bind(sockfd, src_addr->get_sockaddr(), src_addr->get_sockaddr_len()) < 0) {
238 Pmsg2(000, _("Source address bind error. proto=%d. ERR=%s\n"),
239 src_addr->get_family(), be.bstrerror() );
245 * Keep socket from timing out from inactivity
247 if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
249 Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
252 #if defined(TCP_KEEPIDLE)
255 if (setsockopt(sockfd, IPPROTO_IP, TCP_KEEPIDLE, (sockopt_val_t)&opt, sizeof(opt)) < 0) {
257 Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPIDLE on socket: %s\n"),
263 /* connect to server */
264 if (::connect(sockfd, ipaddr->get_sockaddr(), ipaddr->get_sockaddr_len()) < 0) {
275 free_addresses(addr_list);
276 errno = save_errno | b_errno_win32;
280 * Keep socket from timing out from inactivity
281 * Do this a second time out of paranoia
283 if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
285 Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
288 fin_init(jcr, sockfd, name, host, port, ipaddr->get_sockaddr());
289 free_addresses(addr_list);
294 * Force read/write to use locking
296 bool BSOCK::set_locking()
300 return true; /* already set */
302 if ((stat = pthread_mutex_init(&m_mutex, NULL)) != 0) {
304 Qmsg(m_jcr, M_FATAL, 0, _("Could not init bsock mutex. ERR=%s\n"),
308 m_use_locking = true;
312 void BSOCK::clear_locking()
314 if (!m_use_locking) {
317 m_use_locking = false;
318 pthread_mutex_destroy(&m_mutex);
323 * Send a message over the network. The send consists of
324 * two network packets. The first is sends a 32 bit integer containing
325 * the length of the data packet which follows.
327 * Returns: false on failure
337 if (errors || is_terminated() || msglen > 1000000) {
340 if (m_use_locking) P(m_mutex);
341 /* Compute total packet length */
343 pktsiz = sizeof(pktsiz); /* signal, no data */
345 pktsiz = msglen + sizeof(pktsiz); /* data */
347 /* Store packet length at head of message -- note, we
348 * have reserved an int32_t just before msg, so we can
351 hdr = (int32_t *)(msg - (int)sizeof(pktsiz));
352 *hdr = htonl(msglen); /* store signal/length */
354 out_msg_no++; /* increment message number */
356 /* send data packet */
357 timer_start = watchdog_time; /* start timer */
359 /* Full I/O done in one write */
360 rc = write_nbytes(this, (char *)hdr, pktsiz);
361 timer_start = 0; /* clear timer */
370 if (!m_suppress_error_msgs) {
371 Qmsg5(m_jcr, M_ERROR, 0,
372 _("Write error sending %d bytes to %s:%s:%d: ERR=%s\n"),
374 m_host, m_port, this->bstrerror());
377 Qmsg5(m_jcr, M_ERROR, 0,
378 _("Wrote %d bytes to %s:%s:%d, but only %d accepted.\n"),
379 msglen, m_who, m_host, m_port, rc);
383 if (m_use_locking) V(m_mutex);
388 * Format and send a message
389 * Returns: false on error
392 bool BSOCK::fsend(const char *fmt, ...)
397 if (errors || is_terminated()) {
400 /* This probably won't work, but we vsnprintf, then if we
401 * get a negative length or a length greater than our buffer
402 * (depending on which library is used), the printf was truncated, so
403 * get a bigger buffer and try again.
406 maxlen = sizeof_pool_memory(msg) - 1;
407 va_start(arg_ptr, fmt);
408 msglen = bvsnprintf(msg, maxlen, fmt, arg_ptr);
410 if (msglen > 0 && msglen < (maxlen - 5)) {
413 msg = realloc_pool_memory(msg, maxlen + maxlen / 2);
419 * Receive a message from the other end. Each message consists of
420 * two packets. The first is a header that contains the size
421 * of the data that follows in the second packet.
422 * Returns number of bytes read (may return zero)
423 * Returns -1 on signal (BNET_SIGNAL)
424 * Returns -2 on hard end of file (BNET_HARDEOF)
425 * Returns -3 on error (BNET_ERROR)
427 * Unfortunately, it is a bit complicated because we have these
430 * 2. Signal including end of data stream
431 * 3. Hard end of file
433 * Using is_bnet_stop() and is_bnet_error() you can figure this all out.
435 int32_t BSOCK::recv()
442 if (errors || is_terminated()) {
446 if (m_use_locking) P(m_mutex);
447 read_seqno++; /* bump sequence number */
448 timer_start = watchdog_time; /* set start wait time */
450 /* get data size -- in int32_t */
451 if ((nbytes = read_nbytes(this, (char *)&pktsiz, sizeof(int32_t))) <= 0) {
452 timer_start = 0; /* clear timer */
453 /* probably pipe broken because client died */
460 nbytes = BNET_HARDEOF; /* assume hard EOF received */
463 timer_start = 0; /* clear timer */
464 if (nbytes != sizeof(int32_t)) {
467 Qmsg5(m_jcr, M_ERROR, 0, _("Read expected %d got %d from %s:%s:%d\n"),
468 sizeof(int32_t), nbytes, m_who, m_host, m_port);
473 pktsiz = ntohl(pktsiz); /* decode no. of bytes that follow */
475 if (pktsiz == 0) { /* No data transferred */
476 timer_start = 0; /* clear timer */
479 nbytes = 0; /* zero bytes read */
483 /* If signal or packet size too big */
484 if (pktsiz < 0 || pktsiz > 1000000) {
485 if (pktsiz > 0) { /* if packet too big */
486 Qmsg3(m_jcr, M_FATAL, 0,
487 _("Packet size too big from \"%s:%s:%d. Terminating connection.\n"),
488 m_who, m_host, m_port);
489 pktsiz = BNET_TERMINATE; /* hang up */
491 if (pktsiz == BNET_TERMINATE) {
494 timer_start = 0; /* clear timer */
496 msglen = pktsiz; /* signal code */
497 nbytes = BNET_SIGNAL; /* signal */
501 /* Make sure the buffer is big enough + one byte for EOS */
502 if (pktsiz >= (int32_t) sizeof_pool_memory(msg)) {
503 msg = realloc_pool_memory(msg, pktsiz + 100);
506 timer_start = watchdog_time; /* set start wait time */
508 /* now read the actual data */
509 if ((nbytes = read_nbytes(this, msg, pktsiz)) <= 0) {
510 timer_start = 0; /* clear timer */
517 Qmsg4(m_jcr, M_ERROR, 0, _("Read error from %s:%s:%d: ERR=%s\n"),
518 m_who, m_host, m_port, this->bstrerror());
522 timer_start = 0; /* clear timer */
525 if (nbytes != pktsiz) {
528 Qmsg5(m_jcr, M_ERROR, 0, _("Read expected %d got %d from %s:%s:%d\n"),
529 pktsiz, nbytes, m_who, m_host, m_port);
533 /* always add a zero by to properly terminate any
534 * string that was send to us. Note, we ensured above that the
535 * buffer is at least one byte longer than the message length.
537 msg[nbytes] = 0; /* terminate in case it is a string */
538 sm_check(__FILE__, __LINE__, false);
541 if (m_use_locking) V(m_mutex);
542 return nbytes; /* return actual length of message */
549 bool BSOCK::signal(int signal)
552 if (signal == BNET_TERMINATE) {
553 m_suppress_error_msgs = true;
559 * Despool spooled attributes
561 bool BSOCK::despool(void update_attr_spool_size(ssize_t size), ssize_t tsize)
565 ssize_t last = 0, size = 0;
567 JCR *jcr = get_jcr();
571 #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_WILLNEED)
572 posix_fadvise(fileno(m_spool_fd), 0, 0, POSIX_FADV_WILLNEED);
575 while (fread((char *)&pktsiz, 1, sizeof(int32_t), m_spool_fd) ==
577 size += sizeof(int32_t);
578 msglen = ntohl(pktsiz);
580 if (msglen > (int32_t)sizeof_pool_memory(msg)) {
581 msg = realloc_pool_memory(msg, msglen + 1);
583 nbytes = fread(msg, 1, msglen, m_spool_fd);
584 if (nbytes != (size_t)msglen) {
586 Dmsg2(400, "nbytes=%d msglen=%d\n", nbytes, msglen);
587 Qmsg1(get_jcr(), M_FATAL, 0, _("fread attr spool error. ERR=%s\n"),
589 update_attr_spool_size(tsize - last);
593 if ((++count & 0x3F) == 0) {
594 update_attr_spool_size(size - last);
599 if (jcr && job_canceled(jcr)) {
603 update_attr_spool_size(tsize - last);
604 if (ferror(m_spool_fd)) {
605 Qmsg(jcr, M_FATAL, 0, _("fread attr spool I/O error.\n"));
612 * Return the string for the error that occurred
613 * on the socket. Only the first error is retained.
615 const char *BSOCK::bstrerror()
618 if (errmsg == NULL) {
619 errmsg = get_pool_memory(PM_MESSAGE);
621 pm_strcpy(errmsg, be.bstrerror(b_errno));
625 int BSOCK::get_peer(char *buf, socklen_t buflen)
627 #if !defined(HAVE_WIN32)
628 if (peer_addr.sin_family == 0) {
629 socklen_t salen = sizeof(peer_addr);
630 int rval = (getpeername)(m_fd, (struct sockaddr *)&peer_addr, &salen);
631 if (rval < 0) return rval;
633 if (!inet_ntop(peer_addr.sin_family, &peer_addr.sin_addr, buf, buflen))
643 * Set the network buffer size, suggested size is in size.
644 * Actual size obtained is returned in bs->msglen
646 * Returns: false on failure
649 bool BSOCK::set_buffer_size(uint32_t size, int rw)
651 uint32_t dbuf_size, start_size;
652 #if defined(IP_TOS) && defined(IPTOS_THROUGHPUT)
654 opt = IPTOS_THROUGHPUT;
655 setsockopt(fd, IPPROTO_IP, IP_TOS, (sockopt_val_t)&opt, sizeof(opt));
661 dbuf_size = DEFAULT_NETWORK_BUFFER_SIZE;
663 start_size = dbuf_size;
664 if ((msg = realloc_pool_memory(msg, dbuf_size + 100)) == NULL) {
665 Qmsg0(get_jcr(), M_FATAL, 0, _("Could not malloc BSOCK data buffer\n"));
668 if (rw & BNET_SETBUF_READ) {
669 while ((dbuf_size > TAPE_BSIZE) && (setsockopt(m_fd, SOL_SOCKET,
670 SO_RCVBUF, (sockopt_val_t) & dbuf_size, sizeof(dbuf_size)) < 0)) {
672 Qmsg1(get_jcr(), M_ERROR, 0, _("sockopt error: %s\n"), be.bstrerror());
673 dbuf_size -= TAPE_BSIZE;
675 Dmsg1(200, "set network buffer size=%d\n", dbuf_size);
676 if (dbuf_size != start_size) {
677 Qmsg1(get_jcr(), M_WARNING, 0,
678 _("Warning network buffer = %d bytes not max size.\n"), dbuf_size);
680 if (dbuf_size % TAPE_BSIZE != 0) {
681 Qmsg1(get_jcr(), M_ABORT, 0,
682 _("Network buffer size %d not multiple of tape block size.\n"),
689 dbuf_size = DEFAULT_NETWORK_BUFFER_SIZE;
691 start_size = dbuf_size;
692 if (rw & BNET_SETBUF_WRITE) {
693 while ((dbuf_size > TAPE_BSIZE) && (setsockopt(m_fd, SOL_SOCKET,
694 SO_SNDBUF, (sockopt_val_t) & dbuf_size, sizeof(dbuf_size)) < 0)) {
696 Qmsg1(get_jcr(), M_ERROR, 0, _("sockopt error: %s\n"), be.bstrerror());
697 dbuf_size -= TAPE_BSIZE;
699 Dmsg1(900, "set network buffer size=%d\n", dbuf_size);
700 if (dbuf_size != start_size) {
701 Qmsg1(get_jcr(), M_WARNING, 0,
702 _("Warning network buffer = %d bytes not max size.\n"), dbuf_size);
704 if (dbuf_size % TAPE_BSIZE != 0) {
705 Qmsg1(get_jcr(), M_ABORT, 0,
706 _("Network buffer size %d not multiple of tape block size.\n"),
716 * Set socket non-blocking
717 * Returns previous socket flag
719 int BSOCK::set_nonblocking()
724 /* Get current flags */
725 if ((oflags = fcntl(m_fd, F_GETFL, 0)) < 0) {
727 Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_GETFL error. ERR=%s\n"), be.bstrerror());
730 /* Set O_NONBLOCK flag */
731 if ((fcntl(m_fd, F_SETFL, oflags|O_NONBLOCK)) < 0) {
733 Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.bstrerror());
743 ioctlsocket(m_fd, FIONBIO, &ioctlArg);
751 * Set socket blocking
752 * Returns previous socket flags
754 int BSOCK::set_blocking()
758 /* Get current flags */
759 if ((oflags = fcntl(m_fd, F_GETFL, 0)) < 0) {
761 Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_GETFL error. ERR=%s\n"), be.bstrerror());
764 /* Set O_NONBLOCK flag */
765 if ((fcntl(m_fd, F_SETFL, oflags & ~O_NONBLOCK)) < 0) {
767 Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.bstrerror());
777 ioctlsocket(m_fd, FIONBIO, &ioctlArg);
785 * Restores socket flags
787 void BSOCK::restore_blocking (int flags)
790 if ((fcntl(m_fd, F_SETFL, flags)) < 0) {
792 Qmsg1(get_jcr(), M_ABORT, 0, _("fcntl F_SETFL error. ERR=%s\n"), be.bstrerror());
795 m_blocking = (flags & O_NONBLOCK) ? true : false;
797 u_long ioctlArg = flags;
799 ioctlsocket(m_fd, FIONBIO, &ioctlArg);
805 * Wait for a specified time for data to appear on
806 * the BSOCK connection.
808 * Returns: 1 if data available
812 int BSOCK::wait_data(int sec, int usec)
818 FD_SET((unsigned)m_fd, &fdset);
822 switch (select(m_fd + 1, &fdset, NULL, NULL, &tv)) {
823 case 0: /* timeout */
828 if (errno == EINTR) {
831 return -1; /* error return */
840 * As above, but returns on interrupt
842 int BSOCK::wait_data_intr(int sec, int usec)
851 FD_SET((unsigned)m_fd, &fdset);
854 switch (select(m_fd + 1, &fdset, NULL, NULL, &tv)) {
855 case 0: /* timeout */
860 return -1; /* error return */
869 * Note, this routine closes and destroys all the sockets
870 * that are open including the duped ones.
884 for (; bsock; bsock = next) {
885 next = bsock->m_next; /* get possible pointer to next before destoryed */
886 if (!bsock->m_duped) {
887 /* Shutdown tls cleanly. */
889 tls_bsock_shutdown(bsock);
890 free_tls_connection(bsock->tls);
893 if (bsock->is_timed_out()) {
894 shutdown(bsock->m_fd, SHUT_RDWR); /* discard any pending I/O */
896 socketClose(bsock->m_fd); /* normal close */
903 void BSOCK::destroy()
906 free_pool_memory(msg);
909 ASSERT(1 == 0); /* double close */
912 free_pool_memory(errmsg);
930 /* Commands sent to Director */
931 static char hello[] = "Hello %s calling\n";
933 /* Response from Director */
934 static char OKhello[] = "1000 OK:";
937 * Authenticate Director
939 bool BSOCK::authenticate_director(const char *name, const char *password,
940 TLS_CONTEXT *tls_ctx, char *msg, int msglen)
942 int tls_local_need = BNET_TLS_NONE;
943 int tls_remote_need = BNET_TLS_NONE;
944 int compatible = true;
945 char bashed_name[MAX_NAME_LENGTH];
946 BSOCK *dir = this; /* for readability */
950 * Send my name to the Director then do authentication
953 /* Timeout Hello after 15 secs */
954 dir->start_timer(15);
955 dir->fsend(hello, bashed_name);
957 if (get_tls_enable(tls_ctx)) {
958 tls_local_need = get_tls_enable(tls_ctx) ? BNET_TLS_REQUIRED : BNET_TLS_OK;
961 /* respond to Dir challenge */
962 if (!cram_md5_respond(dir, password, &tls_remote_need, &compatible) ||
963 /* Now challenge dir */
964 !cram_md5_challenge(dir, password, tls_local_need, compatible)) {
965 bsnprintf(msg, msglen, _("Director authorization problem at \"%s:%d\"\n"),
966 dir->host(), dir->port());
970 /* Verify that the remote host is willing to meet our TLS requirements */
971 if (tls_remote_need < tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) {
972 bsnprintf(msg, msglen, _("Authorization problem:"
973 " Remote server at \"%s:%d\" did not advertise required TLS support.\n"),
974 dir->host(), dir->port());
978 /* Verify that we are willing to meet the remote host's requirements */
979 if (tls_remote_need > tls_local_need && tls_local_need != BNET_TLS_OK && tls_remote_need != BNET_TLS_OK) {
980 bsnprintf(msg, msglen, _("Authorization problem with Director at \"%s:%d\":"
981 " Remote server requires TLS.\n"),
982 dir->host(), dir->port());
987 /* Is TLS Enabled? */
989 if (tls_local_need >= BNET_TLS_OK && tls_remote_need >= BNET_TLS_OK) {
990 /* Engage TLS! Full Speed Ahead! */
991 if (!bnet_tls_client(tls_ctx, dir, NULL)) {
992 bsnprintf(msg, msglen, _("TLS negotiation failed with Director at \"%s:%d\"\n"),
993 dir->host(), dir->port());
999 Dmsg1(6, ">dird: %s", dir->msg);
1000 if (dir->recv() <= 0) {
1002 bsnprintf(msg, msglen, _("Bad response to Hello command: ERR=%s\n"
1003 "The Director at \"%s:%d\" is probably not running.\n"),
1004 dir->bstrerror(), dir->host(), dir->port());
1009 Dmsg1(10, "<dird: %s", dir->msg);
1010 if (strncmp(dir->msg, OKhello, sizeof(OKhello)-1) != 0) {
1011 bsnprintf(msg, msglen, _("Director at \"%s:%d\" rejected Hello command\n"),
1012 dir->host(), dir->port());
1015 bsnprintf(msg, msglen, "%s", dir->msg);
1021 bsnprintf(msg, msglen, _("Authorization problem with Director at \"%s:%d\"\n"
1022 "Most likely the passwords do not agree.\n"
1023 "If you are using TLS, there may have been a certificate validation error during the TLS handshake.\n"
1024 "Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION003760000000000000000 for help.\n"),
1025 dir->host(), dir->port());