1c39934eaSBrian Somers /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 31de7b4b8SPedro F. Giffuni * 4c39934eaSBrian Somers * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 5c39934eaSBrian Somers * All rights reserved. 6c39934eaSBrian Somers * 7c39934eaSBrian Somers * Redistribution and use in source and binary forms, with or without 8c39934eaSBrian Somers * modification, are permitted provided that the following conditions 9c39934eaSBrian Somers * are met: 10c39934eaSBrian Somers * 1. Redistributions of source code must retain the above copyright 11c39934eaSBrian Somers * notice, this list of conditions and the following disclaimer. 12c39934eaSBrian Somers * 2. Redistributions in binary form must reproduce the above copyright 13c39934eaSBrian Somers * notice, this list of conditions and the following disclaimer in the 14c39934eaSBrian Somers * documentation and/or other materials provided with the distribution. 15c39934eaSBrian Somers * 16c39934eaSBrian Somers * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17c39934eaSBrian Somers * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18c39934eaSBrian Somers * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19c39934eaSBrian Somers * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20c39934eaSBrian Somers * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21c39934eaSBrian Somers * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22c39934eaSBrian Somers * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23c39934eaSBrian Somers * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24c39934eaSBrian Somers * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25c39934eaSBrian Somers * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26c39934eaSBrian Somers * SUCH DAMAGE. 275106c671SBrian Somers */ 285106c671SBrian Somers 2968602c3eSBrian Somers #ifndef NOSUID 30adc17f0aSEd Schouten struct utmpx; 311fa665f5SBrian Somers struct sockaddr_un; 3245ad566fSBrian Somers 335106c671SBrian Somers extern void ID0init(void); 345106c671SBrian Somers extern uid_t ID0realuid(void); 355106c671SBrian Somers extern int ID0ioctl(int, unsigned long, void *); 365106c671SBrian Somers extern int ID0unlink(const char *); 375106c671SBrian Somers extern int ID0socket(int, int, int); 385106c671SBrian Somers extern FILE *ID0fopen(const char *, const char *); 393edeb0c6SBrian Somers extern int ID0open(const char *, int, ...); 40de7453bbSBrian Somers extern int ID0write(int, const void *, size_t); 415106c671SBrian Somers extern int ID0uu_lock(const char *); 4285fd273aSBrian Somers extern int ID0uu_lock_txfr(const char *, pid_t); 435106c671SBrian Somers extern int ID0uu_unlock(const char *); 44adc17f0aSEd Schouten extern void ID0login(const struct utmpx *); 45adc17f0aSEd Schouten extern void ID0logout(const struct utmpx *); 466f384573SBrian Somers extern int ID0bind_un(int, const struct sockaddr_un *); 476f384573SBrian Somers extern int ID0connect_un(int, const struct sockaddr_un *); 488e7b8599SBrian Somers extern int ID0kill(pid_t, int); 49fdb4bb1bSBrian Somers #if defined(__FreeBSD__) && !defined(NOKLDLOAD) 50fc3034caSBrian Somers extern int ID0kldload(const char *); 51fc3034caSBrian Somers #endif 5231dd45c4SBrian Somers #ifndef NONETGRAPH 5331dd45c4SBrian Somers extern int ID0NgMkSockNode(const char *, int *, int *); 5431dd45c4SBrian Somers #endif 5568602c3eSBrian Somers #else /* NOSUID */ 5668602c3eSBrian Somers #define ID0init() 5768602c3eSBrian Somers #define ID0realuid() (0) 5868602c3eSBrian Somers #define ID0ioctl ioctl 5968602c3eSBrian Somers #define ID0unlink unlink 6068602c3eSBrian Somers #define ID0socket socket 6168602c3eSBrian Somers #define ID0fopen fopen 6268602c3eSBrian Somers #define ID0open open 6368602c3eSBrian Somers #define ID0write write 6468602c3eSBrian Somers #define ID0uu_lock uu_lock 6568602c3eSBrian Somers #define ID0uu_lock_txfr uu_lock_txfr 6668602c3eSBrian Somers #define ID0uu_unlock uu_unlock 67adc17f0aSEd Schouten #define ID0login pututxline 68adc17f0aSEd Schouten #define ID0logout pututxline 6968602c3eSBrian Somers #define ID0bind_un(s, n) bind(s, (const struct sockaddr *)(n), sizeof *(n)) 7068602c3eSBrian Somers #define ID0connect_un(s, n) \ 7168602c3eSBrian Somers connect(s, (const struct sockaddr *)(n), sizeof *(n)) 7268602c3eSBrian Somers #define ID0kill kill 7368602c3eSBrian Somers #if defined(__FreeBSD__) && !defined(NOKLDLOAD) 743b39173dSMarcel Moolenaar #include <sys/param.h> 753b39173dSMarcel Moolenaar #include <sys/linker.h> 7668602c3eSBrian Somers #define ID0kldload kldload 7768602c3eSBrian Somers #endif 7868602c3eSBrian Somers #ifndef NONETGRAPH 7968602c3eSBrian Somers #define ID0NgMkSockNode NgMkSockNode 8068602c3eSBrian Somers #endif 8168602c3eSBrian Somers #endif 82