| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * $Id* |
| 4 | * |
| 5 | * Main header file for `become' |
| 6 | * |
| 7 | * (c) 1998 EBI |
| 8 | */ |
| 9 | |
| 10 | /*----- Licensing notice --------------------------------------------------* |
| 11 | * |
| 12 | * This file is part of `become' |
| 13 | * |
| 14 | * `Become' is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License as published by |
| 16 | * the Free Software Foundation; either version 2 of the License, or |
| 17 | * (at your option) any later version. |
| 18 | * |
| 19 | * `Become' is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | * GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License |
| 25 | * along with `become'; if not, write to the Free Software Foundation, |
| 26 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 27 | */ |
| 28 | |
| 29 | #ifndef BECOME_H |
| 30 | #define BECOME_H |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | /*----- Required headers --------------------------------------------------*/ |
| 37 | |
| 38 | #include <sys/types.h> |
| 39 | #include <sys/socket.h> |
| 40 | #include <netinet/in.h> |
| 41 | #include <arpa/inet.h> |
| 42 | |
| 43 | #ifndef CONFIG_H |
| 44 | # include "config.h" |
| 45 | #endif |
| 46 | |
| 47 | /*----- Other configuration -----------------------------------------------*/ |
| 48 | |
| 49 | #define file_KEY ETCDIR "/become.key" |
| 50 | #define file_PUBKEY ETCDIR "/become.pubkey" |
| 51 | #define file_RULES ETCDIR "/become.conf" |
| 52 | #define file_SERVER ETCDIR "/become.server" |
| 53 | |
| 54 | #ifdef NDEBUG |
| 55 | # define D(x) /* empty */ |
| 56 | #else |
| 57 | # define D(x) x |
| 58 | #endif |
| 59 | |
| 60 | /*----- Tracing levels ----------------------------------------------------*/ |
| 61 | |
| 62 | #define TRACE_SILENT 0u |
| 63 | #define TRACE_MISC 1u |
| 64 | #define TRACE_SETUP 2u |
| 65 | #define TRACE_RULE 4u |
| 66 | #ifndef NONETWORK |
| 67 | # define TRACE_DAEMON 8u |
| 68 | # define TRACE_CHECK 16u |
| 69 | # define TRACE_CLIENT 32u |
| 70 | # define TRACE_RAND 64u |
| 71 | # define TRACE_CRYPTO 128u |
| 72 | #else |
| 73 | # define TRACE_DAEMON 0 |
| 74 | # define TRACE_CHECK 0 |
| 75 | # define TRACE_CLIENT 0 |
| 76 | # define TRACE_RAND 0 |
| 77 | # define TRACE_CRYPTO 0 |
| 78 | #endif |
| 79 | #define TRACE_YACC 256u |
| 80 | #define TRACE_DEBUG 512u |
| 81 | |
| 82 | #define TRACE_PRIV ( TRACE_RAND | TRACE_CRYPTO | TRACE_YACC | \ |
| 83 | TRACE_DEBUG ) |
| 84 | #define TRACE_DFL ( TRACE_MISC | TRACE_SETUP | TRACE_CLIENT | \ |
| 85 | TRACE_DAEMON | TRACE_CHECK ) |
| 86 | #define TRACE_ALL 0xFFFFu |
| 87 | |
| 88 | /*----- Other magic constants ---------------------------------------------*/ |
| 89 | |
| 90 | #define SERVER_PORT 35523 /* Not allocated properly */ |
| 91 | |
| 92 | /*----- Type definitions --------------------------------------------------*/ |
| 93 | |
| 94 | /* --- Request buffer (plaintext) --- */ |
| 95 | |
| 96 | #define CMDLEN_MAX 1016 /* Max length of command */ |
| 97 | |
| 98 | typedef struct request { |
| 99 | struct in_addr host; /* Requesting host */ |
| 100 | uid_t from; /* Current user ID */ |
| 101 | uid_t to; /* Requested UID */ |
| 102 | char cmd[CMDLEN_MAX]; /* Command string requested */ |
| 103 | } request; |
| 104 | |
| 105 | /*----- That's all, folks -------------------------------------------------*/ |
| 106 | |
| 107 | #ifdef __cplusplus |
| 108 | } |
| 109 | #endif |
| 110 | |
| 111 | #endif |