Ejemplo n.º 1
0
bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
			void **data_p)
{
	struct dcesrv_handle *rpc_hnd;

	rpc_hnd = find_policy_by_hnd_internal(p, hnd, data_p);
	if (rpc_hnd == NULL) {
		return false;
	}
	return true;
}
Ejemplo n.º 2
0
void *_policy_handle_find(struct pipes_struct *p,
                          const struct policy_handle *hnd,
                          uint32_t access_required,
                          uint32_t *paccess_granted,
                          const char *name, const char *location,
                          NTSTATUS *pstatus)
{
    struct policy *pol;
    void *data;

    pol = find_policy_by_hnd_internal(p, hnd, &data);
    if (pol == NULL) {
        *pstatus = NT_STATUS_INVALID_HANDLE;
        return NULL;
    }
    if (strcmp(name, talloc_get_name(data)) != 0) {
        DEBUG(10, ("expected %s, got %s\n", name,
                   talloc_get_name(data)));
        *pstatus = NT_STATUS_INVALID_HANDLE;
        return NULL;
    }
    if ((access_required & pol->access_granted) != access_required) {
        if (geteuid() == sec_initial_uid()) {
            DEBUG(4, ("%s: ACCESS should be DENIED (granted: "
                      "%#010x; required: %#010x)\n", location,
                      pol->access_granted, access_required));
            DEBUGADD(4,("but overwritten by euid == 0\n"));
            goto okay;
        }
        DEBUG(2,("%s: ACCESS DENIED (granted: %#010x; required: "
                 "%#010x)\n", location, pol->access_granted,
                 access_required));
        *pstatus = NT_STATUS_ACCESS_DENIED;
        return NULL;
    }

okay:
    DEBUG(10, ("found handle of type %s\n", talloc_get_name(data)));
    if (paccess_granted != NULL) {
        *paccess_granted = pol->access_granted;
    }
    *pstatus = NT_STATUS_OK;
    return data;
}
Ejemplo n.º 3
0
bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd)
{
	struct policy *pol = find_policy_by_hnd_internal(p, hnd, NULL);

	if (!pol) {
		DEBUG(3,("Error closing policy\n"));
		return False;
	}

	DEBUG(3,("Closed policy\n"));

	p->pipe_handles->count--;

	DLIST_REMOVE(p->pipe_handles->Policy, pol);

	TALLOC_FREE(pol);

	return True;
}
Ejemplo n.º 4
0
bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd)
{
	struct dcesrv_handle *rpc_hnd;

	rpc_hnd = find_policy_by_hnd_internal(p, hnd, NULL);

	if (rpc_hnd == NULL) {
		DEBUG(3, ("Error closing policy (policy not found)\n"));
		return false;
	}

	DEBUG(6,("Closed policy\n"));

	p->pipe_handles->count--;

	DLIST_REMOVE(p->pipe_handles->handles, rpc_hnd);
	TALLOC_FREE(rpc_hnd);

	return true;
}
Ejemplo n.º 5
0
BOOL close_policy_hnd(pipes_struct *p, POLICY_HND *hnd)
{
	struct policy *pol = find_policy_by_hnd_internal(p, hnd, NULL);

	if (!pol) {
		DEBUG(3,("Error closing policy\n"));
		return False;
	}

	DEBUG(3,("Closed policy\n"));

	if (pol->free_fn && pol->data_ptr)
		(*pol->free_fn)(pol->data_ptr);

	p->pipe_handles->count--;

	DLIST_REMOVE(p->pipe_handles->Policy, pol);

	ZERO_STRUCTP(pol);

	SAFE_FREE(pol);

	return True;
}
Ejemplo n.º 6
0
BOOL find_policy_by_hnd(pipes_struct *p, POLICY_HND *hnd, void **data_p)
{
	return find_policy_by_hnd_internal(p, hnd, data_p) == NULL ? False : True;
}
Ejemplo n.º 7
0
bool find_policy_by_hnd(pipes_struct *p, struct policy_handle *hnd, void **data_p)
{
	return find_policy_by_hnd_internal(p, hnd, data_p) == NULL ? False : True;
}