From b687b31902db27c95b1623809e683899f31c85fe Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 21 Nov 2004 17:53:03 +0000 Subject: [PATCH] - Make authentication timeout compile time configurable. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1713 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/authenticate.c | 4 ++-- bacula/src/filed/authenticate.c | 4 ++-- bacula/src/lib/tree.c | 1 + bacula/src/stored/authenticate.c | 4 ++-- bacula/src/version.h | 11 +++++++++++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index 2b6762d955..733177f1fe 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -65,7 +65,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store) bstrncpy(dirname, director->hdr.name, sizeof(dirname)); bash_spaces(dirname); /* Timeout Hello after 1 min */ - btimer_t *tid = start_bsock_timer(sd, 60 * 10); + btimer_t *tid = start_bsock_timer(sd, AUTH_TIMEOUT); if (!bnet_fsend(sd, hello, dirname)) { stop_bsock_timer(tid); Dmsg1(50, _("Error sending Hello to Storage daemon. ERR=%s\n"), bnet_strerror(sd)); @@ -121,7 +121,7 @@ int authenticate_file_daemon(JCR *jcr) bstrncpy(dirname, director->hdr.name, sizeof(dirname)); bash_spaces(dirname); /* Timeout Hello after 10 mins */ - btimer_t *tid = start_bsock_timer(fd, 60 * 10); + btimer_t *tid = start_bsock_timer(fd, AUTH_TIMEOUT); if (!bnet_fsend(fd, hello, dirname)) { stop_bsock_timer(tid); Jmsg(jcr, M_FATAL, 0, _("Error sending Hello to File daemon. ERR=%s\n"), bnet_strerror(fd)); diff --git a/bacula/src/filed/authenticate.c b/bacula/src/filed/authenticate.c index b8f123431d..d0ad7ab74e 100644 --- a/bacula/src/filed/authenticate.c +++ b/bacula/src/filed/authenticate.c @@ -83,7 +83,7 @@ static int authenticate(int rcode, BSOCK *bs, JCR* jcr) free_pool_memory(dirname); return 0; } - btimer_t *tid = start_bsock_timer(bs, 60 * 10); + btimer_t *tid = start_bsock_timer(bs, AUTH_TIMEOUT); auth = cram_md5_auth(bs, director->password, ssl_need); if (auth) { get_auth = cram_md5_get_auth(bs, director->password, ssl_need); @@ -136,7 +136,7 @@ int authenticate_storagedaemon(JCR *jcr) int ssl_need = BNET_SSL_NONE; bool get_auth, auth = false; - btimer_t *tid = start_bsock_timer(sd, 60 * 10); + btimer_t *tid = start_bsock_timer(sd, AUTH_TIMEOUT); get_auth = cram_md5_get_auth(sd, jcr->sd_auth_key, ssl_need); if (!get_auth) { Dmsg1(50, "cram_get_auth failed for %s\n", sd->who); diff --git a/bacula/src/lib/tree.c b/bacula/src/lib/tree.c index ced63a2454..e6ef465eb1 100755 --- a/bacula/src/lib/tree.c +++ b/bacula/src/lib/tree.c @@ -87,6 +87,7 @@ TREE_ROOT *new_tree(int count) } Dmsg2(400, "count=%d size=%d\n", count, size); malloc_buf(root, size); + root->cached_path_len = -1; root->cached_path = get_pool_memory(PM_FNAME); root->type = TN_ROOT; root->fname = ""; diff --git a/bacula/src/stored/authenticate.c b/bacula/src/stored/authenticate.c index 4aaadadf20..b053dcb93f 100644 --- a/bacula/src/stored/authenticate.c +++ b/bacula/src/stored/authenticate.c @@ -86,7 +86,7 @@ static int authenticate(int rcode, BSOCK *bs, JCR* jcr) } /* Timeout Hello after 10 mins */ - btimer_t *tid = start_bsock_timer(bs, 60 * 10); + btimer_t *tid = start_bsock_timer(bs, AUTH_TIMEOUT); auth = cram_md5_auth(bs, director->password, ssl_need); if (auth) { get_auth = cram_md5_get_auth(bs, director->password, ssl_need); @@ -142,7 +142,7 @@ int authenticate_filed(JCR *jcr) bool auth, get_auth = false; /* Timeout Hello after 5 mins */ - btimer_t *tid = start_bsock_timer(fd, 60 * 10); + btimer_t *tid = start_bsock_timer(fd, AUTH_TIMEOUT); auth = cram_md5_auth(fd, jcr->sd_auth_key, ssl_need); if (auth) { get_auth = cram_md5_get_auth(fd, jcr->sd_auth_key, ssl_need); diff --git a/bacula/src/version.h b/bacula/src/version.h index 6dd499059c..58a9cc9b05 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -10,14 +10,25 @@ #define TRACEBACK 1 #define SMCHECK #define TRACE_FILE 1 + +/* If this is set stdout will not be closed on startup */ #define DEVELOPER 1 +/* + * Set to time limit for other end to respond to + * authentication. Normally 10 minutes is *way* + * more than enough. + */ +#define AUTH_TIMEOUT 60 * 1000 + /* Debug flags not normally turned on */ /* #define TRACE_JCR_CHAIN 1 */ /* #define TRACE_RES 1 */ /* #define DEBUG_MEMSET 1 */ + +/* Check if header of tape block is zero before writing */ #define DEBUG_BLOCK_ZEROING 1 /* #define FULL_DEBUG 1 */ /* normally on for testing only */ -- 2.39.2