Commit graph

5947 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
12d4f965cd Support %1$d syntax.
* tests/printf_unit_test.c: New file.
	* Makefile.util.def (printf_test): New test.
	* grub-core/kern/misc.c (grub_vsnprintf_real): Support %1$d syntax.
2011-11-11 21:14:41 +01:00
Vladimir 'phcoder' Serbinenko
c76b541762 * grub-core/hook/datehook.c (grub_read_hook_datetime): Small stylistic
fix.
2011-11-11 21:03:49 +01:00
Vladimir 'phcoder' Serbinenko
df067ad13a * grub-core/efiemu/mm.c (grub_efiemu_mmap_fill): Change printf into
dprintf.
	* grub-core/font/font.c (grub_font_load): Likewise.
2011-11-11 20:59:25 +01:00
Vladimir 'phcoder' Serbinenko
5b289bc5f6 * util/grub-macho2img.c: Add comment concerning gettext.
* grub-core/lib/legacy_parse.c: Likewise.
2011-11-11 20:52:41 +01:00
Vladimir 'phcoder' Serbinenko
c1860f878b * grub-core/kern/misc.c (grub_vprintf): Add missing va_end.
(grub_xvasprintf): Likewise.
2011-11-11 20:45:31 +01:00
Vladimir 'phcoder' Serbinenko
d35d0d3753 Add const keyword to grub_env_get and gettextize week days.
* grub-core/hook/datehook.c (grub_datetime_names): Make const.
	(grub_read_hook_datetime): Return const char *.
	* grub-core/kern/env.c (grub_env_get): Return const char *. All users
	updated.
	* grub-core/normal/datetime.c (grub_weekday_names): Make const.
	Mark for gettext.
	(grub_get_weekday_name): Return const char *. Call gettext.
	* grub-core/script/argv.c (grub_script_argv_append): Receive const
	char * and len as the argument. All users updated.
	(grub_script_argv_split_append): Receive const char *.
	* include/grub/datetime.h (grub_get_weekday_name): Update proto.
	* include/grub/env.h (grub_env_get): Likewise.
	(grub_env_read_hook_t): Return const char *.
	* include/grub/script_sh.h (grub_script_argv_append): Update proto.
	(grub_script_argv_split_append): Likewise.
2011-11-11 20:34:37 +01:00
Vladimir 'phcoder' Serbinenko
9aed8a7178 * grub-core/normal/main.c (grub_normal_execute): Remove leftover call. 2011-11-11 20:09:14 +01:00
Vladimir 'phcoder' Serbinenko
067fdf0055 * grub-core/kern/misc.c (grub_strstr): Moved from here ...
* include/grub/misc.h (grub_strstr): ... here. Make static and inline.
2011-11-11 20:02:51 +01:00
Vladimir 'phcoder' Serbinenko
a8bd9d39d6 * include/grub/ieee1275/ieee1275.h (grub_ieee1275_set_property):
Fix prototype.
2011-11-11 18:32:06 +01:00
Vladimir 'phcoder' Serbinenko
f7ce5bafb5 Fix mips compilation.
* grub-core/lib/xzembed/xz_dec_stream.c (xz_dec): Restrict hash_id to
	normal decoder.
	(hashes): Use in embed decoder as well (for sizes).
	(dec_stream_header): Fix embed decompressor logic.
	(dec_stream_footer): Likewise.
2011-11-11 18:30:34 +01:00
Vladimir 'phcoder' Serbinenko
9bb182f371 * grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Issue
an error and not a fatal on unrecognised relocation types.
2011-11-11 18:05:16 +01:00
Vladimir 'phcoder' Serbinenko
63a9e6f6a0 * grub-core/kern/ieee1275/openfw.c (grub_ieee1275_parse_args):
Issue error rather than printf on unknown arguments.
2011-11-11 17:44:47 +01:00
Vladimir 'phcoder' Serbinenko
4c458569a7 * grub-core/kern/ieee1275/ieee1275.c (grub_ieee1275_set_property):
Make buf a const.
2011-11-11 17:34:38 +01:00
Vladimir 'phcoder' Serbinenko
e2d22baf41 * grub-core/fs/zfs/zfscrypt.c (GRUB_MOD_INIT), (GRUB_MOD_FINI):
Fix module name.
2011-11-11 17:21:33 +01:00
Vladimir 'phcoder' Serbinenko
53dc859065 * grub-core/fs/ntfs.c (grub_ntfs_read_symlink): Stylistic fix. Remove
leftover debug printf.
2011-11-11 17:18:34 +01:00
Vladimir 'phcoder' Serbinenko
6c1892942d * grub-core/fs/btrfs.c (grub_btrfs_embed): Spelling fix. 2011-11-11 17:13:23 +01:00
Vladimir 'phcoder' Serbinenko
f768836950 * grub-core/efiemu/main.c (grub_efiemu_register_configuration_table):
A stylistic fix.
2011-11-11 17:10:50 +01:00
Vladimir 'phcoder' Serbinenko
11a775a3ad * grub-core/commands/probe.c (grub_cmd_probe): Fix error message. 2011-11-11 17:08:29 +01:00
Shea Levy
33f784e881 Allow all modules to perform serial IO
* grub-core/term-serial.c (grub_serial_find): Remove static qualifier
	* include/grub/serial.h (grub_serial_port_configure): New inline
	function.
	(grub_serial_port_fetch): Likewise.
	(grub_serial_port_put): Likewise.
	(grub_serial_port_fini): Likewise.
	(grub_serial_find): New proto.
