Koha/misc
Magnus Enger e8a24c35f6 Bug 11188 - Make gather_print_notices.pl die on failed open()
Problem:
If you tell gather_print_notices.pl to write output to a location
you do not have write access to, it will silently fail to write the
data, but still mark unsent messages as sent.

Solution:
This patch adds two lines of defense:
1. Check that the location given for the output is writable
2. use "open() or die" instead of just "open()" when writing the
   output
The first measure should catch most of the potential errors, but
I guess a directory can be writable, but the open() still can fail
because the disk is full or something similar.

To test:
- Make sure you have some unsent messages in the message_queue table,
  that do not have an email adress
- Apply the patch
- Run the script, pointing at a location you do not have access to
  write to. Check that the script exits with an appropriate error
  message, and that the unsent messages are still unsent. Do this
  both with and without the -s option.
- To fake passing the first line of defence, comment out line 62
  and put this in instead:
  if ( !$output_directory || !-d $output_directory ) {
- Run the script again as above, check you get an appropriate
  error and that the message queue is not touched
- Reset line 62 to how it was
- Run the script against a directory you do have access to write to
  and check that output is produced as expected and that messages
  are marked as sent
- Sign off

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:12:48 +00:00
..
admin Bug 6061: clearing up system preference on update 2011-06-14 14:16:48 +12:00
bin Revert "Bug 7167: New version for updatedatabase" 2012-12-27 14:02:56 -05:00
cronjobs Bug 11188 - Make gather_print_notices.pl die on failed open() 2013-12-30 15:12:48 +00:00
devel bug 8798: (follow-up) pass DB connection params to DBIC schema updater explicitly 2013-10-14 21:08:03 +00:00
interface_customization Bug 9615 - Combine staff home page images into single sprite 2013-02-20 08:29:22 -05:00
load_testing Bug 11124: QA Follow-up resolving a warning and three typos 2013-12-13 19:49:09 +00:00
maintenance Bug 9192: let UNIMARC_sync_date_created_with_marc_biblio.pl create fields if needed 2013-10-23 14:20:14 +00:00
migration_tools Bug 11412: fix potential bulkmarcimport crash when searching for duplicates in authorities 2013-12-26 15:52:02 +00:00
release_notes release notes for Koha 3.14.0 2013-11-21 01:40:18 +00:00
translator Translation update - split staff UI and help files 2013-12-17 16:22:49 -03:00
batchCompareMARCvsFrameworks.pl Bug 2505 - Add commented use warnings where missing in the misc/ directory 2010-04-21 20:26:44 +12:00
batchdeletebiblios.pl Bug 8674 follow-up Fix perlcritic error 2012-10-02 17:48:03 +02:00
batchDeleteUnusedSubfields.pl Bug 2505 - Add commented use warnings where missing in the misc/ directory 2010-04-21 20:26:44 +12:00
batchImportMARCWithBiblionumbers.pl Bug 8576: Software error on authority edition when using merge 2012-08-28 17:55:33 +02:00
batchRebuildBiblioTables.pl Bug 6001 : batchRebuildBiblioTables.pl doesn't crash anymore when GetMarcBiblio fails. Unprocessed biblionumbers are displayed at the end of the execution instead. 2011-04-29 08:56:57 +12:00
batchRepairMissingBiblionumbers.pl
batchupdateISBNs.pl Bug 2505 - Add commented use warnings where missing in the misc/ directory 2010-04-21 20:26:44 +12:00
check_sysprefs.pl MT3289 : check_sysprefs.pl case sensitive variable names 2011-03-31 15:23:24 +13:00
commit_file.pl Bug 7131: (follow-up) update the command-line import tools 2013-10-30 04:35:17 +00:00
export_borrowers.pl Bug 9045 - Adding some parameters to export_borrowers.pl 2013-03-21 10:47:42 -04:00
exportauth.pl Bug 6755 Problems with switching languages 2011-09-23 09:47:09 +12:00
koha-install-log Bug 10712: Save missing config variables to install log 2013-08-13 14:14:30 +00:00
kohalib.pl Bug 2505 - Add commented use warnings where missing in the misc/ directory 2010-04-21 20:26:44 +12:00
link_bibs_to_authorities.pl Bug 8818: make sure we load modules before using them 2012-10-01 19:01:50 +02:00
mod_zebraqueue.pl Bug 9286 - Add script to add a bib to the zebra queue from the command line 2013-05-28 08:00:15 -07:00
perlmodule_ls.pl Bug 2505 - add strict and warnings to perlmodule_ls 2010-04-21 20:30:52 +12:00
perlmodule_rm.pl Bug 2505 - remove unnecessary -w and replace with use warnings; 2010-04-07 13:27:07 -04:00
recreateIssueStatistics.pl Bug 6025: Adds a script that re-create missing statistics from issues and old_issues tables 2012-03-20 17:02:33 +01:00
sax_parser_print.pl
sax_parser_test.pl Bug 6752: Be stricter with utf-8 encoding of output 2012-01-27 12:11:06 +01:00
stage_file.pl Bug 8015: (follow-up) update stage_file.pl 2013-10-31 22:51:13 +00:00