From owner-freebsd-bugs Tue Dec 10 8: 0:11 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB6B537B401 for ; Tue, 10 Dec 2002 08:00:09 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1673943EB2 for ; Tue, 10 Dec 2002 08:00:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBAG08x3045374 for ; Tue, 10 Dec 2002 08:00:08 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBAG08M5045373; Tue, 10 Dec 2002 08:00:08 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 55B3737B401 for ; Tue, 10 Dec 2002 07:56:57 -0800 (PST) Received: from itesec.hsc.fr (itesec.hsc.fr [192.70.106.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 597B743EC5 for ; Tue, 10 Dec 2002 07:56:56 -0800 (PST) (envelope-from Alain.Thivillon@hsc.fr) Received: from khany.hsc.fr (khany.hsc.fr [192.70.106.104]) by itesec.hsc.fr (Postfix) with ESMTP id CC5F720FF4; Tue, 10 Dec 2002 16:56:54 +0100 (CET) Received: by khany.hsc.fr (Postfix, from userid 1000) id 51199F6A68; Tue, 10 Dec 2002 16:56:58 +0100 (CET) Message-Id: <20021210155658.51199F6A68@khany.hsc.fr> Date: Tue, 10 Dec 2002 16:56:58 +0100 (CET) From: Alain Thivillon Reply-To: Alain Thivillon To: FreeBSD-gnats-submit@FreeBSD.org Cc: at@rominet.net, roberto@keltia.freenix.org X-Send-Pr-Version: 3.113 Subject: bin/46165: call to getsockopt in libc/gen/getpeerid is bogus Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46165 >Category: bin >Synopsis: call to getsockopt in libc/gen/getpeerid is bogus >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 10 08:00:07 PST 2002 >Closed-Date: >Last-Modified: >Originator: Alain Thivillon >Release: FreeBSD 4.7-RELEASE-p2 i386 >Organization: Rominet Networks >Environment: System: FreeBSD khany.hsc.fr 4.7-RELEASE-p2 FreeBSD 4.7-RELEASE-p2 #1: Sat Nov 30 14:37:59 CET 2002 at@khany.hsc.fr:/usr/obj/usr/src/sys/KHANY i386 >Description: call to getsockopt in libc/gen/getpeerid to get Unix Dgram socket caller credentials is wrong. Option name LOCAL_PEERCRED is passed in second argument instead of third. As LOCAL_PEERCRED == SOCK_STREAM == 1, this bug has no influence. However, this is the only one usage of LOCAL_PEERCRED in /usr/src, this can seriously impact mental health of programmers looking for an example ... >How-To-Repeat: Read code and documentation (getsockopt(2) and unix(4) on the same screen. >Fix: --- src/lib/libc/gen/getpeereid.c.orig Sat Mar 9 06:23:56 2002 +++ src/lib/libc/gen/getpeereid.c Tue Dec 10 16:49:00 2002 @@ -43,7 +43,7 @@ int error; xuclen = sizeof(xuc); - error = getsockopt(s, LOCAL_PEERCRED, 1, &xuc, &xuclen); + error = getsockopt(s, SOCK_STREAM, LOCAL_PEERCRED, &xuc, &xuclen); if (error != 0) return (error); if (xuc.cr_version != XUCRED_VERSION) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message