Commit Graph

116 Commits

Author SHA1 Message Date
Steve Lawrence 34b5d67c2d Use selabel interfaces instead of matchpathcon
This replaces the old matchpathcon interfaces with the new selabel
interfaces for relabeling files, storing an selabel handle in the
transaction set.

With this change, also comes an added distinction between --nocontexts
being specified and a failure to read the load file contexts.
Previously, there was no distinction, and both cases used the
RPMTRANS_FLAG_NOCONTEXTS flag.

However, with the new policy plugin, it is necessary to make such a
distinction. This is because matchpathcon_init (now selabel interfaces)
can fail at the beginning of the transaction, but succeed later after
new policy is installed. Because of this, we may need to enable/disable
RPMTRANS_FLAG_NOCONTEXTS multiple times. However, because this flag
could also mean --nocontexts, we cannot do that. By storing the selabel
handle in the rpmts, we can easily keep track if the handle has been
successfully created, rather than overloading RPMTRANS_FLAG_NOCONTEXTS
with two meanings.
2010-09-01 09:30:51 +03:00
Steve Lawrence 04bdec775a Add plugin calling support
This patch adds a simple plugin system that makes simple problems easy to
solve, and difficult problems, such as SELinux, possible.

When the transaction gets to the point where a collection action should occur,
it expands a macro of the form %__collection_<collection name> to get the path
to a plugin and any additional options. The plugin is dlopen'ed, and the
appropriate function is called in the plugin, with the additional arguments
passed in.

This also adds a --nocollections option to disable performing Collection
actions.
2010-06-22 11:12:43 +03:00
Panu Matilainen 05b2d979e8 Move <stdio.h> includes out of system.h to the places that need it 2010-01-05 16:06:02 +02:00
Panu Matilainen 71b7fb380b Lose <sys/types.h> and <sys/stat.h> includes from system.h
- these seem to be already included where needed through rpm's public
  header needs
2010-01-05 16:01:46 +02:00
Panu Matilainen 8fe27d49e1 Move <ctype.h> include out of system.h to the places that need it 2010-01-05 15:33:47 +02:00
Panu Matilainen dd58384ede Move <errno.h> include out of system.h to the places that need it 2010-01-05 15:25:31 +02:00
Panu Matilainen e3638c2c86 Remove <string.h> include from system.h into the few places that still need
- most of the places get it through <rpm/rpmstring.h> already
2010-01-05 15:17:34 +02:00
Panu Matilainen dab8a648db Loose string header compatibility goo
- <string.h> is required by C standard, we dont support ancient
  non-conformant compilers anyway
2010-01-05 15:09:08 +02:00
Panu Matilainen 0c15e5feb3 Include <stdlib.h> as necessary instead of system.h
- also loose the related ancient compatibility goo
2010-01-05 15:04:20 +02:00
Panu Matilainen 729aac4d7a Shove the mount entry include voodoo where sun doesn't ... <cough> fs.c 2010-01-05 14:39:04 +02:00
Panu Matilainen 53ab541984 Remove unnecessary NLS definitions from system.h
- all uses of dgettext() and friends are already protected by
  appropriate ifdef's, no need to provide dummy defines here
- setlocale() and <locale.h> are required by C89, C99 and POSIX .. assume
  its there and if not, one can disable the whole thing with --disable-nls
2010-01-05 14:29:48 +02:00
Panu Matilainen 6109d6388e Remove libcap stuff out of system.h
- just a few places need, avoid polluting everything with it
- make fsm->fcaps void * to avoid having to deal with fcap_t not defined
2010-01-05 13:29:52 +02:00
Panu Matilainen c50b63ba02 Remove unused selinux dummy defines 2010-01-05 12:51:56 +02:00
Panu Matilainen e10e807ce9 Move <mcheck.h> include out of system.h to the couple of places that care
- only two real users inside rpm
- remove mcheck foo from rpminject and rpmsort, we're not interested...
2010-01-05 12:36:37 +02:00
Panu Matilainen 2c6120755c Unconditionally include <sys/wait.h> where needed
- no point conditionalizing what we cant live without
2010-01-05 12:35:54 +02:00
Panu Matilainen 5085ae9923 Move sys/mman.h include out of system.h to the places that care
- just two places where needed, dont pollute system.h needlessly
- include depending on HAVE_MMAP instead of separately checking for
  sys/mman.h, if sys/mman.h doesn't exist or is broken HAVE_MMAP wont be set
