X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=main.cpp;h=6e3f1d7a5c348594c3677c59467b7dfda75da9c7;hb=49b97cc7215a49737d34e177b56162c2087d6544;hp=64c746af5110ab73e3c3514d9e7da12c770967b6;hpb=30cd9395b85fb50f885d8f25d109d2cc27b7f9ff;p=android-x86%2Fsystem-connectivity-wificond.git diff --git a/main.cpp b/main.cpp index 64c746a..6e3f1d7 100644 --- a/main.cpp +++ b/main.cpp @@ -27,10 +27,7 @@ #include #include #include -#include #include -#include -#include #include #include "wificond/ipc_constants.h" @@ -41,13 +38,9 @@ #include "wificond/server.h" using android::net::wifi::IWificond; -using android::wifi_hal::DriverTool; -using android::wifi_system::HalTool; using android::wifi_system::HostapdManager; using android::wifi_system::InterfaceTool; using android::wifi_system::SupplicantManager; -using android::wificond::ipc_constants::kDevModePropertyKey; -using android::wificond::ipc_constants::kDevModeServiceName; using android::wificond::ipc_constants::kServiceName; using std::unique_ptr; @@ -100,30 +93,10 @@ void RegisterServiceOrCrash(const android::sp& service) { android::sp sm = android::defaultServiceManager(); CHECK_EQ(sm != NULL, true) << "Could not obtain IServiceManager"; - const int8_t dev_mode_on = property_get_bool(kDevModePropertyKey, 0); - const char* service_name = (dev_mode_on) ? kDevModeServiceName : kServiceName; - CHECK_EQ(sm->addService(android::String16(service_name), service), + CHECK_EQ(sm->addService(android::String16(kServiceName), service), android::NO_ERROR); } -void DoPrivilegedSetupOrCrash() { - // take ownership of the magic firmware change path - CHECK(chown(DriverTool::kFirmwareReloadPath, AID_WIFI, AID_WIFI) == 0) - << "Error changing ownership of '" << DriverTool::kFirmwareReloadPath - << "' to wifi:wifi, (" << strerror(errno) << ")"; -} - -void DropPrivilegesOrCrash() { - minijail* j = minijail_new(); - CHECK(minijail_change_user(j, "wifi") == 0); - CHECK(minijail_change_group(j, "wifi") == 0); - minijail_use_caps(j, - CAP_TO_MASK(CAP_NET_ADMIN) | - CAP_TO_MASK(CAP_NET_RAW)); - minijail_enter(j); - minijail_destroy(j); -} - } // namespace void OnBinderReadReady(int fd) { @@ -134,9 +107,6 @@ int main(int argc, char** argv) { android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); LOG(INFO) << "wificond is starting up..."; - DoPrivilegedSetupOrCrash(); - DropPrivilegesOrCrash(); - unique_ptr event_dispatcher( new android::wificond::LooperBackedEventLoop()); ScopedSignalHandler scoped_signal_handler(event_dispatcher.get()); @@ -153,9 +123,7 @@ int main(int argc, char** argv) { android::wificond::ScanUtils scan_utils(&netlink_manager); unique_ptr server(new android::wificond::Server( - unique_ptr(new HalTool), unique_ptr(new InterfaceTool), - unique_ptr(new DriverTool), unique_ptr(new SupplicantManager()), unique_ptr(new HostapdManager()), &netlink_utils,