Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Unix{Datagram,Stream}::{set_}passcred() to per-OS traits #117156

Merged
merged 1 commit into from
Mar 11, 2024

Commits on Oct 25, 2023

  1. Convert Unix{Datagram,Stream}::{set_}passcred() to per-OS traits

    These methods are the pre-stabilized API for obtaining peer credentials
    from an `AF_UNIX` socket, part of the `unix_socket_ancillary_data` feature.
    
    Their current behavior is to get/set one of the `SO_PASSCRED` (Linux),
    `LOCAL_CREDS_PERSISTENT` (FreeBSD), or `LOCAL_CREDS` (NetBSD) socket
    options. On other targets the `{set_}passcred()` methods do not exist.
    
    There are two problems with this approach:
    
    1. Having public methods only exist for certain targets isn't permitted
       in a stable `std` API.
    
    2. These options have generally similar purposes, but they are non-POSIX
       and their details can differ in subtle and surprising ways (such as
       whether they continue to be set after the next call to `recvmsg()`).
    
    Splitting into OS-specific extension traits is the preferred solution to
    both problems.
    jmillikin committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    93f2f2c View commit details
    Browse the repository at this point in the history