static char estimatecmd[] = "estimate listing=%d";
static char runbefore[] = "RunBeforeJob %s";
static char runafter[] = "RunAfterJob %s";
-static char runscript[] = "Run OnSuccess=%u OnFailure=%u AbortOnError=%u When=%u Command=%s";
+static char runscript[] = "Run OnSuccess=%d OnFailure=%d AbortOnError=%d When=%d Command=%s";
/* Responses sent to Director */
static char errmsg[] = "2999 Invalid command\n";
{
BSOCK *dir = jcr->dir_bsock;
POOLMEM *msg = get_memory(dir->msglen+1);
+ int on_success, on_failure, abort_on_error;
RUNSCRIPT *cmd = new_runscript() ;
Dmsg1(100, "runscript_cmd: '%s'\n", dir->msg);
- if (sscanf(dir->msg, runscript, &cmd->on_success,
- &cmd->on_failure,
- &cmd->abort_on_error,
+ /* Note, we cannot sscanf into bools */
+ if (sscanf(dir->msg, runscript, &on_success,
+ &on_failure,
+ &abort_on_error,
&cmd->when,
msg) != 5) {
pm_strcpy(jcr->errmsg, dir->msg);
free_memory(msg);
return 0;
}
+ cmd->on_success = on_success;
+ cmd->on_failure = on_failure;
+ cmd->abort_on_error = abort_on_error;
unbash_spaces(msg);
cmd->set_command(msg);
-/*
- *
- * Written by Meno Abels, June MMIV
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Written by Meno Abels, June MMIV
+ *
+ * Version $Id$
+ */
+
class IPADDR : public SMARTALLOC {
public:
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#ifdef HAVE_LIBWRAP
-#include "tcpd.h"
+extern "C" {
+#include <tcpd.h>
+}
int allow_severity = LOG_NOTICE;
int deny_severity = LOG_WARNING;
#endif
/* Extract the subjectKeyIdentifier extension field */
if ((keypair->keyid = openssl_cert_keyid(cert)) == NULL) {
- Emsg0(M_ERROR, 0, _("Provided certificate does not include the required subjectKeyIdentifier extension."));
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0,
+ _("Provided certificate does not include the required subjectKeyIdentifier extension."));
goto err;
}
/* Validate the public key type (only RSA is supported) */
if (EVP_PKEY_type(keypair->pubkey->type) != EVP_PKEY_RSA) {
- Emsg1(M_ERROR, 0, _("Unsupported key type provided: %d\n"), EVP_PKEY_type(keypair->pubkey->type));
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0,
+ _("Unsupported key type provided: %d\n"), EVP_PKEY_type(keypair->pubkey->type));
goto err;
}
ec = EVP_bf_cbc();
break;
default:
- Emsg0(M_ERROR, 0, _("Unsupported cipher type specified\n"));
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Unsupported cipher type specified\n"));
crypto_session_free(cs);
return NULL;
}
* Acquire a cipher instance for the given ASN.1 cipher NID
*/
if ((ec = EVP_get_cipherbyobj(cs->cryptoData->contentEncryptionAlgorithm)) == NULL) {
- Emsg1(M_ERROR, 0, _("Unsupported contentEncryptionAlgorithm: %d\n"), OBJ_obj2nid(cs->cryptoData->contentEncryptionAlgorithm));
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0,
+ _("Unsupported contentEncryptionAlgorithm: %d\n"), OBJ_obj2nid(cs->cryptoData->contentEncryptionAlgorithm));
free(cipher_ctx);
return NULL;
}
int stat;
if ((stat = openssl_init_threads()) != 0) {
- Emsg1(M_ABORT, 0, _("Unable to init OpenSSL threading: ERR=%s\n"), strerror(stat));
+ berrno be;
+ Jmsg1(get_jcr_from_tid(), M_ABORT, 0,
+ _("Unable to init OpenSSL threading: ERR=%s\n"), be.bstrerror(stat));
}
/* Load libssl and libcrypto human-readable error strings */
OpenSSL_add_all_algorithms();
if (!openssl_seed_prng()) {
- Emsg0(M_ERROR_TERM, 0, _("Failed to seed OpenSSL PRNG\n"));
+ Jmsg0(get_jcr_from_tid(), M_ERROR_TERM, 0, _("Failed to seed OpenSSL PRNG\n"));
}
crypto_initialized = true;
}
if (!openssl_save_prng()) {
- Emsg0(M_ERROR, 0, _("Failed to save OpenSSL PRNG\n"));
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Failed to save OpenSSL PRNG\n"));
}
openssl_cleanup_threads();
if ((ret = SHA1Update(&digest->sha1, (const u_int8_t *) data, length)) == shaSuccess) {
return true;
} else {
- Emsg1(M_ERROR, 0, _("SHA1Update() returned an error: %d\n"), ret);
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0, _("SHA1Update() returned an error: %d\n"), ret);
return false;
}
break;
garbage_collect_memory_pool();
Dmsg0(3400, "Exit free_jcr\n");
}
+
+/*
+ * Find which JobId corresponds to the current thread
+ */
+uint32_t get_jobid_from_tid()
+{
+ return get_jobid_from_tid(pthread_self());
+}
+
+uint32_t get_jobid_from_tid(pthread_t tid)
+{
+ JCR *jcr;
+ uint32_t JobId = 0;
+ foreach_jcr(jcr) {
+ if (pthread_equal(jcr->my_thread_id, tid)) {
+ JobId = (uint32_t)jcr->JobId;
+ break;
+ }
+ }
+ endeach_jcr(jcr);
+ return JobId;
+}
+
+/*
+ * Find the jcr that corresponds to the current thread
+ */
+JCR *get_jcr_from_tid()
+{
+ return get_jcr_from_tid(pthread_self());
+}
+
+JCR *get_jcr_from_tid(pthread_t tid)
+{
+ JCR *jcr;
+ JCR *rtn_jcr = NULL;
+
+ foreach_jcr(jcr) {
+ if (pthread_equal(jcr->my_thread_id, tid)) {
+ rtn_jcr = jcr;
+ break;
+ }
+ }
+ endeach_jcr(jcr);
+ return rtn_jcr;
+}
+
/*
*/
void openssl_post_errors(int code, const char *errstring)
{
- openssl_post_errors(NULL, code, errstring);
+ openssl_post_errors(get_jcr_from_tid(), code, errstring);
}
static unsigned long get_openssl_thread_id(void)
{
/* Comparison without use of pthread_equal() is mandated by the OpenSSL API */
+ /*
+ * Note that this creates problems with the new Win32 pthreads
+ * emulation code, which defines pthread_t as a structure. For
+ * this reason, we continue to use a very old implementation.
+ */
return ((unsigned long)pthread_self());
}
if ((stat = pthread_mutex_init(&dynlock->mutex, NULL)) != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
+ Jmsg1(get_jcr_from_tid(), M_ABORT, 0, _("Unable to init mutex: ERR=%s\n"),
+ be.bstrerror(stat));
}
return dynlock;
if ((stat = pthread_mutex_destroy(&dynlock->mutex)) != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Unable to destroy mutex: ERR=%s\n"), be.bstrerror(stat));
+ Jmsg1(get_jcr_from_tid(), M_ABORT, 0, _("Unable to destroy mutex: ERR=%s\n"),
+ be.bstrerror(stat));
}
free(dynlock);
for (i = 0; i < numlocks; i++) {
if ((stat = pthread_mutex_init(&mutexes[i], NULL)) != 0) {
berrno be;
- Emsg1(M_ERROR, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0, _("Unable to init mutex: ERR=%s\n"),
+ be.bstrerror(stat));
return stat;
}
}
if ((stat = pthread_mutex_destroy(&mutexes[i])) != 0) {
berrno be;
/* We don't halt execution, reporting the error should be sufficient */
- Emsg1(M_ERROR, 0, _("Unable to destroy mutex: ERR=%s\n"), be.bstrerror(stat));
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0, _("Unable to destroy mutex: ERR=%s\n"),
+ be.bstrerror(stat));
}
}
JCR *jcr_walk_start();
JCR *jcr_walk_next(JCR *prev_jcr);
void jcr_walk_end(JCR *jcr);
+uint32_t get_jobid_from_tid(pthread_t tid);
+uint32_t get_jobid_from_tid();
+JCR *get_jcr_from_tid(pthread_t tid);
+JCR *get_jcr_from_tid();
/* lex.c */
-/*
- * Bacula RUNSCRIPT Structure definition for FileDaemon and Director
- * Eric Bollengier May 2006
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2006-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2006-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
-
+/*
+ * Bacula RUNSCRIPT Structure definition for FileDaemon and Director
+ * Eric Bollengier May 2006
+ * Version $Id$
+ */
+
#ifndef __RUNSCRIPT_H_
#define __RUNSCRIPT_H_ 1
* script->on_failure = true;
* script->when = SCRIPT_After;
*
- * script->run("LabelBefore"); // the label must contain "Before" or "After" special keyword
+ * script->run("LabelBefore"); // the label must contain "Before" or "After" special keyword
* free_runscript(script);
*/
public:
POOLMEM *command; /* command string */
POOLMEM *target; /* host target */
+ int when; /* SCRIPT_Before|Script_After BEFORE/AFTER JOB*/
char level; /* Base|Full|Incr...|All (NYI) */
bool on_success; /* executre command on job success (After) */
bool on_failure; /* executre command on job failure (After) */
bool abort_on_error; /* abort job on error (Before) */
- int when; /* SCRIPT_Before|Script_After BEFORE/AFTER JOB*/
/* TODO : drop this with bacula 1.42 */
bool old_proto; /* used by old 1.3X protocol */
if (sig == SIGTERM) {
// Emsg1(M_TERM, -1, "Shutting down Bacula service: %s ...\n", my_name);
} else {
- Emsg2(M_FATAL, -1, _("Bacula interrupted by signal %d: %s\n"), sig, sig_names[sig]);
+ Emsg2(M_FATAL, -1, _("Bacula interrupted by signal %d: %s\n"), sig, get_signal_name(sig));
}
#ifdef TRACEBACK
pid_t pid;
int exelen = strlen(exepath);
- fprintf(stderr, _("Kaboom! %s, %s got signal %d. Attempting traceback.\n"),
- exename, my_name, sig);
+ fprintf(stderr, _("Kaboom! %s, %s got signal %d - %s. Attempting traceback.\n"),
+ exename, my_name, sig, get_signal_name(sig));
fprintf(stderr, _("Kaboom! exepath=%s\n"), exepath);
if (exelen + 12 > (int)sizeof(btpath)) {
argv[3] = (char *)NULL;
fprintf(stderr, _("Calling: %s %s %s\n"), btpath, exepath, pid_buf);
if (execv(btpath, argv) != 0) {
- printf(_("execv: %s failed: ERR=%s\n"), btpath, strerror(errno));
+ berrno be;
+ printf(_("execv: %s failed: ERR=%s\n"), btpath, be.bstrerror());
}
exit(-1);
default: /* parent */
+++ /dev/null
- /*
- * @(#) tcpd.h 1.5 96/03/19 16:22:24
- *
- * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
- */
-
-/*
- * This version of the file has been hacked over by
- * Kern Sibbald to make it compatible with C++ for
- * the few functions that Bacula uses. 19 April 2002
- * It now compiles with C++ but remains untested.
- * A correct fix would require significantly more work.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Structure to describe one communications endpoint. */
-
-#define STRING_LENGTH 128 /* hosts, users, processes */
-
-struct host_info {
- char name[STRING_LENGTH]; /* access via eval_hostname(host) */
- char addr[STRING_LENGTH]; /* access via eval_hostaddr(host) */
- struct sockaddr_in *sin; /* socket address or 0 */
- struct t_unitdata *unit; /* TLI transport address or 0 */
- struct request_info *request; /* for shared information */
-};
-
-/* Structure to describe what we know about a service request. */
-
-struct request_info {
- int fd; /* socket handle */
- char user[STRING_LENGTH]; /* access via eval_user(request) */
- char daemon[STRING_LENGTH]; /* access via eval_daemon(request) */
- char pid[10]; /* access via eval_pid(request) */
- struct host_info client[1]; /* client endpoint info */
- struct host_info server[1]; /* server endpoint info */
- void (*sink) (); /* datagram sink function or 0 */
- void (*hostname) (); /* address to printable hostname */
- void (*hostaddr) (); /* address to printable address */
- void (*cleanup) (); /* cleanup function or 0 */
- struct netconfig *config; /* netdir handle */
-};
-
-/* Common string operations. Less clutter should be more readable. */
-
-#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; }
-
-#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0)
-#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0)
-#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0)
-#define STR_NE(x,y) (strcasecmp((x),(y)) != 0)
-
- /*
- * Initially, all above strings have the empty value. Information that
- * cannot be determined at runtime is set to "unknown", so that we can
- * distinguish between `unavailable' and `not yet looked up'. A hostname
- * that we do not believe in is set to "paranoid".
- */
-
-#define STRING_UNKNOWN "unknown" /* lookup failed */
-#define STRING_PARANOID "paranoid" /* hostname conflict */
-
-extern char unknown[];
-extern char paranoid[];
-
-#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid))
-
-#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0)
-
-/* Global functions. */
-
-#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void fromhost(); /* get/validate client host info */
-#else
-#define fromhost sock_host /* no TLI support needed */
-#endif
-
-extern int hosts_access(struct request_info *); /* access control */
-extern void shell_cmd(); /* execute shell command */
-extern char *percent_x(); /* do %<char> expansion */
-extern void rfc931(); /* client name from RFC 931 daemon */
-extern void clean_exit(); /* clean up and exit */
-extern void refuse(); /* clean up and exit */
-extern char *xgets(); /* fgets() on steroids */
-extern char *split_at(); /* strchr() and split */
-extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
-
-/* Global variables. */
-
-extern int allow_severity; /* for connection logging */
-extern int deny_severity; /* for connection logging */
-extern char *hosts_allow_table; /* for verification mode redirection */
-extern char *hosts_deny_table; /* for verification mode redirection */
-extern int hosts_access_verbose; /* for verbose matching mode */
-extern int rfc931_timeout; /* user lookup timeout */
-extern int resident; /* > 0 if resident process */
-
- /*
- * Routines for controlled initialization and update of request structure
- * attributes. Each attribute has its own key.
- */
-
-#ifdef __STDC__
-extern struct request_info *request_init(struct request_info *,...);
-extern struct request_info *request_set(struct request_info *,...);
-#else
-extern struct request_info *request_init(); /* initialize request */
-extern struct request_info *request_set(); /* update request structure */
-#endif
-
-#define RQ_FILE 1 /* file descriptor */
-#define RQ_DAEMON 2 /* server process (argv[0]) */
-#define RQ_USER 3 /* client user name */
-#define RQ_CLIENT_NAME 4 /* client host name */
-#define RQ_CLIENT_ADDR 5 /* client host address */
-#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */
-#define RQ_SERVER_NAME 7 /* server host name */
-#define RQ_SERVER_ADDR 8 /* server host address */
-#define RQ_SERVER_SIN 9 /* server endpoint (internal) */
-
- /*
- * Routines for delayed evaluation of request attributes. Each attribute
- * type has its own access method. The trivial ones are implemented by
- * macros. The other ones are wrappers around the transport-specific host
- * name, address, and client user lookup methods. The request_info and
- * host_info structures serve as caches for the lookup results.
- */
-
-extern char *eval_user(); /* client user */
-extern char *eval_hostname(); /* printable hostname */
-extern char *eval_hostaddr(); /* printable host address */
-extern char *eval_hostinfo(); /* host name or address */
-extern char *eval_client(struct request_info *); /* whatever is available */
-extern char *eval_server(); /* whatever is available */
-#define eval_daemon(r) ((r)->daemon) /* daemon process name */
-#define eval_pid(r) ((r)->pid) /* process id */
-
-/* Socket-specific methods, including DNS hostname lookups. */
-
-extern void sock_host(struct request_info *);
-extern void sock_hostname(); /* translate address to hostname */
-extern void sock_hostaddr(); /* address to printable address */
-#define sock_methods(r) \
- { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
-
-/* The System V Transport-Level Interface (TLI) interface. */
-
-#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void tli_host(); /* look up endpoint addresses etc. */
-#endif
-
- /*
- * Problem reporting interface. Additional file/line context is reported
- * when available. The jump buffer (tcpd_buf) is not declared here, or
- * everyone would have to include <setjmp.h>.
- */
-
-#ifdef __STDC__
-extern void tcpd_warn(char *, ...); /* report problem and proceed */
-extern void tcpd_jump(char *, ...); /* report problem and jump */
-#else
-extern void tcpd_warn();
-extern void tcpd_jump();
-#endif
-
-struct tcpd_context {
- char *file; /* current file */
- int line; /* current line */
-};
-extern struct tcpd_context tcpd_context;
-
- /*
- * While processing access control rules, error conditions are handled by
- * jumping back into the hosts_access() routine. This is cleaner than
- * checking the return value of each and every silly little function. The
- * (-1) returns are here because zero is already taken by longjmp().
- */
-
-#define AC_PERMIT 1 /* permit access */
-#define AC_DENY (-1) /* deny_access */
-#define AC_ERROR AC_DENY /* XXX */
-
- /*
- * In verification mode an option function should just say what it would do,
- * instead of really doing it. An option function that would not return
- * should clear the dry_run flag to inform the caller of this unusual
- * behavior.
- */
-
-extern void process_options(); /* execute options */
-extern int dry_run; /* verification flag */
-
-/* Bug workarounds. */
-
-#ifdef INET_ADDR_BUG /* inet_addr() returns struct */
-#define inet_addr fix_inet_addr
-extern long fix_inet_addr();
-#endif
-
-#ifdef BROKEN_FGETS /* partial reads from sockets */
-#define fgets fix_fgets
-extern char *fix_fgets();
-#endif
-
-#ifdef RECVFROM_BUG /* no address family info */
-#define recvfrom fix_recvfrom
-extern int fix_recvfrom();
-#endif
-
-#ifdef GETPEERNAME_BUG /* claims success with UDP */
-#define getpeername fix_getpeername
-extern int fix_getpeername();
-#endif
-
-#ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */
-#define gethostbyname fix_gethostbyname
-extern struct hostent *fix_gethostbyname();
-#endif
-
-#ifdef USE_STRSEP /* libc calls strtok() */
-#define strtok fix_strtok
-extern char *fix_strtok();
-#endif
-
-#ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */
-#define strtok my_strtok
-extern char *my_strtok();
-#endif
-
-#ifdef __cplusplus
-}
-#endif
X509_NAME_oneline(X509_get_issuer_name(cert), issuer, 256);
X509_NAME_oneline(X509_get_subject_name(cert), subject, 256);
- Emsg5(M_ERROR, 0, _("Error with certificate at depth: %d, issuer = %s,"
+ Jmsg5(get_jcr_from_tid(), M_ERROR, 0, _("Error with certificate at depth: %d, issuer = %s,"
" subject = %s, ERR=%d:%s\n"), depth, issuer,
subject, err, X509_verify_cert_error_string(err));
}
} else if (verify_peer) {
/* At least one CA is required for peer verification */
- Emsg0(M_ERROR, 0, _("Either a certificate file or a directory must be"
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Either a certificate file or a directory must be"
" specified as a verification store\n"));
goto err;
}
}
if (SSL_CTX_set_cipher_list(ctx->openssl, TLS_DEFAULT_CIPHERS) != 1) {
- Emsg0(M_ERROR, 0, _("Error setting cipher list, no valid ciphers available\n"));
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0,
+ _("Error setting cipher list, no valid ciphers available\n"));
goto err;
}
/* Check if peer provided a certificate */
if (!(cert = SSL_get_peer_certificate(ssl))) {
- Emsg0(M_ERROR, 0, _("Peer failed to present a TLS certificate\n"));
+ Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Peer failed to present a TLS certificate\n"));
return false;
}
/* Check if peer provided a certificate */
if (!(cert = SSL_get_peer_certificate(ssl))) {
- Emsg1(M_ERROR, 0, _("Peer %s failed to present a TLS certificate\n"), host);
+ Jmsg1(get_jcr_from_tid(), M_ERROR, 0,
+ _("Peer %s failed to present a TLS certificate\n"), host);
return false;
}
-/*
- * util.c miscellaneous utility subroutines for Bacula
- *
- * Kern Sibbald, MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * util.c miscellaneous utility subroutines for Bacula
+ *
+ * Kern Sibbald, MM
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "jcr.h"
-/*
-** OSSP var - Variable Expansion
-** Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
-** Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
-** Copyright (c) 2001-2002 Cable & Wireless Deutschland (http://www.cw.com/de/)
-**
-** This file is part of OSSP var, a variable expansion
-** library which can be found at http://www.ossp.org/pkg/lib/var/.
-**
-** Permission to use, copy, modify, and distribute this software for
-** any purpose with or without fee is hereby granted, provided that
-** the above copyright notice and this permission notice appear in all
-** copies.
-**
-** For disclaimer see below.
-*/
-/*
- * Adapted by Kern Sibbald to Bacula June 2003
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2003-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2003-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+** OSSP var - Variable Expansion
+** Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
+** Copyright (c) 2001-2002 The OSSP Project (http://www.ossp.org/)
+** Copyright (c) 2001-2002 Cable & Wireless Deutschland (http://www.cw.com/de/)
+**
+** This file is part of OSSP var, a variable expansion
+** library which can be found at http://www.ossp.org/pkg/lib/var/.
+**
+** Permission to use, copy, modify, and distribute this software for
+** any purpose with or without fee is hereby granted, provided that
+** the above copyright notice and this permission notice appear in all
+** copies.
+**
+** For disclaimer see below.
+*/
+/*
+ * Adapted by Kern Sibbald to Bacula June 2003
+ */
#include "bacula.h"
#if defined(HAVE_PCREPOSIX)
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
/*
* Bacula work queue routines. Permits passing work to
* multiple threads.
* workq_destroy(workq_t *wq);
*
*/
-/*
- Bacula® - The Network Backup Solution
-
- Copyright (C) 2001-2006 Free Software Foundation Europe e.V.
-
- The main author of Bacula is Kern Sibbald, with contributions from
- many others, a complete list can be found in the file AUTHORS.
- This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
- License as published by the Free Software Foundation plus additions
- that are listed in the file LICENSE.
-
- 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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
- Bacula® is a registered trademark of John Walker.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
-*/
#include "bacula.h"
void Console::beginNewCommand()
{
for (int i=0; i < 3; i++) {
- write(".\n");
+ write(".");
while (read() > 0) {
if (mainWin->m_displayAll) display_text(msg());
}
if (mainWin->m_commDebug) Pmsg0(000, "CMD OK\n");
m_at_prompt = false;
m_at_main_prompt = false;
+ mainWin->set_status(_("Command completed ..."));
continue;
case BNET_CMD_BEGIN:
if (mainWin->m_commDebug) Pmsg0(000, "CMD BEGIN\n");
m_at_prompt = false;
m_at_main_prompt = false;
+ mainWin->set_status(_("Processing command ..."));
continue;
case BNET_MAIN_PROMPT:
if (mainWin->m_commDebug) Pmsg0(000, "MAIN PROMPT\n");
return true;
} else {
QString message("Director ");
- message += " is curerntly disconnected\n Please reconnect!!";
+ message += " is currently disconnected\n Please reconnect!!";
QMessageBox::warning(this, "Bat",
tr(message.toUtf8().data()), QMessageBox::Ok );
return false;
if (!is_connected()) {
QString message("Director ");
message += m_dir->name();
- message += " is curerntly disconnected\n Please reconnect!!";
+ message += " is currently disconnected\n Please reconnect!!";
QMessageBox::warning(this, "Bat",
tr(message.toUtf8().data()), QMessageBox::Ok );
return false;
} else if (!m_at_main_prompt){
QString message("Director ");
message += m_dir->name();
- message += " is curerntly busy\n Please complete restore or other "
+ message += " is currently busy\n Please complete restore or other "
" operation !! This is a limitation that will be resolved before a beta"
" release. This is currently an alpha release.";
QMessageBox::warning(this, "Bat",
} else if (!m_at_prompt){
QString message("Director ");
message += m_dir->name();
- message += " is curerntly not at a prompt\n Please try again!!";
+ message += " is currently not at a prompt\n Please try again!!";
QMessageBox::warning(this, "Bat",
tr(message.toUtf8().data()), QMessageBox::Ok );
return false;
#include "select.h"
/*
- * Setup all the combo boxes and display the dialog
+ * Read the items for the selection
*/
selectDialog::selectDialog(Console *console)
{
m_console = console;
setupUi(this);
connect(listBox, SIGNAL(currentRowChanged(int)), this, SLOT(index_change(int)));
+ setAttribute(Qt::WA_DeleteOnClose);
m_console->read(); /* get title */
labelWidget->setText(m_console->msg());
while ((stat=m_console->read()) > 0) {
item->setText(m_console->msg());
listBox->insertItem(row++, item);
}
-// Dmsg1(000, "Stat=%d\n", stat);
- m_console->read(); /* get prompt signal */
- m_console->read(); /* get prompt */
-// Dmsg1(000, "Prompt=%s", m_console->msg());
+ m_console->displayToPrompt();
this->show();
}
char cmd[100];
this->hide();
-
bsnprintf(cmd, sizeof(cmd), "%d", m_index+1);
m_console->write_dir(cmd);
m_console->displayToPrompt();
- delete this;
+ this->close();
mainWin->resetFocus();
+ m_console->displayToPrompt();
+
}
void selectDialog::reject()
{
- mainWin->set_status(" Canceled");
this->hide();
- delete this;
+ mainWin->set_status(" Canceled");
+ this->close();
mainWin->resetFocus();
+ m_console->beginNewCommand();
}
/*
*/
void selectDialog::index_change(int index)
{
-// Dmsg1(000, "Index=%d\n", index);
m_index = index;
}
return true;
}
-/*
- * Find which JobId corresponds to the current thread
- */
-uint32_t get_jobid_from_tid(pthread_t tid)
-{
- JCR *jcr;
- uint32_t JobId = 0;
- foreach_jcr(jcr) {
- if (pthread_equal(jcr->my_thread_id, tid)) {
- JobId = (uint32_t)jcr->JobId;
- break;
- }
- }
- endeach_jcr(jcr);
- return JobId;
-}
/*
* Check if the device is blocked or not
void DEVICE::_dlock(const char *file, int line)
{
Dmsg4(sd_dbglvl, "dlock from %s:%d precnt=%d JobId=%u\n", file, line,
- m_count, get_jobid_from_tid(pthread_self()));
+ m_count, get_jobid_from_tid());
/* Note, this *really* should be protected by a mutex, but
* since it is only debug code we don't worry too much.
*/
if (m_count > 0 && pthread_equal(m_pid, pthread_self())) {
Dmsg5(sd_dbglvl, "Possible DEADLOCK!! lock held by JobId=%u from %s:%d m_count=%d JobId=%u\n",
get_jobid_from_tid(m_pid),
- file, line, m_count, get_jobid_from_tid(pthread_self()));
+ file, line, m_count, get_jobid_from_tid());
}
P(m_mutex);
m_pid = pthread_self();
{
m_count--;
Dmsg4(sd_dbglvl+1, "dunlock from %s:%d postcnt=%d JobId=%u\n", file, line,
- m_count, get_jobid_from_tid(pthread_self()));
+ m_count, get_jobid_from_tid());
V(m_mutex);
}
int stat;
#ifdef SD_DEBUG_LOCK
Dmsg4(sd_dbglvl+1, "r_dlock blked=%s from %s:%d JobId=%u\n", this->print_blocked(),
- file, line, get_jobid_from_tid(pthread_self()));
+ file, line, get_jobid_from_tid());
#else
Dmsg1(sd_dbglvl, "reclock blked=%s\n", this->print_blocked());
#endif
void set_new_volume_parameters(DCR *dcr);
void set_new_file_parameters(DCR *dcr);
bool is_device_unmounted(DEVICE *dev);
-uint32_t get_jobid_from_tid(pthread_t tid);
/* From dircmd.c */
void *handle_connection_request(void *arg);
Technical notes on version 2.1
General:
+07Jun07
+kes Fix sscanf problems reported by Peter Buschman that caused
+ a bus error on Solaris.
+kes Rework (simplify) the select prompt in bat.
+kes Move get_jobid_from_tid() into lib and create a
+ get_jcr_from_tid().
+kes Use get_jcr_from_tid() to conver all tls Emsg() to Jmsg(). This
+ should definitely fix the problem of lost error messages in the
+ encryption code.
+kes Remove over zellous addition of FSFE copyright in a few eggxxx files.
+kes Eliminate tcpd.h from the project. Enclose the #include from the
+ library with extern C ...
+kes Add print of signal name when a signal is trapped.
+
+Release: 2.1.12 beta
04Jun07
kes Fix a seg fault in the PostgreSQL driver dereferencing a NULL pointer.
03Jun07