2011-11-10 09:41:07 +01:00
Vladimir 'phcoder' Serbinenko
f627652531 Put symlink at the end of the node and fix a potential
memory corruption.

	* grub-core/fs/iso9660.c (grub_fshelp_node): New field have_symlink.
	Make symlink into an array.
	(set_rockridge): Set have_symlink and alloc_dirents.
	(grub_iso9660_read_symlink): Use new layout.
	(grub_iso9660_iterate_dir): Fix memory corruption.
	Use new layout.
	(grub_iso9660_dir): Set have_symlink.
	(grub_iso9660_open): Likewise.
2011-11-10 09:31:06 +01:00
Vladimir 'phcoder' Serbinenko
c3591189b8 Remove local keyword.
* util/grub-mkconfig_lib.in (version_test_numeric): Remove local.
	(version_test_gt): Likewise.
	(version_find_latest): Likewise.
	(gettext_printf): Likewise.
	* util/grub.d/10_windows.in (get_os_name_from_boot_ini): Likewise.
2011-11-10 08:46:09 +01:00
Vladimir 'phcoder' Serbinenko
cb544caa2e * grub-core/fs/zfs/zfs.c (zfs_mount): Fix spurious warning. 2011-11-10 08:43:08 +01:00
Vladimir 'phcoder' Serbinenko
45bd824d2e Fix ZFS memory and resource leaks.
* grub-core/fs/zfs/zfs.c (fill_vdev_info_real): New paramter inserted.
	All users updated.
	Free type on exit.
	(fill_vdev_info): New parameter inserted. All users updated.
	(check_pool_label): Likewise.
	(scan_disk): Likewise.
	(scan_devices): Close non-inserted disks.
	(fzap_iterate): Free l.
	(unmount_device): Free children descripto memory.
2011-11-10 08:38:06 +01:00
Vladimir 'phcoder' Serbinenko
ad9a2f44b4 * grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Fix grub_strncat
argument (access out of bounds).
2011-11-10 08:16:27 +01:00
Vladimir 'phcoder' Serbinenko
6b68db81fc * grub-core/fs/btrfs.c (grub_btrfs_read_logical): Fix RAID10 logic for
>= 6 drives.
2011-11-10 08:09:33 +01:00
Vladimir 'phcoder' Serbinenko
28840fdaae * include/grub/i386/netbsd_bootinfo.h (grub_netbsd_btinfo_bootwedge):
Fix declaration.
2011-11-10 08:07:51 +01:00
Vladimir 'phcoder' Serbinenko
8a5a3a5b5a Fix several memory leaks.
* grub-core/fs/btrfs.c (grub_btrfs_dir): Fix memory leak.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Likewise.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/fat.c (grub_fat_label): Likewise.
	* grub-core/fs/jfs.c (grub_jfs_label): Likewise.
	* grub-core/fs/romfs.c (grub_romfs_close): Likewise.
	(grub_romfs_label): Likewise.
	* grub-core/fs/squash4.c (squash_mount): Use zalloc for safety.
	(squash_unmount): New function.
	(grub_squash_dir): Fix memory leak.
	(grub_squash_open): Likewise.
	(grub_squash_read): Likewise.
	(grub_squash_mtime): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_open): Likewise.
	* grub-core/fs/zfs/zfs.c (check_pool_label): Likewise.
	* util/grub-fstest.c (fstest): Likewise.
