From fdcbd568f2cc0b1076db32e8542e896724a1e0a3 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 12:53:47 +0200 Subject: [PATCH 01/22] =?UTF-8?q?Utvider=20`.gitignore`=20til=20=C3=A5=20i?= =?UTF-8?q?nneholde=20fler=20autotools-filer.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 66 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index cdb7675..944bc6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,58 @@ *# *.o *~ -.deps -Makefile -autom4te.cache -config.h -config.log -config.status +/.deps +/Makefile +/config.h fjernet -mysql-dbadm -mysql-useradm -pwlex.c -pwyacc.c -stamp-h -stamp-h1 +/mysql-dbadm +/mysql-useradm +/pwlex.c +/pwyacc.c +/pwyacc.h +/stamp-h + +### Autotools ### +# http://www.gnu.org/software/automake + +Makefile.in +/ar-lib +/mdate-sh +/py-compile +/test-driver +/ylwrap + +# http://www.gnu.org/software/autoconf + +autom4te.cache +/autoscan.log +/autoscan-*.log +/aclocal.m4 +/compile +/config.guess +/config.h.in +/config.log +/config.status +/config.sub +/configure +/configure.scan +/depcomp +/install-sh +/missing +/stamp-h1 + +# https://www.gnu.org/software/libtool/ + +/ltmain.sh + +# http://www.gnu.org/software/texinfo + +/texinfo.tex + +# http://www.gnu.org/software/m4/ + +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 From 772f479117672d3386ca31b86e94f1295fb1a4c2 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:01:05 +0200 Subject: [PATCH 02/22] Fjern gitignored-filer --- Makefile.in | 544 ----- aclocal.m4 | 894 -------- config.h.in | 100 - configure | 6105 --------------------------------------------------- depcomp | 472 ---- install-sh | 250 --- missing | 336 --- pwyacc.h | 17 - ylwrap | 160 -- 9 files changed, 8878 deletions(-) delete mode 100644 Makefile.in delete mode 100644 aclocal.m4 delete mode 100644 config.h.in delete mode 100755 configure delete mode 100755 depcomp delete mode 100644 install-sh delete mode 100644 missing delete mode 100644 pwyacc.h delete mode 100755 ylwrap diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 882bb62..0000000 --- a/Makefile.in +++ /dev/null @@ -1,544 +0,0 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @MYSQL_LFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MYSQL_INCLUDE = @MYSQL_INCLUDE@ -MYSQL_LFLAGS = @MYSQL_LFLAGS@ -MYSQL_LIBS = @MYSQL_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSCONFDIR = @SYSCONFDIR@ -VERSION = @VERSION@ -YACC = @YACC@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build_alias = @build_alias@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -bin_PROGRAMS = mysql-dbadm mysql-useradm -mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c -mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) -mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) -BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c -YFLAGS = -d -INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" -LDADD = @MYSQL_LIBS@ @LEXLIB@ -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = mysql-dbadm$(EXEEXT) mysql-useradm$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am__objects_1 = common.$(OBJEXT) pwyacc.$(OBJEXT) pwlex.$(OBJEXT) \ - pwfile.$(OBJEXT) -am_mysql_dbadm_OBJECTS = mysql-dbadm.$(OBJEXT) $(am__objects_1) -mysql_dbadm_OBJECTS = $(am_mysql_dbadm_OBJECTS) -mysql_dbadm_LDADD = $(LDADD) -mysql_dbadm_DEPENDENCIES = -mysql_dbadm_LDFLAGS = -am_mysql_useradm_OBJECTS = mysql-useradm.$(OBJEXT) $(am__objects_1) -mysql_useradm_OBJECTS = $(am_mysql_useradm_OBJECTS) -mysql_useradm_LDADD = $(LDADD) -mysql_useradm_DEPENDENCIES = -mysql_useradm_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/common.Po ./$(DEPDIR)/mysql-dbadm.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/mysql-useradm.Po ./$(DEPDIR)/pwfile.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/pwlex.Po ./$(DEPDIR)/pwyacc.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) -YLWRAP = $(top_srcdir)/ylwrap -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -DIST_SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES) -DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS acconfig.h aclocal.m4 config.h.in configure \ - configure.in depcomp install-sh missing mkinstalldirs pwlex.c \ - pwyacc.c pwyacc.h ylwrap -SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES) - -all: $(BUILT_SOURCES) config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .l .o .obj .y - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) - -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -$(ACLOCAL_M4): configure.in - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h - -$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h - cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/config.h.in - -distclean-hdr: - -rm -f config.h stamp-h1 -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -pwyacc.h: pwyacc.c - @if test ! -f $@; then \ - rm -f pwyacc.c; \ - $(MAKE) pwyacc.c; \ - else :; fi -mysql-dbadm$(EXEEXT): $(mysql_dbadm_OBJECTS) $(mysql_dbadm_DEPENDENCIES) - @rm -f mysql-dbadm$(EXEEXT) - $(LINK) $(mysql_dbadm_LDFLAGS) $(mysql_dbadm_OBJECTS) $(mysql_dbadm_LDADD) $(LIBS) -mysql-useradm$(EXEEXT): $(mysql_useradm_OBJECTS) $(mysql_useradm_DEPENDENCIES) - @rm -f mysql-useradm$(EXEEXT) - $(LINK) $(mysql_useradm_LDFLAGS) $(mysql_useradm_OBJECTS) $(mysql_useradm_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mysql-dbadm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mysql-useradm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwlex.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwyacc.Po@am__quote@ - -distclean-depend: - -rm -rf ./$(DEPDIR) - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.l.c: - $(SHELL) $(YLWRAP) `test -f '$<' || echo '$(srcdir)/'`$< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) - -.y.c: - $(SHELL) $(YLWRAP) `test -f '$<' || echo '$(srcdir)/'`$< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -distdir = $(PACKAGE)-$(VERSION) - -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } - -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ - && rm -f $(distdir).tar.gz \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(PROGRAMS) config.h - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -rm -f pwyacc.h - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -rm -f pwyacc.c - -rm -f pwlex.c -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags dist dist-all dist-gzip distcheck distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-hdr distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 1f13b2b..0000000 --- a/aclocal.m4 +++ /dev/null @@ -1,894 +0,0 @@ -# generated automatically by aclocal 1.7.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- - -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_PREREQ([2.52]) - -# serial 6 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - -# Do all the work for Automake. -*- Autoconf -*- - -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 10 - -AC_PREREQ([2.54]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl - -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.7.6])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# -# Check to make sure that the build environment is sane. -# - -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# -*- Autoconf -*- - - -# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -# Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50]) - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# serial 5 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 5 - -AC_PREREQ(2.52) - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) -fi])]) - - -# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -AC_PREREQ(2.50) - -# AM_PROG_LEX -# ----------- -# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a -# "missing" invocation, for better error output. -AC_DEFUN([AM_PROG_LEX], -[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl -AC_REQUIRE([AC_PROG_LEX])dnl -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi]) - diff --git a/config.h.in b/config.h.in deleted file mode 100644 index d81e018..0000000 --- a/config.h.in +++ /dev/null @@ -1,100 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ -/* - * acconfig.h - * - * @(#) $Header: /tmp/cvs/mysql-admutils/config.h.in,v 1.3 2004-11-17 00:20:08 stain Exp $ - * - */ - - -/* Define the name of the package */ -#undef PACKAGE - -/* Define the version of the package */ -#undef VERSION - -/* Define if MySQL is installed */ -#undef HAVE_MYSQL - -/* Define if you have the header file. */ -#undef HAVE_MATH_H - -/* Define if libmath is available */ -#undef HAVE_LIBM - -/* Define if libnsl is available */ -#undef HAVE_LIBNSL - -/* Define if libsocket is available */ -#undef HAVE_LIBSOCKET - - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRMSG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `unsigned' if does not define. */ -#undef size_t diff --git a/configure b/configure deleted file mode 100755 index f2baef0..0000000 --- a/configure +++ /dev/null @@ -1,6105 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="mysql-dbadm.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP LEX LEXLIB LEX_OUTPUT_ROOT YACC EGREP MYSQL_LIBS MYSQL_LFLAGS MYSQL_INCLUDE SYSCONFDIR LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors - --enable-warnings Enable -Wall -pedantic if using gcc. - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-mysql=DIR Include MySQL support. DIR is the MySQL base - install directory, defaults to /usr/local. - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core core.* *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers config.h" - -am__api_version="1.7" -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$,$program_suffix,;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - - # test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE=mysql-admutils - VERSION=0.46 - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. - - - -echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" - -fi; -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -for ac_prog in flex lex -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LEX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LEX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -LEX=$ac_cv_prog_LEX -if test -n "$LEX"; then - echo "$as_me:$LINENO: result: $LEX" >&5 -echo "${ECHO_T}$LEX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$LEX" && break -done -test -n "$LEX" || LEX=":" - -if test -z "$LEXLIB" -then - echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 -echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 -if test "${ac_cv_lib_fl_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fl_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fl_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 -if test $ac_cv_lib_fl_yywrap = yes; then - LEXLIB="-lfl" -else - echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 -echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 -if test "${ac_cv_lib_l_yywrap+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ll $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap (); -int -main () -{ -yywrap (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_l_yywrap=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_l_yywrap=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 -echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 -if test $ac_cv_lib_l_yywrap = yes; then - LEXLIB="-ll" -fi - -fi - -fi - -if test "x$LEX" != "x:"; then - echo "$as_me:$LINENO: checking lex output file root" >&5 -echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_root+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. -cat >conftest.l <<_ACEOF -%% -%% -_ACEOF -{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 - (eval $LEX conftest.l) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -if test -f lex.yy.c; then - ac_cv_prog_lex_root=lex.yy -elif test -f lexyy.c; then - ac_cv_prog_lex_root=lexyy -else - { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 -echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} - { (exit 1); exit 1; }; } -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 -rm -f conftest.l -LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root - -echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 -echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # POSIX says lex can declare yytext either as a pointer or an array; the -# default is implementation-dependent. Figure out which it is, since -# not all implementations provide the %pointer and %array declarations. -ac_cv_prog_lex_yytext_pointer=no -echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS=$LIBS -LIBS="$LIBS $LEXLIB" -cat >conftest.$ac_ext <<_ACEOF -`cat $LEX_OUTPUT_ROOT.c` -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_lex_yytext_pointer=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_save_LIBS -rm -f "${LEX_OUTPUT_ROOT}.c" - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 -echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 -if test $ac_cv_prog_lex_yytext_pointer = yes; then - -cat >>confdefs.h <<\_ACEOF -#define YYTEXT_POINTER 1 -_ACEOF - -fi - -fi -if test "$LEX" = :; then - LEX=${am_missing_run}flex -fi -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - - -echo "$as_me:$LINENO: checking for floor in -lc" >&5 -echo $ECHO_N "checking for floor in -lc... $ECHO_C" >&6 -if test "${ac_cv_lib_c_floor+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char floor (); -int -main () -{ -floor (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_c_floor=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_c_floor=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_c_floor" >&5 -echo "${ECHO_T}$ac_cv_lib_c_floor" >&6 -if test $ac_cv_lib_c_floor = yes; then - : -else - - echo "$as_me:$LINENO: checking for floor in -lm" >&5 -echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6 -if test "${ac_cv_lib_m_floor+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char floor (); -int -main () -{ -floor (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_m_floor=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_m_floor=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5 -echo "${ECHO_T}$ac_cv_lib_m_floor" >&6 -if test $ac_cv_lib_m_floor = yes; then - - LIBS="$LIBS -lm" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBM 1 -_ACEOF - -fi - -fi - -echo "$as_me:$LINENO: checking for mysql_connect in -lmysqlclient" >&5 -echo $ECHO_N "checking for mysql_connect in -lmysqlclient... $ECHO_C" >&6 -if test "${ac_cv_lib_mysqlclient_mysql_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmysqlclient $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char mysql_connect (); -int -main () -{ -mysql_connect (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mysqlclient_mysql_connect=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_mysqlclient_mysql_connect=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_connect" >&5 -echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_connect" >&6 -if test $ac_cv_lib_mysqlclient_mysql_connect = yes; then - - LIBS="$LIBS -lmysqlclient" -fi - -echo "$as_me:$LINENO: checking for gethostbyaddr in -lc" >&5 -echo $ECHO_N "checking for gethostbyaddr in -lc... $ECHO_C" >&6 -if test "${ac_cv_lib_c_gethostbyaddr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyaddr (); -int -main () -{ -gethostbyaddr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_c_gethostbyaddr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_c_gethostbyaddr=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_c_gethostbyaddr" >&5 -echo "${ECHO_T}$ac_cv_lib_c_gethostbyaddr" >&6 -if test $ac_cv_lib_c_gethostbyaddr = yes; then - : -else - - echo "$as_me:$LINENO: checking for gethostbyaddr in -lnsl" >&5 -echo $ECHO_N "checking for gethostbyaddr in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_gethostbyaddr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyaddr (); -int -main () -{ -gethostbyaddr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_nsl_gethostbyaddr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_nsl_gethostbyaddr=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyaddr" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyaddr" >&6 -if test $ac_cv_lib_nsl_gethostbyaddr = yes; then - - LIBS="$LIBS -lnsl" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBNSL 1 -_ACEOF - -fi - -fi - -echo "$as_me:$LINENO: checking for socket in -lc" >&5 -echo $ECHO_N "checking for socket in -lc... $ECHO_C" >&6 -if test "${ac_cv_lib_c_socket+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char socket (); -int -main () -{ -socket (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_c_socket=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_c_socket=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_c_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_c_socket" >&6 -if test $ac_cv_lib_c_socket = yes; then - : -else - - echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_socket+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char socket (); -int -main () -{ -socket (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_socket_socket=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_socket=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 -if test $ac_cv_lib_socket_socket = yes; then - - LIBS="$LIBS -lsocket" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBSOCKET 1 -_ACEOF - -fi - -fi - - -echo "$as_me:$LINENO: checking for MySQL support" >&5 -echo $ECHO_N "checking for MySQL support... $ECHO_C" >&6 - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -# Check whether --with-mysql or --without-mysql was given. -if test "${with_mysql+set}" = set; then - withval="$with_mysql" - - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - MYSQL_INCDIR=/usr/local/include/mysql - MYSQL_LIBDIR=/usr/local/lib/mysql - else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - MYSQL_LIBDIR=$withval/lib/mysql - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - MYSQL_LIBDIR=$withval/lib - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: Invalid MySQL directory - unable to find mysql.h under $withval" >&5 -echo "$as_me: error: Invalid MySQL directory - unable to find mysql.h under $withval" >&2;} - { (exit 1); exit 1; }; } - fi - fi - MYSQL_INCLUDE=-I$MYSQL_INCDIR - MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" - #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" - MYSQL_LIBS=-lmysqlclient - - cat >>confdefs.h <<\_ACEOF -#define HAVE_MYSQL 1 -_ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - - old_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" - -for ac_header in errmsg.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - CPPFLAGS="$old_CPPFLAGS" - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - fi - -else - - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - echo "$as_me:$LINENO: result: \"Giving up - You need to install MySQL somewhere\"" >&5 -echo "${ECHO_T}\"Giving up - You need to install MySQL somewhere\"" >&6; exit - -fi; - - - - - -echo "$as_me:$LINENO: checking whether to enable -Wall -pedantic" >&5 -echo $ECHO_N "checking whether to enable -Wall -pedantic... $ECHO_C" >&6 -# Check whether --enable-warnings or --disable-warnings was given. -if test "${enable_warnings+set}" = set; then - enableval="$enable_warnings" - if test -n "$GCC"; then - echo "$as_me:$LINENO: result: adding -Wall -pedantic to CFLAGS." >&5 -echo "${ECHO_T}adding -Wall -pedantic to CFLAGS." >&6 - CFLAGS="$CFLAGS -Wall -pedantic" - fi - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi; - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - -for ac_header in unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF - -fi - - - -for ac_func in vprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub__doprnt) || defined (__stub____doprnt) -choke me -#else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != _doprnt; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func__doprnt=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6 -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - ac_config_files="$ac_config_files Makefile" - ac_config_commands="$ac_config_commands default" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.57, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS section. -# - -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CYGPATH_W@,$CYGPATH_W,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t -s,@install_sh@,$install_sh,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t -s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t -s,@CPP@,$CPP,;t t -s,@LEX@,$LEX,;t t -s,@LEXLIB@,$LEXLIB,;t t -s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t -s,@YACC@,$YACC,;t t -s,@EGREP@,$EGREP,;t t -s,@MYSQL_LIBS@,$MYSQL_LIBS,;t t -s,@MYSQL_LFLAGS@,$MYSQL_LFLAGS,;t t -s,@MYSQL_INCLUDE@,$MYSQL_INCLUDE,;t t -s,@SYSCONFDIR@,$SYSCONFDIR,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# Compute $ac_file's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $ac_file | $ac_file:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X$ac_file | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'`/stamp-h$_am_stamp_count -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`(dirname "$mf") 2>/dev/null || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - else - continue - fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`(dirname "$file") 2>/dev/null || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p $dirpart/$fdir - else - as_dir=$dirpart/$fdir - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 -echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - default ) date > stamp-h ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/depcomp b/depcomp deleted file mode 100755 index aea3d00..0000000 --- a/depcomp +++ /dev/null @@ -1,472 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/install-sh b/install-sh deleted file mode 100644 index e843669..0000000 --- a/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/missing b/missing deleted file mode 100644 index 6a37006..0000000 --- a/missing +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/pwyacc.h b/pwyacc.h deleted file mode 100644 index a1e3432..0000000 --- a/pwyacc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BISON_Y_TAB_H -# define BISON_Y_TAB_H - -# ifndef YYSTYPE -# define YYSTYPE int -# define YYSTYPE_IS_TRIVIAL 1 -# endif -# define SET 257 -# define HOST 258 -# define USER 259 -# define PASSWORD 260 -# define STRING 261 - - -extern YYSTYPE yylval; - -#endif /* not BISON_Y_TAB_H */ diff --git a/ylwrap b/ylwrap deleted file mode 100755 index 71e5225..0000000 --- a/ylwrap +++ /dev/null @@ -1,160 +0,0 @@ -#! /bin/sh -# ylwrap - wrapper for lex/yacc invocations. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002 Free Software -# Foundation, Inc. -# -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Usage: -# ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... -# * INPUT is the input file -# * OUTPUT is file PROG generates -# * DESIRED is file we actually want -# * PROGRAM is program to run -# * ARGS are passed to PROG -# Any number of OUTPUT,DESIRED pairs may be used. - -# The input. -input="$1" -shift -case "$input" in - [\\/]* | ?:[\\/]*) - # Absolute path; do nothing. - ;; - *) - # Relative path. Make it absolute. - input="`pwd`/$input" - ;; -esac - -pairlist= -while test "$#" -ne 0; do - if test "$1" = "--"; then - shift - break - fi - pairlist="$pairlist $1" - shift -done - -# The program to run. -prog="$1" -shift -# Make any relative path in $prog absolute. -case "$prog" in - [\\/]* | ?:[\\/]*) ;; - *[\\/]*) prog="`pwd`/$prog" ;; -esac - -# FIXME: add hostname here for parallel makes that run commands on -# other machines. But that might take us over the 14-char limit. -dirname=ylwrap$$ -trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 -mkdir $dirname || exit 1 - -cd $dirname - -case $# in - 0) $prog "$input" ;; - *) $prog "$@" "$input" ;; -esac -status=$? - -if test $status -eq 0; then - set X $pairlist - shift - first=yes - # Since DOS filename conventions don't allow two dots, - # the DOS version of Bison writes out y_tab.c instead of y.tab.c - # and y_tab.h instead of y.tab.h. Test to see if this is the case. - y_tab_nodot="no" - if test -f y_tab.c || test -f y_tab.h; then - y_tab_nodot="yes" - fi - - # The directory holding the input. - input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` - # Quote $INPUT_DIR so we can use it in a regexp. - # FIXME: really we should care about more than `.' and `\'. - input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` - - while test "$#" -ne 0; do - from="$1" - # Handle y_tab.c and y_tab.h output by DOS - if test $y_tab_nodot = "yes"; then - if test $from = "y.tab.c"; then - from="y_tab.c" - else - if test $from = "y.tab.h"; then - from="y_tab.h" - fi - fi - fi - if test -f "$from"; then - # If $2 is an absolute path name, then just use that, - # otherwise prepend `../'. - case "$2" in - [\\/]* | ?:[\\/]*) target="$2";; - *) target="../$2";; - esac - - # Edit out `#line' or `#' directives. - # - # We don't want the resulting debug information to point at - # an absolute srcdir; it is better for it to just mention the - # .y file with no path. - # - # We want to use the real output file name, not yy.lex.c for - # instance. - # - # We want the include guards to be adjusted too. - FROM=`echo "$from" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - TARGET=`echo "$2" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FORM,$TO,;}" "$from" >"$target" || - status=$? - else - # A missing file is only an error for the first file. This - # is a blatant hack to let us support using "yacc -d". If -d - # is not specified, we don't want an error when the header - # file is "missing". - if test $first = yes; then - status=1 - fi - fi - shift - shift - first=no - done -else - status=$? -fi - -# Remove the directory. -cd .. -rm -rf $dirname - -exit $status From 43845d54912fa4b1bc1802e24f9ae5d47044cf18 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:02:58 +0200 Subject: [PATCH 03/22] =?UTF-8?q?Endrer=20navn=20siden=20aclocal=20=C3=B8n?= =?UTF-8?q?sker=20det.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configure.in => configure.ac | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename configure.in => configure.ac (100%) diff --git a/configure.in b/configure.ac similarity index 100% rename from configure.in rename to configure.ac From ed928a447162538492e16d463e333af82a7550b1 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:05:51 +0200 Subject: [PATCH 04/22] Fjernes siden den lages av automake --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 944bc6c..8eb03ef 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ Makefile.in /py-compile /test-driver /ylwrap +/mkinstalldirs # http://www.gnu.org/software/autoconf From bd68d879a29b2a679d571176603b62bba05e421c Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:06:47 +0200 Subject: [PATCH 05/22] Fjerner mkinstalldirs fra repo --- mkinstalldirs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 mkinstalldirs diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100644 index 460454b..0000000 --- a/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here From 856b3f71e1992c5bec5f67ebcce0eb652df45964 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:13:54 +0200 Subject: [PATCH 06/22] Luker ut install --- .gitignore | 59 ---- AUTHORS | 0 COPYING | 340 ----------------------- ChangeLog | 25 -- INSTALL | 183 ------------ Makefile.am | 9 - NEWS | 0 README | 0 acconfig.h | 29 -- common.c | 276 ------------------ configline | 44 --- configure.ac | 98 ------- mysql-admutils.h | 51 ---- mysql-dbadm.c | 707 ----------------------------------------------- mysql-useradm.c | 367 ------------------------ pwfile.c | 108 -------- pwlex.l | 47 ---- pwyacc.y | 33 --- stamp-h.in | 1 - 19 files changed, 2377 deletions(-) delete mode 100644 .gitignore delete mode 100644 AUTHORS delete mode 100644 COPYING delete mode 100644 ChangeLog delete mode 100644 INSTALL delete mode 100644 Makefile.am delete mode 100644 NEWS delete mode 100644 README delete mode 100644 acconfig.h delete mode 100644 common.c delete mode 100644 configline delete mode 100644 configure.ac delete mode 100644 mysql-admutils.h delete mode 100644 mysql-dbadm.c delete mode 100644 mysql-useradm.c delete mode 100644 pwfile.c delete mode 100644 pwlex.l delete mode 100644 pwyacc.y delete mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8eb03ef..0000000 --- a/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -*# -*.o -*~ -/.deps -/Makefile -/config.h -fjernet -/mysql-dbadm -/mysql-useradm -/pwlex.c -/pwyacc.c -/pwyacc.h -/stamp-h - -### Autotools ### -# http://www.gnu.org/software/automake - -Makefile.in -/ar-lib -/mdate-sh -/py-compile -/test-driver -/ylwrap -/mkinstalldirs - -# http://www.gnu.org/software/autoconf - -autom4te.cache -/autoscan.log -/autoscan-*.log -/aclocal.m4 -/compile -/config.guess -/config.h.in -/config.log -/config.status -/config.sub -/configure -/configure.scan -/depcomp -/install-sh -/missing -/stamp-h1 - -# https://www.gnu.org/software/libtool/ - -/ltmain.sh - -# http://www.gnu.org/software/texinfo - -/texinfo.tex - -# http://www.gnu.org/software/m4/ - -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/COPYING b/COPYING deleted file mode 100644 index eeb586b..0000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index f030463..0000000 --- a/ChangeLog +++ /dev/null @@ -1,25 +0,0 @@ -v0.50 (2006-11-20) geirha@itea.ntnu.no - * added create_tmp_table_priv - * added lock_tables_priv - * some memory leaks fixed - -v0.46 (2005-06-27) knuta@itea.ntnu.no - * Replaced deprecated functions not supported in SLES9 - -v0.42-0.45 (2002-03-07 - 2004-12-08) unknown - * Various undocumented fixes, at least something about length - of group names, I think - -v0.41 (2002-03-07) tlan@stud.ntnu.no - * Fixed a seg.fault bug in is_password_set()-routine. - -v0.4 (2002-03-07) tlan@stud.ntnu.no - * added ability to make users/dbs beginning with group-names. - * added index-priv - * added alter-priv - - -Mon Jul 6 11:58:10 1998 Vebjorn Ljosa - * Initial version. - - diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 50dbe43..0000000 --- a/INSTALL +++ /dev/null @@ -1,183 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e3a0bd7..0000000 --- a/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -bin_PROGRAMS = mysql-dbadm mysql-useradm -mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c -mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) -mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) -BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c -YFLAGS = -d -INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" -LDADD = @MYSQL_LIBS@ @LEXLIB@ -LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 76e5baf..0000000 --- a/acconfig.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * acconfig.h - * - * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ - * - */ - - -/* Define the name of the package */ -#undef PACKAGE - -/* Define the version of the package */ -#undef VERSION - -/* Define if MySQL is installed */ -#undef HAVE_MYSQL - -/* Define if you have the header file. */ -#undef HAVE_MATH_H - -/* Define if libmath is available */ -#undef HAVE_LIBM - -/* Define if libnsl is available */ -#undef HAVE_LIBNSL - -/* Define if libsocket is available */ -#undef HAVE_LIBSOCKET - diff --git a/common.c b/common.c deleted file mode 100644 index 84d9603..0000000 --- a/common.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ - * - * functions used by mysql-dbadm.c and mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -char *program_name; - -static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; - - -int -version() -{ - printf("%s %s\n", program_name, rcsheader); - exit(0); -} - - -int -wrong_use(char *format, ...) -{ - va_list ap; - - if (format) { - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - putchar('\n'); - } - - fprintf(stderr, "Try `%s --help' for more information.\n", program_name); - - return 1; -} - - -/* always returns 1. */ -int -dberror(MYSQL *pmysql, char *format, ...) -{ - const char *errmsg; - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - if (pmysql) { - errmsg = mysql_error(pmysql); - if ((errmsg) && (strcmp(errmsg, "") != 0)) - fprintf(stderr, "mysql: %s\n", errmsg); - - mysql_close(pmysql); - } - - return 1; -} - - -/* always returns 1. */ -int -fatal_error(char *format, ...) -{ - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - return 1; -} - - -/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ -int -owner(char *name) -{ - struct passwd *p; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to look up your UNIX username."); - exit(1); - } - - if (strcmp(name, p->pw_name) == 0) - return 1; /* OK */ - - if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && - (*(name + strlen(p->pw_name)) == '_')) - return 1; /* OK */ - - return 0; /* not owner if we get as far as this */ -} - -/** - * Decides if the user is member of a group. The Unix group can't contain any - * '_'. i.e 'fidi_s' won't be accepted. - */ -int -member(char *gr) { - char *username; - - char group[65]; - struct group *g; - - struct passwd *p; - char *foo; - - /* size_t i = 0; */ - - /* Get username */ - p = getpwuid(getuid()); - if (!p) { - fprintf(stderr, "Failed to look up your UNIX username."); - return 0; - } - username = p->pw_name; - - /* Copy string, but cut at '_' */ - strncpy(group, gr, 64); - group[64] = '\0'; - - // ettersom man kan få inn gruppenavn med underscore i, må man rett og - // slett prøve seg fram for å sjekke om det er en gruppe personen er med - // i. - // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test - // (som kanskje finnes), men er med i www_esb. - // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet - // ut av den, og stripper av en og en underscore til vi finner noe som - // passer. - while ( 1 ) { - -#if DEBUG -// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); -#endif - g = getgrnam(group); -#if DEBUG - printf("tror gruppenavnet er: %s\n", group); -#endif - - // hvis gruppen ikke finnes, må vi i allefall prøve å se om - // det er noe lengre inn. - if (g) { - /* Check if user is member of group */ - while(*g->gr_mem != NULL) { - char * member = *g->gr_mem++; -#if DEBUG - printf("Medlem: %s\n", member); -#endif - - if (strcmp(member,username) == 0) { -#if DEBUG - printf("You have access to '%s'\n", gr); -#endif - return 1; /* OK */ - } - } -#if DEBUG - printf("You have no access to '%s'\n", gr); -#endif - } // if - // brukeren var ikke med i gruppen, så vi må prøve neste. - - // finner den siste _-en i navnet. - foo = strrchr(group, '_'); - if (foo == NULL) { - // hvis vi har kommet helt til bunn, og fremdeles - // ikke har blitt avbrutt, fantes det ingen slik gruppe. - return 0; - } - // det som nå er bak siste underscore er passe uinteressant, så - // vi flytter slutten av strengen litt framover. - *foo = '\0'; - - } // while -} - -/* return a list of the user's groupnames */ -/* numgroups is the total number of groups found */ -char **get_group_names(int *numgroups) -{ - char **grouplist; - gid_t *gids = NULL; - int real_nr_groups, nr_groups, i; - struct group *g; - - nr_groups = 0; - - /* Find number and allocate */ - nr_groups = getgroups(0, NULL); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to find group count"); - return NULL; - } - gids = malloc(nr_groups*sizeof(gid_t)); - - /* Fetch group IDs */ - nr_groups = getgroups(nr_groups, gids); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to fetch group info"); - return NULL; - } - - grouplist = malloc((nr_groups + 1)*sizeof(char *)); - real_nr_groups = 0; - - for (i = 0; i < nr_groups; i++) { - g = getgrgid(gids[i]); - - /* Go to next grp if it doesn't have a name */ - if (g != NULL) { - grouplist[real_nr_groups++] = strdup(g->gr_name); - } else { - fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); - } - } - grouplist[real_nr_groups] = NULL; - - free(gids); - - *numgroups = real_nr_groups; - - return grouplist; -} - - -int -reload(MYSQL *pmysql) -{ - return mysql_reload(pmysql); -} - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -char *strmov(char *dest, const char *src) { - while ((*dest++ = *src++)) - ; - return dest-1; -} - -/* New database and user names may only use these characters in their - identifier */ -const char name_validchars[] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; - -/* Returns true if dbname contains only characters in name_validchars. */ -int name_isclean(char* name) { - int reallen, cleanlen; - reallen = strlen(name); - cleanlen = strspn(name, name_validchars); - return (reallen == cleanlen); -} - diff --git a/configline b/configline deleted file mode 100644 index 49f7a3f..0000000 --- a/configline +++ /dev/null @@ -1,44 +0,0 @@ - -vanlig, på linux. -./configure --with-mysql=/usr/ --sysconfdir=/etc/ - -vi burde kanskje komplisere med libmysqlclient statisk, -sånn at vi slipper avhengigheter mot en spesiell rpmpakke. - - -elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile ---- ../Makefile.org Tue Apr 8 20:20:00 2003 -+++ Makefile Tue Apr 8 20:22:27 2003 -@@ -62,8 +62,8 @@ - LEX = flex - MAKEINFO = makeinfo - MYSQL_INCLUDE = -I/store/include/mysql --MYSQL_LFLAGS = -L/store/lib/mysql --MYSQL_LIBS = -lmysqlclient -+MYSQL_LFLAGS = -+MYSQL_LIBS = - PACKAGE = mysql-admutils - SYSCONFDIR = - VERSION = 0.43 -@@ -76,8 +76,8 @@ - BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c - YFLAGS = -d - INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" --LDADD = -lmysqlclient -lfl --LDFLAGS = -L/store/lib/mysql -+LDADD = /store/lib/mysql/libmysqlclient.a -lfl -+LDFLAGS = - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - CONFIG_HEADER = config.h - - - - - - - - -$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ -$Source: /tmp/cvs/mysql-admutils/configline,v $ - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9b7bc2b..0000000 --- a/configure.ac +++ /dev/null @@ -1,98 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(mysql-dbadm.c) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(mysql-admutils, 0.46) -AM_SANITY_CHECK - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AM_PROG_LEX -AC_PROG_YACC - -dnl Checks for libraries. -AC_CHECK_LIB(c, floor, [:], [ - AC_CHECK_LIB(m, floor, [ - LIBS="$LIBS -lm" - AC_DEFINE(HAVE_LIBM) ], []) ]) -AC_CHECK_LIB(mysqlclient, mysql_connect, [ - LIBS="$LIBS -lmysqlclient" ], []) -AC_CHECK_LIB(c, gethostbyaddr, [:], [ - AC_CHECK_LIB(nsl, gethostbyaddr, [ - LIBS="$LIBS -lnsl" - AC_DEFINE(HAVE_LIBNSL) ], []) ]) -AC_CHECK_LIB(c, socket, [:], [ - AC_CHECK_LIB(socket, socket, [ - LIBS="$LIBS -lsocket" - AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) - -AC_MSG_CHECKING(for MySQL support) -AC_ARG_WITH(mysql, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base - install directory, defaults to /usr/local.], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - MYSQL_INCDIR=/usr/local/include/mysql - MYSQL_LIBDIR=/usr/local/lib/mysql - else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - MYSQL_LIBDIR=$withval/lib/mysql - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - MYSQL_LIBDIR=$withval/lib - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) - fi - fi - MYSQL_INCLUDE=-I$MYSQL_INCDIR - MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" - #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" - MYSQL_LIBS=-lmysqlclient - - AC_DEFINE(HAVE_MYSQL) - AC_MSG_RESULT(yes) - - dnl check for errmsg.h, which isn't installed by some versions of 3.21 - old_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" - AC_CHECK_HEADERS(errmsg.h) - CPPFLAGS="$old_CPPFLAGS" - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) - AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit -]) -AC_SUBST(MYSQL_LIBS) -AC_SUBST(MYSQL_LFLAGS) -AC_SUBST(MYSQL_INCLUDE) - - -AC_MSG_CHECKING([whether to enable -Wall -pedantic]) -AC_ARG_ENABLE(warnings, -[ --enable-warnings Enable -Wall -pedantic if using gcc.], -[ if test -n "$GCC"; then - AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) - CFLAGS="$CFLAGS -Wall -pedantic" - fi -],AC_MSG_RESULT(no)) - - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_VPRINTF - -AC_SUBST(SYSCONFDIR) - -AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h deleted file mode 100644 index 1ee0cdc..0000000 --- a/mysql-admutils.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ - * - */ - -#ifndef MYSQL_ADMUTILS_H -#define MYSQL_ADMUTILS_H - -extern char *program_name; - -/* defined in pwfile.c */ -extern const char *db_server; -extern const char *db_user; -extern const char *db_passwd; -extern const char *db_name; - -extern int -wrong_use(char *format, ...); - -extern int -fatal_error(char *format, ...); - -extern int -owner(char *name); - -extern int member(char *gr); - -extern char **get_group_names(int *numgroups); - -extern int -version(void); - -extern int -read_config_file(void); - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -extern char *strmov(char *, const char *); - -extern int name_isclean(char*); - -#ifdef _mysql_h - -extern int -dberror(MYSQL *pmysql, char *format, ...); - -extern int -reload(MYSQL *pmysql); - -#endif - -#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c deleted file mode 100644 index d80ed86..0000000 --- a/mysql-dbadm.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ - * - * mysql-dbadm.c - * - */ - -#include "config.h" -#include "mysql-admutils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char * -strchr_whitespace(const char *s) -{ - char *sp, *tab; - sp = strchr(s, ' '); - tab = strchr(s, '\t'); - if (sp == NULL) - return tab; - if (tab == NULL) - return sp; - return sp < tab ? sp : tab; /* if both are found, return the first one */ -} - -char * -strtok_whitespace(char *s) -{ - static char *cp; - char *r; - - r = s ? s : cp; - if (r == NULL) - return NULL; - cp = strchr_whitespace(r); - if (cp == NULL) - return r; - while ((*cp == ' ') || (*cp == '\t')) - *cp++ = '\0'; - return r; -} - - -int -valid_priv(const char *s) -{ - if (s == NULL) return 0; -#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 - ACCEPT("Y"); - ACCEPT("N"); - ACCEPT("y"); - ACCEPT("n"); -#undef ACCEPT - return 0; /* not a valid priv */ -} - - -int -usage() -{ - printf("Usage: %s COMMAND [DATABASE]...\n", program_name); - printf("Create, drop og edit permission for the DATABASE(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the DATABASE(s).\n"); - printf(" drop delete the DATABASE(s).\n"); - printf(" show give information about the DATABASE(s), or, if\n"); - printf(" none are given, all the ones you own.\n"); - printf(" editperm change permissions for the DATABASE(s). Your\n"); - printf(" favorite editor will be started, allowing you\n"); - printf(" to make changes to the permission table.\n"); - printf(" Run '%s --help-editperm' for more\n" - " information.\n",program_name); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - -int -usage_editperm() -{ - printf("Usage: %s editperm [DATABASE]\n", program_name); - printf("Edit permissions for the DATABASE. Running this command will\n"); - printf("spawn the editor stored in the $EDITOR environment variable.\n"); - printf("(pico will be used if the variable is unset)\n"); - printf("\n"); - printf("The file should contain one line per user, starting with the\n"); - printf("username and followed by ten Y/N-values seperated by whitespace.\n"); - printf("Lines starting with # are ignored.\n"); - printf("\n"); - printf("The Y/N-values corresponds to the following mysql privileges:\n"); - printf(" Select - Enables use of SELECT\n"); - printf(" Insert - Enables use of INSERT\n"); - printf(" Update - Enables use of UPDATE\n"); - printf(" Delete - Enables use of DELETE\n"); - printf(" Create - Enables use of CREATE TABLE\n"); - printf(" Drop - Enables use of DROP TABLE\n"); - printf(" Alter - Enables use of ALTER TABLE\n"); - printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); - printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); - printf(" Lock - Enables use of LOCK TABLE\n"); - printf(" References - Enables use of REFERENCES\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -create(MYSQL *pmysql, char *db) -{ - // hvis man forsøker å dra mysql_create_db() på en database som - // allerede finnes, så henger bare hele sql-kallet. Vi må derfor - // forsøke å selecte databasen først. Ettersom man alltid er root, - // går jo dette vanligvis bra. - // finner ut om denne finnes fra før. - if (!mysql_select_db(pmysql, db)) { - return dberror(pmysql, "Database '%s' already exists.", db); - } - mysql_select_db(pmysql, "mysql"); - // oppretter databasen. - char query[1024], *end; - end = strmov(query, "CREATE DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot create database '%s'.", db); - fprintf(stderr, "Database '%s' created.\n", db); - return 0; -} - - -int -drop(MYSQL *pmysql, char *db) -{ - char query[1024], *end; - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete permissions for database '%s'.", db); - - if (mysql_select_db(pmysql, db)) { - dberror(pmysql, "Database '%s' doesn't exists.", db); - return 0; - } - mysql_select_db(pmysql, "mysql"); - - end = strmov(query, "DROP DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot drop database '%s'.", db); - - fprintf(stderr, "Database '%s' dropped.\n", db); - return 0; -} - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char *wild; - char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ - MYSQL_RES *res; - int rows, numgroups, numgroupdbs; - MYSQL_ROW row; - char **dblist; - int i, counter; - struct passwd *p; - - // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. - char escaped_user[64]; - char *cp_kopi; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to lookup your UNIX username."); - exit(1); - } - - dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ - - numgroupdbs = 0; - counter = 0; - - usr_groups = get_group_names(&numgroups); - cp = usr_groups; - while (cp && *cp) { // itererer over alle grupper en person er med i - if (*cp == NULL) - break; - -#ifdef DEBUG - printf("cp er %s\n", *cp); -#endif - - escaped_user[0] = '\0'; - cp_kopi=*cp; - -// itererer over bokstavene i gruppenavn, og escaper spesialtegn. - for(i=0; i<=strlen(cp_kopi); i++) { - // hvis % _ , så skriv \ og så tegn - if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { - strcat(escaped_user, "\\"); - } - - escaped_user[strlen(escaped_user) + 1] = '\0'; - escaped_user[strlen(escaped_user)] = cp_kopi[i]; - } // for - - wild = malloc(strlen(escaped_user)+4); - sprintf(wild, "%s\\_%%", escaped_user); - -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - - if (rows > 0) { - numgroupdbs += rows; - - dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - } - - - free(wild); - mysql_free_result(res); - cp++; - } - - wild = malloc(strlen(p->pw_name) + 4); - sprintf(wild, "%s\\_%%", p->pw_name); -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); - - if (!dblist) { - dberror(NULL, "Out of memory.\n"); - free(wild); - return NULL; - } - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - mysql_free_result(res); - - res = mysql_list_dbs(pmysql, p->pw_name); - rows = mysql_num_rows(res); - if (rows == 1) - dblist[counter++] = strdup(p->pw_name); - - dblist[counter] = NULL; - - mysql_free_result(res); - free(wild); - for (i=0;inet.fd) != 0) - { - perror("Failed to close fd"); - exit(1); - } - - editor = getenv("EDITOR"); - if (!editor) - editor = "pico"; /* OK since editor won't be freed */ - - cmd = malloc(sizeof(char) * strlen(editor) + 7); - sprintf(cmd, "%s \"$1\"", editor); - - /* sh -c '$EDITOR "$1"' sh "$fn" */ - execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); - perror("Failed to execute editor"); - fprintf(stderr, "Make sure the EDITOR environment variable contains" - " a valid editor\n"); - exit(1); - } - - if (exit_status != 0) - return 1; - - /* parse */ - f = fopen(fn, "r"); - lines = 0; - while (fgets(line, sizeof(line), f)) { - cp = strchr(line, '\n'); - if (cp) - *cp = '\0'; - - cp = line; - while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; - if (*cp == '\0') continue; - if (*cp == '#') continue; - if (*cp == '\n') continue; - - #define STRTOK_WHITESPACE(res, start) \ - { if (!(res = strtok_whitespace(start))) continue; } - - STRTOK_WHITESPACE(user, cp); - if (strlen(user) < 1) - return dberror(NULL, "Invalid user '%s' in grant line %d.", user, - lines + 1); - if (strcmp(user, "%") == 0) - *user = '\0'; /* ugly, but it works... */ - - #define CHECK_PRIV(PRIV) \ - if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ - "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ - "all ten privileges.\nRun '%s --help-editerm' for more " \ - "information.\nNo permissions have been set.", PRIV, lines + 1, \ - program_name) - - STRTOK_WHITESPACE(select_priv, NULL); - CHECK_PRIV(select_priv); - STRTOK_WHITESPACE(insert_priv, NULL); - CHECK_PRIV(insert_priv); - STRTOK_WHITESPACE(update_priv, NULL); - CHECK_PRIV(update_priv); - STRTOK_WHITESPACE(delete_priv, NULL); - CHECK_PRIV(delete_priv); - STRTOK_WHITESPACE(create_priv, NULL); - CHECK_PRIV(create_priv); - STRTOK_WHITESPACE(drop_priv, NULL); - CHECK_PRIV(drop_priv); - STRTOK_WHITESPACE(alter_priv, NULL); - CHECK_PRIV(alter_priv); - STRTOK_WHITESPACE(index_priv, NULL); - CHECK_PRIV(index_priv); - STRTOK_WHITESPACE(create_tmp_table_priv, NULL); - CHECK_PRIV(create_tmp_table_priv); - STRTOK_WHITESPACE(lock_tables_priv, NULL); - CHECK_PRIV(lock_tables_priv); - STRTOK_WHITESPACE(references_priv, NULL); - CHECK_PRIV(references_priv); - - #undef STRTOK_WHITESPACE - #undef CHECK_PRIV - - end = strmov(query, "INSERT INTO db (" - "host,db,user,select_priv,insert_priv," - "update_priv,delete_priv,create_priv," - "drop_priv,alter_priv,index_priv," - "create_tmp_table_priv,lock_tables_priv," - "references_priv" - ") VALUES ("); - - end = strmov(end, "'%'"); - - #define APPEND(VAR) {\ - *end++ = ',';\ - *end++ = '\'';\ - end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ - *end++ = '\'';\ - } - - APPEND(db); - APPEND(user); - APPEND(select_priv); - APPEND(insert_priv); - APPEND(update_priv); - APPEND(delete_priv); - APPEND(create_priv); - APPEND(drop_priv); - APPEND(alter_priv); - APPEND(index_priv); - APPEND(create_tmp_table_priv); - APPEND(lock_tables_priv); - APPEND(references_priv); - *end++ = ')'; - *end = '\0'; - - #undef APPEND - - queries[lines] = strdup(query); - lines++; - if (lines >= MAX_GRANTS) - { - dberror(NULL, "Warning: Maximum of %d grants reached.\n", - MAX_GRANTS); - continue; - } - } /* while fgets ... */ - - unlink(fn); - fclose(f); - - /* now that we have checked the input for errors, we can safely - delete the old grants from the database and insert the new ones. */ - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete old grants for '%s'.", db); - - for (i = 0; i < lines; i++) - { -#ifdef DEBUG - puts(queries[i]); - putchar('\n'); -#endif - if (mysql_query(pmysql, queries[i])) - dberror(pmysql, "Failed to insert grant line %d.", i + 1); - free(queries[i]); - } - - fprintf(stderr,"Permissions updated\n"); - - return 0; -} - - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_drop, c_editperm, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char *db; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help-editperm") == 0) - return usage_editperm(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - - if (argc < 2) - return wrong_use(NULL); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "drop") == 0) - command = c_drop; - else if (strcmp(argv[1], "editperm") == 0) - command = c_editperm; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command"); /* XXX */ - - /* all other than show requires at least one DATABASE argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) { - dblist = list(&mysql); - p = dblist; - while (p && *p) { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - db = malloc(64); - /* for each supplied database name, perform the requested action */ - for (i = 2; i < argc; i++) { - // HE HE - strncpy(db, argv[i], 32); - db[32] = '\0'; - - if (! (owner(db) || member(db))) { - if (command == c_create) - dberror(NULL,"Unable to create mysql-database '%s'.\n" - "A mysql-database must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are a " - "member of.\n", - db, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); - continue; - } - - switch (command) { - case c_create: - // We only check newly created databases. Many old ("unclean") databases are still in use. - if(name_isclean(db)) { - create(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_drop: - if(name_isclean(db)) { - drop(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_editperm: - if(name_isclean(db)) { - editperm(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_show: - if(name_isclean(db)) { - show(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - default: - return dberror(NULL, "This point should never be reached!"); - } - } // for - free(db); - } // else - - mysql_reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/mysql-useradm.c b/mysql-useradm.c deleted file mode 100644 index 04bcdca..0000000 --- a/mysql-useradm.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ - * - * mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -int -usage() -{ - printf("Usage: %s COMMAND [USER]...\n", program_name); - printf("Create, delete or change password for the USER(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the USER(s).\n"); - printf(" delete delete the USER(s).\n"); - printf(" passwd change the MySQL password for the USER(s).\n"); - printf(" show give information about the USERS(s), or, if\n"); - printf(" none are given, all the users you have.\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -is_password_set(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - MYSQL_RES *res; - int rows; - MYSQL_ROW row; - int check = 0; - - end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to look up password for user '%s'.", user); - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - - if (rows > 1) - { - mysql_free_result(res); - return dberror(NULL, "Query for password for user '%s' gave %d results!", - user, rows); - } - else if (rows < 1) { - mysql_free_result(res); - return -1; - } - - row = mysql_fetch_row(res); - check = (row[0] && (strlen(row[0]) > 0)); - mysql_free_result(res); - - return check; -} - - -int -create(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "CREATE USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "'"); - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to create user '%s'.", user); - - return 0; -} - - -int -delete(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "DROP USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to delete user '%s'.", user); - - return 0; -} - - -int -passwd(MYSQL *pmysql, const char *user) -{ - char prompt[1024]; - char query[1024], *end; - char *password, *confirm_password; - - if (is_password_set(pmysql, user) == -1) /* no such mysql user */ - return dberror(NULL, "User '%s' does not exist." - " You must create it first.\n", user); - - sprintf(prompt, "New MySQL password for user '%s': ", user); - password = getpass(prompt); - confirm_password = strdup(password); - sprintf(prompt, "Retype new MySQL password for user '%s': ", user); - password = getpass(prompt); - if (strcmp(password, confirm_password) != 0) - { - free(confirm_password); - return dberror(NULL, "Sorry, passwords do not match."); - } - free(confirm_password); - - end = strmov(query, "ALTER user '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "' IDENTIFIED BY '"); - end += mysql_real_escape_string(pmysql, end, password, strlen(password)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to set new password for user '%s'.", user); - if (mysql_affected_rows(pmysql) != 1) - dberror(NULL, "%d rows affected by password update for user '%s'!", - mysql_affected_rows(pmysql), user); - - fprintf(stderr, "Password updated for user '%s'.\n", user); - return 0; -} - - -int -show(MYSQL *pmysql, const char *user) -{ - switch (is_password_set(pmysql, user)) - { - case -1: - break; - case 0: - printf("User '%s': ", user); - printf("no password set.\n"); - break; - case 1: - printf("User '%s': ", user); - printf("password set.\n"); - break; - } - return 0; -} - - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char query[4096], *end; - char **usrgroups, **cp; - MYSQL_RES *res; - int rows, numgroups; - MYSQL_ROW row; - char **userlist; - int i; - struct passwd *p; - - p = getpwuid(getuid()); - - end = strmov(query, "SELECT user FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "\\_%'"); - - numgroups = 0; - - usrgroups = get_group_names(&numgroups); - cp = usrgroups; - while (cp && *cp) { - end = strmov(end, " OR user='"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "\\_%'"); - free(*cp); - cp++; - } - free(usrgroups); - -#ifdef DEBUG - printf("about to run query: %s\n", query); -#endif - - if (mysql_query(pmysql, query)) - { - dberror(pmysql, "Failed to look up %s's users.", p->pw_name); - return NULL; - } - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - userlist = malloc((rows + 1) * sizeof(char *)); - if (!userlist) - { - dberror(NULL, "%s: Out of memory.\n", program_name); - return NULL; - } - for (i = 0; i < rows; i++) - if ((row = mysql_fetch_row(res))) - { - userlist[i] = strdup(row[0]); - } - - userlist[i] = NULL; - - mysql_free_result(res); - - return userlist; -} - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_delete, c_passwd, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char user[65]; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - if (argc < 2) - return wrong_use(NULL); - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "delete") == 0) - command = c_delete; - else if (strcmp(argv[1], "passwd") == 0) - command = c_passwd; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ - - /* all other than show requires at least one USER argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) - { - dblist = list(&mysql); - p = dblist; - while (p && *p) - { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - /* for each supplied database name, perform the requested action */ - - for (i = 2; i < argc; i++) { - strncpy(user, argv[i], 32); - user[33] = '\0'; - if (! (owner(user) || member(user))) - { - if (command == c_create) - dberror(NULL,"Unable to create mysql-user '%s'.\n" - - "A mysql-user must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are " - "a member of.\n", - user, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); - continue; - } - - switch (command) - { - case c_create: - if(name_isclean(user)) { - create(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_delete: - if(name_isclean(user)) { - delete(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_passwd: - if(name_isclean(user)) { - passwd(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_show: - if(name_isclean(user)) { - show(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - default: - fprintf(stderr, "This point should never be reached.\n"); - exit(1); - } - } - } - - reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/pwfile.c b/pwfile.c deleted file mode 100644 index ce2e573..0000000 --- a/pwfile.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ - * - * functions for parsing the config file. - * - */ - -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" -#include "pwyacc.h" - -/* the MySQL maximum */ -#define MAXPWCHARS 16 - -/* defaults for configurable values */ -const char* db_user = "root"; -const char* db_server = "localhost"; -const char* db_passwd = NULL; -const char* db_name = "mysql"; - -extern int yyparse(void); -extern FILE *yyin; - -int config_line = 1; - -static FILE *pwfile; -static char *filename = SYSCONFDIR "/mysql-admutils.conf"; - -int -read_config_file(void) -{ - struct rlimit rlim; - int rc; /* return code */ - - /* to stop the user from obtaining the password from a core dump. */ - if (getrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("getrlimit"); - exit(1); - } - rlim.rlim_max = 0; - if (setrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("setrlimit"); - exit(1); - } - - pwfile = fopen(filename, "r"); - if (!pwfile) { - fatal_error("cannot open configuration file %s", filename); - exit(1); - } - - /* we don't need to be SUID anymore. */ - if (seteuid(getuid()) != 0) - perror("seteuid"); - - yyin = pwfile; - rc = yyparse(); - fclose(pwfile); - - return rc; -} - - -int -yywrap(void) -{ - return 1; -} - - -int -yyerror(const char *msg) -{ - fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); - return 0; -} - - -int -config_set_string_var(int var, const char *value) -{ - assert(value); - switch (var) { - case USER: - db_user = value; - break; - case HOST: - db_server = value; - break; - case PASSWORD: - if (strlen(value) > MAXPWCHARS) { - fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", - filename, config_line, strlen(value), MAXPWCHARS); - fclose(pwfile); - exit(1); - } - db_passwd = value; - break; - default: - assert(!"We should never get here."); - } - return 0; -} diff --git a/pwlex.l b/pwlex.l deleted file mode 100644 index 457ef74..0000000 --- a/pwlex.l +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * lex source for the configuration file - * - */ - -%{ -#include -#include -#include "pwyacc.h" - -extern int config_line; -extern int yylval; -%} - -%% - -#.*\n config_line++; - -set { yylval = SET; return(SET); } -host { yylval = HOST; return(HOST); }; -user { yylval = USER; return(USER); }; -password { yylval = PASSWORD; return(PASSWORD); } - -\"[^"]*\" { - if (yytext[yyleng - 1] == '\\') - yymore(); - else - yytext[yyleng - 1] = '\0'; - yylval = (int)strdup(yytext + 1); - return(STRING); - }; - -; return(';'); - -[^ \t\n\;]* { - yylval = (int)strdup(yytext); - return(STRING); - } - -[ \t] ; - -\n config_line++; - -%% - diff --git a/pwyacc.y b/pwyacc.y deleted file mode 100644 index 1a39886..0000000 --- a/pwyacc.y +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * yacc source for parsing the configuration file - * - */ - -%{ -int yyerror(const char *msg); -int yylex(void); -int config_set_string_var(int var, const char *value); -%} - -%token SET HOST USER PASSWORD STRING - -%% - -input: ; -input: statement input ; - -statement: SET variable STRING ';' - { - $$ = config_set_string_var($2, (const char *)$3); - } - -; - -variable: USER | PASSWORD | HOST - { $$ = $1; } - ; - -%% - diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp From 332ca2ece9f7a461d82c505e5b2943df8be80358 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:15:01 +0200 Subject: [PATCH 07/22] Luker ut install --- .gitignore | 60 ++++ AUTHORS | 0 COPYING | 340 +++++++++++++++++++++++ ChangeLog | 25 ++ Makefile.am | 9 + NEWS | 0 README | 0 acconfig.h | 29 ++ common.c | 276 ++++++++++++++++++ configline | 44 +++ configure.ac | 98 +++++++ mysql-admutils.h | 51 ++++ mysql-dbadm.c | 707 +++++++++++++++++++++++++++++++++++++++++++++++ mysql-useradm.c | 367 ++++++++++++++++++++++++ pwfile.c | 108 ++++++++ pwlex.l | 47 ++++ pwyacc.y | 33 +++ stamp-h.in | 1 + 18 files changed, 2195 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 acconfig.h create mode 100644 common.c create mode 100644 configline create mode 100644 configure.ac create mode 100644 mysql-admutils.h create mode 100644 mysql-dbadm.c create mode 100644 mysql-useradm.c create mode 100644 pwfile.c create mode 100644 pwlex.l create mode 100644 pwyacc.y create mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73a87e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,60 @@ +*# +*.o +*~ +/.deps +/Makefile +/config.h +fjernet +/mysql-dbadm +/mysql-useradm +/pwlex.c +/pwyacc.c +/pwyacc.h +/stamp-h + +### Autotools ### +# http://www.gnu.org/software/automake + +Makefile.in +/ar-lib +/mdate-sh +/py-compile +/test-driver +/ylwrap +/mkinstalldirs +/INSTALL + +# http://www.gnu.org/software/autoconf + +autom4te.cache +/autoscan.log +/autoscan-*.log +/aclocal.m4 +/compile +/config.guess +/config.h.in +/config.log +/config.status +/config.sub +/configure +/configure.scan +/depcomp +/install-sh +/missing +/stamp-h1 + +# https://www.gnu.org/software/libtool/ + +/ltmain.sh + +# http://www.gnu.org/software/texinfo + +/texinfo.tex + +# http://www.gnu.org/software/m4/ + +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f030463 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,25 @@ +v0.50 (2006-11-20) geirha@itea.ntnu.no + * added create_tmp_table_priv + * added lock_tables_priv + * some memory leaks fixed + +v0.46 (2005-06-27) knuta@itea.ntnu.no + * Replaced deprecated functions not supported in SLES9 + +v0.42-0.45 (2002-03-07 - 2004-12-08) unknown + * Various undocumented fixes, at least something about length + of group names, I think + +v0.41 (2002-03-07) tlan@stud.ntnu.no + * Fixed a seg.fault bug in is_password_set()-routine. + +v0.4 (2002-03-07) tlan@stud.ntnu.no + * added ability to make users/dbs beginning with group-names. + * added index-priv + * added alter-priv + + +Mon Jul 6 11:58:10 1998 Vebjorn Ljosa + * Initial version. + + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e3a0bd7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,9 @@ +bin_PROGRAMS = mysql-dbadm mysql-useradm +mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c +mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) +mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) +BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c +YFLAGS = -d +INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" +LDADD = @MYSQL_LIBS@ @LEXLIB@ +LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..76e5baf --- /dev/null +++ b/acconfig.h @@ -0,0 +1,29 @@ +/* + * acconfig.h + * + * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ + * + */ + + +/* Define the name of the package */ +#undef PACKAGE + +/* Define the version of the package */ +#undef VERSION + +/* Define if MySQL is installed */ +#undef HAVE_MYSQL + +/* Define if you have the header file. */ +#undef HAVE_MATH_H + +/* Define if libmath is available */ +#undef HAVE_LIBM + +/* Define if libnsl is available */ +#undef HAVE_LIBNSL + +/* Define if libsocket is available */ +#undef HAVE_LIBSOCKET + diff --git a/common.c b/common.c new file mode 100644 index 0000000..84d9603 --- /dev/null +++ b/common.c @@ -0,0 +1,276 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ + * + * functions used by mysql-dbadm.c and mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +char *program_name; + +static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; + + +int +version() +{ + printf("%s %s\n", program_name, rcsheader); + exit(0); +} + + +int +wrong_use(char *format, ...) +{ + va_list ap; + + if (format) { + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + putchar('\n'); + } + + fprintf(stderr, "Try `%s --help' for more information.\n", program_name); + + return 1; +} + + +/* always returns 1. */ +int +dberror(MYSQL *pmysql, char *format, ...) +{ + const char *errmsg; + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + if (pmysql) { + errmsg = mysql_error(pmysql); + if ((errmsg) && (strcmp(errmsg, "") != 0)) + fprintf(stderr, "mysql: %s\n", errmsg); + + mysql_close(pmysql); + } + + return 1; +} + + +/* always returns 1. */ +int +fatal_error(char *format, ...) +{ + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return 1; +} + + +/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ +int +owner(char *name) +{ + struct passwd *p; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to look up your UNIX username."); + exit(1); + } + + if (strcmp(name, p->pw_name) == 0) + return 1; /* OK */ + + if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && + (*(name + strlen(p->pw_name)) == '_')) + return 1; /* OK */ + + return 0; /* not owner if we get as far as this */ +} + +/** + * Decides if the user is member of a group. The Unix group can't contain any + * '_'. i.e 'fidi_s' won't be accepted. + */ +int +member(char *gr) { + char *username; + + char group[65]; + struct group *g; + + struct passwd *p; + char *foo; + + /* size_t i = 0; */ + + /* Get username */ + p = getpwuid(getuid()); + if (!p) { + fprintf(stderr, "Failed to look up your UNIX username."); + return 0; + } + username = p->pw_name; + + /* Copy string, but cut at '_' */ + strncpy(group, gr, 64); + group[64] = '\0'; + + // ettersom man kan få inn gruppenavn med underscore i, må man rett og + // slett prøve seg fram for å sjekke om det er en gruppe personen er med + // i. + // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test + // (som kanskje finnes), men er med i www_esb. + // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet + // ut av den, og stripper av en og en underscore til vi finner noe som + // passer. + while ( 1 ) { + +#if DEBUG +// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); +#endif + g = getgrnam(group); +#if DEBUG + printf("tror gruppenavnet er: %s\n", group); +#endif + + // hvis gruppen ikke finnes, må vi i allefall prøve å se om + // det er noe lengre inn. + if (g) { + /* Check if user is member of group */ + while(*g->gr_mem != NULL) { + char * member = *g->gr_mem++; +#if DEBUG + printf("Medlem: %s\n", member); +#endif + + if (strcmp(member,username) == 0) { +#if DEBUG + printf("You have access to '%s'\n", gr); +#endif + return 1; /* OK */ + } + } +#if DEBUG + printf("You have no access to '%s'\n", gr); +#endif + } // if + // brukeren var ikke med i gruppen, så vi må prøve neste. + + // finner den siste _-en i navnet. + foo = strrchr(group, '_'); + if (foo == NULL) { + // hvis vi har kommet helt til bunn, og fremdeles + // ikke har blitt avbrutt, fantes det ingen slik gruppe. + return 0; + } + // det som nå er bak siste underscore er passe uinteressant, så + // vi flytter slutten av strengen litt framover. + *foo = '\0'; + + } // while +} + +/* return a list of the user's groupnames */ +/* numgroups is the total number of groups found */ +char **get_group_names(int *numgroups) +{ + char **grouplist; + gid_t *gids = NULL; + int real_nr_groups, nr_groups, i; + struct group *g; + + nr_groups = 0; + + /* Find number and allocate */ + nr_groups = getgroups(0, NULL); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to find group count"); + return NULL; + } + gids = malloc(nr_groups*sizeof(gid_t)); + + /* Fetch group IDs */ + nr_groups = getgroups(nr_groups, gids); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to fetch group info"); + return NULL; + } + + grouplist = malloc((nr_groups + 1)*sizeof(char *)); + real_nr_groups = 0; + + for (i = 0; i < nr_groups; i++) { + g = getgrgid(gids[i]); + + /* Go to next grp if it doesn't have a name */ + if (g != NULL) { + grouplist[real_nr_groups++] = strdup(g->gr_name); + } else { + fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); + } + } + grouplist[real_nr_groups] = NULL; + + free(gids); + + *numgroups = real_nr_groups; + + return grouplist; +} + + +int +reload(MYSQL *pmysql) +{ + return mysql_reload(pmysql); +} + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +char *strmov(char *dest, const char *src) { + while ((*dest++ = *src++)) + ; + return dest-1; +} + +/* New database and user names may only use these characters in their + identifier */ +const char name_validchars[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; + +/* Returns true if dbname contains only characters in name_validchars. */ +int name_isclean(char* name) { + int reallen, cleanlen; + reallen = strlen(name); + cleanlen = strspn(name, name_validchars); + return (reallen == cleanlen); +} + diff --git a/configline b/configline new file mode 100644 index 0000000..49f7a3f --- /dev/null +++ b/configline @@ -0,0 +1,44 @@ + +vanlig, på linux. +./configure --with-mysql=/usr/ --sysconfdir=/etc/ + +vi burde kanskje komplisere med libmysqlclient statisk, +sånn at vi slipper avhengigheter mot en spesiell rpmpakke. + + +elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile +--- ../Makefile.org Tue Apr 8 20:20:00 2003 ++++ Makefile Tue Apr 8 20:22:27 2003 +@@ -62,8 +62,8 @@ + LEX = flex + MAKEINFO = makeinfo + MYSQL_INCLUDE = -I/store/include/mysql +-MYSQL_LFLAGS = -L/store/lib/mysql +-MYSQL_LIBS = -lmysqlclient ++MYSQL_LFLAGS = ++MYSQL_LIBS = + PACKAGE = mysql-admutils + SYSCONFDIR = + VERSION = 0.43 +@@ -76,8 +76,8 @@ + BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c + YFLAGS = -d + INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" +-LDADD = -lmysqlclient -lfl +-LDFLAGS = -L/store/lib/mysql ++LDADD = /store/lib/mysql/libmysqlclient.a -lfl ++LDFLAGS = + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = config.h + + + + + + + + +$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ +$Source: /tmp/cvs/mysql-admutils/configline,v $ + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..9b7bc2b --- /dev/null +++ b/configure.ac @@ -0,0 +1,98 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(mysql-dbadm.c) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(mysql-admutils, 0.46) +AM_SANITY_CHECK + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AM_PROG_LEX +AC_PROG_YACC + +dnl Checks for libraries. +AC_CHECK_LIB(c, floor, [:], [ + AC_CHECK_LIB(m, floor, [ + LIBS="$LIBS -lm" + AC_DEFINE(HAVE_LIBM) ], []) ]) +AC_CHECK_LIB(mysqlclient, mysql_connect, [ + LIBS="$LIBS -lmysqlclient" ], []) +AC_CHECK_LIB(c, gethostbyaddr, [:], [ + AC_CHECK_LIB(nsl, gethostbyaddr, [ + LIBS="$LIBS -lnsl" + AC_DEFINE(HAVE_LIBNSL) ], []) ]) +AC_CHECK_LIB(c, socket, [:], [ + AC_CHECK_LIB(socket, socket, [ + LIBS="$LIBS -lsocket" + AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) + +AC_MSG_CHECKING(for MySQL support) +AC_ARG_WITH(mysql, +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) + fi + fi + MYSQL_INCLUDE=-I$MYSQL_INCDIR + MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" + #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" + MYSQL_LIBS=-lmysqlclient + + AC_DEFINE(HAVE_MYSQL) + AC_MSG_RESULT(yes) + + dnl check for errmsg.h, which isn't installed by some versions of 3.21 + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" + AC_CHECK_HEADERS(errmsg.h) + CPPFLAGS="$old_CPPFLAGS" + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) + AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit +]) +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_LFLAGS) +AC_SUBST(MYSQL_INCLUDE) + + +AC_MSG_CHECKING([whether to enable -Wall -pedantic]) +AC_ARG_ENABLE(warnings, +[ --enable-warnings Enable -Wall -pedantic if using gcc.], +[ if test -n "$GCC"; then + AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) + CFLAGS="$CFLAGS -Wall -pedantic" + fi +],AC_MSG_RESULT(no)) + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +dnl Checks for library functions. +AC_FUNC_VPRINTF + +AC_SUBST(SYSCONFDIR) + +AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h new file mode 100644 index 0000000..1ee0cdc --- /dev/null +++ b/mysql-admutils.h @@ -0,0 +1,51 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ + * + */ + +#ifndef MYSQL_ADMUTILS_H +#define MYSQL_ADMUTILS_H + +extern char *program_name; + +/* defined in pwfile.c */ +extern const char *db_server; +extern const char *db_user; +extern const char *db_passwd; +extern const char *db_name; + +extern int +wrong_use(char *format, ...); + +extern int +fatal_error(char *format, ...); + +extern int +owner(char *name); + +extern int member(char *gr); + +extern char **get_group_names(int *numgroups); + +extern int +version(void); + +extern int +read_config_file(void); + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +extern char *strmov(char *, const char *); + +extern int name_isclean(char*); + +#ifdef _mysql_h + +extern int +dberror(MYSQL *pmysql, char *format, ...); + +extern int +reload(MYSQL *pmysql); + +#endif + +#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c new file mode 100644 index 0000000..d80ed86 --- /dev/null +++ b/mysql-dbadm.c @@ -0,0 +1,707 @@ +/* + * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ + * + * mysql-dbadm.c + * + */ + +#include "config.h" +#include "mysql-admutils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char * +strchr_whitespace(const char *s) +{ + char *sp, *tab; + sp = strchr(s, ' '); + tab = strchr(s, '\t'); + if (sp == NULL) + return tab; + if (tab == NULL) + return sp; + return sp < tab ? sp : tab; /* if both are found, return the first one */ +} + +char * +strtok_whitespace(char *s) +{ + static char *cp; + char *r; + + r = s ? s : cp; + if (r == NULL) + return NULL; + cp = strchr_whitespace(r); + if (cp == NULL) + return r; + while ((*cp == ' ') || (*cp == '\t')) + *cp++ = '\0'; + return r; +} + + +int +valid_priv(const char *s) +{ + if (s == NULL) return 0; +#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 + ACCEPT("Y"); + ACCEPT("N"); + ACCEPT("y"); + ACCEPT("n"); +#undef ACCEPT + return 0; /* not a valid priv */ +} + + +int +usage() +{ + printf("Usage: %s COMMAND [DATABASE]...\n", program_name); + printf("Create, drop og edit permission for the DATABASE(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the DATABASE(s).\n"); + printf(" drop delete the DATABASE(s).\n"); + printf(" show give information about the DATABASE(s), or, if\n"); + printf(" none are given, all the ones you own.\n"); + printf(" editperm change permissions for the DATABASE(s). Your\n"); + printf(" favorite editor will be started, allowing you\n"); + printf(" to make changes to the permission table.\n"); + printf(" Run '%s --help-editperm' for more\n" + " information.\n",program_name); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + +int +usage_editperm() +{ + printf("Usage: %s editperm [DATABASE]\n", program_name); + printf("Edit permissions for the DATABASE. Running this command will\n"); + printf("spawn the editor stored in the $EDITOR environment variable.\n"); + printf("(pico will be used if the variable is unset)\n"); + printf("\n"); + printf("The file should contain one line per user, starting with the\n"); + printf("username and followed by ten Y/N-values seperated by whitespace.\n"); + printf("Lines starting with # are ignored.\n"); + printf("\n"); + printf("The Y/N-values corresponds to the following mysql privileges:\n"); + printf(" Select - Enables use of SELECT\n"); + printf(" Insert - Enables use of INSERT\n"); + printf(" Update - Enables use of UPDATE\n"); + printf(" Delete - Enables use of DELETE\n"); + printf(" Create - Enables use of CREATE TABLE\n"); + printf(" Drop - Enables use of DROP TABLE\n"); + printf(" Alter - Enables use of ALTER TABLE\n"); + printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); + printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); + printf(" Lock - Enables use of LOCK TABLE\n"); + printf(" References - Enables use of REFERENCES\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +create(MYSQL *pmysql, char *db) +{ + // hvis man forsøker å dra mysql_create_db() på en database som + // allerede finnes, så henger bare hele sql-kallet. Vi må derfor + // forsøke å selecte databasen først. Ettersom man alltid er root, + // går jo dette vanligvis bra. + // finner ut om denne finnes fra før. + if (!mysql_select_db(pmysql, db)) { + return dberror(pmysql, "Database '%s' already exists.", db); + } + mysql_select_db(pmysql, "mysql"); + // oppretter databasen. + char query[1024], *end; + end = strmov(query, "CREATE DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot create database '%s'.", db); + fprintf(stderr, "Database '%s' created.\n", db); + return 0; +} + + +int +drop(MYSQL *pmysql, char *db) +{ + char query[1024], *end; + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete permissions for database '%s'.", db); + + if (mysql_select_db(pmysql, db)) { + dberror(pmysql, "Database '%s' doesn't exists.", db); + return 0; + } + mysql_select_db(pmysql, "mysql"); + + end = strmov(query, "DROP DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot drop database '%s'.", db); + + fprintf(stderr, "Database '%s' dropped.\n", db); + return 0; +} + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char *wild; + char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ + MYSQL_RES *res; + int rows, numgroups, numgroupdbs; + MYSQL_ROW row; + char **dblist; + int i, counter; + struct passwd *p; + + // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. + char escaped_user[64]; + char *cp_kopi; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to lookup your UNIX username."); + exit(1); + } + + dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ + + numgroupdbs = 0; + counter = 0; + + usr_groups = get_group_names(&numgroups); + cp = usr_groups; + while (cp && *cp) { // itererer over alle grupper en person er med i + if (*cp == NULL) + break; + +#ifdef DEBUG + printf("cp er %s\n", *cp); +#endif + + escaped_user[0] = '\0'; + cp_kopi=*cp; + +// itererer over bokstavene i gruppenavn, og escaper spesialtegn. + for(i=0; i<=strlen(cp_kopi); i++) { + // hvis % _ , så skriv \ og så tegn + if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { + strcat(escaped_user, "\\"); + } + + escaped_user[strlen(escaped_user) + 1] = '\0'; + escaped_user[strlen(escaped_user)] = cp_kopi[i]; + } // for + + wild = malloc(strlen(escaped_user)+4); + sprintf(wild, "%s\\_%%", escaped_user); + +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + + if (rows > 0) { + numgroupdbs += rows; + + dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + } + + + free(wild); + mysql_free_result(res); + cp++; + } + + wild = malloc(strlen(p->pw_name) + 4); + sprintf(wild, "%s\\_%%", p->pw_name); +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); + + if (!dblist) { + dberror(NULL, "Out of memory.\n"); + free(wild); + return NULL; + } + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + mysql_free_result(res); + + res = mysql_list_dbs(pmysql, p->pw_name); + rows = mysql_num_rows(res); + if (rows == 1) + dblist[counter++] = strdup(p->pw_name); + + dblist[counter] = NULL; + + mysql_free_result(res); + free(wild); + for (i=0;inet.fd) != 0) + { + perror("Failed to close fd"); + exit(1); + } + + editor = getenv("EDITOR"); + if (!editor) + editor = "pico"; /* OK since editor won't be freed */ + + cmd = malloc(sizeof(char) * strlen(editor) + 7); + sprintf(cmd, "%s \"$1\"", editor); + + /* sh -c '$EDITOR "$1"' sh "$fn" */ + execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); + perror("Failed to execute editor"); + fprintf(stderr, "Make sure the EDITOR environment variable contains" + " a valid editor\n"); + exit(1); + } + + if (exit_status != 0) + return 1; + + /* parse */ + f = fopen(fn, "r"); + lines = 0; + while (fgets(line, sizeof(line), f)) { + cp = strchr(line, '\n'); + if (cp) + *cp = '\0'; + + cp = line; + while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; + if (*cp == '\0') continue; + if (*cp == '#') continue; + if (*cp == '\n') continue; + + #define STRTOK_WHITESPACE(res, start) \ + { if (!(res = strtok_whitespace(start))) continue; } + + STRTOK_WHITESPACE(user, cp); + if (strlen(user) < 1) + return dberror(NULL, "Invalid user '%s' in grant line %d.", user, + lines + 1); + if (strcmp(user, "%") == 0) + *user = '\0'; /* ugly, but it works... */ + + #define CHECK_PRIV(PRIV) \ + if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ + "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ + "all ten privileges.\nRun '%s --help-editerm' for more " \ + "information.\nNo permissions have been set.", PRIV, lines + 1, \ + program_name) + + STRTOK_WHITESPACE(select_priv, NULL); + CHECK_PRIV(select_priv); + STRTOK_WHITESPACE(insert_priv, NULL); + CHECK_PRIV(insert_priv); + STRTOK_WHITESPACE(update_priv, NULL); + CHECK_PRIV(update_priv); + STRTOK_WHITESPACE(delete_priv, NULL); + CHECK_PRIV(delete_priv); + STRTOK_WHITESPACE(create_priv, NULL); + CHECK_PRIV(create_priv); + STRTOK_WHITESPACE(drop_priv, NULL); + CHECK_PRIV(drop_priv); + STRTOK_WHITESPACE(alter_priv, NULL); + CHECK_PRIV(alter_priv); + STRTOK_WHITESPACE(index_priv, NULL); + CHECK_PRIV(index_priv); + STRTOK_WHITESPACE(create_tmp_table_priv, NULL); + CHECK_PRIV(create_tmp_table_priv); + STRTOK_WHITESPACE(lock_tables_priv, NULL); + CHECK_PRIV(lock_tables_priv); + STRTOK_WHITESPACE(references_priv, NULL); + CHECK_PRIV(references_priv); + + #undef STRTOK_WHITESPACE + #undef CHECK_PRIV + + end = strmov(query, "INSERT INTO db (" + "host,db,user,select_priv,insert_priv," + "update_priv,delete_priv,create_priv," + "drop_priv,alter_priv,index_priv," + "create_tmp_table_priv,lock_tables_priv," + "references_priv" + ") VALUES ("); + + end = strmov(end, "'%'"); + + #define APPEND(VAR) {\ + *end++ = ',';\ + *end++ = '\'';\ + end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ + *end++ = '\'';\ + } + + APPEND(db); + APPEND(user); + APPEND(select_priv); + APPEND(insert_priv); + APPEND(update_priv); + APPEND(delete_priv); + APPEND(create_priv); + APPEND(drop_priv); + APPEND(alter_priv); + APPEND(index_priv); + APPEND(create_tmp_table_priv); + APPEND(lock_tables_priv); + APPEND(references_priv); + *end++ = ')'; + *end = '\0'; + + #undef APPEND + + queries[lines] = strdup(query); + lines++; + if (lines >= MAX_GRANTS) + { + dberror(NULL, "Warning: Maximum of %d grants reached.\n", + MAX_GRANTS); + continue; + } + } /* while fgets ... */ + + unlink(fn); + fclose(f); + + /* now that we have checked the input for errors, we can safely + delete the old grants from the database and insert the new ones. */ + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete old grants for '%s'.", db); + + for (i = 0; i < lines; i++) + { +#ifdef DEBUG + puts(queries[i]); + putchar('\n'); +#endif + if (mysql_query(pmysql, queries[i])) + dberror(pmysql, "Failed to insert grant line %d.", i + 1); + free(queries[i]); + } + + fprintf(stderr,"Permissions updated\n"); + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_drop, c_editperm, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char *db; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help-editperm") == 0) + return usage_editperm(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + + if (argc < 2) + return wrong_use(NULL); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "drop") == 0) + command = c_drop; + else if (strcmp(argv[1], "editperm") == 0) + command = c_editperm; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command"); /* XXX */ + + /* all other than show requires at least one DATABASE argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) { + dblist = list(&mysql); + p = dblist; + while (p && *p) { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + db = malloc(64); + /* for each supplied database name, perform the requested action */ + for (i = 2; i < argc; i++) { + // HE HE + strncpy(db, argv[i], 32); + db[32] = '\0'; + + if (! (owner(db) || member(db))) { + if (command == c_create) + dberror(NULL,"Unable to create mysql-database '%s'.\n" + "A mysql-database must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are a " + "member of.\n", + db, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); + continue; + } + + switch (command) { + case c_create: + // We only check newly created databases. Many old ("unclean") databases are still in use. + if(name_isclean(db)) { + create(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_drop: + if(name_isclean(db)) { + drop(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_editperm: + if(name_isclean(db)) { + editperm(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_show: + if(name_isclean(db)) { + show(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + default: + return dberror(NULL, "This point should never be reached!"); + } + } // for + free(db); + } // else + + mysql_reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/mysql-useradm.c b/mysql-useradm.c new file mode 100644 index 0000000..04bcdca --- /dev/null +++ b/mysql-useradm.c @@ -0,0 +1,367 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ + * + * mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +int +usage() +{ + printf("Usage: %s COMMAND [USER]...\n", program_name); + printf("Create, delete or change password for the USER(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the USER(s).\n"); + printf(" delete delete the USER(s).\n"); + printf(" passwd change the MySQL password for the USER(s).\n"); + printf(" show give information about the USERS(s), or, if\n"); + printf(" none are given, all the users you have.\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +is_password_set(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + int check = 0; + + end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to look up password for user '%s'.", user); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + + if (rows > 1) + { + mysql_free_result(res); + return dberror(NULL, "Query for password for user '%s' gave %d results!", + user, rows); + } + else if (rows < 1) { + mysql_free_result(res); + return -1; + } + + row = mysql_fetch_row(res); + check = (row[0] && (strlen(row[0]) > 0)); + mysql_free_result(res); + + return check; +} + + +int +create(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "CREATE USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "'"); + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to create user '%s'.", user); + + return 0; +} + + +int +delete(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "DROP USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to delete user '%s'.", user); + + return 0; +} + + +int +passwd(MYSQL *pmysql, const char *user) +{ + char prompt[1024]; + char query[1024], *end; + char *password, *confirm_password; + + if (is_password_set(pmysql, user) == -1) /* no such mysql user */ + return dberror(NULL, "User '%s' does not exist." + " You must create it first.\n", user); + + sprintf(prompt, "New MySQL password for user '%s': ", user); + password = getpass(prompt); + confirm_password = strdup(password); + sprintf(prompt, "Retype new MySQL password for user '%s': ", user); + password = getpass(prompt); + if (strcmp(password, confirm_password) != 0) + { + free(confirm_password); + return dberror(NULL, "Sorry, passwords do not match."); + } + free(confirm_password); + + end = strmov(query, "ALTER user '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "' IDENTIFIED BY '"); + end += mysql_real_escape_string(pmysql, end, password, strlen(password)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to set new password for user '%s'.", user); + if (mysql_affected_rows(pmysql) != 1) + dberror(NULL, "%d rows affected by password update for user '%s'!", + mysql_affected_rows(pmysql), user); + + fprintf(stderr, "Password updated for user '%s'.\n", user); + return 0; +} + + +int +show(MYSQL *pmysql, const char *user) +{ + switch (is_password_set(pmysql, user)) + { + case -1: + break; + case 0: + printf("User '%s': ", user); + printf("no password set.\n"); + break; + case 1: + printf("User '%s': ", user); + printf("password set.\n"); + break; + } + return 0; +} + + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char query[4096], *end; + char **usrgroups, **cp; + MYSQL_RES *res; + int rows, numgroups; + MYSQL_ROW row; + char **userlist; + int i; + struct passwd *p; + + p = getpwuid(getuid()); + + end = strmov(query, "SELECT user FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "\\_%'"); + + numgroups = 0; + + usrgroups = get_group_names(&numgroups); + cp = usrgroups; + while (cp && *cp) { + end = strmov(end, " OR user='"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "\\_%'"); + free(*cp); + cp++; + } + free(usrgroups); + +#ifdef DEBUG + printf("about to run query: %s\n", query); +#endif + + if (mysql_query(pmysql, query)) + { + dberror(pmysql, "Failed to look up %s's users.", p->pw_name); + return NULL; + } + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + userlist = malloc((rows + 1) * sizeof(char *)); + if (!userlist) + { + dberror(NULL, "%s: Out of memory.\n", program_name); + return NULL; + } + for (i = 0; i < rows; i++) + if ((row = mysql_fetch_row(res))) + { + userlist[i] = strdup(row[0]); + } + + userlist[i] = NULL; + + mysql_free_result(res); + + return userlist; +} + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_delete, c_passwd, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char user[65]; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + if (argc < 2) + return wrong_use(NULL); + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "delete") == 0) + command = c_delete; + else if (strcmp(argv[1], "passwd") == 0) + command = c_passwd; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ + + /* all other than show requires at least one USER argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) + { + dblist = list(&mysql); + p = dblist; + while (p && *p) + { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + /* for each supplied database name, perform the requested action */ + + for (i = 2; i < argc; i++) { + strncpy(user, argv[i], 32); + user[33] = '\0'; + if (! (owner(user) || member(user))) + { + if (command == c_create) + dberror(NULL,"Unable to create mysql-user '%s'.\n" + + "A mysql-user must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are " + "a member of.\n", + user, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); + continue; + } + + switch (command) + { + case c_create: + if(name_isclean(user)) { + create(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_delete: + if(name_isclean(user)) { + delete(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_passwd: + if(name_isclean(user)) { + passwd(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_show: + if(name_isclean(user)) { + show(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + default: + fprintf(stderr, "This point should never be reached.\n"); + exit(1); + } + } + } + + reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/pwfile.c b/pwfile.c new file mode 100644 index 0000000..ce2e573 --- /dev/null +++ b/pwfile.c @@ -0,0 +1,108 @@ +/* + * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ + * + * functions for parsing the config file. + * + */ + +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" +#include "pwyacc.h" + +/* the MySQL maximum */ +#define MAXPWCHARS 16 + +/* defaults for configurable values */ +const char* db_user = "root"; +const char* db_server = "localhost"; +const char* db_passwd = NULL; +const char* db_name = "mysql"; + +extern int yyparse(void); +extern FILE *yyin; + +int config_line = 1; + +static FILE *pwfile; +static char *filename = SYSCONFDIR "/mysql-admutils.conf"; + +int +read_config_file(void) +{ + struct rlimit rlim; + int rc; /* return code */ + + /* to stop the user from obtaining the password from a core dump. */ + if (getrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("getrlimit"); + exit(1); + } + rlim.rlim_max = 0; + if (setrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("setrlimit"); + exit(1); + } + + pwfile = fopen(filename, "r"); + if (!pwfile) { + fatal_error("cannot open configuration file %s", filename); + exit(1); + } + + /* we don't need to be SUID anymore. */ + if (seteuid(getuid()) != 0) + perror("seteuid"); + + yyin = pwfile; + rc = yyparse(); + fclose(pwfile); + + return rc; +} + + +int +yywrap(void) +{ + return 1; +} + + +int +yyerror(const char *msg) +{ + fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); + return 0; +} + + +int +config_set_string_var(int var, const char *value) +{ + assert(value); + switch (var) { + case USER: + db_user = value; + break; + case HOST: + db_server = value; + break; + case PASSWORD: + if (strlen(value) > MAXPWCHARS) { + fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", + filename, config_line, strlen(value), MAXPWCHARS); + fclose(pwfile); + exit(1); + } + db_passwd = value; + break; + default: + assert(!"We should never get here."); + } + return 0; +} diff --git a/pwlex.l b/pwlex.l new file mode 100644 index 0000000..457ef74 --- /dev/null +++ b/pwlex.l @@ -0,0 +1,47 @@ +/* + * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * lex source for the configuration file + * + */ + +%{ +#include +#include +#include "pwyacc.h" + +extern int config_line; +extern int yylval; +%} + +%% + +#.*\n config_line++; + +set { yylval = SET; return(SET); } +host { yylval = HOST; return(HOST); }; +user { yylval = USER; return(USER); }; +password { yylval = PASSWORD; return(PASSWORD); } + +\"[^"]*\" { + if (yytext[yyleng - 1] == '\\') + yymore(); + else + yytext[yyleng - 1] = '\0'; + yylval = (int)strdup(yytext + 1); + return(STRING); + }; + +; return(';'); + +[^ \t\n\;]* { + yylval = (int)strdup(yytext); + return(STRING); + } + +[ \t] ; + +\n config_line++; + +%% + diff --git a/pwyacc.y b/pwyacc.y new file mode 100644 index 0000000..1a39886 --- /dev/null +++ b/pwyacc.y @@ -0,0 +1,33 @@ +/* + * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * yacc source for parsing the configuration file + * + */ + +%{ +int yyerror(const char *msg); +int yylex(void); +int config_set_string_var(int var, const char *value); +%} + +%token SET HOST USER PASSWORD STRING + +%% + +input: ; +input: statement input ; + +statement: SET variable STRING ';' + { + $$ = config_set_string_var($2, (const char *)$3); + } + +; + +variable: USER | PASSWORD | HOST + { $$ = $1; } + ; + +%% + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp From 07f2e8d870532b834a3424a60832caecf9f803a9 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:16:20 +0200 Subject: [PATCH 08/22] Revert "Luker ut install" This reverts commit 332ca2ece9f7a461d82c505e5b2943df8be80358. --- .gitignore | 60 ---- AUTHORS | 0 COPYING | 340 ----------------------- ChangeLog | 25 -- Makefile.am | 9 - NEWS | 0 README | 0 acconfig.h | 29 -- common.c | 276 ------------------ configline | 44 --- configure.ac | 98 ------- mysql-admutils.h | 51 ---- mysql-dbadm.c | 707 ----------------------------------------------- mysql-useradm.c | 367 ------------------------ pwfile.c | 108 -------- pwlex.l | 47 ---- pwyacc.y | 33 --- stamp-h.in | 1 - 18 files changed, 2195 deletions(-) delete mode 100644 .gitignore delete mode 100644 AUTHORS delete mode 100644 COPYING delete mode 100644 ChangeLog delete mode 100644 Makefile.am delete mode 100644 NEWS delete mode 100644 README delete mode 100644 acconfig.h delete mode 100644 common.c delete mode 100644 configline delete mode 100644 configure.ac delete mode 100644 mysql-admutils.h delete mode 100644 mysql-dbadm.c delete mode 100644 mysql-useradm.c delete mode 100644 pwfile.c delete mode 100644 pwlex.l delete mode 100644 pwyacc.y delete mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 73a87e5..0000000 --- a/.gitignore +++ /dev/null @@ -1,60 +0,0 @@ -*# -*.o -*~ -/.deps -/Makefile -/config.h -fjernet -/mysql-dbadm -/mysql-useradm -/pwlex.c -/pwyacc.c -/pwyacc.h -/stamp-h - -### Autotools ### -# http://www.gnu.org/software/automake - -Makefile.in -/ar-lib -/mdate-sh -/py-compile -/test-driver -/ylwrap -/mkinstalldirs -/INSTALL - -# http://www.gnu.org/software/autoconf - -autom4te.cache -/autoscan.log -/autoscan-*.log -/aclocal.m4 -/compile -/config.guess -/config.h.in -/config.log -/config.status -/config.sub -/configure -/configure.scan -/depcomp -/install-sh -/missing -/stamp-h1 - -# https://www.gnu.org/software/libtool/ - -/ltmain.sh - -# http://www.gnu.org/software/texinfo - -/texinfo.tex - -# http://www.gnu.org/software/m4/ - -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/COPYING b/COPYING deleted file mode 100644 index eeb586b..0000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index f030463..0000000 --- a/ChangeLog +++ /dev/null @@ -1,25 +0,0 @@ -v0.50 (2006-11-20) geirha@itea.ntnu.no - * added create_tmp_table_priv - * added lock_tables_priv - * some memory leaks fixed - -v0.46 (2005-06-27) knuta@itea.ntnu.no - * Replaced deprecated functions not supported in SLES9 - -v0.42-0.45 (2002-03-07 - 2004-12-08) unknown - * Various undocumented fixes, at least something about length - of group names, I think - -v0.41 (2002-03-07) tlan@stud.ntnu.no - * Fixed a seg.fault bug in is_password_set()-routine. - -v0.4 (2002-03-07) tlan@stud.ntnu.no - * added ability to make users/dbs beginning with group-names. - * added index-priv - * added alter-priv - - -Mon Jul 6 11:58:10 1998 Vebjorn Ljosa - * Initial version. - - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e3a0bd7..0000000 --- a/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -bin_PROGRAMS = mysql-dbadm mysql-useradm -mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c -mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) -mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) -BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c -YFLAGS = -d -INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" -LDADD = @MYSQL_LIBS@ @LEXLIB@ -LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 76e5baf..0000000 --- a/acconfig.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * acconfig.h - * - * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ - * - */ - - -/* Define the name of the package */ -#undef PACKAGE - -/* Define the version of the package */ -#undef VERSION - -/* Define if MySQL is installed */ -#undef HAVE_MYSQL - -/* Define if you have the header file. */ -#undef HAVE_MATH_H - -/* Define if libmath is available */ -#undef HAVE_LIBM - -/* Define if libnsl is available */ -#undef HAVE_LIBNSL - -/* Define if libsocket is available */ -#undef HAVE_LIBSOCKET - diff --git a/common.c b/common.c deleted file mode 100644 index 84d9603..0000000 --- a/common.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ - * - * functions used by mysql-dbadm.c and mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -char *program_name; - -static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; - - -int -version() -{ - printf("%s %s\n", program_name, rcsheader); - exit(0); -} - - -int -wrong_use(char *format, ...) -{ - va_list ap; - - if (format) { - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - putchar('\n'); - } - - fprintf(stderr, "Try `%s --help' for more information.\n", program_name); - - return 1; -} - - -/* always returns 1. */ -int -dberror(MYSQL *pmysql, char *format, ...) -{ - const char *errmsg; - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - if (pmysql) { - errmsg = mysql_error(pmysql); - if ((errmsg) && (strcmp(errmsg, "") != 0)) - fprintf(stderr, "mysql: %s\n", errmsg); - - mysql_close(pmysql); - } - - return 1; -} - - -/* always returns 1. */ -int -fatal_error(char *format, ...) -{ - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - return 1; -} - - -/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ -int -owner(char *name) -{ - struct passwd *p; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to look up your UNIX username."); - exit(1); - } - - if (strcmp(name, p->pw_name) == 0) - return 1; /* OK */ - - if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && - (*(name + strlen(p->pw_name)) == '_')) - return 1; /* OK */ - - return 0; /* not owner if we get as far as this */ -} - -/** - * Decides if the user is member of a group. The Unix group can't contain any - * '_'. i.e 'fidi_s' won't be accepted. - */ -int -member(char *gr) { - char *username; - - char group[65]; - struct group *g; - - struct passwd *p; - char *foo; - - /* size_t i = 0; */ - - /* Get username */ - p = getpwuid(getuid()); - if (!p) { - fprintf(stderr, "Failed to look up your UNIX username."); - return 0; - } - username = p->pw_name; - - /* Copy string, but cut at '_' */ - strncpy(group, gr, 64); - group[64] = '\0'; - - // ettersom man kan få inn gruppenavn med underscore i, må man rett og - // slett prøve seg fram for å sjekke om det er en gruppe personen er med - // i. - // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test - // (som kanskje finnes), men er med i www_esb. - // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet - // ut av den, og stripper av en og en underscore til vi finner noe som - // passer. - while ( 1 ) { - -#if DEBUG -// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); -#endif - g = getgrnam(group); -#if DEBUG - printf("tror gruppenavnet er: %s\n", group); -#endif - - // hvis gruppen ikke finnes, må vi i allefall prøve å se om - // det er noe lengre inn. - if (g) { - /* Check if user is member of group */ - while(*g->gr_mem != NULL) { - char * member = *g->gr_mem++; -#if DEBUG - printf("Medlem: %s\n", member); -#endif - - if (strcmp(member,username) == 0) { -#if DEBUG - printf("You have access to '%s'\n", gr); -#endif - return 1; /* OK */ - } - } -#if DEBUG - printf("You have no access to '%s'\n", gr); -#endif - } // if - // brukeren var ikke med i gruppen, så vi må prøve neste. - - // finner den siste _-en i navnet. - foo = strrchr(group, '_'); - if (foo == NULL) { - // hvis vi har kommet helt til bunn, og fremdeles - // ikke har blitt avbrutt, fantes det ingen slik gruppe. - return 0; - } - // det som nå er bak siste underscore er passe uinteressant, så - // vi flytter slutten av strengen litt framover. - *foo = '\0'; - - } // while -} - -/* return a list of the user's groupnames */ -/* numgroups is the total number of groups found */ -char **get_group_names(int *numgroups) -{ - char **grouplist; - gid_t *gids = NULL; - int real_nr_groups, nr_groups, i; - struct group *g; - - nr_groups = 0; - - /* Find number and allocate */ - nr_groups = getgroups(0, NULL); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to find group count"); - return NULL; - } - gids = malloc(nr_groups*sizeof(gid_t)); - - /* Fetch group IDs */ - nr_groups = getgroups(nr_groups, gids); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to fetch group info"); - return NULL; - } - - grouplist = malloc((nr_groups + 1)*sizeof(char *)); - real_nr_groups = 0; - - for (i = 0; i < nr_groups; i++) { - g = getgrgid(gids[i]); - - /* Go to next grp if it doesn't have a name */ - if (g != NULL) { - grouplist[real_nr_groups++] = strdup(g->gr_name); - } else { - fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); - } - } - grouplist[real_nr_groups] = NULL; - - free(gids); - - *numgroups = real_nr_groups; - - return grouplist; -} - - -int -reload(MYSQL *pmysql) -{ - return mysql_reload(pmysql); -} - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -char *strmov(char *dest, const char *src) { - while ((*dest++ = *src++)) - ; - return dest-1; -} - -/* New database and user names may only use these characters in their - identifier */ -const char name_validchars[] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; - -/* Returns true if dbname contains only characters in name_validchars. */ -int name_isclean(char* name) { - int reallen, cleanlen; - reallen = strlen(name); - cleanlen = strspn(name, name_validchars); - return (reallen == cleanlen); -} - diff --git a/configline b/configline deleted file mode 100644 index 49f7a3f..0000000 --- a/configline +++ /dev/null @@ -1,44 +0,0 @@ - -vanlig, på linux. -./configure --with-mysql=/usr/ --sysconfdir=/etc/ - -vi burde kanskje komplisere med libmysqlclient statisk, -sånn at vi slipper avhengigheter mot en spesiell rpmpakke. - - -elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile ---- ../Makefile.org Tue Apr 8 20:20:00 2003 -+++ Makefile Tue Apr 8 20:22:27 2003 -@@ -62,8 +62,8 @@ - LEX = flex - MAKEINFO = makeinfo - MYSQL_INCLUDE = -I/store/include/mysql --MYSQL_LFLAGS = -L/store/lib/mysql --MYSQL_LIBS = -lmysqlclient -+MYSQL_LFLAGS = -+MYSQL_LIBS = - PACKAGE = mysql-admutils - SYSCONFDIR = - VERSION = 0.43 -@@ -76,8 +76,8 @@ - BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c - YFLAGS = -d - INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" --LDADD = -lmysqlclient -lfl --LDFLAGS = -L/store/lib/mysql -+LDADD = /store/lib/mysql/libmysqlclient.a -lfl -+LDFLAGS = - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - CONFIG_HEADER = config.h - - - - - - - - -$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ -$Source: /tmp/cvs/mysql-admutils/configline,v $ - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9b7bc2b..0000000 --- a/configure.ac +++ /dev/null @@ -1,98 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(mysql-dbadm.c) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(mysql-admutils, 0.46) -AM_SANITY_CHECK - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AM_PROG_LEX -AC_PROG_YACC - -dnl Checks for libraries. -AC_CHECK_LIB(c, floor, [:], [ - AC_CHECK_LIB(m, floor, [ - LIBS="$LIBS -lm" - AC_DEFINE(HAVE_LIBM) ], []) ]) -AC_CHECK_LIB(mysqlclient, mysql_connect, [ - LIBS="$LIBS -lmysqlclient" ], []) -AC_CHECK_LIB(c, gethostbyaddr, [:], [ - AC_CHECK_LIB(nsl, gethostbyaddr, [ - LIBS="$LIBS -lnsl" - AC_DEFINE(HAVE_LIBNSL) ], []) ]) -AC_CHECK_LIB(c, socket, [:], [ - AC_CHECK_LIB(socket, socket, [ - LIBS="$LIBS -lsocket" - AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) - -AC_MSG_CHECKING(for MySQL support) -AC_ARG_WITH(mysql, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base - install directory, defaults to /usr/local.], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - MYSQL_INCDIR=/usr/local/include/mysql - MYSQL_LIBDIR=/usr/local/lib/mysql - else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - MYSQL_LIBDIR=$withval/lib/mysql - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - MYSQL_LIBDIR=$withval/lib - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) - fi - fi - MYSQL_INCLUDE=-I$MYSQL_INCDIR - MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" - #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" - MYSQL_LIBS=-lmysqlclient - - AC_DEFINE(HAVE_MYSQL) - AC_MSG_RESULT(yes) - - dnl check for errmsg.h, which isn't installed by some versions of 3.21 - old_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" - AC_CHECK_HEADERS(errmsg.h) - CPPFLAGS="$old_CPPFLAGS" - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) - AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit -]) -AC_SUBST(MYSQL_LIBS) -AC_SUBST(MYSQL_LFLAGS) -AC_SUBST(MYSQL_INCLUDE) - - -AC_MSG_CHECKING([whether to enable -Wall -pedantic]) -AC_ARG_ENABLE(warnings, -[ --enable-warnings Enable -Wall -pedantic if using gcc.], -[ if test -n "$GCC"; then - AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) - CFLAGS="$CFLAGS -Wall -pedantic" - fi -],AC_MSG_RESULT(no)) - - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_VPRINTF - -AC_SUBST(SYSCONFDIR) - -AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h deleted file mode 100644 index 1ee0cdc..0000000 --- a/mysql-admutils.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ - * - */ - -#ifndef MYSQL_ADMUTILS_H -#define MYSQL_ADMUTILS_H - -extern char *program_name; - -/* defined in pwfile.c */ -extern const char *db_server; -extern const char *db_user; -extern const char *db_passwd; -extern const char *db_name; - -extern int -wrong_use(char *format, ...); - -extern int -fatal_error(char *format, ...); - -extern int -owner(char *name); - -extern int member(char *gr); - -extern char **get_group_names(int *numgroups); - -extern int -version(void); - -extern int -read_config_file(void); - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -extern char *strmov(char *, const char *); - -extern int name_isclean(char*); - -#ifdef _mysql_h - -extern int -dberror(MYSQL *pmysql, char *format, ...); - -extern int -reload(MYSQL *pmysql); - -#endif - -#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c deleted file mode 100644 index d80ed86..0000000 --- a/mysql-dbadm.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ - * - * mysql-dbadm.c - * - */ - -#include "config.h" -#include "mysql-admutils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char * -strchr_whitespace(const char *s) -{ - char *sp, *tab; - sp = strchr(s, ' '); - tab = strchr(s, '\t'); - if (sp == NULL) - return tab; - if (tab == NULL) - return sp; - return sp < tab ? sp : tab; /* if both are found, return the first one */ -} - -char * -strtok_whitespace(char *s) -{ - static char *cp; - char *r; - - r = s ? s : cp; - if (r == NULL) - return NULL; - cp = strchr_whitespace(r); - if (cp == NULL) - return r; - while ((*cp == ' ') || (*cp == '\t')) - *cp++ = '\0'; - return r; -} - - -int -valid_priv(const char *s) -{ - if (s == NULL) return 0; -#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 - ACCEPT("Y"); - ACCEPT("N"); - ACCEPT("y"); - ACCEPT("n"); -#undef ACCEPT - return 0; /* not a valid priv */ -} - - -int -usage() -{ - printf("Usage: %s COMMAND [DATABASE]...\n", program_name); - printf("Create, drop og edit permission for the DATABASE(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the DATABASE(s).\n"); - printf(" drop delete the DATABASE(s).\n"); - printf(" show give information about the DATABASE(s), or, if\n"); - printf(" none are given, all the ones you own.\n"); - printf(" editperm change permissions for the DATABASE(s). Your\n"); - printf(" favorite editor will be started, allowing you\n"); - printf(" to make changes to the permission table.\n"); - printf(" Run '%s --help-editperm' for more\n" - " information.\n",program_name); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - -int -usage_editperm() -{ - printf("Usage: %s editperm [DATABASE]\n", program_name); - printf("Edit permissions for the DATABASE. Running this command will\n"); - printf("spawn the editor stored in the $EDITOR environment variable.\n"); - printf("(pico will be used if the variable is unset)\n"); - printf("\n"); - printf("The file should contain one line per user, starting with the\n"); - printf("username and followed by ten Y/N-values seperated by whitespace.\n"); - printf("Lines starting with # are ignored.\n"); - printf("\n"); - printf("The Y/N-values corresponds to the following mysql privileges:\n"); - printf(" Select - Enables use of SELECT\n"); - printf(" Insert - Enables use of INSERT\n"); - printf(" Update - Enables use of UPDATE\n"); - printf(" Delete - Enables use of DELETE\n"); - printf(" Create - Enables use of CREATE TABLE\n"); - printf(" Drop - Enables use of DROP TABLE\n"); - printf(" Alter - Enables use of ALTER TABLE\n"); - printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); - printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); - printf(" Lock - Enables use of LOCK TABLE\n"); - printf(" References - Enables use of REFERENCES\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -create(MYSQL *pmysql, char *db) -{ - // hvis man forsøker å dra mysql_create_db() på en database som - // allerede finnes, så henger bare hele sql-kallet. Vi må derfor - // forsøke å selecte databasen først. Ettersom man alltid er root, - // går jo dette vanligvis bra. - // finner ut om denne finnes fra før. - if (!mysql_select_db(pmysql, db)) { - return dberror(pmysql, "Database '%s' already exists.", db); - } - mysql_select_db(pmysql, "mysql"); - // oppretter databasen. - char query[1024], *end; - end = strmov(query, "CREATE DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot create database '%s'.", db); - fprintf(stderr, "Database '%s' created.\n", db); - return 0; -} - - -int -drop(MYSQL *pmysql, char *db) -{ - char query[1024], *end; - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete permissions for database '%s'.", db); - - if (mysql_select_db(pmysql, db)) { - dberror(pmysql, "Database '%s' doesn't exists.", db); - return 0; - } - mysql_select_db(pmysql, "mysql"); - - end = strmov(query, "DROP DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot drop database '%s'.", db); - - fprintf(stderr, "Database '%s' dropped.\n", db); - return 0; -} - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char *wild; - char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ - MYSQL_RES *res; - int rows, numgroups, numgroupdbs; - MYSQL_ROW row; - char **dblist; - int i, counter; - struct passwd *p; - - // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. - char escaped_user[64]; - char *cp_kopi; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to lookup your UNIX username."); - exit(1); - } - - dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ - - numgroupdbs = 0; - counter = 0; - - usr_groups = get_group_names(&numgroups); - cp = usr_groups; - while (cp && *cp) { // itererer over alle grupper en person er med i - if (*cp == NULL) - break; - -#ifdef DEBUG - printf("cp er %s\n", *cp); -#endif - - escaped_user[0] = '\0'; - cp_kopi=*cp; - -// itererer over bokstavene i gruppenavn, og escaper spesialtegn. - for(i=0; i<=strlen(cp_kopi); i++) { - // hvis % _ , så skriv \ og så tegn - if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { - strcat(escaped_user, "\\"); - } - - escaped_user[strlen(escaped_user) + 1] = '\0'; - escaped_user[strlen(escaped_user)] = cp_kopi[i]; - } // for - - wild = malloc(strlen(escaped_user)+4); - sprintf(wild, "%s\\_%%", escaped_user); - -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - - if (rows > 0) { - numgroupdbs += rows; - - dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - } - - - free(wild); - mysql_free_result(res); - cp++; - } - - wild = malloc(strlen(p->pw_name) + 4); - sprintf(wild, "%s\\_%%", p->pw_name); -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); - - if (!dblist) { - dberror(NULL, "Out of memory.\n"); - free(wild); - return NULL; - } - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - mysql_free_result(res); - - res = mysql_list_dbs(pmysql, p->pw_name); - rows = mysql_num_rows(res); - if (rows == 1) - dblist[counter++] = strdup(p->pw_name); - - dblist[counter] = NULL; - - mysql_free_result(res); - free(wild); - for (i=0;inet.fd) != 0) - { - perror("Failed to close fd"); - exit(1); - } - - editor = getenv("EDITOR"); - if (!editor) - editor = "pico"; /* OK since editor won't be freed */ - - cmd = malloc(sizeof(char) * strlen(editor) + 7); - sprintf(cmd, "%s \"$1\"", editor); - - /* sh -c '$EDITOR "$1"' sh "$fn" */ - execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); - perror("Failed to execute editor"); - fprintf(stderr, "Make sure the EDITOR environment variable contains" - " a valid editor\n"); - exit(1); - } - - if (exit_status != 0) - return 1; - - /* parse */ - f = fopen(fn, "r"); - lines = 0; - while (fgets(line, sizeof(line), f)) { - cp = strchr(line, '\n'); - if (cp) - *cp = '\0'; - - cp = line; - while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; - if (*cp == '\0') continue; - if (*cp == '#') continue; - if (*cp == '\n') continue; - - #define STRTOK_WHITESPACE(res, start) \ - { if (!(res = strtok_whitespace(start))) continue; } - - STRTOK_WHITESPACE(user, cp); - if (strlen(user) < 1) - return dberror(NULL, "Invalid user '%s' in grant line %d.", user, - lines + 1); - if (strcmp(user, "%") == 0) - *user = '\0'; /* ugly, but it works... */ - - #define CHECK_PRIV(PRIV) \ - if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ - "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ - "all ten privileges.\nRun '%s --help-editerm' for more " \ - "information.\nNo permissions have been set.", PRIV, lines + 1, \ - program_name) - - STRTOK_WHITESPACE(select_priv, NULL); - CHECK_PRIV(select_priv); - STRTOK_WHITESPACE(insert_priv, NULL); - CHECK_PRIV(insert_priv); - STRTOK_WHITESPACE(update_priv, NULL); - CHECK_PRIV(update_priv); - STRTOK_WHITESPACE(delete_priv, NULL); - CHECK_PRIV(delete_priv); - STRTOK_WHITESPACE(create_priv, NULL); - CHECK_PRIV(create_priv); - STRTOK_WHITESPACE(drop_priv, NULL); - CHECK_PRIV(drop_priv); - STRTOK_WHITESPACE(alter_priv, NULL); - CHECK_PRIV(alter_priv); - STRTOK_WHITESPACE(index_priv, NULL); - CHECK_PRIV(index_priv); - STRTOK_WHITESPACE(create_tmp_table_priv, NULL); - CHECK_PRIV(create_tmp_table_priv); - STRTOK_WHITESPACE(lock_tables_priv, NULL); - CHECK_PRIV(lock_tables_priv); - STRTOK_WHITESPACE(references_priv, NULL); - CHECK_PRIV(references_priv); - - #undef STRTOK_WHITESPACE - #undef CHECK_PRIV - - end = strmov(query, "INSERT INTO db (" - "host,db,user,select_priv,insert_priv," - "update_priv,delete_priv,create_priv," - "drop_priv,alter_priv,index_priv," - "create_tmp_table_priv,lock_tables_priv," - "references_priv" - ") VALUES ("); - - end = strmov(end, "'%'"); - - #define APPEND(VAR) {\ - *end++ = ',';\ - *end++ = '\'';\ - end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ - *end++ = '\'';\ - } - - APPEND(db); - APPEND(user); - APPEND(select_priv); - APPEND(insert_priv); - APPEND(update_priv); - APPEND(delete_priv); - APPEND(create_priv); - APPEND(drop_priv); - APPEND(alter_priv); - APPEND(index_priv); - APPEND(create_tmp_table_priv); - APPEND(lock_tables_priv); - APPEND(references_priv); - *end++ = ')'; - *end = '\0'; - - #undef APPEND - - queries[lines] = strdup(query); - lines++; - if (lines >= MAX_GRANTS) - { - dberror(NULL, "Warning: Maximum of %d grants reached.\n", - MAX_GRANTS); - continue; - } - } /* while fgets ... */ - - unlink(fn); - fclose(f); - - /* now that we have checked the input for errors, we can safely - delete the old grants from the database and insert the new ones. */ - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete old grants for '%s'.", db); - - for (i = 0; i < lines; i++) - { -#ifdef DEBUG - puts(queries[i]); - putchar('\n'); -#endif - if (mysql_query(pmysql, queries[i])) - dberror(pmysql, "Failed to insert grant line %d.", i + 1); - free(queries[i]); - } - - fprintf(stderr,"Permissions updated\n"); - - return 0; -} - - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_drop, c_editperm, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char *db; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help-editperm") == 0) - return usage_editperm(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - - if (argc < 2) - return wrong_use(NULL); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "drop") == 0) - command = c_drop; - else if (strcmp(argv[1], "editperm") == 0) - command = c_editperm; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command"); /* XXX */ - - /* all other than show requires at least one DATABASE argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) { - dblist = list(&mysql); - p = dblist; - while (p && *p) { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - db = malloc(64); - /* for each supplied database name, perform the requested action */ - for (i = 2; i < argc; i++) { - // HE HE - strncpy(db, argv[i], 32); - db[32] = '\0'; - - if (! (owner(db) || member(db))) { - if (command == c_create) - dberror(NULL,"Unable to create mysql-database '%s'.\n" - "A mysql-database must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are a " - "member of.\n", - db, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); - continue; - } - - switch (command) { - case c_create: - // We only check newly created databases. Many old ("unclean") databases are still in use. - if(name_isclean(db)) { - create(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_drop: - if(name_isclean(db)) { - drop(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_editperm: - if(name_isclean(db)) { - editperm(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_show: - if(name_isclean(db)) { - show(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - default: - return dberror(NULL, "This point should never be reached!"); - } - } // for - free(db); - } // else - - mysql_reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/mysql-useradm.c b/mysql-useradm.c deleted file mode 100644 index 04bcdca..0000000 --- a/mysql-useradm.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ - * - * mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -int -usage() -{ - printf("Usage: %s COMMAND [USER]...\n", program_name); - printf("Create, delete or change password for the USER(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the USER(s).\n"); - printf(" delete delete the USER(s).\n"); - printf(" passwd change the MySQL password for the USER(s).\n"); - printf(" show give information about the USERS(s), or, if\n"); - printf(" none are given, all the users you have.\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -is_password_set(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - MYSQL_RES *res; - int rows; - MYSQL_ROW row; - int check = 0; - - end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to look up password for user '%s'.", user); - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - - if (rows > 1) - { - mysql_free_result(res); - return dberror(NULL, "Query for password for user '%s' gave %d results!", - user, rows); - } - else if (rows < 1) { - mysql_free_result(res); - return -1; - } - - row = mysql_fetch_row(res); - check = (row[0] && (strlen(row[0]) > 0)); - mysql_free_result(res); - - return check; -} - - -int -create(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "CREATE USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "'"); - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to create user '%s'.", user); - - return 0; -} - - -int -delete(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "DROP USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to delete user '%s'.", user); - - return 0; -} - - -int -passwd(MYSQL *pmysql, const char *user) -{ - char prompt[1024]; - char query[1024], *end; - char *password, *confirm_password; - - if (is_password_set(pmysql, user) == -1) /* no such mysql user */ - return dberror(NULL, "User '%s' does not exist." - " You must create it first.\n", user); - - sprintf(prompt, "New MySQL password for user '%s': ", user); - password = getpass(prompt); - confirm_password = strdup(password); - sprintf(prompt, "Retype new MySQL password for user '%s': ", user); - password = getpass(prompt); - if (strcmp(password, confirm_password) != 0) - { - free(confirm_password); - return dberror(NULL, "Sorry, passwords do not match."); - } - free(confirm_password); - - end = strmov(query, "ALTER user '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "' IDENTIFIED BY '"); - end += mysql_real_escape_string(pmysql, end, password, strlen(password)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to set new password for user '%s'.", user); - if (mysql_affected_rows(pmysql) != 1) - dberror(NULL, "%d rows affected by password update for user '%s'!", - mysql_affected_rows(pmysql), user); - - fprintf(stderr, "Password updated for user '%s'.\n", user); - return 0; -} - - -int -show(MYSQL *pmysql, const char *user) -{ - switch (is_password_set(pmysql, user)) - { - case -1: - break; - case 0: - printf("User '%s': ", user); - printf("no password set.\n"); - break; - case 1: - printf("User '%s': ", user); - printf("password set.\n"); - break; - } - return 0; -} - - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char query[4096], *end; - char **usrgroups, **cp; - MYSQL_RES *res; - int rows, numgroups; - MYSQL_ROW row; - char **userlist; - int i; - struct passwd *p; - - p = getpwuid(getuid()); - - end = strmov(query, "SELECT user FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "\\_%'"); - - numgroups = 0; - - usrgroups = get_group_names(&numgroups); - cp = usrgroups; - while (cp && *cp) { - end = strmov(end, " OR user='"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "\\_%'"); - free(*cp); - cp++; - } - free(usrgroups); - -#ifdef DEBUG - printf("about to run query: %s\n", query); -#endif - - if (mysql_query(pmysql, query)) - { - dberror(pmysql, "Failed to look up %s's users.", p->pw_name); - return NULL; - } - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - userlist = malloc((rows + 1) * sizeof(char *)); - if (!userlist) - { - dberror(NULL, "%s: Out of memory.\n", program_name); - return NULL; - } - for (i = 0; i < rows; i++) - if ((row = mysql_fetch_row(res))) - { - userlist[i] = strdup(row[0]); - } - - userlist[i] = NULL; - - mysql_free_result(res); - - return userlist; -} - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_delete, c_passwd, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char user[65]; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - if (argc < 2) - return wrong_use(NULL); - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "delete") == 0) - command = c_delete; - else if (strcmp(argv[1], "passwd") == 0) - command = c_passwd; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ - - /* all other than show requires at least one USER argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) - { - dblist = list(&mysql); - p = dblist; - while (p && *p) - { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - /* for each supplied database name, perform the requested action */ - - for (i = 2; i < argc; i++) { - strncpy(user, argv[i], 32); - user[33] = '\0'; - if (! (owner(user) || member(user))) - { - if (command == c_create) - dberror(NULL,"Unable to create mysql-user '%s'.\n" - - "A mysql-user must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are " - "a member of.\n", - user, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); - continue; - } - - switch (command) - { - case c_create: - if(name_isclean(user)) { - create(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_delete: - if(name_isclean(user)) { - delete(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_passwd: - if(name_isclean(user)) { - passwd(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_show: - if(name_isclean(user)) { - show(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - default: - fprintf(stderr, "This point should never be reached.\n"); - exit(1); - } - } - } - - reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/pwfile.c b/pwfile.c deleted file mode 100644 index ce2e573..0000000 --- a/pwfile.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ - * - * functions for parsing the config file. - * - */ - -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" -#include "pwyacc.h" - -/* the MySQL maximum */ -#define MAXPWCHARS 16 - -/* defaults for configurable values */ -const char* db_user = "root"; -const char* db_server = "localhost"; -const char* db_passwd = NULL; -const char* db_name = "mysql"; - -extern int yyparse(void); -extern FILE *yyin; - -int config_line = 1; - -static FILE *pwfile; -static char *filename = SYSCONFDIR "/mysql-admutils.conf"; - -int -read_config_file(void) -{ - struct rlimit rlim; - int rc; /* return code */ - - /* to stop the user from obtaining the password from a core dump. */ - if (getrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("getrlimit"); - exit(1); - } - rlim.rlim_max = 0; - if (setrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("setrlimit"); - exit(1); - } - - pwfile = fopen(filename, "r"); - if (!pwfile) { - fatal_error("cannot open configuration file %s", filename); - exit(1); - } - - /* we don't need to be SUID anymore. */ - if (seteuid(getuid()) != 0) - perror("seteuid"); - - yyin = pwfile; - rc = yyparse(); - fclose(pwfile); - - return rc; -} - - -int -yywrap(void) -{ - return 1; -} - - -int -yyerror(const char *msg) -{ - fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); - return 0; -} - - -int -config_set_string_var(int var, const char *value) -{ - assert(value); - switch (var) { - case USER: - db_user = value; - break; - case HOST: - db_server = value; - break; - case PASSWORD: - if (strlen(value) > MAXPWCHARS) { - fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", - filename, config_line, strlen(value), MAXPWCHARS); - fclose(pwfile); - exit(1); - } - db_passwd = value; - break; - default: - assert(!"We should never get here."); - } - return 0; -} diff --git a/pwlex.l b/pwlex.l deleted file mode 100644 index 457ef74..0000000 --- a/pwlex.l +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * lex source for the configuration file - * - */ - -%{ -#include -#include -#include "pwyacc.h" - -extern int config_line; -extern int yylval; -%} - -%% - -#.*\n config_line++; - -set { yylval = SET; return(SET); } -host { yylval = HOST; return(HOST); }; -user { yylval = USER; return(USER); }; -password { yylval = PASSWORD; return(PASSWORD); } - -\"[^"]*\" { - if (yytext[yyleng - 1] == '\\') - yymore(); - else - yytext[yyleng - 1] = '\0'; - yylval = (int)strdup(yytext + 1); - return(STRING); - }; - -; return(';'); - -[^ \t\n\;]* { - yylval = (int)strdup(yytext); - return(STRING); - } - -[ \t] ; - -\n config_line++; - -%% - diff --git a/pwyacc.y b/pwyacc.y deleted file mode 100644 index 1a39886..0000000 --- a/pwyacc.y +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * yacc source for parsing the configuration file - * - */ - -%{ -int yyerror(const char *msg); -int yylex(void); -int config_set_string_var(int var, const char *value); -%} - -%token SET HOST USER PASSWORD STRING - -%% - -input: ; -input: statement input ; - -statement: SET variable STRING ';' - { - $$ = config_set_string_var($2, (const char *)$3); - } - -; - -variable: USER | PASSWORD | HOST - { $$ = $1; } - ; - -%% - diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp From b8595f1ab62c0abe63ebc194a8cc4a94730d0fa9 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:17:58 +0200 Subject: [PATCH 09/22] Revert "Revert "Luker ut install"" This reverts commit 07f2e8d870532b834a3424a60832caecf9f803a9. --- .gitignore | 60 ++++ AUTHORS | 0 COPYING | 340 +++++++++++++++++++++++ ChangeLog | 25 ++ Makefile.am | 9 + NEWS | 0 README | 0 acconfig.h | 29 ++ common.c | 276 ++++++++++++++++++ configline | 44 +++ configure.ac | 98 +++++++ mysql-admutils.h | 51 ++++ mysql-dbadm.c | 707 +++++++++++++++++++++++++++++++++++++++++++++++ mysql-useradm.c | 367 ++++++++++++++++++++++++ pwfile.c | 108 ++++++++ pwlex.l | 47 ++++ pwyacc.y | 33 +++ stamp-h.in | 1 + 18 files changed, 2195 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 acconfig.h create mode 100644 common.c create mode 100644 configline create mode 100644 configure.ac create mode 100644 mysql-admutils.h create mode 100644 mysql-dbadm.c create mode 100644 mysql-useradm.c create mode 100644 pwfile.c create mode 100644 pwlex.l create mode 100644 pwyacc.y create mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73a87e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,60 @@ +*# +*.o +*~ +/.deps +/Makefile +/config.h +fjernet +/mysql-dbadm +/mysql-useradm +/pwlex.c +/pwyacc.c +/pwyacc.h +/stamp-h + +### Autotools ### +# http://www.gnu.org/software/automake + +Makefile.in +/ar-lib +/mdate-sh +/py-compile +/test-driver +/ylwrap +/mkinstalldirs +/INSTALL + +# http://www.gnu.org/software/autoconf + +autom4te.cache +/autoscan.log +/autoscan-*.log +/aclocal.m4 +/compile +/config.guess +/config.h.in +/config.log +/config.status +/config.sub +/configure +/configure.scan +/depcomp +/install-sh +/missing +/stamp-h1 + +# https://www.gnu.org/software/libtool/ + +/ltmain.sh + +# http://www.gnu.org/software/texinfo + +/texinfo.tex + +# http://www.gnu.org/software/m4/ + +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f030463 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,25 @@ +v0.50 (2006-11-20) geirha@itea.ntnu.no + * added create_tmp_table_priv + * added lock_tables_priv + * some memory leaks fixed + +v0.46 (2005-06-27) knuta@itea.ntnu.no + * Replaced deprecated functions not supported in SLES9 + +v0.42-0.45 (2002-03-07 - 2004-12-08) unknown + * Various undocumented fixes, at least something about length + of group names, I think + +v0.41 (2002-03-07) tlan@stud.ntnu.no + * Fixed a seg.fault bug in is_password_set()-routine. + +v0.4 (2002-03-07) tlan@stud.ntnu.no + * added ability to make users/dbs beginning with group-names. + * added index-priv + * added alter-priv + + +Mon Jul 6 11:58:10 1998 Vebjorn Ljosa + * Initial version. + + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e3a0bd7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,9 @@ +bin_PROGRAMS = mysql-dbadm mysql-useradm +mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c +mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) +mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) +BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c +YFLAGS = -d +INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" +LDADD = @MYSQL_LIBS@ @LEXLIB@ +LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..76e5baf --- /dev/null +++ b/acconfig.h @@ -0,0 +1,29 @@ +/* + * acconfig.h + * + * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ + * + */ + + +/* Define the name of the package */ +#undef PACKAGE + +/* Define the version of the package */ +#undef VERSION + +/* Define if MySQL is installed */ +#undef HAVE_MYSQL + +/* Define if you have the header file. */ +#undef HAVE_MATH_H + +/* Define if libmath is available */ +#undef HAVE_LIBM + +/* Define if libnsl is available */ +#undef HAVE_LIBNSL + +/* Define if libsocket is available */ +#undef HAVE_LIBSOCKET + diff --git a/common.c b/common.c new file mode 100644 index 0000000..84d9603 --- /dev/null +++ b/common.c @@ -0,0 +1,276 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ + * + * functions used by mysql-dbadm.c and mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +char *program_name; + +static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; + + +int +version() +{ + printf("%s %s\n", program_name, rcsheader); + exit(0); +} + + +int +wrong_use(char *format, ...) +{ + va_list ap; + + if (format) { + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + putchar('\n'); + } + + fprintf(stderr, "Try `%s --help' for more information.\n", program_name); + + return 1; +} + + +/* always returns 1. */ +int +dberror(MYSQL *pmysql, char *format, ...) +{ + const char *errmsg; + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + if (pmysql) { + errmsg = mysql_error(pmysql); + if ((errmsg) && (strcmp(errmsg, "") != 0)) + fprintf(stderr, "mysql: %s\n", errmsg); + + mysql_close(pmysql); + } + + return 1; +} + + +/* always returns 1. */ +int +fatal_error(char *format, ...) +{ + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return 1; +} + + +/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ +int +owner(char *name) +{ + struct passwd *p; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to look up your UNIX username."); + exit(1); + } + + if (strcmp(name, p->pw_name) == 0) + return 1; /* OK */ + + if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && + (*(name + strlen(p->pw_name)) == '_')) + return 1; /* OK */ + + return 0; /* not owner if we get as far as this */ +} + +/** + * Decides if the user is member of a group. The Unix group can't contain any + * '_'. i.e 'fidi_s' won't be accepted. + */ +int +member(char *gr) { + char *username; + + char group[65]; + struct group *g; + + struct passwd *p; + char *foo; + + /* size_t i = 0; */ + + /* Get username */ + p = getpwuid(getuid()); + if (!p) { + fprintf(stderr, "Failed to look up your UNIX username."); + return 0; + } + username = p->pw_name; + + /* Copy string, but cut at '_' */ + strncpy(group, gr, 64); + group[64] = '\0'; + + // ettersom man kan få inn gruppenavn med underscore i, må man rett og + // slett prøve seg fram for å sjekke om det er en gruppe personen er med + // i. + // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test + // (som kanskje finnes), men er med i www_esb. + // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet + // ut av den, og stripper av en og en underscore til vi finner noe som + // passer. + while ( 1 ) { + +#if DEBUG +// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); +#endif + g = getgrnam(group); +#if DEBUG + printf("tror gruppenavnet er: %s\n", group); +#endif + + // hvis gruppen ikke finnes, må vi i allefall prøve å se om + // det er noe lengre inn. + if (g) { + /* Check if user is member of group */ + while(*g->gr_mem != NULL) { + char * member = *g->gr_mem++; +#if DEBUG + printf("Medlem: %s\n", member); +#endif + + if (strcmp(member,username) == 0) { +#if DEBUG + printf("You have access to '%s'\n", gr); +#endif + return 1; /* OK */ + } + } +#if DEBUG + printf("You have no access to '%s'\n", gr); +#endif + } // if + // brukeren var ikke med i gruppen, så vi må prøve neste. + + // finner den siste _-en i navnet. + foo = strrchr(group, '_'); + if (foo == NULL) { + // hvis vi har kommet helt til bunn, og fremdeles + // ikke har blitt avbrutt, fantes det ingen slik gruppe. + return 0; + } + // det som nå er bak siste underscore er passe uinteressant, så + // vi flytter slutten av strengen litt framover. + *foo = '\0'; + + } // while +} + +/* return a list of the user's groupnames */ +/* numgroups is the total number of groups found */ +char **get_group_names(int *numgroups) +{ + char **grouplist; + gid_t *gids = NULL; + int real_nr_groups, nr_groups, i; + struct group *g; + + nr_groups = 0; + + /* Find number and allocate */ + nr_groups = getgroups(0, NULL); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to find group count"); + return NULL; + } + gids = malloc(nr_groups*sizeof(gid_t)); + + /* Fetch group IDs */ + nr_groups = getgroups(nr_groups, gids); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to fetch group info"); + return NULL; + } + + grouplist = malloc((nr_groups + 1)*sizeof(char *)); + real_nr_groups = 0; + + for (i = 0; i < nr_groups; i++) { + g = getgrgid(gids[i]); + + /* Go to next grp if it doesn't have a name */ + if (g != NULL) { + grouplist[real_nr_groups++] = strdup(g->gr_name); + } else { + fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); + } + } + grouplist[real_nr_groups] = NULL; + + free(gids); + + *numgroups = real_nr_groups; + + return grouplist; +} + + +int +reload(MYSQL *pmysql) +{ + return mysql_reload(pmysql); +} + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +char *strmov(char *dest, const char *src) { + while ((*dest++ = *src++)) + ; + return dest-1; +} + +/* New database and user names may only use these characters in their + identifier */ +const char name_validchars[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; + +/* Returns true if dbname contains only characters in name_validchars. */ +int name_isclean(char* name) { + int reallen, cleanlen; + reallen = strlen(name); + cleanlen = strspn(name, name_validchars); + return (reallen == cleanlen); +} + diff --git a/configline b/configline new file mode 100644 index 0000000..49f7a3f --- /dev/null +++ b/configline @@ -0,0 +1,44 @@ + +vanlig, på linux. +./configure --with-mysql=/usr/ --sysconfdir=/etc/ + +vi burde kanskje komplisere med libmysqlclient statisk, +sånn at vi slipper avhengigheter mot en spesiell rpmpakke. + + +elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile +--- ../Makefile.org Tue Apr 8 20:20:00 2003 ++++ Makefile Tue Apr 8 20:22:27 2003 +@@ -62,8 +62,8 @@ + LEX = flex + MAKEINFO = makeinfo + MYSQL_INCLUDE = -I/store/include/mysql +-MYSQL_LFLAGS = -L/store/lib/mysql +-MYSQL_LIBS = -lmysqlclient ++MYSQL_LFLAGS = ++MYSQL_LIBS = + PACKAGE = mysql-admutils + SYSCONFDIR = + VERSION = 0.43 +@@ -76,8 +76,8 @@ + BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c + YFLAGS = -d + INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" +-LDADD = -lmysqlclient -lfl +-LDFLAGS = -L/store/lib/mysql ++LDADD = /store/lib/mysql/libmysqlclient.a -lfl ++LDFLAGS = + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = config.h + + + + + + + + +$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ +$Source: /tmp/cvs/mysql-admutils/configline,v $ + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..9b7bc2b --- /dev/null +++ b/configure.ac @@ -0,0 +1,98 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(mysql-dbadm.c) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(mysql-admutils, 0.46) +AM_SANITY_CHECK + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AM_PROG_LEX +AC_PROG_YACC + +dnl Checks for libraries. +AC_CHECK_LIB(c, floor, [:], [ + AC_CHECK_LIB(m, floor, [ + LIBS="$LIBS -lm" + AC_DEFINE(HAVE_LIBM) ], []) ]) +AC_CHECK_LIB(mysqlclient, mysql_connect, [ + LIBS="$LIBS -lmysqlclient" ], []) +AC_CHECK_LIB(c, gethostbyaddr, [:], [ + AC_CHECK_LIB(nsl, gethostbyaddr, [ + LIBS="$LIBS -lnsl" + AC_DEFINE(HAVE_LIBNSL) ], []) ]) +AC_CHECK_LIB(c, socket, [:], [ + AC_CHECK_LIB(socket, socket, [ + LIBS="$LIBS -lsocket" + AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) + +AC_MSG_CHECKING(for MySQL support) +AC_ARG_WITH(mysql, +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) + fi + fi + MYSQL_INCLUDE=-I$MYSQL_INCDIR + MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" + #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" + MYSQL_LIBS=-lmysqlclient + + AC_DEFINE(HAVE_MYSQL) + AC_MSG_RESULT(yes) + + dnl check for errmsg.h, which isn't installed by some versions of 3.21 + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" + AC_CHECK_HEADERS(errmsg.h) + CPPFLAGS="$old_CPPFLAGS" + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) + AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit +]) +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_LFLAGS) +AC_SUBST(MYSQL_INCLUDE) + + +AC_MSG_CHECKING([whether to enable -Wall -pedantic]) +AC_ARG_ENABLE(warnings, +[ --enable-warnings Enable -Wall -pedantic if using gcc.], +[ if test -n "$GCC"; then + AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) + CFLAGS="$CFLAGS -Wall -pedantic" + fi +],AC_MSG_RESULT(no)) + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +dnl Checks for library functions. +AC_FUNC_VPRINTF + +AC_SUBST(SYSCONFDIR) + +AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h new file mode 100644 index 0000000..1ee0cdc --- /dev/null +++ b/mysql-admutils.h @@ -0,0 +1,51 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ + * + */ + +#ifndef MYSQL_ADMUTILS_H +#define MYSQL_ADMUTILS_H + +extern char *program_name; + +/* defined in pwfile.c */ +extern const char *db_server; +extern const char *db_user; +extern const char *db_passwd; +extern const char *db_name; + +extern int +wrong_use(char *format, ...); + +extern int +fatal_error(char *format, ...); + +extern int +owner(char *name); + +extern int member(char *gr); + +extern char **get_group_names(int *numgroups); + +extern int +version(void); + +extern int +read_config_file(void); + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +extern char *strmov(char *, const char *); + +extern int name_isclean(char*); + +#ifdef _mysql_h + +extern int +dberror(MYSQL *pmysql, char *format, ...); + +extern int +reload(MYSQL *pmysql); + +#endif + +#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c new file mode 100644 index 0000000..d80ed86 --- /dev/null +++ b/mysql-dbadm.c @@ -0,0 +1,707 @@ +/* + * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ + * + * mysql-dbadm.c + * + */ + +#include "config.h" +#include "mysql-admutils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char * +strchr_whitespace(const char *s) +{ + char *sp, *tab; + sp = strchr(s, ' '); + tab = strchr(s, '\t'); + if (sp == NULL) + return tab; + if (tab == NULL) + return sp; + return sp < tab ? sp : tab; /* if both are found, return the first one */ +} + +char * +strtok_whitespace(char *s) +{ + static char *cp; + char *r; + + r = s ? s : cp; + if (r == NULL) + return NULL; + cp = strchr_whitespace(r); + if (cp == NULL) + return r; + while ((*cp == ' ') || (*cp == '\t')) + *cp++ = '\0'; + return r; +} + + +int +valid_priv(const char *s) +{ + if (s == NULL) return 0; +#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 + ACCEPT("Y"); + ACCEPT("N"); + ACCEPT("y"); + ACCEPT("n"); +#undef ACCEPT + return 0; /* not a valid priv */ +} + + +int +usage() +{ + printf("Usage: %s COMMAND [DATABASE]...\n", program_name); + printf("Create, drop og edit permission for the DATABASE(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the DATABASE(s).\n"); + printf(" drop delete the DATABASE(s).\n"); + printf(" show give information about the DATABASE(s), or, if\n"); + printf(" none are given, all the ones you own.\n"); + printf(" editperm change permissions for the DATABASE(s). Your\n"); + printf(" favorite editor will be started, allowing you\n"); + printf(" to make changes to the permission table.\n"); + printf(" Run '%s --help-editperm' for more\n" + " information.\n",program_name); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + +int +usage_editperm() +{ + printf("Usage: %s editperm [DATABASE]\n", program_name); + printf("Edit permissions for the DATABASE. Running this command will\n"); + printf("spawn the editor stored in the $EDITOR environment variable.\n"); + printf("(pico will be used if the variable is unset)\n"); + printf("\n"); + printf("The file should contain one line per user, starting with the\n"); + printf("username and followed by ten Y/N-values seperated by whitespace.\n"); + printf("Lines starting with # are ignored.\n"); + printf("\n"); + printf("The Y/N-values corresponds to the following mysql privileges:\n"); + printf(" Select - Enables use of SELECT\n"); + printf(" Insert - Enables use of INSERT\n"); + printf(" Update - Enables use of UPDATE\n"); + printf(" Delete - Enables use of DELETE\n"); + printf(" Create - Enables use of CREATE TABLE\n"); + printf(" Drop - Enables use of DROP TABLE\n"); + printf(" Alter - Enables use of ALTER TABLE\n"); + printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); + printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); + printf(" Lock - Enables use of LOCK TABLE\n"); + printf(" References - Enables use of REFERENCES\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +create(MYSQL *pmysql, char *db) +{ + // hvis man forsøker å dra mysql_create_db() på en database som + // allerede finnes, så henger bare hele sql-kallet. Vi må derfor + // forsøke å selecte databasen først. Ettersom man alltid er root, + // går jo dette vanligvis bra. + // finner ut om denne finnes fra før. + if (!mysql_select_db(pmysql, db)) { + return dberror(pmysql, "Database '%s' already exists.", db); + } + mysql_select_db(pmysql, "mysql"); + // oppretter databasen. + char query[1024], *end; + end = strmov(query, "CREATE DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot create database '%s'.", db); + fprintf(stderr, "Database '%s' created.\n", db); + return 0; +} + + +int +drop(MYSQL *pmysql, char *db) +{ + char query[1024], *end; + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete permissions for database '%s'.", db); + + if (mysql_select_db(pmysql, db)) { + dberror(pmysql, "Database '%s' doesn't exists.", db); + return 0; + } + mysql_select_db(pmysql, "mysql"); + + end = strmov(query, "DROP DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot drop database '%s'.", db); + + fprintf(stderr, "Database '%s' dropped.\n", db); + return 0; +} + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char *wild; + char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ + MYSQL_RES *res; + int rows, numgroups, numgroupdbs; + MYSQL_ROW row; + char **dblist; + int i, counter; + struct passwd *p; + + // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. + char escaped_user[64]; + char *cp_kopi; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to lookup your UNIX username."); + exit(1); + } + + dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ + + numgroupdbs = 0; + counter = 0; + + usr_groups = get_group_names(&numgroups); + cp = usr_groups; + while (cp && *cp) { // itererer over alle grupper en person er med i + if (*cp == NULL) + break; + +#ifdef DEBUG + printf("cp er %s\n", *cp); +#endif + + escaped_user[0] = '\0'; + cp_kopi=*cp; + +// itererer over bokstavene i gruppenavn, og escaper spesialtegn. + for(i=0; i<=strlen(cp_kopi); i++) { + // hvis % _ , så skriv \ og så tegn + if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { + strcat(escaped_user, "\\"); + } + + escaped_user[strlen(escaped_user) + 1] = '\0'; + escaped_user[strlen(escaped_user)] = cp_kopi[i]; + } // for + + wild = malloc(strlen(escaped_user)+4); + sprintf(wild, "%s\\_%%", escaped_user); + +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + + if (rows > 0) { + numgroupdbs += rows; + + dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + } + + + free(wild); + mysql_free_result(res); + cp++; + } + + wild = malloc(strlen(p->pw_name) + 4); + sprintf(wild, "%s\\_%%", p->pw_name); +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); + + if (!dblist) { + dberror(NULL, "Out of memory.\n"); + free(wild); + return NULL; + } + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + mysql_free_result(res); + + res = mysql_list_dbs(pmysql, p->pw_name); + rows = mysql_num_rows(res); + if (rows == 1) + dblist[counter++] = strdup(p->pw_name); + + dblist[counter] = NULL; + + mysql_free_result(res); + free(wild); + for (i=0;inet.fd) != 0) + { + perror("Failed to close fd"); + exit(1); + } + + editor = getenv("EDITOR"); + if (!editor) + editor = "pico"; /* OK since editor won't be freed */ + + cmd = malloc(sizeof(char) * strlen(editor) + 7); + sprintf(cmd, "%s \"$1\"", editor); + + /* sh -c '$EDITOR "$1"' sh "$fn" */ + execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); + perror("Failed to execute editor"); + fprintf(stderr, "Make sure the EDITOR environment variable contains" + " a valid editor\n"); + exit(1); + } + + if (exit_status != 0) + return 1; + + /* parse */ + f = fopen(fn, "r"); + lines = 0; + while (fgets(line, sizeof(line), f)) { + cp = strchr(line, '\n'); + if (cp) + *cp = '\0'; + + cp = line; + while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; + if (*cp == '\0') continue; + if (*cp == '#') continue; + if (*cp == '\n') continue; + + #define STRTOK_WHITESPACE(res, start) \ + { if (!(res = strtok_whitespace(start))) continue; } + + STRTOK_WHITESPACE(user, cp); + if (strlen(user) < 1) + return dberror(NULL, "Invalid user '%s' in grant line %d.", user, + lines + 1); + if (strcmp(user, "%") == 0) + *user = '\0'; /* ugly, but it works... */ + + #define CHECK_PRIV(PRIV) \ + if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ + "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ + "all ten privileges.\nRun '%s --help-editerm' for more " \ + "information.\nNo permissions have been set.", PRIV, lines + 1, \ + program_name) + + STRTOK_WHITESPACE(select_priv, NULL); + CHECK_PRIV(select_priv); + STRTOK_WHITESPACE(insert_priv, NULL); + CHECK_PRIV(insert_priv); + STRTOK_WHITESPACE(update_priv, NULL); + CHECK_PRIV(update_priv); + STRTOK_WHITESPACE(delete_priv, NULL); + CHECK_PRIV(delete_priv); + STRTOK_WHITESPACE(create_priv, NULL); + CHECK_PRIV(create_priv); + STRTOK_WHITESPACE(drop_priv, NULL); + CHECK_PRIV(drop_priv); + STRTOK_WHITESPACE(alter_priv, NULL); + CHECK_PRIV(alter_priv); + STRTOK_WHITESPACE(index_priv, NULL); + CHECK_PRIV(index_priv); + STRTOK_WHITESPACE(create_tmp_table_priv, NULL); + CHECK_PRIV(create_tmp_table_priv); + STRTOK_WHITESPACE(lock_tables_priv, NULL); + CHECK_PRIV(lock_tables_priv); + STRTOK_WHITESPACE(references_priv, NULL); + CHECK_PRIV(references_priv); + + #undef STRTOK_WHITESPACE + #undef CHECK_PRIV + + end = strmov(query, "INSERT INTO db (" + "host,db,user,select_priv,insert_priv," + "update_priv,delete_priv,create_priv," + "drop_priv,alter_priv,index_priv," + "create_tmp_table_priv,lock_tables_priv," + "references_priv" + ") VALUES ("); + + end = strmov(end, "'%'"); + + #define APPEND(VAR) {\ + *end++ = ',';\ + *end++ = '\'';\ + end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ + *end++ = '\'';\ + } + + APPEND(db); + APPEND(user); + APPEND(select_priv); + APPEND(insert_priv); + APPEND(update_priv); + APPEND(delete_priv); + APPEND(create_priv); + APPEND(drop_priv); + APPEND(alter_priv); + APPEND(index_priv); + APPEND(create_tmp_table_priv); + APPEND(lock_tables_priv); + APPEND(references_priv); + *end++ = ')'; + *end = '\0'; + + #undef APPEND + + queries[lines] = strdup(query); + lines++; + if (lines >= MAX_GRANTS) + { + dberror(NULL, "Warning: Maximum of %d grants reached.\n", + MAX_GRANTS); + continue; + } + } /* while fgets ... */ + + unlink(fn); + fclose(f); + + /* now that we have checked the input for errors, we can safely + delete the old grants from the database and insert the new ones. */ + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete old grants for '%s'.", db); + + for (i = 0; i < lines; i++) + { +#ifdef DEBUG + puts(queries[i]); + putchar('\n'); +#endif + if (mysql_query(pmysql, queries[i])) + dberror(pmysql, "Failed to insert grant line %d.", i + 1); + free(queries[i]); + } + + fprintf(stderr,"Permissions updated\n"); + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_drop, c_editperm, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char *db; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help-editperm") == 0) + return usage_editperm(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + + if (argc < 2) + return wrong_use(NULL); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "drop") == 0) + command = c_drop; + else if (strcmp(argv[1], "editperm") == 0) + command = c_editperm; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command"); /* XXX */ + + /* all other than show requires at least one DATABASE argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) { + dblist = list(&mysql); + p = dblist; + while (p && *p) { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + db = malloc(64); + /* for each supplied database name, perform the requested action */ + for (i = 2; i < argc; i++) { + // HE HE + strncpy(db, argv[i], 32); + db[32] = '\0'; + + if (! (owner(db) || member(db))) { + if (command == c_create) + dberror(NULL,"Unable to create mysql-database '%s'.\n" + "A mysql-database must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are a " + "member of.\n", + db, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); + continue; + } + + switch (command) { + case c_create: + // We only check newly created databases. Many old ("unclean") databases are still in use. + if(name_isclean(db)) { + create(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_drop: + if(name_isclean(db)) { + drop(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_editperm: + if(name_isclean(db)) { + editperm(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_show: + if(name_isclean(db)) { + show(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + default: + return dberror(NULL, "This point should never be reached!"); + } + } // for + free(db); + } // else + + mysql_reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/mysql-useradm.c b/mysql-useradm.c new file mode 100644 index 0000000..04bcdca --- /dev/null +++ b/mysql-useradm.c @@ -0,0 +1,367 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ + * + * mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +int +usage() +{ + printf("Usage: %s COMMAND [USER]...\n", program_name); + printf("Create, delete or change password for the USER(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the USER(s).\n"); + printf(" delete delete the USER(s).\n"); + printf(" passwd change the MySQL password for the USER(s).\n"); + printf(" show give information about the USERS(s), or, if\n"); + printf(" none are given, all the users you have.\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +is_password_set(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + int check = 0; + + end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to look up password for user '%s'.", user); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + + if (rows > 1) + { + mysql_free_result(res); + return dberror(NULL, "Query for password for user '%s' gave %d results!", + user, rows); + } + else if (rows < 1) { + mysql_free_result(res); + return -1; + } + + row = mysql_fetch_row(res); + check = (row[0] && (strlen(row[0]) > 0)); + mysql_free_result(res); + + return check; +} + + +int +create(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "CREATE USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "'"); + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to create user '%s'.", user); + + return 0; +} + + +int +delete(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "DROP USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to delete user '%s'.", user); + + return 0; +} + + +int +passwd(MYSQL *pmysql, const char *user) +{ + char prompt[1024]; + char query[1024], *end; + char *password, *confirm_password; + + if (is_password_set(pmysql, user) == -1) /* no such mysql user */ + return dberror(NULL, "User '%s' does not exist." + " You must create it first.\n", user); + + sprintf(prompt, "New MySQL password for user '%s': ", user); + password = getpass(prompt); + confirm_password = strdup(password); + sprintf(prompt, "Retype new MySQL password for user '%s': ", user); + password = getpass(prompt); + if (strcmp(password, confirm_password) != 0) + { + free(confirm_password); + return dberror(NULL, "Sorry, passwords do not match."); + } + free(confirm_password); + + end = strmov(query, "ALTER user '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "' IDENTIFIED BY '"); + end += mysql_real_escape_string(pmysql, end, password, strlen(password)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to set new password for user '%s'.", user); + if (mysql_affected_rows(pmysql) != 1) + dberror(NULL, "%d rows affected by password update for user '%s'!", + mysql_affected_rows(pmysql), user); + + fprintf(stderr, "Password updated for user '%s'.\n", user); + return 0; +} + + +int +show(MYSQL *pmysql, const char *user) +{ + switch (is_password_set(pmysql, user)) + { + case -1: + break; + case 0: + printf("User '%s': ", user); + printf("no password set.\n"); + break; + case 1: + printf("User '%s': ", user); + printf("password set.\n"); + break; + } + return 0; +} + + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char query[4096], *end; + char **usrgroups, **cp; + MYSQL_RES *res; + int rows, numgroups; + MYSQL_ROW row; + char **userlist; + int i; + struct passwd *p; + + p = getpwuid(getuid()); + + end = strmov(query, "SELECT user FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "\\_%'"); + + numgroups = 0; + + usrgroups = get_group_names(&numgroups); + cp = usrgroups; + while (cp && *cp) { + end = strmov(end, " OR user='"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "\\_%'"); + free(*cp); + cp++; + } + free(usrgroups); + +#ifdef DEBUG + printf("about to run query: %s\n", query); +#endif + + if (mysql_query(pmysql, query)) + { + dberror(pmysql, "Failed to look up %s's users.", p->pw_name); + return NULL; + } + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + userlist = malloc((rows + 1) * sizeof(char *)); + if (!userlist) + { + dberror(NULL, "%s: Out of memory.\n", program_name); + return NULL; + } + for (i = 0; i < rows; i++) + if ((row = mysql_fetch_row(res))) + { + userlist[i] = strdup(row[0]); + } + + userlist[i] = NULL; + + mysql_free_result(res); + + return userlist; +} + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_delete, c_passwd, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char user[65]; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + if (argc < 2) + return wrong_use(NULL); + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "delete") == 0) + command = c_delete; + else if (strcmp(argv[1], "passwd") == 0) + command = c_passwd; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ + + /* all other than show requires at least one USER argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) + { + dblist = list(&mysql); + p = dblist; + while (p && *p) + { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + /* for each supplied database name, perform the requested action */ + + for (i = 2; i < argc; i++) { + strncpy(user, argv[i], 32); + user[33] = '\0'; + if (! (owner(user) || member(user))) + { + if (command == c_create) + dberror(NULL,"Unable to create mysql-user '%s'.\n" + + "A mysql-user must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are " + "a member of.\n", + user, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); + continue; + } + + switch (command) + { + case c_create: + if(name_isclean(user)) { + create(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_delete: + if(name_isclean(user)) { + delete(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_passwd: + if(name_isclean(user)) { + passwd(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_show: + if(name_isclean(user)) { + show(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + default: + fprintf(stderr, "This point should never be reached.\n"); + exit(1); + } + } + } + + reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/pwfile.c b/pwfile.c new file mode 100644 index 0000000..ce2e573 --- /dev/null +++ b/pwfile.c @@ -0,0 +1,108 @@ +/* + * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ + * + * functions for parsing the config file. + * + */ + +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" +#include "pwyacc.h" + +/* the MySQL maximum */ +#define MAXPWCHARS 16 + +/* defaults for configurable values */ +const char* db_user = "root"; +const char* db_server = "localhost"; +const char* db_passwd = NULL; +const char* db_name = "mysql"; + +extern int yyparse(void); +extern FILE *yyin; + +int config_line = 1; + +static FILE *pwfile; +static char *filename = SYSCONFDIR "/mysql-admutils.conf"; + +int +read_config_file(void) +{ + struct rlimit rlim; + int rc; /* return code */ + + /* to stop the user from obtaining the password from a core dump. */ + if (getrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("getrlimit"); + exit(1); + } + rlim.rlim_max = 0; + if (setrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("setrlimit"); + exit(1); + } + + pwfile = fopen(filename, "r"); + if (!pwfile) { + fatal_error("cannot open configuration file %s", filename); + exit(1); + } + + /* we don't need to be SUID anymore. */ + if (seteuid(getuid()) != 0) + perror("seteuid"); + + yyin = pwfile; + rc = yyparse(); + fclose(pwfile); + + return rc; +} + + +int +yywrap(void) +{ + return 1; +} + + +int +yyerror(const char *msg) +{ + fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); + return 0; +} + + +int +config_set_string_var(int var, const char *value) +{ + assert(value); + switch (var) { + case USER: + db_user = value; + break; + case HOST: + db_server = value; + break; + case PASSWORD: + if (strlen(value) > MAXPWCHARS) { + fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", + filename, config_line, strlen(value), MAXPWCHARS); + fclose(pwfile); + exit(1); + } + db_passwd = value; + break; + default: + assert(!"We should never get here."); + } + return 0; +} diff --git a/pwlex.l b/pwlex.l new file mode 100644 index 0000000..457ef74 --- /dev/null +++ b/pwlex.l @@ -0,0 +1,47 @@ +/* + * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * lex source for the configuration file + * + */ + +%{ +#include +#include +#include "pwyacc.h" + +extern int config_line; +extern int yylval; +%} + +%% + +#.*\n config_line++; + +set { yylval = SET; return(SET); } +host { yylval = HOST; return(HOST); }; +user { yylval = USER; return(USER); }; +password { yylval = PASSWORD; return(PASSWORD); } + +\"[^"]*\" { + if (yytext[yyleng - 1] == '\\') + yymore(); + else + yytext[yyleng - 1] = '\0'; + yylval = (int)strdup(yytext + 1); + return(STRING); + }; + +; return(';'); + +[^ \t\n\;]* { + yylval = (int)strdup(yytext); + return(STRING); + } + +[ \t] ; + +\n config_line++; + +%% + diff --git a/pwyacc.y b/pwyacc.y new file mode 100644 index 0000000..1a39886 --- /dev/null +++ b/pwyacc.y @@ -0,0 +1,33 @@ +/* + * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * yacc source for parsing the configuration file + * + */ + +%{ +int yyerror(const char *msg); +int yylex(void); +int config_set_string_var(int var, const char *value); +%} + +%token SET HOST USER PASSWORD STRING + +%% + +input: ; +input: statement input ; + +statement: SET variable STRING ';' + { + $$ = config_set_string_var($2, (const char *)$3); + } + +; + +variable: USER | PASSWORD | HOST + { $$ = $1; } + ; + +%% + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp From fe6b59db60be5d1057909aa1a0f560afbed8342e Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:18:05 +0200 Subject: [PATCH 10/22] Revert "Luker ut install" This reverts commit 332ca2ece9f7a461d82c505e5b2943df8be80358. --- .gitignore | 60 ---- AUTHORS | 0 COPYING | 340 ----------------------- ChangeLog | 25 -- Makefile.am | 9 - NEWS | 0 README | 0 acconfig.h | 29 -- common.c | 276 ------------------ configline | 44 --- configure.ac | 98 ------- mysql-admutils.h | 51 ---- mysql-dbadm.c | 707 ----------------------------------------------- mysql-useradm.c | 367 ------------------------ pwfile.c | 108 -------- pwlex.l | 47 ---- pwyacc.y | 33 --- stamp-h.in | 1 - 18 files changed, 2195 deletions(-) delete mode 100644 .gitignore delete mode 100644 AUTHORS delete mode 100644 COPYING delete mode 100644 ChangeLog delete mode 100644 Makefile.am delete mode 100644 NEWS delete mode 100644 README delete mode 100644 acconfig.h delete mode 100644 common.c delete mode 100644 configline delete mode 100644 configure.ac delete mode 100644 mysql-admutils.h delete mode 100644 mysql-dbadm.c delete mode 100644 mysql-useradm.c delete mode 100644 pwfile.c delete mode 100644 pwlex.l delete mode 100644 pwyacc.y delete mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 73a87e5..0000000 --- a/.gitignore +++ /dev/null @@ -1,60 +0,0 @@ -*# -*.o -*~ -/.deps -/Makefile -/config.h -fjernet -/mysql-dbadm -/mysql-useradm -/pwlex.c -/pwyacc.c -/pwyacc.h -/stamp-h - -### Autotools ### -# http://www.gnu.org/software/automake - -Makefile.in -/ar-lib -/mdate-sh -/py-compile -/test-driver -/ylwrap -/mkinstalldirs -/INSTALL - -# http://www.gnu.org/software/autoconf - -autom4te.cache -/autoscan.log -/autoscan-*.log -/aclocal.m4 -/compile -/config.guess -/config.h.in -/config.log -/config.status -/config.sub -/configure -/configure.scan -/depcomp -/install-sh -/missing -/stamp-h1 - -# https://www.gnu.org/software/libtool/ - -/ltmain.sh - -# http://www.gnu.org/software/texinfo - -/texinfo.tex - -# http://www.gnu.org/software/m4/ - -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/COPYING b/COPYING deleted file mode 100644 index eeb586b..0000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index f030463..0000000 --- a/ChangeLog +++ /dev/null @@ -1,25 +0,0 @@ -v0.50 (2006-11-20) geirha@itea.ntnu.no - * added create_tmp_table_priv - * added lock_tables_priv - * some memory leaks fixed - -v0.46 (2005-06-27) knuta@itea.ntnu.no - * Replaced deprecated functions not supported in SLES9 - -v0.42-0.45 (2002-03-07 - 2004-12-08) unknown - * Various undocumented fixes, at least something about length - of group names, I think - -v0.41 (2002-03-07) tlan@stud.ntnu.no - * Fixed a seg.fault bug in is_password_set()-routine. - -v0.4 (2002-03-07) tlan@stud.ntnu.no - * added ability to make users/dbs beginning with group-names. - * added index-priv - * added alter-priv - - -Mon Jul 6 11:58:10 1998 Vebjorn Ljosa - * Initial version. - - diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e3a0bd7..0000000 --- a/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -bin_PROGRAMS = mysql-dbadm mysql-useradm -mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c -mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) -mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) -BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c -YFLAGS = -d -INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" -LDADD = @MYSQL_LIBS@ @LEXLIB@ -LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 76e5baf..0000000 --- a/acconfig.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * acconfig.h - * - * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ - * - */ - - -/* Define the name of the package */ -#undef PACKAGE - -/* Define the version of the package */ -#undef VERSION - -/* Define if MySQL is installed */ -#undef HAVE_MYSQL - -/* Define if you have the header file. */ -#undef HAVE_MATH_H - -/* Define if libmath is available */ -#undef HAVE_LIBM - -/* Define if libnsl is available */ -#undef HAVE_LIBNSL - -/* Define if libsocket is available */ -#undef HAVE_LIBSOCKET - diff --git a/common.c b/common.c deleted file mode 100644 index 84d9603..0000000 --- a/common.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ - * - * functions used by mysql-dbadm.c and mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -char *program_name; - -static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; - - -int -version() -{ - printf("%s %s\n", program_name, rcsheader); - exit(0); -} - - -int -wrong_use(char *format, ...) -{ - va_list ap; - - if (format) { - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - putchar('\n'); - } - - fprintf(stderr, "Try `%s --help' for more information.\n", program_name); - - return 1; -} - - -/* always returns 1. */ -int -dberror(MYSQL *pmysql, char *format, ...) -{ - const char *errmsg; - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - if (pmysql) { - errmsg = mysql_error(pmysql); - if ((errmsg) && (strcmp(errmsg, "") != 0)) - fprintf(stderr, "mysql: %s\n", errmsg); - - mysql_close(pmysql); - } - - return 1; -} - - -/* always returns 1. */ -int -fatal_error(char *format, ...) -{ - va_list ap; - - fprintf(stderr, "%s: ", program_name); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, "\n"); - - return 1; -} - - -/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ -int -owner(char *name) -{ - struct passwd *p; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to look up your UNIX username."); - exit(1); - } - - if (strcmp(name, p->pw_name) == 0) - return 1; /* OK */ - - if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && - (*(name + strlen(p->pw_name)) == '_')) - return 1; /* OK */ - - return 0; /* not owner if we get as far as this */ -} - -/** - * Decides if the user is member of a group. The Unix group can't contain any - * '_'. i.e 'fidi_s' won't be accepted. - */ -int -member(char *gr) { - char *username; - - char group[65]; - struct group *g; - - struct passwd *p; - char *foo; - - /* size_t i = 0; */ - - /* Get username */ - p = getpwuid(getuid()); - if (!p) { - fprintf(stderr, "Failed to look up your UNIX username."); - return 0; - } - username = p->pw_name; - - /* Copy string, but cut at '_' */ - strncpy(group, gr, 64); - group[64] = '\0'; - - // ettersom man kan få inn gruppenavn med underscore i, må man rett og - // slett prøve seg fram for å sjekke om det er en gruppe personen er med - // i. - // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test - // (som kanskje finnes), men er med i www_esb. - // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet - // ut av den, og stripper av en og en underscore til vi finner noe som - // passer. - while ( 1 ) { - -#if DEBUG -// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); -#endif - g = getgrnam(group); -#if DEBUG - printf("tror gruppenavnet er: %s\n", group); -#endif - - // hvis gruppen ikke finnes, må vi i allefall prøve å se om - // det er noe lengre inn. - if (g) { - /* Check if user is member of group */ - while(*g->gr_mem != NULL) { - char * member = *g->gr_mem++; -#if DEBUG - printf("Medlem: %s\n", member); -#endif - - if (strcmp(member,username) == 0) { -#if DEBUG - printf("You have access to '%s'\n", gr); -#endif - return 1; /* OK */ - } - } -#if DEBUG - printf("You have no access to '%s'\n", gr); -#endif - } // if - // brukeren var ikke med i gruppen, så vi må prøve neste. - - // finner den siste _-en i navnet. - foo = strrchr(group, '_'); - if (foo == NULL) { - // hvis vi har kommet helt til bunn, og fremdeles - // ikke har blitt avbrutt, fantes det ingen slik gruppe. - return 0; - } - // det som nå er bak siste underscore er passe uinteressant, så - // vi flytter slutten av strengen litt framover. - *foo = '\0'; - - } // while -} - -/* return a list of the user's groupnames */ -/* numgroups is the total number of groups found */ -char **get_group_names(int *numgroups) -{ - char **grouplist; - gid_t *gids = NULL; - int real_nr_groups, nr_groups, i; - struct group *g; - - nr_groups = 0; - - /* Find number and allocate */ - nr_groups = getgroups(0, NULL); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to find group count"); - return NULL; - } - gids = malloc(nr_groups*sizeof(gid_t)); - - /* Fetch group IDs */ - nr_groups = getgroups(nr_groups, gids); - if (nr_groups == -1) { - dberror(NULL, "Error while trying to fetch group info"); - return NULL; - } - - grouplist = malloc((nr_groups + 1)*sizeof(char *)); - real_nr_groups = 0; - - for (i = 0; i < nr_groups; i++) { - g = getgrgid(gids[i]); - - /* Go to next grp if it doesn't have a name */ - if (g != NULL) { - grouplist[real_nr_groups++] = strdup(g->gr_name); - } else { - fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); - } - } - grouplist[real_nr_groups] = NULL; - - free(gids); - - *numgroups = real_nr_groups; - - return grouplist; -} - - -int -reload(MYSQL *pmysql) -{ - return mysql_reload(pmysql); -} - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -char *strmov(char *dest, const char *src) { - while ((*dest++ = *src++)) - ; - return dest-1; -} - -/* New database and user names may only use these characters in their - identifier */ -const char name_validchars[] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; - -/* Returns true if dbname contains only characters in name_validchars. */ -int name_isclean(char* name) { - int reallen, cleanlen; - reallen = strlen(name); - cleanlen = strspn(name, name_validchars); - return (reallen == cleanlen); -} - diff --git a/configline b/configline deleted file mode 100644 index 49f7a3f..0000000 --- a/configline +++ /dev/null @@ -1,44 +0,0 @@ - -vanlig, på linux. -./configure --with-mysql=/usr/ --sysconfdir=/etc/ - -vi burde kanskje komplisere med libmysqlclient statisk, -sånn at vi slipper avhengigheter mot en spesiell rpmpakke. - - -elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile ---- ../Makefile.org Tue Apr 8 20:20:00 2003 -+++ Makefile Tue Apr 8 20:22:27 2003 -@@ -62,8 +62,8 @@ - LEX = flex - MAKEINFO = makeinfo - MYSQL_INCLUDE = -I/store/include/mysql --MYSQL_LFLAGS = -L/store/lib/mysql --MYSQL_LIBS = -lmysqlclient -+MYSQL_LFLAGS = -+MYSQL_LIBS = - PACKAGE = mysql-admutils - SYSCONFDIR = - VERSION = 0.43 -@@ -76,8 +76,8 @@ - BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c - YFLAGS = -d - INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" --LDADD = -lmysqlclient -lfl --LDFLAGS = -L/store/lib/mysql -+LDADD = /store/lib/mysql/libmysqlclient.a -lfl -+LDFLAGS = - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - CONFIG_HEADER = config.h - - - - - - - - -$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ -$Source: /tmp/cvs/mysql-admutils/configline,v $ - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9b7bc2b..0000000 --- a/configure.ac +++ /dev/null @@ -1,98 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(mysql-dbadm.c) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(mysql-admutils, 0.46) -AM_SANITY_CHECK - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AM_PROG_LEX -AC_PROG_YACC - -dnl Checks for libraries. -AC_CHECK_LIB(c, floor, [:], [ - AC_CHECK_LIB(m, floor, [ - LIBS="$LIBS -lm" - AC_DEFINE(HAVE_LIBM) ], []) ]) -AC_CHECK_LIB(mysqlclient, mysql_connect, [ - LIBS="$LIBS -lmysqlclient" ], []) -AC_CHECK_LIB(c, gethostbyaddr, [:], [ - AC_CHECK_LIB(nsl, gethostbyaddr, [ - LIBS="$LIBS -lnsl" - AC_DEFINE(HAVE_LIBNSL) ], []) ]) -AC_CHECK_LIB(c, socket, [:], [ - AC_CHECK_LIB(socket, socket, [ - LIBS="$LIBS -lsocket" - AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) - -AC_MSG_CHECKING(for MySQL support) -AC_ARG_WITH(mysql, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base - install directory, defaults to /usr/local.], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - MYSQL_INCDIR=/usr/local/include/mysql - MYSQL_LIBDIR=/usr/local/lib/mysql - else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - MYSQL_LIBDIR=$withval/lib/mysql - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - MYSQL_LIBDIR=$withval/lib - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) - fi - fi - MYSQL_INCLUDE=-I$MYSQL_INCDIR - MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" - #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" - MYSQL_LIBS=-lmysqlclient - - AC_DEFINE(HAVE_MYSQL) - AC_MSG_RESULT(yes) - - dnl check for errmsg.h, which isn't installed by some versions of 3.21 - old_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" - AC_CHECK_HEADERS(errmsg.h) - CPPFLAGS="$old_CPPFLAGS" - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) - AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit -]) -AC_SUBST(MYSQL_LIBS) -AC_SUBST(MYSQL_LFLAGS) -AC_SUBST(MYSQL_INCLUDE) - - -AC_MSG_CHECKING([whether to enable -Wall -pedantic]) -AC_ARG_ENABLE(warnings, -[ --enable-warnings Enable -Wall -pedantic if using gcc.], -[ if test -n "$GCC"; then - AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) - CFLAGS="$CFLAGS -Wall -pedantic" - fi -],AC_MSG_RESULT(no)) - - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_VPRINTF - -AC_SUBST(SYSCONFDIR) - -AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h deleted file mode 100644 index 1ee0cdc..0000000 --- a/mysql-admutils.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ - * - */ - -#ifndef MYSQL_ADMUTILS_H -#define MYSQL_ADMUTILS_H - -extern char *program_name; - -/* defined in pwfile.c */ -extern const char *db_server; -extern const char *db_user; -extern const char *db_passwd; -extern const char *db_name; - -extern int -wrong_use(char *format, ...); - -extern int -fatal_error(char *format, ...); - -extern int -owner(char *name); - -extern int member(char *gr); - -extern char **get_group_names(int *numgroups); - -extern int -version(void); - -extern int -read_config_file(void); - -/* same as strcpy, but returns a pointer to the end of dest instead of start */ -extern char *strmov(char *, const char *); - -extern int name_isclean(char*); - -#ifdef _mysql_h - -extern int -dberror(MYSQL *pmysql, char *format, ...); - -extern int -reload(MYSQL *pmysql); - -#endif - -#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c deleted file mode 100644 index d80ed86..0000000 --- a/mysql-dbadm.c +++ /dev/null @@ -1,707 +0,0 @@ -/* - * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ - * - * mysql-dbadm.c - * - */ - -#include "config.h" -#include "mysql-admutils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char * -strchr_whitespace(const char *s) -{ - char *sp, *tab; - sp = strchr(s, ' '); - tab = strchr(s, '\t'); - if (sp == NULL) - return tab; - if (tab == NULL) - return sp; - return sp < tab ? sp : tab; /* if both are found, return the first one */ -} - -char * -strtok_whitespace(char *s) -{ - static char *cp; - char *r; - - r = s ? s : cp; - if (r == NULL) - return NULL; - cp = strchr_whitespace(r); - if (cp == NULL) - return r; - while ((*cp == ' ') || (*cp == '\t')) - *cp++ = '\0'; - return r; -} - - -int -valid_priv(const char *s) -{ - if (s == NULL) return 0; -#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 - ACCEPT("Y"); - ACCEPT("N"); - ACCEPT("y"); - ACCEPT("n"); -#undef ACCEPT - return 0; /* not a valid priv */ -} - - -int -usage() -{ - printf("Usage: %s COMMAND [DATABASE]...\n", program_name); - printf("Create, drop og edit permission for the DATABASE(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the DATABASE(s).\n"); - printf(" drop delete the DATABASE(s).\n"); - printf(" show give information about the DATABASE(s), or, if\n"); - printf(" none are given, all the ones you own.\n"); - printf(" editperm change permissions for the DATABASE(s). Your\n"); - printf(" favorite editor will be started, allowing you\n"); - printf(" to make changes to the permission table.\n"); - printf(" Run '%s --help-editperm' for more\n" - " information.\n",program_name); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - -int -usage_editperm() -{ - printf("Usage: %s editperm [DATABASE]\n", program_name); - printf("Edit permissions for the DATABASE. Running this command will\n"); - printf("spawn the editor stored in the $EDITOR environment variable.\n"); - printf("(pico will be used if the variable is unset)\n"); - printf("\n"); - printf("The file should contain one line per user, starting with the\n"); - printf("username and followed by ten Y/N-values seperated by whitespace.\n"); - printf("Lines starting with # are ignored.\n"); - printf("\n"); - printf("The Y/N-values corresponds to the following mysql privileges:\n"); - printf(" Select - Enables use of SELECT\n"); - printf(" Insert - Enables use of INSERT\n"); - printf(" Update - Enables use of UPDATE\n"); - printf(" Delete - Enables use of DELETE\n"); - printf(" Create - Enables use of CREATE TABLE\n"); - printf(" Drop - Enables use of DROP TABLE\n"); - printf(" Alter - Enables use of ALTER TABLE\n"); - printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); - printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); - printf(" Lock - Enables use of LOCK TABLE\n"); - printf(" References - Enables use of REFERENCES\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -create(MYSQL *pmysql, char *db) -{ - // hvis man forsøker å dra mysql_create_db() på en database som - // allerede finnes, så henger bare hele sql-kallet. Vi må derfor - // forsøke å selecte databasen først. Ettersom man alltid er root, - // går jo dette vanligvis bra. - // finner ut om denne finnes fra før. - if (!mysql_select_db(pmysql, db)) { - return dberror(pmysql, "Database '%s' already exists.", db); - } - mysql_select_db(pmysql, "mysql"); - // oppretter databasen. - char query[1024], *end; - end = strmov(query, "CREATE DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot create database '%s'.", db); - fprintf(stderr, "Database '%s' created.\n", db); - return 0; -} - - -int -drop(MYSQL *pmysql, char *db) -{ - char query[1024], *end; - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete permissions for database '%s'.", db); - - if (mysql_select_db(pmysql, db)) { - dberror(pmysql, "Database '%s' doesn't exists.", db); - return 0; - } - mysql_select_db(pmysql, "mysql"); - - end = strmov(query, "DROP DATABASE `"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '`'; - *end = '\0'; - -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Cannot drop database '%s'.", db); - - fprintf(stderr, "Database '%s' dropped.\n", db); - return 0; -} - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char *wild; - char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ - MYSQL_RES *res; - int rows, numgroups, numgroupdbs; - MYSQL_ROW row; - char **dblist; - int i, counter; - struct passwd *p; - - // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. - char escaped_user[64]; - char *cp_kopi; - - p = getpwuid(getuid()); - if (!p) { - dberror(NULL, "Failed to lookup your UNIX username."); - exit(1); - } - - dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ - - numgroupdbs = 0; - counter = 0; - - usr_groups = get_group_names(&numgroups); - cp = usr_groups; - while (cp && *cp) { // itererer over alle grupper en person er med i - if (*cp == NULL) - break; - -#ifdef DEBUG - printf("cp er %s\n", *cp); -#endif - - escaped_user[0] = '\0'; - cp_kopi=*cp; - -// itererer over bokstavene i gruppenavn, og escaper spesialtegn. - for(i=0; i<=strlen(cp_kopi); i++) { - // hvis % _ , så skriv \ og så tegn - if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { - strcat(escaped_user, "\\"); - } - - escaped_user[strlen(escaped_user) + 1] = '\0'; - escaped_user[strlen(escaped_user)] = cp_kopi[i]; - } // for - - wild = malloc(strlen(escaped_user)+4); - sprintf(wild, "%s\\_%%", escaped_user); - -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - - if (rows > 0) { - numgroupdbs += rows; - - dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - } - - - free(wild); - mysql_free_result(res); - cp++; - } - - wild = malloc(strlen(p->pw_name) + 4); - sprintf(wild, "%s\\_%%", p->pw_name); -#ifdef DEBUG - printf("dbadm: wildcard: '%s'\n", wild); -#endif - - res = mysql_list_dbs(pmysql, wild); - rows = mysql_num_rows(res); - dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); - - if (!dblist) { - dberror(NULL, "Out of memory.\n"); - free(wild); - return NULL; - } - - for (i = 0; i < rows; i++) { - if ((row = mysql_fetch_row(res))) { - dblist[counter++] = strdup(row[0]); - } - } - mysql_free_result(res); - - res = mysql_list_dbs(pmysql, p->pw_name); - rows = mysql_num_rows(res); - if (rows == 1) - dblist[counter++] = strdup(p->pw_name); - - dblist[counter] = NULL; - - mysql_free_result(res); - free(wild); - for (i=0;inet.fd) != 0) - { - perror("Failed to close fd"); - exit(1); - } - - editor = getenv("EDITOR"); - if (!editor) - editor = "pico"; /* OK since editor won't be freed */ - - cmd = malloc(sizeof(char) * strlen(editor) + 7); - sprintf(cmd, "%s \"$1\"", editor); - - /* sh -c '$EDITOR "$1"' sh "$fn" */ - execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); - perror("Failed to execute editor"); - fprintf(stderr, "Make sure the EDITOR environment variable contains" - " a valid editor\n"); - exit(1); - } - - if (exit_status != 0) - return 1; - - /* parse */ - f = fopen(fn, "r"); - lines = 0; - while (fgets(line, sizeof(line), f)) { - cp = strchr(line, '\n'); - if (cp) - *cp = '\0'; - - cp = line; - while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; - if (*cp == '\0') continue; - if (*cp == '#') continue; - if (*cp == '\n') continue; - - #define STRTOK_WHITESPACE(res, start) \ - { if (!(res = strtok_whitespace(start))) continue; } - - STRTOK_WHITESPACE(user, cp); - if (strlen(user) < 1) - return dberror(NULL, "Invalid user '%s' in grant line %d.", user, - lines + 1); - if (strcmp(user, "%") == 0) - *user = '\0'; /* ugly, but it works... */ - - #define CHECK_PRIV(PRIV) \ - if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ - "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ - "all ten privileges.\nRun '%s --help-editerm' for more " \ - "information.\nNo permissions have been set.", PRIV, lines + 1, \ - program_name) - - STRTOK_WHITESPACE(select_priv, NULL); - CHECK_PRIV(select_priv); - STRTOK_WHITESPACE(insert_priv, NULL); - CHECK_PRIV(insert_priv); - STRTOK_WHITESPACE(update_priv, NULL); - CHECK_PRIV(update_priv); - STRTOK_WHITESPACE(delete_priv, NULL); - CHECK_PRIV(delete_priv); - STRTOK_WHITESPACE(create_priv, NULL); - CHECK_PRIV(create_priv); - STRTOK_WHITESPACE(drop_priv, NULL); - CHECK_PRIV(drop_priv); - STRTOK_WHITESPACE(alter_priv, NULL); - CHECK_PRIV(alter_priv); - STRTOK_WHITESPACE(index_priv, NULL); - CHECK_PRIV(index_priv); - STRTOK_WHITESPACE(create_tmp_table_priv, NULL); - CHECK_PRIV(create_tmp_table_priv); - STRTOK_WHITESPACE(lock_tables_priv, NULL); - CHECK_PRIV(lock_tables_priv); - STRTOK_WHITESPACE(references_priv, NULL); - CHECK_PRIV(references_priv); - - #undef STRTOK_WHITESPACE - #undef CHECK_PRIV - - end = strmov(query, "INSERT INTO db (" - "host,db,user,select_priv,insert_priv," - "update_priv,delete_priv,create_priv," - "drop_priv,alter_priv,index_priv," - "create_tmp_table_priv,lock_tables_priv," - "references_priv" - ") VALUES ("); - - end = strmov(end, "'%'"); - - #define APPEND(VAR) {\ - *end++ = ',';\ - *end++ = '\'';\ - end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ - *end++ = '\'';\ - } - - APPEND(db); - APPEND(user); - APPEND(select_priv); - APPEND(insert_priv); - APPEND(update_priv); - APPEND(delete_priv); - APPEND(create_priv); - APPEND(drop_priv); - APPEND(alter_priv); - APPEND(index_priv); - APPEND(create_tmp_table_priv); - APPEND(lock_tables_priv); - APPEND(references_priv); - *end++ = ')'; - *end = '\0'; - - #undef APPEND - - queries[lines] = strdup(query); - lines++; - if (lines >= MAX_GRANTS) - { - dberror(NULL, "Warning: Maximum of %d grants reached.\n", - MAX_GRANTS); - continue; - } - } /* while fgets ... */ - - unlink(fn); - fclose(f); - - /* now that we have checked the input for errors, we can safely - delete the old grants from the database and insert the new ones. */ - - end = strmov(query, "DELETE FROM db WHERE db = '"); - end += mysql_real_escape_string(pmysql, end, db, strlen(db)); - *end++ = '\''; - *end = '\0'; -#ifdef DEBUG - printf("query: %s\n", query); -#endif - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to delete old grants for '%s'.", db); - - for (i = 0; i < lines; i++) - { -#ifdef DEBUG - puts(queries[i]); - putchar('\n'); -#endif - if (mysql_query(pmysql, queries[i])) - dberror(pmysql, "Failed to insert grant line %d.", i + 1); - free(queries[i]); - } - - fprintf(stderr,"Permissions updated\n"); - - return 0; -} - - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_drop, c_editperm, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char *db; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help-editperm") == 0) - return usage_editperm(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - - if (argc < 2) - return wrong_use(NULL); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "drop") == 0) - command = c_drop; - else if (strcmp(argv[1], "editperm") == 0) - command = c_editperm; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command"); /* XXX */ - - /* all other than show requires at least one DATABASE argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) { - dblist = list(&mysql); - p = dblist; - while (p && *p) { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - db = malloc(64); - /* for each supplied database name, perform the requested action */ - for (i = 2; i < argc; i++) { - // HE HE - strncpy(db, argv[i], 32); - db[32] = '\0'; - - if (! (owner(db) || member(db))) { - if (command == c_create) - dberror(NULL,"Unable to create mysql-database '%s'.\n" - "A mysql-database must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are a " - "member of.\n", - db, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); - continue; - } - - switch (command) { - case c_create: - // We only check newly created databases. Many old ("unclean") databases are still in use. - if(name_isclean(db)) { - create(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_drop: - if(name_isclean(db)) { - drop(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_editperm: - if(name_isclean(db)) { - editperm(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - case c_show: - if(name_isclean(db)) { - show(&mysql, db); - } else { - dberror(NULL, "Database name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); - } - break; - default: - return dberror(NULL, "This point should never be reached!"); - } - } // for - free(db); - } // else - - mysql_reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/mysql-useradm.c b/mysql-useradm.c deleted file mode 100644 index 04bcdca..0000000 --- a/mysql-useradm.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ - * - * mysql-useradm.c - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" - -int -usage() -{ - printf("Usage: %s COMMAND [USER]...\n", program_name); - printf("Create, delete or change password for the USER(s),\n"); - printf("as determined by the COMMAND. Valid COMMANDs:\n"); - printf("\n"); - printf(" create create the USER(s).\n"); - printf(" delete delete the USER(s).\n"); - printf(" passwd change the MySQL password for the USER(s).\n"); - printf(" show give information about the USERS(s), or, if\n"); - printf(" none are given, all the users you have.\n"); - printf("\n"); - printf("Report bugs to orakel@ntnu.no\n"); - return 0; -} - - -int -is_password_set(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - MYSQL_RES *res; - int rows; - MYSQL_ROW row; - int check = 0; - - end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - dberror(pmysql, "Failed to look up password for user '%s'.", user); - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - - if (rows > 1) - { - mysql_free_result(res); - return dberror(NULL, "Query for password for user '%s' gave %d results!", - user, rows); - } - else if (rows < 1) { - mysql_free_result(res); - return -1; - } - - row = mysql_fetch_row(res); - check = (row[0] && (strlen(row[0]) > 0)); - mysql_free_result(res); - - return check; -} - - -int -create(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "CREATE USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "'"); - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to create user '%s'.", user); - - return 0; -} - - -int -delete(MYSQL *pmysql, const char *user) -{ - char query[1024], *end; - - end = strmov(query, "DROP USER '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to delete user '%s'.", user); - - return 0; -} - - -int -passwd(MYSQL *pmysql, const char *user) -{ - char prompt[1024]; - char query[1024], *end; - char *password, *confirm_password; - - if (is_password_set(pmysql, user) == -1) /* no such mysql user */ - return dberror(NULL, "User '%s' does not exist." - " You must create it first.\n", user); - - sprintf(prompt, "New MySQL password for user '%s': ", user); - password = getpass(prompt); - confirm_password = strdup(password); - sprintf(prompt, "Retype new MySQL password for user '%s': ", user); - password = getpass(prompt); - if (strcmp(password, confirm_password) != 0) - { - free(confirm_password); - return dberror(NULL, "Sorry, passwords do not match."); - } - free(confirm_password); - - end = strmov(query, "ALTER user '"); - end += mysql_real_escape_string(pmysql, end, user, strlen(user)); - end = strmov(end, "' IDENTIFIED BY '"); - end += mysql_real_escape_string(pmysql, end, password, strlen(password)); - *end++ = '\''; - *end = '\0'; - - if (mysql_query(pmysql, query)) - return dberror(pmysql, "Failed to set new password for user '%s'.", user); - if (mysql_affected_rows(pmysql) != 1) - dberror(NULL, "%d rows affected by password update for user '%s'!", - mysql_affected_rows(pmysql), user); - - fprintf(stderr, "Password updated for user '%s'.\n", user); - return 0; -} - - -int -show(MYSQL *pmysql, const char *user) -{ - switch (is_password_set(pmysql, user)) - { - case -1: - break; - case 0: - printf("User '%s': ", user); - printf("no password set.\n"); - break; - case 1: - printf("User '%s': ", user); - printf("password set.\n"); - break; - } - return 0; -} - - -/* return a list of the user's databases */ -char ** -list(MYSQL *pmysql) -{ - char query[4096], *end; - char **usrgroups, **cp; - MYSQL_RES *res; - int rows, numgroups; - MYSQL_ROW row; - char **userlist; - int i; - struct passwd *p; - - p = getpwuid(getuid()); - - end = strmov(query, "SELECT user FROM user WHERE user='"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); - end = strmov(end, "\\_%'"); - - numgroups = 0; - - usrgroups = get_group_names(&numgroups); - cp = usrgroups; - while (cp && *cp) { - end = strmov(end, " OR user='"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "' OR user LIKE '"); - end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); - end = strmov(end, "\\_%'"); - free(*cp); - cp++; - } - free(usrgroups); - -#ifdef DEBUG - printf("about to run query: %s\n", query); -#endif - - if (mysql_query(pmysql, query)) - { - dberror(pmysql, "Failed to look up %s's users.", p->pw_name); - return NULL; - } - res = mysql_store_result(pmysql); - rows = mysql_num_rows(res); - userlist = malloc((rows + 1) * sizeof(char *)); - if (!userlist) - { - dberror(NULL, "%s: Out of memory.\n", program_name); - return NULL; - } - for (i = 0; i < rows; i++) - if ((row = mysql_fetch_row(res))) - { - userlist[i] = strdup(row[0]); - } - - userlist[i] = NULL; - - mysql_free_result(res); - - return userlist; -} - -int -main(int argc, char *argv[]) -{ - int i; - enum { c_create, c_delete, c_passwd, c_show } command; - MYSQL mysql; - mysql_init(&mysql); - char **dblist, **p; - char user[65]; - - program_name = argv[0]; - - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--help") == 0) - return usage(); - for (i = 1; i < argc; i++) - if (strcmp(argv[i], "--version") == 0) - return version(); - -#ifdef DEBUG - printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); - printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); - printf("og programmet bør virke som vanlig.\n"); -#endif - - if (argc < 2) - return wrong_use(NULL); - - /* check that the supplied command is valid */ - - if (strcmp(argv[1], "create") == 0) - command = c_create; - else if (strcmp(argv[1], "delete") == 0) - command = c_delete; - else if (strcmp(argv[1], "passwd") == 0) - command = c_passwd; - else if (strcmp(argv[1], "show") == 0) - command = c_show; - else - return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ - - /* all other than show requires at least one USER argument. */ - if ((command != c_show) && (argc < 3)) - return wrong_use(NULL); - - read_config_file(); - - /* connect to the database server and select the mysql database */ - if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) - return dberror(&mysql, "Cannot connect to database server '%s'.", - db_server); - if (mysql_select_db(&mysql, db_name)) - return dberror(&mysql, "Cannot select database '%s'.", db_name); - - if ((command == c_show) && (argc == 2)) - { - dblist = list(&mysql); - p = dblist; - while (p && *p) - { - show(&mysql, *p); - free(*p); - p++; - } - free(dblist); - } - else { - /* for each supplied database name, perform the requested action */ - - for (i = 2; i < argc; i++) { - strncpy(user, argv[i], 32); - user[33] = '\0'; - if (! (owner(user) || member(user))) - { - if (command == c_create) - dberror(NULL,"Unable to create mysql-user '%s'.\n" - - "A mysql-user must start with either '%s_' or " - "'groupname_', where groupname is a unix group you are a " - "member of. Type \"groups\" to see which groups you are " - "a member of.\n", - user, getpwuid(getuid())->pw_name); - else - dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); - continue; - } - - switch (command) - { - case c_create: - if(name_isclean(user)) { - create(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_delete: - if(name_isclean(user)) { - delete(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_passwd: - if(name_isclean(user)) { - passwd(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - case c_show: - if(name_isclean(user)) { - show(&mysql, user); - } else { - dberror(NULL, "User name '%s' contains invalid characters.\n" - "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); - } - break; - default: - fprintf(stderr, "This point should never be reached.\n"); - exit(1); - } - } - } - - reload(&mysql); - mysql_close(&mysql); - - return 0; -} diff --git a/pwfile.c b/pwfile.c deleted file mode 100644 index ce2e573..0000000 --- a/pwfile.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ - * - * functions for parsing the config file. - * - */ - -#include -#include -#include -#include -#include -#include -#include "mysql-admutils.h" -#include "pwyacc.h" - -/* the MySQL maximum */ -#define MAXPWCHARS 16 - -/* defaults for configurable values */ -const char* db_user = "root"; -const char* db_server = "localhost"; -const char* db_passwd = NULL; -const char* db_name = "mysql"; - -extern int yyparse(void); -extern FILE *yyin; - -int config_line = 1; - -static FILE *pwfile; -static char *filename = SYSCONFDIR "/mysql-admutils.conf"; - -int -read_config_file(void) -{ - struct rlimit rlim; - int rc; /* return code */ - - /* to stop the user from obtaining the password from a core dump. */ - if (getrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("getrlimit"); - exit(1); - } - rlim.rlim_max = 0; - if (setrlimit(RLIMIT_CORE, &rlim) == -1) { - perror("setrlimit"); - exit(1); - } - - pwfile = fopen(filename, "r"); - if (!pwfile) { - fatal_error("cannot open configuration file %s", filename); - exit(1); - } - - /* we don't need to be SUID anymore. */ - if (seteuid(getuid()) != 0) - perror("seteuid"); - - yyin = pwfile; - rc = yyparse(); - fclose(pwfile); - - return rc; -} - - -int -yywrap(void) -{ - return 1; -} - - -int -yyerror(const char *msg) -{ - fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); - return 0; -} - - -int -config_set_string_var(int var, const char *value) -{ - assert(value); - switch (var) { - case USER: - db_user = value; - break; - case HOST: - db_server = value; - break; - case PASSWORD: - if (strlen(value) > MAXPWCHARS) { - fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", - filename, config_line, strlen(value), MAXPWCHARS); - fclose(pwfile); - exit(1); - } - db_passwd = value; - break; - default: - assert(!"We should never get here."); - } - return 0; -} diff --git a/pwlex.l b/pwlex.l deleted file mode 100644 index 457ef74..0000000 --- a/pwlex.l +++ /dev/null @@ -1,47 +0,0 @@ -/* - * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * lex source for the configuration file - * - */ - -%{ -#include -#include -#include "pwyacc.h" - -extern int config_line; -extern int yylval; -%} - -%% - -#.*\n config_line++; - -set { yylval = SET; return(SET); } -host { yylval = HOST; return(HOST); }; -user { yylval = USER; return(USER); }; -password { yylval = PASSWORD; return(PASSWORD); } - -\"[^"]*\" { - if (yytext[yyleng - 1] == '\\') - yymore(); - else - yytext[yyleng - 1] = '\0'; - yylval = (int)strdup(yytext + 1); - return(STRING); - }; - -; return(';'); - -[^ \t\n\;]* { - yylval = (int)strdup(yytext); - return(STRING); - } - -[ \t] ; - -\n config_line++; - -%% - diff --git a/pwyacc.y b/pwyacc.y deleted file mode 100644 index 1a39886..0000000 --- a/pwyacc.y +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ - * - * yacc source for parsing the configuration file - * - */ - -%{ -int yyerror(const char *msg); -int yylex(void); -int config_set_string_var(int var, const char *value); -%} - -%token SET HOST USER PASSWORD STRING - -%% - -input: ; -input: statement input ; - -statement: SET variable STRING ';' - { - $$ = config_set_string_var($2, (const char *)$3); - } - -; - -variable: USER | PASSWORD | HOST - { $$ = $1; } - ; - -%% - diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp From 1914e8d3269e76d901d5fae4e23b9f91f3cf2889 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:38:33 +0200 Subject: [PATCH 11/22] Rydder --- .gitignore | 59 ++++ AUTHORS | 0 COPYING | 340 +++++++++++++++++++++++ ChangeLog | 25 ++ INSTALL | 183 ++++++++++++ Makefile.am | 9 + NEWS | 0 README | 0 acconfig.h | 29 ++ common.c | 276 ++++++++++++++++++ configline | 44 +++ configure.ac | 98 +++++++ mysql-admutils.h | 51 ++++ mysql-dbadm.c | 707 +++++++++++++++++++++++++++++++++++++++++++++++ mysql-useradm.c | 367 ++++++++++++++++++++++++ pwfile.c | 108 ++++++++ pwlex.l | 47 ++++ pwyacc.y | 33 +++ stamp-h.in | 1 + 19 files changed, 2377 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 acconfig.h create mode 100644 common.c create mode 100644 configline create mode 100644 configure.ac create mode 100644 mysql-admutils.h create mode 100644 mysql-dbadm.c create mode 100644 mysql-useradm.c create mode 100644 pwfile.c create mode 100644 pwlex.l create mode 100644 pwyacc.y create mode 100644 stamp-h.in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8eb03ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +*# +*.o +*~ +/.deps +/Makefile +/config.h +fjernet +/mysql-dbadm +/mysql-useradm +/pwlex.c +/pwyacc.c +/pwyacc.h +/stamp-h + +### Autotools ### +# http://www.gnu.org/software/automake + +Makefile.in +/ar-lib +/mdate-sh +/py-compile +/test-driver +/ylwrap +/mkinstalldirs + +# http://www.gnu.org/software/autoconf + +autom4te.cache +/autoscan.log +/autoscan-*.log +/aclocal.m4 +/compile +/config.guess +/config.h.in +/config.log +/config.status +/config.sub +/configure +/configure.scan +/depcomp +/install-sh +/missing +/stamp-h1 + +# https://www.gnu.org/software/libtool/ + +/ltmain.sh + +# http://www.gnu.org/software/texinfo + +/texinfo.tex + +# http://www.gnu.org/software/m4/ + +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f030463 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,25 @@ +v0.50 (2006-11-20) geirha@itea.ntnu.no + * added create_tmp_table_priv + * added lock_tables_priv + * some memory leaks fixed + +v0.46 (2005-06-27) knuta@itea.ntnu.no + * Replaced deprecated functions not supported in SLES9 + +v0.42-0.45 (2002-03-07 - 2004-12-08) unknown + * Various undocumented fixes, at least something about length + of group names, I think + +v0.41 (2002-03-07) tlan@stud.ntnu.no + * Fixed a seg.fault bug in is_password_set()-routine. + +v0.4 (2002-03-07) tlan@stud.ntnu.no + * added ability to make users/dbs beginning with group-names. + * added index-priv + * added alter-priv + + +Mon Jul 6 11:58:10 1998 Vebjorn Ljosa + * Initial version. + + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..50dbe43 --- /dev/null +++ b/INSTALL @@ -0,0 +1,183 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e3a0bd7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,9 @@ +bin_PROGRAMS = mysql-dbadm mysql-useradm +mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c +mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) +mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) +BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c +YFLAGS = -d +INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" +LDADD = @MYSQL_LIBS@ @LEXLIB@ +LDFLAGS = @MYSQL_LFLAGS@ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..76e5baf --- /dev/null +++ b/acconfig.h @@ -0,0 +1,29 @@ +/* + * acconfig.h + * + * @(#) $Header: /tmp/cvs/mysql-admutils/acconfig.h,v 1.2 2002-02-27 08:49:48 knutpett Exp $ + * + */ + + +/* Define the name of the package */ +#undef PACKAGE + +/* Define the version of the package */ +#undef VERSION + +/* Define if MySQL is installed */ +#undef HAVE_MYSQL + +/* Define if you have the header file. */ +#undef HAVE_MATH_H + +/* Define if libmath is available */ +#undef HAVE_LIBM + +/* Define if libnsl is available */ +#undef HAVE_LIBNSL + +/* Define if libsocket is available */ +#undef HAVE_LIBSOCKET + diff --git a/common.c b/common.c new file mode 100644 index 0000000..84d9603 --- /dev/null +++ b/common.c @@ -0,0 +1,276 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $ + * + * functions used by mysql-dbadm.c and mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +char *program_name; + +static char *rcsheader = "@(#) " PACKAGE " " VERSION " orakel@ntnu.no $Header: /tmp/cvs/mysql-admutils/common.c,v 1.9 2007-02-27 14:10:07 geirha Exp $"; + + +int +version() +{ + printf("%s %s\n", program_name, rcsheader); + exit(0); +} + + +int +wrong_use(char *format, ...) +{ + va_list ap; + + if (format) { + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + putchar('\n'); + } + + fprintf(stderr, "Try `%s --help' for more information.\n", program_name); + + return 1; +} + + +/* always returns 1. */ +int +dberror(MYSQL *pmysql, char *format, ...) +{ + const char *errmsg; + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + if (pmysql) { + errmsg = mysql_error(pmysql); + if ((errmsg) && (strcmp(errmsg, "") != 0)) + fprintf(stderr, "mysql: %s\n", errmsg); + + mysql_close(pmysql); + } + + return 1; +} + + +/* always returns 1. */ +int +fatal_error(char *format, ...) +{ + va_list ap; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return 1; +} + + +/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ +int +owner(char *name) +{ + struct passwd *p; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to look up your UNIX username."); + exit(1); + } + + if (strcmp(name, p->pw_name) == 0) + return 1; /* OK */ + + if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && + (*(name + strlen(p->pw_name)) == '_')) + return 1; /* OK */ + + return 0; /* not owner if we get as far as this */ +} + +/** + * Decides if the user is member of a group. The Unix group can't contain any + * '_'. i.e 'fidi_s' won't be accepted. + */ +int +member(char *gr) { + char *username; + + char group[65]; + struct group *g; + + struct passwd *p; + char *foo; + + /* size_t i = 0; */ + + /* Get username */ + p = getpwuid(getuid()); + if (!p) { + fprintf(stderr, "Failed to look up your UNIX username."); + return 0; + } + username = p->pw_name; + + /* Copy string, but cut at '_' */ + strncpy(group, gr, 64); + group[64] = '\0'; + + // ettersom man kan få inn gruppenavn med underscore i, må man rett og + // slett prøve seg fram for å sjekke om det er en gruppe personen er med + // i. + // eksempel: www_esb_test_users, hvor personen ikke er med i www_est_test + // (som kanskje finnes), men er med i www_esb. + // group er databasenavnet som brukeren ville ha. Vi må finne gruppenavnet + // ut av den, og stripper av en og en underscore til vi finner noe som + // passer. + while ( 1 ) { + +#if DEBUG +// printf("gr = %s, group = %s, foo = %s\n", gr, group, foo); +#endif + g = getgrnam(group); +#if DEBUG + printf("tror gruppenavnet er: %s\n", group); +#endif + + // hvis gruppen ikke finnes, må vi i allefall prøve å se om + // det er noe lengre inn. + if (g) { + /* Check if user is member of group */ + while(*g->gr_mem != NULL) { + char * member = *g->gr_mem++; +#if DEBUG + printf("Medlem: %s\n", member); +#endif + + if (strcmp(member,username) == 0) { +#if DEBUG + printf("You have access to '%s'\n", gr); +#endif + return 1; /* OK */ + } + } +#if DEBUG + printf("You have no access to '%s'\n", gr); +#endif + } // if + // brukeren var ikke med i gruppen, så vi må prøve neste. + + // finner den siste _-en i navnet. + foo = strrchr(group, '_'); + if (foo == NULL) { + // hvis vi har kommet helt til bunn, og fremdeles + // ikke har blitt avbrutt, fantes det ingen slik gruppe. + return 0; + } + // det som nå er bak siste underscore er passe uinteressant, så + // vi flytter slutten av strengen litt framover. + *foo = '\0'; + + } // while +} + +/* return a list of the user's groupnames */ +/* numgroups is the total number of groups found */ +char **get_group_names(int *numgroups) +{ + char **grouplist; + gid_t *gids = NULL; + int real_nr_groups, nr_groups, i; + struct group *g; + + nr_groups = 0; + + /* Find number and allocate */ + nr_groups = getgroups(0, NULL); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to find group count"); + return NULL; + } + gids = malloc(nr_groups*sizeof(gid_t)); + + /* Fetch group IDs */ + nr_groups = getgroups(nr_groups, gids); + if (nr_groups == -1) { + dberror(NULL, "Error while trying to fetch group info"); + return NULL; + } + + grouplist = malloc((nr_groups + 1)*sizeof(char *)); + real_nr_groups = 0; + + for (i = 0; i < nr_groups; i++) { + g = getgrgid(gids[i]); + + /* Go to next grp if it doesn't have a name */ + if (g != NULL) { + grouplist[real_nr_groups++] = strdup(g->gr_name); + } else { + fprintf(stderr, "Omitting gid %d, no entry in group-file.\n", gids[i]); + } + } + grouplist[real_nr_groups] = NULL; + + free(gids); + + *numgroups = real_nr_groups; + + return grouplist; +} + + +int +reload(MYSQL *pmysql) +{ + return mysql_reload(pmysql); +} + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +char *strmov(char *dest, const char *src) { + while ((*dest++ = *src++)) + ; + return dest-1; +} + +/* New database and user names may only use these characters in their + identifier */ +const char name_validchars[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; + +/* Returns true if dbname contains only characters in name_validchars. */ +int name_isclean(char* name) { + int reallen, cleanlen; + reallen = strlen(name); + cleanlen = strspn(name, name_validchars); + return (reallen == cleanlen); +} + diff --git a/configline b/configline new file mode 100644 index 0000000..49f7a3f --- /dev/null +++ b/configline @@ -0,0 +1,44 @@ + +vanlig, på linux. +./configure --with-mysql=/usr/ --sysconfdir=/etc/ + +vi burde kanskje komplisere med libmysqlclient statisk, +sånn at vi slipper avhengigheter mot en spesiell rpmpakke. + + +elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile +--- ../Makefile.org Tue Apr 8 20:20:00 2003 ++++ Makefile Tue Apr 8 20:22:27 2003 +@@ -62,8 +62,8 @@ + LEX = flex + MAKEINFO = makeinfo + MYSQL_INCLUDE = -I/store/include/mysql +-MYSQL_LFLAGS = -L/store/lib/mysql +-MYSQL_LIBS = -lmysqlclient ++MYSQL_LFLAGS = ++MYSQL_LIBS = + PACKAGE = mysql-admutils + SYSCONFDIR = + VERSION = 0.43 +@@ -76,8 +76,8 @@ + BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c + YFLAGS = -d + INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" +-LDADD = -lmysqlclient -lfl +-LDFLAGS = -L/store/lib/mysql ++LDADD = /store/lib/mysql/libmysqlclient.a -lfl ++LDFLAGS = + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = config.h + + + + + + + + +$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ +$Source: /tmp/cvs/mysql-admutils/configline,v $ + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..9b7bc2b --- /dev/null +++ b/configure.ac @@ -0,0 +1,98 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(mysql-dbadm.c) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(mysql-admutils, 0.46) +AM_SANITY_CHECK + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AM_PROG_LEX +AC_PROG_YACC + +dnl Checks for libraries. +AC_CHECK_LIB(c, floor, [:], [ + AC_CHECK_LIB(m, floor, [ + LIBS="$LIBS -lm" + AC_DEFINE(HAVE_LIBM) ], []) ]) +AC_CHECK_LIB(mysqlclient, mysql_connect, [ + LIBS="$LIBS -lmysqlclient" ], []) +AC_CHECK_LIB(c, gethostbyaddr, [:], [ + AC_CHECK_LIB(nsl, gethostbyaddr, [ + LIBS="$LIBS -lnsl" + AC_DEFINE(HAVE_LIBNSL) ], []) ]) +AC_CHECK_LIB(c, socket, [:], [ + AC_CHECK_LIB(socket, socket, [ + LIBS="$LIBS -lsocket" + AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) + +AC_MSG_CHECKING(for MySQL support) +AC_ARG_WITH(mysql, +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) + fi + fi + MYSQL_INCLUDE=-I$MYSQL_INCDIR + MYSQL_LFLAGS="-L$MYSQL_LIBDIR -Wl,-R,$MYSQL_LIBDIR" + #MYSQL_LFLAGS="-L$MYSQL_LIBDIR" + MYSQL_LIBS=-lmysqlclient + + AC_DEFINE(HAVE_MYSQL) + AC_MSG_RESULT(yes) + + dnl check for errmsg.h, which isn't installed by some versions of 3.21 + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" + AC_CHECK_HEADERS(errmsg.h) + CPPFLAGS="$old_CPPFLAGS" + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) + AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit +]) +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_LFLAGS) +AC_SUBST(MYSQL_INCLUDE) + + +AC_MSG_CHECKING([whether to enable -Wall -pedantic]) +AC_ARG_ENABLE(warnings, +[ --enable-warnings Enable -Wall -pedantic if using gcc.], +[ if test -n "$GCC"; then + AC_MSG_RESULT(adding -Wall -pedantic to CFLAGS.) + CFLAGS="$CFLAGS -Wall -pedantic" + fi +],AC_MSG_RESULT(no)) + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +dnl Checks for library functions. +AC_FUNC_VPRINTF + +AC_SUBST(SYSCONFDIR) + +AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/mysql-admutils.h b/mysql-admutils.h new file mode 100644 index 0000000..1ee0cdc --- /dev/null +++ b/mysql-admutils.h @@ -0,0 +1,51 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-admutils.h,v 1.3 2002-03-06 17:05:05 tlan Exp $ + * + */ + +#ifndef MYSQL_ADMUTILS_H +#define MYSQL_ADMUTILS_H + +extern char *program_name; + +/* defined in pwfile.c */ +extern const char *db_server; +extern const char *db_user; +extern const char *db_passwd; +extern const char *db_name; + +extern int +wrong_use(char *format, ...); + +extern int +fatal_error(char *format, ...); + +extern int +owner(char *name); + +extern int member(char *gr); + +extern char **get_group_names(int *numgroups); + +extern int +version(void); + +extern int +read_config_file(void); + +/* same as strcpy, but returns a pointer to the end of dest instead of start */ +extern char *strmov(char *, const char *); + +extern int name_isclean(char*); + +#ifdef _mysql_h + +extern int +dberror(MYSQL *pmysql, char *format, ...); + +extern int +reload(MYSQL *pmysql); + +#endif + +#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c new file mode 100644 index 0000000..d80ed86 --- /dev/null +++ b/mysql-dbadm.c @@ -0,0 +1,707 @@ +/* + * @(#) $Header: /home/stud/admin/cvs/mysql-admutils/mysql-dbadm.c,v 1.20 2007/06/04 08:40:54 geirha Exp $ + * + * mysql-dbadm.c + * + */ + +#include "config.h" +#include "mysql-admutils.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char * +strchr_whitespace(const char *s) +{ + char *sp, *tab; + sp = strchr(s, ' '); + tab = strchr(s, '\t'); + if (sp == NULL) + return tab; + if (tab == NULL) + return sp; + return sp < tab ? sp : tab; /* if both are found, return the first one */ +} + +char * +strtok_whitespace(char *s) +{ + static char *cp; + char *r; + + r = s ? s : cp; + if (r == NULL) + return NULL; + cp = strchr_whitespace(r); + if (cp == NULL) + return r; + while ((*cp == ' ') || (*cp == '\t')) + *cp++ = '\0'; + return r; +} + + +int +valid_priv(const char *s) +{ + if (s == NULL) return 0; +#define ACCEPT(x) if (strcmp(s, x) == 0) return 1 + ACCEPT("Y"); + ACCEPT("N"); + ACCEPT("y"); + ACCEPT("n"); +#undef ACCEPT + return 0; /* not a valid priv */ +} + + +int +usage() +{ + printf("Usage: %s COMMAND [DATABASE]...\n", program_name); + printf("Create, drop og edit permission for the DATABASE(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the DATABASE(s).\n"); + printf(" drop delete the DATABASE(s).\n"); + printf(" show give information about the DATABASE(s), or, if\n"); + printf(" none are given, all the ones you own.\n"); + printf(" editperm change permissions for the DATABASE(s). Your\n"); + printf(" favorite editor will be started, allowing you\n"); + printf(" to make changes to the permission table.\n"); + printf(" Run '%s --help-editperm' for more\n" + " information.\n",program_name); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + +int +usage_editperm() +{ + printf("Usage: %s editperm [DATABASE]\n", program_name); + printf("Edit permissions for the DATABASE. Running this command will\n"); + printf("spawn the editor stored in the $EDITOR environment variable.\n"); + printf("(pico will be used if the variable is unset)\n"); + printf("\n"); + printf("The file should contain one line per user, starting with the\n"); + printf("username and followed by ten Y/N-values seperated by whitespace.\n"); + printf("Lines starting with # are ignored.\n"); + printf("\n"); + printf("The Y/N-values corresponds to the following mysql privileges:\n"); + printf(" Select - Enables use of SELECT\n"); + printf(" Insert - Enables use of INSERT\n"); + printf(" Update - Enables use of UPDATE\n"); + printf(" Delete - Enables use of DELETE\n"); + printf(" Create - Enables use of CREATE TABLE\n"); + printf(" Drop - Enables use of DROP TABLE\n"); + printf(" Alter - Enables use of ALTER TABLE\n"); + printf(" Index - Enables use of CREATE INDEX and DROP INDEX\n"); + printf(" Temp - Enables use of CREATE TEMPORARY TABLE\n"); + printf(" Lock - Enables use of LOCK TABLE\n"); + printf(" References - Enables use of REFERENCES\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +create(MYSQL *pmysql, char *db) +{ + // hvis man forsøker å dra mysql_create_db() på en database som + // allerede finnes, så henger bare hele sql-kallet. Vi må derfor + // forsøke å selecte databasen først. Ettersom man alltid er root, + // går jo dette vanligvis bra. + // finner ut om denne finnes fra før. + if (!mysql_select_db(pmysql, db)) { + return dberror(pmysql, "Database '%s' already exists.", db); + } + mysql_select_db(pmysql, "mysql"); + // oppretter databasen. + char query[1024], *end; + end = strmov(query, "CREATE DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot create database '%s'.", db); + fprintf(stderr, "Database '%s' created.\n", db); + return 0; +} + + +int +drop(MYSQL *pmysql, char *db) +{ + char query[1024], *end; + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete permissions for database '%s'.", db); + + if (mysql_select_db(pmysql, db)) { + dberror(pmysql, "Database '%s' doesn't exists.", db); + return 0; + } + mysql_select_db(pmysql, "mysql"); + + end = strmov(query, "DROP DATABASE `"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '`'; + *end = '\0'; + +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot drop database '%s'.", db); + + fprintf(stderr, "Database '%s' dropped.\n", db); + return 0; +} + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char *wild; + char **usr_groups, **cp; /* holds all group names this dude is a member of [tlan]*/ + MYSQL_RES *res; + int rows, numgroups, numgroupdbs; + MYSQL_ROW row; + char **dblist; + int i, counter; + struct passwd *p; + + // variabler som brukes til å escape gruppenavnet til mysqlvennlig format. + char escaped_user[64]; + char *cp_kopi; + + p = getpwuid(getuid()); + if (!p) { + dberror(NULL, "Failed to lookup your UNIX username."); + exit(1); + } + + dblist = malloc(2 * sizeof(char*)); /* one for username (if used), rest is done below */ + + numgroupdbs = 0; + counter = 0; + + usr_groups = get_group_names(&numgroups); + cp = usr_groups; + while (cp && *cp) { // itererer over alle grupper en person er med i + if (*cp == NULL) + break; + +#ifdef DEBUG + printf("cp er %s\n", *cp); +#endif + + escaped_user[0] = '\0'; + cp_kopi=*cp; + +// itererer over bokstavene i gruppenavn, og escaper spesialtegn. + for(i=0; i<=strlen(cp_kopi); i++) { + // hvis % _ , så skriv \ og så tegn + if ((cp_kopi[i] == '_') || (cp_kopi[i] == '%')) { + strcat(escaped_user, "\\"); + } + + escaped_user[strlen(escaped_user) + 1] = '\0'; + escaped_user[strlen(escaped_user)] = cp_kopi[i]; + } // for + + wild = malloc(strlen(escaped_user)+4); + sprintf(wild, "%s\\_%%", escaped_user); + +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + + if (rows > 0) { + numgroupdbs += rows; + + dblist = realloc(dblist, (numgroupdbs+2) * sizeof(char *)); + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + } + + + free(wild); + mysql_free_result(res); + cp++; + } + + wild = malloc(strlen(p->pw_name) + 4); + sprintf(wild, "%s\\_%%", p->pw_name); +#ifdef DEBUG + printf("dbadm: wildcard: '%s'\n", wild); +#endif + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + dblist = realloc(dblist, (numgroupdbs+rows+2) * sizeof(char *)); + + if (!dblist) { + dberror(NULL, "Out of memory.\n"); + free(wild); + return NULL; + } + + for (i = 0; i < rows; i++) { + if ((row = mysql_fetch_row(res))) { + dblist[counter++] = strdup(row[0]); + } + } + mysql_free_result(res); + + res = mysql_list_dbs(pmysql, p->pw_name); + rows = mysql_num_rows(res); + if (rows == 1) + dblist[counter++] = strdup(p->pw_name); + + dblist[counter] = NULL; + + mysql_free_result(res); + free(wild); + for (i=0;inet.fd) != 0) + { + perror("Failed to close fd"); + exit(1); + } + + editor = getenv("EDITOR"); + if (!editor) + editor = "pico"; /* OK since editor won't be freed */ + + cmd = malloc(sizeof(char) * strlen(editor) + 7); + sprintf(cmd, "%s \"$1\"", editor); + + /* sh -c '$EDITOR "$1"' sh "$fn" */ + execlp("sh", "sh", "-c", cmd, "sh", fn, NULL); + perror("Failed to execute editor"); + fprintf(stderr, "Make sure the EDITOR environment variable contains" + " a valid editor\n"); + exit(1); + } + + if (exit_status != 0) + return 1; + + /* parse */ + f = fopen(fn, "r"); + lines = 0; + while (fgets(line, sizeof(line), f)) { + cp = strchr(line, '\n'); + if (cp) + *cp = '\0'; + + cp = line; + while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; + if (*cp == '\0') continue; + if (*cp == '#') continue; + if (*cp == '\n') continue; + + #define STRTOK_WHITESPACE(res, start) \ + { if (!(res = strtok_whitespace(start))) continue; } + + STRTOK_WHITESPACE(user, cp); + if (strlen(user) < 1) + return dberror(NULL, "Invalid user '%s' in grant line %d.", user, + lines + 1); + if (strcmp(user, "%") == 0) + *user = '\0'; /* ugly, but it works... */ + + #define CHECK_PRIV(PRIV) \ + if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ + "in grant line %d.\nMake sure you fill in a value (Y or N) for " \ + "all ten privileges.\nRun '%s --help-editerm' for more " \ + "information.\nNo permissions have been set.", PRIV, lines + 1, \ + program_name) + + STRTOK_WHITESPACE(select_priv, NULL); + CHECK_PRIV(select_priv); + STRTOK_WHITESPACE(insert_priv, NULL); + CHECK_PRIV(insert_priv); + STRTOK_WHITESPACE(update_priv, NULL); + CHECK_PRIV(update_priv); + STRTOK_WHITESPACE(delete_priv, NULL); + CHECK_PRIV(delete_priv); + STRTOK_WHITESPACE(create_priv, NULL); + CHECK_PRIV(create_priv); + STRTOK_WHITESPACE(drop_priv, NULL); + CHECK_PRIV(drop_priv); + STRTOK_WHITESPACE(alter_priv, NULL); + CHECK_PRIV(alter_priv); + STRTOK_WHITESPACE(index_priv, NULL); + CHECK_PRIV(index_priv); + STRTOK_WHITESPACE(create_tmp_table_priv, NULL); + CHECK_PRIV(create_tmp_table_priv); + STRTOK_WHITESPACE(lock_tables_priv, NULL); + CHECK_PRIV(lock_tables_priv); + STRTOK_WHITESPACE(references_priv, NULL); + CHECK_PRIV(references_priv); + + #undef STRTOK_WHITESPACE + #undef CHECK_PRIV + + end = strmov(query, "INSERT INTO db (" + "host,db,user,select_priv,insert_priv," + "update_priv,delete_priv,create_priv," + "drop_priv,alter_priv,index_priv," + "create_tmp_table_priv,lock_tables_priv," + "references_priv" + ") VALUES ("); + + end = strmov(end, "'%'"); + + #define APPEND(VAR) {\ + *end++ = ',';\ + *end++ = '\'';\ + end += mysql_real_escape_string(pmysql, end, VAR, strlen(VAR));\ + *end++ = '\'';\ + } + + APPEND(db); + APPEND(user); + APPEND(select_priv); + APPEND(insert_priv); + APPEND(update_priv); + APPEND(delete_priv); + APPEND(create_priv); + APPEND(drop_priv); + APPEND(alter_priv); + APPEND(index_priv); + APPEND(create_tmp_table_priv); + APPEND(lock_tables_priv); + APPEND(references_priv); + *end++ = ')'; + *end = '\0'; + + #undef APPEND + + queries[lines] = strdup(query); + lines++; + if (lines >= MAX_GRANTS) + { + dberror(NULL, "Warning: Maximum of %d grants reached.\n", + MAX_GRANTS); + continue; + } + } /* while fgets ... */ + + unlink(fn); + fclose(f); + + /* now that we have checked the input for errors, we can safely + delete the old grants from the database and insert the new ones. */ + + end = strmov(query, "DELETE FROM db WHERE db = '"); + end += mysql_real_escape_string(pmysql, end, db, strlen(db)); + *end++ = '\''; + *end = '\0'; +#ifdef DEBUG + printf("query: %s\n", query); +#endif + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete old grants for '%s'.", db); + + for (i = 0; i < lines; i++) + { +#ifdef DEBUG + puts(queries[i]); + putchar('\n'); +#endif + if (mysql_query(pmysql, queries[i])) + dberror(pmysql, "Failed to insert grant line %d.", i + 1); + free(queries[i]); + } + + fprintf(stderr,"Permissions updated\n"); + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_drop, c_editperm, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char *db; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help-editperm") == 0) + return usage_editperm(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + + if (argc < 2) + return wrong_use(NULL); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "drop") == 0) + command = c_drop; + else if (strcmp(argv[1], "editperm") == 0) + command = c_editperm; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command"); /* XXX */ + + /* all other than show requires at least one DATABASE argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) { + dblist = list(&mysql); + p = dblist; + while (p && *p) { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + db = malloc(64); + /* for each supplied database name, perform the requested action */ + for (i = 2; i < argc; i++) { + // HE HE + strncpy(db, argv[i], 32); + db[32] = '\0'; + + if (! (owner(db) || member(db))) { + if (command == c_create) + dberror(NULL,"Unable to create mysql-database '%s'.\n" + "A mysql-database must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are a " + "member of.\n", + db, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-database: '%s'. Skipping.", db); + continue; + } + + switch (command) { + case c_create: + // We only check newly created databases. Many old ("unclean") databases are still in use. + if(name_isclean(db)) { + create(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_drop: + if(name_isclean(db)) { + drop(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_editperm: + if(name_isclean(db)) { + editperm(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + case c_show: + if(name_isclean(db)) { + show(&mysql, db); + } else { + dberror(NULL, "Database name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", db); + } + break; + default: + return dberror(NULL, "This point should never be reached!"); + } + } // for + free(db); + } // else + + mysql_reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/mysql-useradm.c b/mysql-useradm.c new file mode 100644 index 0000000..04bcdca --- /dev/null +++ b/mysql-useradm.c @@ -0,0 +1,367 @@ +/* + * @(#) $Header: /tmp/cvs/mysql-admutils/mysql-useradm.c,v 1.12 2011-09-22 12:17:18 geirha Exp $ + * + * mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +int +usage() +{ + printf("Usage: %s COMMAND [USER]...\n", program_name); + printf("Create, delete or change password for the USER(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the USER(s).\n"); + printf(" delete delete the USER(s).\n"); + printf(" passwd change the MySQL password for the USER(s).\n"); + printf(" show give information about the USERS(s), or, if\n"); + printf(" none are given, all the users you have.\n"); + printf("\n"); + printf("Report bugs to orakel@ntnu.no\n"); + return 0; +} + + +int +is_password_set(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + int check = 0; + + end = strmov(query, "SELECT authentication_string FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to look up password for user '%s'.", user); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + + if (rows > 1) + { + mysql_free_result(res); + return dberror(NULL, "Query for password for user '%s' gave %d results!", + user, rows); + } + else if (rows < 1) { + mysql_free_result(res); + return -1; + } + + row = mysql_fetch_row(res); + check = (row[0] && (strlen(row[0]) > 0)); + mysql_free_result(res); + + return check; +} + + +int +create(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "CREATE USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "'"); + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to create user '%s'.", user); + + return 0; +} + + +int +delete(MYSQL *pmysql, const char *user) +{ + char query[1024], *end; + + end = strmov(query, "DROP USER '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to delete user '%s'.", user); + + return 0; +} + + +int +passwd(MYSQL *pmysql, const char *user) +{ + char prompt[1024]; + char query[1024], *end; + char *password, *confirm_password; + + if (is_password_set(pmysql, user) == -1) /* no such mysql user */ + return dberror(NULL, "User '%s' does not exist." + " You must create it first.\n", user); + + sprintf(prompt, "New MySQL password for user '%s': ", user); + password = getpass(prompt); + confirm_password = strdup(password); + sprintf(prompt, "Retype new MySQL password for user '%s': ", user); + password = getpass(prompt); + if (strcmp(password, confirm_password) != 0) + { + free(confirm_password); + return dberror(NULL, "Sorry, passwords do not match."); + } + free(confirm_password); + + end = strmov(query, "ALTER user '"); + end += mysql_real_escape_string(pmysql, end, user, strlen(user)); + end = strmov(end, "' IDENTIFIED BY '"); + end += mysql_real_escape_string(pmysql, end, password, strlen(password)); + *end++ = '\''; + *end = '\0'; + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to set new password for user '%s'.", user); + if (mysql_affected_rows(pmysql) != 1) + dberror(NULL, "%d rows affected by password update for user '%s'!", + mysql_affected_rows(pmysql), user); + + fprintf(stderr, "Password updated for user '%s'.\n", user); + return 0; +} + + +int +show(MYSQL *pmysql, const char *user) +{ + switch (is_password_set(pmysql, user)) + { + case -1: + break; + case 0: + printf("User '%s': ", user); + printf("no password set.\n"); + break; + case 1: + printf("User '%s': ", user); + printf("password set.\n"); + break; + } + return 0; +} + + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char query[4096], *end; + char **usrgroups, **cp; + MYSQL_RES *res; + int rows, numgroups; + MYSQL_ROW row; + char **userlist; + int i; + struct passwd *p; + + p = getpwuid(getuid()); + + end = strmov(query, "SELECT user FROM user WHERE user='"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, p->pw_name, strlen(p->pw_name)); + end = strmov(end, "\\_%'"); + + numgroups = 0; + + usrgroups = get_group_names(&numgroups); + cp = usrgroups; + while (cp && *cp) { + end = strmov(end, " OR user='"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "' OR user LIKE '"); + end += mysql_real_escape_string(pmysql, end, *cp, strlen(*cp)); + end = strmov(end, "\\_%'"); + free(*cp); + cp++; + } + free(usrgroups); + +#ifdef DEBUG + printf("about to run query: %s\n", query); +#endif + + if (mysql_query(pmysql, query)) + { + dberror(pmysql, "Failed to look up %s's users.", p->pw_name); + return NULL; + } + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + userlist = malloc((rows + 1) * sizeof(char *)); + if (!userlist) + { + dberror(NULL, "%s: Out of memory.\n", program_name); + return NULL; + } + for (i = 0; i < rows; i++) + if ((row = mysql_fetch_row(res))) + { + userlist[i] = strdup(row[0]); + } + + userlist[i] = NULL; + + mysql_free_result(res); + + return userlist; +} + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_delete, c_passwd, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + char user[65]; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + +#ifdef DEBUG + printf("NB NB NB: denne versjonen av programmet er kompilert med -DDEBUG, og\n"); + printf("kan komme til å skrive ut ekstra informasjon. Dette er ikke farlig,\n"); + printf("og programmet bør virke som vanlig.\n"); +#endif + + if (argc < 2) + return wrong_use(NULL); + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "delete") == 0) + command = c_delete; + else if (strcmp(argv[1], "passwd") == 0) + command = c_passwd; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ + + /* all other than show requires at least one USER argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + read_config_file(); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, db_server, db_user, db_passwd, db_name, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + db_server); + if (mysql_select_db(&mysql, db_name)) + return dberror(&mysql, "Cannot select database '%s'.", db_name); + + if ((command == c_show) && (argc == 2)) + { + dblist = list(&mysql); + p = dblist; + while (p && *p) + { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else { + /* for each supplied database name, perform the requested action */ + + for (i = 2; i < argc; i++) { + strncpy(user, argv[i], 32); + user[33] = '\0'; + if (! (owner(user) || member(user))) + { + if (command == c_create) + dberror(NULL,"Unable to create mysql-user '%s'.\n" + + "A mysql-user must start with either '%s_' or " + "'groupname_', where groupname is a unix group you are a " + "member of. Type \"groups\" to see which groups you are " + "a member of.\n", + user, getpwuid(getuid())->pw_name); + else + dberror(NULL, "You are not in charge of mysql-user: '%s'. Skipping.", user); + continue; + } + + switch (command) + { + case c_create: + if(name_isclean(user)) { + create(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_delete: + if(name_isclean(user)) { + delete(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_passwd: + if(name_isclean(user)) { + passwd(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + case c_show: + if(name_isclean(user)) { + show(&mysql, user); + } else { + dberror(NULL, "User name '%s' contains invalid characters.\n" + "Only A-Z, a-z, 0-9, _ (underscore) and - (dash) permitted. Skipping.", user); + } + break; + default: + fprintf(stderr, "This point should never be reached.\n"); + exit(1); + } + } + } + + reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/pwfile.c b/pwfile.c new file mode 100644 index 0000000..ce2e573 --- /dev/null +++ b/pwfile.c @@ -0,0 +1,108 @@ +/* + * @($) $Id: pwfile.c,v 1.3 2007-02-27 14:10:08 geirha Exp $ + * + * functions for parsing the config file. + * + */ + +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" +#include "pwyacc.h" + +/* the MySQL maximum */ +#define MAXPWCHARS 16 + +/* defaults for configurable values */ +const char* db_user = "root"; +const char* db_server = "localhost"; +const char* db_passwd = NULL; +const char* db_name = "mysql"; + +extern int yyparse(void); +extern FILE *yyin; + +int config_line = 1; + +static FILE *pwfile; +static char *filename = SYSCONFDIR "/mysql-admutils.conf"; + +int +read_config_file(void) +{ + struct rlimit rlim; + int rc; /* return code */ + + /* to stop the user from obtaining the password from a core dump. */ + if (getrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("getrlimit"); + exit(1); + } + rlim.rlim_max = 0; + if (setrlimit(RLIMIT_CORE, &rlim) == -1) { + perror("setrlimit"); + exit(1); + } + + pwfile = fopen(filename, "r"); + if (!pwfile) { + fatal_error("cannot open configuration file %s", filename); + exit(1); + } + + /* we don't need to be SUID anymore. */ + if (seteuid(getuid()) != 0) + perror("seteuid"); + + yyin = pwfile; + rc = yyparse(); + fclose(pwfile); + + return rc; +} + + +int +yywrap(void) +{ + return 1; +} + + +int +yyerror(const char *msg) +{ + fprintf(stderr, "%s:%d: %s\n", filename, config_line, msg); + return 0; +} + + +int +config_set_string_var(int var, const char *value) +{ + assert(value); + switch (var) { + case USER: + db_user = value; + break; + case HOST: + db_server = value; + break; + case PASSWORD: + if (strlen(value) > MAXPWCHARS) { + fprintf(stderr, "%s:%d: password is too long (%d chars > %d chars)\n", + filename, config_line, strlen(value), MAXPWCHARS); + fclose(pwfile); + exit(1); + } + db_passwd = value; + break; + default: + assert(!"We should never get here."); + } + return 0; +} diff --git a/pwlex.l b/pwlex.l new file mode 100644 index 0000000..457ef74 --- /dev/null +++ b/pwlex.l @@ -0,0 +1,47 @@ +/* + * @(#) $Id: pwlex.l,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * lex source for the configuration file + * + */ + +%{ +#include +#include +#include "pwyacc.h" + +extern int config_line; +extern int yylval; +%} + +%% + +#.*\n config_line++; + +set { yylval = SET; return(SET); } +host { yylval = HOST; return(HOST); }; +user { yylval = USER; return(USER); }; +password { yylval = PASSWORD; return(PASSWORD); } + +\"[^"]*\" { + if (yytext[yyleng - 1] == '\\') + yymore(); + else + yytext[yyleng - 1] = '\0'; + yylval = (int)strdup(yytext + 1); + return(STRING); + }; + +; return(';'); + +[^ \t\n\;]* { + yylval = (int)strdup(yytext); + return(STRING); + } + +[ \t] ; + +\n config_line++; + +%% + diff --git a/pwyacc.y b/pwyacc.y new file mode 100644 index 0000000..1a39886 --- /dev/null +++ b/pwyacc.y @@ -0,0 +1,33 @@ +/* + * @(#) $Id: pwyacc.y,v 1.1.1.1 2001-11-25 00:41:16 lkarsten Exp $ + * + * yacc source for parsing the configuration file + * + */ + +%{ +int yyerror(const char *msg); +int yylex(void); +int config_set_string_var(int var, const char *value); +%} + +%token SET HOST USER PASSWORD STRING + +%% + +input: ; +input: statement input ; + +statement: SET variable STRING ';' + { + $$ = config_set_string_var($2, (const char *)$3); + } + +; + +variable: USER | PASSWORD | HOST + { $$ = $1; } + ; + +%% + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp From 84a22a22487c54cd148e12803fc2959b9dbbb9be Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:40:25 +0200 Subject: [PATCH 12/22] Fjerner install --- .gitignore | 1 + INSTALL | 183 ----------------------------------------------------- 2 files changed, 1 insertion(+), 183 deletions(-) delete mode 100644 INSTALL diff --git a/.gitignore b/.gitignore index 8eb03ef..73a87e5 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ Makefile.in /test-driver /ylwrap /mkinstalldirs +/INSTALL # http://www.gnu.org/software/autoconf diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 50dbe43..0000000 --- a/INSTALL +++ /dev/null @@ -1,183 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - From b12a8eae8fff94061124ef759236a6939b5d38e3 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:53:08 +0200 Subject: [PATCH 13/22] configline blir en README-fil --- Makefile.am | 6 +++--- README | 0 README.md | 8 ++++++++ configline | 44 -------------------------------------------- 4 files changed, 11 insertions(+), 47 deletions(-) delete mode 100644 README create mode 100644 README.md delete mode 100644 configline diff --git a/Makefile.am b/Makefile.am index e3a0bd7..b65669f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ mysql_admutils_SOURCE = common.c mysql-admutils.h pwyacc.y pwlex.l pwfile.c mysql_dbadm_SOURCES = mysql-dbadm.c $(mysql_admutils_SOURCE) mysql_useradm_SOURCES = mysql-useradm.c $(mysql_admutils_SOURCE) BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c -YFLAGS = -d -INCLUDES = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" +AM_YFLAGS = -d +AM_CPPFLAGS = @MYSQL_INCLUDE@ -DSYSCONFDIR=\"$(sysconfdir)\" LDADD = @MYSQL_LIBS@ @LEXLIB@ -LDFLAGS = @MYSQL_LFLAGS@ +AM_LDFLAGS = @MYSQL_LFLAGS@ diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b725d9 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ + +vanlig, på linux. + + ./configure --with-mysql=/usr/ --sysconfdir=/etc/ + +vi burde kanskje komplisere med libmysqlclient statisk, +sånn at vi slipper avhengigheter mot en spesiell rpmpakke. + diff --git a/configline b/configline deleted file mode 100644 index 49f7a3f..0000000 --- a/configline +++ /dev/null @@ -1,44 +0,0 @@ - -vanlig, på linux. -./configure --with-mysql=/usr/ --sysconfdir=/etc/ - -vi burde kanskje komplisere med libmysqlclient statisk, -sånn at vi slipper avhengigheter mot en spesiell rpmpakke. - - -elefant:~/mysql-admutils$ diff -u ../Makefile.org Makefile ---- ../Makefile.org Tue Apr 8 20:20:00 2003 -+++ Makefile Tue Apr 8 20:22:27 2003 -@@ -62,8 +62,8 @@ - LEX = flex - MAKEINFO = makeinfo - MYSQL_INCLUDE = -I/store/include/mysql --MYSQL_LFLAGS = -L/store/lib/mysql --MYSQL_LIBS = -lmysqlclient -+MYSQL_LFLAGS = -+MYSQL_LIBS = - PACKAGE = mysql-admutils - SYSCONFDIR = - VERSION = 0.43 -@@ -76,8 +76,8 @@ - BUILT_SOURCES = pwyacc.c pwyacc.h pwlex.c - YFLAGS = -d - INCLUDES = -I/store/include/mysql -DSYSCONFDIR=\"$(sysconfdir)\" --LDADD = -lmysqlclient -lfl --LDFLAGS = -L/store/lib/mysql -+LDADD = /store/lib/mysql/libmysqlclient.a -lfl -+LDFLAGS = - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - CONFIG_HEADER = config.h - - - - - - - - -$Id: configline,v 1.2 2003-04-08 18:31:53 lkarsten Exp $ -$Source: /tmp/cvs/mysql-admutils/configline,v $ - From 2f7f5595f2eda0dbad67f72c5a0d9ac85f9fa4da Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 13:58:01 +0200 Subject: [PATCH 14/22] automake vil ha README --- README | 1 + 1 file changed, 1 insertion(+) create mode 120000 README diff --git a/README b/README new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/README @@ -0,0 +1 @@ +README.md \ No newline at end of file From 42449607b971035ebae706a8cbdb9551400a13b8 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 14:03:55 +0200 Subject: [PATCH 15/22] Kosmetisk for configure-eksemplet --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b725d9..1abbfdd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ vanlig, på linux. - ./configure --with-mysql=/usr/ --sysconfdir=/etc/ + ./configure --with-mysql=/usr --sysconfdir=/etc vi burde kanskje komplisere med libmysqlclient statisk, sånn at vi slipper avhengigheter mot en spesiell rpmpakke. From 2ff4462a34303a025ea8955c73e0e6d89783d8d9 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 14:05:26 +0200 Subject: [PATCH 16/22] Make for rydding til automake-start --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1abbfdd..12386ce 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,6 @@ vanlig, p vi burde kanskje komplisere med libmysqlclient statisk, sånn at vi slipper avhengigheter mot en spesiell rpmpakke. +For å rydde til start: + + make maintainer-clean-am From ec0ef5aaa352909556551d5d0233a87315bd8f18 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 14:44:18 +0200 Subject: [PATCH 17/22] README inneholder aclocal/automake --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12386ce..a07b27e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +## `aclocal`/`automake` + + aclocal + automake -a -f + +## `configure` vanlig, på linux. @@ -6,6 +12,6 @@ vanlig, p vi burde kanskje komplisere med libmysqlclient statisk, sånn at vi slipper avhengigheter mot en spesiell rpmpakke. -For å rydde til start: +For å rydde til `configure`-start: make maintainer-clean-am From 4cda7f50d70c7df7b69613c01a6e5cfda05b4184 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 14:52:41 +0200 Subject: [PATCH 18/22] Ta med --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a07b27e..f78e724 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## `aclocal`/`automake` aclocal + autoheader -f automake -a -f ## `configure` From 2e4bc934bfd248c1662bf0d4d0585105da92f0c9 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 15:08:48 +0200 Subject: [PATCH 19/22] =?UTF-8?q?`autoreconf`=20kj=C3=B8rer=20aclocal,=20a?= =?UTF-8?q?utomake=20etc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f78e724..f50c45e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -## `aclocal`/`automake` +## autoreconf - aclocal - autoheader -f - automake -a -f + autoreconf --force --install --symlink ## `configure` From a067a0991ea44d0adb7230214a40752f8aa044e5 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 15:48:52 +0200 Subject: [PATCH 20/22] tegnsettfeil --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f50c45e..7e9d829 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -## autoreconf +## autoreconf autoreconf --force --install --symlink -## `configure` +## configure -vanlig, på linux. +vanlig, pÃ¥ linux. ./configure --with-mysql=/usr --sysconfdir=/etc -vi burde kanskje komplisere med libmysqlclient statisk, -sånn at vi slipper avhengigheter mot en spesiell rpmpakke. +vi burde kanskje komplisere med libmysqlclient statisk, +sÃ¥nn at vi slipper avhengigheter mot en spesiell rpmpakke. -For å rydde til `configure`-start: +For Ã¥ rydde til `configure`-start: make maintainer-clean-am From 9f8281ead4e01232ad6848d2a3ab60ebec7513e7 Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 15:50:26 +0200 Subject: [PATCH 21/22] Uten BOM --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e9d829..9b042bf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## autoreconf +## autoreconf autoreconf --force --install --symlink From c8923b313df2d9d431c554cdc63a527643a01afb Mon Sep 17 00:00:00 2001 From: Aslak Raanes Date: Fri, 5 Oct 2018 15:57:31 +0200 Subject: [PATCH 22/22] Rydde til start --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9b042bf..8b97d15 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,9 @@ vanlig, pÃ¥ linux. - ./configure --with-mysql=/usr --sysconfdir=/etc + ./configure --with-mysql=yes --sysconfdir=/etc -vi burde kanskje komplisere med libmysqlclient statisk, -sÃ¥nn at vi slipper avhengigheter mot en spesiell rpmpakke. +For Ã¥ rydde til start: -For Ã¥ rydde til `configure`-start: + make maintainer-clean - make maintainer-clean-am