mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Ensure that the path to a dump image specified in the NGDump meta file of a dump device points to a valid location within the dump device. Especially, disallow escaping from a dump device with a dump image path using references to '..' or symbolic links pointing outside of the dump device. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
39 lines
900 B
C
39 lines
900 B
C
/*
|
|
* zgetdump - Tool for copying and converting System z dumps
|
|
*
|
|
* NGDump dump tool
|
|
*
|
|
* Copyright IBM Corp. 2021
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#ifndef ZGETDUMP_NGDUMP_H
|
|
#define ZGETDUMP_NGDUMP_H
|
|
|
|
#include "zg.h"
|
|
|
|
#define NGDUMP_FSTYPE "ext4"
|
|
|
|
struct ngdump_meta {
|
|
int version;
|
|
const char *file;
|
|
const char *sha256sum;
|
|
};
|
|
|
|
enum ngdump_disk_type {
|
|
NG_TYPE_DASD,
|
|
NG_TYPE_NVME,
|
|
};
|
|
|
|
int ngdump_read_meta_from_device(const char *device, struct ngdump_meta *meta);
|
|
int ngdump_get_dump_part(struct zg_fh *zg_fh, char **part_path);
|
|
int ngdump_get_part_path(const char *disk_path, int part_num,
|
|
enum ngdump_disk_type ng_type, char **part_path);
|
|
int ngdump_get_dump_path(const char *mount_point,
|
|
const struct ngdump_meta *meta,
|
|
char **path);
|
|
|
|
#endif /* ZGETDUMP_NGDUMP_H */
|