2010-01-05 12:16:52 +02:00
Panu Matilainen f978dc78b4 Move libacl.h include out of system.h to the only place that cares 2010-01-05 11:52:56 +02:00
Panu Matilainen af3c8690d4 Eliminate SEEK_FOO and [RWXF]_OK definitions from system.h
- systems not defining these constants are broken beyond our caring
2010-01-05 11:45:28 +02:00
Panu Matilainen cd174374ff Remove unnecessary and broken time.h related configure + system.h checks
- the AC_HEADER_TIME check is unnecessary for any remotely recent systems,
  and the HAVE_SYS_TIME_H conditional in system.h is just broken as we
  dont even check for <sys/time.h> header in configure
- dont include from system.h, the time.h and sys/time.h get already
  included through our public headers where necessary
2010-01-05 11:37:59 +02:00
Panu Matilainen 5c084f842a Unconditionally include <netdb.h> where needed instead of system.h
- there's no fallback for missing netdb.h so there's little point
  conditionalizing it
- avoid yet more system.h pollution
2010-01-05 11:26:14 +02:00
Panu Matilainen 834551d246 Clean up poll() vs select() tests
- move the includes out of system.h, not commonly needed
- <poll.h> is conditional as we actually provide a fallback through select(),
  but for <sys/select.h> missing there's no fallback so doesn't make
  much sense to test for (and both poll.h and sys/select.h are posix anyway...)
2010-01-04 17:15:26 +02:00
Panu Matilainen 190d2b4783 Remove S_IFSOCK and S_IFLNK kludgery for ancient unixes
- these are specified by POSIX 2001, it's not really rpm's job to
  provide them if the system doesn't
2010-01-04 16:07:11 +02:00
Panu Matilainen 5f0c9a3882 Require lchown() and remove ancient broken chown kludgery
- lchown() is POSIX 2001, we dont care about older / nonconformant stuff
2010-01-04 15:58:55 +02:00
Panu Matilainen 33404070cd Remove further replacement functions for POSIX 2001 required bits
- getwd(), getcwd(), basename() and realpath() are all POSIX 2001
  defined, we dont care about older stuff
2010-01-04 15:27:05 +02:00
Panu Matilainen bb803d630c Remove unnecessary setenv() replacement function
- setenv() and unsetenv() are required by POSIX 2001, we dont care about
  older systems
2010-01-04 14:21:42 +02:00
Panu Matilainen eaeadb40ac Include <utime.h> where needed instead of system.h
- include unconditionally as we dont try to deal with utime() missing
2009-12-23 14:19:54 +02:00
Panu Matilainen 3786b6640e Move major, minor + makedev portability stuff out of system.h, simplify
- only cpio.c needs, move it there
- if none of the standard headers define these, its not our headache anymore
2009-12-23 14:14:35 +02:00
Panu Matilainen 2553ca2fe3 Move getopt() portability fiddles out of system.h
- only macro.c needs, no point polluting includes everywhere
2009-12-23 14:02:19 +02:00
Panu Matilainen 2753a5e934 Dont include <pwd.h> from system.h, dont bother checking for it either
- no much point conditionalizing something we can't live without
- just three places need, no point polluting include space everywhere
2009-12-23 13:40:10 +02:00
Panu Matilainen 68a5dd5803 Dont bother including <sys/socket.h>, we dont use anything from there 2009-12-23 13:36:29 +02:00
Panu Matilainen df3e1ce0cd Dont bother including <err.h>, we dont use anything from there 2009-12-23 13:32:53 +02:00
Panu Matilainen f70b1c76d5 Only rpmrc.c cares about utsname.h, move out of system.h 2009-12-23 13:31:57 +02:00
Panu Matilainen a39dc445fc Dont include grp.h from system.h, dont bother checking in configure either
- no much point conditionalizing something we can't live without
- just two places need, no point polluting include space everywhere
2009-12-23 13:15:59 +02:00
Panu Matilainen 0fbf88d34c Dont bother checking and including a header we dont use or need 2009-12-23 12:58:17 +02:00
Panu Matilainen 162fc36e14 Move malloc portability tweaks out of system.h
- only rpmmalloc.c needs, no need to pollute system.h
2009-12-23 12:55:45 +02:00
Panu Matilainen 4a1e75d139 We dont use memchr() anywhere 2009-12-23 12:47:59 +02:00
Panu Matilainen 9f43fee26b Move getpass() portability tweaks out of system.h
- only signature.c needs, no need to pollute system.h
2009-12-23 12:41:38 +02:00
Panu Matilainen c47b96630c Dont bother checking for a header we dont use 2009-12-23 12:37:37 +02:00
Panu Matilainen 5c31864598 Dont bother checking for functions we dont use
- some of this stuff was used in 4.4.x but not anymore
- additionally we dont even use getdomainnname(), check for gethostname()
  instead
