Ejemplo n.º 1
0
Archivo: su.c Proyecto: garyhsh/system
int main(int argc, char **argv)
{
	struct stat stats;
	struct passwd *pw;
	int uid = 0;
	int gid = 0;

	int ppid = getppid();
	char szppid[256];
	sprintf(szppid, "/proc/%d", ppid);
	stat(szppid, &stats);
	g_puid = stats.st_uid;

	ALOGE("----su-----");
	if(setgid(gid) || setuid(uid)) 
		return permissionDenied();

	char *exec_args[argc + 1];
	exec_args[argc] = NULL;
	exec_args[0] = "sh";
	int i;
	for (i = 1; i < argc; i++)
	{
		ALOGV("argv[%d]=%s", i, argv[i]);
		exec_args[i] = argv[i];
	}
	execv("/system/bin/sh", exec_args);
	return executionFailure("sh");
}
Ejemplo n.º 2
0
void MIDIAccess::setSysExEnabled(bool enable)
{
    m_requesting = false;
    m_sysExEnabled = enable;
    if (enable)
        m_accessor->startSession();
    else
        permissionDenied();
}
Ejemplo n.º 3
0
void MIDIAccess::startRequest()
{
    if (!m_promise->options()->sysex) {
        m_accessor->startSession();
        return;
    }
    Document* document = toDocument(executionContext());
    ASSERT(document);
    MIDIController* controller = MIDIController::from(document->page());
    if (controller) {
        m_requesting = true;
        controller->requestSysExPermission(this);
    } else {
        permissionDenied();
    }
}