vold: Enable the SO_PASSCRED socket option

Ensure that sender credentials are available when we
receive a netlink message.

Change-Id: I48411205a8fbc1ebd29834f64028662d80f15995
This commit is contained in:
Nick Kralevich 2011-04-18 15:51:19 -07:00
parent f3d3ce5e53
commit c51920c824

View file

@ -50,6 +50,7 @@ NetlinkManager::~NetlinkManager() {
int NetlinkManager::start() { int NetlinkManager::start() {
struct sockaddr_nl nladdr; struct sockaddr_nl nladdr;
int sz = 64 * 1024; int sz = 64 * 1024;
int on = 1;
memset(&nladdr, 0, sizeof(nladdr)); memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK; nladdr.nl_family = AF_NETLINK;
@ -63,7 +64,12 @@ int NetlinkManager::start() {
} }
if (setsockopt(mSock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) { if (setsockopt(mSock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0) {
SLOGE("Unable to set uevent socket options: %s", strerror(errno)); SLOGE("Unable to set uevent socket SO_RECBUFFORCE option: %s", strerror(errno));
return -1;
}
if (setsockopt(mSock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
SLOGE("Unable to set uevent socket SO_PASSCRED option: %s", strerror(errno));
return -1; return -1;
} }