├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── atov.c ├── autogen.sh ├── build-aux ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── missing └── ylwrap ├── config.h.in ├── configure ├── configure.ac ├── contrib ├── .gitignore ├── aix43 │ ├── README │ └── bos.adt.insttools │ │ └── usr │ │ ├── lpp │ │ └── bos │ │ │ └── README.MKINSTALLP │ │ └── sbin │ │ ├── makebff.pl │ │ └── mkinstallp ├── aix52 │ ├── .gitignore │ ├── mkpkg │ └── op.spec ├── audit │ ├── cppcheck.cfg │ ├── cppcheck.sh │ └── cpplint.sh ├── build │ ├── cleanall │ ├── mkaix43 │ ├── mkaix52 │ ├── mkhpux │ ├── mkrhel345 │ ├── mkrhel6 │ ├── mkrhel7 │ ├── mksunos │ └── mktar ├── hpux1100 │ ├── .gitignore │ ├── README │ ├── op.postinstall │ ├── op.postremove │ └── op.psf ├── hpux1111 │ ├── .gitignore │ ├── README │ ├── op.postinstall │ ├── op.postremove │ └── op.psf ├── linux │ ├── .gitignore │ └── op.spec ├── mkpkg └── solaris │ ├── .gitignore │ ├── RATPop.admin │ ├── README │ ├── pkginfo │ ├── postinstall │ └── prototype ├── defs.h ├── lex.c ├── lex.l ├── m4 ├── ax_append_compile_flags.m4 ├── ax_append_flag.m4 ├── ax_append_link_flags.m4 ├── ax_cflags_aix_option.m4 ├── ax_cflags_warn_all.m4 ├── ax_check_compile_flag.m4 ├── ax_check_link_flag.m4 ├── ax_compiler_flags.m4 ├── ax_compiler_flags_cflags.m4 ├── ax_compiler_flags_gir.m4 ├── ax_compiler_flags_ldflags.m4 ├── ax_compiler_vendor.m4 ├── ax_compiler_version.m4 ├── ax_is_release.m4 └── ax_require_defined.m4 ├── main.c ├── op.1 ├── op.conf ├── op.conf-dist ├── op.conf.complex ├── op.list.in ├── op.pam ├── op.paper ├── regexp.c ├── regexp.h ├── rplregex.c ├── rplregex.h ├── snprintf.c ├── strlcat.c ├── strlcpy.c ├── util.c └── yywrap.c /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.old 3 | *.tar.gz 4 | .*.swp 5 | .deps/ 6 | Makefile 7 | \[config.h].in 8 | audit/ 9 | autom4te.cache/ 10 | build/ 11 | config.cache 12 | config.h 13 | config.log 14 | config.status 15 | lex.c 16 | op 17 | op.list 18 | packages/ 19 | stamp-h1 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | compiler: gcc 4 | 5 | before_install: 6 | - sudo apt-get -qq update 7 | - sudo apt-get install -y xauth 8 | 9 | script: 10 | - ./configure --enable-xauth=/usr/bin/xauth && make 11 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Tom Christiansen + Dave Koblas (original authors) 2 | Howard Owen (maintainer from 1995 to 2002) 3 | Alec Thomas (current maintainer) 4 | Cyrille Lefevre (code auditing/hardening) 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 12 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 13 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 14 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 15 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 16 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 17 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 18 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 19 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 20 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 13/04/17 - op 1.34 2 | ================== 3 | * port to RHEL 7 4 | * https://travis-ci.org/ 5 | 6 | 16/04/16 - op 1.33 7 | ================== 8 | * code auditing using flawfinder, cppcheck, cpplint.py and scan-build. 9 | * Replaced strcpy/strcat by strlcpy/strlcat which are also provided if missing. 10 | * Provided v/snprintf if missing. 11 | * Replaced atoi by strtolong (util.c), atov still provided but unused. 12 | * contrib dir added for various building and packaging architectures 13 | (aix, hp-ux, linux, solaris). results goes to build and packages dirs. 14 | * autoconf-archive macros added to m4 dir to enhance autotools configuration 15 | such as compiler flags for hardening building. 16 | * automake scripts moves to build-aux dir. 17 | * Replaced v8 regexp by POSIX regex if possible. 18 | 19 | 08/12/05 - op 1.32 20 | ================== 21 | 22 | * Added rpl_malloc/rpl_realloc so that systems with dodgy implementations 23 | will link. This fixes compilation on HPUX, for example. 24 | * If a 'help' parameter does not exist, use the actual command to be run for 25 | the help. 26 | * Added detection for openlog() returning void. 27 | 28 | 01/09/05 - op 1.31 29 | ================== 30 | 31 | The biggest change is the move to the autotools. 32 | 33 | Broken down changes. 34 | 35 | * Trailing args are now expanded from the last numbered argument encountered. 36 | eg. with {{{/bin/echo $1 $*}}}, the {{{$*}}} will expand to arguments 2 and on. 37 | * Fixed usage of snprintf. 38 | * Renamed fowner to fowners to be more consistent with the rest of the op commands. 39 | * Fixed long standing bug where the incorrect user is reported in the logs. 40 | * Added fperms and fowner constraints thanks to Pierre. 41 | * Logging beautification. 42 | * More automake/autoconf additions and cleanup. 43 | * Cleaned up ChangeLog, README, AUTHORS and NEWS. 44 | * Added man page. 45 | * Merged autoconf branch into trunk. 46 | * Fixed build errors on AIX reported by Pierre. 47 | * {{{make clean}}} cleans up {{{lex.c}}}. 48 | * Some configure fixes for crypt and pam fallback. 49 | * Added --with-shadow. 50 | * Added patch from Pierre that automatically reduces commands in the form "op 51 | /bin/ksh" to "op ksh" if the target is a valid executable. Convenience only. 52 | * Added a log prettification patch from Pierre. Also removed "=>" as it was 53 | ugly. This may break log parsers. 54 | * Added xauth support back in with {{{--enable-xauth=}}}. 55 | 56 | 57 | 27/05/05 - op 1.30 58 | ================== 59 | Fixed use of DEFAULT section, closes #5. Quite a pain in the arse actually. 60 | 61 | Environment variables can now be propagated into child environments even when 62 | "environment" is specified. This will override any existing variables. 63 | 64 | Now using vsnprintf rather than snprintf. Correspondingly, changed preprocessor 65 | define which may mean build scripts need to be changed. 66 | 67 | Added an INSTALL file documenting the usual installation instructions. 68 | 69 | Default to using Flex, as Lex has internal constraints. 70 | 71 | Added default op.pam which is now installed if /etc/pam.d exists. 72 | 73 | Added patches by Pierre fixing strnprintf issues and a wildcard constraint bug. 74 | Thanks Pierre. 75 | 76 | 08/04/05 - op 1.29 77 | ================== 78 | Added -l argument which lists available commands. 79 | 80 | Also added a {{{help=""}}} option which defines the help string displayed 81 | by -l. 82 | 83 | Cleaned up the code a bit, adding some basic dynamic array functions instead of 84 | replicating the code across multiple areas. 85 | 86 | Closes #4 87 | 88 | 07/04/05 - op 1.27/1.28 89 | ================== 90 | Added ''nolog'' option which suppresses informational logs. Useful for 91 | automated jobs to prevent log spam. 92 | 93 | Configuration files in /etc/op.d are now lexically sorted. This allows 94 | variables in configuration files to be used deterministically. Commands 95 | can also be overridden in this fashion. 96 | 97 | 07/04/05 - op 1.26 98 | ================== 99 | op will now read all config files in /etc/op.d with a .conf extension. This is 100 | a clean way of adding extra commands without having to manipulate op.conf. 101 | op.conf does not have to be present at all. Useful for dropping in op config 102 | with other packages or when adding config to systems in bulk. Thanks to Kyle 103 | Hyland for this idea. 104 | 105 | Also made error reporting a bit smarter when config files are missing or have 106 | incorrect permissions. 107 | 108 | 06/07/04 - op 1.24 109 | ================== 110 | The xauth directive can now be given a target user, into whose environment the 111 | X authentication information is imported. 112 | 113 | 04/05/04 - op 1.23 114 | ================== 115 | The xauth modifier now updates $XAUTHORITY in the child environment. 116 | Fixed a bug when setting the GID explicitly. 117 | 118 | 03/05/04 - op 1.22 119 | ================== 120 | Added xauth support. This allows the X authority for the current display to be 121 | exported to the destination users X authority database. eg. 122 | 123 | shell /bin/su -; users=athomas $TERM xauth password 124 | 125 | To enable xauth support, the preprocessor macro XAUTH must be defined as 126 | a string pointing to the FULL PATH to the xauth binary. 127 | 128 | 23/04/04 - op 1.21 129 | ================== 130 | Added netgroup support. eg. 131 | 132 | shell /bin/su -; netgroup=op-shell environment 133 | 134 | This is very useful in conjunction with either LDAP or NIS based netgroups. 135 | 136 | 02/02/04 - op 1.20 137 | ================== 138 | Fixed a fairly major bug whereby blocked signals were not restored to their 139 | original state upon execv'ing the child process. 140 | 141 | Changed version number scheme to match the original op versions, and bumped up 142 | to 1.20. This is part of a collaborative effort between myself and Steve 143 | Simmons, who is going to add Kerberos support to op in the near future. Welcome 144 | Steve. 145 | 146 | 27/01/04 - op 1.1.10 147 | ==================== 148 | Applied some of the FreeBSD patches, thanks to Cyrille Lefevre (the previous 149 | FreeBSD port maintainer) for pointing me to these. 150 | Patched a potential buffer overflow, again, picked up by Cyrille. 151 | Added lots of checks for allocation failures. 152 | Added constraints to as many uses of strcpy/strcat as I could find. 153 | Added constraint on number of simultaneous groups a user can be in. 154 | 155 | 24/01/04 - op 1.1.9 156 | =================== 157 | Trapping signals (SIGINT, etc.) so that a failed authentication attempt can not 158 | be broken out of. 159 | 160 | 06/11/03 - op 1.1.8 161 | =================== 162 | Fixed a fairly substantial bug where command arguments with multiple variables 163 | were not being expanded at all. 164 | 165 | 28/10/03 - op 1.1.7 166 | =================== 167 | Logging now uses auth.level, and level is actually useful. 168 | 169 | 22/07/03 - op 1.1.6 170 | =================== 171 | Added PAM support. 172 | 173 | April 17th 2003 - op 1.1.5 174 | ========================== 175 | Added extensive logging to op. All logging is sent to syslog as auth.notice. 176 | 177 | April 16th 2003 - op 1.1.4 178 | ========================== 179 | Added basic quoted argument passing to exec commands. This allows for complex 180 | shell scripts: 181 | 182 | inetd /bin/sh -c ' 183 | case $1 in 184 | on) /usr/sbin/inetd -s ;; 185 | off) /usr/bin/pkill inetd ;; 186 | esac 187 | '; 188 | users=ROOTUSERS 189 | $1=on|off 190 | 191 | April 10th 2003 - op 1.1.3 192 | ========================== 193 | Added a max length arugment to GetField to help prevent buffer overflows. 194 | Regular expressions always have ^ prepended and $ appended so that if you put 195 | 'a' in an rx field it will not match any string with an 'a'. Old behaviour can 196 | be emulated with '.*a.*'. 197 | Added expiration support to users (user[@host][/expiry]). 198 | 199 | September 13th 2002 - op 1.1.2 200 | ============================== 201 | Added user@host and group@host based access as well as variable expansion. 202 | Changed SHADOW to USE_SHADOW so it doesn't conflict with system defines. 203 | 204 | November 22nd 1997 - op 1.1.1 205 | =============================== 206 | Break shadow support out from Solaris support. Added SHADOW symbol to the 207 | build. It works on Linux 2.0.30. Presumably it still works on Solaris. 8) 208 | 209 | Cleaned up logging code. It was an uncomfortable mess. Slimmed it down some. 210 | 211 | Historical ChangeLog entries below 212 | ================================== 213 | Dave Koblas added the keyword "password" to the list of options 214 | accepted by op. This requires the user to supply op with a password 215 | before executing the command. The password can be specified in the 216 | op.access file (with "password=") or the user's personal password may 217 | be required. 218 | 219 | Howard Owen added the keyword "securid" to the list of options 220 | accepted by op. This functions similarly to the "password" option, 221 | requiring the user to supply op with his or her current SecurID code before 222 | executing the command. If op is compiled without SecurID support, use 223 | of this option in op.access will result in an error message and a 224 | refusal to execute the corresponding command. 225 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | bin_PROGRAMS=op 4 | op_SOURCES=defs.h lex.l main.c regexp.c regexp.h util.c \ 5 | snprintf.c strlcat.c strlcpy.c yywrap.c rplregex.c rplregex.h 6 | man_MANS=op.1 7 | EXTRA_DIST=op.conf op.conf.complex op.list.in op.pam op.paper op.1 \ 8 | op.conf-dist autogen.sh contrib m4 9 | #README 10 | 11 | EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@ 12 | AM_CPPFLAGS = $(EXTRA_CPPFLAGS) $(WARN_CFLAGS) -DSYSCONFDIR=\"$(sysconfdir)\" 13 | 14 | EXTRA_CFLAGS = @EXTRA_CFLAGS@ 15 | AM_CFLAGS = $(EXTRA_CFLAGS) 16 | 17 | EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ 18 | AM_LDFLAGS = $(EXTRA_LDFLAGS) $(WARN_LDFLAGS) 19 | 20 | install-exec-local: op.conf-dist 21 | chmod 4755 $(DESTDIR)$(bindir)/op 22 | test -d $(DESTDIR)$(sysconfdir) || \ 23 | $(INSTALL) -d -m 755 $(DESTDIR)$(sysconfdir) 24 | test -d $(DESTDIR)$(sysconfdir)/op.d || \ 25 | $(INSTALL) -d -m 700 $(DESTDIR)$(sysconfdir)/op.d 26 | $(INSTALL) -m 600 op.conf-dist $(DESTDIR)$(sysconfdir)/op.conf-dist 27 | test -f $(DESTDIR)$(sysconfdir)/op.conf || \ 28 | $(INSTALL) -m 600 op.conf-dist $(DESTDIR)$(sysconfdir)/op.conf 29 | 30 | clobber: clean 31 | rm -f lex.c 32 | 33 | cleanall: 34 | rm -rf build 35 | rm -rf contrib/aix??/op/op/build contrib/aix??/op/op/op.template 36 | rm -rf contrib/hpux????/usr 37 | rm -rf contrib/solaris/RATPop contrib/solaris/usr 38 | 39 | clobberall: 40 | rm -rf packages 41 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | No news is good news. 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 2 | 3 | This document is largely out of date, but left for historical interest. 4 | 5 | Alec Thomas, 08/06/2005 6 | 7 | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 8 | 9 | Op is a tool for allowing users to run root privileged commands 10 | without the root password. It is described in detail in "Op: A Flexible 11 | Tool for Restricted Superuser Access" by Tom Christiansen. From this 12 | description Dave Koblas produced an impementation of op in C. Tom's 13 | original paper is included in this distribution in the file 14 | "op.paper". Differences between that design and the current 15 | implementation are noted in the file "op.changes". 16 | 17 | I first came into contact with op at Octel in 1992. Over the years I 18 | added a couple of things, and ported it to architectures Octel cared 19 | about. Those included SunOS 4.1.x, Solaris 2.2 and greater, AIX, 20 | HP-UX 9.x, BSDI 1.1 and Linux 1.x. I added support for SecurID access 21 | control from Security Dynamics. This particular code has only been 22 | tested under SunOS and Solaris. I also enhanced the syslog stuff so it 23 | would log the command parameters that op executes as well as the 24 | command name. Support for Solaris shadow passwords was also added. 25 | 26 | I left Octel in 1996, and payed little attention to op for over a 27 | year. Recently, I had a need for op on Linux 2.0. I had to tweak the 28 | shadow password implementation to get it to work. while I was at it I 29 | cleaned up some of the logging code. It seems to work quite well on 30 | Linux. I've tried hard not to break other platforms with my mods, so 31 | they probably still work too. 8).I will test this code on any platform 32 | I need to use it on. If you have ported or built this code on other 33 | platforms, I'd like to hear from you. You can reach me via email at 34 | hbo@egbok.com. I'll try to help out with bugs time permitting. 35 | 36 | 37 | **** Disclaimer **** 38 | 39 | This code has been extensively tested only on the Sun 40 | architectures. We have noticed no egregious bugs on those platforms, 41 | but that's no guarantee such bugs don't exist. That goes double for 42 | the non-Sun architectures where testing has involved building, 43 | installing and running "op sh" once or twice. 44 | 45 | To build op, edit defs.h to point OP_ACCESS at the full pathname of 46 | your op.access file. You can study the sample file included with the 47 | distribution to get an idea of its semantics. Next, edit the Makefile 48 | and remove comments from the lines appropriate to your 49 | architecture. 50 | 51 | If you have shadow passwords, define the USE_SHADOW symbol to build in 52 | Solaris style shadow support. This also works on Linux 2.0.30. Shadow 53 | passwords on other architectures have not been tested and are not 54 | supported. If you successfully port op to another platform's shadow 55 | password implementation, send me the diffs, and I'll try to roll them 56 | into the main distribution. 57 | 58 | If you have the Security Dynamics ACE server software, 59 | uncomment the lines pertaining to SECURID. Define SECURIDLIBDIR and 60 | SECURIDINC to point at where the sdiclient library, and the ACE 61 | header files live respectively. The keyword "securid" in op.access 62 | will enable the client code. Each host that runs op in this mode must 63 | be configured as a client in the ACE server's database. 64 | 65 | After that, a simple make in the source directory should build op. To 66 | test op, the executable must be setuid root, and the op.access file 67 | must reside at the place OP_ACCESS points to. 68 | 69 | I'm grateful to Tom Christiansen and Dave Koblas for the original 70 | design and implementation of op. I'm also grateful to all those folks 71 | who, like Tom and Dave, have made my life easier by giving away 72 | marvelous, useful source code. I'm happy to give a little bit back, at 73 | long last. 74 | 75 | /* +-------------------------------------------------------------------+ */ 76 | /* | Copyright 1991, David Koblas. | */ 77 | /* | Permission to use, copy, modify, and distribute this software | */ 78 | /* | and its documentation for any purpose and without fee is hereby | */ 79 | /* | granted, provided that the above copyright notice appear in all | */ 80 | /* | copies and that both that copyright notice and this permission | */ 81 | /* | notice appear in supporting documentation. This software is | */ 82 | /* | provided "as is" without express or implied warranty. | */ 83 | /* +-------------------------------------------------------------------+ */ 84 | 85 | Ditto for my contributions which are Copyright (C) 1995, 1997 by 86 | Howard Owen. (hbo@egbok.com) 87 | 88 | And again for contributions by me, Alec Thomas (alec@swapoff.org), 89 | Copyright (C) 2002-2005. 90 | 91 | -------------------------------------------------------------------------------- /atov.c: -------------------------------------------------------------------------------- 1 | /* +-------------------------------------------------------------------+ */ 2 | /* | Copyright 1988,1991, David Koblas. | */ 3 | /* | Permission to use, copy, modify, and distribute this software | */ 4 | /* | and its documentation for any purpose and without fee is hereby | */ 5 | /* | granted, provided that the above copyright notice appear in all | */ 6 | /* | copies and that both that copyright notice and this permission | */ 7 | /* | notice appear in supporting documentation. This software is | */ 8 | /* | provided "as is" without express or implied warranty. | */ 9 | /* +-------------------------------------------------------------------+ */ 10 | 11 | #include 12 | #include 13 | 14 | #ifdef TEST 15 | int 16 | main(argc, argv) 17 | int argc; 18 | char **argv; 19 | { 20 | int i; 21 | for (i = 1; i < argc; i++) 22 | printf("%10s == %d\n", argv[i], atov(argv[i], 0)); 23 | } 24 | #endif 25 | 26 | int 27 | atov(char *str, int type) 28 | { 29 | int sign = 1; 30 | int i; 31 | char c; 32 | int val = 0, n; 33 | 34 | i = 0; 35 | while ((str[i] == ' ') || (str[i] == '\t')) 36 | i++; 37 | if (str[i] == '-') { 38 | sign = -1; 39 | i++; 40 | } else if (str[i] == '+') { 41 | sign = 1; 42 | i++; 43 | } 44 | if (type == 0) { 45 | if (str[i] == '0') { 46 | i++; 47 | if (str[i] == '%') { 48 | i++; 49 | type = 2; 50 | } else if (str[i] == 'x') { 51 | i++; 52 | type = 16; 53 | } else { 54 | type = 8; 55 | } 56 | } else { 57 | type = 10; 58 | } 59 | } 60 | // Flawfinder: ignore (strlen) 61 | for (; i < strlen(str); i++) { 62 | c = str[i]; 63 | if (isdigit(c)) { 64 | n = c - '0'; 65 | } else if (isupper(c)) { 66 | n = c - 'A' + 10; 67 | } else if (islower(c)) { 68 | n = c - 'a' + 10; 69 | } else { 70 | goto out; 71 | } 72 | if (n >= type) 73 | goto out; 74 | val = (val * type) + n; 75 | } 76 | out: 77 | return (val * sign); 78 | } 79 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | rm -f aclocal.m4 6 | 7 | type autoreconf268 > /dev/null 2>&1 && acversion=268 || acversion= 8 | 9 | autoreconf$acversion -f -i -v -I m4 -Wall 10 | 11 | rm -rf autom4te.cache 12 | 13 | [ -f config.cache ] && cp -f config.cache config.cache.old || touch config.cache.old 14 | 15 | [ "_$1" = _-M ] && shift && set - --enable-maintainer-mode ${1+"$@"} 16 | 17 | ./configure -C ${1+"$@"} 18 | 19 | PATH=$PATH:/usr/contrib/bin 20 | perl -pi -e 's/auto(conf|header)$/$&'"$acversion"'/ if /^AUTO(CONF|HEADER)/' Makefile 21 | 22 | diff -u config.cache.old config.cache 23 | 24 | rm -f config.cache.old 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /build-aux/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2012-06-26.16; # UTC 5 | 6 | # Copyright (C) 1996-2013 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'automa4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /build-aux/ylwrap: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # ylwrap - wrapper for lex/yacc invocations. 3 | 4 | scriptversion=2012-12-21.17; # UTC 5 | 6 | # Copyright (C) 1996-2013 Free Software Foundation, Inc. 7 | # 8 | # Written by Tom Tromey . 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # This file is maintained in Automake, please report 29 | # bugs to or send patches to 30 | # . 31 | 32 | get_dirname () 33 | { 34 | case $1 in 35 | */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; 36 | # Otherwise, we want the empty string (not "."). 37 | esac 38 | } 39 | 40 | # guard FILE 41 | # ---------- 42 | # The CPP macro used to guard inclusion of FILE. 43 | guard() 44 | { 45 | printf '%s\n' "$1" \ 46 | | sed \ 47 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ 48 | -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ 49 | -e 's/__*/_/g' 50 | } 51 | 52 | # quote_for_sed [STRING] 53 | # ---------------------- 54 | # Return STRING (or stdin) quoted to be used as a sed pattern. 55 | quote_for_sed () 56 | { 57 | case $# in 58 | 0) cat;; 59 | 1) printf '%s\n' "$1";; 60 | esac \ 61 | | sed -e 's|[][\\.*]|\\&|g' 62 | } 63 | 64 | case "$1" in 65 | '') 66 | echo "$0: No files given. Try '$0 --help' for more information." 1>&2 67 | exit 1 68 | ;; 69 | --basedir) 70 | basedir=$2 71 | shift 2 72 | ;; 73 | -h|--h*) 74 | cat <<\EOF 75 | Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... 76 | 77 | Wrapper for lex/yacc invocations, renaming files as desired. 78 | 79 | INPUT is the input file 80 | OUTPUT is one file PROG generates 81 | DESIRED is the file we actually want instead of OUTPUT 82 | PROGRAM is program to run 83 | ARGS are passed to PROG 84 | 85 | Any number of OUTPUT,DESIRED pairs may be used. 86 | 87 | Report bugs to . 88 | EOF 89 | exit $? 90 | ;; 91 | -v|--v*) 92 | echo "ylwrap $scriptversion" 93 | exit $? 94 | ;; 95 | esac 96 | 97 | 98 | # The input. 99 | input="$1" 100 | shift 101 | # We'll later need for a correct munging of "#line" directives. 102 | input_sub_rx=`get_dirname "$input" | quote_for_sed` 103 | case "$input" in 104 | [\\/]* | ?:[\\/]*) 105 | # Absolute path; do nothing. 106 | ;; 107 | *) 108 | # Relative path. Make it absolute. 109 | input="`pwd`/$input" 110 | ;; 111 | esac 112 | input_rx=`get_dirname "$input" | quote_for_sed` 113 | 114 | # Since DOS filename conventions don't allow two dots, 115 | # the DOS version of Bison writes out y_tab.c instead of y.tab.c 116 | # and y_tab.h instead of y.tab.h. Test to see if this is the case. 117 | y_tab_nodot=false 118 | if test -f y_tab.c || test -f y_tab.h; then 119 | y_tab_nodot=true 120 | fi 121 | 122 | # The parser itself, the first file, is the destination of the .y.c 123 | # rule in the Makefile. 124 | parser=$1 125 | 126 | # A sed program to s/FROM/TO/g for all the FROM/TO so that, for 127 | # instance, we rename #include "y.tab.h" into #include "parse.h" 128 | # during the conversion from y.tab.c to parse.c. 129 | sed_fix_filenames= 130 | 131 | # Also rename header guards, as Bison 2.7 for instance uses its header 132 | # guard in its implementation file. 133 | sed_fix_header_guards= 134 | 135 | while test "$#" -ne 0; do 136 | if test "$1" = "--"; then 137 | shift 138 | break 139 | fi 140 | from=$1 141 | # Handle y_tab.c and y_tab.h output by DOS 142 | if $y_tab_nodot; then 143 | case $from in 144 | "y.tab.c") from=y_tab.c;; 145 | "y.tab.h") from=y_tab.h;; 146 | esac 147 | fi 148 | shift 149 | to=$1 150 | shift 151 | sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" 152 | sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" 153 | done 154 | 155 | # The program to run. 156 | prog="$1" 157 | shift 158 | # Make any relative path in $prog absolute. 159 | case "$prog" in 160 | [\\/]* | ?:[\\/]*) ;; 161 | *[\\/]*) prog="`pwd`/$prog" ;; 162 | esac 163 | 164 | # FIXME: add hostname here for parallel makes that run commands on 165 | # other machines. But that might take us over the 14-char limit. 166 | dirname=ylwrap$$ 167 | do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' 168 | trap "ret=129; $do_exit" 1 169 | trap "ret=130; $do_exit" 2 170 | trap "ret=141; $do_exit" 13 171 | trap "ret=143; $do_exit" 15 172 | mkdir $dirname || exit 1 173 | 174 | cd $dirname 175 | 176 | case $# in 177 | 0) "$prog" "$input" ;; 178 | *) "$prog" "$@" "$input" ;; 179 | esac 180 | ret=$? 181 | 182 | if test $ret -eq 0; then 183 | for from in * 184 | do 185 | to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` 186 | if test -f "$from"; then 187 | # If $2 is an absolute path name, then just use that, 188 | # otherwise prepend '../'. 189 | case $to in 190 | [\\/]* | ?:[\\/]*) target=$to;; 191 | *) target="../$to";; 192 | esac 193 | 194 | # Do not overwrite unchanged header files to avoid useless 195 | # recompilations. Always update the parser itself: it is the 196 | # destination of the .y.c rule in the Makefile. Divert the 197 | # output of all other files to a temporary file so we can 198 | # compare them to existing versions. 199 | if test $from != $parser; then 200 | realtarget="$target" 201 | target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` 202 | fi 203 | 204 | # Munge "#line" or "#" directives. Don't let the resulting 205 | # debug information point at an absolute srcdir. Use the real 206 | # output file name, not yy.lex.c for instance. Adjust the 207 | # include guards too. 208 | sed -e "/^#/!b" \ 209 | -e "s|$input_rx|$input_sub_rx|" \ 210 | -e "$sed_fix_filenames" \ 211 | -e "$sed_fix_header_guards" \ 212 | "$from" >"$target" || ret=$? 213 | 214 | # Check whether files must be updated. 215 | if test "$from" != "$parser"; then 216 | if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then 217 | echo "$to is unchanged" 218 | rm -f "$target" 219 | else 220 | echo "updating $to" 221 | mv -f "$target" "$realtarget" 222 | fi 223 | fi 224 | else 225 | # A missing file is only an error for the parser. This is a 226 | # blatant hack to let us support using "yacc -d". If -d is not 227 | # specified, don't fail when the header file is "missing". 228 | if test "$from" = "$parser"; then 229 | ret=1 230 | fi 231 | fi 232 | done 233 | fi 234 | 235 | # Remove the directory. 236 | cd .. 237 | rm -rf $dirname 238 | 239 | exit $ret 240 | 241 | # Local Variables: 242 | # mode: shell-script 243 | # sh-indentation: 2 244 | # eval: (add-hook 'write-file-hooks 'time-stamp) 245 | # time-stamp-start: "scriptversion=" 246 | # time-stamp-format: "%:y-%02m-%02d.%02H" 247 | # time-stamp-time-zone: "UTC" 248 | # time-stamp-end: "; # UTC" 249 | # End: 250 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if the `closedir' function returns void instead of `int'. */ 4 | #undef CLOSEDIR_VOID 5 | 6 | /* Define to 1 if your system has a working `chown' function. */ 7 | #undef HAVE_CHOWN 8 | 9 | /* Define to 1 if you have the header file, and it defines `DIR'. 10 | */ 11 | #undef HAVE_DIRENT_H 12 | 13 | /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ 14 | #undef HAVE_DOPRNT 15 | 16 | /* Define to 1 if you have the `fork' function. */ 17 | #undef HAVE_FORK 18 | 19 | /* Define to 1 if you have the `gethostname' function. */ 20 | #undef HAVE_GETHOSTNAME 21 | 22 | /* Define to 1 if you have the `getpass' function. */ 23 | #undef HAVE_GETPASS 24 | 25 | /* Define to 1 if you have the `getspnam' function. */ 26 | #undef HAVE_GETSPNAM 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #undef HAVE_INTTYPES_H 30 | 31 | /* Define to 1 if you have the `bsd' library (-lbsd) */ 32 | #undef HAVE_LIBBSD 33 | 34 | /* Define to 1 if you have the `crypt' library (-lcrypt). */ 35 | #undef HAVE_LIBCRYPT 36 | 37 | /* Define to 1 if you have the `fl' library (-lfl). */ 38 | #undef HAVE_LIBFL 39 | 40 | /* Define to 1 if you have the `l' library (-ll). */ 41 | #undef HAVE_LIBL 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #undef HAVE_LIMITS_H 45 | 46 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 47 | to 0 otherwise. */ 48 | #undef HAVE_MALLOC 49 | 50 | /* Define to 1 if you have the header file. */ 51 | #undef HAVE_MEMORY_H 52 | 53 | /* Define to 1 if you have the `memset' function. */ 54 | #undef HAVE_MEMSET 55 | 56 | /* Define to 1 if you have the header file, and it defines `DIR'. */ 57 | #undef HAVE_NDIR_H 58 | 59 | /* Define to 1 if you have the header file. */ 60 | #undef HAVE_NETDB_H 61 | 62 | /* Define to 1 if your system has a GNU libc compatible `realloc' function, 63 | and to 0 otherwise. */ 64 | #undef HAVE_REALLOC 65 | 66 | /* Define to 1 if you have the `regcomp' function. */ 67 | #undef HAVE_REGCOMP 68 | 69 | /* Define to 1 if you have the `regex' functions. */ 70 | #undef HAVE_REGEX 71 | 72 | /* Define to 1 if you have the header file. */ 73 | #undef HAVE_SHADOW_H 74 | 75 | /* Define to 1 if `stat' has the bug that it succeeds when given the 76 | zero-length file name argument. */ 77 | #undef HAVE_STAT_EMPTY_STRING_BUG 78 | 79 | /* Define to 1 if you have the header file. */ 80 | #undef HAVE_STDINT_H 81 | 82 | /* Define to 1 if you have the header file. */ 83 | #undef HAVE_STDLIB_H 84 | 85 | /* Define to 1 if you have the `strchr' function. */ 86 | #undef HAVE_STRCHR 87 | 88 | /* Define to 1 if you have the `strcspn' function. */ 89 | #undef HAVE_STRCSPN 90 | 91 | /* Define to 1 if you have the `strdup' function. */ 92 | #undef HAVE_STRDUP 93 | 94 | /* Define to 1 if you have the `strftime' function. */ 95 | #undef HAVE_STRFTIME 96 | 97 | /* Define to 1 if you have the header file. */ 98 | #undef HAVE_STRINGS_H 99 | 100 | /* Define to 1 if you have the header file. */ 101 | #undef HAVE_STRING_H 102 | 103 | /* Define to 1 if you have the `strlcat' function. */ 104 | #undef HAVE_STRLCAT 105 | 106 | /* Define to 1 if you have the `strlcpy' function. */ 107 | #undef HAVE_STRLCPY 108 | 109 | /* Define to 1 if you have the `strrchr' function. */ 110 | #undef HAVE_STRRCHR 111 | 112 | /* Define to 1 if you have the `strtol' function. */ 113 | #undef HAVE_STRTOL 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #undef HAVE_SYSLOG_H 117 | 118 | /* Define to 1 if you have the header file, and it defines `DIR'. 119 | */ 120 | #undef HAVE_SYS_DIR_H 121 | 122 | /* Define to 1 if you have the header file, and it defines `DIR'. 123 | */ 124 | #undef HAVE_SYS_NDIR_H 125 | 126 | /* Define to 1 if you have the header file. */ 127 | #undef HAVE_SYS_STAT_H 128 | 129 | /* Define to 1 if you have the header file. */ 130 | #undef HAVE_SYS_TIME_H 131 | 132 | /* Define to 1 if you have the header file. */ 133 | #undef HAVE_SYS_TYPES_H 134 | 135 | /* Define to 1 if you have that is POSIX.1 compatible. */ 136 | #undef HAVE_SYS_WAIT_H 137 | 138 | /* Define to 1 if you have the header file. */ 139 | #undef HAVE_UNISTD_H 140 | 141 | /* Define to 1 if you have the `vfork' function. */ 142 | #undef HAVE_VFORK 143 | 144 | /* Define to 1 if you have the header file. */ 145 | #undef HAVE_VFORK_H 146 | 147 | /* Define to 1 if you have the `vprintf' function. */ 148 | #undef HAVE_VPRINTF 149 | 150 | /* Define to 1 if you have the `vsnprintf' function. */ 151 | #undef HAVE_VSNPRINTF 152 | 153 | /* Define to 1 if `fork' works. */ 154 | #undef HAVE_WORKING_FORK 155 | 156 | /* Define to 1 if `vfork' works. */ 157 | #undef HAVE_WORKING_VFORK 158 | 159 | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing 160 | slash. */ 161 | #undef LSTAT_FOLLOWS_SLASHED_SYMLINK 162 | 163 | /* Does openlog() return void? */ 164 | #undef OPENLOG_VOID 165 | 166 | /* Name of package */ 167 | #undef PACKAGE 168 | 169 | /* Define to the address where bug reports for this package should be sent. */ 170 | #undef PACKAGE_BUGREPORT 171 | 172 | /* Define to the full name of this package. */ 173 | #undef PACKAGE_NAME 174 | 175 | /* Define to the full name and version of this package. */ 176 | #undef PACKAGE_STRING 177 | 178 | /* Define to the one symbol short name of this package. */ 179 | #undef PACKAGE_TARNAME 180 | 181 | /* Define to the home page for this package. */ 182 | #undef PACKAGE_URL 183 | 184 | /* Define to the version of this package. */ 185 | #undef PACKAGE_VERSION 186 | 187 | /* Define to 1 if you have the ANSI C header files. */ 188 | #undef STDC_HEADERS 189 | 190 | /* Define to 1 if you can safely include both and . */ 191 | #undef TIME_WITH_SYS_TIME 192 | 193 | /* Use PAM for authentication */ 194 | #undef USE_PAM 195 | 196 | /* Use shadow file for authentication */ 197 | #undef USE_SHADOW 198 | 199 | /* Enable extensions on AIX 3, Interix. */ 200 | #ifndef _ALL_SOURCE 201 | # undef _ALL_SOURCE 202 | #endif 203 | /* Enable GNU extensions on systems that have them. */ 204 | #ifndef _GNU_SOURCE 205 | # undef _GNU_SOURCE 206 | #endif 207 | /* Enable threading extensions on Solaris. */ 208 | #ifndef _POSIX_PTHREAD_SEMANTICS 209 | # undef _POSIX_PTHREAD_SEMANTICS 210 | #endif 211 | /* Enable extensions on HP NonStop. */ 212 | #ifndef _TANDEM_SOURCE 213 | # undef _TANDEM_SOURCE 214 | #endif 215 | /* Enable general extensions on Solaris. */ 216 | #ifndef __EXTENSIONS__ 217 | # undef __EXTENSIONS__ 218 | #endif 219 | 220 | 221 | /* Version number of package */ 222 | #undef VERSION 223 | 224 | /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a 225 | `char[]'. */ 226 | #undef YYTEXT_POINTER 227 | 228 | /* Define to 1 if on MINIX. */ 229 | #undef _MINIX 230 | 231 | /* Define to 2 if the system does not provide POSIX.1 features except with 232 | this defined. */ 233 | #undef _POSIX_1_SOURCE 234 | 235 | /* Define to 1 if you need to in order for `stat' and other things to work. */ 236 | #undef _POSIX_SOURCE 237 | 238 | /* Define to empty if `const' does not conform to ANSI C. */ 239 | #undef const 240 | 241 | /* Define to `int' if doesn't define. */ 242 | #undef gid_t 243 | 244 | /* Define to rpl_malloc if the replacement function should be used. */ 245 | #undef malloc 246 | 247 | /* Define to `int' if does not define. */ 248 | #undef mode_t 249 | 250 | /* Define to `int' if does not define. */ 251 | #undef pid_t 252 | 253 | /* Define to rpl_realloc if the replacement function should be used. */ 254 | #undef realloc 255 | 256 | /* Define to `unsigned int' if does not define. */ 257 | #undef size_t 258 | 259 | /* Define to `int' if doesn't define. */ 260 | #undef uid_t 261 | 262 | /* Define as `fork' if `vfork' does not work. */ 263 | #undef vfork 264 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ([2.68]) 5 | AC_INIT([op],[1.34],[alec@swapoff.org]) 6 | AC_CONFIG_AUX_DIR([build-aux]) 7 | AC_CONFIG_MACRO_DIR([m4]) 8 | AC_CONFIG_SRCDIR([main.c]) 9 | AC_CONFIG_HEADER([config.h]) 10 | AM_INIT_AUTOMAKE([-Wall]) 11 | AC_CONFIG_FILES([Makefile op.list]) 12 | AM_MAINTAINER_MODE 13 | AC_CANONICAL_BUILD 14 | dnl ac_cv_build=x86_64-unknown-linux-gnu 15 | AC_USE_SYSTEM_EXTENSIONS 16 | 17 | # Checks for programs. 18 | AC_PROG_CC 19 | AC_PROG_LEX 20 | AC_PROG_INSTALL 21 | AC_PROG_MAKE_SET 22 | 23 | # Feature checks. 24 | auto_detect_auth=no 25 | with_pam=${with_pam:-yes} 26 | AC_ARG_WITH([pam], 27 | AS_HELP_STRING([--with-pam], 28 | [use PAM for authentication (yes)])]) 29 | AS_IF([test "_${with_pam}" = _yes], [ 30 | AC_CHECK_LIB([pam], [pam_start], [ 31 | AC_DEFINE(USE_PAM, [], [Use PAM for authentication]) 32 | LIBS="$LIBS -lpam" 33 | ], [ 34 | AC_MSG_WARN([Can't find pam_start() in libpam, trying shadow support]) 35 | auto_detect_auth=yes 36 | with_pam=no 37 | # Try shadow if PAM failed 38 | with_shadow=yes 39 | ]) 40 | ]) 41 | 42 | with_shadow=${with_shadow:-no} 43 | AC_ARG_WITH([shadow], 44 | AS_HELP_STRING([--with-shadow], 45 | [use shadow file for authentication 46 | (default if PAM not found)])]) 47 | AS_IF([test "_${with_shadow}" = _yes], [ 48 | AS_IF([test "_${with_pam}" = _yes], [ 49 | AC_MSG_WARN([Can't enable PAM and shadow support, shadow disabled]) 50 | ], [ 51 | AS_IF([test "_${auto_detect_auth}" = _yes -a \ 52 | ! -e /etc/shadow], [ 53 | AC_MSG_WARN([Failed to find shadow support while auto-detecting authentication mechanisms, using basic crypt]) 54 | ], [ 55 | AS_IF([test ! -e /etc/shadow], [ 56 | AC_MSG_WARN([Shadow support enabled but /etc/shadow does not exist, continuing anyway]) 57 | ]) 58 | AC_DEFINE(USE_SHADOW, [], [Use shadow file for authentication]) 59 | ]) 60 | ]) 61 | ]) 62 | 63 | enable_xauth=${enable_xauth:-no} 64 | AC_ARG_ENABLE([xauth], 65 | AS_HELP_STRING([--enable-xauth=], 66 | [enable xauth support and specify xauth binary])]) 67 | AS_IF([test "_${enable_xauth}" != _no], [ 68 | EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DXAUTH=\\\"$enable_xauth\\\"" 69 | ]) 70 | 71 | # Checks for libraries. 72 | AC_CHECK_LIB([bsd], [strlcat], [ 73 | AC_DEFINE(HAVE_LIBBSD, [1], 74 | [Define to 1 if you have the `bsd' library (-lbsd)]) 75 | LIBS="$LIBS -lbsd" 76 | ]) 77 | AC_CHECK_LIB([fl], [yywrap], [], AC_CHECK_LIB([l], [yywrap], [])) 78 | 79 | # Checks for header files. 80 | AC_HEADER_DIRENT 81 | AC_HEADER_STDC 82 | AC_HEADER_SYS_WAIT 83 | AC_HEADER_TIME 84 | AC_CHECK_HEADERS([limits.h netdb.h shadow.h stdlib.h string.h \ 85 | sys/time.h syslog.h unistd.h]) 86 | 87 | # Checks for typedefs, structures, and compiler characteristics. 88 | AC_C_CONST 89 | AC_TYPE_UID_T 90 | AC_TYPE_MODE_T 91 | AC_TYPE_SIZE_T 92 | 93 | # Checks for library functions. 94 | AC_FUNC_CHOWN 95 | AC_FUNC_CLOSEDIR_VOID 96 | AC_FUNC_FORK 97 | AC_FUNC_MALLOC 98 | AC_FUNC_REALLOC 99 | AC_FUNC_STAT 100 | AC_FUNC_STRFTIME 101 | AC_FUNC_VPRINTF 102 | AC_CHECK_FUNCS([gethostname getpass getspnam memset regcomp \ 103 | strchr strcspn strdup strrchr strtol vsnprintf]) 104 | AC_CHECK_FUNC([crypt], 105 | [], [AC_CHECK_LIB([crypt], [crypt], [], 106 | [AC_MSG_ERROR(Can't find crypt())])]) 107 | AC_CHECK_FUNC([regfree], 108 | [AC_DEFINE(HAVE_REGEX, [1], 109 | [Define to 1 if you have the `regex' functions.])]) 110 | AC_CHECK_FUNC([strlcat], 111 | [AC_DEFINE(HAVE_STRLCAT, [1], 112 | [Define to 1 if you have the `strlcat' function.])]) 113 | AC_CHECK_FUNC([strlcpy], 114 | [AC_DEFINE(HAVE_STRLCPY, [1], 115 | [Define to 1 if you have the `strlcpy' function.])]) 116 | AC_CHECK_FUNC([vsnprintf], 117 | [AC_DEFINE(HAVE_VSNPRINTF, [1], 118 | [Define to 1 if you have the `vsnprintf' function.])]) 119 | 120 | # Custom checks. 121 | AC_COMPILE_IFELSE( 122 | [AC_LANG_SOURCE([int main(int, char**){int i = openlog(); return 0;}])], 123 | [OPENLOG_VOID=0], 124 | [OPENLOG_VOID=1]) 125 | AC_DEFINE_UNQUOTED([OPENLOG_VOID], 126 | [${OPENLOG_VOID}], 127 | [Does openlog() return void?]) 128 | 129 | # Check for compiler options. 130 | dnl AC_PROG_CC_STDC 131 | dnl ac_cv_prog_cc_stdc=-std=gnu99 132 | dnl ac_cv_c_compiler_gnu=yes 133 | 134 | AX_COMPILER_VENDOR 135 | dnl ax_cv_c_compiler_vendor=gnu 136 | dnl AX_COMPILER_VERSION 137 | dnl ax_cv_c_compiler_version=4.4.7 138 | 139 | AX_CFLAGS_WARN_ALL 140 | dnl -Waddress 141 | dnl -Warray-bounds 142 | dnl -Wc++0x-compat 143 | dnl -Wchar-subscripts 144 | dnl -Wimplicit-int 145 | dnl -Wimplicit-function-declaration 146 | dnl -Wcomment 147 | dnl -Wformat 148 | dnl -Wmain 149 | dnl -Wmissing-braces 150 | dnl -Wnonnull 151 | dnl -Wparentheses 152 | dnl -Wpointer-sign 153 | dnl -Wreorder 154 | dnl -Wreturn-type 155 | dnl -Wsequence-point 156 | dnl -Wsign-compare 157 | dnl -Wstrict-aliasing 158 | dnl -Wstrict-overflow=1 159 | dnl -Wswitch 160 | dnl -Wtrigraphs 161 | dnl -Wuninitialized 162 | dnl -Wunknown-pragmas 163 | dnl -Wunused-function 164 | dnl -Wunused-label 165 | dnl -Wunused-value 166 | dnl -Wunused-variable 167 | dnl -Wvolatile-register-var 168 | 169 | AS_IF([test "_${ax_cv_c_compiler_vendor}" = _ibm], [ 170 | # Stack Smashing Protection 171 | AX_CFLAGS_AIX_OPTION([-qstackprotect], [EXTRA_CFLAGS]) 172 | ]) 173 | 174 | AS_IF([test "_${ax_cv_c_compiler_vendor}" = _gnu], [ 175 | dnl rhel 3.x gcc 3.2.3 ld 2.14 i686-pc-linux-gnu 176 | dnl rhel 4.x gcc 3.4.6 ld 2.15 177 | dnl rhel 5.x gcc 4.1.2 ld 2.17 178 | dnl rhel 6.x gcc 4.4.7 ld 2.20 x86_64-unknown-linux-gnu 179 | dnl rhel 7.x gcc 4.8.5 ld 2.25 x86_64-unknown-linux-gnu 180 | dnl aix 5.2 gcc 3.3.2 ld aix powerpc-ibm-aix5.2.0.0 181 | dnl hpux 11.00 gcc 3.2 ld hp hppa2.0w-hp-hpux11.00 182 | dnl hpux 11.11 gcc 4.1.1 ld hp hppa2.0w-hp-hpux11.11 183 | dnl sunos 5.9 gcc 3.4.6 ld sun sparc-sun-solaris2.9 184 | 185 | dnl https://www.owasp.org/index.php/C-Based_Toolchain_Hardening 186 | dnl http://connect.ed-diamond.com/GNU-Linux-Magazine/GLMFHS-076/Les-options-de-securite-de-gcc 187 | dnl https://wiki.debian.org/Hardening 188 | dnl https://wiki.ubuntu.com/ToolChain/CompilerFlags 189 | dnl https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/BuiltPIE 190 | dnl https://fedoraproject.org/wiki/Security_Features_Matrix 191 | dnl https://fedoraproject.org/wiki/Hardened_Packages 192 | dnl https://wiki.gentoo.org/wiki/Hardened/Toolchain 193 | dnl https://wiki.archlinux.org/index.php/DeveloperWiki:Security 194 | 195 | AS_IF([test "_${USE_MAINTAINER_MODE}" = _no], [ 196 | enable_compile_warnings=${enable_compile_warnings:-no} 197 | ], [ 198 | enable_Werror=${enable_Werror:-no} 199 | ]) 200 | 201 | dnl AX_IS_RELEASE([git-directory]) 202 | 203 | AC_MSG_NOTICE([USE_MAINTAINER_MODE=$USE_MAINTAINER_MODE]) 204 | AC_MSG_NOTICE([ax_is_release=$ax_is_release]) 205 | AC_MSG_NOTICE([enable_compile_warnings=$enable_compile_warnings]) 206 | 207 | AX_COMPILER_FLAGS 208 | dnl WARN_CFLAGS = -fno-strict-aliasing 209 | dnl -Wall 210 | dnl -Wextra 211 | dnl -Wundef 212 | dnl -Wnested-externs 213 | dnl -Wwrite-strings 214 | dnl -Wpointer-arith 215 | dnl -Wmissing-declarations 216 | dnl -Wmissing-prototypes 217 | dnl -Wstrict-prototypes 218 | dnl -Wredundant-decls 219 | dnl -Wno-unused-parameter 220 | dnl -Wno-missing-field-initializers 221 | dnl -Wdeclaration-after-statement 222 | dnl -Wformat=2 223 | dnl -Wold-style-definition 224 | dnl -Wcast-align 225 | dnl -Wformat-nonliteral 226 | dnl -Wformat-security 227 | dnl -Wsign-compare 228 | dnl -Wstrict-aliasing 229 | dnl -Wshadow 230 | dnl -Winline 231 | dnl -Wpacked 232 | dnl -Wmissing-format-attribute 233 | dnl -Wmissing-noreturn 234 | dnl -Winit-self 235 | dnl -Wmissing-include-dirs 236 | dnl -Wunused-but-set-variable 237 | dnl -Warray-bounds 238 | dnl -Wimplicit-function-declaration 239 | dnl -Wreturn-type 240 | dnl -Wswitch-enum 241 | dnl -Wswitch-default 242 | dnl -Werror 243 | dnl -Wno-suggest-attribute=format 244 | dnl -Wno-error=unused-parameter 245 | dnl -Wno-error=missing-field-initializers 246 | dnl WARN_LDFLAGS = -Wl,--no-as-needed -Wl,--fatal-warnings 247 | dnl WARN_SCANNERFLAGS = --warn-all 248 | 249 | # Enables many warnings (despite their names, all and extra do not turn on all warnings) 250 | AX_APPEND_COMPILE_FLAGS([-pedantic], [EXTRA_CPPFLAGS]) 251 | 252 | # MAINTAINER_MODE 253 | AX_APPEND_COMPILE_FLAGS([-W], [EXTRA_CPPFLAGS]) 254 | AX_APPEND_COMPILE_FLAGS([-Wextra], [EXTRA_CPPFLAGS]) 255 | AX_APPEND_COMPILE_FLAGS([-Wunused], [EXTRA_CPPFLAGS]) 256 | dnl AX_APPEND_COMPILE_FLAGS([-Wclobbered], [EXTRA_CPPFLAGS]) 257 | dnl AX_APPEND_COMPILE_FLAGS([-Wempty-body], [EXTRA_CPPFLAGS]) 258 | dnl AX_APPEND_COMPILE_FLAGS([-Wignored-qualifiers], [EXTRA_CPPFLAGS]) 259 | dnl AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers], [EXTRA_CPPFLAGS]) 260 | dnl AX_APPEND_COMPILE_FLAGS([-Wmissing-parameter-type], [EXTRA_CPPFLAGS]) 261 | dnl AX_APPEND_COMPILE_FLAGS([-Wold-style-declaration], [EXTRA_CPPFLAGS]) 262 | dnl AX_APPEND_COMPILE_FLAGS([-Woverride-init], [EXTRA_CPPFLAGS]) 263 | dnl AX_APPEND_COMPILE_FLAGS([-Wtype-limits], [EXTRA_CPPFLAGS]) 264 | dnl AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [EXTRA_CPPFLAGS]) 265 | 266 | # Warn for implicit conversions that may alter a value (includes -Wsign-conversion) 267 | AX_APPEND_COMPILE_FLAGS([-Wconversion], [EXTRA_CPPFLAGS]) 268 | 269 | # Warn for implicit conversions that may change the sign of an integer value, such 270 | # as assigning a signed integer to an unsigned integer (-1 > 1 after promotion!) 271 | dnl AX_APPEND_COMPILE_FLAGS([-Wsign-conversion], [EXTRA_CPPFLAGS]) 272 | 273 | # Warn for a pointer cast to a type which has a different size, causing an invalid 274 | # alignment and subsequent bus error on ARM processors 275 | AX_APPEND_COMPILE_FLAGS([-Wcast-align], [EXTRA_CPPFLAGS]) 276 | 277 | # Increases warnings related to possible security defects, including incorrect format 278 | # specifiers (includes -Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k) 279 | AX_APPEND_COMPILE_FLAGS([-Wformat=2], [EXTRA_CPPFLAGS]) 280 | 281 | # Warn if a global function is defined without a prototype or declaration 282 | dnl AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes], [EXTRA_CPPFLAGS]) 283 | AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations], [EXTRA_CPPFLAGS]) 284 | 285 | # Warn if a function is declared or defined without specifying the argument types 286 | AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes], [EXTRA_CPPFLAGS]) 287 | 288 | # Warn about optimizations taken due to [undefined] signed integer overflow assumptions 289 | AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow], [EXTRA_CPPFLAGS]) # gcc 4.2 290 | 291 | # Enable exception handling. Generates extra code needed to propagate exceptions 292 | AX_APPEND_COMPILE_FLAGS([-fexceptions], [EXTRA_CFLAGS]) 293 | 294 | # Enable AddressSanitizer, a fast memory error detector. Memory access instructions 295 | # will be instrumented to help detect heap, stack, and global buffer overflows; 296 | # as well as use-after-free bugs 297 | AX_APPEND_COMPILE_FLAGS([-fsanitize=address], [EXTRA_CFLAGS]) # gcc 4.8 298 | AX_APPEND_COMPILE_FLAGS([-static-libasan], [EXTRA_CFLAGS]) # gcc 4.8 299 | 300 | # FORTIFY_SOURCE / buffer overflow 301 | AX_APPEND_COMPILE_FLAGS(['-O1 -D_FORTIFY_SOURCE=2'], [EXTRA_CPPFLAGS]) # gcc 4.1 302 | 303 | dnl # too many warning: frame size too large for reliable stack checking 304 | dnl AX_APPEND_COMPILE_FLAGS([-fstack-check], [EXTRA_CFLAGS]) 305 | 306 | # Stack Smashing Protection 307 | # Improves stack layout and adds a guard to detect stack based buffer overflows 308 | AS_CASE([${ac_cv_build}], 309 | dnl hpux : not supported for this target 310 | [*hpux*], [], 311 | [ 312 | dnl too many warning: not protecting local variables: variable length buffer 313 | dnl AX_APPEND_COMPILE_FLAGS([-Wstack-protector], [EXTRA_CPPFLAGS]) 314 | AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong], [EXTRA_CFLAGS]) # gcc 4.9 315 | 316 | AS_IF([test "_${ax_cv_check_cflags___fstack_protector_strong}" = _no], [ 317 | AX_APPEND_COMPILE_FLAGS([-fstack-protector-all], [EXTRA_CFLAGS]) # gcc 3.x 318 | ]) 319 | 320 | AX_APPEND_COMPILE_FLAGS(['--param ssp-buffer-size=4'], [EXTRA_CFLAGS]) 321 | ]) 322 | 323 | # Data Execution Prevention (DEP). ELF headers are marked with PT_GNU_STACK and PT_GNU_HEAP 324 | AX_APPEND_LINK_FLAGS([-Wl,-z,noexecstack], [EXTRA_LDFLAGS]) # ld 2.14 325 | AX_APPEND_LINK_FLAGS([-Wl,-z,noexecheap], [EXTRA_LDFLAGS]) # ld 2.14 326 | 327 | # RELocation Read-Only 328 | # Helps remediate Global Offset Table (GOT) attacks on executables 329 | # Helps remediate Procedure Linkage Table (PLT) attacks on executables 330 | AX_APPEND_LINK_FLAGS([-Wl,-z,relro], [EXTRA_LDFLAGS]) # ld 2.15 331 | AX_APPEND_LINK_FLAGS([-Wl,-z,now], [EXTRA_LDFLAGS]) # ld 2.15 332 | 333 | AS_CASE([${ac_cv_build}], 334 | dnl aix : unrecognized option -pie 335 | [*-aix*], [], 336 | dnl solaris is buggy 337 | [*-solaris*], [], 338 | [ 339 | # Position Independent Executable (ASLR). Used for programs. 340 | # Both -fPIE (compiler) and -pie (linker) are required 341 | AX_APPEND_COMPILE_FLAGS([-fPIE], [EXTRA_CFLAGS]) # gcc 3.x 342 | AX_APPEND_LINK_FLAGS([-pie], [EXTRA_LDFLAGS]) # ld 2.16 343 | ]) 344 | 345 | CFLAGS=`echo "$CFLAGS" | sed 's/-O2//'` 346 | ]) 347 | 348 | AC_SUBST([EXTRA_CPPFLAGS]) 349 | AC_SUBST([EXTRA_CFLAGS]) 350 | AC_SUBST([EXTRA_LDFLAGS]) 351 | 352 | AC_OUTPUT 353 | -------------------------------------------------------------------------------- /contrib/.gitignore: -------------------------------------------------------------------------------- 1 | !build/ 2 | -------------------------------------------------------------------------------- /contrib/aix43/README: -------------------------------------------------------------------------------- 1 | this rootsh directory was made for creating a installp package 2 | using the lppbuild tool. Get it from 3 | ftp://aixpdslib.seas.ucla.edu/pub/lppbuild/RISC/4.3/src/lppbuild.2.1.tar.Z 4 | 5 | 1. Set your PATH to /lppbuild-2.1/bin 6 | 7 | 2. Change into the rootsh directory 8 | copy your rootsh binary to 9 | ./rootsh/rootsh/root/usr/bin/COPY_YUR_ROOTSH_BINARY_HERE 10 | 11 | chown bin:bin rootsh/root/usr 12 | chmod 755 rootsh/root/usr 13 | chown bin:bin rootsh/root/usr/bin 14 | chmod 755 rootsh/root/usr/bin 15 | chown bin:bin rootsh/root/usr/bin/rootsh 16 | chmod 500 rootsh/root/usr/bin/rootsh 17 | 18 | 3. Call lppbuild 19 | hopefully you will see this 20 | # lppbuild 21 | LPPBUILD - Processing for rootsh started 22 | found "rootsh" at level 0.2.0.0. 23 | Processing files for rootsh... 24 | Backing up to /home/qx28305/rootsh-0.2/contrib/aix/rootsh/rootsh.bff. 25 | Cluster 51200 bytes (100 blocks). 26 | Volume 1 on /home/qx28305/rootsh-0.2/contrib/aix/rootsh/rootsh.bff 27 | a 102 ./lpp_name 28 | a 0 ./usr 29 | a 0 ./usr/bin 30 | a 64585 ./usr/bin/rootsh 31 | a 0 ./usr/lpp 32 | a 0 ./usr/lpp/rootsh 33 | a 3460 ./usr/lpp/rootsh/liblpp.a 34 | The total size is 68147 bytes. 35 | Backup finished on Thu Jul 15 15:42:42 MSZ 2004; there are 200 blocks on 1 volumes. 36 | LPPBUILD - processing complete 37 | # 38 | 39 | 4. lppbuild created a package rootsh.bff which you can install with 40 | installp -a -d .../rootsh.bff all 41 | 42 | -------------------------------------------------------------------------------- /contrib/aix43/bos.adt.insttools/usr/lpp/bos/README.MKINSTALLP: -------------------------------------------------------------------------------- 1 | mkinstallp README 2 | 3 | Description 4 | 5 | The mkinstallp command is a tool that allows users to create their own 6 | software packages for AIX. Packages created with mkinstallp are in installp 7 | format and can be installed or removed with the installp command. 8 | 9 | Files to be packaged by mkinstallp must be in a directory structure such 10 | that the location of the file relative to the root build directory is the 11 | same as the destination of the file after installation. For example, if 12 | /usr/bin/ is to be installed via a mkinstallp package, 13 | the file /usr/bin/ must exist when mkinstallp 14 | is invoked. 15 | 16 | Once the contents of a package are in the correct directory structure, 17 | mkinstallp prompts for basic package data via the command line interface. 18 | This data includes the package name, requisites, descriptions of files to 19 | be packaged, etc. mkinstallp will then generate a template file based on 20 | responses given by the user. Template files can be created and/or edited 21 | directly by the user and passed to the mkinstallp command with the -T flag 22 | to avoid command line prompting. A subdirectory of the root build directory, 23 | /.info, will be created for mkinstallp to save the template file 24 | and other packaging and configuration files. 25 | 26 | Command Syntax 27 | 28 | mkinstallp [ -d BaseDirectory ] [ -T TemplateFile ] 29 | 30 | Flags 31 | 32 | -d BaseDirectory Specifies the root build directory containing the files 33 | to be packaged. If omitted, the current working directory is used. 34 | 35 | -T TemplateFile Specifies the full path name of the template file to be 36 | passed to mkinstallp. If omitted, mkinstallp will prompt for package 37 | information and create a new template file based on user responses. 38 | 39 | Examples 40 | 41 | The following examples show the directory structure and template file for a 42 | variety of packaging scenarios. The root build directory for the following 43 | examples is /tmp/packages. A list of template keywords is defined after 44 | example 4. 45 | There may be additional supported template keywords. To see them, run 46 | mkinstallp without -T, say yes to every request for a file and look at the 47 | resulting template file. 48 | 49 | Ex 1: PkgA - single fileset with no requisites and no ROOT part 50 | Ex 2: PkgB - single fileset with one prerequisite and ROOT part 51 | Ex 3: PkgC - single fileset with License agreement required 52 | Ex 4: PkgD - multiple filesets, one using requisite filename 53 | 54 | 55 | Ex 1: PkgA - single fileset with no requisites 56 | ---------------------------------------------- 57 | Directory Structure: 58 | 59 | /tmp/packages 60 | /tmp/packages/usr/doc/PkgA/README 61 | /tmp/packages/usr/PkgA/bin/acommand 62 | 63 | 64 | Template File: 65 | 66 | Package Name: PkgA 67 | Package VRMF: 1.0.0.0 68 | Update: N 69 | Fileset 70 | Fileset Name: PkgA.rte 71 | Fileset VRMF: 1.0.0.0 72 | Fileset Description: My runtime fileset 73 | Bosboot required: N 74 | License agreement acceptance required: N 75 | Include license files in this package: N 76 | Requisites: 77 | USRFiles 78 | /usr/doc/PkgA 79 | /usr/doc/PkgA/README 80 | /usr/PkgA 81 | /usr/PkgA/bin 82 | /usr/PkgA/bin/acommand 83 | EOUSRFiles 84 | ROOT Part: N 85 | ROOTFiles 86 | EOROOTFiles 87 | EOFileset 88 | 89 | 90 | Ex 2: PkgB - single fileset with one prerequisite and ROOT part 91 | --------------------------------------------------------------- 92 | Directory Structure: 93 | 94 | /tmp/packages 95 | /tmp/packages/etc/PkgB/a.cfg 96 | /tmp/packages/usr/doc/PkgB/README 97 | /tmp/packages/usr/PkgB/bin/bcommand 98 | 99 | 100 | Template File: 101 | 102 | Package Name: PkgB 103 | Package VRMF: 1.1.0.0 104 | Update: N 105 | Fileset 106 | Fileset Name: PkgB.rte 107 | Fileset VRMF: 1.1.0.0 108 | Fileset Description: My runtime fileset 109 | Bosboot required: N 110 | License agreement acceptance required: N 111 | Include license files in this package: N 112 | Requisites: *prereq PkgA.rte 1.0.0.0; 113 | USRFiles 114 | /usr/doc/PkgB 115 | /usr/doc/PkgB/README 116 | /usr/PkgB 117 | /usr/PkgB/bin 118 | /usr/PkgB/bin/bcommand 119 | EOUSRFiles 120 | ROOT Part: Y 121 | ROOTFiles 122 | /etc/PkgB 123 | /etc/PkgB/a.cfg 124 | EOROOTFiles 125 | EOFileset 126 | 127 | 128 | Ex 3: PkgC - single fileset with License agreement 129 | -------------------------------------------------- 130 | Directory Structure: 131 | 132 | /tmp/packages 133 | /tmp/packages/usr/doc/PkgC/README 134 | /tmp/packages/usr/PkgC/bin/ccommand 135 | 136 | 137 | Template File: 138 | 139 | Package Name: PkgC 140 | Package VRMF: 1.0.1.0 141 | Update: N 142 | Fileset 143 | Fileset Name: PkgC.rte 144 | Fileset VRMF: 1.0.1.0 145 | Fileset Description: My runtime fileset 146 | Bosboot required: N 147 | License agreement acceptance required: Y 148 | Name of license agreement: LAR/usr/swlag/%L/LUM.la 149 | Include license files in this package: N 150 | Requisites: 151 | USRFiles 152 | /usr/doc/PkgC 153 | /usr/doc/PkgC/README 154 | /usr/PkgC 155 | /usr/PkgC/bin 156 | /usr/PkgC/bin/ccommand 157 | EOUSRFiles 158 | ROOT Part: N 159 | ROOTFiles 160 | EOROOTFiles 161 | EOFileset 162 | 163 | 164 | Ex 4: PkgD - multiple filesets, one with requisite file 165 | ------------------------------------------------------- 166 | Directory Structure: 167 | 168 | /tmp/packages 169 | /tmp/packages/etc/PkgD/a.cfg 170 | /tmp/packages/usr/doc/PkgD/README 171 | /tmp/packages/usr/PkgD/bin/acommand 172 | /tmp/packages/usr/PkgD/bin/bcommand 173 | 174 | 175 | Template File: 176 | 177 | Package Name: PkgD 178 | Package VRMF: 1.2.0.0 179 | Update: N 180 | Fileset 181 | Fileset Name: PkgD.rte 182 | Fileset VRMF: 1.2.0.0 183 | Fileset Description: My runtime fileset 184 | Bosboot required: N 185 | License agreement acceptance required: N 186 | Include license files in this package: N 187 | Requisites: /pkgdata/pkgD.rte/requisites 188 | USRFiles 189 | /usr/doc/PkgD 190 | /usr/doc/PkgD/README 191 | /usr/PkgD 192 | /usr/PkgD/bin 193 | /usr/PkgD/bin/acommand 194 | EOUSRFiles 195 | ROOT Part: Y 196 | ROOTFiles 197 | /etc/PkgD 198 | /etc/PkgD/a.cfg 199 | EOROOTFiles 200 | EOFileset 201 | Fileset 202 | Fileset Name: PkgD.data 203 | Fileset VRMF: 1.2.0.0 204 | Fileset Description: My data fileset 205 | Bosboot required: N 206 | License agreement acceptance required: N 207 | Include license files in this package: N 208 | Requisites: 209 | USRFiles 210 | /usr/PkgD 211 | /usr/PkgD/bin 212 | /usr/PkgD/bin/bcommand 213 | EOUSRFiles 214 | ROOT Part: N 215 | ROOTFiles 216 | EOROOTFiles 217 | EOFileset 218 | 219 | 220 | Template File Keywords 221 | 222 | Keywords with a * are required, and will cause mkinstallp to fail if left blank or 223 | omitted in the template file. 224 | 225 | Package Name *- Name of the package 226 | Package VRMF *- Version, Release, Modification, and Fix level of the package 227 | Update *- Is this an update package? 228 | Fileset *- Start of a new Fileset 229 | Fileset Name *- Name of the fileset 230 | Fileset VRMF *- VRMF of the fileset 231 | Fileset Description *- Description of the fileset 232 | Bosboot required *- Is a bosboot required when installing this fileset? 233 | License agreement acceptance required *- Is license agreement acceptance required 234 | for this filesest? 235 | Name of license agreement - Name of the license agreement (see Note 1) 236 | Include license files in this package *- Are the license files included in this 237 | package? 238 | License file path - Path of the license file(s) (see Note 2) 239 | Requisites - co/if/inst/pre-requistes for the fileset (see Note 3) 240 | USRFiles *- Start of the USR part files section 241 | /path/to/file - File path (see Note 4) 242 | EOUSRFiles *- End of the USR part files section 243 | ROOT Part *- Is there a ROOT part included in this fileset? 244 | ROOTFiles *- Start of the ROOT part files section 245 | /path/to/file - File path (see Note 4) 246 | EOROOTFiles *- End of the ROOT part files section 247 | EOFileset *- End of the Fileset 248 | 249 | Note 1: The Name of license agreement is defined as LAR/path/to/license/agreement. 250 | The %L tag can be used in place of a hard coded path to represent the locale 251 | of the machine that the package will be installed on. For example, if PkgC 252 | is installed in the en_US locale, %L will be converted to en_US. 253 | 254 | Note 2: A License file path is defined as LAF/path/to/license/file. A conditional 255 | License file path is defined as LAF/path/to/license/file, where lc_LC 256 | is the locale which is associated with the license file. An example conditional 257 | License file path is LAF/usr/swlag/en_US/prod.la. Either type of path 258 | may be specified or both types. Multiple license file paths are separated by 259 | semicolons. 260 | 261 | Note 3: Requisites are defined as *Type Name VRMF;. Type may be coreq, ifreq, instreq, 262 | or prereq. Multiple requisites are separated by semicolons. 263 | Requisites may also be an absolute pathname of a file specifying multiple or 264 | complex requisites. 265 | 266 | Note 4: The full path name for each file in the fileset must be listed in the files 267 | section. Any custom directories should also be listed in this section. For 268 | example, to package /usr/PkgA/myFile, list both /usr/PkgA and /usr/PkgA/myFile in the 269 | files section. Each entity in the final package will have the same attributes 270 | (owner/group/permissions) that it had at build time. The user must ensure 271 | that file attributes in the buildroot are correct prior to running mkinstallp. 272 | -------------------------------------------------------------------------------- /contrib/aix52/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | usr/ 3 | -------------------------------------------------------------------------------- /contrib/aix52/mkpkg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | pkg=op 4 | ver=1.34.aix52 5 | exc='op.conf$' 6 | dir=build/usr/local 7 | usr=root 8 | grp=system 9 | rdir=/home/ftp/diffusion/exploitation/op 10 | #post='chmod 700 /tmp/${pkg}_${ver}/${dir}/usr/local/etc/op.d' 11 | 12 | PATH=/usr/local/bin:$PATH # tar 13 | cd build/usr/local 14 | 15 | . ../../../../mkpkg 16 | -------------------------------------------------------------------------------- /contrib/aix52/op.spec: -------------------------------------------------------------------------------- 1 | # Upstream: Corey Henderson 2 | 3 | %define _with_pam 1 4 | %define _with_shadow 0 5 | %define _with_xauth 1 6 | %define _with_x11 1 7 | 8 | Summary: Controlled privilege escalation (a flexible alternative to sudo) 9 | Name: op 10 | Version: 1.34 11 | Release: 1%{?dist} 12 | License: GPL 13 | Group: System Environment/Base 14 | URL: https://github.com/dagwieers/op/ 15 | Packager: Alec Thomas 16 | #Source: https://github.com/dagwieers/op/archive/%{version}.tar.gz 17 | Source: file:///../../op-%{version}.tar.gz 18 | NoSource: 0 19 | 20 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root 21 | 22 | %description 23 | Op is a tool for allowing users to run root privileged commands 24 | without the root password. 25 | 26 | # ---------------------------------------------------------------------- 27 | %prep 28 | %setup 29 | 30 | # ---------------------------------------------------------------------- 31 | %build 32 | %configure --target=%{_target} \ 33 | %{?_with_pam:--with-pam} %{?_with_shadow:--with-shadow} \ 34 | %{?_with_xauth:--enable-xauth=/usr/bin%{?_with_x11:/X11}/xauth} 35 | %{__make} %{?_smp_mflags} 36 | 37 | # ---------------------------------------------------------------------- 38 | %install 39 | %{__rm} -rf %{buildroot} # RHEL5 40 | %{__make} install DESTDIR=%{?buildroot} 41 | #%{__install} -p -d -m 700 %{buildroot}%{_sysconfdir}/op.d/ 42 | %{__install} -p -d %{buildroot}%{_sysconfdir}/pam.d/ 43 | #%{__install} -p -m 600 op.conf-dist %{buildroot}%{_sysconfdir}/op.conf 44 | cat << EOF > %{buildroot}%{_sysconfdir}/pam.d/op 45 | #%PAM-1.0 46 | # 47 | #auth sufficient pam_rootok.so 48 | # Uncomment the following line to implicitly trust users in the "wheel" group. 49 | #auth sufficient pam_wheel.so trust use_uid 50 | # Uncomment the following line to require a user to be in the "wheel" group. 51 | #auth required pam_wheel.so use_uid 52 | # 53 | auth include system-auth 54 | # 55 | account sufficient pam_succeed_if.so uid = 0 use_uid quiet 56 | # 57 | # 58 | account include system-auth 59 | password include system-auth 60 | #session required pam_limits.so 61 | # 62 | # 63 | #session optional pam_xauth.so 64 | # 65 | EOF 66 | 67 | %clean 68 | %{__rm} -rf %{buildroot} 69 | 70 | #%pre 71 | #%pre_control op 72 | #%pre_control op.conf 73 | 74 | %post 75 | # /etc/op.d 76 | case %{_sysconfdir}/op.d/* in */\*) ;; *) 77 | chown root:system %{_sysconfdir}/op.d/* || : set -e 78 | chmod 600 %{_sysconfdir}/op.d/* || : set -e 79 | esac 80 | #%post_control -s wheelonly op 81 | #%post_control -s strict op.conf 82 | 83 | # ---------------------------------------------------------------------- 84 | %files 85 | # %defattr(-, root, system, -) 86 | %dir %{_sysconfdir}/pam.d 87 | %config(noreplace) %{_sysconfdir}/pam.d/op 88 | # %caps(cap_linux_immutable) 89 | %attr(600,root,system) %{_sysconfdir}/op.conf-dist 90 | %attr(600,root,system) %config(noreplace) %{_sysconfdir}/op.conf 91 | %attr(700, root, system) %dir %{_sysconfdir}/op.d 92 | %attr(4511, root, system) %{_bindir}/op 93 | %{_mandir}/man1/op.1* 94 | %doc AUTHORS ChangeLog COPYING INSTALL README 95 | %doc op.conf.complex 96 | 97 | %changelog 98 | * Fri Jun 5 2012 Alec Thomas - 1.34 99 | - Initial package. 100 | -------------------------------------------------------------------------------- /contrib/audit/cppcheck.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | true 8 | 9 | 10 | true 11 | 12 | 13 | true 14 | 15 | 16 | true 17 | 18 | 19 | true 20 | 21 | 22 | true 23 | 24 | 25 | true 26 | 27 | 28 | -------------------------------------------------------------------------------- /contrib/audit/cppcheck.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | top=${0%/*} 4 | top=${top:-.} 5 | 6 | cppcargs= 7 | cppcargs="${cppcargs} --check-library" 8 | cppcargs="${cppcargs} --library=std" 9 | # cppcargs="${cppcargs} --library=/usr/local/share/cppcheck/gnu.cfg" 10 | cppcargs="${cppcargs} --include=/usr/local/" 11 | cppcargs="${cppcargs} --include=/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/" 12 | cppcargs="${cppcargs} --include=/usr/include/" 13 | cppcargs="${cppcargs} --platform=unix64 --inconclusive --inline-suppr" 14 | cppcargs="${cppcargs} --enable=information,style --error-exitcode=1" 15 | cppcargs="${cppcargs} --suppress=missingIncludeSystem" 16 | cppcargs="${cppcargs} --suppress=checkLibraryNoReturn" 17 | cppcargs="${cppcargs} --suppress=unreachableCode" 18 | cppcargs="${cppcargs} --template='{file}:{line}:{severity}:{id}:{message}'" 19 | 20 | cppcargs="${cppcargs} --library=${top}/cppcheck.cfg" 21 | cppcargs="${cppcargs} -DXAUTH=1" # -DHAVE_CONFIG_H 22 | 23 | args= sep=; for arg; do args="$args$sep'$arg'"; sep=' '; done 24 | 25 | eval cppcheck $cppcargs $args 2>&1 26 | 27 | exit 28 | 29 | // cppcheck-suppress 30 | // memlink 31 | // unreadVariale 32 | // ignoredReturnValue 33 | // nullPointer 34 | -------------------------------------------------------------------------------- /contrib/audit/cpplint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | cpplargs= 4 | cpplargs="${cpplargs} --extensions=c,h,l" 5 | 6 | filters= sep= 7 | 8 | # category list : cpplint.py --filter= 9 | # ignore next line : // NOLINT(category) 10 | 11 | filters="${filters}${sep}-build/include"; sep=, 12 | 13 | filters="${filters}${sep}-legal/copyright"; sep=, 14 | 15 | filters="${filters}${sep}-readability/braces"; sep=, 16 | filters="${filters}${sep}-readability/casting"; sep=, 17 | 18 | #filters="${filters}${sep}-runtime/int"; sep=, 19 | filters="${filters}${sep}-runtime/threadsafe_fn"; sep=, 20 | 21 | #filters="${filters}${sep}-whitespace/blank_line"; sep=, 22 | filters="${filters}${sep}-whitespace/braces"; sep=, 23 | #filters="${filters}${sep}-whitespace/comma"; sep=, 24 | #filters="${filters}${sep}-whitespace/comments"; sep=, 25 | #filters="${filters}${sep}-whitespace/end_of_line"; sep=, 26 | #filters="${filters}${sep}-whitespace/indent"; sep=, 27 | #filters="${filters}${sep}-whitespace/line_length"; sep=, 28 | #filters="${filters}${sep}-whitespace/newline"; sep=, 29 | #filters="${filters}${sep}-whitespace/operators"; sep=, 30 | #filters="${filters}${sep}-whitespace/parens"; sep=, 31 | #filters="${filters}${sep}-whitespace/semicolon"; sep=, 32 | filters="${filters}${sep}-whitespace/tab"; sep=, 33 | 34 | cpplargs="${cpplargs} --filter=${filters}" 35 | 36 | cpplint.py $cpplargs "$@" 2>&1 37 | 38 | exit 39 | 40 | // cpplheck-suppress 41 | // memlink 42 | // unreadVariale 43 | // ignoredReturnValue 44 | // nullPointer 45 | -------------------------------------------------------------------------------- /contrib/build/cleanall: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | 3 | set -e 4 | cd $home/op 5 | rm -rf build autom4te.cache 6 | sudo rm -rf contrib/aix??/op/op/build contrib/aix??/op/op/op.template 7 | rm -rf contrib/hpux????/usr 8 | rm -rf contrib/solaris/RATPop contrib/solaris/usr 9 | -------------------------------------------------------------------------------- /contrib/build/mkaix43: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | serv=sv003611 3 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 4 | osrel=$(oslevel | cut -d . -f 1-2) 5 | vers=1.34 6 | dist=$(echo $osrel | tr -d .) 7 | PATH=/usr/sbin:$PATH 8 | 9 | # set -e 10 | cd $home/op 11 | make distclean 12 | mkdir -p build/aix$dist contrib/aix$dist/op/op/build packages 13 | cd $home/op/build/aix$dist 14 | for i in lex.l main.c regexp.c snprintf.c strlcat.c strlcpy.c util.c yywrap.c op.1 op.conf-dist rplregex.c 15 | do ln -fs ../../$i; done; cp -p ../../lex.c lex.c 16 | egrep -q 'in +;' ../../configure && 17 | perl -pi -e 's/in +;/in .;/' ../../configure 18 | ../../configure --enable-xauth=/usr/bin/X11/xauth 19 | make 20 | sudo make install DESTDIR=$home/op/contrib/aix$dist/op/op/build 21 | sudo rm -f $home/op/contrib/aix$dist/op/op/build/usr/local/etc/op.conf 22 | cd $home/op/contrib/aix$dist/op/op 23 | # echo /usr/local/etc/op.conf preserve > build/.info/ratp.freeware.op.cfgfiles 24 | sed "s|@PWD@|$PWD|" op.tmpl > op.template 25 | sudo mkinstallp -d build -T op.template 26 | #sudo installp -Ld build/tmp/ratp.freeware.op.$vers.$osrel.bff 27 | #sudo installp -ld build/tmp/ratp.freeware.op.$vers.$osrel.bff 28 | scp -p build/tmp/ratp.freeware.op.$vers.$osrel.bff $rdist 29 | cp -p build/tmp/ratp.freeware.op.$vers.$osrel.bff $home/op/packages/ 30 | tar cf - -C $home op/packages/ratp.freeware.op.$vers.$osrel.bff | ssh $serv tar xf - 31 | -------------------------------------------------------------------------------- /contrib/build/mkaix52: -------------------------------------------------------------------------------- 1 | mkaix43 -------------------------------------------------------------------------------- /contrib/build/mkhpux: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 3 | osrel=$(uname -r | sed 's|B.||') 4 | osver=$(uname -r | tr -d B.) 5 | vers=1.34 6 | PATH=/usr/sbin:$PATH 7 | 8 | set -e 9 | cd $home/op 10 | mkdir -p build/hpux$osver packages 11 | cd $home/op/build/hpux$osver 12 | type lex > /dev/null 2>&1 || cp ../../lex.c . 13 | ln -fs ../../op.conf-dist . 14 | egrep -q 'in +;' ../../configure && 15 | perl -pi -e 's/in +;/in .;/' ../../configure 16 | ../../configure --enable-xauth=/usr/bin/X11/xauth 17 | make 18 | make install DESTDIR=$home/op/contrib/hpux$osver 19 | cd $home/op/contrib/hpux$osver 20 | swpackage -s op.psf -d op-$vers-HP-UX-$osrel.depot -x target_type=tape 21 | scp op-$vers-HP-UX-$osrel.depot $rdist 22 | mv op-$vers-HP-UX-$osrel.depot $home/op/packages/ 23 | -------------------------------------------------------------------------------- /contrib/build/mkrhel345: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 3 | vers=1.34 4 | dist=.el$(tr -dc 0-9 < /etc/redhat-release | cut -c 1) 5 | type xauth | grep -q X11 && x11='--with x11' || x11= 6 | 7 | set -e 8 | for pkg in rpm-build gcc glibc-devel; do 9 | rpm -q $pkg > /dev/null || 10 | sudo yum install -y $pkg 11 | done 12 | grep -q %_topdir ~/.rpmmacros || 13 | echo %_topdir $home/rpmbuild >> ~/.rpmmacros 14 | case $dist in *[45]) # bug cross compile 15 | grep -q %_sysconfdir ~/.rpmmacros || 16 | echo %_sysconfdir /etc >> ~/.rpmmacros 17 | grep -q %_localstatedir ~/.rpmmacros || 18 | echo %_localstatedir /var >> ~/.rpmmacros 19 | esac 20 | cd $home/op 21 | mkdir -p $home/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SPRMS} packages 22 | ln -fs $PWD/op-$vers.tar.gz $home/rpmbuild/SOURCES/ 23 | cd $home/op/contrib/linux 24 | rpmbuild -D "dist $dist" -bb $x11 op.spec 25 | arch | grep -q 64 && 26 | CC='gcc -m32' rpmbuild --target=i386-linux -D "dist $dist" -bb $x11 op.spec 27 | mv $home/rpmbuild/RPMS/*/op-$vers-1$dist.*.rpm . 28 | [[ -f $home/rpmbuild/RPMS/i386/op-$vers-1.i386.rpm ]] && 29 | mv $home/rpmbuild/RPMS/i386/op-$vers-1.i386.rpm op-$vers-1$dist.i386.rpm 30 | scp -p op-$vers-1$dist.*.rpm $rdist 31 | mv op-$vers-1$dist.*.rpm $home/op/packages/ 32 | -------------------------------------------------------------------------------- /contrib/build/mkrhel6: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 3 | vers=1.34 4 | dist=.el$(tr -dc 0-9 < /etc/redhat-release | cut -c 1) 5 | type xauth | grep -q X11 && x11='--with x11' || x11= 6 | 7 | set -e 8 | for pkg in rpm-build gcc glibc-devel; do 9 | rpm -q $pkg > /dev/null || 10 | sudo yum install -y $pkg 11 | done 12 | cd $home/op 13 | mkdir -p $home/rpmbuild/SOURCES packages 14 | ln -fs $home/op/op-$vers.tar.gz $home/rpmbuild/SOURCES 15 | cd $home/op/contrib/linux 16 | rpmbuild -bb $x11 op$X.spec 17 | arch | grep -q 64 && 18 | CC='gcc -m32' rpmbuild --target=i386-linux -bb op.spec 19 | mv $home/rpmbuild/RPMS/*/op-$vers-1$dist.*.rpm . 20 | scp -p op-$vers-1$dist.*.rpm $rdist 21 | mv op-$vers-1$dist.*.rpm $home/op/packages/ 22 | -------------------------------------------------------------------------------- /contrib/build/mkrhel7: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 3 | vers=1.34 4 | dist=.el$(tr -dc 0-9 < /etc/redhat-release | cut -c 1) 5 | type xauth | grep -q X11 && x11='--with x11' || x11= 6 | 7 | set -e 8 | for pkg in rpm-build gcc glibc-devel libasan-static; do 9 | [[ $pkg = libasan-static ]] && repo=--enablerepo=* || repo= 10 | rpm -q $pkg > /dev/null || 11 | sudo yum install $repo -y $pkg 12 | done 13 | cd $home/op 14 | mkdir -p $home/rpmbuild/SOURCES packages 15 | ln -fs $home/op/op-$vers.tar.gz $home/rpmbuild/SOURCES 16 | cd $home/op/contrib/linux 17 | # -ba to generate debuginfo 18 | rpmbuild -bb $x11 op$X.spec 19 | # not tested... should I ?! 20 | #arch | grep -q 64 && 21 | #CC='gcc -m32' rpmbuild --target=i386-linux -bb op.spec 22 | mv $home/rpmbuild/RPMS/*/op-$vers-1$dist.*.rpm . 23 | # mv $home/rpmbuild/RPMS/*/op-debuginfo-$vers-1$dist.*.rpm . 24 | # mv $home/rpmbuild/SRPMS/op-$vers-1$dist.*.rpm . 25 | scp -p op-$vers-1$dist.*.rpm $rdist 26 | mv op-$vers-1$dist.*.rpm $home/op/packages/ 27 | # mv op-debuginfo-$vers-1$dist.*.rpm $home/op/packages/ 28 | -------------------------------------------------------------------------------- /contrib/build/mksunos: -------------------------------------------------------------------------------- 1 | home=$HOME 2 | rdist=esxide@recife:/home/ftp/diffusion/exploitation/op/ 3 | vers=1.34 4 | PATH=/sbin:/usr/sbin:$PATH:/usr/openwin/bin 5 | 6 | set -e 7 | cd $home/op 8 | mkdir -p build/sunos59 packages 9 | cd $home/op/build/sunos59 10 | grep -q 'in *;' ../../configure && 11 | perl -pi -e 's/in +;/in .;/' ../../configure 12 | ../../configure --enable-xauth=/usr/openwin/bin/xauth 13 | make 14 | make install DESTDIR=$home/op/contrib/solaris 15 | rm -f $home/op/contrib/solaris/usr/local/etc/op.conf 16 | cd $home/op/contrib/solaris 17 | pkgmk -od $PWD 18 | pkgtrans $PWD RATPop-$vers.pkg RATPop 19 | pkginfo -ld RATPop-$vers.pkg 20 | pkgchk -vd RATPop-$vers.pkg all 21 | scp -p RATPop-$vers.pkg RATPop.admin $rdist 22 | cp -p RATPop.admin $home/op/packages/ 23 | mv RATPop-$vers.pkg $home/op/packages/ 24 | -------------------------------------------------------------------------------- /contrib/build/mktar: -------------------------------------------------------------------------------- 1 | rhost=esxide@recife 2 | rdir=/home/ftp/diffusion/exploitation/op 3 | vers=1.34 4 | 5 | ssh -o LogLevel=ERROR ${rhost} \ 6 | "cd ${rdir} && /usr/local/bin/tar zcf ${rdir}/op_${vers}.tar.gz *${vers}*.rpm *${vers}*.depot *${vers}*.bff *${vers}*.pkg *.admin" 7 | -------------------------------------------------------------------------------- /contrib/hpux1100/.gitignore: -------------------------------------------------------------------------------- 1 | *.depot 2 | usr/ 3 | -------------------------------------------------------------------------------- /contrib/hpux1100/README: -------------------------------------------------------------------------------- 1 | create a datastream package named op-0.2-HP-UX.depot 2 | # /usr/sbin/swpackage -sop.psf -dop-0.2-HP-UX.depot -xtarget_type=tape 3 | 4 | install it 5 | # swinstall -s `pwd`/op-0.2-HP-UX.depot \* 6 | 7 | -------------------------------------------------------------------------------- /contrib/hpux1100/op.postinstall: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | set -e 4 | 5 | PATH=${SW_PATH}:/sbin:/usr/bin:/usr/ccs/sbin 6 | 7 | DESTDIR=${DESTDIR:-${SW_ROOT_DIRECTORY:-}} 8 | [ ${DESTDIR} = '/' ] && DESTDIR= 9 | LOCALDIR=/usr/local 10 | [ -n ${LOCALDIR} ] && USERDIR=${LOCALDIR} || USERDIR=/usr 11 | 12 | CFGOWN=root 13 | CFGGRP=root 14 | 15 | # /etc/op.conf 16 | test -f ${DESTDIR}${LOCALDIR}/etc/op.conf || 17 | cp ${DESTDIR}${LOCALDIR}/etc/op.conf-dist ${DESTDIR}${LOCALDIR}/etc/op.conf 18 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.conf 19 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.conf 20 | 21 | # /etc/op.d 22 | test -d ${DESTDIR}${LOCALDIR}/etc/op.d || 23 | mkdir ${DESTDIR}${LOCALDIR}/etc/op.d 24 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.d 25 | chmod 700 ${DESTDIR}${LOCALDIR}/etc/op.d 26 | 27 | # /etc/op.d/* 28 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 29 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 30 | 31 | # eof 32 | -------------------------------------------------------------------------------- /contrib/hpux1100/op.postremove: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | set -e 4 | 5 | PATH=${SW_PATH}:/sbin:/usr/bin:/usr/ccs/sbin 6 | 7 | DESTDIR=${DESTDIR:-} 8 | [ ${DESTDIR} = '/' ] && DESTDIR= 9 | LOCALDIR=/usr/local 10 | [ -n ${LOCALDIR} ] && USERDIR=${LOCALDIR} || USERDIR=/usr 11 | 12 | rm -f ${DESTDIR}${USERDIR}/bin/op ${DESTDIR}${USERDIR}/share/man/man1/op.1 13 | 14 | # eof 15 | -------------------------------------------------------------------------------- /contrib/hpux1100/op.psf: -------------------------------------------------------------------------------- 1 | # PSF file for /usr/contrib 1/14/97 2 | # 3 | # 4 | # Useful Commands: 5 | # 6 | # swpackage -p -vv -s /depot/psf_files/op.psf -d /depot/s700_contrib 7 | # swmodify -p -d -vv -s /depot/psf_files/op.psf op @ /depot/s700_contrib 8 | # swremove -p -v -d op,r=yyy @ /depot/s700_contrib 9 | # swinstall -p -v -s /depot/s700_contrib op 10 | # 11 | # 12 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 13 | # 14 | # This section is optional -- delete it if you don't want it. 15 | # 16 | vendor 17 | tag RATP 18 | title "Linux operations at RATP" 19 | #description "" 20 | end 21 | # 22 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 23 | # 24 | # Describe the product below. Search and replace the op. Delete 25 | # what you don't use. Either define filesets by file or by whole directory. 26 | # 27 | product 28 | tag OP 29 | title "Controlled privilege escalation (a flexible alternative to sudo)" 30 | description "Controlled privilege escalation (a flexible alternative to sudo)" 31 | revision 1.34 32 | # 33 | architecture S700/S800_HPUX_11 34 | machine_type 9000/[78]* 35 | os_name HP-UX 36 | os_release ?.11.* 37 | os_version * 38 | # 39 | fileset 40 | tag op 41 | title "op executables" 42 | revision 1.34 43 | 44 | file -u 0177 -g root -o root usr/local/etc/op.conf-dist /usr/local/etc/op.conf-dist 45 | file -m 4755 -g bin -o root usr/local/bin/op /usr/local/bin/op 46 | file -u 0333 -g bin -o bin usr/local/share/man/man1/op.1 /usr/local/share/man/man1/op.1 47 | postinstall op.postinstall 48 | postremove op.postremove 49 | end 50 | end 51 | 52 | -------------------------------------------------------------------------------- /contrib/hpux1111/.gitignore: -------------------------------------------------------------------------------- 1 | *.depot 2 | usr/ 3 | -------------------------------------------------------------------------------- /contrib/hpux1111/README: -------------------------------------------------------------------------------- 1 | create a datastream package named op-0.2-HP-UX.depot 2 | # /usr/sbin/swpackage -sop.psf -dop-0.2-HP-UX.depot -xtarget_type=tape 3 | 4 | install it 5 | # swinstall -s `pwd`/op-0.2-HP-UX.depot \* 6 | 7 | -------------------------------------------------------------------------------- /contrib/hpux1111/op.postinstall: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | set -e 4 | 5 | PATH=${SW_PATH}:/sbin:/usr/bin:/usr/ccs/sbin 6 | 7 | DESTDIR=${DESTDIR:-${SW_ROOT_DIRECTORY:-}} 8 | [ ${DESTDIR} = '/' ] && DESTDIR= 9 | LOCALDIR=/usr/local 10 | [ -n ${LOCALDIR} ] && USERDIR=${LOCALDIR} || USERDIR=/usr 11 | 12 | CFGOWN=root 13 | CFGGRP=root 14 | 15 | # /etc/op.conf 16 | test -f ${DESTDIR}${LOCALDIR}/etc/op.conf || 17 | cp ${DESTDIR}${LOCALDIR}/etc/op.conf-dist ${DESTDIR}${LOCALDIR}/etc/op.conf 18 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.conf 19 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.conf 20 | 21 | # /etc/op.d 22 | test -d ${DESTDIR}${LOCALDIR}/etc/op.d || 23 | mkdir ${DESTDIR}${LOCALDIR}/etc/op.d 24 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.d 25 | chmod 700 ${DESTDIR}${LOCALDIR}/etc/op.d 26 | 27 | # /etc/op.d/* 28 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 29 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 30 | 31 | # eof 32 | -------------------------------------------------------------------------------- /contrib/hpux1111/op.postremove: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | set -e 4 | 5 | PATH=${SW_PATH}:/sbin:/usr/bin:/usr/ccs/sbin 6 | 7 | DESTDIR=${DESTDIR:-} 8 | [ ${DESTDIR} = '/' ] && DESTDIR= 9 | LOCALDIR=/usr/local 10 | [ -n ${LOCALDIR} ] && USERDIR=${LOCALDIR} || USERDIR=/usr 11 | 12 | rm -f ${DESTDIR}${USERDIR}/bin/op ${DESTDIR}${USERDIR}/share/man/man1/op.1 13 | 14 | # eof 15 | -------------------------------------------------------------------------------- /contrib/hpux1111/op.psf: -------------------------------------------------------------------------------- 1 | # PSF file for /usr/contrib 1/14/97 2 | # 3 | # 4 | # Useful Commands: 5 | # 6 | # swpackage -p -vv -s /depot/psf_files/op.psf -d /depot/s700_contrib 7 | # swmodify -p -d -vv -s /depot/psf_files/op.psf op @ /depot/s700_contrib 8 | # swremove -p -v -d op,r=yyy @ /depot/s700_contrib 9 | # swinstall -p -v -s /depot/s700_contrib op 10 | # 11 | # 12 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 13 | # 14 | # This section is optional -- delete it if you don't want it. 15 | # 16 | vendor 17 | tag RATP 18 | title "Linux operations at RATP" 19 | #description "" 20 | end 21 | # 22 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 23 | # 24 | # Describe the product below. Search and replace the op. Delete 25 | # what you don't use. Either define filesets by file or by whole directory. 26 | # 27 | product 28 | tag OP 29 | title "Controlled privilege escalation (a flexible alternative to sudo)" 30 | description "Controlled privilege escalation (a flexible alternative to sudo)" 31 | revision 1.34 32 | # 33 | architecture S700/S800_HPUX_11 34 | machine_type 9000/[78]* 35 | os_name HP-UX 36 | os_release ?.11.* 37 | os_version * 38 | # 39 | fileset 40 | tag op 41 | title "op executables" 42 | revision 1.34 43 | 44 | file -u 0177 -g root -o root usr/local/etc/op.conf-dist /usr/local/etc/op.conf-dist 45 | file -m 4755 -g bin -o root usr/local/bin/op /usr/local/bin/op 46 | file -u 0333 -g bin -o bin usr/local/share/man/man1/op.1 /usr/local/share/man/man1/op.1 47 | postinstall op.postinstall 48 | postremove op.postremove 49 | end 50 | end 51 | 52 | -------------------------------------------------------------------------------- /contrib/linux/.gitignore: -------------------------------------------------------------------------------- 1 | *.rpm 2 | -------------------------------------------------------------------------------- /contrib/linux/op.spec: -------------------------------------------------------------------------------- 1 | # Upstream: Corey Henderson 2 | 3 | %define _with_pam 1 4 | #define _with_shadow 1 5 | %define _with_xauth 1 6 | #define _with_x11 1 7 | 8 | Summary: Controlled privilege escalation (a flexible alternative to sudo) 9 | Name: op 10 | Version: 1.34 11 | Release: 1%{?dist} 12 | License: GPL 13 | Group: System Environment/Base 14 | URL: https://github.com/dagwieers/op/ 15 | Packager: Alec Thomas 16 | #Source: https://github.com/dagwieers/op/archive/%{version}.tar.gz 17 | Source: file:///../../op-%{version}.tar.gz 18 | NoSource: 0 19 | 20 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root 21 | 22 | %description 23 | Op is a tool for allowing users to run root privileged commands 24 | without the root password. 25 | 26 | # ---------------------------------------------------------------------- 27 | %prep 28 | %setup 29 | 30 | # ---------------------------------------------------------------------- 31 | %build 32 | %configure --target=%{_target} \ 33 | %{?_with_pam:--with-pam} %{?_with_shadow:--with-shadow} \ 34 | %{?_with_xauth:--enable-xauth=/usr/bin%{?_with_x11:/X11}/xauth} 35 | %{__make} %{?_smp_mflags} 36 | 37 | # ---------------------------------------------------------------------- 38 | %install 39 | %{__rm} -rf %{buildroot} # RHEL5 40 | %{__make} install DESTDIR=%{?buildroot} 41 | #%{__install} -p -d -m 700 %{buildroot}%{_sysconfdir}/op.d/ 42 | %{__install} -p -d %{buildroot}%{_sysconfdir}/pam.d/ 43 | #%{__install} -p -m 600 op.conf-dist %{buildroot}%{_sysconfdir}/op.conf 44 | cat << EOF > %{buildroot}%{_sysconfdir}/pam.d/op 45 | #%PAM-1.0 46 | # 47 | #auth sufficient pam_rootok.so 48 | # Uncomment the following line to implicitly trust users in the "wheel" group. 49 | #auth sufficient pam_wheel.so trust use_uid 50 | # Uncomment the following line to require a user to be in the "wheel" group. 51 | #auth required pam_wheel.so use_uid 52 | # 53 | auth include system-auth 54 | # 55 | account sufficient pam_succeed_if.so uid = 0 use_uid quiet 56 | # 57 | # 58 | account include system-auth 59 | password include system-auth 60 | #session required pam_limits.so 61 | # 62 | # 63 | #session optional pam_xauth.so 64 | # 65 | EOF 66 | 67 | %clean 68 | %{__rm} -rf %{buildroot} 69 | 70 | #%pre 71 | #%pre_control op 72 | #%pre_control op.conf 73 | 74 | %post 75 | # /etc/op.d 76 | case %{_sysconfdir}/op.d/* in */\*) ;; *) 77 | chown root:root %{_sysconfdir}/op.d/* || : set -e 78 | chmod 600 %{_sysconfdir}/op.d/* || : set -e 79 | esac 80 | #%post_control -s wheelonly op 81 | #%post_control -s strict op.conf 82 | 83 | # ---------------------------------------------------------------------- 84 | %files 85 | # %defattr(-, root, root, -) 86 | %dir %{_sysconfdir}/pam.d 87 | %config(noreplace) %{_sysconfdir}/pam.d/op 88 | # %caps(cap_linux_immutable) 89 | %attr(600,root,root) %{_sysconfdir}/op.conf-dist 90 | %attr(600,root,root) %config(noreplace) %{_sysconfdir}/op.conf 91 | %attr(700, root, root) %dir %{_sysconfdir}/op.d 92 | %attr(4511, root, root) %{_bindir}/op 93 | %{_mandir}/man1/op.1* 94 | %doc AUTHORS ChangeLog COPYING INSTALL README 95 | %doc op.conf.complex 96 | 97 | %changelog 98 | * Fri Jun 5 2012 Alec Thomas - 1.34 99 | - Initial package. 100 | -------------------------------------------------------------------------------- /contrib/mkpkg: -------------------------------------------------------------------------------- 1 | [[ -n ${pkg} ]] || exit 2 | 3 | #pkg=xxx 4 | #ver=vXX.YY.ZZ 5 | ext=${ext:-tar.gz} 6 | inc=${inc:-.} 7 | exc=${exc+|${exc}} 8 | usr=${usr:-exploit} 9 | grp=${grp:-expl} 10 | dir=${dir:-${pkg}} 11 | user=${user:-esxide} 12 | host=${host:-recife} 13 | post=${post:-} 14 | rdir=${rdir:-/home/ftp/diffusion/exploitation/${pkg}/futur} 15 | now=$(date +%Y%m%d%H%M%S) 16 | 17 | sudo rm -rf /tmp/${pkg}_${ver} 18 | mkdir -p /tmp/${pkg}_${ver}/${dir} 19 | find ${inc} | 20 | egrep -v "\.#|~$|\.swp|\.gitignore|mkpkg${exc}" | 21 | cpio -pdm /tmp/${pkg}_${ver}/${dir} 22 | sudo chown -Rh ${usr}:${grp} /tmp/${pkg}_${ver}/${dir} 23 | sudo chmod -R g-s /tmp/${pkg}_${ver}/${dir} 24 | eval "${post}" 25 | sudo tar zcf /tmp/${pkg}_${ver}.${ext} -C /tmp/${pkg}_${ver} ${dir} 26 | tar zvtf /tmp/${pkg}_${ver}.${ext} 27 | sftp -o LogLevel=ERROR ${user}@${host} << EOF 28 | put /tmp/${pkg}_${ver}.${ext} ${rdir}/${pkg}_${ver}.${ext} 29 | ls -l ${rdir} 30 | quit 31 | EOF 32 | sudo rm -rf /tmp/${pkg}_${ver} 33 | -------------------------------------------------------------------------------- /contrib/solaris/.gitignore: -------------------------------------------------------------------------------- 1 | RATPop 2 | *.pkg 3 | usr/ 4 | -------------------------------------------------------------------------------- /contrib/solaris/RATPop.admin: -------------------------------------------------------------------------------- 1 | mail= 2 | instance=overwrite 3 | partial=nocheck 4 | runlevel=nocheck 5 | idepend=quit 6 | rdepend=quit 7 | space=quit 8 | setuid=nocheck 9 | conflict=quit 10 | action=nocheck 11 | networktimeout=60 12 | networkretries=3 13 | authentication=quit 14 | keystore=/var/sadm/security 15 | proxy= 16 | basedir=default 17 | -------------------------------------------------------------------------------- /contrib/solaris/README: -------------------------------------------------------------------------------- 1 | copy the op binary to the bin directory 2 | 3 | # pkgmk -d `pwd` 4 | will create the package op in directory format 5 | # pkgtrans `pwd` op.pkg op 6 | will create the package op.pkg in datastream format 7 | -------------------------------------------------------------------------------- /contrib/solaris/pkginfo: -------------------------------------------------------------------------------- 1 | PKG="RATPop" 2 | NAME="op" 3 | CATEGORY="application" 4 | ARCH="sparc" 5 | VERSION="1.34" 6 | BASEDIR=/ 7 | VENDOR="not for sale" 8 | DESC="Controlled privilege escalation (a flexible alternative to sudo)" 9 | EMAIL="" 10 | HOTLINE="Please contact your local service provider" 11 | -------------------------------------------------------------------------------- /contrib/solaris/postinstall: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | set -e 4 | 5 | DESTDIR=${DESTDIR:-${BASEDIR:-}} 6 | [ ${DESTDIR} = '/' ] && DESTDIR= 7 | LOCALDIR=/usr/local 8 | [ -n ${LOCALDIR} ] && USERDIR=${LOCALDIR} || USERDIR=/usr 9 | 10 | CFGOWN=root 11 | CFGGRP=sys 12 | 13 | # /etc/op.conf 14 | test -f ${DESTDIR}${LOCALDIR}/etc/op.conf || 15 | cp ${DESTDIR}${LOCALDIR}/etc/op.conf-dist ${DESTDIR}${LOCALDIR}/etc/op.conf 16 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.conf 17 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.conf 18 | 19 | # /etc/op.d/* 20 | case ${DESTDIR}${LOCALDIR}/etc/op.d/* in */\*) ;; *) 21 | chown ${CFGOWN}:${CFGGRP} ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 22 | chmod 600 ${DESTDIR}${LOCALDIR}/etc/op.d/* || : set -e 23 | esac 24 | 25 | # eof 26 | -------------------------------------------------------------------------------- /contrib/solaris/prototype: -------------------------------------------------------------------------------- 1 | i pkginfo 2 | i postinstall 3 | d none usr ? ? ? 4 | d none usr/local/bin ? ? ? 5 | d none usr/local/etc ? ? ? 6 | d none usr/local/share ? ? ? 7 | d none usr/local/share/man ? ? ? 8 | d none usr/local/share/man/man1 ? ? ? 9 | d none usr/local/etc/op.d 0700 root sys 10 | f none usr/local/bin/op=usr/local/bin/op 4511 root sys 11 | f none usr/local/etc/op.conf-dist=usr/local/etc/op.conf-dist 0600 root sys 12 | f none usr/local/share/man/man1/op.1=usr/local/share/man/man1/op.1 0444 root bin 13 | -------------------------------------------------------------------------------- /defs.h: -------------------------------------------------------------------------------- 1 | /* +-------------------------------------------------------------------+ */ 2 | /* | Copyright 1991, David Koblas. | */ 3 | /* | Permission to use, copy, modify, and distribute this software | */ 4 | /* | and its documentation for any purpose and without fee is hereby | */ 5 | /* | granted, provided that the above copyright notice appear in all | */ 6 | /* | copies and that both that copyright notice and this permission | */ 7 | /* | notice appear in supporting documentation. This software is | */ 8 | /* | provided "as is" without express or implied warranty. | */ 9 | /* +-------------------------------------------------------------------+ */ 10 | 11 | #ifndef _DEFS_H_ 12 | #define _DEFS_H_ 13 | 14 | #include "config.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #if HAVE_MALLOC == 0 22 | # ifdef malloc 23 | # undef malloc 24 | # define rpl_malloc 25 | # endif 26 | # ifdef realloc 27 | # undef realloc 28 | # define rpl_realloc 29 | # endif 30 | #endif 31 | #include 32 | #if HAVE_MALLOC == 0 33 | # ifdef rpl_malloc 34 | # undef rpl_malloc 35 | # define malloc rpl_malloc 36 | # endif 37 | # ifdef rpl_realloc 38 | # undef rpl_realloc 39 | # define realloc rpl_realloc 40 | # endif 41 | #endif 42 | 43 | #include 44 | 45 | #ifdef TIME_WITH_SYS_TIME 46 | # include 47 | # include 48 | #else 49 | # ifdef HAVE_SYS_TIME_H 50 | # include 51 | # else 52 | # include 53 | # endif 54 | #endif 55 | 56 | #ifdef HAVE_DIRENT_H 57 | # include 58 | # define NAMLEN(dirent) strlen((dirent)->d_name) 59 | #else 60 | # define dirent direct 61 | # define NAMLEN(dirent) (dirent)->d_namlen 62 | # ifdef HAVE_SYS_NDIR_H 63 | # include 64 | # endif 65 | # ifdef HAVE_SYS_DIR_H 66 | # include 67 | # endif 68 | # ifdef HAVE_NDIR_H 69 | # include 70 | # endif 71 | #endif 72 | 73 | #include 74 | #ifdef HAVE_SYS_WAIT_H 75 | # include 76 | #endif 77 | #ifndef WEXITSTATUS 78 | # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) 79 | #endif 80 | #ifndef WIFEXITED 81 | # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) 82 | #endif 83 | 84 | #ifdef STDC_HEADERS 85 | # include 86 | #else 87 | # ifndef HAVE_STRCHR 88 | # define strchr index 89 | # define strrchr rindex 90 | # endif 91 | char *strchr(), *strrchr(); 92 | # ifndef HAVE_MEMCPY 93 | # define memcpy(d, s, n) bcopy ((s), (d), (n)) 94 | # define memmove(d, s, n) bcopy ((s), (d), (n)) 95 | # endif 96 | #endif 97 | 98 | #ifdef HAVE_LIBBSD 99 | #include 100 | #else 101 | # ifndef HAVE_STRLCAT 102 | size_t strlcat(char *dst, const char *src, size_t siz); 103 | size_t strlcpy(char *dst, const char *src, size_t siz); 104 | # endif 105 | #endif 106 | 107 | #ifndef HAVE_VSNPRINTF 108 | int snprintf(char *str, size_t size, const char *format, ...); 109 | int vsnprintf(char *str, size_t size, const char *format, va_list arg); 110 | #endif 111 | 112 | #ifndef MIN 113 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 114 | #endif 115 | 116 | #define UNUSED(x) (void)(x) 117 | 118 | #ifdef malloc 119 | void *rpl_malloc(size_t n); 120 | #endif 121 | #ifdef realloc 122 | void *rpl_realloc(void *ptr, size_t n); 123 | #endif 124 | 125 | typedef struct cmd_s { 126 | char *name; 127 | size_t nargs, nopts; 128 | size_t margs, mopts; 129 | char **args, **opts; 130 | struct cmd_s *next; 131 | } cmd_t; 132 | 133 | typedef struct var_s { 134 | char *name, *value; 135 | struct var_s *next; 136 | } var_t; 137 | 138 | typedef struct array_s { 139 | void **data; 140 | size_t size, capacity; 141 | } array_t; 142 | 143 | /* functions to manage a dynamically extensible array of pointers */ 144 | #define ARRAY_CHUNK 32 145 | array_t *array_alloc(void); 146 | void array_free(array_t * array); 147 | array_t *array_free_contents(array_t * array); 148 | void *array_push(array_t * array, void *object); 149 | void *array_pop(array_t * array); 150 | int array_extend(array_t * array, size_t capacity); 151 | 152 | char *savestr(const char *str); 153 | cmd_t *Build(cmd_t * def, cmd_t * cmd); 154 | cmd_t *BuildSingle(cmd_t * def, cmd_t * cmd); 155 | 156 | extern cmd_t *First; 157 | extern var_t *Variables; 158 | 159 | /* cppcheck-suppress noreturn */ 160 | int logger(unsigned level, const char *format, ...); 161 | void fatal(int logit, const char *format, ...); 162 | char *strtolower(char *in); 163 | /* NOLINTNEXTLINE(runtime/int) */ 164 | long strtolong(const char *str, int base); 165 | 166 | int ReadFile(const char *file); 167 | int CountArgs(cmd_t * cmd); 168 | 169 | #define MAXSTRLEN 2048 170 | #ifndef SYSCONFDIR 171 | #define SYSCONFDIR "/etc" 172 | #endif 173 | #define OP_ACCESS SYSCONFDIR "/op.conf" 174 | #define OP_ACCESS_DIR SYSCONFDIR "/op.d" 175 | 176 | #define VAR_EXPAND_LEN 8192 177 | #define VAR_NAME_LEN 64 178 | 179 | #ifndef HOST_NAME_MAX 180 | #define HOST_NAME_MAX 255 181 | #endif 182 | 183 | #ifndef PASS_MAX 184 | #define PASS_MAX 512 185 | #endif 186 | 187 | #endif /* !_DEFS_H_ */ 188 | -------------------------------------------------------------------------------- /lex.l: -------------------------------------------------------------------------------- 1 | %{ 2 | /* +-------------------------------------------------------------------+ */ 3 | /* | Copyright 1991, David Koblas. | */ 4 | /* | Permission to use, copy, modify, and distribute this software | */ 5 | /* | and its documentation for any purpose and without fee is hereby | */ 6 | /* | granted, provided that the above copyright notice appear in all | */ 7 | /* | copies and that both that copyright notice and this permission | */ 8 | /* | notice appear in supporting documentation. This software is | */ 9 | /* | provided "as is" without express or implied warranty. | */ 10 | /* +-------------------------------------------------------------------+ */ 11 | 12 | #include "defs.h" 13 | #include 14 | 15 | #ifndef NDEBUG 16 | #define _msg(x) 17 | #else 18 | #define _msg(x) msg x 19 | static void msg(const char *format, ...); 20 | #endif 21 | static char *expandvars(const char *instr); 22 | static void preprocerror(const char *str); 23 | static void preproc(const char *str); 24 | static void addvar(const char *str); 25 | static void addquotedarg(int state, cmd_t * cmd, const char *instr); 26 | static void addarg(int state, cmd_t * cmd, const char *instr); 27 | static cmd_t *alloccmd(const char *name); 28 | static void freecmd(cmd_t * cmd); 29 | static cmd_t *newcmd(const char *name); 30 | #ifdef NUNUSED 31 | static int cmpopts(const char *a, const char *b); 32 | static void sortopts(cmd_t * cmd); 33 | #endif 34 | 35 | int yyline = 1; 36 | 37 | #define YY_NO_INPUT 38 | 39 | %} 40 | 41 | WS [ \t]* 42 | NWS [^ \n\t;]+ 43 | 44 | %s ARGS 45 | %a 2700 46 | %o 3700 47 | 48 | %option nounput 49 | 50 | %% 51 | int state = 0; 52 | cmd_t *cmd = NULL; 53 | 54 | #[^\n]* ; 55 | ^%(((if|elsif)[ \t]+.*)|(else|endif)) { preproc(yytext); } 56 | ^%.* { preprocerror(yytext); } 57 | \n { yyline++; BEGIN 0; } 58 | ^[A-Z_][A-Z_0-9]*=[^\n\r]* { addvar(yytext); } 59 | ^[^ \n\t]+ { cmd = newcmd(yytext); 60 | state = strcmp(yytext, "DEFAULT") == 0 ? 1 : 0; 61 | BEGIN ARGS; } 62 | ^{WS} BEGIN ARGS; 63 | ";" state++; 64 | ([^ \n\t'"]*'(\\.|[^'])*')+ addquotedarg(state, cmd, yytext); 65 | ([^ \n\t'"]*\"(\\.|[^\"])*\")+ addquotedarg(state, cmd, yytext); 66 | {NWS} addarg(state, cmd, yytext); 67 | {WS} ; 68 | %% 69 | /* ' for emacs */ 70 | 71 | #include 72 | #include 73 | #include 74 | 75 | #ifdef NDEBUG 76 | static void 77 | msg(const char *format, ...) 78 | { 79 | va_list ap; 80 | char *s; 81 | 82 | va_start(ap); 83 | s = va_arg(ap, char *); 84 | fprintf(stderr, "line %d: ", yyline); 85 | /* Flawfinder: ignore (vfprintf) */ 86 | vfprintf(stderr, s, ap); 87 | fputc('\n', stderr); 88 | va_end(ap); 89 | } 90 | #endif 91 | 92 | static char * 93 | expandvars(const char *instr) 94 | { 95 | char *str = (char *)malloc(VAR_EXPAND_LEN); 96 | size_t i = 0; 97 | 98 | if (str == NULL) 99 | fatal(1, "Unable to allocate variable expansion buffer"); 100 | 101 | while (*instr) 102 | if (isupper((int)*instr) || *instr == '_') { 103 | const char *mark = instr; 104 | var_t *var; 105 | 106 | while (*instr && 107 | (isupper((int)*instr) || isdigit((int)*instr) || 108 | *instr == '_')) 109 | ++instr; 110 | for (var = Variables; var != 0; var = var->next) { 111 | /* Flawfinder: ignore (strlen) */ 112 | size_t l = strlen(var->name); 113 | 114 | if ((size_t) (instr - mark) > l) 115 | l = (size_t) (instr - mark); 116 | if (!strncmp(mark, var->name, l)) { 117 | str[i] = 0; 118 | /* Flawfinder: fix (strcat) */ 119 | strlcat(str, var->value, VAR_EXPAND_LEN); 120 | /* Flawfinder: ignore (strlen) */ 121 | i += strlen(var->value); 122 | break; 123 | } 124 | } 125 | if (!var) { 126 | instr = mark + 1; 127 | str[i++] = *mark; 128 | } 129 | } else 130 | str[i++] = *instr++; 131 | str[i] = 0; 132 | return str; 133 | } 134 | 135 | static void 136 | preprocerror(const char *str) 137 | { 138 | fprintf(stderr, "Invalid preprocessor command '%s'\n", str); 139 | exit(1); 140 | } 141 | 142 | static void 143 | preproc(const char *str) 144 | { 145 | if (!strncmp(str, "%if", 3)) { 146 | } else if (!strncmp(str, "%elseif", 7)) { 147 | } else if (!strcmp(str, "%else")) { 148 | } else if (!strcmp(str, "%endif")) { 149 | } else 150 | preprocerror(str); 151 | } 152 | 153 | static void 154 | addvar(const char *str) 155 | { 156 | /* Flawfinder: ignore (char) */ 157 | /* cppcheck-suppress variableScope */ 158 | char name[VAR_NAME_LEN], value[VAR_EXPAND_LEN]; 159 | const char *eq = strchr(str, '='); 160 | 161 | if (eq && str - eq < VAR_NAME_LEN) { 162 | size_t i, o, len; 163 | var_t *var; 164 | 165 | /* Flawfinder: fix (strncpy) */ 166 | strlcpy(name, str, MIN((size_t) (eq - str + 1), sizeof(name))); 167 | 168 | for (o = 0, i = (size_t) (eq - str + 1); 169 | o < VAR_EXPAND_LEN - 1 && str[i]; ++i) 170 | if (str[i] == '\\') { 171 | switch (str[++i]) { 172 | case 'n': 173 | value[o++] = '\n'; 174 | break; 175 | case 'r': 176 | value[o++] = '\r'; 177 | break; 178 | case 't': 179 | value[o++] = '\t'; 180 | break; 181 | case 'a': 182 | value[o++] = '\a'; 183 | break; 184 | case 'b': 185 | value[o++] = '\b'; 186 | break; 187 | default: 188 | value[o++] = str[i]; 189 | break; 190 | } 191 | } else if (str[i] == '"') 192 | break; 193 | else 194 | value[o++] = str[i]; 195 | value[o++] = 0; 196 | 197 | if ((var = (var_t *) malloc(sizeof(var_t))) == NULL) 198 | fatal(1, "Unable to allocate var_t"); 199 | /* Flawfinder: fix (strlen) */ 200 | len = strlen(name) + 1; 201 | if ((var->name = malloc(len)) == NULL) /* expected-warning */ 202 | fatal(1, "Unable to allocate variable name"); 203 | /* Flawfinder: fix (strcpy) */ 204 | strlcpy(var->name, name, len); 205 | var->value = expandvars(value); 206 | var->next = 0; 207 | 208 | if (Variables) { 209 | var_t *v; 210 | 211 | for (v = Variables; v->next; v = v->next) ; 212 | v->next = var; 213 | } else 214 | Variables = var; 215 | } else 216 | fatal(1, "Invalid alias"); 217 | } 218 | 219 | static void 220 | addquotedarg(int state, cmd_t * cmd, const char *instr) 221 | { 222 | /* Flawfinder: ignore (char) */ 223 | char buffer[MAXSTRLEN]; 224 | size_t i, o, q; 225 | 226 | /* Flawfinder: ignore (strlen) */ 227 | if (strlen(instr) + 2 > MAXSTRLEN) { 228 | fatal(1, "Quoted argument too long\n"); 229 | exit(1); 230 | } 231 | for (o = 0; !strchr("'\"", instr[o]); ++o) 232 | buffer[o] = instr[o]; 233 | q = o; 234 | 235 | for (i = o + 1; instr[i] && instr[i] != instr[q]; ++i, ++o) { 236 | if (instr[i] == '\\') { 237 | int c = instr[++i]; 238 | 239 | if (strchr("'\"", c)) { 240 | buffer[o] = (char)c; 241 | } else { 242 | buffer[o++] = '\\'; 243 | buffer[o] = (char)c; 244 | } 245 | } else 246 | buffer[o] = instr[i]; 247 | } 248 | buffer[o] = 0; 249 | addarg(state, cmd, buffer); 250 | } 251 | 252 | static void 253 | addarg(int state, cmd_t * cmd, const char *instr) 254 | { 255 | char *str = expandvars(instr); 256 | 257 | if (state == 0) { 258 | _msg(("cmd='%s' add arg '%s'", cmd->name, str)); 259 | if (cmd->margs == cmd->nargs) { 260 | cmd->margs += cmd->margs; 261 | cmd->args = (char **)realloc(cmd->args, 262 | sizeof(char *) * cmd->margs); 263 | if (cmd->args == NULL) 264 | fatal(1, "Unable to groupw args"); 265 | } 266 | cmd->args[cmd->nargs++] = savestr(str); 267 | } else if (state == 1) { 268 | _msg(("cmd='%s' add opt '%s'", cmd->name, str)); 269 | if (cmd->mopts == cmd->nopts) { 270 | cmd->mopts += cmd->mopts; 271 | cmd->opts = (char **)realloc(cmd->opts, 272 | sizeof(char *) * cmd->mopts); 273 | if (cmd->opts == NULL) 274 | fatal(1, "Unable to groupw opts"); 275 | } 276 | cmd->opts[cmd->nopts++] = savestr(str); 277 | } else { 278 | fatal(1, "bad state (%d) received\n", state); 279 | } 280 | free(str); 281 | } 282 | 283 | char * 284 | savestr(const char *str) 285 | { 286 | /* Flawfinder: ignore (strlen) */ 287 | size_t len = strlen(str) + 1; 288 | char *s = (char *)malloc(len); 289 | 290 | if (s == NULL) 291 | fatal(1, "No string space"); 292 | 293 | /* Flawfinder: fix (strcpy) */ 294 | strlcpy(s, str, len); 295 | return s; 296 | } 297 | 298 | static cmd_t * 299 | alloccmd(const char *name) 300 | { 301 | cmd_t *cmd = (cmd_t *) malloc(sizeof(cmd_t)); 302 | 303 | if (cmd == NULL) 304 | fatal(1, "Unable to alloc space for new command"); 305 | 306 | cmd->name = savestr(name); 307 | cmd->nargs = 0; 308 | cmd->margs = 16; 309 | cmd->nopts = 0; 310 | cmd->mopts = 16; 311 | cmd->args = (char **)malloc(sizeof(char *) * cmd->margs); 312 | cmd->opts = (char **)malloc(sizeof(char *) * cmd->mopts); 313 | 314 | if (cmd->args == NULL || cmd->opts == NULL) 315 | fatal(1, "Unable to alloc args/opts"); 316 | 317 | return cmd; 318 | } 319 | 320 | static void 321 | freecmd(cmd_t * cmd) 322 | { 323 | if (cmd == NULL) 324 | return; 325 | 326 | free(cmd->name); 327 | free(cmd->args); 328 | free(cmd->opts); 329 | free(cmd); 330 | } 331 | 332 | static cmd_t * 333 | newcmd(const char *name) 334 | { 335 | cmd_t *cmd = alloccmd(name); 336 | 337 | cmd->next = First; 338 | First = cmd; 339 | 340 | return cmd; 341 | } 342 | 343 | int 344 | ReadFile(const char *file) 345 | { 346 | struct stat statbuf; 347 | FILE *fd; 348 | 349 | if ((stat(file, &statbuf) < 0)) 350 | return 0; 351 | if ((statbuf.st_uid != 0) || /* Owned by root */ 352 | ((statbuf.st_mode & 0077) != 0)) { /* SD - no perm */ 353 | logger(LOG_ERR, "Permission problems on %s", file); 354 | return 0; 355 | } 356 | /* Flawfinder: ignore (fopen) race condition */ 357 | if ((fd = fopen(file, "r")) == NULL) 358 | return 0; 359 | 360 | yyin = fd; 361 | yylex(); 362 | 363 | return 1; 364 | } 365 | 366 | int 367 | CountArgs(cmd_t * cmd) 368 | { 369 | size_t i; 370 | /* NOLINTNEXTLINE(runtime/int) */ 371 | long val, max = 0; 372 | int wild = 0; 373 | /* Flawfinder: ignore (char) */ 374 | /* cppcheck-suppress variableScope */ 375 | char *cp, *np, str[MAXSTRLEN]; 376 | 377 | for (i = 0; i < cmd->nargs; i++) { 378 | np = cmd->args[i]; 379 | 380 | while ((cp = strchr(np, '$')) != NULL) { 381 | if ((cp != cmd->args[i]) && (*(cp - 1) == '\\')) 382 | np = cp + 1; 383 | else { 384 | if (*(cp + 1) == '*') { 385 | wild = 1; 386 | ++cp; 387 | np = cp; 388 | continue; 389 | } 390 | cp++; 391 | np = cp; 392 | 393 | while (isdigit((int)*cp)) 394 | cp++; 395 | if ((cp - np) == 0) 396 | continue; 397 | /* Flawfinder: fix (strncpy) */ 398 | strlcpy(str, np, MIN((size_t) (cp - np + 1), sizeof(str))); 399 | /* Flawfinder: fix (atoi -> strtolong) */ 400 | val = strtolong(str, 10); 401 | if (val > max) 402 | max = val; 403 | } 404 | } 405 | } 406 | 407 | if (wild) 408 | return (int)-max; 409 | return (int)max; 410 | } 411 | 412 | #ifdef NUNUSED 413 | static int 414 | cmpopts(const char *a, const char *b) 415 | { 416 | char *cp_a, *cp_b; 417 | /* NOLINTNEXTLINE(runtime/int) */ 418 | long val_a, val_b; 419 | /* Flawfinder: ignore (char) */ 420 | char str_a[MAXSTRLEN], str_b[MAXSTRLEN]; 421 | 422 | if (*a != '$' && *b != '$') 423 | return 0; 424 | if (*a == '$' && *b != '$') 425 | return -1; 426 | if (*a != '$' && *b == '$') 427 | return 1; 428 | 429 | cp_a = ++a; 430 | cp_b = ++b; 431 | while ((*cp_a != '\0') && (*cp_a != '=')) 432 | if (!isdigit((int)*cp_a)) 433 | break; 434 | while ((*cp_b != '\0') && (*cp_b != '=')) 435 | if (!isdigit((int)*cp_b)) 436 | break; 437 | 438 | if (*cp_a != '=' && *cp_b != '=') 439 | return 0; 440 | if (*cp_a == '=' && *cp_b != '=') 441 | return -1; 442 | if (*cp_a != '=' && *cp_b == '=') 443 | return 1; 444 | 445 | /* flawfinder: fix (strncpy) */ 446 | strlcpy(str_a, a, MIN((size_t) (cp_a - a + 1), sizeof(str_a))); 447 | /* flawfinder: fix (atoi -> strtolong) */ 448 | val_a = strtolong(str_a, 10); 449 | /* flawfinder: fix (strncpy) */ 450 | strlcpy(str_b, b, MIN((size_t) (cp_b - a + 1), sizeof(str_b))); 451 | /* Flawfinder: fix (atoi -> strtolong) */ 452 | val_b = strtolong(str_b, 10); 453 | 454 | if (val_a < val_b) 455 | return -1; 456 | if (val_a > val_b) 457 | return 1; 458 | return 0; 459 | } 460 | 461 | static void 462 | sortopts(cmd_t * cmd) 463 | { 464 | qsort(cmd->opts, cmd->nopts, sizeof(char *), 465 | (int(*)(const void *, const void *))cmpopts); 466 | } 467 | #endif 468 | 469 | /* Build a new command but don't merge it into the global list */ 470 | cmd_t * 471 | BuildSingle(cmd_t * def, cmd_t * cmd) 472 | { 473 | cmd_t *new = alloccmd(cmd->name ? cmd->name : ""); 474 | /* Flawfinder: ignore (char) */ 475 | char defname[MAXSTRLEN], optname[MAXSTRLEN], *cp; 476 | size_t i, j; 477 | 478 | /* cppcheck-suppress nullPointer */ 479 | if (cmd == NULL) { 480 | freecmd(new); 481 | return def; 482 | } 483 | if (def == NULL) { 484 | freecmd(new); 485 | return cmd; 486 | } 487 | 488 | for (i = 0; i < cmd->nargs; i++) 489 | addarg(0, new, cmd->args[i]); 490 | 491 | for (i = 0; i < def->nopts; i++) { 492 | int skipped = 0; 493 | 494 | if ((cp = strchr(def->opts[i], '=')) == NULL) 495 | /* Flawfinder: fix (strcpy) */ 496 | strlcpy(defname, def->opts[i], sizeof(defname)); 497 | else { 498 | size_t l = (size_t) (cp - def->opts[i]); 499 | /* Flawfinder: fix (strncpy) */ 500 | strlcpy(defname, def->opts[i], MIN(l + 1, sizeof(defname))); 501 | } 502 | for (j = 0; j < cmd->nopts; j++) { 503 | if ((cp = strchr(cmd->opts[j], '=')) == NULL) 504 | /* Flawfinder: fix (strcpy) */ 505 | strlcpy(optname, cmd->opts[j], sizeof(optname)); 506 | else { 507 | size_t l = (size_t) (cp - cmd->opts[j]); 508 | /* Flawfinder: fix (strncpy) */ 509 | strlcpy(optname, cmd->opts[j], MIN(l + 1, sizeof(optname))); 510 | } 511 | if (strcmp(defname, optname) == 0) { 512 | skipped = 1; 513 | break; 514 | } 515 | } 516 | if (skipped) 517 | continue; 518 | if (def->opts[i][0] != '\0') 519 | addarg(1, new, def->opts[i]); 520 | } 521 | for (j = 0; j < cmd->nopts; j++) 522 | addarg(1, new, cmd->opts[j]); 523 | 524 | /* sortopts(new); */ 525 | 526 | return new; 527 | } 528 | 529 | /* Build a new command *and* merge it with the global command list */ 530 | cmd_t * 531 | Build(cmd_t * def, cmd_t * cmd) 532 | { 533 | cmd_t *new = BuildSingle(def, cmd); 534 | 535 | new->next = First; 536 | First = new; 537 | 538 | return new; 539 | } 540 | -------------------------------------------------------------------------------- /m4/ax_append_compile_flags.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # For every FLAG1, FLAG2 it is checked whether the compiler works with the 12 | # flag. If it does, the flag is added FLAGS-VARIABLE 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. During the check the flag is always added to the 16 | # current language's flags. 17 | # 18 | # If EXTRA-FLAGS is defined, it is added to the current language's default 19 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 20 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 21 | # force the compiler to issue an error when a bad flag is given. 22 | # 23 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 24 | # 25 | # NOTE: This macro depends on the AX_APPEND_FLAG and 26 | # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with 27 | # AX_APPEND_LINK_FLAGS. 28 | # 29 | # LICENSE 30 | # 31 | # Copyright (c) 2011 Maarten Bosmans 32 | # 33 | # This program is free software: you can redistribute it and/or modify it 34 | # under the terms of the GNU General Public License as published by the 35 | # Free Software Foundation, either version 3 of the License, or (at your 36 | # option) any later version. 37 | # 38 | # This program is distributed in the hope that it will be useful, but 39 | # WITHOUT ANY WARRANTY; without even the implied warranty of 40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 41 | # Public License for more details. 42 | # 43 | # You should have received a copy of the GNU General Public License along 44 | # with this program. If not, see . 45 | # 46 | # As a special exception, the respective Autoconf Macro's copyright owner 47 | # gives unlimited permission to copy, distribute and modify the configure 48 | # scripts that are the output of Autoconf when processing the Macro. You 49 | # need not follow the terms of the GNU General Public License when using 50 | # or distributing such scripts, even though portions of the text of the 51 | # Macro appear in them. The GNU General Public License (GPL) does govern 52 | # all other use of the material that constitutes the Autoconf Macro. 53 | # 54 | # This special exception to the GPL applies to versions of the Autoconf 55 | # Macro released by the Autoconf Archive. When you make and distribute a 56 | # modified version of the Autoconf Macro, you may extend this special 57 | # exception to the GPL to apply to your modified version as well. 58 | 59 | #serial 5 60 | 61 | AC_DEFUN([AX_APPEND_COMPILE_FLAGS], 62 | [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) 63 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 64 | for flag in $1; do 65 | AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) 66 | done 67 | ])dnl AX_APPEND_COMPILE_FLAGS 68 | -------------------------------------------------------------------------------- /m4/ax_append_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_append_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space 12 | # added in between. 13 | # 14 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. 15 | # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains 16 | # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly 17 | # FLAG. 18 | # 19 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. 20 | # 21 | # LICENSE 22 | # 23 | # Copyright (c) 2008 Guido U. Draheim 24 | # Copyright (c) 2011 Maarten Bosmans 25 | # 26 | # This program is free software: you can redistribute it and/or modify it 27 | # under the terms of the GNU General Public License as published by the 28 | # Free Software Foundation, either version 3 of the License, or (at your 29 | # option) any later version. 30 | # 31 | # This program is distributed in the hope that it will be useful, but 32 | # WITHOUT ANY WARRANTY; without even the implied warranty of 33 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 34 | # Public License for more details. 35 | # 36 | # You should have received a copy of the GNU General Public License along 37 | # with this program. If not, see . 38 | # 39 | # As a special exception, the respective Autoconf Macro's copyright owner 40 | # gives unlimited permission to copy, distribute and modify the configure 41 | # scripts that are the output of Autoconf when processing the Macro. You 42 | # need not follow the terms of the GNU General Public License when using 43 | # or distributing such scripts, even though portions of the text of the 44 | # Macro appear in them. The GNU General Public License (GPL) does govern 45 | # all other use of the material that constitutes the Autoconf Macro. 46 | # 47 | # This special exception to the GPL applies to versions of the Autoconf 48 | # Macro released by the Autoconf Archive. When you make and distribute a 49 | # modified version of the Autoconf Macro, you may extend this special 50 | # exception to the GPL to apply to your modified version as well. 51 | 52 | #serial 6 53 | 54 | AC_DEFUN([AX_APPEND_FLAG], 55 | [dnl 56 | AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF 57 | AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) 58 | AS_VAR_SET_IF(FLAGS,[ 59 | AS_CASE([" AS_VAR_GET(FLAGS) "], 60 | [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], 61 | [ 62 | AS_VAR_APPEND(FLAGS,[" $1"]) 63 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 64 | ]) 65 | ], 66 | [ 67 | AS_VAR_SET(FLAGS,[$1]) 68 | AC_RUN_LOG([: FLAGS="$FLAGS"]) 69 | ]) 70 | AS_VAR_POPDEF([FLAGS])dnl 71 | ])dnl AX_APPEND_FLAG 72 | -------------------------------------------------------------------------------- /m4/ax_append_link_flags.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # For every FLAG1, FLAG2 it is checked whether the linker works with the 12 | # flag. If it does, the flag is added FLAGS-VARIABLE 13 | # 14 | # If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is 15 | # used. During the check the flag is always added to the linker's flags. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags 18 | # when the check is done. The check is thus made with the flags: "LDFLAGS 19 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to 20 | # issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23 | # 24 | # NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG. 25 | # Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2011 Maarten Bosmans 30 | # 31 | # This program is free software: you can redistribute it and/or modify it 32 | # under the terms of the GNU General Public License as published by the 33 | # Free Software Foundation, either version 3 of the License, or (at your 34 | # option) any later version. 35 | # 36 | # This program is distributed in the hope that it will be useful, but 37 | # WITHOUT ANY WARRANTY; without even the implied warranty of 38 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 39 | # Public License for more details. 40 | # 41 | # You should have received a copy of the GNU General Public License along 42 | # with this program. If not, see . 43 | # 44 | # As a special exception, the respective Autoconf Macro's copyright owner 45 | # gives unlimited permission to copy, distribute and modify the configure 46 | # scripts that are the output of Autoconf when processing the Macro. You 47 | # need not follow the terms of the GNU General Public License when using 48 | # or distributing such scripts, even though portions of the text of the 49 | # Macro appear in them. The GNU General Public License (GPL) does govern 50 | # all other use of the material that constitutes the Autoconf Macro. 51 | # 52 | # This special exception to the GPL applies to versions of the Autoconf 53 | # Macro released by the Autoconf Archive. When you make and distribute a 54 | # modified version of the Autoconf Macro, you may extend this special 55 | # exception to the GPL to apply to your modified version as well. 56 | 57 | #serial 5 58 | 59 | AC_DEFUN([AX_APPEND_LINK_FLAGS], 60 | [AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 61 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 62 | for flag in $1; do 63 | AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4]) 64 | done 65 | ])dnl AX_APPEND_LINK_FLAGS 66 | -------------------------------------------------------------------------------- /m4/ax_cflags_aix_option.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_cflags_aix_option.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CFLAGS_AIX_OPTION (optionflag [,[shellvar][,[A][,[NA]]]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_CFLAGS_AIX_OPTION(-qubicle) would show a message as like "checking 12 | # CFLAGS for aix/cc -qubicle ... yes" and adds the optionflag to CFLAGS if 13 | # it is understood. You can override the shellvar-default of CFLAGS of 14 | # course. The order of arguments stems from the explicit macros like 15 | # AX_CFLAGS_WARN_ALL. 16 | # 17 | # The cousin AX_CXXFLAGS_AIX_OPTION would check for an option to add to 18 | # CXXFLAGS - and it uses the autoconf setup for C++ instead of C (since it 19 | # is possible to use different compilers for C and C++). 20 | # 21 | # The macro is a lot simpler than any special AX_CFLAGS_* macro (or 22 | # ax_cxx_rtti.m4 macro) but allows to check for arbitrary options. 23 | # However, if you use this macro in a few places, it would be great if you 24 | # would make up a new function-macro and submit it to the ac-archive. 25 | # 26 | # - $1 option-to-check-for : required ("-option" as non-value) 27 | # - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case) 28 | # - $3 action-if-found : add value to shellvariable 29 | # - $4 action-if-not-found : nothing 30 | # 31 | # note: in earlier versions, $1-$2 were swapped. We try to detect the 32 | # situation and accept a $2=~/-/ as being the old option-to-check-for. 33 | # 34 | # see also: AX_CFLAGS_GCC_OPTION for the widely used original variant. 35 | # 36 | # LICENSE 37 | # 38 | # Copyright (c) 2008 Guido U. Draheim 39 | # 40 | # This program is free software; you can redistribute it and/or modify it 41 | # under the terms of the GNU General Public License as published by the 42 | # Free Software Foundation; either version 3 of the License, or (at your 43 | # option) any later version. 44 | # 45 | # This program is distributed in the hope that it will be useful, but 46 | # WITHOUT ANY WARRANTY; without even the implied warranty of 47 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 48 | # Public License for more details. 49 | # 50 | # You should have received a copy of the GNU General Public License along 51 | # with this program. If not, see . 52 | # 53 | # As a special exception, the respective Autoconf Macro's copyright owner 54 | # gives unlimited permission to copy, distribute and modify the configure 55 | # scripts that are the output of Autoconf when processing the Macro. You 56 | # need not follow the terms of the GNU General Public License when using 57 | # or distributing such scripts, even though portions of the text of the 58 | # Macro appear in them. The GNU General Public License (GPL) does govern 59 | # all other use of the material that constitutes the Autoconf Macro. 60 | # 61 | # This special exception to the GPL applies to versions of the Autoconf 62 | # Macro released by the Autoconf Archive. When you make and distribute a 63 | # modified version of the Autoconf Macro, you may extend this special 64 | # exception to the GPL to apply to your modified version as well. 65 | 66 | #serial 13 67 | 68 | AC_DEFUN([AX_FLAGS_AIX_OPTION_PRIVATE], [dnl 69 | AX_CHECK_COMPILE_FLAG([$1], [flag_ok="yes"], [flag_ok="no"], [-qlanglvl=ansi -qsrcmsg]) 70 | AS_CASE([".$flag_ok"], 71 | [.ok|.ok,*], [$3], 72 | [.|.no|.no,*], [$4], 73 | [m4_default($3,[AX_APPEND_FLAG([$1],[$2])])]) 74 | ]) 75 | 76 | AC_DEFUN([AX_CFLAGS_AIX_OPTION],[ 77 | AC_LANG_PUSH([C]) 78 | AX_FLAGS_AIX_OPTION_PRIVATE(ifelse(m4_bregexp([$2],[-]),-1,[[$1],[$2]],[[$2],[$1]]),[$3],[$4]) 79 | AC_LANG_POP 80 | ]) 81 | 82 | AC_DEFUN([AX_CXXFLAGS_AIX_OPTION],[ 83 | AC_LANG_PUSH([C++]) 84 | AX_FLAGS_AIX_OPTION_PRIVATE(ifelse(m4_bregexp([$2],[-]),-1,[[$1],[$2]],[[$2],[$1]]),[$3],[$4]) 85 | AC_LANG_POP 86 | ]) 87 | -------------------------------------------------------------------------------- /m4/ax_cflags_warn_all.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 8 | # AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 9 | # AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] 10 | # 11 | # DESCRIPTION 12 | # 13 | # Try to find a compiler option that enables most reasonable warnings. 14 | # 15 | # For the GNU compiler it will be -Wall (and -ansi -pedantic) The result 16 | # is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. 17 | # 18 | # Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, 19 | # HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and 20 | # Intel compilers. For a given compiler, the Fortran flags are much more 21 | # experimental than their C equivalents. 22 | # 23 | # - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS 24 | # - $2 add-value-if-not-found : nothing 25 | # - $3 action-if-found : add value to shellvariable 26 | # - $4 action-if-not-found : nothing 27 | # 28 | # NOTE: These macros depend on AX_APPEND_FLAG. 29 | # 30 | # LICENSE 31 | # 32 | # Copyright (c) 2008 Guido U. Draheim 33 | # Copyright (c) 2010 Rhys Ulerich 34 | # 35 | # This program is free software; you can redistribute it and/or modify it 36 | # under the terms of the GNU General Public License as published by the 37 | # Free Software Foundation; either version 3 of the License, or (at your 38 | # option) any later version. 39 | # 40 | # This program is distributed in the hope that it will be useful, but 41 | # WITHOUT ANY WARRANTY; without even the implied warranty of 42 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 43 | # Public License for more details. 44 | # 45 | # You should have received a copy of the GNU General Public License along 46 | # with this program. If not, see . 47 | # 48 | # As a special exception, the respective Autoconf Macro's copyright owner 49 | # gives unlimited permission to copy, distribute and modify the configure 50 | # scripts that are the output of Autoconf when processing the Macro. You 51 | # need not follow the terms of the GNU General Public License when using 52 | # or distributing such scripts, even though portions of the text of the 53 | # Macro appear in them. The GNU General Public License (GPL) does govern 54 | # all other use of the material that constitutes the Autoconf Macro. 55 | # 56 | # This special exception to the GPL applies to versions of the Autoconf 57 | # Macro released by the Autoconf Archive. When you make and distribute a 58 | # modified version of the Autoconf Macro, you may extend this special 59 | # exception to the GPL to apply to your modified version as well. 60 | 61 | #serial 15 62 | 63 | AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl 64 | AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl 65 | AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl 66 | AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], 67 | VAR,[VAR="no, unknown" 68 | ac_save_[]FLAGS="$[]FLAGS" 69 | for ac_arg dnl 70 | in "-warn all % -warn all" dnl Intel 71 | "-pedantic % -Wall" dnl GCC 72 | "-xstrconst % -v" dnl Solaris C 73 | "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix 74 | "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX 75 | "-ansi -ansiE % -fullwarn" dnl IRIX 76 | "+ESlit % +w1" dnl HP-UX C 77 | "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) 78 | "-h conform % -h msglevel 2" dnl Cray C (Unicos) 79 | # 80 | do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` 81 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM], 82 | [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) 83 | done 84 | FLAGS="$ac_save_[]FLAGS" 85 | ]) 86 | AS_VAR_POPDEF([FLAGS])dnl 87 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 88 | case ".$VAR" in 89 | .ok|.ok,*) m4_ifvaln($3,$3) ;; 90 | .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; 91 | *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; 92 | esac 93 | AS_VAR_POPDEF([VAR])dnl 94 | ])dnl AX_FLAGS_WARN_ALL 95 | dnl implementation tactics: 96 | dnl the for-argument contains a list of options. The first part of 97 | dnl these does only exist to detect the compiler - usually it is 98 | dnl a global option to enable -ansi or -extrawarnings. All other 99 | dnl compilers will fail about it. That was needed since a lot of 100 | dnl compilers will give false positives for some option-syntax 101 | dnl like -Woption or -Xoption as they think of it is a pass-through 102 | dnl to later compile stages or something. The "%" is used as a 103 | dnl delimiter. A non-option comment can be given after "%%" marks 104 | dnl which will be shown but not added to the respective C/CXXFLAGS. 105 | 106 | AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl 107 | AC_LANG_PUSH([C]) 108 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 109 | AC_LANG_POP([C]) 110 | ]) 111 | 112 | AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl 113 | AC_LANG_PUSH([C++]) 114 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 115 | AC_LANG_POP([C++]) 116 | ]) 117 | 118 | AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl 119 | AC_LANG_PUSH([Fortran]) 120 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) 121 | AC_LANG_POP([Fortran]) 122 | ]) 123 | -------------------------------------------------------------------------------- /m4/ax_check_compile_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the current language's compiler 12 | # or gives an error. (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the current language's default 18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 20 | # force the compiler to issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # This program is free software: you can redistribute it and/or modify it 33 | # under the terms of the GNU General Public License as published by the 34 | # Free Software Foundation, either version 3 of the License, or (at your 35 | # option) any later version. 36 | # 37 | # This program is distributed in the hope that it will be useful, but 38 | # WITHOUT ANY WARRANTY; without even the implied warranty of 39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 40 | # Public License for more details. 41 | # 42 | # You should have received a copy of the GNU General Public License along 43 | # with this program. If not, see . 44 | # 45 | # As a special exception, the respective Autoconf Macro's copyright owner 46 | # gives unlimited permission to copy, distribute and modify the configure 47 | # scripts that are the output of Autoconf when processing the Macro. You 48 | # need not follow the terms of the GNU General Public License when using 49 | # or distributing such scripts, even though portions of the text of the 50 | # Macro appear in them. The GNU General Public License (GPL) does govern 51 | # all other use of the material that constitutes the Autoconf Macro. 52 | # 53 | # This special exception to the GPL applies to versions of the Autoconf 54 | # Macro released by the Autoconf Archive. When you make and distribute a 55 | # modified version of the Autoconf Macro, you may extend this special 56 | # exception to the GPL to apply to your modified version as well. 57 | 58 | #serial 4 59 | 60 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], 61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 63 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 64 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 65 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 66 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 67 | [AS_VAR_SET(CACHEVAR,[yes])], 68 | [AS_VAR_SET(CACHEVAR,[no])]) 69 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 70 | AS_VAR_IF(CACHEVAR,yes, 71 | [m4_default([$2], :)], 72 | [m4_default([$3], :)]) 73 | AS_VAR_POPDEF([CACHEVAR])dnl 74 | ])dnl AX_CHECK_COMPILE_FLAGS 75 | -------------------------------------------------------------------------------- /m4/ax_check_link_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the linker or gives an error. 12 | # (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags 18 | # when the check is done. The check is thus made with the flags: "LDFLAGS 19 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to 20 | # issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_LINK_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # This program is free software: you can redistribute it and/or modify it 33 | # under the terms of the GNU General Public License as published by the 34 | # Free Software Foundation, either version 3 of the License, or (at your 35 | # option) any later version. 36 | # 37 | # This program is distributed in the hope that it will be useful, but 38 | # WITHOUT ANY WARRANTY; without even the implied warranty of 39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 40 | # Public License for more details. 41 | # 42 | # You should have received a copy of the GNU General Public License along 43 | # with this program. If not, see . 44 | # 45 | # As a special exception, the respective Autoconf Macro's copyright owner 46 | # gives unlimited permission to copy, distribute and modify the configure 47 | # scripts that are the output of Autoconf when processing the Macro. You 48 | # need not follow the terms of the GNU General Public License when using 49 | # or distributing such scripts, even though portions of the text of the 50 | # Macro appear in them. The GNU General Public License (GPL) does govern 51 | # all other use of the material that constitutes the Autoconf Macro. 52 | # 53 | # This special exception to the GPL applies to versions of the Autoconf 54 | # Macro released by the Autoconf Archive. When you make and distribute a 55 | # modified version of the Autoconf Macro, you may extend this special 56 | # exception to the GPL to apply to your modified version as well. 57 | 58 | #serial 4 59 | 60 | AC_DEFUN([AX_CHECK_LINK_FLAG], 61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl 63 | AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ 64 | ax_check_save_flags=$LDFLAGS 65 | LDFLAGS="$LDFLAGS $4 $1" 66 | AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 67 | [AS_VAR_SET(CACHEVAR,[yes])], 68 | [AS_VAR_SET(CACHEVAR,[no])]) 69 | LDFLAGS=$ax_check_save_flags]) 70 | AS_VAR_IF(CACHEVAR,yes, 71 | [m4_default([$2], :)], 72 | [m4_default([$3], :)]) 73 | AS_VAR_POPDEF([CACHEVAR])dnl 74 | ])dnl AX_CHECK_LINK_FLAGS 75 | -------------------------------------------------------------------------------- /m4/ax_compiler_flags.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check for the presence of an --enable-compile-warnings option to 12 | # configure, defaulting to "error" in normal operation, or "yes" if 13 | # IS-RELEASE is equal to "yes". Return the value in the variable 14 | # $ax_enable_compile_warnings. 15 | # 16 | # Depending on the value of --enable-compile-warnings, different compiler 17 | # warnings are checked to see if they work with the current compiler and, 18 | # if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE. This 19 | # allows a consistent set of baseline compiler warnings to be used across 20 | # a code base, irrespective of any warnings enabled locally by individual 21 | # developers. By standardising the warnings used by all developers of a 22 | # project, the project can commit to a zero-warnings policy, using -Werror 23 | # to prevent compilation if new warnings are introduced. This makes 24 | # catching bugs which are flagged by warnings a lot easier. 25 | # 26 | # By providing a consistent --enable-compile-warnings argument across all 27 | # projects using this macro, continuous integration systems can easily be 28 | # configured the same for all projects. Automated systems or build 29 | # systems aimed at beginners may want to pass the --disable-Werror 30 | # argument to unconditionally prevent warnings being fatal. 31 | # 32 | # --enable-compile-warnings can take the values: 33 | # 34 | # * no: Base compiler warnings only; not even -Wall. 35 | # * yes: The above, plus a broad range of useful warnings. 36 | # * error: The above, plus -Werror so that all warnings are fatal. 37 | # Use --disable-Werror to override this and disable fatal 38 | # warnings. 39 | # 40 | # The set of base and enabled flags can be augmented using the 41 | # EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and 42 | # appended to the output variable if --enable-compile-warnings is not 43 | # "no". Flags should not be disabled using these arguments, as the entire 44 | # point of AX_COMPILER_FLAGS is to enforce a consistent set of useful 45 | # compiler warnings on code, using warnings which have been chosen for low 46 | # false positive rates. If a compiler emits false positives for a 47 | # warning, a #pragma should be used in the code to disable the warning 48 | # locally. See: 49 | # 50 | # https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas 51 | # 52 | # The EXTRA-* variables should only be used to supply extra warning flags, 53 | # and not general purpose compiler flags, as they are controlled by 54 | # configure options such as --disable-Werror. 55 | # 56 | # IS-RELEASE can be used to disable -Werror when making a release, which 57 | # is useful for those hairy moments when you just want to get the release 58 | # done as quickly as possible. Set it to "yes" to disable -Werror. By 59 | # default, it uses the value of $ax_is_release, so if you are using the 60 | # AX_IS_RELEASE macro, there is no need to pass this parameter. For 61 | # example: 62 | # 63 | # AX_IS_RELEASE([git-directory]) 64 | # AX_COMPILER_FLAGS() 65 | # 66 | # CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults 67 | # to WARN_LDFLAGS. Both variables are AC_SUBST-ed by this macro, but must 68 | # be manually added to the CFLAGS and LDFLAGS variables for each target in 69 | # the code base. 70 | # 71 | # If C++ language support is enabled with AC_PROG_CXX, which must occur 72 | # before this macro in configure.ac, warning flags for the C++ compiler 73 | # are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the 74 | # CXXFLAGS variables for each target in the code base. EXTRA-*-CFLAGS can 75 | # be used to augment the base and enabled flags. 76 | # 77 | # Warning flags for g-ir-scanner (from GObject Introspection) are 78 | # AC_SUBST-ed as WARN_SCANNERFLAGS. This variable must be manually added 79 | # to the SCANNERFLAGS variable for each GIR target in the code base. If 80 | # extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR 81 | # macro must be invoked manually. 82 | # 83 | # AX_COMPILER_FLAGS may add support for other tools in future, in addition 84 | # to the compiler and linker. No extra EXTRA-* variables will be added 85 | # for those tools, and all extra support will still use the single 86 | # --enable-compile-warnings configure option. For finer grained control 87 | # over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS, 88 | # AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools. 89 | # 90 | # The UNUSED variables date from a previous version of this macro, and are 91 | # automatically appended to the preceding non-UNUSED variable. They should 92 | # be left empty in new uses of the macro. 93 | # 94 | # LICENSE 95 | # 96 | # Copyright (c) 2014, 2015 Philip Withnall 97 | # Copyright (c) 2015 David King 98 | # 99 | # Copying and distribution of this file, with or without modification, are 100 | # permitted in any medium without royalty provided the copyright notice 101 | # and this notice are preserved. This file is offered as-is, without any 102 | # warranty. 103 | 104 | #serial 13 105 | 106 | # _AX_COMPILER_FLAGS_LANG([LANGNAME]) 107 | m4_defun([_AX_COMPILER_FLAGS_LANG], 108 | [m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [], 109 | [m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl 110 | AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl 111 | ]) 112 | 113 | AC_DEFUN([AX_COMPILER_FLAGS],[ 114 | # C support is enabled by default. 115 | _AX_COMPILER_FLAGS_LANG([C]) 116 | # Only enable C++ support if AC_PROG_CXX is called. The redefinition of 117 | # AC_PROG_CXX is so that a fatal error is emitted if this macro is called 118 | # before AC_PROG_CXX, which would otherwise cause no C++ warnings to be 119 | # checked. 120 | AC_PROVIDE_IFELSE([AC_PROG_CXX], 121 | [_AX_COMPILER_FLAGS_LANG([CXX])], 122 | [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])]) 123 | AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS]) 124 | 125 | # Default value for IS-RELEASE is $ax_is_release 126 | ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],, 127 | [$ax_is_release], 128 | [$3]))) 129 | 130 | AC_ARG_ENABLE([compile-warnings], 131 | AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@], 132 | [Enable compiler warnings and errors]),, 133 | [AS_IF([test "$ax_compiler_flags_is_release" = "yes"], 134 | [enable_compile_warnings="yes"], 135 | [enable_compile_warnings="error"])]) 136 | AC_ARG_ENABLE([Werror], 137 | AS_HELP_STRING([--disable-Werror], 138 | [Unconditionally make all compiler warnings non-fatal]),, 139 | [enable_Werror=maybe]) 140 | 141 | # Return the user's chosen warning level 142 | AS_IF([test "$enable_Werror" = "no" -a \ 143 | "$enable_compile_warnings" = "error"],[ 144 | enable_compile_warnings="yes" 145 | ]) 146 | 147 | ax_enable_compile_warnings=$enable_compile_warnings 148 | 149 | AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release], 150 | [$4],[$5 $6 $7 $8]) 151 | m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled], 152 | [AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS], 153 | [$ax_compiler_flags_is_release], 154 | [$4],[$5 $6 $7 $8])]) 155 | AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release], 156 | [$9],[$10 $11 $12 $13]) 157 | AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release]) 158 | ])dnl AX_COMPILER_FLAGS 159 | -------------------------------------------------------------------------------- /m4/ax_compiler_flags_cflags.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================ 2 | # http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html 3 | # ============================================================================ 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Add warning flags for the C compiler to VARIABLE, which defaults to 12 | # WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be 13 | # manually added to the CFLAGS variable for each target in the code base. 14 | # 15 | # This macro depends on the environment set up by AX_COMPILER_FLAGS. 16 | # Specifically, it uses the value of $ax_enable_compile_warnings to decide 17 | # which flags to enable. 18 | # 19 | # LICENSE 20 | # 21 | # Copyright (c) 2014, 2015 Philip Withnall 22 | # 23 | # Copying and distribution of this file, with or without modification, are 24 | # permitted in any medium without royalty provided the copyright notice 25 | # and this notice are preserved. This file is offered as-is, without any 26 | # warranty. 27 | 28 | #serial 11 29 | 30 | AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ 31 | AC_REQUIRE([AC_PROG_SED]) 32 | AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) 33 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 34 | AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) 35 | 36 | # Variable names 37 | m4_define(ax_warn_cflags_variable, 38 | [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))]) 39 | 40 | AC_LANG_PUSH([C]) 41 | 42 | # Always pass -Werror=unknown-warning-option to get Clang to fail on bad 43 | # flags, otherwise they are always appended to the warn_cflags variable, and 44 | # Clang warns on them for every compilation unit. 45 | # If this is passed to GCC, it will explode, so the flag must be enabled 46 | # conditionally. 47 | AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ 48 | ax_compiler_flags_test="-Werror=unknown-warning-option" 49 | ],[ 50 | ax_compiler_flags_test="" 51 | ]) 52 | 53 | # Base flags 54 | AX_APPEND_COMPILE_FLAGS([ dnl 55 | -fno-strict-aliasing dnl 56 | $3 dnl 57 | ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) 58 | 59 | AS_IF([test "$ax_enable_compile_warnings" != "no"],[ 60 | # "yes" flags 61 | AX_APPEND_COMPILE_FLAGS([ dnl 62 | -Wall dnl 63 | -Wextra dnl 64 | -Wundef dnl 65 | -Wnested-externs dnl 66 | -Wwrite-strings dnl 67 | -Wpointer-arith dnl 68 | -Wmissing-declarations dnl 69 | -Wmissing-prototypes dnl 70 | -Wstrict-prototypes dnl 71 | -Wredundant-decls dnl 72 | -Wno-unused-parameter dnl 73 | -Wno-missing-field-initializers dnl 74 | -Wdeclaration-after-statement dnl 75 | -Wformat=2 dnl 76 | -Wold-style-definition dnl 77 | -Wcast-align dnl 78 | -Wformat-nonliteral dnl 79 | -Wformat-security dnl 80 | -Wsign-compare dnl 81 | -Wstrict-aliasing dnl 82 | -Wshadow dnl 83 | -Winline dnl 84 | -Wpacked dnl 85 | -Wmissing-format-attribute dnl 86 | -Wmissing-noreturn dnl 87 | -Winit-self dnl 88 | -Wredundant-decls dnl 89 | -Wmissing-include-dirs dnl 90 | -Wunused-but-set-variable dnl 91 | -Warray-bounds dnl 92 | -Wimplicit-function-declaration dnl 93 | -Wreturn-type dnl 94 | -Wswitch-enum dnl 95 | -Wswitch-default dnl 96 | $4 dnl 97 | $5 dnl 98 | $6 dnl 99 | $7 dnl 100 | ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) 101 | ]) 102 | AS_IF([test "$ax_enable_compile_warnings" = "error"],[ 103 | # "error" flags; -Werror has to be appended unconditionally because 104 | # it's not possible to test for 105 | # 106 | # suggest-attribute=format is disabled because it gives too many false 107 | # positives 108 | AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable) 109 | 110 | AX_APPEND_COMPILE_FLAGS([ dnl 111 | -Wno-suggest-attribute=format dnl 112 | ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) 113 | ]) 114 | 115 | # In the flags below, when disabling specific flags, always add *both* 116 | # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) 117 | # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, 118 | # which effectively turns that flag back on again as an error. 119 | for flag in $ax_warn_cflags_variable; do 120 | AS_CASE([$flag], 121 | [-Wno-*=*],[], 122 | [-Wno-*],[ 123 | AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], 124 | ax_warn_cflags_variable, 125 | [$ax_compiler_flags_test]) 126 | ]) 127 | done 128 | 129 | AC_LANG_POP([C]) 130 | 131 | # Substitute the variables 132 | AC_SUBST(ax_warn_cflags_variable) 133 | ])dnl AX_COMPILER_FLAGS 134 | -------------------------------------------------------------------------------- /m4/ax_compiler_flags_gir.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_gir.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_COMPILER_FLAGS_GIR([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Add warning flags for the g-ir-scanner (from GObject Introspection) to 12 | # VARIABLE, which defaults to WARN_SCANNERFLAGS. VARIABLE is AC_SUBST-ed 13 | # by this macro, but must be manually added to the SCANNERFLAGS variable 14 | # for each GIR target in the code base. 15 | # 16 | # This macro depends on the environment set up by AX_COMPILER_FLAGS. 17 | # Specifically, it uses the value of $ax_enable_compile_warnings to decide 18 | # which flags to enable. 19 | # 20 | # LICENSE 21 | # 22 | # Copyright (c) 2015 Philip Withnall 23 | # 24 | # Copying and distribution of this file, with or without modification, are 25 | # permitted in any medium without royalty provided the copyright notice 26 | # and this notice are preserved. This file is offered as-is, without any 27 | # warranty. 28 | 29 | #serial 4 30 | 31 | AC_DEFUN([AX_COMPILER_FLAGS_GIR],[ 32 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 33 | 34 | # Variable names 35 | m4_define(ax_warn_scannerflags_variable, 36 | [m4_normalize(ifelse([$1],,[WARN_SCANNERFLAGS],[$1]))]) 37 | 38 | # Base flags 39 | AX_APPEND_FLAG([$3],ax_warn_scannerflags_variable) 40 | 41 | AS_IF([test "$ax_enable_compile_warnings" != "no"],[ 42 | # "yes" flags 43 | AX_APPEND_FLAG([ dnl 44 | --warn-all dnl 45 | $4 dnl 46 | $5 dnl 47 | $6 dnl 48 | $7 dnl 49 | ],ax_warn_scannerflags_variable) 50 | ]) 51 | AS_IF([test "$ax_enable_compile_warnings" = "error"],[ 52 | # "error" flags 53 | AX_APPEND_FLAG([ dnl 54 | --warn-error dnl 55 | ],ax_warn_scannerflags_variable) 56 | ]) 57 | 58 | # Substitute the variables 59 | AC_SUBST(ax_warn_scannerflags_variable) 60 | ])dnl AX_COMPILER_FLAGS 61 | -------------------------------------------------------------------------------- /m4/ax_compiler_flags_ldflags.m4: -------------------------------------------------------------------------------- 1 | # ============================================================================= 2 | # http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_ldflags.html 3 | # ============================================================================= 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_COMPILER_FLAGS_LDFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Add warning flags for the linker to VARIABLE, which defaults to 12 | # WARN_LDFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be 13 | # manually added to the LDFLAGS variable for each target in the code base. 14 | # 15 | # This macro depends on the environment set up by AX_COMPILER_FLAGS. 16 | # Specifically, it uses the value of $ax_enable_compile_warnings to decide 17 | # which flags to enable. 18 | # 19 | # LICENSE 20 | # 21 | # Copyright (c) 2014, 2015 Philip Withnall 22 | # 23 | # Copying and distribution of this file, with or without modification, are 24 | # permitted in any medium without royalty provided the copyright notice 25 | # and this notice are preserved. This file is offered as-is, without any 26 | # warranty. 27 | 28 | #serial 5 29 | 30 | AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[ 31 | AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) 32 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) 33 | AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) 34 | 35 | # Variable names 36 | m4_define(ax_warn_ldflags_variable, 37 | [m4_normalize(ifelse([$1],,[WARN_LDFLAGS],[$1]))]) 38 | 39 | # Always pass -Werror=unknown-warning-option to get Clang to fail on bad 40 | # flags, otherwise they are always appended to the warn_ldflags variable, 41 | # and Clang warns on them for every compilation unit. 42 | # If this is passed to GCC, it will explode, so the flag must be enabled 43 | # conditionally. 44 | AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ 45 | ax_compiler_flags_test="-Werror=unknown-warning-option" 46 | ],[ 47 | ax_compiler_flags_test="" 48 | ]) 49 | 50 | # Base flags 51 | AX_APPEND_LINK_FLAGS([ dnl 52 | -Wl,--no-as-needed dnl 53 | $3 dnl 54 | ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) 55 | 56 | AS_IF([test "$ax_enable_compile_warnings" != "no"],[ 57 | # "yes" flags 58 | AX_APPEND_LINK_FLAGS([$4 $5 $6 $7], 59 | ax_warn_ldflags_variable, 60 | [$ax_compiler_flags_test]) 61 | ]) 62 | AS_IF([test "$ax_enable_compile_warnings" = "error"],[ 63 | # "error" flags; -Werror has to be appended unconditionally because 64 | # it's not possible to test for 65 | # 66 | # suggest-attribute=format is disabled because it gives too many false 67 | # positives 68 | AX_APPEND_LINK_FLAGS([ dnl 69 | -Wl,--fatal-warnings dnl 70 | ],ax_warn_ldflags_variable,[$ax_compiler_flags_test]) 71 | ]) 72 | 73 | # Substitute the variables 74 | AC_SUBST(ax_warn_ldflags_variable) 75 | ])dnl AX_COMPILER_FLAGS 76 | -------------------------------------------------------------------------------- /m4/ax_compiler_vendor.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_COMPILER_VENDOR 8 | # 9 | # DESCRIPTION 10 | # 11 | # Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, 12 | # hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, 13 | # watcom, etc. The vendor is returned in the cache variable 14 | # $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. 15 | # 16 | # LICENSE 17 | # 18 | # Copyright (c) 2008 Steven G. Johnson 19 | # Copyright (c) 2008 Matteo Frigo 20 | # 21 | # This program is free software: you can redistribute it and/or modify it 22 | # under the terms of the GNU General Public License as published by the 23 | # Free Software Foundation, either version 3 of the License, or (at your 24 | # option) any later version. 25 | # 26 | # This program is distributed in the hope that it will be useful, but 27 | # WITHOUT ANY WARRANTY; without even the implied warranty of 28 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 29 | # Public License for more details. 30 | # 31 | # You should have received a copy of the GNU General Public License along 32 | # with this program. If not, see . 33 | # 34 | # As a special exception, the respective Autoconf Macro's copyright owner 35 | # gives unlimited permission to copy, distribute and modify the configure 36 | # scripts that are the output of Autoconf when processing the Macro. You 37 | # need not follow the terms of the GNU General Public License when using 38 | # or distributing such scripts, even though portions of the text of the 39 | # Macro appear in them. The GNU General Public License (GPL) does govern 40 | # all other use of the material that constitutes the Autoconf Macro. 41 | # 42 | # This special exception to the GPL applies to versions of the Autoconf 43 | # Macro released by the Autoconf Archive. When you make and distribute a 44 | # modified version of the Autoconf Macro, you may extend this special 45 | # exception to the GPL to apply to your modified version as well. 46 | 47 | #serial 15 48 | 49 | AC_DEFUN([AX_COMPILER_VENDOR], 50 | [AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, 51 | dnl Please add if possible support to ax_compiler_version.m4 52 | [# note: don't check for gcc first since some other compilers define __GNUC__ 53 | vendors="intel: __ICC,__ECC,__INTEL_COMPILER 54 | ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ 55 | pathscale: __PATHCC__,__PATHSCALE__ 56 | clang: __clang__ 57 | cray: _CRAYC 58 | fujitsu: __FUJITSU 59 | gnu: __GNUC__ 60 | sun: __SUNPRO_C,__SUNPRO_CC 61 | hp: __HP_cc,__HP_aCC 62 | dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER 63 | borland: __BORLANDC__,__CODEGEARC__,__TURBOC__ 64 | comeau: __COMO__ 65 | kai: __KCC 66 | lcc: __LCC__ 67 | sgi: __sgi,sgi 68 | microsoft: _MSC_VER 69 | metrowerks: __MWERKS__ 70 | watcom: __WATCOMC__ 71 | portland: __PGI 72 | tcc: __TINYC__ 73 | unknown: UNKNOWN" 74 | for ventest in $vendors; do 75 | case $ventest in 76 | *:) vendor=$ventest; continue ;; 77 | *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; 78 | esac 79 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ 80 | #if !($vencpp) 81 | thisisanerror; 82 | #endif 83 | ])], [break]) 84 | done 85 | ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` 86 | ]) 87 | ]) 88 | -------------------------------------------------------------------------------- /m4/ax_is_release.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_is_release.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_IS_RELEASE(POLICY) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Determine whether the code is being configured as a release, or from 12 | # git. Set the ax_is_release variable to 'yes' or 'no'. 13 | # 14 | # If building a release version, it is recommended that the configure 15 | # script disable compiler errors and debug features, by conditionalising 16 | # them on the ax_is_release variable. If building from git, these 17 | # features should be enabled. 18 | # 19 | # The POLICY parameter specifies how ax_is_release is determined. It can 20 | # take the following values: 21 | # 22 | # * git-directory: ax_is_release will be 'no' if a '.git' directory exists 23 | # * minor-version: ax_is_release will be 'no' if the minor version number 24 | # in $PACKAGE_VERSION is odd; this assumes 25 | # $PACKAGE_VERSION follows the 'major.minor.micro' scheme 26 | # * micro-version: ax_is_release will be 'no' if the micro version number 27 | # in $PACKAGE_VERSION is odd; this assumes 28 | # $PACKAGE_VERSION follows the 'major.minor.micro' scheme 29 | # * always: ax_is_release will always be 'yes' 30 | # * never: ax_is_release will always be 'no' 31 | # 32 | # Other policies may be added in future. 33 | # 34 | # LICENSE 35 | # 36 | # Copyright (c) 2015 Philip Withnall 37 | # 38 | # Copying and distribution of this file, with or without modification, are 39 | # permitted in any medium without royalty provided the copyright notice 40 | # and this notice are preserved. 41 | 42 | #serial 3 43 | 44 | AC_DEFUN([AX_IS_RELEASE],[ 45 | AC_BEFORE([AC_INIT],[$0]) 46 | 47 | m4_case([$1], 48 | [git-directory],[ 49 | # $is_release = (.git directory does not exist) 50 | AS_IF([test -d .git],[ax_is_release=no],[ax_is_release=yes]) 51 | ], 52 | [minor-version],[ 53 | # $is_release = ($minor_version is even) 54 | minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` 55 | AS_IF([test "$(( $minor_version % 2 ))" -ne 0], 56 | [ax_is_release=no],[ax_is_release=yes]) 57 | ], 58 | [micro-version],[ 59 | # $is_release = ($micro_version is even) 60 | micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'` 61 | AS_IF([test "$(( $micro_version % 2 ))" -ne 0], 62 | [ax_is_release=no],[ax_is_release=yes]) 63 | ], 64 | [always],[ax_is_release=yes], 65 | [never],[ax_is_release=no], 66 | [ 67 | AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.]) 68 | ]) 69 | ]) 70 | -------------------------------------------------------------------------------- /m4/ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 1 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /op.1: -------------------------------------------------------------------------------- 1 | .TH OP 1 2 | .UC 4 3 | .SH NAME 4 | op \- operator access 5 | .SH SYNOPSIS 6 | .B op 7 | mnemonic [arg] 8 | .SH DESCRIPTION 9 | The 10 | .I op 11 | tool provides a flexible means for system administrators to grant 12 | trusted users access to certain 13 | .B root 14 | operations without having to give them full superuser privileges. 15 | Different sets of users may access different operations, and the 16 | security-related aspects of environment of each 17 | operation can be carefully controlled. 18 | .SH OPTIONS 19 | .TP 20 | .B -V 21 | Show version number. 22 | .TP 23 | .B -l 24 | List available commands. Note that this will only display commands you are 25 | permitted to run. 26 | .SH CONFIGURATION 27 | .PP 28 | Configuration entries are read from 29 | .B /etc/op.conf 30 | and all files in lexical order from 31 | .B /etc/op.d 32 | with the extension 33 | .B .conf. 34 | Files must be owned by 35 | .I root 36 | and not have 37 | .I group 38 | or 39 | .I other 40 | permissions set. 41 | .PP 42 | The fields of the entries in the configuration files are separated by white 43 | space. Each entry may span several lines and continues until the next 44 | alphanumeric string is found at the beginning of a lines (which is taken to be 45 | the next 46 | .I mnemonic or variable definition, 47 | and thus the beginning of a new entry). Comments may be embedded 48 | beginning with a # character. Each entry in the configuration files has the 49 | following form: 50 | .RS 51 | .DT 52 | .PP 53 | \fImnemonic command \fR[\fI arg ... \fR]\fI ; \fR[\fI option ... \fR] 54 | .RE 55 | or 56 | .RS 57 | .DT 58 | var=value 59 | .PP 60 | .RE 61 | where the fields are interpreted in the following manner: 62 | .TP 63 | .I var 64 | a variable name, which must be an upper case alphanumeric identifier. 65 | Variables are expanded when reading options. 66 | .TP 67 | .I value 68 | the remainder of the line is taken to be the value of the variable. 69 | .TP 70 | .I mnemonic 71 | a unique, alphanumeric identifier for each operator function. 72 | .TP 73 | .I command 74 | the full pathname of the executable to be run by 75 | .I op 76 | when the associated 77 | .I mnemonic 78 | is chosen. 79 | .TP 80 | .I arg(s) 81 | any arguments, either literal or variable, needed by 82 | .I command. 83 | Literal arguments are simply specified directly, like specific command 84 | options (\fB0Gun\fR) or files (\fB/dev/rmt20\fR). Variable arguments 85 | are specified here as \fB$1, $2 ... $\fR\fIn\fR; these are described 86 | more fully in the options section below. \fB$*\fR indicates any number 87 | trailing arguments. 88 | .TP 89 | .I option(s) 90 | a set of optional parameters to specify settings or restoring for the 91 | particular 92 | .I mnemonic, 93 | define variable arguments specified for the 94 | .I command, 95 | space and are of the form 96 | .I keyword=value. 97 | The absence of a specific list of values separated by commas, where 98 | appropriate. 99 | There should be no white space in each element of the 100 | .I value 101 | string unless quoted. The 102 | .I keyword 103 | is any of the following types: 104 | .TP 105 | .B uid 106 | Set the user id to the value specified. The value can be numeric user 107 | ID or a login name. The default is 108 | .B root. 109 | .TP 110 | .B gid 111 | Set the group id's to the values specified. Each value can be a numeric 112 | group ID or a group name. 113 | .TP 114 | .B dir 115 | Change the current working directory to the path specified. 116 | .TP 117 | .B chroot 118 | Change the root directory to the path specified using 119 | .I chroot. 120 | .TP 121 | .B umask 122 | Set the file creation umask to the octal value specified. The default 123 | is to set it to 124 | .B 022. 125 | .TP 126 | .B groups 127 | Allow any user who belongs to a group listed here to execute this 128 | .I op 129 | function. The default is not to allow any specific group. Note that the user 130 | and group strings are always treated as regular expressions, meaning the user 131 | name 'a' will match *any* user with the letter A in their name. In addition, 132 | group@hostname can be used to explicitly allow access only on specific hosts. 133 | 134 | .TP 135 | .B users 136 | Allow any user listed here to execute this 137 | .I op 138 | function. The default is to not allow any specific users. You may use 139 | the regular expression .* to indicate that all users may use this 140 | mnemonic. User expressions are in the form [@][/] where 141 | is a regular expression matched against the current system user, 142 | is a regular expression matched against the systems hostname and is a 143 | time in the form YYYYMMDD[hh[mm]] when that users access to the command 144 | expires. 145 | .TP 146 | .B netgroups 147 | Allow any user who belongs to a netgroup listed here to execute this 148 | .I op 149 | function. The default is not to allow any specific netgroup. 150 | 151 | .TP 152 | .B password 153 | Queries the user for a password. If there is an = part the value is the crypted 154 | password required, otherwise the users own password is asked. 155 | .TP 156 | .B securid 157 | Queries the user for SecureID PIN and code. If op has been compiled 158 | without SecurID support, this option will cause the command to fail 159 | with an error message. 160 | .TP 161 | .BI $VAR 162 | where 163 | .I VAR 164 | is the name of an environment variable. The specified environment 165 | case, simply using 166 | .I $VAR with no = part (as in 167 | .B $USER) 168 | means that this environment variable is inherited unchanged from 169 | the caller's shell. If the $VAR is an assignment the environment variable 170 | is set to the specified value in the new environment. 171 | .TP 172 | .B environment 173 | Disables the destruction of the users environment. 174 | .TP 175 | .B help 176 | Define help for this mnemonic. Defaults to the full command. 177 | .I op -l 178 | will display this help when it lists the available commands. eg. 179 | .I help="This is some help" 180 | .TP 181 | .B nolog 182 | Disables informational logging per command. Useful for cron jobs to avoid 183 | spamming the logs. Note that authentication failures and other errors will 184 | still be logged. 185 | .TP 186 | .B fowners 187 | Specifies the owner and group of the target command executable as a list of 188 | regular expression in the form 189 | .I user:group 190 | If the executables ownership does not match, the command will not be executed. 191 | .TP 192 | .B fperms 193 | As with 194 | .I fowners 195 | but matches against the octal permissions of the executable. 196 | .TP 197 | .B xauth 198 | Attempt to propagate the X authority entry for the current display to the new 199 | users X authority file. The DISPLAY environment variable is also propagated to 200 | the new environment. The destination user is determined by first using the user 201 | specified after xauth=..., then the user specified by uid=... then finally the 202 | root user is used. 203 | .TP 204 | .B $n 205 | defines the \fIn\fRth variable argument specified in the command 206 | .I arg 207 | list. The value for this type may be a comma-separated list of regular 208 | expressions using \fIegrep\fR(1). option defines the range of values 209 | allowed for the variable arguments A variable argument specified as a 210 | command 211 | .I arg 212 | but not described in the 213 | .I options 214 | section may take on any value. If an argument does not match any 215 | of its permitted values, then a diagnostic is printed and the 216 | command is not executed. When using '(' syntax to pass values 217 | to other options, only the next options can use values from 218 | the previous search. 219 | .TP 220 | .B $* 221 | is used in the 222 | .I options 223 | section to place restriction on the trailing arguments 224 | specified as $* in the 225 | .I args 226 | section. If any of these (possibly many) arguments do not match, then 227 | a diagnostic is printed, and the command is not executed. 228 | .PP 229 | There can also be a special entry in the file beginning at the first 230 | non-comment line 231 | that can define default values to override the builtin defaults listed 232 | here, yet still be overridden by any entry that wants to redefine any of 233 | the keyword fields described above. It should have the following format: 234 | .RS 235 | .DT 236 | \fBDEFAULT\fR \fIkeyword_option\fR 237 | .RE 238 | where \fIkeyword_option\fR is a \fIkeyword=value\fR string mentioned above 239 | under \fIoptions\fR. 240 | .PP 241 | It should be noted that if any regular 242 | .I mnemonic 243 | entry defines its own 244 | .I option, 245 | the value given for that entry must explicitly include the item from the 246 | DEFAULT line if the default values is to be included. That is, the 247 | .I options 248 | definitions completely override any 249 | defaults; they do not add to them In this way, if a value specified on 250 | the DEFAULT line for 251 | .B users 252 | or 253 | .B groups 254 | (for example) needs to be "erased" without redefining new values 255 | (that is, we want no users or groups to be allowed to run the mnemonic), 256 | then the default value must be overridden with nothing (as in 257 | \fBusers=\fR). For the 258 | .B users 259 | or 260 | .B groups 261 | fields, such a null setting has the effect of setting the list of 262 | allowable users or groups to be empty. For the other keywords (\fR 263 | uid, gid, dir, chroot, \fRand\fB umask\fR), a null setting leaves that 264 | attribute as it is upon invocation of the 265 | .I op 266 | program, overriding any defaults. 267 | .PP 268 | Another note is that if the 269 | .I command 270 | for a 271 | .I mnemonic 272 | is 273 | .B MAGIC_SHELL 274 | then a shell (using the users $SHELL environment variable) is created, 275 | if there are arguments in addition to the 276 | .I mnemonic 277 | on the command line then the shell is invoked "-c args". 278 | .SH EXAMPLES 279 | .PP 280 | Example /etc/op.conf: 281 | .RS 282 | .PP 283 | # Define some users 284 | .br 285 | OPERATORS=(fred|barry) 286 | .br 287 | # Define hosts that Fred is restricted to 288 | .br 289 | FRED_HOSTS=(alpha|beta) 290 | .br 291 | # Define hosts that Barry is restricted to 292 | .br 293 | BARRY_HOSTS=(theta|gamma) 294 | .br 295 | # Define user/host access list 296 | .br 297 | ACCESS_LIST=fred@FRED_HOSTS|barry@BARRY_HOSTS 298 | .PP 299 | .br 300 | # 'op shell' - gives user a root shell 301 | .br 302 | shell 303 | .br 304 | /bin/su -; 305 | .br 306 | users=ACCESS_LIST 307 | .br 308 | environment 309 | .br 310 | password 311 | .br 312 | help="Root shell" 313 | .PP 314 | .br 315 | # 'op reboot' - reboot system 316 | .br 317 | reboot 318 | .br 319 | /sbin/reboot; 320 | .br 321 | users=ACCESS_LIST 322 | .br 323 | password 324 | .br 325 | help="Reboot system" 326 | .PP 327 | # 'op shutdown