View | Details | Raw Unified | Return to bug 170114 | Differences between
and this patch

Collapse All | Expand All

(-)bin/duplicity (-27 lines)
Lines 299-330 Link Here
299
            tdp.delete()
299
            tdp.delete()
300
        return putsize
300
        return putsize
301
301
302
    def validate_encryption_settings(backup_set, manifest):
303
        """
304
        When restarting a backup, we have no way to verify that the current
305
        passphrase is the same as the one used for the beginning of the backup.
306
        This is because the local copy of the manifest is unencrypted and we
307
        don't need to decrypt the existing volumes on the backend.  To ensure
308
        that we are using the same passphrase, we manually download volume 1
309
        and decrypt it with the current passphrase.  We also want to confirm
310
        that we're using the same encryption settings (i.e. we don't switch
311
        from encrypted to non in the middle of a backup chain), so we check
312
        that the vol1 filename on the server matches the settings of this run.
313
        """
314
        vol1_filename = file_naming.get(backup_type, 1,
315
                                        encrypted=globals.encryption,
316
                                        gzipped=globals.compression)
317
        if vol1_filename != backup_set.volume_name_dict[1]:
318
            log.FatalError(_("Restarting backup, but current encryption "
319
                             "settings do not match original settings"),
320
                           log.ErrorCode.enryption_mismatch)
321
322
        # Settings are same, let's check passphrase itself if we are encrypted
323
        if globals.encryption:
324
            fileobj = restore_get_enc_fileobj(globals.backend, vol1_filename,
325
                                              manifest.volume_info_dict[1])
326
            fileobj.close()
327
328
    if not globals.restart:
302
    if not globals.restart:
329
        # normal backup start
303
        # normal backup start
330
        vol_num = 0
304
        vol_num = 0
Lines 335-341 Link Here
335
        mf = globals.restart.last_backup.get_local_manifest()
309
        mf = globals.restart.last_backup.get_local_manifest()
336
        globals.restart.checkManifest(mf)
310
        globals.restart.checkManifest(mf)
337
        globals.restart.setLastSaved(mf)
311
        globals.restart.setLastSaved(mf)
338
        validate_encryption_settings(globals.restart.last_backup, mf)
339
        mf.fh = man_outfp
312
        mf.fh = man_outfp
340
        last_block = globals.restart.last_block
313
        last_block = globals.restart.last_block
341
        log.Notice("Restarting after volume %s, file %s, block %s" %
314
        log.Notice("Restarting after volume %s, file %s, block %s" %

Return to bug 170114