FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ununpack-disk.c File Reference

The universal unpacker code to unpack a disk file system. More...

#include "ununpack.h"
#include "externs.h"
#include <utime.h>
Include dependency graph for ununpack-disk.c:

Go to the source code of this file.

Classes

struct  permlist
 Structure to hold permission about an inode. More...
 

Typedefs

typedef struct permlist permlist
 

Functions

void FatDiskName (char *Name)
 Special handling for FAT names. More...
 
void FreeDiskPerms (permlist *List)
 Deallocate perms. More...
 
permlistExtractDiskPerms (char *FStype, char *Source)
 Given a disk, load in all of the file permissions. Assumes Source is already quote-tainted! More...
 
int SameInode (char *Inode1, char *Inode2)
 Determine if two inodes are the same. More...
 
permlistSetDiskPerm (char *inode, permlist *List, char *Destination, char *Target)
 Find a disk permission by inode, set the permissions on the file, and free the memory. More...
 
int ExtractDisk (char *Source, char *FStype, char *Destination)
 Given a disk image, type of system, and a directory, extract all files! More...
 

Detailed Description

The universal unpacker code to unpack a disk file system.

Definition in file ununpack-disk.c.

Function Documentation

◆ ExtractDisk()

int ExtractDisk ( char *  Source,
char *  FStype,
char *  Destination 
)

Given a disk image, type of system, and a directory, extract all files!

This can handle any filesystem supported by fls/icat.

Special: FAT is case-insensitive, so everything is converted to lowercase.

Uses the following external commands: fls icat

icat and fls are from the package "sleuthkit".

Note
This spawns multiple processes.
Parameters
Source
FStypefilesystem type
Destination
Returns
0 on success, non-zero on failure.

Definition at line 288 of file ununpack-disk.c.

◆ ExtractDiskPerms()

permlist* ExtractDiskPerms ( char *  FStype,
char *  Source 
)

Given a disk, load in all of the file permissions. Assumes Source is already quote-tainted!

Parameters
FStypeFilesystem type
SourceSource filepath
Returns
permlist

Definition at line 81 of file ununpack-disk.c.

◆ FatDiskName()

void FatDiskName ( char *  Name)

Special handling for FAT names.

  • Convert to lowercase.
  • Remove any short name (name in parenthesis).
    Parameters
    NameFilename

Definition at line 37 of file ununpack-disk.c.

◆ FreeDiskPerms()

void FreeDiskPerms ( permlist List)

Deallocate perms.

Parameters
Listpermlist

Definition at line 62 of file ununpack-disk.c.

◆ SameInode()

int SameInode ( char *  Inode1,
char *  Inode2 
)

Determine if two inodes are the same.

Note
Strings MUST be null terminated!
Valid characters: 0-9 and hyphen.
Parameters
Inode1
Inode2
Returns
1 on match, 0 on miss.

Definition at line 178 of file ununpack-disk.c.

◆ SetDiskPerm()

permlist* SetDiskPerm ( char *  inode,
permlist List,
char *  Destination,
char *  Target 
)

Find a disk permission by inode, set the permissions on the file, and free the memory.

Parameters
inode
Listpermlist
DestinationTarget directory containing file
TargetFilename (may also include path components)
Returns
new permlist or NULL on error

Definition at line 205 of file ununpack-disk.c.