From owner-freebsd-hackers@freebsd.org Thu Apr 15 19:22:09 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D3045D4203 for ; Thu, 15 Apr 2021 19:22:09 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FLq3N1xBdz4ldH for ; Thu, 15 Apr 2021 19:22:07 +0000 (UTC) (envelope-from 6yearold@gmail.com) Received: by mail-lf1-f43.google.com with SMTP id x19so10533634lfa.2 for ; Thu, 15 Apr 2021 12:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eDoNNBMepOhxExatUHtyCseZk1Z67rzwG1ipZZJ2MSo=; b=h3cWumtnek8rupTLfkkFhUz9UO5LcxPtzr+bHTsfWZ3Z+d+AR4B/mrv4W9d4zVLYdm Q0+hOxAaK9Q4NgOUw3vKt7J25eAlNtyqpgGQiSjTqmvzwIzUhbjvo4YwHOdb+mJpnrwG 9c5fohCIBnv0WS5AKpjxELNWenUYj4tKFF51sJOYCumtsMXqZxphSuyqoFXM/C9Ic4fZ 2KeIGvpxe2RwvUKUlRfTK3eJ0FSAf5nJJbfiwvQn7diu4v9eJR/tAQQspclGFJExcdPQ wQlN96YLGMGJRN++zbNqHSaeUV/pLeHFyTbYTSHay8SAKneS8EjxotvFIcy1bfLBhjkJ Rf3g== X-Gm-Message-State: AOAM531HgAFjtWSnyrKPvWUfZO/gVq/z9xUAV00Rt7h5XOkDfay2cS6Q yDQjULoxzpbKoYNzPY02eELMTUGcSN9/jg== X-Google-Smtp-Source: ABdhPJxWQFUShCaDBFmoSEoRRgo0BWFXZ5d5ngHcSm9j0V0Yoyzi9n2hHMr4RkhfJR/BnNOwFF7UvQ== X-Received: by 2002:a05:6512:3194:: with SMTP id i20mr474165lfe.266.1618514526047; Thu, 15 Apr 2021 12:22:06 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id j2sm763861lfe.100.2021.04.15.12.22.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Apr 2021 12:22:05 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id l14so25509706ljb.1 for ; Thu, 15 Apr 2021 12:22:05 -0700 (PDT) X-Received: by 2002:a2e:8881:: with SMTP id k1mr402521lji.441.1618514525733; Thu, 15 Apr 2021 12:22:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Gleb Popov Date: Thu, 15 Apr 2021 22:21:39 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ? To: Konstantin Belousov Cc: freebsd-hackers X-Rspamd-Queue-Id: 4FLq3N1xBdz4ldH X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of 6yearold@gmail.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=6yearold@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[arrowd@freebsd.org,6yearold@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; SUBJECT_ENDS_QUESTION(1.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.167.43:from]; R_DKIM_NA(0.00)[]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[arrowd@freebsd.org,6yearold@gmail.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.167.43:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.43:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.43:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 19:22:09 -0000 On Thu, Apr 15, 2021 at 10:16 PM Konstantin Belousov wrote: > You are calling getsockopt(2) in the listen socket, not on the connected > one. > Replace s with s2 in the call. > The `man unix ` says: The credentials presented to the server (the listen(2) caller) are those of the client when it called connect(2); the credentials presented to the client (the connect(2) caller) are those of the server when it called listen(2). This is what I actually want - to find out credentials of the connected user.