From f6129f4635829f96a77f2f746dbe7734a7402b68 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Sun, 25 Jun 2006 12:55:50 +0000 Subject: * NEWS: Document strict absolute path checks. * sbuild/sbuild-chroot-config.cc (parse_data): Catch and report chroot deserialisation errors. * sbuild/sbuild-chroot-plain.cc (set_keyfile): "location" must be absolute. * sbuild/sbuild-chroot-file.cc (set_keyfile): "file" must be absolute. * sbuild/sbuild-chroot.cc (set_keyfile): "mount-device" and "mount-location" must be absolute. * sbuild/sbuild-chroot-lvm-snapshot.cc (set_keyfile): "lvm-snapshot-device" must be absolute. * sbuild/sbuild-chroot-block-device.cc (get_location): Remove unused function (set_location): Remove unused function (get_keyfile): Remove "location". (set_keyfile): Obsolete "location". "device" must be absolute. * sbuild/sbuild-chroot.h (sbuild): Add DEVICE_ABS, FILE_ABS and LOCATION_ABS error codes. * sbuild/sbuild-keyfile.cc (check_priority): Add missing break in switch. * dchroot-dsa/dchroot-dsa-session.cc (get_user_command): Throw a COMMAND_ABS error if the command is not absolute. * sbuild/sbuild-session.(cc|h): Add a COMMAND_ABS error code. * dchroot-dsa/dchroot-dsa-options.cc (check_options): Throw an error if the command is not an absolute path. This optimisation means a session is not set up if it is already known it will fail. * sbuild/sbuild-util.cc (is_absname): New function. This checks if a path is absolute. --- sbuild/sbuild-util.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sbuild/sbuild-util.cc') diff --git a/sbuild/sbuild-util.cc b/sbuild/sbuild-util.cc index c0b1e141..a6b1ab20 100644 --- a/sbuild/sbuild-util.cc +++ b/sbuild/sbuild-util.cc @@ -121,6 +121,15 @@ sbuild::normalname (std::string name, return remove_duplicates(name, separator); } +bool +sbuild::is_absname (std::string const& name) +{ + if (name.empty() || name[0] != '/') + return false; + else + return true; +} + std::string sbuild::string_list_to_string (sbuild::string_list const& list, std::string const& separator) -- cgit v1.2.3