echo Not building shared libafsauthent for ${SYS_NAME} ;; \
esac
+kopenafs: config sys
+ ${COMPILE_PART1} kopenafs ${COMPILE_PART2}
+
libadmin_real:
${COMPILE_PART1} libadmin ${COMPILE_PART2}
${COMPILE_PART1} libadmin/adminutil ${COMPILE_PART2}
ptserver scout bu_utils ubik uss bozo vfsck volser tvolser tsalvaged \
venus update xstat afsmonitor rxdebug libafsrpc \
libafsauthent shlibafsrpc shlibafsauthent libadmin man-pages \
- platform
+ platform kopenafs
${COMPILE_PART1} finale ${COMPILE_PART2}
finale_nolibafs: project cmd comerr afsd butc tbutc libuafs audit kauth log \
ptserver scout bu_utils ubik uss bozo vfsck volser tvolser tsalvaged \
venus update xstat afsmonitor rxdebug libafsrpc \
libafsauthent shlibafsrpc shlibafsauthent libadmin man-pages \
- platform
+ platform kopenafs
${COMPILE_PART1} finale ${COMPILE_PART2}
# Use washtool to ensure MakefileProto is current and obj/libafs exists.
-${COMPILE_PART1} libafsauthent ${COMPILE_CLEAN}
-${COMPILE_PART1} shlibafsrpc ${COMPILE_CLEAN}
-${COMPILE_PART1} shlibafsauthent ${COMPILE_CLEAN}
+ -${COMPILE_PART1} kopenafs ${COMPILE_CLEAN}
-${COMPILE_PART1} libadmin ${COMPILE_CLEAN}
-${COMPILE_PART1} libadmin/adminutil ${COMPILE_CLEAN}
-${COMPILE_PART1} libadmin/client ${COMPILE_CLEAN}
src/gtx/Makefile \
src/kauth/test/Makefile \
src/kauth/Makefile \
+ src/kopenafs/Makefile \
src/libacl/test/Makefile \
src/libacl/Makefile \
src/libadmin/adminutil/Makefile \
else
AC_MSG_RESULT(no)
fi
-
+
+AC_TYPE_SIGNAL
AC_CHECK_TYPE(ssize_t, int)
+AC_CHECK_TYPE([sig_atomic_t], ,
+ [AC_DEFINE([sig_atomic_t], [int],
+ [Define to int if <signal.h> does not define.])],
+[#include <sys/types.h>
+#include <signal.h>])
AC_SIZEOF_TYPE(long)
AC_MSG_CHECKING(size of time_t)
src/JAVA/libjafs/Makefile \
src/kauth/Makefile \
src/kauth/test/Makefile \
+src/kopenafs/Makefile \
src/libacl/Makefile \
src/libacl/test/Makefile \
src/libadmin/adminutil/Makefile \
--- /dev/null
+AFS_component_version_number.c
+Makefile
+libkopenafs.*
+test-setpag
+test-unlog
--- /dev/null
+# Copyright 2000, International Business Machines Corporation and others.
+# All Rights Reserved.
+#
+# This software has been released under the terms of the IBM Public
+# License. For details, see the LICENSE file in the top-level source
+# directory or online at http://www.openafs.org/dl/license10.html
+#
+# Portions Copyright (c) 2003 Apple Computer, Inc.
+
+srcdir=@srcdir@
+include @TOP_OBJDIR@/src/config/Makefile.config
+
+# API version. When something changes, increment as appropriate.
+# Ignore at your own risk.
+MAJOR = 1
+MINOR = 0
+
+CC = ${MT_CC}
+INCLUDES = -I. -I${srcdir} -I../sys
+CFLAGS = ${COMMON_CFLAGS} ${INCLUDES} ${MT_CFLAGS} ${SHLIB_CFLAGS}
+
+SYS = ${srcdir}/../sys
+SYSOBJS = glue.o pioctl.o setpag.o syscall.o
+LIBOBJS = kopenafs.o ${SYSOBJS} AFS_component_version_number.o
+
+LIBKOPENAFS = libkopenafs.${SHLIB_SUFFIX}.${MAJOR}.${MINOR}
+
+all: ${TOP_LIBDIR}/${LIBKOPENAFS} ${TOP_LIBDIR}/libkopenafs.a \
+ ${TOP_INCDIR}/kopenafs.h
+
+${TOP_LIBDIR}/${LIBKOPENAFS}: ${LIBKOPENAFS}
+ ${INSTALL_DATA} ${LIBKOPENAFS} ${TOP_LIBDIR}/${LIBKOPENAFS}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX}.${MAJOR}
+
+${TOP_LIBDIR}/libkopenafs.a: libkopenafs.a
+ ${INSTALL_DATA} libkopenafs.a $@
+
+${TOP_INCDIR}/kopenafs.h: kopenafs.h
+ ${INSTALL_DATA} kopenafs.h $@
+
+glue.o: ${SYS}/glue.c ${SYS}/afssyscalls.h
+ ${CCOBJ} ${CFLAGS} -c ${SYS}/glue.c
+
+pioctl.o: ${SYS}/pioctl.c ${SYS}/afssyscalls.h
+ ${CCOBJ} ${CFLAGS} -c ${SYS}/pioctl.c
+
+setpag.o: ${SYS}/setpag.c ${SYS}/afssyscalls.h
+ ${CCOBJ} ${CFLAGS} -c ${SYS}/setpag.c
+
+# This file is only actually used on SGI and AIX, but some systems can't cope
+# with an empty .o file being included in a link.
+syscall.o: ${SYS}/syscall.s
+ @set -x; case "$(SYS_NAME)" in \
+ sgi_*) \
+ ${CC} ${CFLAGS} -c ${SYS}/syscall.s; \
+ ;; \
+ *fbsd* | *obsd* | *nbsd*) \
+ ${CCOBJ} -E ${SFLAGS} syscall.s > syscall.S ; \
+ ${AS} syscall.S -o syscall.o ; \
+ $(RM) -f syscall.S; \
+ ;; \
+ rs_aix*) \
+ /lib/cpp -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
+ as -o syscall.o syscall.ss; \
+ $(RM) syscall.ss; \
+ ;; \
+ *) \
+ touch syscall.o; \
+ ;; \
+ esac
+
+libkopenafs.a: ${LIBOBJS}
+ ${RM} -f $@
+ ${AR} crv $@ ${LIBOBJS}
+ ${RANLIB} $@
+
+${LIBKOPENAFS}: ${LIBOBJS}
+ case ${SYS_NAME} in \
+ rs_aix*) \
+ ${SHLIB_LINKER} -o ${LIBKOPENAFS} ${LIBOBJS} \
+ -bE:${srcdir}/kopenafs.exp ${MT_LIBS}; \
+ ;; \
+ sun*_5*) \
+ ${SHLIB_LINKER} -h libafsrpc.${SHLIB_SUFFIX}.${MAJOR} \
+ -o ${LIBKOPENAFS} ${LIBOBJS} ${MT_LIBS}; \
+ ;; \
+ *_linux*) \
+ ${SHLIB_LINKER} -Wl,-h,libafsrpc.${SHLIB_SUFFIX}.${MAJOR} \
+ -Wl,--version-script=${srcdir}/mapfile \
+ -o ${LIBKOPENAFS} ${LIBOBJS} ${MT_LIBS}; \
+ ;; \
+ *) \
+ ${SHLIB_LINKER} -o ${LIBKOPENAFS} ${LIBOBJS} ${MT_LIBS}; \
+ ;; \
+ esac
+
+test-unlog: test-unlog.o libkopenafs.a
+ ${CC} -o test-unlog test-unlog.o libkopenafs.a ${XLIBS} ${CFLAGS}
+
+test-setpag: test-setpag.o libkopenafs.a
+ ${CC} -o test-setpag test-setpag.o libkopenafs.a ${XLIBS} ${CFLAGS}
+
+#
+# Installation targets
+#
+install: ${LIBKOPENAFS}
+ ${INSTALL} -d ${DESTDIR}${libdir}
+ ${INSTALL} -d ${DESTDIR}${includedir}
+ ${INSTALL_DATA} libkopenafs.a ${DESTDIR}${libdir}/libkopenafs.a
+ ${INSTALL_DATA} ${LIBKOPENAFS} ${DESTDIR}${libdir}/${LIBKOPENAFS}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${DESTDIR}${libdir}/libkopenafs.${SHLIB_SUFFIX}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${DESTDIR}${libdir}/libkopenafs.${SHLIB_SUFFIX}.${MAJOR}
+ ${INSTALL_DATA} kopenafs.h ${DESTDIR}${includedir}/kopenafs.h
+
+dest: ${LIBKOPENAFS}
+ ${INSTALL} -d ${DEST}/lib
+ ${INSTALL} -d ${DEST}/include
+ ${INSTALL_DATA} libkopenafs.a ${DEST}/lib/libkopenafs.a
+ ${INSTALL_DATA} ${LIBKOPENAFS} ${DEST}/lib/${LIBKOPENAFS}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${DEST}/lib/libkopenafs.${SHLIB_SUFFIX}
+ -ln -f -s ${LIBKOPENAFS} \
+ ${DEST}/lib/libkopenafs.${SHLIB_SUFFIX}.${MAJOR}
+ ${INSTALL_DATA} kopenafs.h ${DEST}/include/kopenafs.h
+
+#
+# Misc targets
+#
+clean:
+ $(RM) -f *.o *.a ${LIBKOPENAFS} AFS_component_version_number.c
+
+include ../config/Makefile.version
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
+ * Glue code for the kopenafs API. Mostly just wrappers around the functions
+ * included in the libsys code.
+ */
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <sys/signal.h>
+
+#include <afsconfig.h>
+#include <afs/afssyscalls.h>
+#include <kopenafs.h>
+
+static volatile sig_atomic_t syscall_okay = 1;
+
+/* Signal handler to catch failed system calls and change the okay flag. */
+#ifdef SIGSYS
+static RETSIGTYPE
+sigsys_handler(int s)
+{
+ syscall_okay = 0;
+ signal(SIGSYS, sigsys_handler);
+}
+#endif /* SIGSYS */
+
+int
+k_hasafs(void)
+{
+ struct ViceIoctl iob;
+ int okay, saved_errno;
+ RETSIGTYPE (*saved_func)(int);
+
+ saved_errno = errno;
+
+#ifdef SIGSYS
+ saved_func = signal(SIGSYS, sigsys_handler);
+#endif
+
+ iob.in = NULL;
+ iob.in_size = 0;
+ iob.out = NULL;
+ iob.out_size = 0;
+ lpioctl(NULL, VIOCSETTOK, (char *) &iob, 0);
+
+#ifdef SIGSYS
+ signal(SIGSYS, saved_func);
+#endif
+
+ okay = 1;
+ if (!syscall_okay || errno != EINVAL)
+ okay = 0;
+ errno = saved_errno;
+ return okay;
+}
+
+int
+k_setpag(void)
+{
+ return lsetpag();
+}
+
+int
+k_pioctl(char *path, int cmd, struct ViceIoctl *cmarg, int follow)
+{
+ return lpioctl(path, cmd, (char *) cmarg, follow);
+}
+
+int
+k_unlog(void)
+{
+ struct ViceIoctl iob;
+
+ iob.in = NULL;
+ iob.in_size = 0;
+ iob.out = NULL;
+ iob.out_size = 0;
+ return lpioctl(NULL, VIOCUNLOG, (char *) &iob, 0);
+}
--- /dev/null
+k_hasafs
+k_setpag
+k_unlog
+k_pioctl
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
+ * This file defines the interface to the libkopenafs library, which provides
+ * a reduced set of functions for compatibility with the Heimdal/KTH libkafs
+ * library. This interface and the corresponding library are the best way to
+ * get a completely standalone setpag() function from OpenAFS (in the form of
+ * the k_setpag() interface defined here).
+ *
+ * The calls here only work on systems with native AFS clients and *will not*
+ * work through the NFS translator.
+ */
+
+#ifndef KOPENAFS_H
+#define KOPENAFS_H 1
+
+/* Get the VIOC* constants and struct ViceIoctl. */
+#include <afs/vioc.h>
+
+/*
+ * Initialization function. Returns true if AFS is available on the system
+ * and false otherwise. Should be called before any of the other functions,
+ * and if it returns false, the other functions should not be called.
+ */
+int k_hasafs(void);
+
+/*
+ * Create a new PAG and put the current process in it. Returns 0 on success,
+ * non-zero on system call failure. Equivalent to lsetpag().
+ */
+int k_setpag(void);
+
+/*
+ * Remove the tokens in the current PAG. Returns 0 on success, non-zero on
+ * system call failure.
+ */
+int k_unlog(void);
+
+/*
+ * Perform an arbitrary pioctl system call with the specified arguments.
+ * Returns 0 on success, non-zero on system call failure. Equivalent to
+ * lpioctl().
+ */
+int k_pioctl(char *path, int cmd, struct ViceIoctl *cmarg, int follow);
+
+#endif /* KOPENAFS_H */
--- /dev/null
+# Export map for libkopenafs, used on Linux and Solaris to restrict
+# exports from the shared libraries to just the public ABI. Add symbol
+# versioning while we're at it, just in case.
+
+KOPENAFS_1.0 {
+ global:
+ k_hasafs;
+ k_setpag;
+ k_unlog;
+ k_pioctl;
+ local:
+ *;
+};
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
+ * Test the kopenafs setpag support.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+ int status;
+
+ if (k_hasafs()) {
+ printf("Running k_setpag\n");
+ status = k_setpag();
+ printf("Status: %d, errno: %d\n", status, errno);
+ if (argc > 1) {
+ argv++;
+ execvp(argv[0], argv);
+ }
+ } else {
+ printf("AFS apparently not running\n");
+ }
+}
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
+ * Test the kopenafs unlog support.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+
+int
+main(void)
+{
+ int status;
+
+ if (k_hasafs()) {
+ printf("Running k_unlog\n");
+ status = k_unlog();
+ printf("Status: %d, errno: %d\n", status, errno);
+ } else {
+ printf("AFS apparently not running\n");
+ }
+}
afssyscalls.o \
rmtsysnet.o \
glue.o \
- setpag.o
+ setpag.o \
+ pioctl.o
PTSERVEROBJS = \
ptclient.o \
setpag.o: ${SYS}/setpag.c
${CCRULE}
+pioctl.o: ${SYS}/pioctl.c
+ ${CCRULE}
+
clean:
$(RM) -f *.o *.a libafsauthent*
INCLUDES=-I${TOP_OBJDIR}/src/config -I${TOP_INCDIR}
CFLAGS = ${PAM_DBG} ${PAM_OPTMZ} ${INCLUDES} ${PAM_CFLAGS}
-all: test_pam ${TOP_LIBDIR}/pam_afs.so.1 ${TOP_LIBDIR}/pam_afs.krb.so.1
-
-${TOP_LIBDIR}/pam_afs.so.1: pam_afs.so.1
- ${INSTALL_DATA} $? $@
-
-${TOP_LIBDIR}/pam_afs.krb.so.1: pam_afs.krb.so.1
- ${INSTALL_DATA} $? $@
+all: test_pam pam_afs.so.1 pam_afs.krb.so.1
afs_setcred.o: afs_setcred.c afs_pam_msg.h afs_message.h afs_util.h
${CC} ${CFLAGS} -c ${srcdir}/afs_setcred.c -o afs_setcred.o
afssyscalls.o \
rmtsysnet.o \
glue.o \
- setpag.o
+ setpag.o \
+ pioctl.o
PTSERVEROBJS = \
ptclient.o \
setpag.o: ${SYS}/setpag.c
${CCRULE}
+pioctl.o: ${SYS}/pioctl.c
+ ${CCRULE}
+
clean:
$(RM) -f *.o *.a libafsauthent*
SFLAGS=-I${TOP_INCDIR}
LIBS=libsys.a ${TOP_LIBDIR}/librx.a libsys.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/util.a ${XLIBS}
-OBJECTS= afssyscalls.o setpag.o glue.o syscall.o
+OBJECTS= afssyscalls.o setpag.o pioctl.o glue.o syscall.o
SHLIBOBJS = picobj/setpag.o picobj/glue.o syscall.o
RMTOBJS=rmtsysnet.o rmtsysc.o rmtsys.cs.o rmtsys.xdr.o rmtsys.ss.o rmtsyss.o
setpag.o: setpag.c afssyscalls.h
${CCOBJ} ${CFLAGS} -c ${srcdir}/setpag.c
+pioctl.o: pioctl.c afssyscalls.h
+ ${CCOBJ} ${CFLAGS} -c ${srcdir}/pioctl.c
+
rmtsysnet.o rmtsysc.o rmtsyss.o rmtsysd.o: rmtsys.h
rmtsysd: AFS_component_version_number.o afs.exp afsl.exp
#pragma weak xiinc = iinc
#pragma weak xidec = idec
#pragma weak xiopen = iopen
-#pragma weak xlpioctl = lpioctl
#ifdef notdef
#pragma weak xiread = iread
#pragma weak xiwrite = iwrite
}
#endif /* notdef */
-int
-lpioctl(char *path, int cmd, char *cmarg, int follow)
-{
- return (syscall(AFS_PIOCTL, path, cmd, cmarg, follow));
-}
#else /* AFS_SGI_ENV */
#ifndef AFS_NAMEI_ENV
#endif /* AFS_NAMEI_ENV */
-#if defined(AFS_DARWIN80_ENV)
-int ioctl_afs_syscall(long syscall, long param1, long param2, long param3,
- long param4, long param5, long param6, int *rval) {
- struct afssysargs syscall_data;
- int code;
- int fd = open(SYSCALL_DEV_FNAME, O_RDWR);
- if(fd < 0)
- return -1;
-
- syscall_data.syscall = syscall;
- syscall_data.param1 = param1;
- syscall_data.param2 = param2;
- syscall_data.param3 = param3;
- syscall_data.param4 = param4;
- syscall_data.param5 = param5;
- syscall_data.param6 = param6;
-
- code = ioctl(fd, VIOC_SYSCALL, &syscall_data);
-
- close(fd);
- if (code)
- return code;
- *rval=syscall_data.retval;
- return 0;
-}
-#endif
-
-int
-lpioctl(char *path, int cmd, char *cmarg, int follow)
-{
- int errcode, rval;
-
-#if defined(AFS_LINUX20_ENV)
- rval = proc_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg,
- follow, &errcode);
-
- if(rval)
- errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg,
- follow);
-#elif defined(AFS_DARWIN80_ENV)
- rval = ioctl_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg,
- follow, 0, 0, &errcode);
- if (rval)
- errcode = rval;
-#else
- errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow);
-#endif
-
- return (errcode);
-}
-
#endif /* !AFS_SGI_ENV */
#endif /* !AFS_AIX32_ENV */
return 0;
}
#endif
+
+#if defined(AFS_DARWIN80_ENV)
+int ioctl_afs_syscall(long syscall, long param1, long param2, long param3,
+ long param4, long param5, long param6, int *rval) {
+ struct afssysargs syscall_data;
+ int code;
+ int fd = open(SYSCALL_DEV_FNAME, O_RDWR);
+ if(fd < 0)
+ return -1;
+
+ syscall_data.syscall = syscall;
+ syscall_data.param1 = param1;
+ syscall_data.param2 = param2;
+ syscall_data.param3 = param3;
+ syscall_data.param4 = param4;
+ syscall_data.param5 = param5;
+ syscall_data.param6 = param6;
+
+ code = ioctl(fd, VIOC_SYSCALL, &syscall_data);
+
+ close(fd);
+ if (code)
+ return code;
+ *rval=syscall_data.retval;
+ return 0;
+}
+#endif
--- /dev/null
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+/*
+ * The lpioctl system call. (pioctl is handled by the rmtsys layer and turned
+ * into either lpioctl or a remote call as appropriate.) It is kept separate
+ * to allow for the creation of the libkopenafs shared library without
+ * including the other system calls.
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <afs/afs_args.h>
+#if defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
+#include <unistd.h>
+#else
+#include <stdio.h>
+#endif
+#include "afssyscalls.h"
+
+#ifdef AFS_AIX32_ENV
+/*
+ * in VRMIX, system calls look just like function calls, so we don't
+ * need to do anything!
+ */
+
+#else
+#if defined(AFS_SGI_ENV)
+
+#pragma weak xlpioctl = lpioctl
+
+int
+lpioctl(char *path, int cmd, char *cmarg, int follow)
+{
+ return (syscall(AFS_PIOCTL, path, cmd, cmarg, follow));
+}
+
+#else /* AFS_SGI_ENV */
+
+int
+lpioctl(char *path, int cmd, char *cmarg, int follow)
+{
+ int errcode, rval;
+
+#if defined(AFS_LINUX20_ENV)
+ rval = proc_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg,
+ follow, &errcode);
+
+ if(rval)
+ errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg,
+ follow);
+#elif defined(AFS_DARWIN80_ENV)
+ rval = ioctl_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg,
+ follow, 0, 0, &errcode);
+ if (rval)
+ errcode = rval;
+#else
+ errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow);
+#endif
+
+ return (errcode);
+}
+
+#endif /* !AFS_SGI_ENV */
+#endif /* !AFS_AIX32_ENV */