Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Bug 835963 - Revert pull request 26 due to bustage #27

Merged
merged 1 commit into from
Jan 29, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/rilproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@
#include <utils/Log.h>
#include <cutils/sockets.h>

#define LISTEN_BACKLOG 4

void setCapability() {
void switchUser() {
prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
setuid(1001);

struct __user_cap_header_struct header;
struct __user_cap_data_struct cap;
header.version = _LINUX_CAPABILITY_VERSION;
Expand Down Expand Up @@ -140,22 +142,18 @@ int main(int argc, char **argv) {
rild_socket = getSocketName(RILD_SOCKET_NAME, client_id);
}

// get control rilproxy socket
rilproxy_conn = android_get_control_socket(rilproxy_socket);
// connect to the rilproxy socket
rilproxy_conn = socket_local_server(
rilproxy_socket,
ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM );
if (rilproxy_conn < 0) {
LOGE("Could not connect to %s socket: %s\n",
rilproxy_socket, strerror(errno));
return 1;
}

ret = listen(rilproxy_conn, LISTEN_BACKLOG);
if (ret < 0) {
LOGE("Failed to listen on control socket '%d': %s",
rilproxy_conn, strerror(errno));
return 1;
}

setCapability();
switchUser();
struct passwd *pwd = NULL;
pwd = getpwuid(getuid());
if (pwd != NULL) {
Expand Down