2011-11-09 15:01:58 +01:00
Vladimir 'phcoder' Serbinenko
57b0125004 * include/grub/misc.h (grub_strncat): Fix the order of conditionals to
avoid accessing beyond the array.
2011-11-09 14:47:45 +01:00
Vladimir 'phcoder' Serbinenko
19e81ba7a0 * configure.ac: Add missing -mXX to TARGET_CPPFLAGS. 2011-11-09 14:44:21 +01:00
Vladimir 'phcoder' Serbinenko
52b656c037 Several AFFS fixes.
* grub-core/fs/affs.c (grub_affs_bblock): Replace flags with version.
	(GRUB_AFFS_FLAG_FFS): Removed.
	(GRUB_AFFS_SYMLINK_SIZE): Likewise.
	(GRUB_AFFS_FILETYPE_DIR): Make positive and unsigned.
	(GRUB_AFFS_FILETYPE_DIR), (GRUB_AFFS_FILETYPE_REG): Fix a mix-up.
	(grub_fshelp_node): Make block 32-bit.
	Add block_cache and last_block_cache.
	(grub_affs_read_block): Fill and use block cache.
	(grub_affs_read_file): Removed.
	(grub_affs_mount): Zero-fill node. Fix version check. Don't reread
	boot block.
	(grub_affs_read_symlink): Fix symlink size. Add a \0 at the end for
	safety.
	(grub_affs_iterate_dir): Use more appropriate types. Zero-fill allocated
	space.
	(grub_affs_close): Free block cache.
	(grub_affs_read): Use grub_fshelp_read_file directly.
2011-11-09 11:43:39 +01:00
Vladimir 'phcoder' Serbinenko
438a746a3f * grub-core/fs/zfs/zfs.c (read_dva): Issue an error if read failed
with no error set.
2011-11-08 20:03:06 +01:00
Vladimir 'phcoder' Serbinenko
49a45021c1 * grub-core/lib/LzmaEnc.c (LzmaEnc_CodeOneBlock): Remove set but not
used variable.
	* grub-core/kern/ia64/dl_helper.c (grub_ia64_dl_get_tramp_got_size):
	Likewise.
2011-11-08 19:46:41 +01:00
Vladimir 'phcoder' Serbinenko
3ae17eb83c Fix potential problem with calling zfs_to_cpu and cpu_to_be in a row.
* grub-core/fs/zfs/zfscrypt.c (grub_zfs_decrypt_real): Use explicit
	byteswap when needed.
2011-11-08 19:44:18 +01:00
Vladimir 'phcoder' Serbinenko
27610c3836 Fix FreeBSD compilation.
* grub-core/disk/geli.c (GRUB_MD_SHA256) [GRUB_UTIL]: Redefine in a way
	to avoid circular dependency.
	(GRUB_MD_SHA512) [GRUB_UTIL]: Likewise.
	* util/getroot.c (grub_util_follow_gpart_up): Move from here...
	* grub-core/kern/emu/hostdisk.c (+grub_util_follow_gpart_up): ... here.
2011-11-08 19:34:19 +01:00
Vladimir 'phcoder' Serbinenko
4a19b6017d Fix ZFS crypto error types.
* grub-core/fs/zfs/zfscrypt.c (grub_ccm_decrypt): Fix return type.
	(grub_gcm_decrypt): Likewise.
	(grub_zfs_load_key_real): Fix error code type. Handle possible error
	from PBKDF2.
2011-11-08 16:07:27 +01:00
Vladimir 'phcoder' Serbinenko
958ee22168 Illumos support.
* Makefile.util.def (10_illumos): New script.
	* configure.ac: Set COND_HOST_ILLUMOS.
	* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors) [__sun__]:
	Support Illumos calls.
	(find_partition_start) [__sun__]: Likewise.
	(convert_system_partition_to_system_disk) [__sun__]: Likewise.
	(device_is_wholedisk) [__sun__]: Handle Illumos naming scheme.
	(grub_util_biosdisk_get_grub_dev) [__sun__]: Handle Illumos.
	* util/getroot.c (find_root_device_from_libzfs) [__sun__]: Return raw
	device.
	* util/grub-probe.c (probe) [__sun__]: Do character check.
	* util/grub.d/10_illumos.in: New file.
2011-11-08 12:38:30 +01:00
Vladimir 'phcoder' Serbinenko
cac14fb663 Support escaped commas in hostdisk.
* grub-core/kern/emu/hostdisk.c (unescape_cmp): New function.
	(find_grub_drive): Use unescape_cmp.
	(make_device_name): Escape commas.
2011-11-08 12:15:57 +01:00
Vladimir 'phcoder' Serbinenko
78e08dc3cb * util/grub.d/10_kfreebsd.in: Use ${grub_mkrelpath} not grub-mkrelpath. 2011-11-08 12:06:27 +01:00
Vladimir 'phcoder' Serbinenko
9f421dd1f0 * grub-core/fs/zfs/zfs.c (zap_iterate): Remove set but not used
variable.
2011-11-08 11:32:19 +01:00
Vladimir 'phcoder' Serbinenko
ed64e9e279 Support trampoline jumps on powerpc.
* grub-core/kern/dl.c (grub_dl_load_segments) [__powerpc__]: Follow
	__ia64__ path.
	(grub_dl_load_segments): Set mod->sz.
	(grub_dl_flush_cache): Flush whole space occupied by module, not just
	segments.
	* grub-core/kern/ia64/dl.c (nopm): Make const while on it.
	(jump): Likewise.
	* grub-core/kern/powerpc/dl.c (grub_arch_dl_get_tramp_got_size): New
	function.
	(trampoline): New struct.
	(trampoline_template): New const.
	(grub_arch_dl_relocate_symbols): Create trampolines on overflow.
	* include/grub/dl.h (grub_dl): Add sz element.
	[__powerpc__]: Follow __ia64__.
	(GRUB_ARCH_DL_TRAMP_ALIGN): Define on ppc.
	(GRUB_ARCH_DL_GOT_ALIGN): Likewise.
	(GRUB_ARCH_DL_TRAMP_SIZE): Likewise.
	(grub_arch_dl_get_tramp_got_size) [__powerpc__]: New proto.
