Compare commits

...
Author SHA1 Message Date
cvs2svn b4d1edeb37 This commit was manufactured by cvs2svn to create tag
'RELENG_3_5_0_RELEASE'.
2000-06-25 00:20:49 +00:00
262 changed files with 116 additions and 34805 deletions

No files matched your search

-106
View File
@@ -1,106 +0,0 @@
1999-07-03 Assar Westerlund <[email protected]>
* parse.y (statement): use asprintf
1999-06-13 Assar Westerlund <[email protected]>
* Makefile.in: make it solaris make vpath-safe
Thu Apr 1 11:13:53 1999 Johan Danielsson <[email protected]>
* compile_et.c: use getargs
Sat Mar 20 00:16:30 1999 Assar Westerlund <[email protected]>
* compile_et.c: static-ize
Thu Mar 18 11:22:13 1999 Johan Danielsson <[email protected]>
* Makefile.am: include Makefile.am.common
Tue Mar 16 22:30:05 1999 Assar Westerlund <[email protected]>
* parse.y: use YYACCEPT instead of return
Sat Mar 13 22:22:56 1999 Assar Westerlund <[email protected]>
* compile_et.c (generate_h): cast when calling is* to get rid of a
warning
Thu Mar 11 15:00:51 1999 Johan Danielsson <[email protected]>
* parse.y: prototype for error_message
Sun Nov 22 10:39:02 1998 Assar Westerlund <[email protected]>
* compile_et.h: include ctype and roken
* compile_et.c: include err.h
(generate_h): remove unused variable
* Makefile.in (WFLAGS): set
Fri Nov 20 06:58:59 1998 Assar Westerlund <[email protected]>
* lex.l: undef ECHO to work around AIX lex bug
Sun Sep 27 02:23:59 1998 Johan Danielsson <[email protected]>
* com_err.c (error_message): try to pass code to strerror, to see
if it might be an errno code (this if broken, but some MIT code
seems to expect this behaviour)
Sat Sep 26 17:42:39 1998 Johan Danielsson <[email protected]>
* compile_et.c: <foo_err.h> -> "foo_err.h"
Tue Jun 30 17:17:36 1998 Assar Westerlund <[email protected]>
* Makefile.in: add str{cpy,cat}_truncate
Mon May 25 05:24:39 1998 Assar Westerlund <[email protected]>
* Makefile.in (clean): try to remove shared library debris
Sun Apr 19 09:50:17 1998 Assar Westerlund <[email protected]>
* Makefile.in: add symlink magic for linux
Sun Apr 5 09:22:11 1998 Assar Westerlund <[email protected]>
* parse.y: define alloca to malloc in case we're using bison but
don't have alloca
Tue Mar 24 05:13:01 1998 Assar Westerlund <[email protected]>
* Makefile.in: link with snprintf (From Derrick J Brashear
<[email protected]>)
Fri Feb 27 05:01:42 1998 Assar Westerlund <[email protected]>
* parse.y: initialize ec->next
Thu Feb 26 02:22:25 1998 Assar Westerlund <[email protected]>
* Makefile.am: @LEXLIB@
Sat Feb 21 15:18:54 1998 assar westerlund <[email protected]>
* Makefile.in: set YACC and LEX
Tue Feb 17 22:20:27 1998 Bjoern Groenvall <[email protected]>
* com_right.h: Change typedefs so that one may mix MIT compile_et
generated code with krb4 dito.
Tue Feb 17 16:30:55 1998 Johan Danielsson <[email protected]>
* compile_et.c (generate): Always return a value.
* parse.y: Files don't have to end with `end'.
Mon Feb 16 16:09:20 1998 Johan Danielsson <[email protected]>
* lex.l (getstring): Replace getc() with input().
* Makefile.am: Fixes for new compile_et.
-24
View File
@@ -1,24 +0,0 @@
# $Id: Makefile.am,v 1.23 1999/04/09 18:26:55 assar Exp $
include $(top_srcdir)/Makefile.am.common
YFLAGS = -d
lib_LTLIBRARIES = libcom_err.la
libcom_err_la_LDFLAGS = -version-info 1:0:0
bin_PROGRAMS = compile_et
include_HEADERS = com_err.h com_right.h
compile_et_SOURCES = compile_et.c compile_et.h parse.y lex.l
libcom_err_la_SOURCES = error.c com_err.c roken_rename.h
CLEANFILES = lex.c parse.c parse.h
$(compile_et_OBJECTS): parse.h
compile_et_LDADD = \
$(LIB_roken) \
$(LEXLIB)
-710
View File
@@ -1,710 +0,0 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 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.
# $Id: Makefile.am,v 1.23 1999/04/09 18:26:55 assar Exp $
# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $
# $Id: Makefile.am.common,v 1.12 1999/07/28 00:54:29 assar Exp $
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AFS_EXTRA_LD = @AFS_EXTRA_LD@
AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
AWK = @AWK@
CANONICAL_HOST = @CANONICAL_HOST@
CATMAN = @CATMAN@
CATMANEXT = @CATMANEXT@
CC = @CC@
DBLIB = @DBLIB@
EXEEXT = @EXEEXT@
EXTRA_LIB45 = @EXTRA_LIB45@
GROFF = @GROFF@
INCLUDE_ = @INCLUDE_@
LD = @LD@
LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBTOOL = @LIBTOOL@
LIB_ = @LIB_@
LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
LIB_kdb = @LIB_kdb@
LIB_otp = @LIB_otp@
LIB_roken = @LIB_roken@
LIB_security = @LIB_security@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MAKE_X_PROGS_BIN_PROGS = @MAKE_X_PROGS_BIN_PROGS@
MAKE_X_PROGS_BIN_SCRPTS = @MAKE_X_PROGS_BIN_SCRPTS@
MAKE_X_PROGS_LIBEXEC_PROGS = @MAKE_X_PROGS_LIBEXEC_PROGS@
NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@
NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@
NM = @NM@
NROFF = @NROFF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
VOID_RETSIGTYPE = @VOID_RETSIGTYPE@
WFLAGS = @WFLAGS@
WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
YACC = @YACC@
AUTOMAKE_OPTIONS = foreign no-dependencies
SUFFIXES = .et .h .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x
INCLUDES = -I$(top_builddir)/include
AM_CFLAGS = $(WFLAGS)
COMPILE_ET = $(top_builddir)/lib/com_err/compile_et
buildinclude = $(top_builddir)/include
LIB_XauReadAuth = @LIB_XauReadAuth@
LIB_crypt = @LIB_crypt@
LIB_dbm_firstkey = @LIB_dbm_firstkey@
LIB_dbopen = @LIB_dbopen@
LIB_dlopen = @LIB_dlopen@
LIB_dn_expand = @LIB_dn_expand@
LIB_el_init = @LIB_el_init@
LIB_getattr = @LIB_getattr@
LIB_gethostbyname = @LIB_gethostbyname@
LIB_getpwent_r = @LIB_getpwent_r@
LIB_getpwnam_r = @LIB_getpwnam_r@
LIB_getsockopt = @LIB_getsockopt@
LIB_logout = @LIB_logout@
LIB_logwtmp = @LIB_logwtmp@
LIB_odm_initialize = @LIB_odm_initialize@
LIB_readline = @LIB_readline@
LIB_res_search = @LIB_res_search@
LIB_setpcred = @LIB_setpcred@
LIB_setsockopt = @LIB_setsockopt@
LIB_socket = @LIB_socket@
LIB_syslog = @LIB_syslog@
LIB_tgetent = @LIB_tgetent@
HESIODLIB = @HESIODLIB@
HESIODINCLUDE = @HESIODINCLUDE@
INCLUDE_hesiod = @INCLUDE_hesiod@
LIB_hesiod = @LIB_hesiod@
INCLUDE_krb4 = @INCLUDE_krb4@
LIB_krb4 = @LIB_krb4@
INCLUDE_readline = @INCLUDE_readline@
LEXLIB = @LEXLIB@
cat1dir = $(mandir)/cat1
cat3dir = $(mandir)/cat3
cat5dir = $(mandir)/cat5
cat8dir = $(mandir)/cat8
MANRX = \(.*\)\.\([0-9]\)
CATSUFFIX = @CATSUFFIX@
NROFF_MAN = groff -mandoc -Tascii
@KRB4_TRUE@LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la $(top_builddir)/lib/asn1/libasn1.la
@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
CHECK_LOCAL = $(PROGRAMS)
YFLAGS = -d
lib_LTLIBRARIES = libcom_err.la
libcom_err_la_LDFLAGS = -version-info 1:0:0
bin_PROGRAMS = compile_et
include_HEADERS = com_err.h com_right.h
compile_et_SOURCES = compile_et.c compile_et.h parse.y lex.l
libcom_err_la_SOURCES = error.c com_err.c roken_rename.h
CLEANFILES = lex.c parse.c parse.h
compile_et_LDADD = $(LIB_roken) $(LEXLIB)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../include/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
libcom_err_la_LIBADD =
libcom_err_la_OBJECTS = error.lo com_err.lo
bin_PROGRAMS = compile_et$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
compile_et_OBJECTS = compile_et.$(OBJEXT) parse.$(OBJEXT) lex.$(OBJEXT)
compile_et_DEPENDENCIES =
compile_et_LDFLAGS =
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(include_HEADERS)
DIST_COMMON = ChangeLog Makefile.am Makefile.in lex.c parse.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(libcom_err_la_SOURCES) $(compile_et_SOURCES)
OBJECTS = $(libcom_err_la_OBJECTS) $(compile_et_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .1 .3 .5 .8 .S .c .cat1 .cat3 .cat5 .cat8 .et .h .l .lo .o .obj .s .x .y
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common
cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/com_err/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
.c.o:
$(COMPILE) -c $<
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libcom_err.la: $(libcom_err_la_OBJECTS) $(libcom_err_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libcom_err_la_LDFLAGS) $(libcom_err_la_OBJECTS) $(libcom_err_la_LIBADD) $(LIBS)
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
compile_et$(EXEEXT): $(compile_et_OBJECTS) $(compile_et_DEPENDENCIES)
@rm -f compile_et$(EXEEXT)
$(LINK) $(compile_et_LDFLAGS) $(compile_et_OBJECTS) $(compile_et_LDADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
parse.h: parse.c
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
list='$(include_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(includedir)/$$p; \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib/com_err
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-exec: install-exec-am
install-data-am: install-includeHEADERS install-data-local
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \
uninstall-includeHEADERS
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(includedir)
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-test -z "lexlparsehparsec" || rm -f lexl parseh parsec
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-binPROGRAMS \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \
clean-binPROGRAMS clean-tags clean-generic \
mostlyclean-am
clean: clean-am
distclean-am: distclean-libLTLIBRARIES distclean-compile \
distclean-libtool distclean-binPROGRAMS distclean-tags \
distclean-generic clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-binPROGRAMS maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
distclean-compile clean-compile maintainer-clean-compile \
mostlyclean-libtool distclean-libtool clean-libtool \
maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \
clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
install-binPROGRAMS uninstall-includeHEADERS install-includeHEADERS \
tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check-local check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-local install-data-am install-data install-am install \
uninstall-am uninstall all-local all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
install-suid-programs:
@foo='$(bin_SUIDS)'; \
for file in $$foo; do \
x=$(DESTDIR)$(bindir)/$$file; \
if chown 0:0 $$x && chmod u+s $$x; then :; else \
chmod 0 $$x; fi; done
install-exec-hook: install-suid-programs
install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
@foo='$(include_HEADERS) $(build_HEADERZ)'; \
for f in $$foo; do \
f=`basename $$f`; \
if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
else file="$$f"; fi; \
if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
: ; else \
echo " $(INSTALL_DATA) $$file $(buildinclude)/$$f"; \
$(INSTALL_DATA) $$file $(buildinclude)/$$f; \
fi ; \
done
all-local: install-build-headers
#NROFF_MAN = nroff -man
.1.cat1:
$(NROFF_MAN) $< > $@
.3.cat3:
$(NROFF_MAN) $< > $@
.5.cat5:
$(NROFF_MAN) $< > $@
.8.cat8:
$(NROFF_MAN) $< > $@
dist-cat1-mans:
@foo='$(man1_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.1) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat3-mans:
@foo='$(man3_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.3) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat5-mans:
@foo='$(man5_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.5) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat8-mans:
@foo='$(man8_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.8) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
install-cat1-mans:
@ext=1;\
foo='$(man1_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.1) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat1dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat1/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat3-mans:
@ext=3;\
foo='$(man3_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.3) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat3dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat3/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat5-mans:
@ext=5;\
foo='$(man5_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.5) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat5dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat5/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat8-mans:
@ext=8;\
foo='$(man8_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.8) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat8dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat8/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat-mans: install-cat1-mans install-cat3-mans install-cat5-mans install-cat8-mans
install-data-local: install-cat-mans
.et.h:
$(COMPILE_ET) $<
.et.c:
$(COMPILE_ET) $<
.x.c:
@cmp -s $< $@ 2> /dev/null || cp $< $@
check-local::
@foo='$(CHECK_LOCAL)'; \
if test "$$foo"; then \
failed=0; all=0; \
for i in $$foo; do \
all=`expr $$all + 1`; \
if ./$$i --version > /dev/null 2>&1; then \
echo "PASS: $$i"; \
else \
echo "FAIL: $$i"; \
failed=`expr $$failed + 1`; \
fi; \
done; \
if test "$$failed" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="$$failed of $$all tests failed"; \
fi; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
fi
$(compile_et_OBJECTS): parse.h
# 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:
-96
View File
@@ -1,96 +0,0 @@
.\" Copyright (c) 1988 Massachusetts Institute of Technology,
.\" Student Information Processing Board. All rights reserved.
.\"
.\" $FreeBSD$
.\"
.TH COM_ERR 3 "22 Nov 1988" SIPB
.SH NAME
com_err \- common error display routine
.SH SYNOPSIS
.nf
#include <com_err.h>
.PP
void com_err (whoami, code, format, ...);
const char *whoami;
long code;
const char *format;
.PP
proc = set_com_err_hook (proc);
.fi
void (*
.I proc
) (const char *, long, const char *, va_list);
.nf
.PP
proc = reset_com_err_hook ();
.PP
void initialize_XXXX_error_table ();
.fi
.SH DESCRIPTION
.I Com_err
displays an error message on the standard error stream
.I stderr
(see
.IR stdio (3S))
composed of the
.I whoami
string, which should specify the program name or some subportion of
a program, followed by an error message generated from the
.I code
value (derived from
.IR compile_et (1)),
and a string produced using the
.I format
string and any following arguments, in the same style as
.IR fprintf (3).
The behavior of
.I com_err
can be modified using
.I set_com_err_hook;
this defines a procedure which is called with the arguments passed to
.I com_err,
instead of the default internal procedure which sends the formatted
text to error output. Thus the error messages from a program can all
easily be diverted to another form of diagnostic logging, such as
.IR syslog (3).
.I Reset_com_err_hook
may be used to restore the behavior of
.I com_err
to its default form. Both procedures return the previous ``hook''
value. These ``hook'' procedures must have the declaration given for
.I proc
above in the synopsis.
The
.I initialize_XXXX_error_table
routine is generated mechanically by
.IR compile_et (1)
from a source file containing names and associated strings. Each
table has a name of up to four characters, which is used in place of
the
.B XXXX
in the name of the routine. These routines should be called before
any of the corresponding error codes are used, so that the
.I com_err
library will recognize error codes from these tables when they are
used.
The
.B com_err.h
header file should be included in any source file that uses routines
from the
.I com_err
library; executable files must be linked using
.I ``-lcom_err''
in order to cause the
.I com_err
library to be included.
.\" .IR for manual entries
.\" .PP for paragraph breaks
.SH "SEE ALSO"
compile_et (1), syslog (3).
Ken Raeburn, "A Common Error Description Library for UNIX".
-155
View File
@@ -1,155 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id: com_err.c,v 1.13 1999/03/12 15:17:08 bg Exp $");
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "com_err.h"
struct et_list *_et_list;
const char *
error_message (long code)
{
static char msg[128];
const char *p = com_right(_et_list, code);
if (p == NULL)
p = strerror(code);
if (p != NULL && *p != '\0') {
strncpy(msg, p, sizeof(msg) - 1);
msg[sizeof(msg) - 1] = 0;
} else
sprintf(msg, "Unknown error %ld", code);
return msg;
}
int
init_error_table(const char **msgs, long base, int count)
{
initialize_error_table_r(&_et_list, msgs, count, base);
return 0;
}
static void
default_proc (const char *whoami, long code, const char *fmt, va_list args)
{
if (whoami)
fprintf(stderr, "%s: ", whoami);
if (code)
fprintf(stderr, "%s ", error_message(code));
if (fmt)
vfprintf(stderr, fmt, args);
fprintf(stderr, "\r\n"); /* ??? */
}
static errf com_err_hook = default_proc;
void
com_err_va (const char *whoami,
long code,
const char *fmt,
va_list args)
{
(*com_err_hook) (whoami, code, fmt, args);
}
void
com_err (const char *whoami,
long code,
const char *fmt,
...)
{
va_list ap;
va_start(ap, fmt);
com_err_va (whoami, code, fmt, ap);
va_end(ap);
}
errf
set_com_err_hook (errf new)
{
errf old = com_err_hook;
if (new)
com_err_hook = new;
else
com_err_hook = default_proc;
return old;
}
errf
reset_com_err_hook (void)
{
return set_com_err_hook(NULL);
}
#define ERRCODE_RANGE 8 /* # of bits to shift table number */
#define BITS_PER_CHAR 6 /* # bits to shift per character in name */
static const char char_set[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
static char buf[6];
const char *
error_table_name(int num)
{
int ch;
int i;
char *p;
/* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
p = buf;
num >>= ERRCODE_RANGE;
/* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
num &= 077777777;
/* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
for (i = 4; i >= 0; i--) {
ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
if (ch != 0)
*p++ = char_set[ch-1];
}
*p = '\0';
return(buf);
}
-68
View File
@@ -1,68 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: com_err.h,v 1.3 1998/05/02 20:13:28 assar Exp $ */
/* $FreeBSD$ */
/* MIT compatible com_err library */
#ifndef __COM_ERR_H__
#define __COM_ERR_H__
#include <sys/cdefs.h>
#ifdef __STDC__
#include <stdarg.h>
#endif
#include <com_right.h>
typedef void (*errf) __P((const char *, long, const char *, va_list));
const char * error_message __P((long));
int init_error_table __P((const char**, long, int));
void com_err_va __P((const char *, long, const char *, va_list));
void com_err __P((const char *, long, const char *, ...));
errf set_com_err_hook __P((errf));
errf reset_com_err_hook __P((void));
const char *error_table_name __P((int num));
#endif /* __COM_ERR_H__ */
-63
View File
@@ -1,63 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: com_right.h,v 1.8 1998/02/17 21:19:43 bg Exp $ */
/* $FreeBSD$ */
#ifndef __COM_RIGHT_H__
#define __COM_RIGHT_H__
#include <sys/cdefs.h>
struct error_table {
char const * const * msgs;
long base;
int n_msgs;
};
struct et_list {
struct et_list *next;
struct error_table *table;
};
extern struct et_list *_et_list;
const char *com_right __P((struct et_list *list, long code));
void initialize_error_table_r __P((struct et_list **, const char **, int,
long));
void free_error_table __P((struct et_list *));
#endif /* __COM_RIGHT_H__ */
-78
View File
@@ -1,78 +0,0 @@
.\" Copyright (c) 1988 Massachusetts Institute of Technology,
.\" Student Information Processing Board. All rights reserved.
.\"
.\" $FreeBSD$
.\"
.Dd November 22, 1988
.Os
.Dt COMPILE_ET 1
.Sh NAME
.Nm compile_et
.Nd error table compiler
.Sh SYNOPSIS
.Nm compile_et
.Ar file
.Sh DESCRIPTION
.Nm Compile_et
converts a table listing error-code names and associated messages into
a C source file suitable for use with the
.Xr com_err 3
library.
.Pp
The source file name must end with a suffix of ``.et''; the file
consists of a declaration supplying the name (up to four characters
long) of the error-code table:
.Em error_table name
followed by up to 256 entries of the form:
.Em error_code name ,
"
.Em string
"
and a final
.Em end
to indicate the end of the table.
.Pp
The name of the table is used to construct the name of a subroutine
.Em initialize_XXXX_error_table
which must be called in order for the
.Xr com_err 3
library to recognize the error table.
.Pp
The various error codes defined are assigned sequentially increasing
numbers (starting with a large number computed as a hash function of
the name of the table); thus for compatibility it is suggested that
new codes be added only to the end of an existing table, and that no
codes be removed from tables.
.Pp
The names defined in the table are placed into a C header file with
preprocessor directives defining them as integer constants of up to
32 bits in magnitude.
.Pp
A C source file is also generated which should be compiled and linked
with the object files which reference these error codes; it contains
the text of the messages and the initialization subroutine. Both C
files have names derived from that of the original source file, with
the ``.et'' suffix replaced by ``.c'' and ``.h''.
.Pp
A ``#'' in the source file is treated as a comment character, and all
remaining text to the end of the source line will be ignored.
.Sh BUGS
Since
.Nm compile_et
uses a very simple parser based on
.Xr yacc 1 ,
its error recovery leaves much to be desired.
.Sh "SEE ALSO"
.Xr yacc 1 ,
.Xr com_err 3
.Pp
.Rs
.%A Ken Raeburn
.%T "A Common Error Description Library for UNIX"
.Re
-234
View File
@@ -1,234 +0,0 @@
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef ROKEN_RENAME
#include "compile_et.h"
#include <getarg.h>
#if 0
RCSID("$Id: compile_et.c,v 1.12 1999/04/01 09:13:52 joda Exp $");
#endif
#include <err.h>
#include "parse.h"
int numerror;
extern FILE *yyin;
extern void yyparse(void);
long base;
int number;
char *prefix;
char *id_str;
char name[128];
char Basename[128];
#ifdef YYDEBUG
extern int yydebug = 1;
#endif
char *filename;
char hfn[128];
char cfn[128];
struct error_code *codes = NULL;
static int
generate_c(void)
{
int n;
struct error_code *ec;
FILE *c_file = fopen(cfn, "w");
if(c_file == NULL)
return 1;
fprintf(c_file, "/* Generated from %s */\n", filename);
if(id_str)
fprintf(c_file, "/* %s */\n", id_str);
fprintf(c_file, "\n");
fprintf(c_file, "#include <stddef.h>\n");
fprintf(c_file, "#include <com_err.h>\n");
fprintf(c_file, "#include \"%s\"\n", hfn);
fprintf(c_file, "\n");
fprintf(c_file, "static const char *text[] = {\n");
for(ec = codes, n = 0; ec; ec = ec->next, n++) {
while(n < ec->number) {
fprintf(c_file, "\t/* %03d */ \"Reserved %s error (%d)\",\n",
n, name, n);
n++;
}
fprintf(c_file, "\t/* %03d */ \"%s\",\n", ec->number, ec->string);
}
fprintf(c_file, "\tNULL\n");
fprintf(c_file, "};\n");
fprintf(c_file, "\n");
fprintf(c_file,
"void initialize_%s_error_table_r(struct et_list **list)\n",
name);
fprintf(c_file, "{\n");
fprintf(c_file,
" initialize_error_table_r(list, text, "
"%s_num_errors, ERROR_TABLE_BASE_%s);\n", name, name);
fprintf(c_file, "}\n");
fprintf(c_file, "\n");
fprintf(c_file, "void initialize_%s_error_table(void)\n", name);
fprintf(c_file, "{\n");
fprintf(c_file,
" init_error_table(text, ERROR_TABLE_BASE_%s, "
"%s_num_errors);\n", name, name);
fprintf(c_file, "}\n");
fclose(c_file);
return 0;
}
static int
generate_h(void)
{
struct error_code *ec;
char fn[128];
FILE *h_file = fopen(hfn, "w");
char *p;
if(h_file == NULL)
return 1;
snprintf(fn, sizeof(fn), "__%s__", hfn);
for(p = fn; *p; p++)
if(!isalnum((unsigned char)*p))
*p = '_';
fprintf(h_file, "/* Generated from %s */\n", filename);
if(id_str)
fprintf(h_file, "/* %s */\n", id_str);
fprintf(h_file, "\n");
fprintf(h_file, "#ifndef %s\n", fn);
fprintf(h_file, "#define %s\n", fn);
fprintf(h_file, "\n");
fprintf(h_file, "#include <com_right.h>\n");
fprintf(h_file, "\n");
fprintf(h_file,
"void initialize_%s_error_table_r(struct et_list **);\n",
name);
fprintf(h_file, "\n");
fprintf(h_file, "void initialize_%s_error_table(void);\n", name);
fprintf(h_file, "#define init_%s_err_tbl initialize_%s_error_table\n",
name, name);
fprintf(h_file, "\n");
fprintf(h_file, "typedef enum %s_error_number{\n", name);
fprintf(h_file, "\tERROR_TABLE_BASE_%s = %ld,\n", name, base);
fprintf(h_file, "\t%s_err_base = %ld,\n", name, base);
for(ec = codes; ec; ec = ec->next) {
fprintf(h_file, "\t%s = %ld,\n", ec->name, base + ec->number);
}
fprintf(h_file, "\t%s_num_errors = %d\n", name, number);
fprintf(h_file, "} %s_error_number;\n", name);
fprintf(h_file, "\n");
fprintf(h_file, "#endif /* %s */\n", fn);
fclose(h_file);
return 0;
}
static int
generate(void)
{
return generate_c() || generate_h();
}
int help_flag;
struct getargs args[] = {
{ "help", 0, arg_flag, &help_flag }
};
int num_args = sizeof(args) / sizeof(args[0]);
static void
usage(int code)
{
arg_printusage(args, num_args, NULL, "error-table");
exit(code);
}
int
main(int argc, char **argv)
{
char *p;
int optind = 0;
if(getarg(args, num_args, argc, argv, &optind))
usage(1);
if(help_flag)
usage(0);
if(optind == argc)
usage(1);
filename = argv[optind];
yyin = fopen(filename, "r");
if(yyin == NULL)
err(1, "%s", filename);
p = strrchr(filename, '/');
if(p)
p++;
else
p = filename;
strncpy(Basename, p, sizeof(Basename));
Basename[sizeof(Basename) - 1] = '\0';
Basename[strcspn(Basename, ".")] = '\0';
snprintf(hfn, sizeof(hfn), "%s.h", Basename);
snprintf(cfn, sizeof(cfn), "%s.c", Basename);
yyparse();
if(numerror)
return 1;
return generate();
}
-83
View File
@@ -1,83 +0,0 @@
/*
* Copyright (c) 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: compile_et.h,v 1.3 1998/11/22 09:39:46 assar Exp $ */
#ifndef __COMPILE_ET_H__
#define __COMPILE_ET_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
extern long base;
extern int number;
extern char *prefix;
extern char name[128];
extern char *id_str;
extern char *filename;
extern int numerror;
struct error_code {
unsigned number;
char *name;
char *string;
struct error_code *next, **tail;
};
extern struct error_code *codes;
#define APPEND(L, V) \
do { \
if((L) == NULL) { \
(L) = (V); \
(L)->tail = &(V)->next; \
(L)->next = NULL; \
}else{ \
*(L)->tail = (V); \
(L)->tail = &(V)->next; \
} \
}while(0)
#endif /* __COMPILE_ET_H__ */
-96
View File
@@ -1,96 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id: error.c,v 1.13 1998/02/17 21:19:44 bg Exp $");
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <com_right.h>
const char *
com_right(struct et_list *list, long code)
{
struct et_list *p;
for (p = list; p; p = p->next) {
if (code >= p->table->base && code < p->table->base + p->table->n_msgs)
return p->table->msgs[code - p->table->base];
}
return NULL;
}
struct foobar {
struct et_list etl;
struct error_table et;
};
void
initialize_error_table_r(struct et_list **list,
const char **messages,
int num_errors,
long base)
{
struct et_list *et;
struct foobar *f;
for (et = *list; et; et = et->next)
if (et->table->msgs == messages)
return;
f = malloc(sizeof(*f));
if (f == NULL)
return;
et = &f->etl;
et->table = &f->et;
et->table->msgs = messages;
et->table->n_msgs = num_errors;
et->table->base = base;
et->next = *list;
*list = et;
}
void
free_error_table(struct et_list *et)
{
while(et){
struct et_list *p = et;
et = et->next;
free(p);
}
}
-376
View File
@@ -1,376 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if 0
RCSID("$Id: getarg.c,v 1.25 1998/11/22 09:45:05 assar Exp $");
#endif
#include <sys/ttycom.h>
#include <time.h>
#include <stdio.h>
#include "getarg.h"
#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
static size_t
print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
{
const char *s;
*string = '\0';
if (ISFLAG(*arg))
return 0;
if(mdoc){
if(longp)
strncat(string, "= Ns", len);
strncat(string, " Ar ", len);
}else
if (longp)
strncat (string, "=", len);
else
strncat (string, " ", len);
if (arg->arg_help)
s = arg->arg_help;
else if (arg->type == arg_integer)
s = "number";
else if (arg->type == arg_string)
s = "string";
else
s = "<undefined>";
strncat(string, s, len);
return 1 + strlen(s);
}
static int
check_column(FILE *f, int col, int len, int columns)
{
if(col + len > columns) {
fprintf(f, "\n");
col = fprintf(f, " ");
}
return col;
}
void
arg_printusage (struct getargs *args,
size_t num_args,
const char *progname,
const char *extra_string)
{
int i;
size_t max_len = 0;
char buf[128];
int col = 0, columns;
struct winsize ws;
columns = 80;
col = 0;
col += fprintf (stderr, "Usage: %s", progname);
for (i = 0; i < num_args; ++i) {
size_t len = 0;
if (args[i].long_name) {
buf[0] = '\0';
strncat(buf, "[--", sizeof(buf));
len += 2;
if(args[i].type == arg_negative_flag) {
strncat(buf, "no-", sizeof(buf));
len += 3;
}
strncat(buf, args[i].long_name, sizeof(buf));
len += strlen(args[i].long_name);
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
0, 1, &args[i]);
strncat(buf, "]", sizeof(buf));
if(args[i].type == arg_strings)
strncat(buf, "...", sizeof(buf));
col = check_column(stderr, col, strlen(buf) + 1, columns);
col += fprintf(stderr, " %s", buf);
}
if (args[i].short_name) {
snprintf(buf, sizeof(buf), "[-%c", args[i].short_name);
len += 2;
len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
0, 0, &args[i]);
strncat(buf, "]", sizeof(buf));
if(args[i].type == arg_strings)
strncat(buf, "...", sizeof(buf));
col = check_column(stderr, col, strlen(buf) + 1, columns);
col += fprintf(stderr, " %s", buf);
}
if (args[i].long_name && args[i].short_name)
len += 2; /* ", " */
max_len = max(max_len, len);
}
if (extra_string) {
col = check_column(stderr, col, strlen(extra_string) + 1, columns);
fprintf (stderr, " %s\n", extra_string);
} else
fprintf (stderr, "\n");
for (i = 0; i < num_args; ++i) {
if (args[i].help) {
size_t count = 0;
if (args[i].short_name) {
count += fprintf (stderr, "-%c", args[i].short_name);
print_arg (buf, sizeof(buf), 0, 0, &args[i]);
count += fprintf(stderr, "%s", buf);
}
if (args[i].short_name && args[i].long_name)
count += fprintf (stderr, ", ");
if (args[i].long_name) {
count += fprintf (stderr, "--");
if (args[i].type == arg_negative_flag)
count += fprintf (stderr, "no-");
count += fprintf (stderr, "%s", args[i].long_name);
print_arg (buf, sizeof(buf), 0, 1, &args[i]);
count += fprintf(stderr, "%s", buf);
}
while(count++ <= max_len)
putc (' ', stderr);
fprintf (stderr, "%s\n", args[i].help);
}
}
}
static void
add_string(getarg_strings *s, char *value)
{
s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings));
s->strings[s->num_strings] = value;
s->num_strings++;
}
static int
arg_match_long(struct getargs *args, size_t num_args,
char *argv)
{
int i;
char *optarg = NULL;
int negate = 0;
int partial_match = 0;
struct getargs *partial = NULL;
struct getargs *current = NULL;
int argv_len;
char *p;
argv_len = strlen(argv);
p = strchr (argv, '=');
if (p != NULL)
argv_len = p - argv;
for (i = 0; i < num_args; ++i) {
if(args[i].long_name) {
int len = strlen(args[i].long_name);
char *p = argv;
int p_len = argv_len;
negate = 0;
for (;;) {
if (strncmp (args[i].long_name, p, p_len) == 0) {
if(p_len == len)
current = &args[i];
else {
++partial_match;
partial = &args[i];
}
optarg = p + p_len;
} else if (ISFLAG(args[i]) && strncmp (p, "no-", 3) == 0) {
negate = !negate;
p += 3;
p_len -= 3;
continue;
}
break;
}
if (current)
break;
}
}
if (current == NULL) {
if (partial_match == 1)
current = partial;
else
return ARG_ERR_NO_MATCH;
}
if(*optarg == '\0' && !ISFLAG(*current))
return ARG_ERR_NO_MATCH;
switch(current->type){
case arg_integer:
{
int tmp;
if(sscanf(optarg + 1, "%d", &tmp) != 1)
return ARG_ERR_BAD_ARG;
*(int*)current->value = tmp;
return 0;
}
case arg_string:
{
*(char**)current->value = optarg + 1;
return 0;
}
case arg_strings:
{
add_string((getarg_strings*)current->value, optarg + 1);
return 0;
}
case arg_flag:
case arg_negative_flag:
{
int *flag = current->value;
if(*optarg == '\0' ||
strcmp(optarg + 1, "yes") == 0 ||
strcmp(optarg + 1, "true") == 0){
*flag = !negate;
return 0;
} else if (*optarg && strcmp(optarg + 1, "maybe") == 0) {
*flag = rand() & 1;
} else {
*flag = negate;
return 0;
}
return ARG_ERR_BAD_ARG;
}
default:
abort ();
}
}
int
getarg(struct getargs *args, size_t num_args,
int argc, char **argv, int *optind)
{
int i, j, k;
int ret = 0;
srand (time(NULL));
(*optind)++;
for(i = *optind; i < argc; i++) {
if(argv[i][0] != '-')
break;
if(argv[i][1] == '-'){
if(argv[i][2] == 0){
i++;
break;
}
ret = arg_match_long (args, num_args, argv[i] + 2);
if(ret)
return ret;
}else{
for(j = 1; argv[i][j]; j++) {
for(k = 0; k < num_args; k++) {
char *optarg;
if(args[k].short_name == 0)
continue;
if(argv[i][j] == args[k].short_name){
if(args[k].type == arg_flag){
*(int*)args[k].value = 1;
break;
}
if(args[k].type == arg_negative_flag){
*(int*)args[k].value = 0;
break;
}
if(argv[i][j + 1])
optarg = &argv[i][j + 1];
else{
i++;
optarg = argv[i];
}
if(optarg == NULL)
return ARG_ERR_NO_ARG;
if(args[k].type == arg_integer){
int tmp;
if(sscanf(optarg, "%d", &tmp) != 1)
return ARG_ERR_BAD_ARG;
*(int*)args[k].value = tmp;
goto out;
}else if(args[k].type == arg_string){
*(char**)args[k].value = optarg;
goto out;
}else if(args[k].type == arg_strings){
add_string((getarg_strings*)args[k].value, optarg);
goto out;
}
return ARG_ERR_BAD_ARG;
}
}
if (k == num_args)
return ARG_ERR_NO_MATCH;
}
out:;
}
}
*optind = i;
return 0;
}
#if TEST
int foo_flag = 2;
int flag1 = 0;
int flag2 = 0;
int bar_int;
char *baz_string;
struct getargs args[] = {
{ NULL, '1', arg_flag, &flag1, "one", NULL },
{ NULL, '2', arg_flag, &flag2, "two", NULL },
{ "foo", 'f', arg_negative_flag, &foo_flag, "foo", NULL },
{ "bar", 'b', arg_integer, &bar_int, "bar", "seconds"},
{ "baz", 'x', arg_string, &baz_string, "baz", "name" },
};
int main(int argc, char **argv)
{
int optind = 0;
while(getarg(args, 5, argc, argv, &optind))
printf("Bad arg: %s\n", argv[optind]);
printf("flag1 = %d\n", flag1);
printf("flag2 = %d\n", flag2);
printf("foo_flag = %d\n", foo_flag);
printf("bar_int = %d\n", bar_int);
printf("baz_flag = %s\n", baz_string);
arg_printusage (args, 5, argv[0], "nothing here");
}
#endif
-76
View File
@@ -1,76 +0,0 @@
/*
* Copyright (c) 1997 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: getarg.h,v 1.5 1998/08/18 20:26:11 assar Exp $ */
#ifndef __GETARG_H__
#define __GETARG_H__
#include <stddef.h>
#define max(a,b) (((a)>(b))?(a):(b))
struct getargs{
const char *long_name;
char short_name;
enum { arg_integer, arg_string, arg_flag, arg_negative_flag, arg_strings } type;
void *value;
const char *help;
const char *arg_help;
};
enum {
ARG_ERR_NO_MATCH = 1,
ARG_ERR_BAD_ARG,
ARG_ERR_NO_ARG
};
typedef struct getarg_strings {
int num_strings;
char **strings;
} getarg_strings;
int getarg(struct getargs *args, size_t num_args,
int argc, char **argv, int *optind);
void arg_printusage (struct getargs *args,
size_t num_args,
const char *progname,
const char *extra_string);
#endif /* __GETARG_H__ */
-129
View File
@@ -1,129 +0,0 @@
%{
/*
* Copyright (c) 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* This is to handle the definition of this symbol in some AIX
* headers, which will conflict with the definition that lex will
* generate for it. It's only a problem for AIX lex.
*/
#undef ECHO
#include "compile_et.h"
#include "parse.h"
#if 0
RCSID("$Id: lex.l,v 1.4 1998/11/20 05:58:52 assar Exp $");
#endif
static unsigned lineno = 1;
void error_message(char *, ...);
int getstring(void);
%}
%%
et { return ET; }
error_table { return ET; }
ec { return EC; }
error_code { return EC; }
prefix { return PREFIX; }
index { return INDEX; }
id { return ID; }
end { return END; }
[0-9]+ { yylval.number = atoi(yytext); return NUMBER; }
#[^\n]* ;
[ \t] ;
\n { lineno++; }
\" { return getstring(); }
[a-zA-Z0-9_]+ { yylval.string = strdup(yytext); return STRING; }
. { return *yytext; }
%%
#ifndef yywrap /* XXX */
int
yywrap ()
{
return 1;
}
#endif
int
getstring(void)
{
char x[128];
int i = 0;
int c;
int quote = 0;
while((c = input()) != EOF){
if(quote) {
x[i++] = c;
quote = 0;
continue;
}
if(c == '\n'){
error_message("unterminated string");
lineno++;
break;
}
if(c == '\\'){
quote++;
continue;
}
if(c == '\"')
break;
x[i++] = c;
}
x[i] = '\0';
yylval.string = strdup(x);
return STRING;
}
void
error_message (char *format, ...)
{
va_list args;
va_start (args, format);
fprintf (stderr, "%s:%d:", filename, lineno);
vfprintf (stderr, format, args);
va_end (args);
numerror++;
}
-173
View File
@@ -1,173 +0,0 @@
%{
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "compile_et.h"
#if 0
RCSID("$Id: parse.y,v 1.9 1999/07/04 14:54:58 assar Exp $");
#endif
void yyerror (char *s);
long name2number(const char *str);
void error_message(char *, ...);
extern char *yytext;
/* This is for bison */
#if !defined(alloca) && !defined(HAVE_ALLOCA)
#define alloca(x) malloc(x)
#endif
%}
%union {
char *string;
int number;
}
%token ET INDEX PREFIX EC ID END
%token <string> STRING
%token <number> NUMBER
%%
file : /* */
| header statements
;
header : id et
| et
;
id : ID STRING
{
id_str = $2;
}
;
et : ET STRING
{
base = name2number($2);
strncpy(name, $2, sizeof(name));
name[sizeof(name) - 1] = '\0';
free($2);
}
| ET STRING STRING
{
base = name2number($2);
strncpy(name, $3, sizeof(name));
name[sizeof(name) - 1] = '\0';
free($2);
free($3);
}
;
statements : statement
| statements statement
;
statement : INDEX NUMBER
{
number = $2;
}
| PREFIX STRING
{
prefix = realloc(prefix, strlen($2) + 2);
strcpy(prefix, $2);
strcat(prefix, "_");
free($2);
}
| PREFIX
{
prefix = realloc(prefix, 1);
*prefix = '\0';
}
| EC STRING ',' STRING
{
struct error_code *ec = malloc(sizeof(*ec));
ec->next = NULL;
ec->number = number;
if(prefix && *prefix != '\0') {
asprintf (&ec->name, "%s%s", prefix, $2);
free($2);
} else
ec->name = $2;
ec->string = $4;
APPEND(codes, ec);
number++;
}
| END
{
YYACCEPT;
}
;
%%
long
name2number(const char *str)
{
const char *p;
long base = 0;
const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789_";
if(strlen(str) > 4) {
yyerror("table name too long");
return 0;
}
for(p = str; *p; p++){
char *q = strchr(x, *p);
if(q == NULL) {
yyerror("invalid character in table name");
return 0;
}
base = (base << 6) + (q - x) + 1;
}
base <<= 8;
if(base > 0x7fffffff)
base = -(0xffffffff - base + 1);
return base;
}
void
yyerror (char *s)
{
error_message ("%s\n", s);
}
-44
View File
@@ -1,44 +0,0 @@
/*
* Copyright (c) 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Kungliga Tekniska
* Högskolan and its contributors.
*
* 4. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: roken_rename.h,v 1.2 1999/03/11 18:14:53 bg Exp $ */
#ifndef __roken_rename_h__
#define __roken_rename_h__
#endif /* __roken_rename_h__ */
-9
View File
@@ -1,9 +0,0 @@
dnl $Id: acinclude.m4,v 1.2 1999/03/01 13:06:21 joda Exp $
dnl
dnl Only put things that for some reason can't live in the `cf'
dnl directory in this file.
dnl
dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
dnl
define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
@@ -1,89 +0,0 @@
# $Id: Makefile.in,v 1.27 1999/03/10 19:01:10 joda Exp $
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
top_builddir = ../..
CC = @CC@
LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
DEFS = @DEFS@
CFLAGS = @CFLAGS@ $(WFLAGS)
WFLAGS = @WFLAGS@
LD_FLAGS= @LD_FLAGS@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LIBROKEN = -L../../lib/roken -lroken
LIBS = @KRB_KAFS_LIB@ -L../../lib/krb -lkrb -L../../lib/des -ldes $(LIBROKEN) @LIBS@ $(LIBROKEN)
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
libexecdir = @libexecdir@
bindir = @bindir@
transform=@program_transform_name@
EXECSUFFIX=@EXECSUFFIX@
PROG_BIN = pagsh$(EXECSUFFIX) \
afslog$(EXECSUFFIX) \
kstring2key$(EXECSUFFIX)
PROG_LIBEXEC =
PROGS = $(PROG_BIN) $(PROG_LIBEXEC)
SOURCES = pagsh.c aklog.c kstring2key.c
OBJECTS = pagsh.o aklog.o kstring2key.o
all: $(PROGS)
Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
$(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
install: all
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
for x in $(PROG_BIN); do \
$(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
done
uninstall:
for x in $(PROG_BIN); do \
rm -f $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
done
TAGS: $(SOURCES)
etags $(SOURCES)
check:
clean:
rm -f *.a *.o $(PROGS)
mostlyclean: clean
distclean: clean
rm -f Makefile *.tab.c *~
realclean: distclean
rm -f TAGS
pagsh$(EXECSUFFIX): pagsh.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ pagsh.o $(LIBS)
afslog$(EXECSUFFIX): aklog.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ aklog.o $(LIBS)
kstring2key$(EXECSUFFIX): kstring2key.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ kstring2key.o $(LIBS)
$(OBJECTS): ../../include/config.h
.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
-234
View File
@@ -1,234 +0,0 @@
/*
* Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <err.h>
#include <krb.h>
#include <kafs.h>
#include <roken.h>
RCSID("$Id: aklog.c,v 1.24 1999/12/02 16:58:28 joda Exp $");
static int debug = 0;
static void
DEBUG(const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
;
static void
DEBUG(const char *fmt, ...)
{
va_list ap;
if (debug) {
va_start(ap, fmt);
vwarnx(fmt, ap);
va_end(ap);
}
}
static char *
expand_cell_name(char *cell)
{
FILE *f;
static char buf[128];
char *p;
f = fopen(_PATH_CELLSERVDB, "r");
if(f == NULL)
return cell;
while(fgets(buf, sizeof(buf), f) != NULL) {
if(buf[0] == '>') {
for(p=buf; *p && !isspace(*p) && *p != '#'; p++)
;
*p = '\0';
if(strstr(buf, cell)){
fclose(f);
return buf + 1;
}
}
buf[0] = 0;
}
fclose(f);
return cell;
}
static int
createuser (char *cell)
{
char cellbuf[64];
char name[ANAME_SZ];
char instance[INST_SZ];
char realm[REALM_SZ];
char cmd[1024];
if (cell == NULL) {
FILE *f;
int len;
f = fopen (_PATH_THISCELL, "r");
if (f == NULL)
err (1, "open(%s)", _PATH_THISCELL);
if (fgets (cellbuf, sizeof(cellbuf), f) == NULL)
err (1, "read cellname from %s", _PATH_THISCELL);
fclose (f);
len = strlen(cellbuf);
if (cellbuf[len-1] == '\n')
cellbuf[len-1] = '\0';
cell = cellbuf;
}
if(krb_get_default_principal(name, instance, realm))
errx (1, "Could not even figure out who you are");
snprintf (cmd, sizeof(cmd),
"pts createuser %s%s%s@%s -cell %s",
name, *instance ? "." : "", instance, strlwr(realm),
cell);
DEBUG("Executing %s", cmd);
return system(cmd);
}
int
main(int argc, char **argv)
{
int i;
int do_aklog = -1;
int do_createuser = -1;
char *cell = NULL;
char *realm = NULL;
char cellbuf[64];
set_progname (argv[0]);
if(!k_hasafs())
exit(1);
for(i = 1; i < argc; i++){
if(!strncmp(argv[i], "-createuser", 11)){
do_createuser = do_aklog = 1;
}else if(!strncmp(argv[i], "-c", 2) && i + 1 < argc){
cell = expand_cell_name(argv[++i]);
do_aklog = 1;
}else if(!strncmp(argv[i], "-k", 2) && i + 1 < argc){
realm = argv[++i];
}else if(!strncmp(argv[i], "-p", 2) && i + 1 < argc){
if(k_afs_cell_of_file(argv[++i], cellbuf, sizeof(cellbuf)))
errx (1, "No cell found for file \"%s\".", argv[i]);
else
cell = cellbuf;
do_aklog = 1;
}else if(!strncmp(argv[i], "-unlog", 6)){
exit(k_unlog());
}else if(!strncmp(argv[i], "-hosts", 6)){
warnx ("Argument -hosts is not implemented.");
}else if(!strncmp(argv[i], "-zsubs", 6)){
warnx("Argument -zsubs is not implemented.");
}else if(!strncmp(argv[i], "-noprdb", 6)){
warnx("Argument -noprdb is not implemented.");
}else if(!strncmp(argv[i], "-d", 6)){
debug = 1;
}else{
if(!strcmp(argv[i], ".") ||
!strcmp(argv[i], "..") ||
strchr(argv[i], '/')){
DEBUG("I guess that \"%s\" is a filename.", argv[i]);
if(k_afs_cell_of_file(argv[i], cellbuf, sizeof(cellbuf)))
errx (1, "No cell found for file \"%s\".", argv[i]);
else {
cell = cellbuf;
DEBUG("The file \"%s\" lives in cell \"%s\".", argv[i], cell);
}
}else{
cell = expand_cell_name(argv[i]);
DEBUG("I guess that %s is cell %s.", argv[i], cell);
}
do_aklog = 1;
}
if(do_aklog == 1){
do_aklog = 0;
if(krb_afslog(cell, realm))
errx (1, "Failed getting tokens for cell %s in realm %s.",
cell?cell:"(local cell)", realm?realm:"(local realm)");
}
if(do_createuser == 1) {
do_createuser = 0;
if(createuser(cell))
errx (1, "Failed creating user in cell %s", cell?cell:"(local cell)");
}
}
if(do_aklog == -1 && do_createuser == -1 && krb_afslog(0, realm))
errx (1, "Failed getting tokens for cell %s in realm %s.",
cell?cell:"(local cell)", realm?realm:"(local realm)");
return 0;
}
@@ -1,138 +0,0 @@
/*
* Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $FreeBSD$ */
#include "config.h"
RCSID("$Id: kstring2key.c,v 1.16 1999/12/02 16:58:28 joda Exp $");
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <err.h>
#include <roken.h>
#include <openssl/des.h>
#include <krb.h>
#define VERIFY 0
static void
usage(void)
{
fprintf(stderr,
"Usage: %s [-c AFS cellname] [ -5 krb5salt ] [ password ]\n",
__progname);
fprintf(stderr,
" krb5salt is realmname APPEND principal APPEND instance\n");
exit(1);
}
static
void
krb5_string_to_key(char *str,
char *salt,
des_cblock *key)
{
char *foo;
asprintf(&foo, "%s%s", str, salt);
if (foo == NULL)
errx (1, "malloc: out of memory");
des_string_to_key(foo, key);
free (foo);
}
int
main(int argc, char **argv)
{
des_cblock key;
char buf[1024];
char *cellname = 0, *salt = 0;
set_progname (argv[0]);
if (argc >= 3 && argv[1][0] == '-' && argv[1][1] == 'c')
{
cellname = argv[2];
argv += 2;
argc -= 2;
}
else if (argc >= 3 && argv[1][0] == '-' && argv[1][1] == '5')
{
salt = argv[2];
argv += 2;
argc -= 2;
}
if (argc >= 2 && argv[1][0] == '-')
usage();
switch (argc) {
case 1:
if (des_read_pw_string(buf, sizeof(buf)-1, "password: ", VERIFY))
errx (1, "Error reading password.");
break;
case 2:
strlcpy(buf, argv[1], sizeof(buf));
break;
default:
usage();
break;
}
if (cellname != 0)
afs_string_to_key(buf, cellname, &key);
else if (salt != 0)
krb5_string_to_key(buf, salt, &key);
else
des_string_to_key(buf, &key);
{
int j;
unsigned char *tkey = (unsigned char *) &key;
printf("ascii = ");
for(j = 0; j < 8; j++)
if(tkey[j] != '\\' && isalpha(tkey[j]) != 0)
printf("%c", tkey[j]);
else
printf("\\%03o",(unsigned char)tkey[j]);
printf("\n");
printf("hex = ");
for(j = 0; j < 8; j++)
printf("%02x",(unsigned char)tkey[j]);
printf("\n");
}
exit(0);
}
-136
View File
@@ -1,136 +0,0 @@
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
RCSID("$Id: pagsh.c,v 1.22 1999/12/02 16:58:28 joda Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <time.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <err.h>
#include <roken.h>
#include <krb.h>
#include <kafs.h>
int
main(int argc, char **argv)
{
int f;
char tf[1024];
char *p;
char *path;
char **args;
int i;
do {
snprintf(tf, sizeof(tf), "%s%u_%u", TKT_ROOT, (unsigned int)getuid(),
(unsigned int)(getpid()*time(0)));
f = open(tf, O_CREAT|O_EXCL|O_RDWR);
} while(f < 0);
close(f);
unlink(tf);
setenv("KRBTKFILE", tf, 1);
i = 0;
args = (char **) malloc((argc + 10)*sizeof(char *));
if (args == NULL)
errx (1, "Out of memory allocating %lu bytes",
(unsigned long)((argc + 10)*sizeof(char *)));
argv++;
if(*argv == NULL) {
path = getenv("SHELL");
if(path == NULL){
struct passwd *pw = k_getpwuid(geteuid());
path = strdup(pw->pw_shell);
}
} else {
if(strcmp(*argv, "-c") == 0) argv++;
path = strdup(*argv++);
}
if (path == NULL)
errx (1, "Out of memory copying path");
p=strrchr(path, '/');
if(p)
args[i] = strdup(p+1);
else
args[i] = strdup(path);
if (args[i++] == NULL)
errx (1, "Out of memory copying arguments");
while(*argv)
args[i++] = *argv++;
args[i++] = NULL;
if(k_hasafs())
k_setpag();
execvp(path, args);
if (errno == ENOENT) {
char **sh_args = malloc ((i + 2) * sizeof(char *));
int j;
if (sh_args == NULL)
errx (1, "Out of memory copying sh arguments");
for (j = 1; j < i; ++j)
sh_args[j + 2] = args[j];
sh_args[0] = "sh";
sh_args[1] = "-c";
sh_args[2] = path;
execv ("/bin/sh", sh_args);
}
perror("execvp");
exit(1);
}
-79
View File
@@ -1,79 +0,0 @@
/*
* Copyright (c) 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "bsd_locl.h"
RCSID("$Id: osfc2.c,v 1.2 1999/12/02 16:58:28 joda Exp $");
int
do_osfc2_magic(uid_t uid)
{
#ifdef HAVE_OSFC2
struct es_passwd *epw;
char *argv[2];
/* fake */
argv[0] = (char*)__progname;
argv[1] = NULL;
set_auth_parameters(1, argv);
epw = getespwuid(uid);
if(epw == NULL) {
syslog(LOG_AUTHPRIV|LOG_NOTICE,
"getespwuid failed for %d", uid);
printf("Sorry.\n");
return 1;
}
/* We don't check for auto-retired, foo-retired,
bar-retired, or any other kind of retired accounts
here; neither do we check for time-locked accounts, or
any other kind of serious C2 mumbo-jumbo. We do,
however, call setluid, since failing to do so it not
very good (take my word for it). */
if(!epw->uflg->fg_uid) {
syslog(LOG_AUTHPRIV|LOG_NOTICE,
"attempted login by %s (has no uid)", epw->ufld->fd_name);
printf("Sorry.\n");
return 1;
}
setluid(epw->ufld->fd_uid);
if(getluid() != epw->ufld->fd_uid) {
syslog(LOG_AUTHPRIV|LOG_NOTICE,
"failed to set LUID for %s (%d)",
epw->ufld->fd_name, epw->ufld->fd_uid);
printf("Sorry.\n");
return 1;
}
#endif /* HAVE_OSFC2 */
return 0;
}
-376
View File
@@ -1,376 +0,0 @@
1999-11-30 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (getdatasock): make sure to keep the port-number of
the outgoing connections. It has to be `ftp-data' or some people
might get upset.
* ftpd/ftpd.c (args): set correct variable when `-l' so that
logging actually works
1999-11-29 Assar Westerlund <[email protected]>
* ftp/security.c (sec_login): check return value from realloc
(sec_end): set app_data to NULL
1999-11-25 Assar Westerlund <[email protected]>
* ftp/krb4.c (krb4_auth): obtain the `local' address when doing
NAT. also turn on passive mode. From <[email protected]>
1999-11-20 Assar Westerlund <[email protected]>
* ftpd/ls.c (make_fileinfo): cast to allow for non-const
prototypes of readlink
1999-11-12 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (args): use arg_counter for `l'
1999-11-04 Assar Westerlund <[email protected]>
* ftpd/ls.c (S_ISSOCK, S_ISLNK): fallback definitions for systems
that don't have them (such as ultrix)
1999-10-29 Assar Westerlund <[email protected]>
* ftpd/ls.c (make_fileinfo): cast uid's and gid's to unsigned in
printf, we don't know what types they might be.
(lstat_file): conditionalize the kafs part on KRB4
* ftpd/ftpd_locl.h: <sys/ioccom.h> is needed for kafs.h
1999-10-28 Assar Westerlund <[email protected]>
* ftpd/ls.c (lstat_file): don't set st_mode, it should already be
correct
* ftpd/ls.c: don't use warnx to print errors
* ftpd/ls.c (builtin_ls): fix typo, 'd' shouldn't imply 'f'
* ftpd/ls.c (lstat_file): new function for avoiding stating AFS
mount points. From Love <[email protected]>
(list_files): use `lstat_file'
* ftpd/ftpd.c: some const-poisoning
* ftpd/ftpd.c (args): add `-B' as an alias for `--builtin-ls' to
allow for stupid inetds that only support two arguments. From
Love <[email protected]>
1999-10-26 Assar Westerlund <[email protected]>
* ftpd/ftpcmd.y (help): it's unnecessary to interpret help strings
as printf commands
* ftpd/ftpd.c (show_issue): don't interpret contents of
/etc/issue* as printf commands. From Brian A May
<[email protected]>
1999-10-21 Johan Danielsson <[email protected]>
* ftpd/kauth.c (kauth): complain if protection level isn't
`private'
* ftp/krb4.c (krb4_decode): syslog failure reason
* ftp/kauth.c (kauth): set private level earlier
* ftp/security.c: get_command_prot; (sec_prot): partially match
`command' and `data'
1999-10-18 Johan Danielsson <[email protected]>
* ftpd/ftpd.c: change `-l' flag to use arg_collect (this makes
`-ll' work again)
* ftpd/ftpd.c (list_file): pass filename to ls
1999-10-04 Johan Danielsson <[email protected]>
* ftpd/ftpcmd.y: FEAT
1999-10-03 Assar Westerlund <[email protected]>
* ftpd/ls.c: fall-back definitions for constans and casts for
printfs
1999-10-03 Johan Danielsson <[email protected]>
* ftpd/ftpd.c (main): make this use getarg; add `list_file'
* ftpd/ftpcmd.y (LIST): call list_file
* ftpd/ls.c: add simple built-in ls
* ftp/security.c: add `sec_vfprintf2' and `sec_fprintf2' that
prints to the data stream
* ftp/kauth.c (kauth): make sure we're using private protection
level
* ftp/security.c (set_command_prot): set command protection level
* ftp/security.c: make it possible to set the command protection
level with `prot'
1999-09-30 Assar Westerlund <[email protected]>
* ftpd/ftpd_locl.h: add prototype for fclose to make sunos happy
1999-08-19 Johan Danielsson <[email protected]>
* ftpd/ftpd.c (do_login): show issue-file
(send_data): change handling of zero-byte files
1999-08-18 Assar Westerlund <[email protected]>
* ftp/cmds.c (getit): be more suspicious when parsing the result
of MDTM. Do the comparison of timestamps correctly.
1999-08-13 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (send_data): avoid calling mmap with `len == 0'.
Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
get grumpy later.
* ftp/ftp.c (copy_stream): avoid calling mmap with `len == 0'.
Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
get grumpy later.
1999-08-03 Assar Westerlund <[email protected]>
* ftp/ftp.c (active_mode): hide failure of EPRT by setting verbose
* ftp/gssapi.c (gss_auth): initialize application_data in bindings
1999-08-02 Assar Westerlund <[email protected]>
* ftpd/ftpcmd.y: save file names when doing commands that might
get aborted (and longjmp:ed out of) to avoid overwriting them also
remove extra closing brace
1999-08-01 Johan Danielsson <[email protected]>
* ftpd/ftpcmd.y: change `site find' to `site locate' (to match
what it does, and other implementations) keep find as an alias
1999-07-28 Assar Westerlund <[email protected]>
* common/socket.c: moved to roken
* common/socket.c: new file with generic socket functions
* ftpd/ftpd.c: make it more AF-neutral and v6-capable
* ftpd/ftpcmd.y: add EPRT and EPSV
* ftpd/extern.h: update prototypes and variables
* ftp/krb4.c: update to new types of addresses
* ftp/gssapi.c: add support for both AF_INET and AF_INET6
addresses
* ftp/ftp.c: make it more AF-neutral and v6-capable
* ftp/extern.h (hookup): change prototype
* common/common.h: add prototypes for functions in socket.c
* common/Makefile.am (libcommon_a_SOURCES): add socket.c
* ftp/gssapi.c (gss_auth): check return value from
`gss_import_name' and print error messages if it fails
1999-06-15 Assar Westerlund <[email protected]>
* ftp/krb4.c (krb4_auth): type correctness
1999-06-02 Johan Danielsson <[email protected]>
* ftp/ftp.c (sendrequest): lmode != rmode
1999-05-21 Assar Westerlund <[email protected]>
* ftp/extern.h (sendrequest): update prototype
* ftp/cmds.c: update calls to sendrequest and recvrequest to send
"b" when appropriate
* ftp/ftp.c (sendrequest): add argument for mode to open file in.
1999-05-08 Assar Westerlund <[email protected]>
* ftpd/ftpcmd.y: rename getline -> ftpd_getline
* ftp/main.c (makeargv): fill in unused slots with NULL
Thu Apr 8 15:06:40 1999 Johan Danielsson <[email protected]>
* ftpd/ftpd.c: remove definition of KRB_VERIFY_USER (moved to
config.h)
Wed Apr 7 16:15:21 1999 Johan Danielsson <[email protected]>
* ftp/gssapi.c (gss_auth): call gss_display_status to get a sane
error message; return AUTH_{CONTINUE,ERROR}, where appropriate
* ftp/krb4.c: return AUTH_{CONTINUE,ERROR}, where appropriate
* ftp/security.c (sec_login): if mechanism returns AUTH_CONTINUE,
just continue with the next mechanism, this fixes the case of
having GSSAPI fail because of non-existant of expired tickets
* ftp/security.h: add AUTH_{OK,CONTINUE,ERROR}
Thu Apr 1 16:59:04 1999 Johan Danielsson <[email protected]>
* ftpd/Makefile.am: don't run check-local
* ftp/Makefile.am: don't run check-local
Mon Mar 22 22:15:18 1999 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (pass): fall-back for KRB_VERIFY_SECURE
* ftpd/ftpd.c (pass): 1 -> KRB_VERIFY_SECURE
Thu Mar 18 12:07:09 1999 Johan Danielsson <[email protected]>
* ftpd/Makefile.am: clean ftpcmd.c
* ftpd/ftpd_locl.h: remove krb5.h (breaks in ftpcmd.y)
* ftpd/ftpd.c: move include of krb5.h here
* ftpd/Makefile.am: include Makefile.am.common
* Makefile.am: include Makefile.am.common
* ftp/Makefile.am: include Makefile.am.common
* common/Makefile.am: include Makefile.am.common
Tue Mar 16 22:28:37 1999 Assar Westerlund <[email protected]>
* ftpd/ftpd_locl.h: add krb5.h to get heimdal_version
* ftpd/ftpd.c: krb_verify_user_multiple -> krb_verify_user
Thu Mar 11 14:54:59 1999 Johan Danielsson <[email protected]>
* ftp/Makefile.in: WFLAGS
* ftp/ruserpass.c: add some if-braces
Wed Mar 10 20:02:55 1999 Johan Danielsson <[email protected]>
* ftpd/ftpd_locl.h: remove ifdef HAVE_FNMATCH
Mon Mar 8 21:29:24 1999 Johan Danielsson <[email protected]>
* ftpd/ftpd.c: re-add version in greeting message
Mon Mar 1 10:49:38 1999 Johan Danielsson <[email protected]>
* ftpd/logwtmp.c: HAVE_UT_* -> HAVE_STRUCT_UTMP*_UT_*
Mon Feb 22 19:20:51 1999 Johan Danielsson <[email protected]>
* common/Makefile.in: remove glob
Sat Feb 13 17:19:35 1999 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (match): remove #ifdef HAVE_FNMATCH. We have a
fnmatch implementation in roken and therefore always have it.
* ftp/ftp.c (copy_stream): initialize `werr'
Wed Jan 13 23:52:57 1999 Assar Westerlund <[email protected]>
* ftpd/ftpcmd.y: moved all check_login and check_login_no_guest to
the end of the rules to ensure we don't generate several
(independent) error messages. once again, having a yacc-grammar
for FTP with embedded actions doesn't strike me as the most
optimal way of doing it.
Tue Dec 1 14:44:29 1998 Johan Danielsson <[email protected]>
* ftpd/Makefile.am: link with extra libs for aix
Sun Nov 22 10:28:20 1998 Assar Westerlund <[email protected]>
* ftpd/ftpd.c (retrying): support on-the-fly decompression
* ftpd/Makefile.in (WFLAGS): set
* ftp/ruserpass.c (guess_domain): new function
(ruserpass): use it
* common/Makefile.in (WFLAGS): set
* Makefile.in (WFLAGS): set
Sat Nov 21 23:13:03 1998 Assar Westerlund <[email protected]>
* ftp/security.c: some more type correctness.
* ftp/gssapi.c (gss_adat): more braces to shut up warnings
Wed Nov 18 21:47:55 1998 Assar Westerlund <[email protected]>
* ftp/main.c (main): new option `-p' for enable passive mode.
Mon Nov 2 01:57:49 1998 Assar Westerlund <[email protected]>
* ftp/ftp.c (getreply): remove extra `break'
* ftp/gssapi.c (gss_auth): fixo typo(copyo?)
* ftp/security.c (sec_login): fix loop and return value
Tue Sep 1 16:56:42 1998 Johan Danielsson <[email protected]>
* ftp/cmds.c (quote1): fix % quoting bug
Fri Aug 14 17:10:06 1998 Johan Danielsson <[email protected]>
* ftp/krb4.c: krb_put_int -> KRB_PUT_INT
Tue Jun 30 18:07:15 1998 Assar Westerlund <[email protected]>
* ftp/security.c (auth): free `app_data'
(sec_end): only destroy if it was initialized
Tue Jun 9 21:01:59 1998 Johan Danielsson <[email protected]>
* ftp/krb4.c: pass client address to krb_rd_req
Sat May 16 00:02:07 1998 Assar Westerlund <[email protected]>
* ftpd/Makefile.am: link with DBLIB
Tue May 12 14:15:32 1998 Johan Danielsson <[email protected]>
* ftp/gssapi.c: Save client name for userok().
* ftpd/gss_userok.c: Userok for gssapi.
Fri May 1 07:15:01 1998 Assar Westerlund <[email protected]>
* ftp/ftp.c: unifdef -DHAVE_H_ERRNO
Fri Mar 27 00:46:07 1998 Johan Danielsson <[email protected]>
* Make compile w/o krb4.
Thu Mar 26 03:49:12 1998 Johan Danielsson <[email protected]>
* ftp/*, ftpd/*: Changes for new framework.
* ftp/gssapi.c: GSS-API backend for the new security framework.
* ftp/krb4.c: Updated for new framework.
* ftp/security.{c,h}: New unified security framework.
-5
View File
@@ -1,5 +0,0 @@
# $Id: Makefile.am,v 1.5 1999/03/20 13:58:14 joda Exp $
include $(top_srcdir)/Makefile.am.common
SUBDIRS = common ftp ftpd
@@ -1,12 +0,0 @@
# $Id: Makefile.am,v 1.9 1999/07/28 21:15:06 assar Exp $
include $(top_srcdir)/Makefile.am.common
INCLUDES += $(INCLUDE_krb4)
noinst_LIBRARIES = libcommon.a
libcommon_a_SOURCES = \
sockbuf.c \
buffer.c \
common.h
@@ -1,44 +0,0 @@
# $Id: Makefile.am,v 1.12 1999/04/09 18:22:08 assar Exp $
include $(top_srcdir)/Makefile.am.common
INCLUDES += -I$(srcdir)/../common $(INCLUDE_readline) $(INCLUDE_krb4)
bin_PROGRAMS = ftp
CHECK_LOCAL =
if KRB4
krb4_sources = krb4.c kauth.c
endif
if KRB5
krb5_sources = gssapi.c
endif
ftp_SOURCES = \
cmds.c \
cmdtab.c \
extern.h \
ftp.c \
ftp_locl.h \
ftp_var.h \
main.c \
pathnames.h \
ruserpass.c \
domacro.c \
globals.c \
security.c \
security.h \
$(krb4_sources) \
$(krb5_sources)
EXTRA_ftp_SOURCES = krb4.c kauth.c gssapi.c
LDADD = \
../common/libcommon.a \
$(LIB_gssapi) \
$(LIB_krb5) \
$(LIB_krb4) \
$(top_builddir)/lib/des/libdes.la \
$(LIB_roken) \
$(LIB_readline)
-379
View File
@@ -1,379 +0,0 @@
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef FTP_SERVER
#include "ftpd_locl.h"
#else
#include "ftp_locl.h"
#endif
#include <gssapi.h>
RCSID("$Id: gssapi.c,v 1.13 1999/12/02 16:58:29 joda Exp $");
struct gss_data {
gss_ctx_id_t context_hdl;
char *client_name;
};
static int
gss_init(void *app_data)
{
struct gss_data *d = app_data;
d->context_hdl = GSS_C_NO_CONTEXT;
return 0;
}
static int
gss_check_prot(void *app_data, int level)
{
if(level == prot_confidential)
return -1;
return 0;
}
static int
gss_decode(void *app_data, void *buf, int len, int level)
{
OM_uint32 maj_stat, min_stat;
gss_buffer_desc input, output;
gss_qop_t qop_state;
int conf_state;
struct gss_data *d = app_data;
input.length = len;
input.value = buf;
maj_stat = gss_unwrap (&min_stat,
d->context_hdl,
&input,
&output,
&conf_state,
&qop_state);
if(GSS_ERROR(maj_stat))
return -1;
memmove(buf, output.value, output.length);
return output.length;
}
static int
gss_overhead(void *app_data, int level, int len)
{
return 100; /* dunno? */
}
static int
gss_encode(void *app_data, void *from, int length, int level, void **to)
{
OM_uint32 maj_stat, min_stat;
gss_buffer_desc input, output;
int conf_state;
struct gss_data *d = app_data;
input.length = length;
input.value = from;
maj_stat = gss_wrap (&min_stat,
d->context_hdl,
level == prot_private,
GSS_C_QOP_DEFAULT,
&input,
&conf_state,
&output);
*to = output.value;
return output.length;
}
static void
sockaddr_to_gss_address (const struct sockaddr *sa,
OM_uint32 *addr_type,
gss_buffer_desc *gss_addr)
{
switch (sa->sa_family) {
#ifdef HAVE_IPV6
case AF_INET6 : {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
gss_addr->length = 16;
gss_addr->value = &sin6->sin6_addr;
*addr_type = GSS_C_AF_INET6;
break;
}
#endif
case AF_INET : {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
gss_addr->length = 4;
gss_addr->value = &sin->sin_addr;
*addr_type = GSS_C_AF_INET;
break;
}
default :
errx (1, "unknown address family %d", sa->sa_family);
}
}
/* end common stuff */
#ifdef FTP_SERVER
static int
gss_adat(void *app_data, void *buf, size_t len)
{
char *p = NULL;
gss_buffer_desc input_token, output_token;
OM_uint32 maj_stat, min_stat;
gss_name_t client_name;
struct gss_data *d = app_data;
gss_channel_bindings_t bindings = malloc(sizeof(*bindings));
sockaddr_to_gss_address (his_addr,
&bindings->initiator_addrtype,
&bindings->initiator_address);
sockaddr_to_gss_address (ctrl_addr,
&bindings->acceptor_addrtype,
&bindings->acceptor_address);
bindings->application_data.length = 0;
bindings->application_data.value = NULL;
input_token.value = buf;
input_token.length = len;
maj_stat = gss_accept_sec_context (&min_stat,
&d->context_hdl,
GSS_C_NO_CREDENTIAL,
&input_token,
bindings,
&client_name,
NULL,
&output_token,
NULL,
NULL,
NULL);
if(output_token.length) {
if(base64_encode(output_token.value, output_token.length, &p) < 0) {
reply(535, "Out of memory base64-encoding.");
return -1;
}
}
if(maj_stat == GSS_S_COMPLETE){
char *name;
gss_buffer_desc export_name;
maj_stat = gss_export_name(&min_stat, client_name, &export_name);
if(maj_stat != 0) {
reply(500, "Error exporting name");
goto out;
}
name = realloc(export_name.value, export_name.length + 1);
if(name == NULL) {
reply(500, "Out of memory");
free(export_name.value);
goto out;
}
name[export_name.length] = '\0';
d->client_name = name;
if(p)
reply(235, "ADAT=%s", p);
else
reply(235, "ADAT Complete");
sec_complete = 1;
} else if(maj_stat == GSS_S_CONTINUE_NEEDED) {
if(p)
reply(335, "ADAT=%s", p);
else
reply(335, "OK, need more data");
} else
reply(535, "foo?");
out:
free(p);
return 0;
}
int gss_userok(void*, char*);
struct sec_server_mech gss_server_mech = {
"GSSAPI",
sizeof(struct gss_data),
gss_init, /* init */
NULL, /* end */
gss_check_prot,
gss_overhead,
gss_encode,
gss_decode,
/* */
NULL,
gss_adat,
NULL, /* pbsz */
NULL, /* ccc */
gss_userok
};
#else /* FTP_SERVER */
extern struct sockaddr *hisctladdr, *myctladdr;
static int
gss_auth(void *app_data, char *host)
{
OM_uint32 maj_stat, min_stat;
gss_buffer_desc name;
gss_name_t target_name;
gss_buffer_desc input, output_token;
int context_established = 0;
char *p;
int n;
gss_channel_bindings_t bindings;
struct gss_data *d = app_data;
name.length = asprintf((char**)&name.value, "ftp@%s", host);
maj_stat = gss_import_name(&min_stat,
&name,
GSS_C_NT_HOSTBASED_SERVICE,
&target_name);
if (GSS_ERROR(maj_stat)) {
OM_uint32 new_stat;
OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string;
gss_display_status(&new_stat,
min_stat,
GSS_C_MECH_CODE,
GSS_C_NO_OID,
&msg_ctx,
&status_string);
printf("Error importing name %s: %s\n",
(char *)name.value,
(char *)status_string.value);
gss_release_buffer(&new_stat, &status_string);
return AUTH_ERROR;
}
free(name.value);
input.length = 0;
input.value = NULL;
bindings = malloc(sizeof(*bindings));
sockaddr_to_gss_address (myctladdr,
&bindings->initiator_addrtype,
&bindings->initiator_address);
sockaddr_to_gss_address (hisctladdr,
&bindings->acceptor_addrtype,
&bindings->acceptor_address);
bindings->application_data.length = 0;
bindings->application_data.value = NULL;
while(!context_established) {
maj_stat = gss_init_sec_context(&min_stat,
GSS_C_NO_CREDENTIAL,
&d->context_hdl,
target_name,
GSS_C_NO_OID,
GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG,
0,
bindings,
&input,
NULL,
&output_token,
NULL,
NULL);
if (GSS_ERROR(maj_stat)) {
OM_uint32 new_stat;
OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string;
gss_display_status(&new_stat,
min_stat,
GSS_C_MECH_CODE,
GSS_C_NO_OID,
&msg_ctx,
&status_string);
printf("Error initializing security context: %s\n",
(char*)status_string.value);
gss_release_buffer(&new_stat, &status_string);
return AUTH_CONTINUE;
}
gss_release_buffer(&min_stat, &input);
if (output_token.length != 0) {
base64_encode(output_token.value, output_token.length, &p);
gss_release_buffer(&min_stat, &output_token);
n = command("ADAT %s", p);
free(p);
}
if (GSS_ERROR(maj_stat)) {
if (d->context_hdl != GSS_C_NO_CONTEXT)
gss_delete_sec_context (&min_stat,
&d->context_hdl,
GSS_C_NO_BUFFER);
break;
}
if (maj_stat & GSS_S_CONTINUE_NEEDED) {
p = strstr(reply_string, "ADAT=");
if(p == NULL){
printf("Error: expected ADAT in reply.\n");
return AUTH_ERROR;
} else {
p+=5;
input.value = malloc(strlen(p));
input.length = base64_decode(p, input.value);
}
} else {
if(code != 235) {
printf("Unrecognized response code: %d\n", code);
return AUTH_ERROR;
}
context_established = 1;
}
}
return AUTH_OK;
}
struct sec_client_mech gss_client_mech = {
"GSSAPI",
sizeof(struct gss_data),
gss_init,
gss_auth,
NULL, /* end */
gss_check_prot,
gss_overhead,
gss_encode,
gss_decode,
};
#endif /* FTP_SERVER */
-785
View File
@@ -1,785 +0,0 @@
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef FTP_SERVER
#include "ftpd_locl.h"
#else
#include "ftp_locl.h"
#endif
RCSID("$Id: security.c,v 1.15 1999/12/02 16:58:30 joda Exp $");
static enum protection_level command_prot;
static enum protection_level data_prot;
static size_t buffer_size;
struct buffer {
void *data;
size_t size;
size_t index;
int eof_flag;
};
static struct buffer in_buffer, out_buffer;
int sec_complete;
static struct {
enum protection_level level;
const char *name;
} level_names[] = {
{ prot_clear, "clear" },
{ prot_safe, "safe" },
{ prot_confidential, "confidential" },
{ prot_private, "private" }
};
static const char *
level_to_name(enum protection_level level)
{
int i;
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
if(level_names[i].level == level)
return level_names[i].name;
return "unknown";
}
#ifndef FTP_SERVER /* not used in server */
static enum protection_level
name_to_level(const char *name)
{
int i;
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
if(!strncasecmp(level_names[i].name, name, strlen(name)))
return level_names[i].level;
return (enum protection_level)-1;
}
#endif
#ifdef FTP_SERVER
static struct sec_server_mech *mechs[] = {
#ifdef KRB5
&gss_server_mech,
#endif
#ifdef KRB4
&krb4_server_mech,
#endif
NULL
};
static struct sec_server_mech *mech;
#else
static struct sec_client_mech *mechs[] = {
#ifdef KRB5
&gss_client_mech,
#endif
#ifdef KRB4
&krb4_client_mech,
#endif
NULL
};
static struct sec_client_mech *mech;
#endif
static void *app_data;
int
sec_getc(FILE *F)
{
if(sec_complete && data_prot) {
char c;
if(sec_read(fileno(F), &c, 1) <= 0)
return EOF;
return c;
} else
return getc(F);
}
static int
block_read(int fd, void *buf, size_t len)
{
unsigned char *p = buf;
int b;
while(len) {
b = read(fd, p, len);
if (b == 0)
return 0;
else if (b < 0)
return -1;
len -= b;
p += b;
}
return p - (unsigned char*)buf;
}
static int
block_write(int fd, void *buf, size_t len)
{
unsigned char *p = buf;
int b;
while(len) {
b = write(fd, p, len);
if(b < 0)
return -1;
len -= b;
p += b;
}
return p - (unsigned char*)buf;
}
static int
sec_get_data(int fd, struct buffer *buf, int level)
{
int len;
int b;
b = block_read(fd, &len, sizeof(len));
if (b == 0)
return 0;
else if (b < 0)
return -1;
len = ntohl(len);
buf->data = realloc(buf->data, len);
b = block_read(fd, buf->data, len);
if (b == 0)
return 0;
else if (b < 0)
return -1;
buf->size = (*mech->decode)(app_data, buf->data, len, data_prot);
buf->index = 0;
return 0;
}
static size_t
buffer_read(struct buffer *buf, void *data, size_t len)
{
len = min(len, buf->size - buf->index);
memcpy(data, (char*)buf->data + buf->index, len);
buf->index += len;
return len;
}
static size_t
buffer_write(struct buffer *buf, void *data, size_t len)
{
if(buf->index + len > buf->size) {
void *tmp;
if(buf->data == NULL)
tmp = malloc(1024);
else
tmp = realloc(buf->data, buf->index + len);
if(tmp == NULL)
return -1;
buf->data = tmp;
buf->size = buf->index + len;
}
memcpy((char*)buf->data + buf->index, data, len);
buf->index += len;
return len;
}
int
sec_read(int fd, void *data, int length)
{
size_t len;
int rx = 0;
if(sec_complete == 0 || data_prot == 0)
return read(fd, data, length);
if(in_buffer.eof_flag){
in_buffer.eof_flag = 0;
return 0;
}
len = buffer_read(&in_buffer, data, length);
length -= len;
rx += len;
data = (char*)data + len;
while(length){
if(sec_get_data(fd, &in_buffer, data_prot) < 0)
return -1;
if(in_buffer.size == 0) {
if(rx)
in_buffer.eof_flag = 1;
return rx;
}
len = buffer_read(&in_buffer, data, length);
length -= len;
rx += len;
data = (char*)data + len;
}
return rx;
}
static int
sec_send(int fd, char *from, int length)
{
int bytes;
void *buf;
bytes = (*mech->encode)(app_data, from, length, data_prot, &buf);
bytes = htonl(bytes);
block_write(fd, &bytes, sizeof(bytes));
block_write(fd, buf, ntohl(bytes));
free(buf);
return length;
}
int
sec_fflush(FILE *F)
{
if(data_prot != prot_clear) {
if(out_buffer.index > 0){
sec_write(fileno(F), out_buffer.data, out_buffer.index);
out_buffer.index = 0;
}
sec_send(fileno(F), NULL, 0);
}
fflush(F);
return 0;
}
int
sec_write(int fd, char *data, int length)
{
int len = buffer_size;
int tx = 0;
if(data_prot == prot_clear)
return write(fd, data, length);
len -= (*mech->overhead)(app_data, data_prot, len);
while(length){
if(length < len)
len = length;
sec_send(fd, data, len);
length -= len;
data += len;
tx += len;
}
return tx;
}
int
sec_vfprintf2(FILE *f, const char *fmt, va_list ap)
{
char *buf;
int ret;
if(data_prot == prot_clear)
return vfprintf(f, fmt, ap);
else {
vasprintf(&buf, fmt, ap);
ret = buffer_write(&out_buffer, buf, strlen(buf));
free(buf);
return ret;
}
}
int
sec_fprintf2(FILE *f, const char *fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
ret = sec_vfprintf2(f, fmt, ap);
va_end(ap);
return ret;
}
int
sec_putc(int c, FILE *F)
{
char ch = c;
if(data_prot == prot_clear)
return putc(c, F);
buffer_write(&out_buffer, &ch, 1);
if(c == '\n' || out_buffer.index >= 1024 /* XXX */) {
sec_write(fileno(F), out_buffer.data, out_buffer.index);
out_buffer.index = 0;
}
return c;
}
int
sec_read_msg(char *s, int level)
{
int len;
char *buf;
int code;
buf = malloc(strlen(s));
len = base64_decode(s + 4, buf); /* XXX */
len = (*mech->decode)(app_data, buf, len, level);
if(len < 0)
return -1;
buf[len] = '\0';
if(buf[3] == '-')
code = 0;
else
sscanf(buf, "%d", &code);
if(buf[len-1] == '\n')
buf[len-1] = '\0';
strcpy(s, buf);
free(buf);
return code;
}
int
sec_vfprintf(FILE *f, const char *fmt, va_list ap)
{
char *buf;
void *enc;
int len;
if(!sec_complete)
return vfprintf(f, fmt, ap);
vasprintf(&buf, fmt, ap);
len = (*mech->encode)(app_data, buf, strlen(buf), command_prot, &enc);
free(buf);
if(len < 0) {
printf("Failed to encode command.\n");
return -1;
}
if(base64_encode(enc, len, &buf) < 0){
printf("Out of memory base64-encoding.\n");
return -1;
}
#ifdef FTP_SERVER
if(command_prot == prot_safe)
fprintf(f, "631 %s\r\n", buf);
else if(command_prot == prot_private)
fprintf(f, "632 %s\r\n", buf);
else if(command_prot == prot_confidential)
fprintf(f, "633 %s\r\n", buf);
#else
if(command_prot == prot_safe)
fprintf(f, "MIC %s", buf);
else if(command_prot == prot_private)
fprintf(f, "ENC %s", buf);
else if(command_prot == prot_confidential)
fprintf(f, "CONF %s", buf);
#endif
free(buf);
return 0;
}
int
sec_fprintf(FILE *f, const char *fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = sec_vfprintf(f, fmt, ap);
va_end(ap);
return ret;
}
/* end common stuff */
#ifdef FTP_SERVER
void
auth(char *auth_name)
{
int i;
for(i = 0; (mech = mechs[i]) != NULL; i++){
if(!strcasecmp(auth_name, mech->name)){
app_data = realloc(app_data, mech->size);
if(mech->init && (*mech->init)(app_data) != 0) {
reply(431, "Unable to accept %s at this time", mech->name);
return;
}
if(mech->auth) {
(*mech->auth)(app_data);
return;
}
if(mech->adat)
reply(334, "Send authorization data.");
else
reply(234, "Authorization complete.");
return;
}
}
free (app_data);
reply(504, "%s is unknown to me", auth_name);
}
void
adat(char *auth_data)
{
if(mech && !sec_complete) {
void *buf = malloc(strlen(auth_data));
size_t len;
len = base64_decode(auth_data, buf);
(*mech->adat)(app_data, buf, len);
free(buf);
} else
reply(503, "You must %sissue an AUTH first.", mech ? "re-" : "");
}
void pbsz(int size)
{
size_t new = size;
if(!sec_complete)
reply(503, "Incomplete security data exchange.");
if(mech->pbsz)
new = (*mech->pbsz)(app_data, size);
if(buffer_size != new){
buffer_size = size;
}
if(new != size)
reply(200, "PBSZ=%lu", (unsigned long)new);
else
reply(200, "OK");
}
void
prot(char *pl)
{
int p = -1;
if(buffer_size == 0){
reply(503, "No protection buffer size negotiated.");
return;
}
if(!strcasecmp(pl, "C"))
p = prot_clear;
else if(!strcasecmp(pl, "S"))
p = prot_safe;
else if(!strcasecmp(pl, "E"))
p = prot_confidential;
else if(!strcasecmp(pl, "P"))
p = prot_private;
else {
reply(504, "Unrecognized protection level.");
return;
}
if(sec_complete){
if((*mech->check_prot)(app_data, p)){
reply(536, "%s does not support %s protection.",
mech->name, level_to_name(p));
}else{
data_prot = (enum protection_level)p;
reply(200, "Data protection is %s.", level_to_name(p));
}
}else{
reply(503, "Incomplete security data exchange.");
}
}
void ccc(void)
{
if(sec_complete){
if(mech->ccc && (*mech->ccc)(app_data) == 0)
command_prot = data_prot = prot_clear;
else
reply(534, "You must be joking.");
}else
reply(503, "Incomplete security data exchange.");
}
void mec(char *msg, enum protection_level level)
{
void *buf;
size_t len;
if(!sec_complete) {
reply(503, "Incomplete security data exchange.");
return;
}
buf = malloc(strlen(msg) + 2); /* XXX go figure out where that 2
comes from :-) */
len = base64_decode(msg, buf);
command_prot = level;
if(len == (size_t)-1) {
reply(501, "Failed to base64-decode command");
return;
}
len = (*mech->decode)(app_data, buf, len, level);
if(len == (size_t)-1) {
reply(535, "Failed to decode command");
return;
}
((char*)buf)[len] = '\0';
if(strstr((char*)buf, "\r\n") == NULL)
strcat((char*)buf, "\r\n");
new_ftp_command(buf);
}
/* ------------------------------------------------------------ */
int
sec_userok(char *user)
{
if(sec_complete)
return (*mech->userok)(app_data, user);
return 0;
}
char *ftp_command;
void
new_ftp_command(char *command)
{
ftp_command = command;
}
void
delete_ftp_command(void)
{
free(ftp_command);
ftp_command = NULL;
}
int
secure_command(void)
{
return ftp_command != NULL;
}
enum protection_level
get_command_prot(void)
{
return command_prot;
}
#else /* FTP_SERVER */
void
sec_status(void)
{
if(sec_complete){
printf("Using %s for authentication.\n", mech->name);
printf("Using %s command channel.\n", level_to_name(command_prot));
printf("Using %s data channel.\n", level_to_name(data_prot));
if(buffer_size > 0)
printf("Protection buffer size: %lu.\n",
(unsigned long)buffer_size);
}else{
printf("Not using any security mechanism.\n");
}
}
static int
sec_prot_internal(int level)
{
int ret;
char *p;
unsigned int s = 1048576;
int old_verbose = verbose;
verbose = 0;
if(!sec_complete){
printf("No security data exchange has taken place.\n");
return -1;
}
if(level){
ret = command("PBSZ %u", s);
if(ret != COMPLETE){
printf("Failed to set protection buffer size.\n");
return -1;
}
buffer_size = s;
p = strstr(reply_string, "PBSZ=");
if(p)
sscanf(p, "PBSZ=%u", &s);
if(s < buffer_size)
buffer_size = s;
}
verbose = old_verbose;
ret = command("PROT %c", level["CSEP"]); /* XXX :-) */
if(ret != COMPLETE){
printf("Failed to set protection level.\n");
return -1;
}
data_prot = (enum protection_level)level;
return 0;
}
enum protection_level
set_command_prot(enum protection_level level)
{
enum protection_level old = command_prot;
command_prot = level;
return old;
}
void
sec_prot(int argc, char **argv)
{
int level = -1;
if(argc < 2 || argc > 3)
goto usage;
if(!sec_complete) {
printf("No security data exchange has taken place.\n");
code = -1;
return;
}
level = name_to_level(argv[argc - 1]);
if(level == -1)
goto usage;
if((*mech->check_prot)(app_data, level)) {
printf("%s does not implement %s protection.\n",
mech->name, level_to_name(level));
code = -1;
return;
}
if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
if(sec_prot_internal(level) < 0){
code = -1;
return;
}
} else if(strncasecmp(argv[1], "command", strlen(argv[1])) == 0)
set_command_prot(level);
else
goto usage;
code = 0;
return;
usage:
printf("usage: %s [command|data] [clear|safe|confidential|private]\n",
argv[0]);
code = -1;
}
static enum protection_level request_data_prot;
void
sec_set_protection_level(void)
{
if(sec_complete && data_prot != request_data_prot)
sec_prot_internal(request_data_prot);
}
int
sec_request_prot(char *level)
{
int l = name_to_level(level);
if(l == -1)
return -1;
request_data_prot = (enum protection_level)l;
return 0;
}
int
sec_login(char *host)
{
int ret;
struct sec_client_mech **m;
int old_verbose = verbose;
verbose = -1; /* shut up all messages this will produce (they
are usually not very user friendly) */
for(m = mechs; *m && (*m)->name; m++) {
void *tmp;
tmp = realloc(app_data, (*m)->size);
if (tmp == NULL) {
warnx ("realloc %u failed", (*m)->size);
return -1;
}
app_data = tmp;
if((*m)->init && (*(*m)->init)(app_data) != 0) {
printf("Skipping %s...\n", (*m)->name);
continue;
}
printf("Trying %s...\n", (*m)->name);
ret = command("AUTH %s", (*m)->name);
if(ret != CONTINUE){
if(code == 504){
printf("%s is not supported by the server.\n", (*m)->name);
}else if(code == 534){
printf("%s rejected as security mechanism.\n", (*m)->name);
}else if(ret == ERROR) {
printf("The server doesn't support the FTP "
"security extensions.\n");
verbose = old_verbose;
return -1;
}
continue;
}
ret = (*(*m)->auth)(app_data, host);
if(ret == AUTH_CONTINUE)
continue;
else if(ret != AUTH_OK){
/* mechanism is supposed to output error string */
verbose = old_verbose;
return -1;
}
mech = *m;
sec_complete = 1;
command_prot = prot_safe;
break;
}
verbose = old_verbose;
return *m == NULL;
}
void
sec_end(void)
{
if (mech != NULL) {
if(mech->end)
(*mech->end)(app_data);
memset(app_data, 0, mech->size);
free(app_data);
app_data = NULL;
}
sec_complete = 0;
data_prot = (enum protection_level)0;
}
#endif /* FTP_SERVER */
-131
View File
@@ -1,131 +0,0 @@
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: security.h,v 1.7 1999/12/02 16:58:30 joda Exp $ */
#ifndef __security_h__
#define __security_h__
enum protection_level {
prot_clear,
prot_safe,
prot_confidential,
prot_private
};
struct sec_client_mech {
char *name;
size_t size;
int (*init)(void *);
int (*auth)(void *, char*);
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
int (*encode)(void *, void*, int, int, void**);
int (*decode)(void *, void*, int, int);
};
struct sec_server_mech {
char *name;
size_t size;
int (*init)(void *);
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
int (*encode)(void *, void*, int, int, void**);
int (*decode)(void *, void*, int, int);
int (*auth)(void *);
int (*adat)(void *, void*, size_t);
size_t (*pbsz)(void *, size_t);
int (*ccc)(void*);
int (*userok)(void*, char*);
};
#define AUTH_OK 0
#define AUTH_CONTINUE 1
#define AUTH_ERROR 2
#ifdef FTP_SERVER
extern struct sec_server_mech krb4_server_mech, gss_server_mech;
#else
extern struct sec_client_mech krb4_client_mech, gss_client_mech;
#endif
extern int sec_complete;
#ifdef FTP_SERVER
extern char *ftp_command;
void new_ftp_command(char*);
void delete_ftp_command(void);
#endif
/* ---- */
int sec_fflush (FILE *);
int sec_fprintf (FILE *, const char *, ...);
int sec_getc (FILE *);
int sec_putc (int, FILE *);
int sec_read (int, void *, int);
int sec_read_msg (char *, int);
int sec_vfprintf (FILE *, const char *, va_list);
int sec_fprintf2(FILE *f, const char *fmt, ...);
int sec_vfprintf2(FILE *, const char *, va_list);
int sec_write (int, char *, int);
#ifdef FTP_SERVER
void adat (char *);
void auth (char *);
void ccc (void);
void mec (char *, enum protection_level);
void pbsz (int);
void prot (char *);
void delete_ftp_command (void);
void new_ftp_command (char *);
int sec_userok (char *);
int secure_command (void);
enum protection_level get_command_prot(void);
#else
void sec_end (void);
int sec_login (char *);
void sec_prot (int, char **);
int sec_request_prot (char *);
void sec_set_protection_level (void);
void sec_status (void);
enum protection_level set_command_prot(enum protection_level);
#endif
#endif /* __security_h__ */
@@ -1,54 +0,0 @@
# $Id: Makefile.am,v 1.20 1999/10/03 16:38:53 joda Exp $
include $(top_srcdir)/Makefile.am.common
INCLUDES += -I$(srcdir)/../common $(INCLUDE_krb4) -DFTP_SERVER
libexec_PROGRAMS = ftpd
CHECK_LOCAL =
if KRB4
krb4_sources = krb4.c kauth.c
endif
if KRB5
krb5_sources = gssapi.c gss_userok.c
endif
ftpd_SOURCES = \
extern.h \
ftpcmd.y \
ftpd.c \
ftpd_locl.h \
logwtmp.c \
ls.c \
pathnames.h \
popen.c \
security.c \
$(krb4_sources) \
$(krb5_sources)
EXTRA_ftpd_SOURCES = krb4.c kauth.c gssapi.c gss_userok.c
$(ftpd_OBJECTS): security.h
security.c:
@test -f security.c || $(LN_S) $(srcdir)/../ftp/security.c .
security.h:
@test -f security.h || $(LN_S) $(srcdir)/../ftp/security.h .
krb4.c:
@test -f krb4.c || $(LN_S) $(srcdir)/../ftp/krb4.c .
gssapi.c:
@test -f gssapi.c || $(LN_S) $(srcdir)/../ftp/gssapi.c .
CLEANFILES = security.c security.h krb4.c gssapi.c ftpcmd.c
LDADD = ../common/libcommon.a \
$(LIB_kafs) \
$(LIB_gssapi) \
$(LIB_krb5) \
$(LIB_krb4) \
$(LIB_otp) \
$(top_builddir)/lib/des/libdes.la \
$(LIB_roken) \
$(DBLIB)
-170
View File
@@ -1,170 +0,0 @@
/*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: ftpd_locl.h,v 1.9 1999/12/02 16:58:30 joda Exp $ */
#ifndef __ftpd_locl_h__
#define __ftpd_locl_h__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/*
* FTP server.
*/
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#elif defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#else
#include <time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#ifdef HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#include <arpa/ftp.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_TELNET_H
#include <arpa/telnet.h>
#endif
#include <ctype.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <glob.h>
#include <limits.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#include <fnmatch.h>
#ifdef HAVE_BSD_BSD_H
#include <bsd/bsd.h>
#endif
#include <err.h>
#include "pathnames.h"
#include "extern.h"
#include "common.h"
#include "security.h"
#include "roken.h"
#ifdef KRB4
#include <krb.h>
#include <kafs.h>
#endif
#ifdef OTP
#include <otp.h>
#endif
#ifdef SOCKS
#include <socks.h>
extern int LIBPREFIX(fclose) (FILE *);
#endif
/* SunOS doesn't have any declaration of fclose */
int fclose(FILE *stream);
int yyparse();
#ifndef LOG_FTP
#define LOG_FTP LOG_DAEMON
#endif
#endif /* __ftpd_locl_h__ */
@@ -1,69 +0,0 @@
/*
* Copyright (c) 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "ftpd_locl.h"
#include <gssapi.h>
#include <krb5.h>
RCSID("$Id: gss_userok.c,v 1.2 1999/12/02 16:58:31 joda Exp $");
/* XXX a bit too much of krb5 dependency here...
What is the correct way to do this?
*/
extern krb5_context gssapi_krb5_context;
/* XXX sync with gssapi.c */
struct gss_data {
gss_ctx_id_t context_hdl;
char *client_name;
};
int gss_userok(void*, char*); /* to keep gcc happy */
int
gss_userok(void *app_data, char *username)
{
struct gss_data *data = app_data;
if(gssapi_krb5_context) {
krb5_principal client;
krb5_error_code ret;
ret = krb5_parse_name(gssapi_krb5_context, data->client_name, &client);
if(ret)
return 1;
ret = krb5_kuserok(gssapi_krb5_context, client, username);
krb5_free_principal(gssapi_krb5_context, client);
return !ret;
}
return 1;
}
-572
View File
@@ -1,572 +0,0 @@
/*
* Copyright (c) 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of KTH nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
#include "ftpd_locl.h"
RCSID("$Id: ls.c,v 1.13 1999/11/20 20:49:41 assar Exp $");
struct fileinfo {
struct stat st;
int inode;
int bsize;
char mode[11];
int n_link;
char *user;
char *group;
char *size;
char *major;
char *minor;
char *date;
char *filename;
char *link;
};
#define LS_DIRS 1
#define LS_IGNORE_DOT 2
#define LS_SORT_MODE 12
#define SORT_MODE(f) ((f) & LS_SORT_MODE)
#define LS_SORT_NAME 4
#define LS_SORT_MTIME 8
#define LS_SORT_SIZE 12
#define LS_SORT_REVERSE 16
#define LS_SIZE 32
#define LS_INODE 64
#ifndef S_ISTXT
#define S_ISTXT S_ISVTX
#endif
#ifndef S_ISSOCK
#define S_ISSOCK(mode) (((mode) & _S_IFMT) == S_IFSOCK)
#endif
#ifndef S_ISLNK
#define S_ISLNK(mode) (((mode) & _S_IFMT) == S_IFLNK)
#endif
static void
make_fileinfo(const char *filename, struct fileinfo *file, int flags)
{
char buf[128];
struct stat *st = &file->st;
file->inode = st->st_ino;
#ifdef S_BLKSIZE
file->bsize = st->st_blocks * S_BLKSIZE / 1024;
#else
file->bsize = st->st_blocks * 512 / 1024;
#endif
if(S_ISDIR(st->st_mode))
file->mode[0] = 'd';
else if(S_ISCHR(st->st_mode))
file->mode[0] = 'c';
else if(S_ISBLK(st->st_mode))
file->mode[0] = 'b';
else if(S_ISREG(st->st_mode))
file->mode[0] = '-';
else if(S_ISFIFO(st->st_mode))
file->mode[0] = 'p';
else if(S_ISLNK(st->st_mode))
file->mode[0] = 'l';
else if(S_ISSOCK(st->st_mode))
file->mode[0] = 's';
#ifdef S_ISWHT
else if(S_ISWHT(st->st_mode))
file->mode[0] = 'w';
#endif
else
file->mode[0] = '?';
{
char *x[] = { "---", "--x", "-w-", "-wx",
"r--", "r-x", "rw-", "rwx" };
strcpy(file->mode + 1, x[(st->st_mode & S_IRWXU) >> 6]);
strcpy(file->mode + 4, x[(st->st_mode & S_IRWXG) >> 3]);
strcpy(file->mode + 7, x[(st->st_mode & S_IRWXO) >> 0]);
if((st->st_mode & S_ISUID)) {
if((st->st_mode & S_IXUSR))
file->mode[3] = 's';
else
file->mode[3] = 'S';
}
if((st->st_mode & S_ISGID)) {
if((st->st_mode & S_IXGRP))
file->mode[6] = 's';
else
file->mode[6] = 'S';
}
if((st->st_mode & S_ISTXT)) {
if((st->st_mode & S_IXOTH))
file->mode[9] = 't';
else
file->mode[9] = 'T';
}
}
file->n_link = st->st_nlink;
{
struct passwd *pwd;
pwd = getpwuid(st->st_uid);
if(pwd == NULL)
asprintf(&file->user, "%u", (unsigned)st->st_uid);
else
file->user = strdup(pwd->pw_name);
}
{
struct group *grp;
grp = getgrgid(st->st_gid);
if(grp == NULL)
asprintf(&file->group, "%u", (unsigned)st->st_gid);
else
file->group = strdup(grp->gr_name);
}
if(S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
#if defined(major) && defined(minor)
asprintf(&file->major, "%u", (unsigned)major(st->st_rdev));
asprintf(&file->minor, "%u", (unsigned)minor(st->st_rdev));
#else
/* Don't want to use the DDI/DKI crap. */
asprintf(&file->major, "%u", (unsigned)st->st_rdev);
asprintf(&file->minor, "%u", 0);
#endif
} else
asprintf(&file->size, "%lu", (unsigned long)st->st_size);
{
time_t t = time(NULL);
struct tm *tm = localtime(&st->st_mtime);
if((t - st->st_mtime > 6*30*24*60*60) ||
(st->st_mtime - t > 6*30*24*60*60))
strftime(buf, sizeof(buf), "%b %e %Y", tm);
else
strftime(buf, sizeof(buf), "%b %e %H:%M", tm);
file->date = strdup(buf);
}
{
const char *p = strrchr(filename, '/');
if(p)
p++;
else
p = filename;
file->filename = strdup(p);
}
if(S_ISLNK(st->st_mode)) {
int n;
n = readlink((char *)filename, buf, sizeof(buf));
if(n >= 0) {
buf[n] = '\0';
file->link = strdup(buf);
} else
warn("%s: readlink", filename);
}
}
static void
print_file(FILE *out,
int flags,
struct fileinfo *f,
int max_inode,
int max_bsize,
int max_n_link,
int max_user,
int max_group,
int max_size,
int max_major,
int max_minor,
int max_date)
{
if(f->filename == NULL)
return;
if(flags & LS_INODE) {
sec_fprintf2(out, "%*d", max_inode, f->inode);
sec_fprintf2(out, " ");
}
if(flags & LS_SIZE) {
sec_fprintf2(out, "%*d", max_bsize, f->bsize);
sec_fprintf2(out, " ");
}
sec_fprintf2(out, "%s", f->mode);
sec_fprintf2(out, " ");
sec_fprintf2(out, "%*d", max_n_link, f->n_link);
sec_fprintf2(out, " ");
sec_fprintf2(out, "%-*s", max_user, f->user);
sec_fprintf2(out, " ");
sec_fprintf2(out, "%-*s", max_group, f->group);
sec_fprintf2(out, " ");
if(f->major != NULL && f->minor != NULL)
sec_fprintf2(out, "%*s, %*s", max_major, f->major, max_minor, f->minor);
else
sec_fprintf2(out, "%*s", max_size, f->size);
sec_fprintf2(out, " ");
sec_fprintf2(out, "%*s", max_date, f->date);
sec_fprintf2(out, " ");
sec_fprintf2(out, "%s", f->filename);
if(f->link)
sec_fprintf2(out, " -> %s", f->link);
sec_fprintf2(out, "\r\n");
}
static int
compare_filename(struct fileinfo *a, struct fileinfo *b)
{
if(a->filename == NULL)
return 1;
if(b->filename == NULL)
return -1;
return strcmp(a->filename, b->filename);
}
static int
compare_mtime(struct fileinfo *a, struct fileinfo *b)
{
if(a->filename == NULL)
return 1;
if(b->filename == NULL)
return -1;
return a->st.st_mtime - b->st.st_mtime;
}
static int
compare_size(struct fileinfo *a, struct fileinfo *b)
{
if(a->filename == NULL)
return 1;
if(b->filename == NULL)
return -1;
return a->st.st_size - b->st.st_size;
}
static void
list_dir(FILE *out, const char *directory, int flags);
static int
log10(int num)
{
int i = 1;
while(num > 10) {
i++;
num /= 10;
}
return i;
}
/*
* Operate as lstat but fake up entries for AFS mount points so we don't
* have to fetch them.
*/
static int
lstat_file (const char *file, struct stat *sb)
{
#ifdef KRB4
if (k_hasafs()
&& strcmp(file, ".")
&& strcmp(file, ".."))
{
struct ViceIoctl a_params;
char *last;
char *path_bkp;
static ino_t ino_counter = 0, ino_last = 0;
int ret;
const int maxsize = 2048;
path_bkp = strdup (file);
if (path_bkp == NULL)
return -1;
a_params.out = malloc (maxsize);
if (a_params.out == NULL) {
free (path_bkp);
return -1;
}
/* If path contains more than the filename alone - split it */
last = strrchr (path_bkp, '/');
if (last != NULL) {
*last = '\0';
a_params.in = last + 1;
} else
a_params.in = (char *)file;
a_params.in_size = strlen (a_params.in) + 1;
a_params.out_size = maxsize;
ret = k_pioctl (last ? path_bkp : "." ,
VIOC_AFS_STAT_MT_PT, &a_params, 0);
free (a_params.out);
if (ret < 0) {
free (path_bkp);
if (errno != EINVAL)
return ret;
else
/* if we get EINVAL this is probably not a mountpoint */
return lstat (file, sb);
}
/*
* wow this was a mountpoint, lets cook the struct stat
* use . as a prototype
*/
ret = lstat (path_bkp, sb);
free (path_bkp);
if (ret < 0)
return ret;
if (ino_last == sb->st_ino)
ino_counter++;
else {
ino_last = sb->st_ino;
ino_counter = 0;
}
sb->st_ino += ino_counter;
sb->st_nlink = 3;
return 0;
}
#endif /* KRB4 */
return lstat (file, sb);
}
static void
list_files(FILE *out, char **files, int n_files, int flags)
{
struct fileinfo *fi;
int i;
fi = calloc(n_files, sizeof(*fi));
if (fi == NULL) {
sec_fprintf2(out, "ouf of memory\r\n");
return;
}
for(i = 0; i < n_files; i++) {
if(lstat_file(files[i], &fi[i].st) < 0) {
sec_fprintf2(out, "%s: %s\r\n", files[i], strerror(errno));
fi[i].filename = NULL;
} else {
if((flags & LS_DIRS) == 0 && S_ISDIR(fi[i].st.st_mode)) {
if(n_files > 1)
sec_fprintf2(out, "%s:\r\n", files[i]);
list_dir(out, files[i], flags);
} else {
make_fileinfo(files[i], &fi[i], flags);
}
}
}
switch(SORT_MODE(flags)) {
case LS_SORT_NAME:
qsort(fi, n_files, sizeof(*fi),
(int (*)(const void*, const void*))compare_filename);
break;
case LS_SORT_MTIME:
qsort(fi, n_files, sizeof(*fi),
(int (*)(const void*, const void*))compare_mtime);
break;
case LS_SORT_SIZE:
qsort(fi, n_files, sizeof(*fi),
(int (*)(const void*, const void*))compare_size);
break;
}
{
int max_inode = 0;
int max_bsize = 0;
int max_n_link = 0;
int max_user = 0;
int max_group = 0;
int max_size = 0;
int max_major = 0;
int max_minor = 0;
int max_date = 0;
for(i = 0; i < n_files; i++) {
if(fi[i].filename == NULL)
continue;
if(fi[i].inode > max_inode)
max_inode = fi[i].inode;
if(fi[i].bsize > max_bsize)
max_bsize = fi[i].bsize;
if(fi[i].n_link > max_n_link)
max_n_link = fi[i].n_link;
if(strlen(fi[i].user) > max_user)
max_user = strlen(fi[i].user);
if(strlen(fi[i].group) > max_group)
max_group = strlen(fi[i].group);
if(fi[i].major != NULL && strlen(fi[i].major) > max_major)
max_major = strlen(fi[i].major);
if(fi[i].minor != NULL && strlen(fi[i].minor) > max_minor)
max_minor = strlen(fi[i].minor);
if(fi[i].size != NULL && strlen(fi[i].size) > max_size)
max_size = strlen(fi[i].size);
if(strlen(fi[i].date) > max_date)
max_date = strlen(fi[i].date);
}
if(max_size < max_major + max_minor + 2)
max_size = max_major + max_minor + 2;
else if(max_size - max_minor - 2 > max_major)
max_major = max_size - max_minor - 2;
max_inode = log10(max_inode);
max_bsize = log10(max_bsize);
max_n_link = log10(max_n_link);
if(flags & LS_SORT_REVERSE)
for(i = n_files - 1; i >= 0; i--)
print_file(out,
flags,
&fi[i],
max_inode,
max_bsize,
max_n_link,
max_user,
max_group,
max_size,
max_major,
max_minor,
max_date);
else
for(i = 0; i < n_files; i++)
print_file(out,
flags,
&fi[i],
max_inode,
max_bsize,
max_n_link,
max_user,
max_group,
max_size,
max_major,
max_minor,
max_date);
}
}
static void
free_files (char **files, int n)
{
int i;
for (i = 0; i < n; ++i)
free (files[i]);
free (files);
}
static void
list_dir(FILE *out, const char *directory, int flags)
{
DIR *d = opendir(directory);
struct dirent *ent;
char **files = NULL;
int n_files = 0;
if(d == NULL) {
sec_fprintf2(out, "%s: %s\r\n", directory, strerror(errno));
return;
}
while((ent = readdir(d)) != NULL) {
void *tmp;
if(ent->d_name[0] == '.') {
if (flags & LS_IGNORE_DOT)
continue;
if (ent->d_name[1] == 0) /* Ignore . */
continue;
if (ent->d_name[1] == '.' && ent->d_name[2] == 0) /* Ignore .. */
continue;
}
tmp = realloc(files, (n_files + 1) * sizeof(*files));
if (tmp == NULL) {
sec_fprintf2(out, "%s: out of memory\r\n", directory);
free_files (files, n_files);
closedir (d);
return;
}
files = tmp;
asprintf(&files[n_files], "%s/%s", directory, ent->d_name);
if (files[n_files] == NULL) {
sec_fprintf2(out, "%s: out of memory\r\n", directory);
free_files (files, n_files);
closedir (d);
return;
}
++n_files;
}
closedir(d);
list_files(out, files, n_files, flags | LS_DIRS);
}
void
builtin_ls(FILE *out, const char *file)
{
int flags = LS_SORT_NAME;
if(*file == '-') {
const char *p;
for(p = file + 1; *p; p++) {
switch(*p) {
case 'a':
case 'A':
flags &= ~LS_IGNORE_DOT;
break;
case 'C':
break;
case 'd':
flags |= LS_DIRS;
break;
case 'f':
flags = (flags & ~LS_SORT_MODE);
break;
case 'i':
flags |= flags | LS_INODE;
break;
case 'l':
break;
case 't':
flags = (flags & ~LS_SORT_MODE) | LS_SORT_MTIME;
break;
case 's':
flags |= LS_SIZE;
break;
case 'S':
flags = (flags & ~LS_SORT_MODE) | LS_SORT_SIZE;
break;
case 'r':
flags |= LS_SORT_REVERSE;
break;
}
}
file = ".";
}
list_files(out, &file, 1, flags);
sec_fflush(out);
}
-30
View File
@@ -1,30 +0,0 @@
1999-08-31 Johan Danielsson <[email protected]>
* kauth.c: cleanup usage string; handle `kauth -h' gracefully
(print usage); add `-a' flag to get the ticket address (useful for
firewall configurations)
Thu Apr 15 15:05:33 1999 Johan Danielsson <[email protected]>
* kauth.c: add `-v'
Thu Mar 18 11:17:14 1999 Johan Danielsson <[email protected]>
* Makefile.am: include Makefile.am.common
Sun Nov 22 10:30:47 1998 Assar Westerlund <[email protected]>
* Makefile.in (WFLAGS): set
Tue May 26 17:41:47 1998 Johan Danielsson <[email protected]>
* kauth.c: use krb_enable_debug
Fri May 1 07:15:18 1998 Assar Westerlund <[email protected]>
* rkinit.c: unifdef -DHAVE_H_ERRNO
Thu Mar 19 16:07:18 1998 Johan Danielsson <[email protected]>
* kauth.c: Check for negative return value from krb_afslog().
-42
View File
@@ -1,42 +0,0 @@
# $Id: Makefile.am,v 1.7 1999/04/09 18:22:45 assar Exp $
include $(top_srcdir)/Makefile.am.common
INCLUDES += $(INCLUDE_krb4)
bin_PROGRAMS = kauth
bin_SCRIPTS = ksrvtgt
libexec_PROGRAMS = kauthd
EXTRA_DIST = zrefresh ksrvtgt.in
kauth_SOURCES = \
kauth.c \
kauth.h \
rkinit.c \
marshall.c \
encdata.c
kauthd_SOURCES = \
kauthd.c \
kauth.h \
marshall.c \
encdata.c
ksrvtgt: ksrvtgt.in
sed -e "s!%bindir%!$(bindir)!" $(srcdir)/ksrvtgt.in > $@
chmod +x $@
install-exec-local:
if test -f $(bindir)/zrefresh -o -r $(bindir)/zrefresh; then \
true; \
else \
$(INSTALL_PROGRAM) $(srcdir)/zrefresh $(bindir)/`echo zrefresh | sed '$(transform)'`; \
fi
LDADD = \
$(LIB_kafs) \
$(LIB_krb5) \
$(LIB_krb4) \
$(top_builddir)/lib/des/libdes.la \
$(LIB_roken)
-135
View File
@@ -1,135 +0,0 @@
1999-11-13 Assar Westerlund <[email protected]>
* push.c: make `-v' a arg_counter
1999-11-02 Assar Westerlund <[email protected]>
* push.c (main): redo the v4/v5 selection for consistency. -4 ->
try only v4 -5 -> try only v5 none, -45 -> try v5, v4
1999-08-19 Assar Westerlund <[email protected]>
* push.c (doit): remember to step over the error message when we
discover that XDELE is not supported
1999-08-12 Johan Danielsson <[email protected]>
* push.c: use XDELE
1999-08-05 Assar Westerlund <[email protected]>
* push.c (do_connect): v6-ify
1999-06-15 Assar Westerlund <[email protected]>
* push.c: get_default_username and the resulting const propagation
1999-05-21 Assar Westerlund <[email protected]>
* push.c (parse_pobox): try $USERNAME
1999-05-11 Assar Westerlund <[email protected]>
* push.c (do_v5): remove unused and non-working code
1999-05-10 Assar Westerlund <[email protected]>
* push.c (do_v5): call krb5_sendauth with ccache == NULL
Wed Apr 7 23:40:00 1999 Assar Westerlund <[email protected]>
* Makefile.in: fix names of hesiod variables
Wed Mar 24 04:37:04 1999 Assar Westerlund <[email protected]>
* Makefile.am (pfrom): fix typo
* push.c (get_pobox): try to handle old and new hesiod APIs
Mon Mar 22 22:19:40 1999 Assar Westerlund <[email protected]>
* Makefile.am: hesoid -> hesiod
Sun Mar 21 18:02:10 1999 Johan Danielsson <[email protected]>
* Makefile.am: bindir -> libexecdir
Sat Mar 20 00:12:26 1999 Assar Westerlund <[email protected]>
* Makefile.am: LDADD: add missing backslash
Thu Mar 18 15:28:35 1999 Johan Danielsson <[email protected]>
* Makefile.am: clean pfrom
* Makefile.am: include Makefile.am.common
Mon Mar 15 18:26:16 1999 Johan Danielsson <[email protected]>
* push.c: strncasecmp headers
Mon Feb 15 22:22:09 1999 Assar Westerlund <[email protected]>
* Makefile.in (pfrom): use libexecdir
* Makefile.am: build and install pfrom
* push.c (do_connect): init `s'
(pop_state): spell-check enums
Tue Nov 24 23:20:54 1998 Assar Westerlund <[email protected]>
* Makefile.in: build and install pfrom
* pfrom.in: bindir -> libexecdir
Sun Nov 22 15:33:52 1998 Johan Danielsson <[email protected]>
* push.c: eliminate some warnings
Sun Nov 22 10:34:54 1998 Assar Westerlund <[email protected]>
* Makefile.in (WFLAGS): set
Thu Nov 19 01:17:33 1998 Assar Westerlund <[email protected]>
* push_locl.h: add <hesiod.h>
* Makefile.am, Makefile.in: link and include hesiod
* push.c (get_pobox): new function. add hesiod support.
1998-11-07 Assar Westerlund <[email protected]>
* push.8: updated
* push.c: --from implementation from <[email protected]>
Fri Jul 10 01:14:45 1998 Assar Westerlund <[email protected]>
* push.c (net_{read,write}): remove
Wed Jun 24 14:41:41 1998 Johan Danielsson <[email protected]>
* push.c: allow `po:user@host' mailbox syntax
Tue Jun 2 17:35:06 1998 Johan Danielsson <[email protected]>
* push.c: quote '^From ' properly
Mon May 25 05:22:47 1998 Assar Westerlund <[email protected]>
* Makefile.in (clean): PROGS -> PROGRAMS
Sun Apr 26 11:42:13 1998 Assar Westerlund <[email protected]>
* push.c (main): better default for v4 and v5
* push.c (main): init context correctly
* push.c: should work with krb4
* push_locl.h: krb4 compat
* Makefile.in: new file
-27
View File
@@ -1,27 +0,0 @@
# $Id: Makefile.am,v 1.15 1999/04/09 18:29:48 assar Exp $
include $(top_srcdir)/Makefile.am.common
INCLUDES += $(INCLUDE_krb4) $(INCLUDE_hesiod)
bin_SCRIPTS = pfrom
libexec_PROGRAMS = push
push_SOURCES = push.c push_locl.h
pfrom: pfrom.in
sed -e "s!%libexecdir%!$(libexecdir)!" $(srcdir)/pfrom.in > $@
chmod +x $@
man_MANS = push.8
CLEANFILES = pfrom
EXTRA_DIST = pfrom.in $(man_MANS)
LDADD = $(LIB_krb5) \
$(LIB_krb4) \
$(top_builddir)/lib/des/libdes.la \
$(LIB_roken) \
$(LIB_hesiod)
-95
View File
@@ -1,95 +0,0 @@
# $Id: Makefile.in,v 1.10 1999/04/07 18:39:56 assar Exp $
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
CC = @CC@
LINK = @LINK@
RANLIB = @RANLIB@
DEFS = @DEFS@ @INCLUDE_hesiod@
CFLAGS = @CFLAGS@ $(WFLAGS)
WFLAGS = @WFLAGS@
LD_FLAGS = @LD_FLAGS@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LIBS = @LIB_hesiod@ @LIBS@
LIB_DBM = @LIB_DBM@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
libexecdir = @libexecdir@
bindir = @bindir@
transform=@program_transform_name@
EXECSUFFIX=@EXECSUFFIX@
bin_PROGRAMS = pfrom
libexec_PROGRAMS = push$(EXECSUFFIX)
PROGRAMS = $(libexec_PROGRAMS) $(bin_PROGRAMS)
push_SOURCES = push.c
push_OBJECTS = push.o
SOURCES = $(push_SOURCES)
OBJECTS = $(push_OBJECTS)
all: $(PROGRAMS)
.c.o:
$(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
install: all
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
for x in $(bin_PROGRAMS); do \
$(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
done
$(MKINSTALLDIRS) $(DESTDIR)$(libexecdir)
for x in $(libexec_PROGRAMS); do \
$(INSTALL_PROGRAM) $$x $(DESTDIR)$(libexecdir)/`echo $$x | sed '$(transform)'`; \
done
uninstall:
for x in $(bin_PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
done
for x in $(libexec_PROGRAMS); do \
rm -f $(DESTDIR)$(libexecdir)/`echo $$x | sed '$(transform)'`; \
done
TAGS: $(SOURCES)
etags $(SOURCES)
check:
clean:
rm -f *.a *.o $(PROGRAMS)
mostlyclean: clean
distclean: clean
rm -f Makefile *~
realclean: distclean
rm -f TAGS
KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes
LIBROKEN=-L../../lib/roken -lroken
push$(EXECSUFFIX): $(push_OBJECTS)
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ $(push_OBJECTS) $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
pfrom: pfrom.in
sed -e "s!%libexecdir%!$(libexecdir)!" $(srcdir)/pfrom.in > $@
chmod +x $@
$(OBJECTS): ../../include/config.h
.PHONY: all install uninstall check clean mostlyclean distclean realclean
-6
View File
@@ -1,6 +0,0 @@
#!/bin/sh
# $Id: pfrom.in,v 1.2 1998/11/24 13:25:47 assar Exp $
libexecdir=%libexecdir%
PATH=$libexecdir:$PATH
export PATH
push --from $*
-138
View File
@@ -1,138 +0,0 @@
.\" $Id: push.8,v 1.3.16.1 1999/12/06 17:25:27 assar Exp $
.\"
.Dd May 31, 1998
.Dt PUSH 8
.Os HEIMDAL
.Sh NAME
.Nm push
.Nd
fetch mail via POP
.Sh SYNOPSIS
.Nm
.Op Fl 4 | Fl -krb4
.Op Fl 5 | Fl -krb5
.Op Fl v | Fl -verbose
.Op Fl f | Fl -fork
.Op Fl l | -leave
.Op Fl -from
.Op Fl c | -count
.Op Fl -header
.Oo Fl p Ar port-spec \*(Ba Xo
.Fl -port= Ns Ar port-spec Oc
.Xc
.Ar po-box
.Pa filename
.Sh DESCRIPTION
.Nm
retrieves mail from the post office box
.Ar po-box ,
and stores the mail in mbox format in
.Pa filename .
The
.Ar po-box
can have any of the following formats:
.Bl -hang -compact -offset indent
.It Ql hostname:username
.It Ql po:hostname:username
.It Ql username@hostname
.It Ql po:username@hostname
.It Ql hostname
.It Ql po:username
.El
If no username is specified,
.Nm
assumes that it's the same as on the local machine;
.Ar hostname
defaults to the value of the
.Ev MAILHOST
environment variable.
Supported options:
.Bl -tag -width Ds
.It Xo
.Fl 4 Ns ,
.Fl -krb4
.Xc
use Kerberos 4 (if compiled with support for Kerberos 4)
.It Xo
.Fl 5 Ns ,
.Fl -krb5
.Xc
use Kerberos 5 (if compiled with support for Kerberos 5)
.It Xo
.Fl f Ns ,
.Fl -fork
.Xc
fork before starting to delete messages
.It Xo
.Fl l Ns ,
.Fl -leave
.Xc
don't delete fetched mail
.It Xo
.Fl -from
.Xc
behave like from.
.It Xo
.Fl c Ns ,
.Fl -count
.Xc
first print how many messages and bytes there are.
.It Xo
.Fl -header
.Xc
which header from should print.
.It Xo
.Fl p Ar port-spec Ns ,
.Fl -port= Ns Ar port-spec
.Xc
use this port instead of the default
.Ql kpop
or
.Ql 1109 .
.El
The default is to first try Kerberos 5 authentication and then, if
that fails, Kerberos 4.
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev MAILHOST
points to the post office, if no other hostname is specified.
.El
.\".Sh FILES
.Sh EXAMPLES
.Bd -literal -offset indent
$ push cornfield:roosta ~/.gnus-crash-box
.Ed
tries to fetch mail for the user
.Ar roosta
from the post office at
.Dq cornfield ,
and stores the mail in
.Pa ~/.gnus-crash-box
(you are using Gnus, aren't you?)
.Bd -literal -offset indent
$ push --from -5 havregryn
.Ed
tries to fetch
.Nm From:
lines for current user at post office
.Dq havregryn
using Kerberos 5.
.\".Sh DIAGNOSTICS
.Sh SEE ALSO
.Xr movemail 8 ,
.Xr popper 8 ,
.Xr from 1
.\".Sh STANDARDS
.Sh HISTORY
.Nm
was written while waiting for
.Nm movemail
to finish getting the mail.
.\".Sh AUTHORS
.\".Sh BUGS
-795
View File
@@ -1,795 +0,0 @@
/*
* Copyright (c) 1997-1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "push_locl.h"
RCSID("$Id: push.c,v 1.34.2.1 1999/12/06 17:25:28 assar Exp $");
#ifdef KRB4
static int use_v4 = -1;
#endif
#ifdef KRB5
static int use_v5 = -1;
static krb5_context context;
#endif
static char *port_str;
static int verbose_level;
static int do_fork;
static int do_leave;
static int do_version;
static int do_help;
static int do_from;
static int do_count;
static char *header_str;
struct getargs args[] = {
#ifdef KRB4
{ "krb4", '4', arg_flag, &use_v4, "Use Kerberos V4",
NULL },
#endif
#ifdef KRB5
{ "krb5", '5', arg_flag, &use_v5, "Use Kerberos V5",
NULL },
#endif
{ "verbose",'v', arg_counter, &verbose_level, "Verbose",
NULL },
{ "fork", 'f', arg_flag, &do_fork, "Fork deleting proc",
NULL },
{ "leave", 'l', arg_flag, &do_leave, "Leave mail on server",
NULL },
{ "port", 'p', arg_string, &port_str, "Use this port",
"number-or-service" },
{ "from", 0, arg_flag, &do_from, "Behave like from",
NULL },
{ "header", 0, arg_string, &header_str, "Header string to print", NULL },
{ "count", 'c', arg_flag, &do_count, "Print number of messages", NULL},
{ "version", 0, arg_flag, &do_version, "Print version",
NULL },
{ "help", 0, arg_flag, &do_help, NULL,
NULL }
};
static void
usage (int ret)
{
arg_printusage (args,
sizeof(args) / sizeof(args[0]),
NULL,
"[[{po:username[@hostname] | hostname[:username]}] ...]"
"filename");
exit (ret);
}
static int
do_connect (const char *hostname, int port, int nodelay)
{
struct hostent *hostent = NULL;
char **h;
int error;
int af;
int s;
#ifdef HAVE_IPV6
if (hostent == NULL)
hostent = getipnodebyname (hostname, AF_INET6, 0, &error);
#endif
if (hostent == NULL)
hostent = getipnodebyname (hostname, AF_INET, 0, &error);
if (hostent == NULL)
errx(1, "gethostbyname '%s' failed: %s", hostname, hstrerror(error));
af = hostent->h_addrtype;
for (h = hostent->h_addr_list; *h != NULL; ++h) {
struct sockaddr_storage sa_ss;
struct sockaddr *sa = (struct sockaddr *)&sa_ss;
sa->sa_family = af;
socket_set_address_and_port (sa, *h, port);
s = socket (af, SOCK_STREAM, 0);
if (s < 0)
err (1, "socket");
if (connect(s, sa, socket_sockaddr_size(sa)) < 0) {
warn ("connect(%s)", hostname);
close (s);
continue;
} else {
break;
}
}
freehostent (hostent);
if (*h == NULL)
return -1;
if(setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
(void *)&nodelay, sizeof(nodelay)) < 0)
err (1, "setsockopt TCP_NODELAY");
return s;
}
typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
DELE, XDELE, QUIT} pop_state;
#define PUSH_BUFSIZ 65536
#define STEP 16
struct write_state {
struct iovec *iovecs;
size_t niovecs, maxiovecs, allociovecs;
int fd;
};
static void
write_state_init (struct write_state *w, int fd)
{
#ifdef UIO_MAXIOV
w->maxiovecs = UIO_MAXIOV;
#else
w->maxiovecs = 16;
#endif
w->allociovecs = min(STEP, w->maxiovecs);
w->niovecs = 0;
w->iovecs = malloc(w->allociovecs * sizeof(*w->iovecs));
if (w->iovecs == NULL)
err (1, "malloc");
w->fd = fd;
}
static void
write_state_add (struct write_state *w, void *v, size_t len)
{
if(w->niovecs == w->allociovecs) {
if(w->niovecs == w->maxiovecs) {
if(writev (w->fd, w->iovecs, w->niovecs) < 0)
err(1, "writev");
w->niovecs = 0;
} else {
w->allociovecs = min(w->allociovecs + STEP, w->maxiovecs);
w->iovecs = realloc (w->iovecs,
w->allociovecs * sizeof(*w->iovecs));
if (w->iovecs == NULL)
errx (1, "realloc");
}
}
w->iovecs[w->niovecs].iov_base = v;
w->iovecs[w->niovecs].iov_len = len;
++w->niovecs;
}
static void
write_state_flush (struct write_state *w)
{
if (w->niovecs) {
if (writev (w->fd, w->iovecs, w->niovecs) < 0)
err (1, "writev");
w->niovecs = 0;
}
}
static void
write_state_destroy (struct write_state *w)
{
free (w->iovecs);
}
static int
doit(int s,
const char *host,
const char *user,
const char *outfilename,
const char *header_str,
int leavep,
int verbose,
int forkp)
{
int ret;
char out_buf[PUSH_BUFSIZ];
size_t out_len = 0;
char in_buf[PUSH_BUFSIZ + 1]; /* sentinel */
size_t in_len = 0;
char *in_ptr = in_buf;
pop_state state = INIT;
unsigned count, bytes;
unsigned asked_for = 0, retrieved = 0, asked_deleted = 0, deleted = 0;
unsigned sent_xdele = 0;
int out_fd;
char from_line[128];
size_t from_line_length;
time_t now;
struct write_state write_state;
if (do_from) {
out_fd = -1;
if (verbose)
fprintf (stderr, "%s@%s\n", user, host);
} else {
out_fd = open(outfilename, O_WRONLY | O_APPEND | O_CREAT, 0666);
if (out_fd < 0)
err (1, "open %s", outfilename);
if (verbose)
fprintf (stderr, "%s@%s -> %s\n", user, host, outfilename);
}
now = time(NULL);
from_line_length = snprintf (from_line, sizeof(from_line),
"From %s %s", "push", ctime(&now));
out_len = snprintf (out_buf, sizeof(out_buf),
"USER %s\r\nPASS hej\r\nSTAT\r\n",
user);
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)
write (STDERR_FILENO, out_buf, out_len);
if (!do_from)
write_state_init (&write_state, out_fd);
while(state != QUIT) {
fd_set readset, writeset;
FD_ZERO(&readset);
FD_ZERO(&writeset);
FD_SET(s,&readset);
if (((state == STAT || state == RETR || state == TOP)
&& asked_for < count)
|| (state == XDELE && !sent_xdele)
|| (state == DELE && asked_deleted < count))
FD_SET(s,&writeset);
ret = select (s + 1, &readset, &writeset, NULL, NULL);
if (ret < 0) {
if (errno == EAGAIN)
continue;
else
err (1, "select");
}
if (FD_ISSET(s, &readset)) {
char *beg, *p;
size_t rem;
int blank_line = 0;
ret = read (s, in_ptr, sizeof(in_buf) - in_len - 1);
if (ret < 0)
err (1, "read");
else if (ret == 0)
errx (1, "EOF during read");
in_len += ret;
in_ptr += ret;
*in_ptr = '\0';
beg = in_buf;
rem = in_len;
while(rem > 1
&& (p = strstr(beg, "\r\n")) != NULL) {
if (state == TOP) {
char *copy = beg;
if (strncasecmp(copy,
header_str,
min(p - copy + 1, strlen(header_str))) == 0) {
fprintf (stdout, "%.*s\n", (int)(p - copy), copy);
}
if (beg[0] == '.' && beg[1] == '\r' && beg[2] == '\n') {
state = STAT;
if (++retrieved == count) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
}
}
rem -= p - beg + 2;
beg = p + 2;
} else if (state == RETR) {
char *copy = beg;
if (beg[0] == '.') {
if (beg[1] == '\r' && beg[2] == '\n') {
if(!blank_line)
write_state_add(&write_state, "\n", 1);
state = STAT;
rem -= p - beg + 2;
beg = p + 2;
if (++retrieved == count) {
write_state_flush (&write_state);
if (fsync (out_fd) < 0)
err (1, "fsync");
close(out_fd);
if (leavep) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
} else {
if (forkp) {
pid_t pid;
pid = fork();
if (pid < 0)
warn ("fork");
else if(pid != 0) {
if(verbose)
fprintf (stderr,
"(exiting)");
return 0;
}
}
state = XDELE;
if (verbose)
fprintf (stderr, "deleting... ");
}
}
continue;
} else
++copy;
}
*p = '\n';
if(blank_line &&
strncmp(copy, "From ", min(p - copy + 1, 5)) == 0)
write_state_add(&write_state, ">", 1);
write_state_add(&write_state, copy, p - copy + 1);
blank_line = (*copy == '\n');
rem -= p - beg + 2;
beg = p + 2;
} else if (rem >= 3 && strncmp (beg, "+OK", 3) == 0) {
if (state == STAT) {
if (!do_from)
write_state_add(&write_state,
from_line, from_line_length);
blank_line = 0;
if (do_from)
state = TOP;
else
state = RETR;
} else if (state == XDELE) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
break;
} else if (state == DELE) {
if (++deleted == count) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
break;
}
} else if (++state == STAT) {
if(sscanf (beg + 4, "%u %u", &count, &bytes) != 2)
errx(1, "Bad STAT-line: %.*s", (int)(p - beg), beg);
if (verbose) {
fprintf (stderr, "%u message(s) (%u bytes). "
"fetching... ",
count, bytes);
if (do_from)
fprintf (stderr, "\n");
} else if (do_count) {
fprintf (stderr, "%u message(s) (%u bytes).\n",
count, bytes);
}
if (count == 0) {
state = QUIT;
net_write (s, "QUIT\r\n", 6);
if (verbose > 1)
net_write (STDERR_FILENO, "QUIT\r\n", 6);
break;
}
}
rem -= p - beg + 2;
beg = p + 2;
} else {
if(state == XDELE) {
state = DELE;
rem -= p - beg + 2;
beg = p + 2;
} else
errx (1, "Bad response: %.*s", (int)(p - beg), beg);
}
}
if (!do_from)
write_state_flush (&write_state);
memmove (in_buf, beg, rem);
in_len = rem;
in_ptr = in_buf + rem;
}
if (FD_ISSET(s, &writeset)) {
if ((state == STAT && !do_from) || state == RETR)
out_len = snprintf (out_buf, sizeof(out_buf),
"RETR %u\r\n", ++asked_for);
else if ((state == STAT && do_from) || state == TOP)
out_len = snprintf (out_buf, sizeof(out_buf),
"TOP %u 0\r\n", ++asked_for);
else if(state == XDELE) {
out_len = snprintf(out_buf, sizeof(out_buf),
"XDELE %u %u\r\n", 1, count);
sent_xdele++;
}
else if(state == DELE)
out_len = snprintf (out_buf, sizeof(out_buf),
"DELE %u\r\n", ++asked_deleted);
if (net_write (s, out_buf, out_len) != out_len)
err (1, "write");
if (verbose > 1)
write (STDERR_FILENO, out_buf, out_len);
}
}
if (verbose)
fprintf (stderr, "Done\n");
if (!do_from)
write_state_destroy (&write_state);
return 0;
}
#ifdef KRB5
static int
do_v5 (const char *host,
int port,
const char *user,
const char *filename,
const char *header_str,
int leavep,
int verbose,
int forkp)
{
krb5_error_code ret;
krb5_auth_context auth_context = NULL;
krb5_principal server;
int s;
s = do_connect (host, port, 1);
if (s < 0)
return 1;
ret = krb5_sname_to_principal (context,
host,
"pop",
KRB5_NT_SRV_HST,
&server);
if (ret) {
warnx ("krb5_sname_to_principal: %s",
krb5_get_err_text (context, ret));
return 1;
}
ret = krb5_sendauth (context,
&auth_context,
&s,
"KPOPV1.0",
NULL,
server,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
krb5_free_principal (context, server);
if (ret) {
warnx ("krb5_sendauth: %s",
krb5_get_err_text (context, ret));
return 1;
}
return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
}
#endif
#ifdef KRB4
static int
do_v4 (const char *host,
int port,
const char *user,
const char *filename,
const char *header_str,
int leavep,
int verbose,
int forkp)
{
KTEXT_ST ticket;
MSG_DAT msg_data;
CREDENTIALS cred;
des_key_schedule sched;
int s;
int ret;
s = do_connect (host, port, 1);
if (s < 0)
return 1;
ret = krb_sendauth(0,
s,
&ticket,
"pop",
(char *)host,
krb_realmofhost(host),
getpid(),
&msg_data,
&cred,
sched,
NULL,
NULL,
"KPOPV0.1");
if(ret) {
warnx("krb_sendauth: %s", krb_get_err_text(ret));
return 1;
}
return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
}
#endif /* KRB4 */
#ifdef HESIOD
#ifdef HESIOD_INTERFACES
static char *
hesiod_get_pobox (const char **user)
{
void *context;
struct hesiod_postoffice *hpo;
char *ret = NULL;
if(hesiod_init (&context) != 0)
err (1, "hesiod_init");
hpo = hesiod_getmailhost (context, *user);
if (hpo == NULL) {
warn ("hesiod_getmailhost %s", *user);
} else {
if (strcasecmp(hpo->hesiod_po_type, "pop") != 0)
errx (1, "Unsupported po type %s", hpo->hesiod_po_type);
ret = strdup(hpo->hesiod_po_host);
if(ret == NULL)
errx (1, "strdup: out of memory");
*user = strdup(hpo->hesiod_po_name);
if (*user == NULL)
errx (1, "strdup: out of memory");
hesiod_free_postoffice (context, hpo);
}
hesiod_end (context);
return ret;
}
#else /* !HESIOD_INTERFACES */
static char *
hesiod_get_pobox (const char **user)
{
char *ret = NULL;
struct hes_postoffice *hpo;
hpo = hes_getmailhost (*user);
if (hpo == NULL) {
warn ("hes_getmailhost %s", *user);
} else {
if (strcasecmp(hpo->po_type, "pop") != 0)
errx (1, "Unsupported po type %s", hpo->po_type);
ret = strdup(hpo->po_host);
if(ret == NULL)
errx (1, "strdup: out of memory");
*user = strdup(hpo->po_name);
if (*user == NULL)
errx (1, "strdup: out of memory");
}
return ret;
}
#endif /* HESIOD_INTERFACES */
#endif /* HESIOD */
static char *
get_pobox (const char **user)
{
char *ret = NULL;
#ifdef HESIOD
ret = hesiod_get_pobox (user);
#endif
if (ret == NULL)
ret = getenv("MAILHOST");
if (ret == NULL)
errx (1, "MAILHOST not set");
return ret;
}
static void
parse_pobox (char *a0, const char **host, const char **user)
{
const char *h, *u;
char *p;
int po = 0;
if (a0 == NULL) {
*user = getenv ("USERNAME");
if (*user == NULL) {
struct passwd *pwd = getpwuid (getuid ());
if (pwd == NULL)
errx (1, "Who are you?");
*user = strdup (pwd->pw_name);
if (*user == NULL)
errx (1, "strdup: out of memory");
}
*host = get_pobox (user);
return;
}
/* if the specification starts with po:, remember this information */
if(strncmp(a0, "po:", 3) == 0) {
a0 += 3;
po++;
}
/* if there is an `@', the hostname is after it, otherwise at the
beginning of the string */
p = strchr(a0, '@');
if(p != NULL) {
*p++ = '\0';
h = p;
} else {
h = a0;
}
/* if there is a `:', the username comes before it, otherwise at
the beginning of the string */
p = strchr(a0, ':');
if(p != NULL) {
*p++ = '\0';
u = p;
} else {
u = a0;
}
if(h == u) {
/* some inconsistent compatibility with various mailers */
if(po) {
h = get_pobox (&u);
} else {
u = get_default_username ();
if (u == NULL)
errx (1, "Who are you?");
}
}
*host = h;
*user = u;
}
int
main(int argc, char **argv)
{
int port = 0;
int optind = 0;
int ret = 1;
const char *host, *user, *filename = NULL;
char *pobox = NULL;
set_progname (argv[0]);
#ifdef KRB5
krb5_init_context (&context);
#endif
if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
&optind))
usage (1);
argc -= optind;
argv += optind;
#if defined(KRB4) && defined(KRB5)
if(use_v4 == -1 && use_v5 == 1)
use_v4 = 0;
if(use_v5 == -1 && use_v4 == 1)
use_v5 = 0;
#endif
if (do_help)
usage (0);
if (do_version) {
print_version(NULL);
return 0;
}
if (do_from && header_str == NULL)
header_str = "From:";
else if (header_str != NULL)
do_from = 1;
if (do_from) {
if (argc == 0)
pobox = NULL;
else if (argc == 1)
pobox = argv[0];
else
usage (1);
} else {
if (argc == 1) {
filename = argv[0];
pobox = NULL;
} else if (argc == 2) {
filename = argv[1];
pobox = argv[0];
} else
usage (1);
}
if (port_str) {
struct servent *s = roken_getservbyname (port_str, "tcp");
if (s)
port = s->s_port;
else {
char *ptr;
port = strtol (port_str, &ptr, 10);
if (port == 0 && ptr == port_str)
errx (1, "Bad port `%s'", port_str);
port = htons(port);
}
}
if (port == 0)
#ifdef KRB5
port = krb5_getportbyname (context, "kpop", "tcp", 1109);
#elif defined(KRB4)
port = k_getportbyname ("kpop", "tcp", 1109);
#else
#error must define KRB4 or KRB5
#endif
parse_pobox (pobox, &host, &user);
#ifdef KRB5
if (ret && use_v5) {
ret = do_v5 (host, port, user, filename, header_str,
do_leave, verbose_level, do_fork);
}
#endif
#ifdef KRB4
if (ret && use_v4) {
ret = do_v4 (host, port, user, filename, header_str,
do_leave, verbose_level, do_fork);
}
#endif /* KRB4 */
return ret;
}
-77
View File
@@ -1,77 +0,0 @@
PUSH(8) UNIX System Manager's Manual PUSH(8)
NNAAMMEE
ppuusshh - fetch mail via POP
SSYYNNOOPPSSIISS
ppuusshh [--44 | ----kkrrbb44] [--55 | ----kkrrbb55] [--vv | ----vveerrbboossee] [--ff | ----ffoorrkk] [--ll |
----lleeaavvee] [----ffrroomm] [--cc | ----ccoouunntt] [----hheeaaddeerr] [--pp _p_o_r_t_-_s_p_e_c | ----ppoorrtt==_p_o_r_t_-
_s_p_e_c] _p_o_-_b_o_x _f_i_l_e_n_a_m_e
DDEESSCCRRIIPPTTIIOONN
ppuusshh retrieves mail from the post office box _p_o_-_b_o_x, and stores the mail
in mbox format in _f_i_l_e_n_a_m_e. The _p_o_-_b_o_x can have any of the following for-
mats:
`hostname:username'
`po:hostname:username'
`username@hostname'
`po:username@hostname'
`hostname'
`po:username'
If no username is specified, ppuusshh assumes that it's the same as on the
local machine; _h_o_s_t_n_a_m_e defaults to the value of the MAILHOST environment
variable.
Supported options:
--44, ----kkrrbb44
use Kerberos 4 (if compiled with support for Kerberos 4)
--55, ----kkrrbb55
use Kerberos 5 (if compiled with support for Kerberos 5)
--ff, ----ffoorrkk
fork before starting to delete messages
--ll, ----lleeaavvee
don't delete fetched mail
----ffrroomm behave like from.
--cc, ----ccoouunntt
first print how many messages and bytes there are.
----hheeaaddeerr
which header from should print.
--pp _p_o_r_t_-_s_p_e_c, ----ppoorrtt==_p_o_r_t_-_s_p_e_c
use this port instead of the default `kpop' or `1109'.
The default is to first try Kerberos 5 authentication and then, if that
fails, Kerberos 4.
EENNVVIIRROONNMMEENNTT
MAILHOST
points to the post office, if no other hostname is specified.
EEXXAAMMPPLLEESS
$ push cornfield:roosta ~/.gnus-crash-box
tries to fetch mail for the user _r_o_o_s_t_a from the post office at
``cornfield'', and stores the mail in _~_/_._g_n_u_s_-_c_r_a_s_h_-_b_o_x (you are using
Gnus, aren't you?)
$ push --from -5 havregryn
tries to fetch FFrroomm:: lines for current user at post office ``havregryn''
using Kerberos 5.
SSEEEE AALLSSOO
movemail(8), popper(8), from(1)
HHIISSTTOORRYY
ppuusshh was written while waiting for mmoovveemmaaiill to finish getting the mail.
HEIMDAL May 31, 1998 2
-98
View File
@@ -1,98 +0,0 @@
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: push_locl.h,v 1.6 1999/12/02 16:58:33 joda Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <ctype.h>
#include <limits.h>
#include <time.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
#include <netinet/in6.h>
#endif
#ifdef HAVE_NETINET6_IN6_H
#include <netinet6/in6.h>
#endif
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HESIOD
#include <hesiod.h>
#endif
#include <roken.h>
#include <err.h>
#include <getarg.h>
#ifdef KRB5
#include <krb5.h>
#endif
#ifdef KRB4
#include <krb.h>
#endif
-83
View File
@@ -1,83 +0,0 @@
# $Id: Makefile.in,v 1.18 1999/03/10 19:01:13 joda Exp $
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
top_builddir = ../..
CC = @CC@
LINK = @LINK@
AR = ar
DEFS = @DEFS@
CFLAGS = @CFLAGS@ $(WFLAGS)
WFLAGS = @WFLAGS@
LD_FLAGS = @LD_FLAGS@
INSTALL = @INSTALL@
LIBS = @LIBS@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
libexecdir = @libexecdir@
bindir = @bindir@
transform=@program_transform_name@
EXECSUFFIX=@EXECSUFFIX@
PROG_BIN = sample_client$(EXECSUFFIX) \
simple_client$(EXECSUFFIX)
PROG_LIBEXEC = sample_server$(EXECSUFFIX) \
simple_server$(EXECSUFFIX)
PROGS = $(PROG_BIN) $(PROG_LIBEXEC)
OBJECTS = sample_client.o sample_server.o simple_client.o simple_server.o
SOURCES = sample_client.c sample_server.c simple_client.c simple_server.c
all: $(PROGS)
Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
$(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
install: all
uninstall:
TAGS: $(SOURCES)
etags $(SOURCES)
check:
clean:
rm -f *.a *.o $(PROGS)
mostlyclean: clean
distclean: clean
rm -f Makefile *.tab.c *~
realclean: distclean
rm -f TAGS
KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes
LIBROKEN=-L../../lib/roken -lroken
sample_client$(EXECSUFFIX): sample_client.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ sample_client.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
simple_client$(EXECSUFFIX): simple_client.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ simple_client.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
sample_server$(EXECSUFFIX): sample_server.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ sample_server.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
simple_server$(EXECSUFFIX): simple_server.o
$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ simple_server.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
$(OBJECTS): ../../include/config.h
.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
-76
View File
@@ -1,76 +0,0 @@
/*
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Id: sample.h,v 1.11 1999/12/02 16:58:33 joda Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include <errno.h>
#ifdef SOCKS
#include <socks.h>
/* This doesn't belong here. */
struct tm *localtime(const time_t *);
struct hostent *gethostbyname(const char *);
#endif
#include <err.h>
#include <krb.h>
#include <roken.h>
#define SAMPLE_PORT 6354
#define SAMPLE_SERVICE "sample"
#define SAMPLE_VERSION "VERSION9"
@@ -1,168 +0,0 @@
/*
*
* Copyright 1987, 1988 by the Massachusetts Institute of Technology.
*
* For copying and distribution information,
* please see the file <mit-copyright.h>.
*
* sample_client:
* A sample Kerberos client, which connects to a server on a remote host,
* at port "sample" (be sure to define it in /etc/services)
* and authenticates itself to the server. The server then writes back
* (in ASCII) the authenticated name.
*
* Usage:
* sample_client <hostname> <checksum>
*
* <hostname> is the name of the foreign host to contact.
*
* <checksum> is an integer checksum to be used for the call to krb_mk_req()
* and mutual authentication
*
*/
#include "sample.h"
RCSID("$Id: sample_client.c,v 1.21 1999/11/13 06:27:01 assar Exp $");
static void
usage (void)
{
fprintf (stderr, "Usage: %s [-s service] [-p port] hostname checksum\n",
__progname);
exit (1);
}
int
main(int argc, char **argv)
{
struct hostent *hp;
struct sockaddr_in sin, lsin;
char *remote_host;
int status;
int namelen;
int sock = -1;
KTEXT_ST ticket;
char buf[512];
long authopts;
MSG_DAT msg_data;
CREDENTIALS cred;
des_key_schedule sched;
u_int32_t cksum;
int c;
char service[SNAME_SZ];
u_int16_t port;
struct servent *serv;
char **h_addr_list;
set_progname (argv[0]);
strlcpy (service, SAMPLE_SERVICE, sizeof(service));
port = 0;
while ((c = getopt(argc, argv, "s:p:")) != -1)
switch(c) {
case 's' :
strlcpy (service, optarg, sizeof(service));
break;
case 'p' :
serv = getservbyname (optarg, "tcp");
if (serv)
port = serv->s_port;
else
port = htons(atoi(optarg));
break;
case '?' :
default :
usage();
}
argc -= optind;
argv += optind;
if (argc != 2)
usage ();
/* convert cksum to internal rep */
cksum = atoi(argv[1]);
printf("Setting checksum to %ld\n", (long)cksum);
/* clear out the structure first */
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
if (port)
sin.sin_port = port;
else
sin.sin_port = k_getportbyname (service, "tcp", htons(SAMPLE_PORT));
/* look up the server host */
hp = gethostbyname(argv[0]);
if (hp == NULL)
errx (1, "gethostbyname(%s): %s", argv[0],
hstrerror(h_errno));
/* copy the hostname into non-volatile storage */
remote_host = strdup(hp->h_name);
if (remote_host == NULL)
errx (1, "strdup: out of memory");
/* set up the address of the foreign socket for connect() */
sin.sin_family = hp->h_addrtype;
for (h_addr_list = hp->h_addr_list;
*h_addr_list;
++h_addr_list) {
memcpy(&sin.sin_addr, *h_addr_list, sizeof(sin.sin_addr));
fprintf (stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr));
/* open a TCP socket */
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock < 0)
err (1, "socket");
/* connect to the server */
if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
close (sock);
}
if (*h_addr_list == NULL)
err (1, "connect");
/* find out who I am, now that we are connected and therefore bound */
namelen = sizeof(lsin);
if (getsockname(sock, (struct sockaddr *) &lsin, &namelen) < 0) {
close (sock);
err (1, "getsockname");
}
/* call Kerberos library routine to obtain an authenticator,
pass it over the socket to the server, and obtain mutual
authentication. */
authopts = KOPT_DO_MUTUAL;
status = krb_sendauth(authopts, sock, &ticket,
service, remote_host,
NULL, cksum, &msg_data, &cred,
sched, &lsin, &sin, SAMPLE_VERSION);
if (status != KSUCCESS)
errx (1, "cannot authenticate to server: %s",
krb_get_err_text(status));
/* After we send the authenticator to the server, it will write
back the name we authenticated to. Read what it has to say. */
status = read(sock, buf, sizeof(buf));
if (status < 0)
errx(1, "read");
/* make sure it's null terminated before printing */
if (status < sizeof(buf))
buf[status] = '\0';
else
buf[sizeof(buf) - 1] = '\0';
printf("The server says:\n%s\n", buf);
close(sock);
return 0;
}
@@ -1,153 +0,0 @@
/*
*
* Copyright 1987, 1988 by the Massachusetts Institute of Technology.
*
* For copying and distribution information,
* please see the file <mit-copyright.h>.
*
* sample_server:
* A sample Kerberos server, which reads a ticket from a TCP socket,
* decodes it, and writes back the results (in ASCII) to the client.
*
* Usage:
* sample_server
*
* file descriptor 0 (zero) should be a socket connected to the requesting
* client (this will be correct if this server is started by inetd).
*/
#include "sample.h"
RCSID("$Id: sample_server.c,v 1.14 1999/11/13 06:28:49 assar Exp $");
static void
usage (void)
{
fprintf (stderr, "Usage: %s [-i] [-s service] [-t srvtab]\n",
__progname);
exit (1);
}
int
main(int argc, char **argv)
{
struct sockaddr_in peername, myname;
int namelen = sizeof(peername);
int status, count, len;
long authopts;
AUTH_DAT auth_data;
KTEXT_ST clt_ticket;
des_key_schedule sched;
char instance[INST_SZ];
char service[ANAME_SZ];
char version[KRB_SENDAUTH_VLEN+1];
char retbuf[512];
char lname[ANAME_SZ];
char srvtab[MaxPathLen];
int c;
int no_inetd = 0;
/* open a log connection */
set_progname (argv[0]);
roken_openlog(__progname, LOG_ODELAY, LOG_DAEMON);
strlcpy (service, SAMPLE_SERVICE, sizeof(service));
*srvtab = '\0';
while ((c = getopt (argc, argv, "s:t:i")) != -1)
switch (c) {
case 's' :
strlcpy (service, optarg, sizeof(service));
break;
case 't' :
strlcpy (srvtab, optarg, sizeof(srvtab));
break;
case 'i':
no_inetd = 1;
break;
case '?' :
default :
usage ();
}
if (no_inetd)
mini_inetd (htons(SAMPLE_PORT));
/*
* To verify authenticity, we need to know the address of the
* client.
*/
if (getpeername(STDIN_FILENO,
(struct sockaddr *)&peername,
&namelen) < 0) {
syslog(LOG_ERR, "getpeername: %m");
return 1;
}
/* for mutual authentication, we need to know our address */
namelen = sizeof(myname);
if (getsockname(STDIN_FILENO, (struct sockaddr *)&myname, &namelen) < 0) {
syslog(LOG_ERR, "getsocknamename: %m");
return 1;
}
/* read the authenticator and decode it. Using `k_getsockinst' we
* always get the right instance on a multi-homed host.
*/
k_getsockinst (STDIN_FILENO, instance, sizeof(instance));
/* we want mutual authentication */
authopts = KOPT_DO_MUTUAL;
status = krb_recvauth(authopts, STDIN_FILENO, &clt_ticket,
service, instance, &peername, &myname,
&auth_data, srvtab,
sched, version);
if (status != KSUCCESS) {
snprintf(retbuf, sizeof(retbuf),
"Kerberos error: %s\n",
krb_get_err_text(status));
syslog(LOG_ERR, retbuf);
} else {
/* Check the version string (KRB_SENDAUTH_VLEN chars) */
if (strncmp(version, SAMPLE_VERSION, KRB_SENDAUTH_VLEN)) {
/* didn't match the expected version */
/* could do something different, but we just log an error
and continue */
version[8] = '\0'; /* make sure null term */
syslog(LOG_ERR, "Version mismatch: '%s' isn't '%s'",
version, SAMPLE_VERSION);
}
/* now that we have decoded the authenticator, translate
the kerberos principal.instance@realm into a local name */
if (krb_kntoln(&auth_data, lname) != KSUCCESS)
strlcpy(lname,
"*No local name returned by krb_kntoln*",
sizeof(lname));
/* compose the reply */
snprintf(retbuf, sizeof(retbuf),
"You are %s.%s@%s (local name %s),\n at address %s, version %s, cksum %ld\n",
auth_data.pname,
auth_data.pinst,
auth_data.prealm,
lname,
inet_ntoa(peername.sin_addr),
version,
(long)auth_data.checksum);
}
/* write back the response */
if ((count = write(0, retbuf, (len = strlen(retbuf) + 1))) < 0) {
syslog(LOG_ERR,"write: %m");
return 1;
} else if (count != len) {
syslog(LOG_ERR, "write count incorrect: %d != %d\n",
count, len);
return 1;
}
/* close up and exit */
close(0);
return 0;
}
-14
View File
@@ -1,14 +0,0 @@
/*
* $Id: simple.h,v 1.3 1996/09/27 15:54:23 assar Exp $
*
* Copyright 1988 by the Massachusetts Institute of Technology.
*
* For copying and distribution information, please see the file
* <mit-copyright.h>.
*
* Common definitions for the simple UDP-based Kerberos-mediated
* server & client applications.
*/
#define SERVICE "sample"
#define HOST "bach"
@@ -1,202 +0,0 @@
/*
*
* Copyright 1989 by the Massachusetts Institute of Technology.
*
* For copying and distribution information, please see the file
* <mit-copyright.h>.
*
* Simple UDP-based sample client program. For demonstration.
* This program performs no useful function.
*/
#include "sample.h"
RCSID("$Id: simple_client.c,v 1.15 1999/11/13 06:29:01 assar Exp $");
#define MSG "hi, Jennifer!" /* message text */
static int
talkto(char *hostname, char *service, int port)
{
int flags = 0; /* flags for sendto() */
long len;
u_long cksum = 0L; /* cksum not used */
char c_realm[REALM_SZ]; /* local Kerberos realm */
char *s_realm; /* server's Kerberos realm */
KTEXT_ST k; /* Kerberos data */
KTEXT ktxt = &k;
int sock, i;
struct hostent *host;
struct sockaddr_in s_sock; /* server address */
char myhostname[MaxHostNameLen]; /* local hostname */
/* for krb_mk_safe/priv */
struct sockaddr_in c_sock; /* client address */
CREDENTIALS c; /* ticket & session key */
CREDENTIALS *cred = &c;
/* for krb_mk_priv */
des_key_schedule sched; /* session key schedule */
/* Look up server host */
if ((host = gethostbyname(hostname)) == NULL) {
fprintf(stderr, "%s: unknown host \n", hostname);
return 1;
}
/* Set server's address */
memset(&s_sock, 0, sizeof(s_sock));
memcpy(&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr));
s_sock.sin_family = AF_INET;
if (port)
s_sock.sin_port = port;
else
s_sock.sin_port = k_getportbyname (service, "tcp", htons(SAMPLE_PORT));
if (gethostname(myhostname, sizeof(myhostname)) < 0) {
warn("gethostname");
return 1;
}
if ((host = gethostbyname(myhostname)) == NULL) {
fprintf(stderr, "%s: unknown host\n", myhostname);
return 1;
}
/* Open a socket */
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
warn("socket SOCK_DGRAM");
return 1;
}
memset(&c_sock, 0, sizeof(c_sock));
memcpy(&c_sock.sin_addr, host->h_addr, sizeof(c_sock.sin_addr));
c_sock.sin_family = AF_INET;
/* Bind it to set the address; kernel will fill in port # */
if (bind(sock, (struct sockaddr *)&c_sock, sizeof(c_sock)) < 0) {
warn("bind");
return 1;
}
/* Get local realm, not needed, just an example */
if ((i = krb_get_lrealm(c_realm, 1)) != KSUCCESS) {
fprintf(stderr, "can't find local Kerberos realm\n");
return 1;
}
printf("Local Kerberos realm is %s\n", c_realm);
/* Get Kerberos realm of host */
s_realm = krb_realmofhost(hostname);
/* PREPARE KRB_MK_REQ MESSAGE */
/* Get credentials for server, create krb_mk_req message */
if ((i = krb_mk_req(ktxt, service, hostname, s_realm, cksum))
!= KSUCCESS) {
fprintf(stderr, "%s\n", krb_get_err_text(i));
return 1;
}
printf("Got credentials for %s.\n", service);
/* Send authentication info to server */
i = sendto(sock, (char *)ktxt->dat, ktxt->length, flags,
(struct sockaddr *)&s_sock, sizeof(s_sock));
if (i < 0)
warn("sending datagram message");
printf("Sent authentication data: %d bytes\n", i);
/* PREPARE KRB_MK_SAFE MESSAGE */
/* Get my address */
memset(&c_sock, 0, sizeof(c_sock));
i = sizeof(c_sock);
if (getsockname(sock, (struct sockaddr *)&c_sock, &i) < 0) {
warn("getsockname");
return 1;
}
/* Get session key */
i = krb_get_cred(service, hostname, s_realm, cred);
if (i != KSUCCESS)
return 1;
/* Make the safe message */
len = krb_mk_safe(MSG, ktxt->dat, strlen(MSG)+1,
&cred->session, &c_sock, &s_sock);
/* Send it */
i = sendto(sock, (char *)ktxt->dat, (int) len, flags,
(struct sockaddr *)&s_sock, sizeof(s_sock));
if (i < 0)
warn("sending safe message");
printf("Sent checksummed message: %d bytes\n", i);
/* PREPARE KRB_MK_PRIV MESSAGE */
#ifdef NOENCRYPTION
memset(sched, 0, sizeof(sched));
#else
/* Get key schedule for session key */
des_key_sched(&cred->session, sched);
#endif
/* Make the encrypted message */
len = krb_mk_priv(MSG, ktxt->dat, strlen(MSG)+1,
sched, &cred->session, &c_sock, &s_sock);
/* Send it */
i = sendto(sock, (char *)ktxt->dat, (int) len, flags,
(struct sockaddr *)&s_sock, sizeof(s_sock));
if (i < 0)
warn("sending encrypted message");
printf("Sent encrypted message: %d bytes\n", i);
return 0;
}
static void
usage (void)
{
fprintf (stderr, "Usage: %s [-s service] [-p port] hostname\n",
__progname);
exit (1);
}
int
main(int argc, char **argv)
{
int ret = 0;
int port = 0;
char service[SNAME_SZ];
struct servent *serv;
int c;
set_progname (argv[0]);
strlcpy (service, SAMPLE_SERVICE, sizeof(service));
while ((c = getopt(argc, argv, "s:p:")) != -1)
switch(c) {
case 's' :
strlcpy (service, optarg, sizeof(service));
break;
case 'p' :
serv = getservbyname (optarg, "tcp");
if (serv)
port = serv->s_port;
else
port = htons(atoi(optarg));
break;
case '?' :
default :
usage();
}
argc -= optind;
argv += optind;
while (argc-- > 0)
ret &= talkto (*argv++, service, port);
return ret;
}
@@ -1,140 +0,0 @@
/*
*
* Copyright 1989 by the Massachusetts Institute of Technology.
*
* For copying and distribution information, please see the file
* <mit-copyright.h>.
*
* Simple UDP-based server application. For demonstration.
* This program performs no useful function.
*/
#include "sample.h"
RCSID("$Id: simple_server.c,v 1.11 1999/11/13 06:29:24 assar Exp $");
static void
usage (void)
{
fprintf (stderr, "Usage: %s [-p port] [-s service] [-t srvtab]\n",
__progname);
exit (1);
}
int
main(int argc, char **argv)
{
char service[SNAME_SZ];
char instance[INST_SZ];
int port;
char srvtab[MaxPathLen];
struct sockaddr_in addr, otheraddr;
int c;
int sock;
int i;
int len;
KTEXT_ST k;
KTEXT ktxt = &k;
AUTH_DAT ad;
MSG_DAT msg_data;
des_key_schedule sched;
set_progname (argv[0]);
strlcpy (service, SAMPLE_SERVICE, sizeof(service));
strlcpy (instance, "*", sizeof(instance));
*srvtab = '\0';
port = 0;
while ((c = getopt (argc, argv, "p:s:t:")) != -1)
switch (c) {
case 'p' : {
struct servent *sp;
sp = getservbyname (optarg, "udp");
if (sp)
port = sp->s_port;
else
port = htons(atoi(optarg));
break;
}
case 's' :
strlcpy (service, optarg, sizeof(service));
break;
case 't' :
strlcpy (srvtab, optarg, sizeof(srvtab));
break;
case '?' :
default :
usage ();
}
if(port == 0)
port = k_getportbyname (SAMPLE_SERVICE, "udp", htons(SAMPLE_PORT));
memset (&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = port;
sock = socket (AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
err (1, "socket");
if (bind (sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
err (1, "bind");
/* GET KRB_MK_REQ MESSAGE */
i = read(sock, ktxt->dat, MAX_KTXT_LEN);
if (i < 0)
err (1, "read");
printf("Received %d bytes\n", i);
ktxt->length = i;
/* Check authentication info */
i = krb_rd_req(ktxt, service, instance, 0, &ad, "");
if (i != KSUCCESS)
errx (1, "krb_rd_req: %s", krb_get_err_text(i));
printf("Got authentication info from %s%s%s@%s\n", ad.pname,
*ad.pinst ? "." : "", ad.pinst, ad.prealm);
/* GET KRB_MK_SAFE MESSAGE */
/* use "recvfrom" so we know client's address */
len = sizeof(otheraddr);
i = recvfrom(sock, ktxt->dat, MAX_KTXT_LEN, 0,
(struct sockaddr *)&otheraddr, &len);
if (i < 0)
err (1, "recvfrom");
printf("Received %d bytes\n", i);
/* Verify the checksummed message */
i = krb_rd_safe(ktxt->dat, i, &ad.session, &otheraddr,
&addr, &msg_data);
if (i != KSUCCESS)
errx (1, "krb_rd_safe: %s", krb_get_err_text(i));
printf("Safe message is: %s\n", msg_data.app_data);
/* NOW GET ENCRYPTED MESSAGE */
#ifdef NOENCRYPTION
memset(sched, 0, sizeof(sched));
#else
/* need key schedule for session key */
des_key_sched(&ad.session, sched);
#endif
/* use "recvfrom" so we know client's address */
len = sizeof(otheraddr);
i = recvfrom(sock, ktxt->dat, MAX_KTXT_LEN, 0,
(struct sockaddr *)&otheraddr, &len);
if (i < 0)
err (1, "recvfrom");
printf("Received %d bytes\n", i);
i = krb_rd_priv(ktxt->dat, i, sched, &ad.session, &otheraddr,
&addr, &msg_data);
if (i != KSUCCESS)
errx (1, "krb_rd_priv: %s", krb_get_err_text(i));
printf("Decrypted message is: %s\n", msg_data.app_data);
return(0);
}
-216
View File
@@ -1,216 +0,0 @@
1999-11-05 Assar Westerlund <[email protected]>
* check-x.m4: include X_PRE_LIBS and X_EXTRA_LIBS when testing
1999-11-01 Assar Westerlund <[email protected]>
* Makefile.am.common (install-build-headers): use `cp' instead of
INSTALL_DATA for copying header files inside the build tree. The
user might have redefined INSTALL_DATA to specify owners and other
information.
1999-10-30 Assar Westerlund <[email protected]>
* find-func-no-libs2.m4: add yet another argument to allow specify
linker flags that will be added _before_ the library when trying
to link
* find-func-no-libs.m4: add yet another argument to allow specify
linker flags that will be added _before_ the library when trying
to link
1999-10-12 Assar Westerlund <[email protected]>
* find-func-no-libs2.m4 (AC_FIND_FUNC_NO_LIBS2): new argument
`extra libs'
* find-func-no-libs.m4 (AC_FIND_FUNC_NO_LIBS): new argument `extra
libs'
1999-09-01 Johan Danielsson <[email protected]>
* capabilities.m4: sgi capabilities
1999-07-29 Assar Westerlund <[email protected]>
* have-struct-field.m4: quote macros when undefining
1999-07-28 Assar Westerlund <[email protected]>
* Makefile.am.common (install-build-headers): add dependencies
1999-07-24 Assar Westerlund <[email protected]>
* have-type.m4: try to get autoheader to co-operate
* have-type.m4: stolen from Arla
* krb-struct-sockaddr-sa-len.m4: not used any longer. removed.
1999-06-13 Assar Westerlund <[email protected]>
* krb-struct-spwd.m4: consequent name of cache variables
* krb-func-getlogin.m4: new file for testing for posix (broken)
getlogin
* shared-libs.m4 (freebsd[34]): don't use ld -Bshareable
1999-06-02 Johan Danielsson <[email protected]>
* check-x.m4: extended test for X
1999-05-14 Assar Westerlund <[email protected]>
* check-netinet-ip-and-tcp.m4: proper autoheader tricks
* check-netinet-ip-and-tcp.m4: new file for checking for
netinet/{ip,tcp}.h. These are special as they on Irix 6.5.3
require <standards.h> to be included in advance.
* check-xau.m4: we also need to check for XauFilename since it's
used by appl/kx. And on Irix 6.5 that function requires linking
with -lX11.
1999-05-08 Assar Westerlund <[email protected]>
* krb-find-db.m4: try with more header files than ndbm.h
1999-04-19 Assar Westerlund <[email protected]>
* test-package.m4: try to handle the case of --without-package
correctly
1999-04-17 Assar Westerlund <[email protected]>
* make-aclocal: removed. Not used anymore, being replaced by
aclocal from automake.
Thu Apr 15 14:17:26 1999 Johan Danielsson <[email protected]>
* make-proto.pl: handle __attribute__
Fri Apr 9 20:37:18 1999 Assar Westerlund <[email protected]>
* shared-libs.m4: quote $@
(freebsd3): add install_symlink_command2
Wed Apr 7 20:40:22 1999 Assar Westerlund <[email protected]>
* shared-libs.m4 (hpux): no library dependencies
Mon Apr 5 16:13:08 1999 Johan Danielsson <[email protected]>
* test-package.m4: compile and link, rather than looking for
files; also export more information, so it's possible to add rpath
information
Tue Mar 30 13:49:54 1999 Johan Danielsson <[email protected]>
* Makefile.am.common: CFLAGS -> AM_CFLAGS
Mon Mar 29 16:51:12 1999 Johan Danielsson <[email protected]>
* check-xau.m4: check for XauWriteAuth before checking for
XauReadAuth to catch -lX11:s not containing XauWriteAuth, and IRIX
6.5 that doesn't work with -lXau
Sat Mar 27 18:03:58 1999 Johan Danielsson <[email protected]>
* osfc2.m4: --enable-osfc2
Fri Mar 19 15:34:52 1999 Johan Danielsson <[email protected]>
* shared-libs.m4: move shared lib stuff here
Wed Mar 24 23:24:51 1999 Assar Westerlund <[email protected]>
* Makefile.am.common (install-build-headers): simplify loop
Tue Mar 23 17:31:23 1999 Johan Danielsson <[email protected]>
* check-getpwnam_r-posix.m4: check for getpwnam_r, and if it's
posix or not
Tue Mar 23 00:00:13 1999 Assar Westerlund <[email protected]>
* Makefile.am.common (install_build_headers): try to make it work
better when list of headers is empty. handle make rewriting the
filenames.
* Makefile.am.common: hesoid -> hesiod
Sun Mar 21 14:48:03 1999 Johan Danielsson <[email protected]>
* grok-type.m4: <bind/bitypes.h>
* Makefile.am.common: fix for automake bug/feature; add more LIB_*
* test-package.m4: fix typo
* check-man.m4: fix some typos
* auth-modules.m4: tests for authentication modules
Thu Mar 18 11:02:55 1999 Johan Danielsson <[email protected]>
* Makefile.am.common: make install-build-headers a multi
dependency target
* Makefile.am.common: remove include_dir hack
* Makefile.am.common: define LIB_kafs and LIB_gssapi
* krb-find-db.m4: subst DBLIB also
* check-xau.m4: test for Xau{Read,Write}Auth
Wed Mar 10 19:29:20 1999 Johan Danielsson <[email protected]>
* wflags.m4: AC_WFLAGS
Mon Mar 1 11:23:41 1999 Johan Danielsson <[email protected]>
* have-struct-field.m4: remove extra AC_MSG_RESULT
* proto-compat.m4: typo
* krb-func-getcwd-broken.m4: update to autoconf 2.13
* krb-find-db.m4: update to autoconf 2.13
* check-declaration.m4: typo
* have-pragma-weak.m4: update to autoconf 2.13
* have-struct-field.m4: better handling of types with spaces
Mon Feb 22 20:05:06 1999 Johan Danielsson <[email protected]>
* broken-glob.m4: check for broken glob
Sun Jan 31 06:50:33 1999 Assar Westerlund <[email protected]>
* krb-ipv6.m4: more magic for different v6 implementations. From
Jun-ichiro itojun Hagino <[email protected]>
Sun Nov 22 12:16:06 1998 Assar Westerlund <[email protected]>
* krb-struct-spwd.m4: new file
Thu Jun 4 04:07:41 1998 Assar Westerlund <[email protected]>
* find-func-no-libs2.m4: new file
Fri May 1 23:31:28 1998 Assar Westerlund <[email protected]>
* c-attribute.m4, c-function.m4: new files (from arla)
Wed Mar 18 23:11:29 1998 Assar Westerlund <[email protected]>
* krb-ipv6.m4: rename HAVE_STRUCT_SOCKADDR_IN6 to HAVE_IPV6
Thu Feb 26 02:37:49 1998 Assar Westerlund <[email protected]>
* make-proto.pl: should work with perl4
-255
View File
@@ -1,255 +0,0 @@
# $Id: Makefile.am.common,v 1.13 1999/11/01 03:19:58 assar Exp $
AUTOMAKE_OPTIONS = foreign no-dependencies
SUFFIXES = .et .h
INCLUDES = -I$(top_builddir)/include
AM_CFLAGS += $(WFLAGS)
COMPILE_ET = $(top_builddir)/lib/com_err/compile_et
## set build_HEADERZ to headers that should just be installed in build tree
buildinclude = $(top_builddir)/include
## these aren't detected by automake
LIB_XauReadAuth = @LIB_XauReadAuth@
LIB_crypt = @LIB_crypt@
LIB_dbm_firstkey = @LIB_dbm_firstkey@
LIB_dbopen = @LIB_dbopen@
LIB_dlopen = @LIB_dlopen@
LIB_dn_expand = @LIB_dn_expand@
LIB_el_init = @LIB_el_init@
LIB_getattr = @LIB_getattr@
LIB_gethostbyname = @LIB_gethostbyname@
LIB_getpwent_r = @LIB_getpwent_r@
LIB_getpwnam_r = @LIB_getpwnam_r@
LIB_getsockopt = @LIB_getsockopt@
LIB_logout = @LIB_logout@
LIB_logwtmp = @LIB_logwtmp@
LIB_odm_initialize = @LIB_odm_initialize@
LIB_readline = @LIB_readline@
LIB_res_search = @LIB_res_search@
LIB_setpcred = @LIB_setpcred@
LIB_setsockopt = @LIB_setsockopt@
LIB_socket = @LIB_socket@
LIB_syslog = @LIB_syslog@
LIB_tgetent = @LIB_tgetent@
HESIODLIB = @HESIODLIB@
HESIODINCLUDE = @HESIODINCLUDE@
INCLUDE_hesiod = @INCLUDE_hesiod@
LIB_hesiod = @LIB_hesiod@
INCLUDE_krb4 = @INCLUDE_krb4@
LIB_krb4 = @LIB_krb4@
INCLUDE_readline = @INCLUDE_readline@
LIB_readline = @LIB_readline@
LEXLIB = @LEXLIB@
install-suid-programs:
@foo='$(bin_SUIDS)'; \
for file in $$foo; do \
x=$(DESTDIR)$(bindir)/$$file; \
if chown 0:0 $$x && chmod u+s $$x; then :; else \
chmod 0 $$x; fi; done
install-exec-hook: install-suid-programs
install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
@foo='$(include_HEADERS) $(build_HEADERZ)'; \
for f in $$foo; do \
f=`basename $$f`; \
if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
else file="$$f"; fi; \
if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
: ; else \
echo " cp $$file $(buildinclude)/$$f"; \
cp $$file $(buildinclude)/$$f; \
fi ; \
done
all-local: install-build-headers
cat1dir = $(mandir)/cat1
cat3dir = $(mandir)/cat3
cat5dir = $(mandir)/cat5
cat8dir = $(mandir)/cat8
MANRX = \(.*\)\.\([0-9]\)
CATSUFFIX = @CATSUFFIX@
SUFFIXES += .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
NROFF_MAN = groff -mandoc -Tascii
#NROFF_MAN = nroff -man
.1.cat1:
$(NROFF_MAN) $< > $@
.3.cat3:
$(NROFF_MAN) $< > $@
.5.cat5:
$(NROFF_MAN) $< > $@
.8.cat8:
$(NROFF_MAN) $< > $@
## MAINTAINERCLEANFILES +=
dist-cat1-mans:
@foo='$(man1_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.1) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat3-mans:
@foo='$(man3_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.3) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat5-mans:
@foo='$(man5_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.5) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-cat8-mans:
@foo='$(man8_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.8) foo="$$foo $$i";; \
esac; done ;\
for i in $$foo; do \
x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
done
dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
install-cat1-mans:
@ext=1;\
foo='$(man1_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.1) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat1dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat1/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat3-mans:
@ext=3;\
foo='$(man3_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.3) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat3dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat3/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat5-mans:
@ext=5;\
foo='$(man5_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.5) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat5dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat5/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat8-mans:
@ext=8;\
foo='$(man8_MANS)'; \
bar='$(man_MANS)'; \
for i in $$bar; do \
case $$i in \
*.8) foo="$$foo $$i";; \
esac; done; \
if test "$$foo"; then \
$(mkinstalldirs) $(DESTDIR)$(cat8dir); \
for x in $$foo; do \
f=`echo $$x | sed 's/\.[^.]*$$/.cat8/'`; \
if test -f "$(srcdir)/$$f"; then \
b=`echo $$x | sed 's!$(MANRX)!\1!'`; \
echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX)";\
$(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX);\
fi; \
done ;\
fi
install-cat-mans: install-cat1-mans install-cat3-mans install-cat5-mans install-cat8-mans
install-data-local: install-cat-mans
.et.h:
$(COMPILE_ET) $<
.et.c:
$(COMPILE_ET) $<
if KRB4
LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
endif
if KRB5
LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
$(top_builddir)/lib/asn1/libasn1.la
LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
endif
-27
View File
@@ -1,27 +0,0 @@
dnl $Id: auth-modules.m4,v 1.1 1999/03/21 13:48:00 joda Exp $
dnl
dnl Figure what authentication modules should be built
AC_DEFUN(AC_AUTH_MODULES,[
AC_MSG_CHECKING(which authentication modules should be built)
LIB_AUTH_SUBDIRS=
if test "$ac_cv_header_siad_h" = yes; then
LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
fi
if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_shared" = yes; then
LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
fi
case "${host}" in
changequote(,)dnl
*-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
changequote([,])dnl
esac
AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
AC_SUBST(LIB_AUTH_SUBDIRS)dnl
])
-22
View File
@@ -1,22 +0,0 @@
dnl $Id: broken-glob.m4,v 1.2 1999/03/01 09:52:15 joda Exp $
dnl
dnl check for glob(3)
dnl
AC_DEFUN(AC_BROKEN_GLOB,[
AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
ac_cv_func_glob_working=yes
AC_TRY_LINK([
#include <stdio.h>
#include <glob.h>],[
glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE, NULL, NULL);
],:,ac_cv_func_glob_working=no,:))
if test "$ac_cv_func_glob_working" = yes; then
AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks
GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, and GLOB_TILDE])
fi
if test "$ac_cv_func_glob_working" = yes; then
AC_NEED_PROTO([#include <stdio.h>
#include <glob.h>],glob)
fi
])
-58
View File
@@ -1,58 +0,0 @@
dnl $Id: broken-snprintf.m4,v 1.3 1999/03/01 09:52:22 joda Exp $
dnl
AC_DEFUN(AC_BROKEN_SNPRINTF, [
AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
ac_cv_func_snprintf_working=yes
AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
int main()
{
changequote(`,')dnl
char foo[3];
changequote([,])dnl
snprintf(foo, 2, "12");
return strcmp(foo, "1");
}],:,ac_cv_func_snprintf_working=no,:))
if test "$ac_cv_func_snprintf_working" = yes; then
AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
fi
if test "$ac_cv_func_snprintf_working" = yes; then
AC_NEED_PROTO([#include <stdio.h>],snprintf)
fi
])
AC_DEFUN(AC_BROKEN_VSNPRINTF,[
AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
ac_cv_func_vsnprintf_working=yes
AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
int foo(int num, ...)
{
changequote(`,')dnl
char bar[3];
changequote([,])dnl
va_list arg;
va_start(arg, num);
vsnprintf(bar, 2, "%s", arg);
va_end(arg);
return strcmp(bar, "1");
}
int main()
{
return foo(0, "12");
}],:,ac_cv_func_vsnprintf_working=no,:))
if test "$ac_cv_func_vsnprintf_working" = yes; then
AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
fi
if test "$ac_cv_func_vsnprintf_working" = yes; then
AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
fi
])
-19
View File
@@ -1,19 +0,0 @@
dnl $Id: broken.m4,v 1.3 1998/03/16 22:16:19 joda Exp $
dnl
dnl
dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
dnl libraries
AC_DEFUN(AC_BROKEN,
[for ac_func in $1
do
AC_CHECK_FUNC($ac_func, [
ac_tr_func=HAVE_[]upcase($ac_func)
AC_DEFINE_UNQUOTED($ac_tr_func)],[LIBOBJS[]="$LIBOBJS ${ac_func}.o"])
dnl autoheader tricks *sigh*
: << END
@@@funcs="$funcs $1"@@@
END
done
AC_SUBST(LIBOBJS)dnl
])
-31
View File
@@ -1,31 +0,0 @@
dnl
dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
dnl
dnl
dnl Test for __attribute__
dnl
AC_DEFUN(AC_C___ATTRIBUTE__, [
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([
#include <stdlib.h>
],
[
static void foo(void) __attribute__ ((noreturn));
static void
foo(void)
{
exit(1);
}
],
ac_cv___attribute__=yes,
ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
fi
AC_MSG_RESULT($ac_cv___attribute__)
])
-33
View File
@@ -1,33 +0,0 @@
dnl
dnl $Id: c-function.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
dnl
dnl
dnl Test for __FUNCTION__
dnl
AC_DEFUN(AC_C___FUNCTION__, [
AC_MSG_CHECKING(for __FUNCTION__)
AC_CACHE_VAL(ac_cv___function__, [
AC_TRY_RUN([
#include <string.h>
static char *foo()
{
return __FUNCTION__;
}
int main()
{
return strcmp(foo(), "foo") != 0;
}
],
ac_cv___function__=yes,
ac_cv___function__=no,
ac_cv___function__=no)])
if test "$ac_cv___function__" = "yes"; then
AC_DEFINE(HAVE___FUNCTION__, 1, [define if your compiler has __FUNCTION__])
fi
AC_MSG_RESULT($ac_cv___function__)
])
-14
View File
@@ -1,14 +0,0 @@
dnl
dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
dnl
dnl
dnl Test SGI capabilities
dnl
AC_DEFUN(KRB_CAPABILITIES,[
AC_CHECK_HEADERS(capability.h sys/capability.h)
AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
])
-25
View File
@@ -1,25 +0,0 @@
dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
dnl
dnl
dnl Check if we need the declaration of a variable
dnl
dnl AC_HAVE_DECLARATION(includes, variable)
AC_DEFUN(AC_CHECK_DECLARATION, [
AC_MSG_CHECKING([if $2 is properly declared])
AC_CACHE_VAL(ac_cv_var_$2_declaration, [
AC_TRY_COMPILE([$1
extern struct { int foo; } $2;],
[$2.foo = 1;],
eval "ac_cv_var_$2_declaration=no",
eval "ac_cv_var_$2_declaration=yes")
])
define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
AC_MSG_RESULT($ac_cv_var_$2_declaration)
if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
AC_DEFINE(foo, 1, [define if your system declares $2])
fi
undefine([foo])
])
@@ -1,24 +0,0 @@
dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
dnl
dnl check for getpwnam_r, and if it's posix or not
AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
if test "$ac_cv_func_getpwnam_r" = yes; then
AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
ac_libs="$LIBS"
LIBS="$LIBS $LIB_getpwnam_r"
AC_TRY_RUN([
#include <pwd.h>
int main()
{
struct passwd pw, *pwd;
return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
}
],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
LIBS="$ac_libs")
if test "$ac_cv_func_getpwnam_r_posix" = yes; then
AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
fi
fi
])
-59
View File
@@ -1,59 +0,0 @@
dnl $Id: check-man.m4,v 1.2 1999/03/21 14:30:50 joda Exp $
dnl check how to format manual pages
dnl
AC_DEFUN(AC_CHECK_MAN,
[AC_PATH_PROG(NROFF, nroff)
AC_PATH_PROG(GROFF, groff)
AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
[cat > conftest.1 << END
.Dd January 1, 1970
.Dt CONFTEST 1
.Sh NAME
.Nm conftest
.Nd
foobar
END
if test "$NROFF" ; then
for i in "-mdoc" "-mandoc"; do
if "$NROFF" $i conftest.1 2> /dev/null | \
grep Jan > /dev/null 2>&1 ; then
ac_cv_sys_man_format="$NROFF $i"
break
fi
done
fi
if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
for i in "-mdoc" "-mandoc"; do
if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
grep Jan > /dev/null 2>&1 ; then
ac_cv_sys_man_format="$GROFF -Tascii $i"
break
fi
done
fi
if test "$ac_cv_sys_man_format"; then
ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
fi
])
if test "$ac_cv_sys_man_format"; then
CATMAN="$ac_cv_sys_man_format"
AC_SUBST(CATMAN)
fi
AM_CONDITIONAL(CATMAN, test "$CATMAN")
AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
[if grep _suffix /etc/man.conf > /dev/null 2>&1; then
ac_cv_sys_catman_ext=0
else
ac_cv_sys_catman_ext=number
fi
])
if test "$ac_cv_sys_catman_ext" = number; then
CATMANEXT='$$ext'
else
CATMANEXT=0
fi
AC_SUBST(CATMANEXT)
])
@@ -1,38 +0,0 @@
dnl
dnl $Id: check-netinet-ip-and-tcp.m4,v 1.2 1999/05/14 13:15:40 assar Exp $
dnl
dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
dnl you have to include standards.h before including these files
AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
[
AC_CHECK_HEADERS(standards.h)
for i in netinet/ip.h netinet/tcp.h; do
cv=`echo "$i" | sed 'y%./+-%__p_%'`
AC_MSG_CHECKING([for $i])
AC_CACHE_VAL([ac_cv_header_$cv],
[AC_TRY_CPP([\
#ifdef HAVE_STANDARDS_H
#include <standards.h>
#endif
#include <$i>
],
eval "ac_cv_header_$cv=yes",
eval "ac_cv_header_$cv=no")])
AC_MSG_RESULT(`eval echo \\$ac_cv_header_$cv`)
changequote(, )dnl
if test `eval echo \\$ac_cv_header_$cv` = yes; then
ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
changequote([, ])dnl
AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
fi
done
dnl autoheader tricks *sigh*
: << END
@@@headers="$headers netinet/ip.h netinet/tcp.h"@@@
END
])
-23
View File
@@ -1,23 +0,0 @@
dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
dnl
dnl ac_check_type + extra headers
dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
AC_DEFUN(AC_CHECK_TYPE_EXTRA,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no; then
AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
fi
])
-20
View File
@@ -1,20 +0,0 @@
dnl $Id: check-var.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
dnl
dnl AC_CHECK_VAR(includes, variable)
AC_DEFUN(AC_CHECK_VAR, [
AC_MSG_CHECKING(for $2)
AC_CACHE_VAL(ac_cv_var_$2, [
AC_TRY_LINK([extern int $2;
int foo() { return $2; }],
[foo()],
ac_cv_var_$2=yes, ac_cv_var_$2=no)
])
define([foo], [HAVE_]translit($2, [a-z], [A-Z]))
AC_MSG_RESULT(`eval echo \\$ac_cv_var_$2`)
if test `eval echo \\$ac_cv_var_$2` = yes; then
AC_DEFINE_UNQUOTED(foo, 1, [define if you have $2])
AC_CHECK_DECLARATION([$1],[$2])
fi
undefine([foo])
])
-52
View File
@@ -1,52 +0,0 @@
dnl
dnl See if there is any X11 present
dnl
dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
AC_DEFUN(KRB_CHECK_X,[
AC_PATH_XTRA
# try to figure out if we need any additional ld flags, like -R
# and yes, the autoconf X test is utterly broken
if test "$no_x" != yes; then
AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
krb_cv_sys_x_libs_rpath=""
krb_cv_sys_x_libs=""
for rflag in "" "-R" "-R " "-rpath "; do
if test "$rflag" = ""; then
foo="$X_LIBS"
else
foo=""
for flag in $X_LIBS; do
case $flag in
-L*)
foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
;;
*)
foo="$foo $flag"
;;
esac
done
fi
LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
AC_TRY_RUN([
#include <X11/Xlib.h>
foo()
{
XOpenDisplay(NULL);
}
main()
{
return 0;
}
], krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:)
done
LIBS="$ac_save_libs"
CFLAGS="$ac_save_cflags"
])
X_LIBS="$krb_cv_sys_x_libs"
fi
])
-64
View File
@@ -1,64 +0,0 @@
dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
dnl
dnl check for Xau{Read,Write}Auth and XauFileName
dnl
AC_DEFUN(AC_CHECK_XAU,[
save_CFLAGS="$CFLAGS"
CFLAGS="$X_CFLAGS $CFLAGS"
save_LIBS="$LIBS"
dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
## check for XauWriteAuth first, so we detect the case where
## XauReadAuth is in -lX11, but XauWriteAuth is only in -lXau this
## could be done by checking for XauReadAuth in -lXau first, but this
## breaks in IRIX 6.5
AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
ac_xxx="$LIBS"
LIBS="$LIB_XauWriteAuth $LIBS"
AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
LIBS="$LIB_XauReadAauth $LIBS"
AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
LIBS="$ac_xxx"
## set LIB_XauReadAuth to union of these tests, since this is what the
## Makefiles are using
case "$ac_cv_funclib_XauWriteAuth" in
yes) ;;
no) ;;
*) if test "$ac_cv_funclib_XauReadAuth" = yes; then
if test "$ac_cv_funclib_XauFileName" = yes; then
LIB_XauReadAuth="$LIB_XauWriteAuth"
else
LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
fi
else
if test "$ac_cv_funclib_XauFileName" = yes; then
LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
else
LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
fi
fi
;;
esac
if test "$AUTOMAKE" != ""; then
AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
else
AC_SUBST(NEED_WRITEAUTH_TRUE)
AC_SUBST(NEED_WRITEAUTH_FALSE)
if test "$ac_cv_func_XauWriteAuth" != "yes"; then
NEED_WRITEAUTH_TRUE=
NEED_WRITEAUTH_FALSE='#'
else
NEED_WRITEAUTH_TRUE='#'
NEED_WRITEAUTH_FALSE=
fi
fi
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
LDFLAGS=$save_LDFLAGS
])
@@ -1,9 +0,0 @@
dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
dnl
dnl
dnl Look for function in any of the specified libraries
dnl
dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
@@ -1,63 +0,0 @@
dnl $Id: find-func-no-libs2.m4,v 1.3 1999/10/30 21:09:53 assar Exp $
dnl
dnl
dnl Look for function in any of the specified libraries
dnl
dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_funclib_$1,
[
if eval "test \"\$ac_cv_func_$1\" != yes" ; then
ac_save_LIBS="$LIBS"
for ac_lib in $2; do
if test -n "$ac_lib"; then
ac_lib="-l$ac_lib"
else
ac_lib=""
fi
LIBS="$6 $ac_lib $5 $ac_save_LIBS"
AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break)
done
eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
LIBS="$ac_save_LIBS"
fi
])
eval "ac_res=\$ac_cv_funclib_$1"
dnl autoheader tricks *sigh*
: << END
@@@funcs="$funcs $1"@@@
@@@libs="$libs $2"@@@
END
# $1
eval "ac_tr_func=HAVE_[]upcase($1)"
eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
eval "LIB_$1=$ac_res"
case "$ac_res" in
yes)
eval "ac_cv_func_$1=yes"
eval "LIB_$1="
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_MSG_RESULT([yes])
;;
no)
eval "ac_cv_func_$1=no"
eval "LIB_$1="
AC_MSG_RESULT([no])
;;
*)
eval "ac_cv_func_$1=yes"
eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_DEFINE_UNQUOTED($ac_tr_lib)
AC_MSG_RESULT([yes, in $ac_res])
;;
esac
AC_SUBST(LIB_$1)
])
-9
View File
@@ -1,9 +0,0 @@
dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
dnl
dnl AC_FIND_FUNC(func, libraries, includes, arguments)
AC_DEFUN(AC_FIND_FUNC, [
AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
if test -n "$LIB_$1"; then
LIBS="$LIB_$1 $LIBS"
fi
])
@@ -1,13 +0,0 @@
dnl $Id: find-if-not-broken.m4,v 1.2 1998/03/16 22:16:27 joda Exp $
dnl
dnl
dnl Mix between AC_FIND_FUNC and AC_BROKEN
dnl
AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
[AC_FIND_FUNC([$1], [$2], [$3], [$4])
if eval "test \"$ac_cv_func_$1\" != yes"; then
LIBOBJS[]="$LIBOBJS $1.o"
fi
AC_SUBST(LIBOBJS)dnl
])
-38
View File
@@ -1,38 +0,0 @@
dnl $Id: grok-type.m4,v 1.4 1999/11/29 11:16:48 joda Exp $
dnl
AC_DEFUN(AC_GROK_TYPE, [
AC_CACHE_VAL(ac_cv_type_$1,
AC_TRY_COMPILE([
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
#ifdef HAVE_BIND_BITYPES_H
#include <bind/bitypes.h>
#endif
#ifdef HAVE_NETINET_IN6_MACHTYPES_H
#include <netinet/in6_machtypes.h>
#endif
],
$i x;
,
eval ac_cv_type_$1=yes,
eval ac_cv_type_$1=no))])
AC_DEFUN(AC_GROK_TYPES, [
for i in $1; do
AC_MSG_CHECKING(for $i)
AC_GROK_TYPE($i)
eval ac_res=\$ac_cv_type_$i
if test "$ac_res" = yes; then
type=HAVE_[]upcase($i)
AC_DEFINE_UNQUOTED($type)
fi
AC_MSG_RESULT($ac_res)
done
])
-37
View File
@@ -1,37 +0,0 @@
dnl $Id: have-pragma-weak.m4,v 1.3 1999/03/01 11:55:25 joda Exp $
dnl
AC_DEFUN(AC_HAVE_PRAGMA_WEAK, [
if test "${enable_shared}" = "yes"; then
AC_MSG_CHECKING(for pragma weak)
AC_CACHE_VAL(ac_have_pragma_weak, [
ac_have_pragma_weak=no
cat > conftest_foo.$ac_ext <<'EOF'
[#]line __oline__ "configure"
#include "confdefs.h"
#pragma weak foo = _foo
int _foo = 17;
EOF
cat > conftest_bar.$ac_ext <<'EOF'
[#]line __oline__ "configure"
#include "confdefs.h"
extern int foo;
int t() {
return foo;
}
int main() {
return t();
}
EOF
if AC_TRY_EVAL('CC -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest_foo.$ac_ext conftest_bar.$ac_ext 1>&AC_FD_CC'); then
ac_have_pragma_weak=yes
fi
rm -rf conftest*
])
if test "$ac_have_pragma_weak" = "yes"; then
AC_DEFINE(HAVE_PRAGMA_WEAK, 1, [Define this if your compiler supports \`#pragma weak.'])dnl
fi
AC_MSG_RESULT($ac_have_pragma_weak)
fi
])
-19
View File
@@ -1,19 +0,0 @@
dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
dnl
dnl check for fields in a structure
dnl
dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
AC_CACHE_CHECK([for $2 in $1], cache_val,[
AC_TRY_COMPILE([$3],[$1 x; x.$2;],
cache_val=yes,
cache_val=no)])
if test "$cache_val" = yes; then
define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
AC_DEFINE(foo, 1, [Define if $1 has field $2.])
undefine([foo])
fi
undefine([cache_val])
])
-31
View File
@@ -1,31 +0,0 @@
dnl $Id: have-type.m4,v 1.4 1999/07/24 19:23:01 assar Exp $
dnl
dnl check for existance of a type
dnl AC_HAVE_TYPE(TYPE,INCLUDES)
AC_DEFUN(AC_HAVE_TYPE, [
cv=`echo "$1" | sed 'y%./+- %__p__%'`
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL([ac_cv_type_$cv],
AC_TRY_COMPILE(
[#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$2],
[$1 foo;],
eval "ac_cv_type_$cv=yes",
eval "ac_cv_type_$cv=no"))dnl
AC_MSG_RESULT(`eval echo \\$ac_cv_type_$cv`)
if test `eval echo \\$ac_cv_type_$cv` = yes; then
ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
dnl autoheader tricks *sigh*
define(foo,translit($1, [ ], [_]))
: << END
@@@funcs="$funcs foo"@@@
END
undefine([foo])
AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
fi
])
-14
View File
@@ -1,14 +0,0 @@
dnl
dnl $Id: have-types.m4,v 1.1 1999/07/24 18:38:58 assar Exp $
dnl
AC_DEFUN(AC_HAVE_TYPES, [
for i in $1; do
AC_HAVE_TYPE($i)
done
: << END
changequote(`,')dnl
@@@funcs="$funcs $1"@@@
changequote([,])dnl
END
])
-98
View File
@@ -1,98 +0,0 @@
dnl $Id: krb-find-db.m4,v 1.5 1999/05/08 02:24:04 assar Exp $
dnl
dnl find a suitable database library
dnl
dnl AC_FIND_DB(libraries)
AC_DEFUN(KRB_FIND_DB, [
lib_dbm=no
lib_db=no
for i in $1; do
if test "$i"; then
m="lib$i"
l="-l$i"
else
m="libc"
l=""
fi
AC_MSG_CHECKING(for dbm_open in $m)
AC_CACHE_VAL(ac_cv_krb_dbm_open_$m, [
save_LIBS="$LIBS"
LIBS="$l $LIBS"
AC_TRY_RUN([
#include <unistd.h>
#include <fcntl.h>
#if defined(HAVE_NDBM_H)
#include <ndbm.h>
#elif defined(HAVE_DBM_H)
#include <dbm.h>
#elif defined(HAVE_RPCSVC_DBM_H)
#include <rpcsvc/dbm.h>
#elif defined(HAVE_DB_H)
#define DB_DBM_HSEARCH 1
#include <db.h>
#endif
int main()
{
DBM *d;
d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
if(d == NULL)
return 1;
dbm_close(d);
return 0;
}], [
if test -f conftest.db; then
ac_res=db
else
ac_res=dbm
fi], ac_res=no, ac_res=no)
LIBS="$save_LIBS"
eval ac_cv_krb_dbm_open_$m=$ac_res])
eval ac_res=\$ac_cv_krb_dbm_open_$m
AC_MSG_RESULT($ac_res)
if test "$lib_dbm" = no -a $ac_res = dbm; then
lib_dbm="$l"
elif test "$lib_db" = no -a $ac_res = db; then
lib_db="$l"
break
fi
done
AC_MSG_CHECKING(for NDBM library)
ac_ndbm=no
if test "$lib_db" != no; then
LIB_DBM="$lib_db"
ac_ndbm=yes
AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files ending in .db).])
if test "$LIB_DBM"; then
ac_res="yes, $LIB_DBM"
else
ac_res=yes
fi
elif test "$lib_dbm" != no; then
LIB_DBM="$lib_dbm"
ac_ndbm=yes
if test "$LIB_DBM"; then
ac_res="yes, $LIB_DBM"
else
ac_res=yes
fi
else
LIB_DBM=""
ac_res=no
fi
test "$ac_ndbm" = yes && AC_DEFINE(NDBM, 1, [Define if you have NDBM (and not DBM)])dnl
AC_SUBST(LIB_DBM)
DBLIB="$LIB_DBM"
AC_SUBST(DBLIB)
AC_MSG_RESULT($ac_res)
])
@@ -1,42 +0,0 @@
dnl $Id: krb-func-getcwd-broken.m4,v 1.2 1999/03/01 13:03:32 joda Exp $
dnl
dnl
dnl test for broken getcwd in (SunOS braindamage)
dnl
AC_DEFUN(AC_KRB_FUNC_GETCWD_BROKEN, [
if test "$ac_cv_func_getcwd" = yes; then
AC_MSG_CHECKING(if getcwd is broken)
AC_CACHE_VAL(ac_cv_func_getcwd_broken, [
ac_cv_func_getcwd_broken=no
AC_TRY_RUN([
#include <errno.h>
char *getcwd(char*, int);
void *popen(char *cmd, char *mode)
{
errno = ENOTTY;
return 0;
}
int main()
{
char *ret;
ret = getcwd(0, 1024);
if(ret == 0 && errno == ENOTTY)
return 0;
return 1;
}
], ac_cv_func_getcwd_broken=yes,:,:)
])
if test "$ac_cv_func_getcwd_broken" = yes; then
AC_DEFINE(BROKEN_GETCWD, 1, [Define if getcwd is broken (like in SunOS 4).])dnl
LIBOBJS="$LIBOBJS getcwd.o"
AC_SUBST(LIBOBJS)dnl
AC_MSG_RESULT($ac_cv_func_getcwd_broken)
else
AC_MSG_RESULT([seems ok])
fi
fi
])
-22
View File
@@ -1,22 +0,0 @@
dnl
dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
dnl
dnl test for POSIX (broken) getlogin
dnl
AC_DEFUN(AC_FUNC_GETLOGIN, [
AC_CHECK_FUNCS(getlogin setlogin)
if test "$ac_cv_func_getlogin" = yes; then
AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
ac_cv_func_getlogin_posix=no
else
ac_cv_func_getlogin_posix=yes
fi
])
if test "$ac_cv_func_getlogin_posix" = yes; then
AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
fi
fi
])
-130
View File
@@ -1,130 +0,0 @@
dnl $Id: krb-ipv6.m4,v 1.5 1999/03/21 14:06:16 joda Exp $
dnl
dnl test for IPv6
dnl
AC_DEFUN(AC_KRB_IPV6, [
AC_CACHE_CHECK(for IPv6,ac_cv_lib_ipv6,
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
#include <netinet/in6.h>
#endif
],
[
#if defined(IN6ADDR_ANY_INIT)
struct in6_addr any = IN6ADDR_ANY_INIT;
#elif defined(IPV6ADDR_ANY_INIT)
struct in6_addr any = IPV6ADDR_ANY_INIT;
#else
#error no any?
#endif
struct sockaddr_in6 sin6;
int s;
s = socket(AF_INET6, SOCK_DGRAM, 0);
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(17);
sin6.sin6_addr = any;
bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
],
ac_cv_lib_ipv6=yes,
ac_cv_lib_ipv6=no))
if test "$ac_cv_lib_ipv6" = yes; then
AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
dnl check for different v6 implementations (by itojun)
v6type=unknown
v6lib=none
AC_MSG_CHECKING([ipv6 stack type])
for i in v6d toshiba kame inria zeta linux; do
case $i in
v6d)
AC_EGREP_CPP(yes, [dnl
#include </usr/local/v6/include/sys/types.h>
#ifdef __V6D__
yes
#endif],
[v6type=$i; v6lib=v6;
v6libdir=/usr/local/v6/lib;
CFLAGS="-I/usr/local/v6/include $CFLAGS"])
;;
toshiba)
AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _TOSHIBA_INET6
yes
#endif],
[v6type=$i; v6lib=inet6;
v6libdir=/usr/local/v6/lib;
CFLAGS="-DINET6 $CFLAGS"])
;;
kame)
AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef __KAME__
yes
#endif],
[v6type=$i; v6lib=inet6;
v6libdir=/usr/local/v6/lib;
CFLAGS="-DINET6 $CFLAGS"])
;;
inria)
AC_EGREP_CPP(yes, [dnl
#include <netinet/in.h>
#ifdef IPV6_INRIA_VERSION
yes
#endif],
[v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
;;
zeta)
AC_EGREP_CPP(yes, [dnl
#include <sys/param.h>
#ifdef _ZETA_MINAMI_INET6
yes
#endif],
[v6type=$i; v6lib=inet6;
v6libdir=/usr/local/v6/lib;
CFLAGS="-DINET6 $CFLAGS"])
;;
linux)
if test -d /usr/inet6; then
v6type=$i
v6lib=inet6
v6libdir=/usr/inet6
CFLAGS="-DINET6 $CFLAGS"
fi
;;
esac
if test "$v6type" != "unknown"; then
break
fi
done
AC_MSG_RESULT($v6type)
if test "$v6lib" != "none"; then
for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
if test -d $dir -a -f $dir/lib$v6lib.a; then
LIBS="-L$dir -l$v6lib $LIBS"
break
fi
done
dnl AC_CHECK_LIB($v6lib, getaddrinfo,
dnl [SERVER_LIBS="-l$v6lib $SERVER_LIBS"],
dnl [dnl
dnl echo "Fatal: no $v6lib library found. cannot continue."
dnl echo "You need to fetch lib$v6lib.a from appropriate v6 kit and"
dnl echo 'compile beforehand.'
dnl exit 1])
fi
fi
])
-28
View File
@@ -1,28 +0,0 @@
dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
dnl
dnl
dnl Better test for ln -s, ln or cp
dnl
AC_DEFUN(AC_KRB_PROG_LN_S,
[AC_MSG_CHECKING(for ln -s or something else)
AC_CACHE_VAL(ac_cv_prog_LN_S,
[rm -f conftestdata
if ln -s X conftestdata 2>/dev/null
then
rm -f conftestdata
ac_cv_prog_LN_S="ln -s"
else
touch conftestdata1
if ln conftestdata1 conftestdata2; then
rm -f conftestdata*
ac_cv_prog_LN_S=ln
else
ac_cv_prog_LN_S=cp
fi
fi])dnl
LN_S="$ac_cv_prog_LN_S"
AC_MSG_RESULT($ac_cv_prog_LN_S)
AC_SUBST(LN_S)dnl
])
-8
View File
@@ -1,8 +0,0 @@
dnl $Id: krb-prog-ranlib.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
dnl
dnl
dnl Also look for EMXOMF for OS/2
dnl
AC_DEFUN(AC_KRB_PROG_RANLIB,
[AC_CHECK_PROGS(RANLIB, ranlib EMXOMF, :)])
-8
View File
@@ -1,8 +0,0 @@
dnl $Id: krb-prog-yacc.m4,v 1.1 1997/12/14 15:59:02 joda Exp $
dnl
dnl
dnl We prefer byacc or yacc because they do not use `alloca'
dnl
AC_DEFUN(AC_KRB_PROG_YACC,
[AC_CHECK_PROGS(YACC, byacc yacc 'bison -y')])
-22
View File
@@ -1,22 +0,0 @@
dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
dnl
dnl Test for `struct spwd'
AC_DEFUN(AC_KRB_STRUCT_SPWD, [
AC_MSG_CHECKING(for struct spwd)
AC_CACHE_VAL(ac_cv_struct_spwd, [
AC_TRY_COMPILE(
[#include <pwd.h>
#ifdef HAVE_SHADOW_H
#include <shadow.h>
#endif],
[struct spwd foo;],
ac_cv_struct_spwd=yes,
ac_cv_struct_spwd=no)
])
AC_MSG_RESULT($ac_cv_struct_spwd)
if test "$ac_cv_struct_spwd" = "yes"; then
AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
fi
])
@@ -1,27 +0,0 @@
dnl $Id: krb-struct-winsize.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
dnl
dnl
dnl Search for struct winsize
dnl
AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
AC_MSG_CHECKING(for struct winsize)
AC_CACHE_VAL(ac_cv_struct_winsize, [
ac_cv_struct_winsize=no
for i in sys/termios.h sys/ioctl.h; do
AC_EGREP_HEADER(
changequote(, )dnl
struct[ ]*winsize,dnl
changequote([,])dnl
$i, ac_cv_struct_winsize=yes; break)dnl
done
])
if test "$ac_cv_struct_winsize" = "yes"; then
AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
fi
AC_MSG_RESULT($ac_cv_struct_winsize)
AC_EGREP_HEADER(ws_xpixel, termios.h,
AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
AC_EGREP_HEADER(ws_ypixel, termios.h,
AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
])
-15
View File
@@ -1,15 +0,0 @@
dnl $Id: krb-sys-aix.m4,v 1.1 1997/12/14 15:59:02 joda Exp $
dnl
dnl
dnl AIX have a very different syscall convention
dnl
AC_DEFUN(AC_KRB_SYS_AIX, [
AC_MSG_CHECKING(for AIX)
AC_CACHE_VAL(krb_cv_sys_aix,
AC_EGREP_CPP(yes,
[#ifdef _AIX
yes
#endif
], krb_cv_sys_aix=yes, krb_cv_sys_aix=no) )
AC_MSG_RESULT($krb_cv_sys_aix)
])
-21
View File
@@ -1,21 +0,0 @@
dnl $Id: krb-sys-nextstep.m4,v 1.2 1998/06/03 23:48:40 joda Exp $
dnl
dnl
dnl NEXTSTEP is not posix compliant by default,
dnl you need a switch -posix to the compiler
dnl
AC_DEFUN(AC_KRB_SYS_NEXTSTEP, [
AC_MSG_CHECKING(for NEXTSTEP)
AC_CACHE_VAL(krb_cv_sys_nextstep,
AC_EGREP_CPP(yes,
[#if defined(NeXT) && !defined(__APPLE__)
yes
#endif
], krb_cv_sys_nextstep=yes, krb_cv_sys_nextstep=no) )
if test "$krb_cv_sys_nextstep" = "yes"; then
CFLAGS="$CFLAGS -posix"
LIBS="$LIBS -posix"
fi
AC_MSG_RESULT($krb_cv_sys_nextstep)
])
-25
View File
@@ -1,25 +0,0 @@
dnl $Id: krb-version.m4,v 1.1 1997/12/14 15:59:03 joda Exp $
dnl
dnl
dnl output a C header-file with some version strings
dnl
AC_DEFUN(AC_KRB_VERSION,[
dnl AC_OUTPUT_COMMANDS([
cat > include/newversion.h.in <<FOOBAR
char *${PACKAGE}_long_version = "@(#)\$Version: $PACKAGE-$VERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
char *${PACKAGE}_version = "$PACKAGE-$VERSION";
FOOBAR
if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
echo "include/version.h is unchanged"
rm -f include/newversion.h.in
else
echo "creating include/version.h"
User=${USER-${LOGNAME}}
Host=`(hostname || uname -n) 2>/dev/null | sed 1q`
Date=`date`
mv -f include/newversion.h.in include/version.h.in
sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
fi
dnl ],host=$host PACKAGE=$PACKAGE VERSION=$VERSION)
])
-199
View File
@@ -1,199 +0,0 @@
# Make prototypes from .c files
# $Id: make-proto.pl,v 1.11 1999/04/15 12:37:54 joda Exp $
##use Getopt::Std;
require 'getopts.pl';
$brace = 0;
$line = "";
$debug = 0;
do Getopts('o:p:d') || die "foo";
if($opt_d) {
$debug = 1;
}
while(<>) {
print $brace, " ", $_ if($debug);
if(/^\#if 0/) {
$if_0 = 1;
}
if($if_0 && /^\#endif/) {
$if_0 = 0;
}
if($if_0) { next }
if(/^\s*\#/) {
next;
}
if(/^\s*$/) {
$line = "";
next;
}
if(/\{/){
$_ = $line;
while(s/\*\//\ca/){
s/\/\*(.|\n)*\ca//;
}
s/^\s*//;
s/\s$//;
s/\s+/ /g;
if($line =~ /\)\s$/){
if(!/^static/ && !/^PRIVATE/){
if(/(.*)(__attribute__\s?\(.*\))/) {
$attr = $2;
$_ = $1;
} else {
$attr = "";
}
# remove outer ()
s/\s*\(/@/;
s/\)\s?$/@/;
# remove , within ()
while(s/\(([^()]*),(.*)\)/($1\$$2)/g){}
s/,\s*/,\n\t/g;
# fix removed ,
s/\$/,/g;
# match function name
/([a-zA-Z0-9_]+)\s*@/;
$f = $1;
# only add newline if more than one parameter
$LP = "(("; # XXX workaround for indentation bug in emacs
$RP = "))";
$P = "__P((";
if(/,/){
s/@/ __P$LP\n\t/;
}else{
s/@/ __P$LP/;
}
s/@/$RP/;
# insert newline before function name
s/(.*)\s([a-zA-Z0-9_]+ __P)/$1\n$2/;
if($attr ne "") {
$_ .= "\n $attr";
}
$_ = $_ . ";";
$funcs{$f} = $_;
}
}
$line = "";
$brace++;
}
if(/\}/){
$brace--;
}
if(/^\}/){
$brace = 0;
}
if($brace == 0) {
$line = $line . " " . $_;
}
}
sub foo {
local ($arg) = @_;
$_ = $arg;
s/.*\/([^\/]*)/$1/;
s/[^a-zA-Z0-9]/_/g;
"__" . $_ . "__";
}
if($opt_o) {
open(OUT, ">$opt_o");
$block = &foo($opt_o);
} else {
$block = "__public_h__";
}
if($opt_p) {
open(PRIV, ">$opt_p");
$private = &foo($opt_p);
} else {
$private = "__private_h__";
}
$public_h = "";
$private_h = "";
$public_h_header = "/* This is a generated file */
#ifndef $block
#define $block
#ifdef __STDC__
#include <stdarg.h>
#ifndef __P
#define __P(x) x
#endif
#else
#ifndef __P
#define __P(x) ()
#endif
#endif
";
$private_h_header = "/* This is a generated file */
#ifndef $private
#define $private
#ifdef __STDC__
#include <stdarg.h>
#ifndef __P
#define __P(x) x
#endif
#else
#ifndef __P
#define __P(x) ()
#endif
#endif
";
foreach(sort keys %funcs){
if(/^(main)$/) { next }
if(/^_/) {
$private_h .= $funcs{$_} . "\n\n";
if($funcs{$_} =~ /__attribute__/) {
$private_attribute_seen = 1;
}
} else {
$public_h .= $funcs{$_} . "\n\n";
if($funcs{$_} =~ /__attribute__/) {
$public_attribute_seen = 1;
}
}
}
if ($public_attribute_seen) {
$public_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif
";
}
if ($private_attribute_seen) {
$private_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif
";
}
if ($public_h ne "") {
$public_h = $public_h_header . $public_h . "#endif /* $block */\n";
}
if ($private_h ne "") {
$private_h = $private_h_header . $private_h . "#endif /* $private */\n";
}
if($opt_o) {
print OUT $public_h;
}
if($opt_p) {
print PRIV $private_h;
}
close OUT;
close PRIV;
-87
View File
@@ -1,87 +0,0 @@
dnl $Id: mips-abi.m4,v 1.4 1998/05/16 20:44:15 joda Exp $
dnl
dnl
dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
dnl value.
AC_DEFUN(AC_MIPS_ABI, [
AC_ARG_WITH(mips_abi,
[ --with-mips-abi=abi ABI to use for IRIX (32, n32, or 64)])
case "$host_os" in
irix*)
with_mips_abi="${with_mips_abi:-yes}"
if test -n "$GCC"; then
# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
#
# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
# GCC and revert back to O32. The same goes if O32 is asked for - old
# GCCs doesn't like the -mabi option, and new GCCs can't output O32.
#
# Don't you just love *all* the different SGI ABIs?
case "${with_mips_abi}" in
32|o32) abi='-mabi=32'; abilibdirext='' ;;
n32|yes) abi='-mabi=n32'; abilibdirext='32' ;;
64) abi='-mabi=64'; abilibdirext='64' ;;
no) abi=''; abilibdirext='';;
*) AC_ERROR("Invalid ABI specified") ;;
esac
if test -n "$abi" ; then
ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
dnl
dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
dnl AC_MSG_RESULT
dnl
AC_MSG_CHECKING([if $CC supports the $abi option])
AC_CACHE_VAL($ac_foo, [
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $abi"
AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
CFLAGS="$save_CFLAGS"
])
ac_res=`eval echo \\\$$ac_foo`
AC_MSG_RESULT($ac_res)
if test $ac_res = no; then
# Try to figure out why that failed...
case $abi in
-mabi=32)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mabi=n32"
AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
CLAGS="$save_CFLAGS"
if test $ac_res = yes; then
# New GCC
AC_ERROR([$CC does not support the $with_mips_abi ABI])
fi
# Old GCC
abi=''
abilibdirext=''
;;
-mabi=n32|-mabi=64)
if test $with_mips_abi = yes; then
# Old GCC, default to O32
abi=''
abilibdirext=''
else
# Some broken GCC
AC_ERROR([$CC does not support the $with_mips_abi ABI])
fi
;;
esac
fi #if test $ac_res = no; then
fi #if test -n "$abi" ; then
else
case "${with_mips_abi}" in
32|o32) abi='-32'; abilibdirext='' ;;
n32|yes) abi='-n32'; abilibdirext='32' ;;
64) abi='-64'; abilibdirext='64' ;;
no) abi=''; abilibdirext='';;
*) AC_ERROR("Invalid ABI specified") ;;
esac
fi #if test -n "$GCC"; then
;;
esac
])
-3
View File
@@ -1,3 +0,0 @@
dnl $Id: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
dnl
define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
-25
View File
@@ -1,25 +0,0 @@
dnl $Id: need-proto.m4,v 1.2 1999/03/01 09:52:24 joda Exp $
dnl
dnl
dnl Check if we need the prototype for a function
dnl
dnl AC_NEED_PROTO(includes, function)
AC_DEFUN(AC_NEED_PROTO, [
if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
AC_TRY_COMPILE([$1],
[struct foo { int foo; } xx;
extern int $2 (struct foo*);
$2(&xx);
],
eval "ac_cv_func_$2_noproto=yes",
eval "ac_cv_func_$2_noproto=no"))
define([foo], [NEED_]translit($2, [a-z], [A-Z])[_PROTO])
if test "$ac_cv_func_$2_noproto" = yes; then
AC_DEFINE(foo, 1, [define if the system is missing a prototype for $2()])
fi
undefine([foo])
fi
])
-14
View File
@@ -1,14 +0,0 @@
dnl $Id: osfc2.m4,v 1.2 1999/03/27 17:28:16 joda Exp $
dnl
dnl enable OSF C2 stuff
AC_DEFUN(AC_CHECK_OSFC2,[
AC_ARG_ENABLE(osfc2,
[ --enable-osfc2 enable some OSF C2 support])
LIB_security=
if test "$enable_osfc2" = yes; then
AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
LIB_security=-lsecurity
fi
AC_SUBST(LIB_security)
])
-22
View File
@@ -1,22 +0,0 @@
dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
dnl
dnl
dnl Check if the prototype of a function is compatible with another one
dnl
dnl AC_PROTO_COMPAT(includes, function, prototype)
AC_DEFUN(AC_PROTO_COMPAT, [
AC_CACHE_CHECK([if $2 is compatible with system prototype],
ac_cv_func_$2_proto_compat,
AC_TRY_COMPILE([$1],
[$3;],
eval "ac_cv_func_$2_proto_compat=yes",
eval "ac_cv_func_$2_proto_compat=no"))
define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
if test "$ac_cv_func_$2_proto_compat" = yes; then
AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
$3])
fi
undefine([foo])
])
-187
View File
@@ -1,187 +0,0 @@
dnl
dnl $Id: shared-libs.m4,v 1.4 1999/07/13 17:47:09 assar Exp $
dnl
dnl Shared library stuff has to be different everywhere
dnl
AC_DEFUN(AC_SHARED_LIBS, [
dnl Check if we want to use shared libraries
AC_ARG_ENABLE(shared,
[ --enable-shared create shared libraries for Kerberos])
AC_SUBST(CFLAGS)dnl
AC_SUBST(LDFLAGS)dnl
case ${enable_shared} in
yes ) enable_shared=yes;;
no ) enable_shared=no;;
* ) enable_shared=no;;
esac
# NOTE: Building shared libraries may not work if you do not use gcc!
#
# OS $SHLIBEXT
# HP-UX sl
# Linux so
# NetBSD so
# FreeBSD so
# OSF so
# SunOS5 so
# SunOS4 so.0.5
# Irix so
#
# LIBEXT is the extension we should build (.a or $SHLIBEXT)
LINK='$(CC)'
AC_SUBST(LINK)
lib_deps=yes
REAL_PICFLAGS="-fpic"
LDSHARED='$(CC) $(PICFLAGS) -shared'
LIBPREFIX=lib
build_symlink_command=@true
install_symlink_command=@true
install_symlink_command2=@true
REAL_SHLIBEXT=so
changequote({,})dnl
SHLIB_VERSION=`echo $VERSION | sed 's/\([0-9.]*\).*/\1/'`
SHLIB_SONAME=`echo $VERSION | sed 's/\([0-9]*\).*/\1/'`
changequote([,])dnl
case "${host}" in
*-*-hpux*)
REAL_SHLIBEXT=sl
REAL_LD_FLAGS='-Wl,+b$(libdir)'
if test -z "$GCC"; then
LDSHARED="ld -b"
REAL_PICFLAGS="+z"
fi
lib_deps=no
;;
*-*-linux*)
LDSHARED='$(CC) -shared -Wl,-soname,$(LIBNAME).so.'"${SHLIB_SONAME}"
REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
REAL_SHLIBEXT=so.$SHLIB_VERSION
build_symlink_command='$(LN_S) -f [$][@] $(LIBNAME).so'
install_symlink_command='$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so.'"${SHLIB_SONAME}"';$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so'
install_symlink_command2='$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so.'"${SHLIB_SONAME}"';$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so'
;;
changequote(,)dnl
*-*-freebsd[34]*)
changequote([,])dnl
REAL_SHLIBEXT=so.$SHLIB_VERSION
REAL_LD_FLAGS='-Wl,-R$(libdir)'
build_symlink_command='$(LN_S) -f [$][@] $(LIBNAME).so'
install_symlink_command='$(LN_S) -f $(LIB) $(DESTDIR)$(libdir)/$(LIBNAME).so'
install_symlink_command2='$(LN_S) -f $(LIB2) $(DESTDIR)$(libdir)/$(LIBNAME2).so'
;;
*-*-*bsd*)
REAL_SHLIBEXT=so.$SHLIB_VERSION
LDSHARED='ld -Bshareable'
REAL_LD_FLAGS='-Wl,-R$(libdir)'
;;
*-*-osf*)
REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
REAL_PICFLAGS=
LDSHARED='ld -shared -expect_unresolved \*'
;;
*-*-solaris2*)
REAL_LD_FLAGS='-Wl,-R$(libdir)'
if test -z "$GCC"; then
LDSHARED='$(CC) -G'
REAL_PICFLAGS="-Kpic"
fi
;;
*-fujitsu-uxpv*)
REAL_LD_FLAGS='' # really: LD_RUN_PATH=$(libdir) cc -o ...
REAL_LINK='LD_RUN_PATH=$(libdir) $(CC)'
LDSHARED='$(CC) -G'
REAL_PICFLAGS="-Kpic"
lib_deps=no # fails in mysterious ways
;;
*-*-sunos*)
REAL_SHLIBEXT=so.$SHLIB_VERSION
REAL_LD_FLAGS='-Wl,-L$(libdir)'
lib_deps=no
;;
*-*-irix*)
libdir="${libdir}${abilibdirext}"
REAL_LD_FLAGS="${abi} -Wl,-rpath,\$(libdir)"
LD_FLAGS="${abi} -Wl,-rpath,\$(libdir)"
LDSHARED="\$(CC) -shared ${abi}"
REAL_PICFLAGS=
CFLAGS="${abi} ${CFLAGS}"
;;
*-*-os2*)
LIBPREFIX=
EXECSUFFIX='.exe'
RANLIB=EMXOMF
LD_FLAGS=-Zcrtdll
REAL_SHLIBEXT=nobuild
;;
*-*-cygwin32*)
EXECSUFFIX='.exe'
REAL_SHLIBEXT=nobuild
;;
*) REAL_SHLIBEXT=nobuild
REAL_PICFLAGS=
;;
esac
if test "${enable_shared}" != "yes" ; then
PICFLAGS=""
SHLIBEXT="nobuild"
LIBEXT="a"
build_symlink_command=@true
install_symlink_command=@true
install_symlink_command2=@true
else
PICFLAGS="$REAL_PICFLAGS"
SHLIBEXT="$REAL_SHLIBEXT"
LIBEXT="$SHLIBEXT"
AC_MSG_CHECKING(whether to use -rpath)
case "$libdir" in
/lib | /usr/lib | /usr/local/lib)
AC_MSG_RESULT(no)
REAL_LD_FLAGS=
LD_FLAGS=
;;
*)
LD_FLAGS="$REAL_LD_FLAGS"
test "$REAL_LINK" && LINK="$REAL_LINK"
AC_MSG_RESULT($LD_FLAGS)
;;
esac
fi
if test "$lib_deps" = yes; then
lib_deps_yes=""
lib_deps_no="# "
else
lib_deps_yes="# "
lib_deps_no=""
fi
AC_SUBST(lib_deps_yes)
AC_SUBST(lib_deps_no)
# use supplied ld-flags, or none if `no'
if test "$with_ld_flags" = no; then
LD_FLAGS=
elif test -n "$with_ld_flags"; then
LD_FLAGS="$with_ld_flags"
fi
AC_SUBST(REAL_PICFLAGS) dnl
AC_SUBST(REAL_SHLIBEXT) dnl
AC_SUBST(REAL_LD_FLAGS) dnl
AC_SUBST(PICFLAGS) dnl
AC_SUBST(SHLIBEXT) dnl
AC_SUBST(LDSHARED) dnl
AC_SUBST(LD_FLAGS) dnl
AC_SUBST(LIBEXT) dnl
AC_SUBST(LIBPREFIX) dnl
AC_SUBST(EXECSUFFIX) dnl
AC_SUBST(build_symlink_command)dnl
AC_SUBST(install_symlink_command)dnl
AC_SUBST(install_symlink_command2)dnl
])
-88
View File
@@ -1,88 +0,0 @@
dnl $Id: test-package.m4,v 1.7 1999/04/19 13:33:05 assar Exp $
dnl
dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations)
AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
AC_DEFUN(AC_TEST_PACKAGE_NEW,[
AC_ARG_WITH($1,
[ --with-$1=dir use $1 in dir])
AC_ARG_WITH($1-lib,
[ --with-$1-lib=dir use $1 libraries in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-$1-lib])
elif test "X$with_$1" = "X"; then
with_$1=yes
fi])
AC_ARG_WITH($1-include,
[ --with-$1-include=dir use $1 headers in dir],
[if test "$withval" = "yes" -o "$withval" = "no"; then
AC_MSG_ERROR([No argument for --with-$1-include])
elif test "X$with_$1" = "X"; then
with_$1=yes
fi])
AC_MSG_CHECKING(for $1)
case "$with_$1" in
yes) ;;
no) ;;
"") ;;
*) if test "$with_$1_include" = ""; then
with_$1_include="$with_$1/include"
fi
if test "$with_$1_lib" = ""; then
with_$1_lib="$with_$1/lib$abilibdirext"
fi
;;
esac
header_dirs=
lib_dirs=
d='$5'
for i in $d; do
header_dirs="$header_dirs $i/include"
lib_dirs="$lib_dirs $i/lib$abilibdirext"
done
case "$with_$1_include" in
yes) ;;
no) ;;
*) header_dirs="$with_$1_include $header_dirs";;
esac
case "$with_$1_lib" in
yes) ;;
no) ;;
*) lib_dirs="$with_$1_lib $lib_dirs";;
esac
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
ires= lres=
for i in $header_dirs; do
CFLAGS="-I$i $save_CFLAGS"
AC_TRY_COMPILE([$2],,ires=$i;break)
done
for i in $lib_dirs; do
LIBS="-L$i $3 $4 $save_LIBS"
AC_TRY_LINK([$2],,lres=$i;break)
done
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
$1_includedir="$ires"
$1_libdir="$lres"
INCLUDE_$1="-I$$1_includedir"
LIB_$1="-L$$1_libdir $3"
AC_DEFINE_UNQUOTED(upcase($1),1,[Define if you have the $1 package.])
with_$1=yes
AC_MSG_RESULT([headers $ires, libraries $lres])
else
INCLUDE_$1=
LIB_$1=
with_$1=no
AC_MSG_RESULT($with_$1)
fi
AC_SUBST(INCLUDE_$1)
AC_SUBST(LIB_$1)
])
-21
View File
@@ -1,21 +0,0 @@
dnl $Id: wflags.m4,v 1.3 1999/03/11 12:11:41 joda Exp $
dnl
dnl set WFLAGS
AC_DEFUN(AC_WFLAGS,[
WFLAGS_NOUNUSED=""
WFLAGS_NOIMPLICITINT=""
if test -z "$WFLAGS" -a "$GCC" = "yes"; then
# -Wno-implicit-int for broken X11 headers
# leave these out for now:
# -Wcast-align doesn't work well on alpha osf/1
# -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast
# -Wmissing-declarations -Wnested-externs
WFLAGS="ifelse($#, 0,-Wall, $1)"
WFLAGS_NOUNUSED="-Wno-unused"
WFLAGS_NOIMPLICITINT="-Wno-implicit-int"
fi
AC_SUBST(WFLAGS)dnl
AC_SUBST(WFLAGS_NOUNUSED)dnl
AC_SUBST(WFLAGS_NOIMPLICITINT)dnl
])
-17
View File
@@ -1,17 +0,0 @@
$Id: dir,v 1.1 1997/06/12 16:15:21 joda Exp $
This is the file .../info/dir, which contains the topmost node of the
Info hierarchy. The first time you invoke Info you start off
looking at that node, which is (dir)Top.