2009-12-23 12:25:32 +02:00
Panu Matilainen 33685ef74e Kill off last remaining uses of _constfree()
- practially all the data in rpmfi needs to be treated as const, these
  are just a funky special case which point to header memory for the
  couple of cases where KEEPHEADER is still used
2009-12-22 14:36:35 +02:00
Panu Matilainen 1492581139 Always use build + use our own allocator functions
- Consistent across platforms and will allow some things macros dont and
  memory checkers these days are smart enough to get decent output anyway
- Minimal namespacing with r-prefix, add compatibility macros to system.h
  for now so we dont have to change the entire codebase for this
- Also make rpmutil.h where the declarations and gcc __attribute__ macros
  are available everywhere
2009-09-17 12:32:04 +03:00
Panu Matilainen 759b73a429 Ensure PATH_MAX is defined (ticket #3) Adam Tkac
- POSIX doesn't require PATH_MAX to be defined as constant, and Hurd
  doesn't define it...
- deal with it just once in system.h for now, the proper fix is to get
  rid of needing it at all (ie add a mallocing realpath() clone to librpmio)
- patch from Adam Tkac
2008-11-03 14:14:14 +02:00
Panu Matilainen 97ab15cc9e Add fsm and rpmfi machinery for file capabilities
- new rpmfiFCaps() API to retrieve the info from rpmfi set
- fsm internals quite similar to selinux handling
- plenty of #ifdef's, another possibility would be adding cap_foo dummies to
  system.h like for selinux
2008-10-29 11:49:38 +02:00
Panu Matilainen f4b5bd55db Beginnings of acl (POSIX.1e draft 17) verification support
- if built with --with-acl, check that files and directories don't have
  any extra acl's set
- for now, any acl beyond the regular unix permission set is reported as
  file mode difference as the acl's cannot have been set by rpm itself
- patch from Andreas Gruenbacher, modified to use libacl instead of raw
  xattrs for portability, BUT atm this uses non-portable acl_equiv_mode()
  Linux libacl extension, the posix draft doesn't seem to have much in
  the way of comparing entries :-/
2008-10-26 14:18:17 +02:00
Panu Matilainen 770a0f34c9 Beginnings of file capability (POSIX.1e draft 15) verification support
- add minimal bits and pieces to check for capabilities in files on verify
- for now, any capability set is a verification failure as the capability
  cannot have been set by rpm itself
- patch from Andreas Gruenbacher, modified to use libcap instead of raw
  xattrs for portability
2008-10-26 14:17:16 +02:00
Jindrich Novy ca40fafedb Remove timezone autoconf checks and system.h reference
- timezone is no more used so it's no more needed
2008-10-24 12:32:31 +02:00
Panu Matilainen 461fd000d2 is_selinux_enabled() returns 0 if not enabled, not -1 2008-05-08 12:40:37 +03:00
Panu Matilainen a306a04a89 RIP alloca() 2008-04-30 14:38:09 +03:00
Panu Matilainen 20f6d481aa Expose compiler warnings from freeing data declared as const
- _free() is just a wrapper to free() which additionally returns NULL
- add _constfree() for use in the cases where const is used to protect
  malloced "read-only" data in long-lived otherwise exposed structures etc
2007-12-15 13:41:58 +02:00
Panu Matilainen 142b5e5301 Use dgettext() instead of just gettext()
Patch from Pascal Rigaux
2007-11-13 12:57:49 +02:00