OSDN Git Service

adbd: set sent file ownership per android fs config table
authorThomas Daniel <thomas.daniel@intel.com>
Mon, 7 Jan 2013 17:02:31 +0000 (17:02 +0000)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 16 Jun 2013 08:06:07 +0000 (16:06 +0800)
commita2abab9e2dfd397d765d9c80c59dea630d7c0c06
treebacbd72372a4ded188ddf135d52ec4199d298e1a
parentbdfc90aeed057110fa1c6959224cdde7d959d1ed
adbd: set sent file ownership per android fs config table

do_send() uses fs_config() to retrieve mode, user and group for a sent file but
handle_send_file() only gets passed the mode.  User and group are discarded.
This causes problems as it means any files updated with adb sync will have their
owner set to root.

For example, the file "/system/etc/dbus.conf" should be owned by "bluetooth" as
specified in android_filesystem_config.h, and its permissions should be read for
user and group but nothing for other.  Using adb sync to send this file means
that the owner is set to root, and no access permissions for others.  This means
that when a process running as "bluetooth" tries to access the file it fails,
resulting in a boot failure.

This change adds a new wrapper function adb_chown() which calls chown() to match
the existing pattern for wrapping file I/O functions.  This adb_chown() is now
called in do_send() to correctly set the owner and group as specified in the
fs_config table.

Change-Id: I37661273780346a6a868e58d9069171052e81e34
adb/file_sync_service.c
adb/sysdeps.h