File: dir Node: Top This is the top of the INFO tree
This (the Directory node) gives a menu of major topics.
Typing "q" exits, "?" lists all Info commands, "d" returns here,
"h" gives a primer for first-timers,
"mEmacs<Return>" visits the Emacs topic, etc.
In Emacs, you can click mouse button 2 on a menu item or cross reference
to select it.
* Menu:
@@ -1,33 +0,0 @@
#
# $Id: inetd.conf.changes.in,v 1.14 1999/11/10 14:21:07 joda Exp $
#
# Turn off vanilla rshd and rlogind with an informational message.
# If you really want this security problem remove the '-v' option!
shell stream tcp nowait root @prefix@/libexec/rshd rshd -l -L -v
login stream tcp nowait root @prefix@/libexec/rlogind rlogind -l -v
#
# Kerberos rsh
kshell stream tcp nowait root @prefix@/libexec/rshd rshd -L -k
ekshell stream tcp nowait root @prefix@/libexec/rshd rshd -L -k -x
ekshell2 stream tcp nowait root @prefix@/libexec/rshd rshd -L -k -x
#
# Kerberos rlogin
klogin stream tcp nowait root @prefix@/libexec/rlogind rlogind -k
eklogin stream tcp nowait root @prefix@/libexec/rlogind rlogind -k -x
#
# Kerberized telnet and ftp, consider adding '-a user' to
# disallow cleartext passwords to both telnetd and ftpd.
telnet stream tcp nowait root @prefix@/libexec/telnetd telnetd -a none
ftp stream tcp nowait root @prefix@/libexec/ftpd ftpd -l -a none
#
# Kerberized POP. Server principal is pop.hostname, *not* rcmd.hostname!
#kpop stream tcp nowait root @prefix@/libexec/popper popper -k
#
# Old POP3 with passwords in clear (not recommended, uses cleartext passwords)
#pop3 stream tcp nowait root @prefix@/libexec/popper popper
#
# Kauthd, support for putting tickets on other machines in a secure fashion.
kauth stream tcp nowait root @prefix@/libexec/kauthd kauthd
#
# Encrypted X connections
kx stream tcp nowait root @prefix@/libexec/kxd kxd
-208
View File
@@ -1,208 +0,0 @@
/*
* Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id: bits.c,v 1.6 1999/12/02 16:58:36 joda Exp $");
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#ifndef HAVE_STRUPR
static void
strupr(char *s)
{
unsigned char *p = (unsigned char *)s;
while(*p){
if(islower(*p))
*p = toupper(*p);
p++;
}
}
#endif /* HAVE_STRUPR */
#define BITSIZE(TYPE) \
{ \
int b = 0; TYPE x = 1, zero = 0; char *pre = "u_"; \
char tmp[128], tmp2[128]; \
while(x){ x <<= 1; b++; if(x < zero) pre=""; } \
if(b >= len){ \
int tabs; \
sprintf(tmp, "%sint%d_t" , pre, len); \
sprintf(tmp2, "typedef %s %s;", #TYPE, tmp); \
strupr(tmp); \
tabs = 5 - strlen(tmp2) / 8; \
fprintf(f, "%s", tmp2); \
while(tabs-- > 0) fprintf(f, "\t"); \
fprintf(f, "/* %2d bits */\n", b); \
return; \
} \
}
#ifndef HAVE___ATTRIBUTE__
#define __attribute__(x)
#endif
static void
try_signed(FILE *f, int len) __attribute__ ((unused));
static void
try_unsigned(FILE *f, int len) __attribute__ ((unused));
static void
try_signed(FILE *f, int len)
{
BITSIZE(signed char);
BITSIZE(short);
BITSIZE(int);
BITSIZE(long);
#ifdef HAVE_LONG_LONG
BITSIZE(long long);
#endif
fprintf(f, "/* There is no %d bit type */\n", len);
}
static void
try_unsigned(FILE *f, int len)
{
BITSIZE(unsigned char);
BITSIZE(unsigned short);
BITSIZE(unsigned int);
BITSIZE(unsigned long);
#ifdef HAVE_LONG_LONG
BITSIZE(unsigned long long);
#endif
fprintf(f, "/* There is no %d bit type */\n", len);
}
static int
print_bt(FILE *f, int flag)
{
if(flag == 0){
fprintf(f, "/* For compatibility with various type definitions */\n");
fprintf(f, "#ifndef __BIT_TYPES_DEFINED__\n");
fprintf(f, "#define __BIT_TYPES_DEFINED__\n");
fprintf(f, "\n");
}
return 1;
}
int main(int argc, char **argv)
{
FILE *f;
int flag;
char *fn, *hb;
if(argc < 2){
fn = "bits.h";
hb = "__BITS_H__";
f = stdout;
} else {
char *p;
fn = argv[1];
hb = malloc(strlen(fn) + 5);
sprintf(hb, "__%s__", fn);
for(p = hb; *p; p++){
if(!isalnum((unsigned char)*p))
*p = '_';
}
f = fopen(argv[1], "w");
}
fprintf(f, "/* %s -- this file was generated for %s by\n", fn, HOST);
fprintf(f, " %*s %s */\n\n", (int)strlen(fn), "",
"$Id: bits.c,v 1.6 1999/12/02 16:58:36 joda Exp $");
fprintf(f, "#ifndef %s\n", hb);
fprintf(f, "#define %s\n", hb);
fprintf(f, "\n");
#ifdef HAVE_SYS_TYPES_H
fprintf(f, "#include <sys/types.h>\n");
#endif
#ifdef HAVE_INTTYPES_H
fprintf(f, "#include <inttypes.h>\n");
#endif
#ifdef HAVE_SYS_BITYPES_H
fprintf(f, "#include <sys/bitypes.h>\n");
#endif
#ifdef HAVE_NETINET_IN6_MACHTYPES_H
fprintf(f, "#include <netinet/in6_machtypes.h>\n");
#endif
fprintf(f, "\n");
flag = 0;
#ifndef HAVE_INT8_T
flag = print_bt(f, flag);
try_signed (f, 8);
#endif /* HAVE_INT8_T */
#ifndef HAVE_INT16_T
flag = print_bt(f, flag);
try_signed (f, 16);
#endif /* HAVE_INT16_T */
#ifndef HAVE_INT32_T
flag = print_bt(f, flag);
try_signed (f, 32);
#endif /* HAVE_INT32_T */
#if 0
#ifndef HAVE_INT64_T
flag = print_bt(f, flag);
try_signed (f, 64);
#endif /* HAVE_INT64_T */
#endif
#ifndef HAVE_U_INT8_T
flag = print_bt(f, flag);
try_unsigned (f, 8);
#endif /* HAVE_INT8_T */
#ifndef HAVE_U_INT16_T
flag = print_bt(f, flag);
try_unsigned (f, 16);
#endif /* HAVE_U_INT16_T */
#ifndef HAVE_U_INT32_T
flag = print_bt(f, flag);
try_unsigned (f, 32);
#endif /* HAVE_U_INT32_T */
#if 0
#ifndef HAVE_U_INT64_T
flag = print_bt(f, flag);
try_unsigned (f, 64);
#endif /* HAVE_U_INT64_T */
#endif
if(flag){
fprintf(f, "\n");
fprintf(f, "#endif /* __BIT_TYPES_DEFINED__ */\n\n");
}
fprintf(f, "#endif /* %s */\n", hb);
return 0;
}
Loaded 100 of 262 files, more files were not shown because too many files have changed in this diff. Show more