2011-11-08 11:23:56 +01:00
Vladimir 'phcoder' Serbinenko
3084ede4c7 ZFS crypto support.
* Makefile.util.def (libgrubmods): Add grub-core/fs/zfs/zfscrypt.c.
	* grub-core/Makefile.core.def (zfscrypt): New module.
	* grub-core/fs/zfs/zfs.c (subvolume): New structure.
	(grub_zfs_data): Replace mdn with subvol. Put case_insensitivity inside
	it. All users updated.
	(grub_zfs_decrypt): New var.
	(grub_zfs_load_key): Likewise.
	(zio_checksum_functions): Add SHA256+MAC.
	(zio_checksum_verify): Handle incomplete comparison due to MAC.
	(zio_read): Handle encrypted blocks.
	(zap_verify): Remove incorrect check.
	(fzap_iterate): Handle non-standard fzap.
	(zap_iterate): Likewise.
	(zap_iterate_u64): New function.
	(dnode_get_fullpath): Load keys.
	* grub-core/fs/zfs/zfscrypt.c: New file.
	* grub-core/lib/crypto.c (grub_crypto_cipher_close): Removed.
	(grub_crypto_ecb_encrypt): Make input const.
	* include/grub/crypto.h (grub_crypto_cipher_close): Inline.
	(grub_crypto_ecb_encrypt): Make input const.
	(GRUB_CIPHER_AES): New macro.
	* include/grub/zfs/dmu.h (dmu_object_type): Add DMU_OT_DSL_KEYCHAIN.
	* include/grub/zfs/dsl_dir.h (dsl_dir_phys): Add keychain.
	* include/grub/zfs/spa.h (grub_zfs_endian): Moved from here ...
	* include/grub/zfs/zfs.h (grub_zfs_endian): ... here. Added GURB_ZFS_
	prefix. All users updated.
	(grub_zfs_add_key): New proto.
	(grub_zfs_decrypt): Likewise.
	(grub_zfs_load_key): Likewise.
	* include/grub/zfs/zio.h (zio_checksum): Add SHA256+MAC.
	* util/grub-fstest.c (options): Add -K option.
	(argp_parser): Likewise.
2011-11-06 21:44:48 +01:00
Vladimir 'phcoder' Serbinenko
ae9a20d973 Small cleanup 2011-11-06 21:08:32 +01:00
Vladimir 'phcoder' Serbinenko
bc1de0bc26 GCM support 2011-11-06 21:05:25 +01:00
Vladimir 'phcoder' Serbinenko
d99b3726e5 Support ZFS subvolumes with multiple keys 2011-11-06 17:13:38 +01:00
Vladimir 'phcoder' Serbinenko
ed746949af ZFS passphrase support 2011-11-06 16:30:52 +01:00
Vladimir 'phcoder' Serbinenko
f003a8c5e7 Move ZFS crypto to separate module 2011-11-06 15:18:25 +01:00
Vladimir 'phcoder' Serbinenko
2cdc899567 ZFS crypto key adding 2011-11-06 14:44:29 +01:00
Vladimir 'phcoder' Serbinenko
1bc7cc1b4d First part of zfs-crypto. CCM support with 0-filled keys 2011-11-06 13:18:27 +01:00
Vladimir 'phcoder' Serbinenko
b632b404e0 Support zle compression on ZFS.
* grub-core/fs/zfs/zfs.c (zle_decompress): New function.
	(decomp_table): Add zle.
	* include/grub/zfs/zio.h (zio_compress): Add zle.
2011-11-05 14:50:53 +01:00
Vladimir 'phcoder' Serbinenko
c7ba4f6984 Support BtrFS embedding.
* grub-core/fs/btrfs.c (grub_btrfs_embed) [GRUB_UTIL]: New function.
	(grub_btrfs_fs) [GRUB_UTIL]: Set embed.
	* include/grub/fs.h (grub_fs) [GRUB_UTIL]: New field embed.
	* util/grub-setup.c (setup): Use fs embedding if available.
	Add additional sanity check.
2011-11-05 14:47:25 +01:00