]> granicus.if.org Git - sudo/commitdiff
Move code common to sudo and the sudoers plugin to a convenience library,
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 27 May 2010 21:27:36 +0000 (17:27 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 27 May 2010 21:27:36 +0000 (17:27 -0400)
libcommon.  Removes the need to make links in the sudoers plugin dir
and reduces re-compilation of duplicate object files.

15 files changed:
Makefile.in
common/alloc.c [moved from src/alloc.c with 100% similarity]
common/atobool.c [moved from src/atobool.c with 100% similarity]
common/fileops.c [moved from src/fileops.c with 100% similarity]
common/fmt_string.c [moved from src/fmt_string.c with 100% similarity]
common/gettime.c [moved from src/gettime.c with 100% similarity]
common/lbuf.c [moved from src/lbuf.c with 100% similarity]
common/list.c [moved from src/list.c with 100% similarity]
common/term.c [moved from src/term.c with 100% similarity]
common/zero_bytes.c [moved from src/zero_bytes.c with 100% similarity]
configure
configure.in
plugins/sample/Makefile.in
plugins/sudoers/Makefile.in
src/Makefile.in

index 1d2a5d582e757ef3b4cf36ebd204297c26ba014e..415bcc91395be64ebd6435532afb8cd761f53704 100644 (file)
@@ -20,7 +20,7 @@ devdir = @devdir@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-SUBDIRS = compat src plugins/sample plugins/sudoers include doc
+SUBDIRS = compat common src plugins/sample plugins/sudoers include doc
 
 VERSION = @PACKAGE_VERSION@
 
similarity index 100%
rename from src/alloc.c
rename to common/alloc.c
similarity index 100%
rename from src/atobool.c
rename to common/atobool.c
similarity index 100%
rename from src/fileops.c
rename to common/fileops.c
similarity index 100%
rename from src/fmt_string.c
rename to common/fmt_string.c
similarity index 100%
rename from src/gettime.c
rename to common/gettime.c
similarity index 100%
rename from src/lbuf.c
rename to common/lbuf.c
similarity index 100%
rename from src/list.c
rename to common/list.c
similarity index 100%
rename from src/term.c
rename to common/term.c
similarity index 100%
rename from src/zero_bytes.c
rename to common/zero_bytes.c
index 13afb00f9418c380453a6514a299dc3509da0184..e24cdd9841723d141ec4acd85e1ce257c1a1e7ff 100755 (executable)
--- a/configure
+++ b/configure
@@ -18025,7 +18025,7 @@ EOF
     exec_prefix="$oexec_prefix"
 fi
 
-ac_config_files="$ac_config_files Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/sudoers/Makefile"
+ac_config_files="$ac_config_files Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/sudoers/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -18976,6 +18976,7 @@ do
     "pathnames.h") CONFIG_HEADERS="$CONFIG_HEADERS pathnames.h" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
     "compat/Makefile") CONFIG_FILES="$CONFIG_FILES compat/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
index 0f7175b871eb750247c1c314475c12104668d707..fce653e0a69a407bdbfcdfeb36ad370f26a7bc0f 100644 (file)
@@ -2741,7 +2741,7 @@ dnl
 dnl Substitute into the Makefile and man pages
 dnl
 dnl AC_CONFIG_FILES([doc/sudo.man doc/visudo.man doc/sudoers.man doc/sudoers.ldap.man doc/sudoreplay.man src/Makefile src/sudo_usage.h])
-AC_CONFIG_FILES([Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/sudoers/Makefile])
+AC_CONFIG_FILES([Makefile common/Makefile compat/Makefile doc/Makefile include/Makefile src/sudo_usage.h src/Makefile plugins/sample/Makefile plugins/sudoers/Makefile])
 AC_OUTPUT
 
 dnl
index 7ad6df1b2ade6a0b13828a8be1c32fb0b37d639d..8ffb7016a07f3166ccf220143fad8a9097cb3c4f 100644 (file)
@@ -75,10 +75,10 @@ all: sample_plugin.la
 .SUFFIXES: .o .c .h .lo
 
 .c.o:
-       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 .c.lo:
-       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 sample_plugin.lo: $(srcdir)/sample_plugin.c
 
index 3936a326a7233f84323da6e1f99d84cae4209693..37adfd1a3654ebdebab561d6d9bd8bf2251e0f3d 100644 (file)
@@ -33,7 +33,6 @@ incdir = $(top_srcdir)/include
 
 # For out of tree builds
 VPATH = $(devdir):$(srcdir):$(srcdir)/auth
-LN_S = @LN_S@
 
 # Compiler & tools to use
 CC = @CC@
@@ -45,7 +44,7 @@ YACC = @YACC@
 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
 
 # Libraries
-LIBS = $(top_builddir)/@ac_config_libobj_dir@/libreplace.la
+LIBS = $(top_builddir)/@ac_config_libobj_dir@/libreplace.la $(top_builddir)/common/libcommon.la
 NET_LIBS = @NET_LIBS@
 SUDOERS_LIBS = @SUDOERS_LIBS@ @AFS_LIBS@ @GETGROUPS_LIB@ $(LIBS) $(NET_LIBS) @ZLIB@
 REPLAY_LIBS = @REPLAY_LIBS@ @ZLIB@
@@ -99,25 +98,22 @@ SHELL = @SHELL@
 
 AUTH_OBJS = sudo_auth.lo @AUTH_OBJS@
 
-LIBSUDOERS_OBJS = alias.lo alloc.lo atobool.lo audit.lo defaults.lo gram.lo \
-                 list.lo match.lo pwutil.lo timestr.lo toke.lo redblack.lo \
-                 zero_bytes.lo @NONUNIX_GROUPS_IMPL@
+LIBSUDOERS_OBJS = alias.lo audit.lo defaults.lo gram.lo \
+                 match.lo pwutil.lo timestr.lo toke.lo redblack.lo \
+                 @NONUNIX_GROUPS_IMPL@
 
-SUDOERS_OBJS = $(AUTH_OBJS) boottime.lo check.lo fmt_string.lo \
-              plugin_error.lo env.lo getspwuid.lo gettime.lo \
-              goodpath.lo fileops.lo find_path.lo interfaces.lo lbuf.lo \
+SUDOERS_OBJS = $(AUTH_OBJS) boottime.lo check.lo \
+              plugin_error.lo env.lo getspwuid.lo \
+              goodpath.lo find_path.lo interfaces.lo \
               logging.lo parse.lo set_perms.lo sudoers.lo sudo_nss.lo \
               iolog.lo @SUDOERS_OBJS@
 
-VISUDO_OBJS = visudo.o fileops.o gettime.o goodpath.o find_path.o error.o
+VISUDO_OBJS = visudo.o goodpath.o find_path.o error.o
 
-REPLAY_OBJS = getdate.o sudoreplay.o term.o error.o
+REPLAY_OBJS = getdate.o sudoreplay.o error.o
 
 TEST_OBJS = interfaces.o testsudoers.o tsgetgrpw.o error.o
 
-LINKS = alloc.c atobool.c error.c gettime.c fileops.c fmt_string.c lbuf.c \
-       list.c term.c zero_bytes.c
-
 VERSION = @PACKAGE_VERSION@
 
 SUDODEP = $(srcdir)/sudoers.h $(incdir)/compat.h \
@@ -135,10 +131,10 @@ all: sudoers.la visudo sudoreplay testsudoers
 .SUFFIXES: .o .c .h .l .y .lo
 
 .c.o:
-       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 .c.lo:
-       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 # Prevent default rules from building .c files from .l and .y files
 .l.c:
@@ -155,7 +151,7 @@ visudo: libsudoers.la $(VISUDO_OBJS)
        $(LIBTOOL) --mode=link $(CC) -o $@ $(VISUDO_OBJS) $(LDFLAGS) libsudoers.la $(LIBS) $(NET_LIBS)
 
 sudoreplay: libsudoers.la $(REPLAY_OBJS)
