From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 17 16:31:35 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C3B8A16A41C for ; Fri, 17 Jun 2005 16:31:35 +0000 (GMT) (envelope-from french.linuxian@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DFF643D1F for ; Fri, 17 Jun 2005 16:31:35 +0000 (GMT) (envelope-from french.linuxian@gmail.com) Received: by zproxy.gmail.com with SMTP id 12so448428nzp for ; Fri, 17 Jun 2005 09:31:34 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Pcir6XAyjyVvJ4H8MeIn09mEw4sidguAaSXvjkkfOcCj24tKWwddrmXrM6ajq5fRZhsd6aISTiQ1wm2H27C/EqcmFxWBYl5qiZaKUUT7pTq2MEgQLxZVxxWfCk+lW4Z3FsAVhW5PvU31sR+dCXAIMKE8gvKjpP6wERlGM7r4nh8= Received: by 10.36.61.12 with SMTP id j12mr1454692nza; Fri, 17 Jun 2005 09:31:34 -0700 (PDT) Received: by 10.36.57.3 with HTTP; Fri, 17 Jun 2005 09:31:34 -0700 (PDT) Message-ID: <3727392705061709318b9346f@mail.gmail.com> Date: Fri, 17 Jun 2005 12:31:34 -0400 From: Aziz Kezzou To: freebsd-hackers Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: How to check root powers on a struct proc ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Aziz Kezzou List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2005 16:31:35 -0000 Hi all, I am trying to check that a process (struct proc) has root powers when it calls my KLD system call. I know from kern_jail.c that I can use suser() but this function takes a struct thread* instead of struct proc* although the credentials (struct ucred *p_ucred;) are stored in proc ! Is there an esay way to get a struct thread* from a struct proc* ? or should I simply use the function: int suser_cred(struct ucred *cred, int flag); with cred =3D p-> p_ucred BTW what would the value of flag be? Thanks, -aziz