mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-16 01:42:56 +08:00
Disable user credentials and use default values
This commit is contained in:
@@ -140,6 +140,12 @@ void rtems_bsd_assert_func(const char *file, int line, const char *func, const c
|
||||
|
||||
#define BSD_DEFAULT_PID 0
|
||||
|
||||
#define BSD_DEFAULT_UID 0
|
||||
|
||||
#define BSD_DEFAULT_GID 0
|
||||
|
||||
#define BSD_DEFAULT_PRISON (&prison0)
|
||||
|
||||
extern rtems_chain_control rtems_bsd_lock_chain;
|
||||
|
||||
extern rtems_chain_control rtems_bsd_mtx_chain;
|
||||
|
@@ -114,7 +114,7 @@ int
|
||||
prison_flag(struct ucred *cred, unsigned flag)
|
||||
{
|
||||
/* This is an atomic read, so no locking is necessary. */
|
||||
return (cred->cr_prison->pr_flags & flag);
|
||||
return (prison0.pr_flags & flag);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -154,15 +154,6 @@ prison_saddrsel_ip6(struct ucred *cred, struct in6_addr *ia6)
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if pr1 and pr2 have the same IPv4 address restrictions.
|
||||
*/
|
||||
int
|
||||
prison_equal_ip4(struct prison *pr1, struct prison *pr2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if given address belongs to the jail referenced by cred/prison.
|
||||
*
|
||||
@@ -213,15 +204,6 @@ prison_remote_ip4(struct ucred *cred, struct in_addr *ia)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if pr1 and pr2 have the same IPv6 address restrictions.
|
||||
*/
|
||||
int
|
||||
prison_equal_ip6(struct prison *pr1, struct prison *pr2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure our (source) address is set to something meaningful to this jail.
|
||||
*
|
||||
|
@@ -48,26 +48,12 @@
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/filedesc.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/resourcevar.h>
|
||||
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#include <rtems/score/objectimpl.h>
|
||||
|
||||
RTEMS_CHAIN_DEFINE_EMPTY(rtems_bsd_thread_chain);
|
||||
|
||||
/* FIXME: What to do with the credentials? */
|
||||
static struct ucred FIXME_ucred = {
|
||||
.cr_ref = 1 /* reference count */
|
||||
};
|
||||
static struct proc FIXME_proc = {
|
||||
.p_ucred = NULL /* (c) Process owner's identity. */
|
||||
};
|
||||
static struct prison FIXME_prison = {
|
||||
.pr_parent = NULL
|
||||
};
|
||||
|
||||
static size_t rtems_bsd_extension_index;
|
||||
|
||||
struct thread *
|
||||
@@ -108,7 +94,6 @@ rtems_bsd_thread_create(Thread_Control *thread, int wait)
|
||||
|
||||
if (td != NULL) {
|
||||
td->td_thread = thread;
|
||||
td->td_proc = &FIXME_proc;
|
||||
}
|
||||
|
||||
thread->extensions[rtems_bsd_extension_index] = td;
|
||||
@@ -207,15 +192,6 @@ rtems_bsd_threads_init(void *arg __unused)
|
||||
}
|
||||
|
||||
rtems_bsd_extension_index = rtems_object_id_get_index(ext_id);
|
||||
|
||||
mtx_init(&FIXME_prison.pr_mtx, "prison lock", NULL, MTX_DEF | MTX_DUPOK);
|
||||
|
||||
FIXME_ucred.cr_prison = &FIXME_prison; /* jail(2) */
|
||||
FIXME_ucred.cr_uidinfo = uifind(0);
|
||||
FIXME_ucred.cr_ruidinfo = uifind(0);
|
||||
FIXME_ucred.cr_ngroups = 1; /* group 0 */
|
||||
|
||||
FIXME_proc.p_ucred = crhold(&FIXME_ucred);
|
||||
}
|
||||
|
||||
SYSINIT(rtems_bsd_threads, SI_SUB_INTRINSIC, SI_ORDER_ANY, rtems_bsd_threads_init, NULL);
|
||||
|
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup rtems_bsd_rtems
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 On-Line Applications Research Corporation (OAR).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/rtems-bsd-config.h>
|
||||
|
||||
#include <rtems/bsd/sys/param.h>
|
||||
#include <rtems/bsd/sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/resourcevar.h>
|
||||
|
||||
struct ucred *rtems_bsd_thread0_ucred;
|
||||
|
||||
static void rtems_bsd_thread0_ucred_init(void *arg)
|
||||
{
|
||||
rtems_bsd_thread0_ucred = crget();
|
||||
rtems_bsd_thread0_ucred->cr_ngroups = 1; /* group 0 */
|
||||
rtems_bsd_thread0_ucred->cr_uidinfo = uifind(0);
|
||||
rtems_bsd_thread0_ucred->cr_prison = &prison0;
|
||||
}
|
||||
|
||||
SYSINIT(cpu, SI_SUB_INTRINSIC, SI_ORDER_SECOND, rtems_bsd_thread0_ucred_init, NULL);
|
Reference in New Issue
Block a user