X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fguestfs-internal.h;h=9193b97dd2416f3723973a0a898e8662bfbe262a;hp=b29fa5772f7a324da484e460da52f65fcddbacc7;hb=daf55c07978cd29fe6675911bf76da0b056fdae1;hpb=9e7c6a548353bde925c16434711bcc6208038d83 diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index b29fa57..9193b97 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -60,6 +60,35 @@ #define xdr_uint32_t xdr_u_int32_t #endif +/* Some limits on what the inspection code will read, for safety. */ + +/* Small text configuration files. + * + * The upper limit is for general files that we grep or download. The + * largest such file is probably "txtsetup.sif" from Windows CDs + * (~500K). This number has to be larger than any legitimate file and + * smaller than the protocol message size. + * + * The lower limit is for files parsed by Augeas on the daemon side, + * where Augeas is running in reduced memory and can potentially + * create a lot of metadata so we really need to be careful about + * those. + */ +#define MAX_SMALL_FILE_SIZE (2 * 1000 * 1000) +#define MAX_AUGEAS_FILE_SIZE (100 * 1000) + +/* Maximum Windows Registry hive that we will download to /tmp. Some + * registries can be legitimately very large. + */ +#define MAX_REGISTRY_SIZE (100 * 1000 * 1000) + +/* Maximum RPM or dpkg database we will download to /tmp. RPM + * 'Packages' database can get very large: 70 MB is roughly the + * standard size for a new Fedora install, and after lots of package + * installation/removal I have seen well over 100 MB databases. + */ +#define MAX_PKG_DB_SIZE (300 * 1000 * 1000) + /* Network configuration of the appliance. Note these addresses are * only meaningful within the context of the running appliance. QEMU * translates network connections to these magic addresses into @@ -118,7 +147,7 @@ struct guestfs_h char *qemu_help, *qemu_version; /* Output of qemu -help, qemu -version. */ char **cmdline; /* Qemu command line. */ - int cmdline_size; + size_t cmdline_size; int verbose; int trace; @@ -212,6 +241,8 @@ enum inspect_os_distro { OS_DISTRO_LINUX_MINT, OS_DISTRO_MANDRIVA, OS_DISTRO_SLACKWARE, + OS_DISTRO_CENTOS, + OS_DISTRO_SCIENTIFIC_LINUX, }; enum inspect_os_package_format { @@ -252,6 +283,7 @@ struct inspect_fs { char *hostname; char *windows_systemroot; char *windows_current_control_set; + char **drive_mappings; enum inspect_os_format format; int is_live_disk; int is_netinst_disk; @@ -314,11 +346,28 @@ extern int guestfs___match3 (guestfs_h *g, const char *str, const pcre *re, char #endif extern int guestfs___feature_available (guestfs_h *g, const char *feature); extern void guestfs___free_string_list (char **); -extern int guestfs___checkpoint_cmdline (guestfs_h *g); -extern void guestfs___rollback_cmdline (guestfs_h *g, int pos); +extern size_t guestfs___checkpoint_cmdline (guestfs_h *g); +extern void guestfs___rollback_cmdline (guestfs_h *g, size_t pos); extern void guestfs___call_callbacks_void (guestfs_h *g, uint64_t event); extern void guestfs___call_callbacks_message (guestfs_h *g, uint64_t event, const char *buf, size_t buf_len); extern void guestfs___call_callbacks_array (guestfs_h *g, uint64_t event, const uint64_t *array, size_t array_len); +#if defined(HAVE_PCRE) && defined(HAVE_HIVEX) +extern int guestfs___check_for_filesystem_on (guestfs_h *g, const char *device, int is_block, int is_partnum); +extern int guestfs___download_to_tmp (guestfs_h *g, const char *filename, const char *basename, int64_t max_size); +extern char *guestfs___case_sensitive_path_silently (guestfs_h *g, const char *); +extern struct inspect_fs *guestfs___search_for_root (guestfs_h *g, const char *root); +extern int guestfs___parse_unsigned_int (guestfs_h *g, const char *str); +extern int guestfs___parse_unsigned_int_ignore_trailing (guestfs_h *g, const char *str); +extern int guestfs___parse_major_minor (guestfs_h *g, struct inspect_fs *fs); +extern char *guestfs___first_line_of_file (guestfs_h *g, const char *filename); +extern int guestfs___first_egrep_of_file (guestfs_h *g, const char *filename, const char *eregex, int iflag, char **ret); +typedef int (*guestfs___db_dump_callback) (guestfs_h *g, const unsigned char *key, size_t keylen, const unsigned char *value, size_t valuelen, void *opaque); +extern int guestfs___read_db_dump (guestfs_h *g, const char *dumpfile, void *opaque, guestfs___db_dump_callback callback); +extern int guestfs___check_installer_root (guestfs_h *g, struct inspect_fs *fs); +extern int guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs); +extern int guestfs___check_freebsd_root (guestfs_h *g, struct inspect_fs *fs); +extern int guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs); +#endif #define error(g,...) guestfs_error_errno((g),0,__VA_ARGS__) #define perrorf guestfs_perrorf