8db3a1a Ticket #47555 - db2bak.pl issue when specifying non-default directory

Authored and Committed by nhosoi 10 years ago
    Ticket #47555 - db2bak.pl issue when specifying non-default directory
    
    Bug description: db2bak.pl takes an option "-a backupdir", which is
    supposed to be generated by the server and used as a backup directory.
    But since the created directory inherits the parent's selinux context,
    it fails to store the backup files in the directory.
    
    Fix description: As the reporter agaviola suggested, it should be a
    good idea to add one more level to the archive directory.
    $archivedir = "${archivedir}/ID-${yr}_${mn}_${dy}_${h}_${m}_${s}";
    But to keep the backward compatibility, introducing a new option "-A
    backupdir" and when "-A" is given, storing the backup files in the
    nested backup directory.  If the option is "-a backupdir", the backup
    files are stored in the backupdir.
    
    Respecting the selinux policy, the server and its utilities are not
    supposed to create a file/directory where it is not allowed.  This
    patch creates a symlink from the back up location to the specified
    path by a user.  bak2db.pl follows the symlink and restore from the
    back up directory.
    
    https://fedorahosted.org/389/ticket/47555
    
    Reviewed by rmeggins (Thank you, Rich!!)