View Issue Details

IDProjectCategoryView StatusLast Update
0000757bareos-coredirectorpublic2017-01-27 11:38
Reporterloli10K Assigned To 
Status closedResolutionfixed 
PlatformLinuxOSDebianOS Version7
Product Version16.2.4 
Fixed in Version16.2.5 
Summary0000757: [PATCH] Director daemon crashes on configuration load when job does not contain storage and pool definition
DescriptionI'm new to Bareos, and i was working to setup a backup server on my raspberry. I compiled the latest (Release/16.2.4) tag from source and created a job for a test client, but forgot to define a JobDefs.

The result is a job configuration that does not define any "Storage" or "Pool" values.

When i start the director it crashes (SIGSEGV). It should report the error "No storage specified in Job %s nor in Pool" instead.

A simple patch is provider as attachment.
Steps To ReproduceDefine a job without both "Storage" and "Pool", then reload the director.
Additional InformationI reproduced the crash on a fedora client because it's much simpler to get debugging tools there.

[root@fedora24 bareos]# gdb -q -ex 'file /usr/sbin/bareos-dir' -ex 'run -v -f'
Reading symbols from /usr/sbin/bareos-dir...done.
Starting program: /usr/sbin/bareos-dir -v -f
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".

Program received signal SIGSEGV, Segmentation fault.
0x000000000041e555 in JOBRES::validate (this=0x6f3108) at dird_conf.c:1328
1328 if (!storage && !pool->storage) {
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.23.1-11.fc24.x86_64 keyutils-libs-1.5.9-8.fc24.x86_64 krb5-libs-1.14.4-4.fc24.x86_64 libacl-2.2.52-11.fc24.x86_64 libattr-2.4.47-16.fc24.x86_64 libcom_err-1.42.13-4.fc24.x86_64 libgcc-6.3.1-1.fc24.x86_64 libselinux-2.5-12.fc24.x86_64 libstdc++-6.3.1-1.fc24.x86_64 openssl-libs-1.0.2j-3.fc24.x86_64 pcre-8.39-6.fc24.x86_64 zlib-1.2.8-10.fc24.x86_64
(gdb) bt
#0 0x000000000041e555 in JOBRES::validate (this=0x6f3108) at dird_conf.c:1328
0000001 0x000000000041e2f8 in validate_resource (res_type=1004, items=0x6c8240 <job_items>, res=0x6f3108) at dird_conf.c:1273
0000002 0x00000000004243f9 in populate_jobdefs () at dird_conf.c:3121
0000003 0x0000000000424413 in populate_defs () at dird_conf.c:3134
0000004 0x0000000000429709 in check_resources () at dird.c:830
0000005 0x0000000000428616 in main (argc=0, argv=0x7fffffffe440) at dird.c:355
(gdb) list
1323 Jmsg(NULL, M_ERROR, 0,
1324 _("\"fileset\" directive in Job \"%s\" resource is required, but not found.\n"), name());
1325 return false;
1326 }
1328 if (!storage && !pool->storage) {
1329 Jmsg(NULL, M_ERROR, 0, _("No storage specified in Job \"%s\" nor in Pool.\n"), name());
1330 return false;
1331 }
1332 break;
(gdb) p storage
$1 = (alist *) 0x0
(gdb) p pool
$2 = (POOLRES *) 0x0
TagsNo tags attached.


child of 0000734 closedstephand Release bareos-16.2.5 




2017-01-07 11:03


0001-Fix-bareos-dir-crash-when-both-storage-and-pool-are-.patch (785 bytes)   
From 8d637a101744015c69f83256a0803986a4dda235 Mon Sep 17 00:00:00 2001
From: loli10K <>
Date: Sat, 7 Jan 2017 10:30:13 +0100
Subject: [PATCH] Fix bareos-dir crash when both storage and pool are undefined
 for a backup job

 src/dird/dird_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dird/dird_conf.c b/src/dird/dird_conf.c
index 9a40a03..5df83e9 100644
--- a/src/dird/dird_conf.c
+++ b/src/dird/dird_conf.c
@@ -1325,7 +1325,7 @@ bool JOBRES::validate()
          return false;
-      if (!storage && !pool->storage) {
+      if (!storage && (!pool || !pool->storage)) {
          Jmsg(NULL, M_ERROR, 0, _("No storage specified in Job \"%s\" nor in Pool.\n"), name());
          return false;



2017-01-27 10:48

developer   ~0002534

Fix committed to bareos bareos-16.2 branch with changesetid 6834.


2017-01-27 11:38

developer   ~0002535

Seams to good way to start with Bareos by providing a patch for a Segmentation fault. Thank you for this. It is now added to bareos-16.2 and will be merged into master soon.

Related Changesets

bareos: bareos-16.2 02e08d53

2017-01-07 11:30


Committer: joergs

Ported: N/A

Details Diff
Fix bareos-dir crash when both storage and pool are undefined for a backup job

Fixes 0000757: Director daemon crashes when job does not contain storage and pool definition
Affected Issues
mod - src/dird/dird_conf.c Diff File

Issue History

Date Modified Username Field Change
2017-01-07 11:03 loli10K New Issue
2017-01-07 11:03 loli10K File Added: 0001-Fix-bareos-dir-crash-when-both-storage-and-pool-are-.patch
2017-01-25 14:33 joergs Assigned To => joergs
2017-01-25 14:33 joergs Status new => assigned
2017-01-27 10:48 joergs Changeset attached => bareos bareos-16.2 02e08d53
2017-01-27 10:48 joergs Note Added: 0002534
2017-01-27 10:48 joergs Status assigned => resolved
2017-01-27 10:48 joergs Resolution open => fixed
2017-01-27 11:36 joergs Relationship added child of 0000734
2017-01-27 11:38 joergs Note Added: 0002535
2017-01-27 11:38 joergs Status resolved => closed
2017-01-27 11:38 joergs Assigned To joergs =>
2017-01-27 11:38 joergs Fixed in Version => 16.2.5