-       $(LIBTOOL) --mode=link $(CC) -o $@ $(REPLAY_OBJS) $(LDFLAGS) alloc.lo timestr.lo zero_bytes.lo $(REPLAY_LIBS) $(LIBS)
+       $(LIBTOOL) --mode=link $(CC) -o $@ $(REPLAY_OBJS) $(LDFLAGS) timestr.lo $(REPLAY_LIBS) $(LIBS)
 
 testsudoers: $(TEST_OBJS)
        $(LIBTOOL) --mode=link $(CC) -o $@ $(TEST_OBJS) $(LDFLAGS) libsudoers.la $(LIBS) $(NET_LIBS)
@@ -216,33 +212,6 @@ tsgetgrpw.lo: $(srcdir)/tsgetgrpw.c $(SUDODEP)
 vasgroups.lo: $(srcdir)/vasgroups.c $(srcdir)/nonunix.h $(SUDODEP)
 plugin_error.lo: $(srcdir)/plugin_error.c $(incdir)/error.h $(incdir)/compat.h $(top_builddir)/config.h
 
-# Upper level sudo dependencies
-# We need to use links because of differences in VPATH semantics
-alloc.c: $(top_srcdir)/src/alloc.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-alloc.lo: alloc.c $(SUDODEP)
-atobool.c: $(top_srcdir)/src/atobool.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-atobool.lo: atobool.c $(SUDODEP)
-fileops.c: $(top_srcdir)/src/fileops.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-fileops.lo: fileops.c $(SUDODEP)
-fmt_string.c: $(top_srcdir)/src/fmt_string.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-fmt_string.lo: fmt_string.c $(incdir)/compat.h $(top_builddir)/config.h
-gettime.c: $(top_srcdir)/src/gettime.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-gettime.lo: gettime.c $(incdir)/compat.h $(top_builddir)/config.h
-list.c: $(top_srcdir)/src/list.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-list.lo: list.c $(SUDODEP)
-lbuf.c: $(top_srcdir)/src/lbuf.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-lbuf.lo: lbuf.c $(SUDODEP)
-zero_bytes.c: $(top_srcdir)/src/zero_bytes.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-zero_bytes.lo: zero_bytes.c $(incdir)/compat.h $(top_builddir)/config.h
-
 # Auth dependencies
 sudo_auth.lo: $(authdir)/sudo_auth.c $(AUTHDEP) $(INSDEP)
 afs.lo: $(authdir)/afs.c $(AUTHDEP)
@@ -261,20 +230,14 @@ securid5.lo: $(authdir)/securid5.c $(AUTHDEP)
 sia.lo: $(authdir)/sia.c $(AUTHDEP)
 
 # Command dependencies (sudoreplay, testsudoers, visudo)
-error.c: $(top_srcdir)/src/error.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-error.o: error.c $(incdir)/error.h $(incdir)/compat.h $(top_builddir)/config.h
-fileops.o: fileops.lo
+error.o: $(top_srcdir)/src/error.c $(incdir)/error.h $(incdir)/compat.h $(top_builddir)/config.h
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 find_path.o: find_path.lo
 getdate.o: $(devdir)/getdate.c $(incdir)/compat.h $(top_builddir)/config.h
-       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
-gettime.o: gettime.lo
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 goodpath.o: goodpath.lo
 interfaces.o: interfaces.lo
 sudoreplay.o: $(srcdir)/sudoreplay.c $(incdir)/alloc.h $(incdir)/compat.h $(incdir)/error.h $(incdir)/missing.h $(top_builddir)/config.h
-term.c: $(top_srcdir)/src/term.c
-       @$(LN_S) -f $(top_srcdir)/src/$@ $@
-term.o: term.c $(incdir)/compat.h $(top_builddir)/config.h
 testsudoers.o: $(srcdir)/testsudoers.c $(SUDODEP) $(srcdir)/parse.h $(incdir)/list.h $(srcdir)/interfaces.h $(devdir)/gram.h
 tsgetgrpw.o: $(srcdir)/tsgetgrpw.c $(SUDODEP)
 visudo.o: $(srcdir)/visudo.c $(SUDODEP) $(devdir)/gram.h
