Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
GPLv2 or later license:
src/tools/bsmtp.c
Copyright (C) 1997 Ralf S. Engelschall, All Rights Reserved.
- (note, bsmtp.c does not use OpenSSL)
+ (note, bsmtp.c does not use OpenSSL, nor is it used with the code
+ of any other part of Bacula)
-BSD License notice for inclusion with the binary:
+3 clause BSD License notice for inclusion with the binary:
src/lib/fnmatch.c
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
(tjh@cryptsoft.com).
There are parts of Bacula that are licensed under the LGPL so
-that they may be used in proprietary code to interface with
+that those files may be used in proprietary code to interface with
Bacula.
Finally there are parts of Bacula that are in the public domain.
implement it. A lot more design detail should be presented
before voting on this project.
+========= Added since the last vote =================
+
+Item: Store and restore extended attributes, especially selinux file contexts
+ Date: 28 December 2007
+ Origin: Frank Sweetser <fs@wpi.edu>
+ What: The ability to store and restore extended attributes on
+ filesystems that support them, such as ext3.
+
+ Why: Security Enhanced Linux (SELinux) enabled systems make extensive
+ use of extended attributes. In addition to the standard user,
+ group, and permission, each file has an associated SELinux context
+ stored as an extended attribute. This context is used to define
+ which operations a given program is permitted to perform on that
+ file. Storing contexts on an SELinux system is as critical as
+ storing ownership and permissions. In the case of a full system
+ restore, the system will not even be able to boot until all
+ critical system files have been properly relabeled.
+
+ Notes: Fedora ships with a version of tar that has been patched to handle
+ extended attributes. The patch has not been integrated upstream
+ yet, so could serve as a good starting point.
+
+ http://linux.die.net/man/2/getxattr
+ http://linux.die.net/man/2/setxattr
+ http://linux.die.net/man/2/listxattr
+ ===
+ http://linux.die.net/man/3/getfilecon
+ http://linux.die.net/man/3/setfilecon
+
+
+
========== Already implemented ================================
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0);
/* For All Volumes, All Volumes from Pool, and Done, we don't need
- * a Volume record */
+ * a Volume record */
if ( i != 12 && i != 13 && i != 16) {
if (!select_media_dbr(ua, &mr)) { /* Get Volume record */
return 0;
ATTR_DBR *ar; /* DB attribute record */
guid_list *id_list; /* User/group id to name list */
+ void *plugin_ctx;
+
/* Daemon specific part of JCR */
/* This should be empty in the library */
}
-#ifdef REALLY_USED
-/*
- * Bind an address so that we may accept connections
- * one at a time.
- */
-BSOCK *bnet_bind(int port)
-{
- int sockfd;
- struct sockaddr_in serv_addr; /* our address */
- int tlog;
- int turnon = 1;
-
- /*
- * Open a TCP socket
- */
- for (tlog = 0; (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0; tlog -= 10) {
- berrno be;
- if (errno == EINTR || errno == EAGAIN) {
- continue;
- }
- if (tlog <= 0) {
- tlog = 2 * 60;
- Emsg1(M_ERROR, 0, _("Cannot open stream socket: %s\n"), be.bstrerror());
- }
- bmicrosleep(60, 0);
- }
-
- /*
- * Reuse old sockets
- */
- if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
- berrno be;
- Emsg1(M_WARNING, 0, _("Cannot set SO_REUSEADDR on socket: %s\n"),
- be.bstrerror());
- }
-
- /*
- * Bind our local address so that the client can send to us.
- */
- bzero((char *)&serv_addr, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- serv_addr.sin_port = htons(port);
-
- for (tlog = 0; bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0;
- tlog -= 5) {
- berrno be;
- if (errno == EINTR || errno == EAGAIN) {
- continue;
- }
- if (tlog <= 0) {
- tlog = 2 * 60;
- Emsg2(M_WARNING, 0, _("Cannot bind port %d: ERR=%s: retrying ...\n"), port,
- be.bstrerror());
- }
- bmicrosleep(5, 0);
- }
- listen(sockfd, 1); /* tell system we are ready */
- return init_bsock(NULL, sockfd, _("Server socket"), _("client"), port,
- &serv_addr);
-}
-
-/*
- * Accept a single connection
- */
-BSOCK *bnet_accept(BSOCK * bsock, char *who)
-{
- fd_set ready, sockset;
- int newsockfd, stat, len;
- socklen_t clilen;
- struct sockaddr_in cli_addr; /* client's address */
- char *caller, *buf;
- BSOCK *bs;
- int turnon = 1;
-#ifdef HAVE_LIBWRAP
- struct request_info request;
-#endif
-
- /*
- * Wait for a connection from the client process.
- */
- FD_ZERO(&sockset);
- FD_SET((unsigned)bsock->fd, &sockset);
-
- for (;;) {
- /*
- * Wait for a connection from a client process.
- */
- ready = sockset;
- if ((stat = select(bsock->fd + 1, &ready, NULL, NULL, NULL)) < 0) {
- berrno be;
- if (errno == EINTR || errno = EAGAIN) {
- errno = 0;
- continue;
- }
- Emsg1(M_FATAL, 0, _("Error in select: %s\n"), be.bstrerror());
- newsockfd = -1;
- break;
- }
- do {
- clilen = sizeof(cli_addr);
- newsockfd = accept(bsock->fd, (struct sockaddr *)&cli_addr, &clilen);
- } while (newsockfd < 0 && (errno == EINTR || errno = EAGAIN));
- if (newsockfd >= 0) {
- break;
- }
- }
-
-#ifdef HAVE_LIBWRAP
- P(mutex);
- request_init(&request, RQ_DAEMON, my_name, RQ_FILE, newsockfd, 0);
- fromhost(&request);
- if (!hosts_access(&request)) {
- V(mutex);
- Emsg2(M_SECURITY, 0, _("Connection from %s:%d refused by hosts.access\n"),
- inet_ntoa(cli_addr.sin_addr), ntohs(cli_addr.sin_port));
- close(newsockfd);
- return NULL;
- }
- V(mutex);
-#endif
-
- /*
- * Receive notification when connection dies.
- */
- if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
- berrno be;
- Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
- be.bstrerror());
- }
-
- /* see who client is. I.e. who connected to us.
- * return it in the input message buffer.
- */
- if ((caller = inet_ntoa(cli_addr.sin_addr)) != NULL) {
- pm_strcpy(&bsock->msg, caller);
- } else {
- bsock->msg[0] = 0;
- }
- bsock->msglen = strlen(bsock->msg);
-
- if (newsockfd < 0) {
- berrno be;
- Emsg2(M_FATAL, 0, _("Socket accept error for %s. ERR=%s\n"), who,
- be.bstrerror());
- return NULL;
- } else {
- if (caller == NULL) {
- caller = _("unknown");
- }
- len = strlen(caller) + strlen(who) + 3;
- buf = (char *)malloc(len);
- bstrncpy(buf, len, who);
- bstrncat(buf, len, ": ");
- bstrncat(buf, len, caller);
- bs = init_bsock(NULL, newsockfd, _("client"), buf, bsock->port, &cli_addr);
- free(buf);
- return bs; /* return new BSOCK */
- }
-}
-
-#endif
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
Switzerland, email:ftf@fsfeurope.org.
*/
/*
- * daemon.c by Kern Sibbald
+ * daemon.c by Kern Sibbald 2000
*
* Version $Id$
*
- * this code is inspired by the Prentice Hall book
+ * This code is inspired by the Prentice Hall book
* "Unix Network Programming" by W. Richard Stevens
* and later updated from his book "Advanced Programming
* in the UNIX Environment"
Dmsg0(900, "Enter daemon_start\n");
if ( (cpid = fork() ) < 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Cannot fork to become daemon: %s\n"), be.bstrerror());
+ Emsg1(M_ABORT, 0, _("Cannot fork to become daemon: ERR=%s\n"), be.bstrerror());
} else if (cpid > 0) {
exit(0); /* parent exits */
}
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
return strcmp(((VOLRES *)item1)->vol_name, ((VOLRES *)item2)->vol_name);
}
-
+/*
+ * This allows a given thread to recursively call lock_reservations.
+ * It must, of course, call unlock_... the same number of times.
+ */
void init_reservations_lock()
{
int errstat;
int vol_list_lock_count = 0;
+/*
+ * This allows a given thread to recursively call to lock_volumes()
+ */
void _lock_volumes()
{
int errstat;
Dmsg1(dbglvl, "OK, vol=%s on device.\n", VolumeName);
goto get_out; /* Volume already on this device */
} else {
+ /* Don't release a volume if it is in use */
+ if (!vol->released) {
+ vol = NULL; /* vol in use */
+ goto get_out;
+ }
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
unload_autochanger(dcr, -1); /* unload the volume */
free_volume(dev);
/*
* Switch from current device to given device
+ * (not yet used)
*/
void switch_device(DCR *dcr, DEVICE *dev)
{
/*
* Free a Volume from the Volume list if it is no longer used
+ * Note, for tape drives we want to remember where the Volume
+ * was when last used, so rather than free the volume entry,
+ * we simply mark it "released" so when the drive is really
+ * needed for another volume, we can reuse it.
*
- * Returns: true if the Volume found and removed from the list
+ * Returns: true if the Volume found and "removed" from the list
* false if the Volume is not in the list or is in use
*/
bool volume_unused(DCR *dcr)
}
/*
- * Unconditionally release the volume
+ * Unconditionally release the volume entry
*/
bool free_volume(DEVICE *dev)
{
free_volume_list(); /* release temp_vol_list */
vol_list = save_vol_list;
Dmsg0(dbglvl, "deleted temp vol list\n");
- Dmsg0(dbglvl, "lock volumes\n");
+ Dmsg0(dbglvl, "unlock volumes\n");
unlock_volumes();
+ debug_list_volumes("=== After free temp table\n");
}
if (ok) {
Dmsg1(dbglvl, "got vol %s from in-use vols list\n", rctx.VolumeName);
Technical notes on version 2.3
General:
+05Jan08
+kes Fix reserve_volume() so it doesn't release a volume in use
+ (i.e. a volume entry not marked released). This should be
+ the last part needed to fix bug #1018.
02Jan08
-kes Fix exist switch drive SD code to call autochanger to release
+kes Fix existing switch drive SD code to call autochanger to release
any old volume. This must be done to keep the autochanger from
releasing subsequently newly reserved volumes in doing a close().
+ This should fix bug #1018.
kes Fail if attempting to get console input in batch mode. This
should help fail RunScript console commands that are incomplete.
kes First cut implementing switch_drive() in SD (not actually called).
31Dec07
kes Implement first cut running console commands in a RunScript.
29Dec07
-ebl Fixes #1028 where "Selection Type" option was not usable with JobDefs.
-ebl Fixes #897 and #1005 where bacula doesn't display runscript
+ebl Fixes bug #1028 where "Selection Type" option was not usable
+ with JobDefs.
+ebl Fixes bug #897 and bug #1005 where bacula doesn't display runscript
output in error.
24Dec07
kes Add new free_tls() entry point so that Win32 builds.