index d6df90480b9a76e03652858a416d126a0973f55e..55cdb9a7d5fcbe77755897a9190fc5a19fee4d09 100644 (file)
@@ -37,7 +37,7 @@ INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
 
 # Libraries
 LIBS = @LIBS@ @SUDO_LIBS@ @GETGROUPS_LIB@ @NET_LIBS@ \
-       $(LIBOBJDIR)libreplace.la
+       $(LIBOBJDIR)libreplace.la $(top_builddir)/common/libcommon.la
 
 # C preprocessor flags
 CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(srcdir) -I. @CPPFLAGS@
@@ -72,9 +72,8 @@ SHELL = @SHELL@
 
 PROGS = @PROGS@
 
-OBJS = alloc.o atobool.o conversation.o error.o fileops.o fmt_string.o \
-       gettime.o lbuf.o list.o load_plugins.o parse_args.o pty.o exec.o \
-       sudo.o sudo_edit.o term.o tgetpass.o ttysize.o zero_bytes.o @SUDO_OBJS@
+OBJS = conversation.o error.o load_plugins.o parse_args.o pty.o exec.o \
+       sudo.o sudo_edit.o tgetpass.o ttysize.o @SUDO_OBJS@
 
 LIBOBJDIR = $(top_builddir)/@ac_config_libobj_dir@/
 
@@ -90,10 +89,10 @@ all: $(PROGS)
 .SUFFIXES: .c .h .lo .o
 
 .c.o:
-       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 .c.lo:
-       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
+       $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
 
 sudo: $(OBJS)
        $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) -static-libtool-libs
@@ -107,15 +106,8 @@ sesh: sesh.o
 # Dependencies
 # XXX - SUDODEP is overkill for some of these
 aix.o: $(srcdir)/aix.c $(top_builddir)/config.h $(incdir)/compat.h
-alloc.o: $(srcdir)/alloc.c $(SUDODEP)
-atobool.o: $(srcdir)/atobool.c $(SUDODEP)
 conversation.o: $(srcdir)/conversation.c $(SUDODEP)
 error.o: $(srcdir)/error.c $(incdir)/compat.h $(incdir)/error.h $(top_builddir)/config.h
-fileops.o: $(srcdir)/fileops.c $(SUDODEP)
-fmt_string.o: $(srcdir)/fmt_string.c $(incdir)/compat.h $(top_builddir)/config.h
-gettime.o: $(srcdir)/gettime.c $(incdir)/compat.h $(top_builddir)/config.h
-lbuf.o: $(srcdir)/lbuf.c $(SUDODEP)
-list.o: $(srcdir)/list.c $(SUDODEP)
 load_plugins.o: $(srcdir)/load_plugins.c $(SUDODEP)
 parse_args.o: $(srcdir)/parse_args.c sudo_usage.h $(SUDODEP)
 pty.o: $(srcdir)/pty.c $(SUDODEP)
@@ -125,10 +117,8 @@ sesh.o: $(srcdir)/sesh.c $(incdir)/compat.h $(top_builddir)/config.h
 sudo.o: $(srcdir)/sudo.c $(SUDODEP)
 sudo_edit.o: $(srcdir)/sudo_edit.c $(SUDODEP)
 sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(incdir)/compat.h $(top_builddir)/config.h
-term.o: $(srcdir)/term.c $(incdir)/compat.h $(top_builddir)/config.h
 tgetpass.o: $(srcdir)/tgetpass.c $(SUDODEP)
 ttysize.o: $(srcdir)/ttysize.c $(incdir)/compat.h $(top_builddir)/config.h
-zero_bytes.o: $(srcdir)/zero_bytes.c $(incdir)/compat.h $(top_builddir)/config.h
 
 install: install-dirs install-binaries @INSTALL_NOEXEC@