]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
log: Relocate pagsh
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 20 May 2012 16:43:10 +0000 (17:43 +0100)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 1 Sep 2012 18:13:07 +0000 (11:13 -0700)
Move the pagsh utility out of sys, and into log. This moves it closer
to other token and PAG related utilities, and resolves a circular
dependency between sys and auth.

Change-Id: Ibbbfc0e3bebc9ecb70f05b137e10e65ff9e4aff6
Reviewed-on: http://gerrit.openafs.org/8028
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
src/log/.gitignore
src/log/Makefile.in
src/log/pagsh.c [new file with mode: 0644]
src/sys/.gitignore
src/sys/Makefile.in
src/sys/pagsh.c [deleted file]

index cf84a7412ab2b57269407a0a834f724a58603f1d..c5f418f18bfd9779044d6713292358915270680d 100644 (file)
@@ -2,6 +2,8 @@
 #     git ls-files -i --exclude-standard
 # to check that you haven't inadvertently ignored any tracked files.
 
+/pagsh
+/pagsh.krb
 /kseal
 /tokens
 /tokens.krb
index c70f7ccf85c3c3f6746906ee4449ea220f538425..49a48c3d09ef04623e4fb00a95dce88ced65a634 100644 (file)
@@ -35,7 +35,7 @@ KLIBRARIES=${TOP_LIBDIR}/libauth.krb.a \
 #
 # Main targets
 #
-all: unlog tokens tokens.krb
+all: unlog tokens tokens.krb pagsh pagsh.krb
 
 #
 # Build targets
@@ -43,6 +43,16 @@ all: unlog tokens tokens.krb
 kseal: kseal.o ${LIBRARIES}
        $(AFS_LDRULE) kseal.o ${LIBRARIES} $(LIB_roken) ${XLIBS}
 
+pagsh: pagsh.o ${LIBRARIES}
+       $(AFS_LDRULE) pagsh.o ${LIBRARIES} $(LIB_roken) ${XLIBS}
+
+CFLAGS_pagsh.krb.o = -DAFS_KERBEROS_ENV
+pagsh.krb.o: pagsh.c
+       $(AFS_CCRULE) $(srcdir)/pagsh.c
+
+pagsh.krb: pagsh.krb.o ${KLIBRARIES}
+       $(AFS_LDRULE) pagsh.krb.o ${KLIBRARIES} $(LIB_roken) ${XLIBS}
+
 unlog: unlog.o ${LIBRARIES}
        $(AFS_LDRULE) unlog.o ${LIBRARIES} $(LIB_roken) ${XLIBS}
 
@@ -59,7 +69,7 @@ tokens.o: tokens.c ${TOP_INCDIR}/rx/xdr.h AFS_component_version_number.c
 #
 # Install targets
 #
-install: unlog tokens tokens.krb
+install: unlog tokens tokens.krb pagsh pagsh.krb
        ${INSTALL} -d ${DESTDIR}${bindir}
        ${INSTALL} -d ${DESTDIR}${afssrvbindir}
        ${INSTALL} -d ${DESTDIR}${sbindir}
@@ -68,8 +78,11 @@ install: unlog tokens tokens.krb
        ${INSTALL_PROGRAM} tokens.krb ${DESTDIR}${bindir}/tokens.krb
        ${INSTALL_PROGRAM} tokens ${DESTDIR}${afssrvbindir}/tokens
        ${INSTALL_PROGRAM} tokens.krb ${DESTDIR}${afssrvbindir}/tokens.krb
+       ${INSTALL_PROGRAM} pagsh ${DESTDIR}${bindir}/pagsh
+       ${INSTALL_PROGRAM} pagsh.krb ${DESTDIR}${bindir}/pagsh.krb
 
-dest: unlog tokens tokens.krb
+
+dest: unlog tokens tokens.krb pagsh pagsh.krb
        ${INSTALL} -d ${DEST}/bin
        ${INSTALL} -d ${DEST}/root.server/usr/afs/bin
        ${INSTALL} -d ${DEST}/etc
@@ -78,12 +91,14 @@ dest: unlog tokens tokens.krb
        ${INSTALL_PROGRAM} tokens.krb ${DEST}/bin/tokens.krb
        ${INSTALL_PROGRAM} tokens ${DEST}/root.server/usr/afs/bin/tokens
        ${INSTALL_PROGRAM} tokens.krb ${DEST}/root.server/usr/afs/bin/tokens.krb
-
+       ${INSTALL_PROGRAM} pagsh ${DEST}/bin/pagsh
+       ${INSTALL_PROGRAM} pagsh.krb ${DEST}/bin/pagsh.krb
 #
 # Misc. targets
 #
 clean: 
-       $(RM) -f *.o unlog tokens kseal core AFS_component_version_number.c tokens.krb
+       $(RM) -f *.o unlog tokens kseal pagsh pagsh.krb \
+               core AFS_component_version_number.c tokens.krb
 
 test:
        cd test; $(MAKE)
diff --git a/src/log/pagsh.c b/src/log/pagsh.c
new file mode 100644 (file)
index 0000000..7bbdcfb
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
+
+#ifdef AFS_AIX32_ENV
+# ifdef AFS_AIX51_ENV
+#  include <sys/cred.h>
+#  ifdef HAVE_SYS_PAG_H
+#   include <sys/pag.h>
+#  endif
+# endif
+#endif
+
+#include <limits.h>
+#include <rx/rx.h>
+#include <afs/auth.h>
+#include <afs/sys_prototypes.h>
+
+#include "AFS_component_version_number.c"
+
+int
+main(int argc, char *argv[])
+{
+    struct passwd *pwe;
+    int uid, gid;
+    char *shell = "/bin/sh";
+
+#ifdef AFS_AIX32_ENV
+    /*
+     * The following signal action for AIX is necessary so that in case of a
+     * crash (i.e. core is generated) we can include the user's data section
+     * in the core dump. Unfortunately, by default, only a partial core is
+     * generated which, in many cases, isn't too useful.
+     */
+    struct sigaction nsa;
+
+    sigemptyset(&nsa.sa_mask);
+    nsa.sa_handler = SIG_DFL;
+    nsa.sa_flags = SA_FULLDUMP;
+    sigaction(SIGSEGV, &nsa, NULL);
+#endif
+    gid = getgid();
+    uid = getuid();
+    pwe = getpwuid(uid);
+    if (pwe == 0) {
+       fprintf(stderr, "Intruder alert.\n");
+    } else {
+/*             shell = pwe->pw_shell; */
+    }
+    if (setpag() == -1) {
+       perror("setpag");
+    }
+#ifdef AFS_KERBEROS_ENV
+    ktc_newpag();
+#endif
+    (void)setuid(uid);
+    (void)setgid(gid);
+    argv[0] = shell;
+    execvp(shell, argv);
+    perror(shell);
+    fprintf(stderr, "No shell\n");
+    exit(1);
+}
index 89e6019b237827a53f0688dec6efedb7e1318074..aa60e2d2dfc1c7ee35d1bd418caf8136a3d2689a 100644 (file)
@@ -2,8 +2,6 @@
 #     git ls-files -i --exclude-standard
 # to check that you haven't inadvertently ignored any tracked files.
 
-/pagsh
-/pagsh.krb
 /picobj
 /rmtsys.h
 /rmtsysd
index 8161579e22bc751889a0d52a6f6163a51638962a..073ea8fb525e82f3c3f41adecf120d28ce0763f6 100644 (file)
@@ -29,8 +29,6 @@ RMTOBJS=rmtsysnet.o rmtsysc.o rmtsys.cs.o rmtsys.xdr.o rmtsys.ss.o rmtsyss.o
 
 all: \
     rmtsysd \
-    pagsh \
-    pagsh.krb \
     ${TOP_INCDIR}/afs/afssyscalls.h \
     ${TOP_INCDIR}/afs/afs.exp \
     ${TOP_INCDIR}/afs/xfsattrs.h \
@@ -105,7 +103,7 @@ libsys.a: ${OBJECTS} ${RMTOBJS} syscall.o afsl.exp AFS_component_version_number.
        esac
        $(RANLIB) $@
 
-tests: pagsh pagsh.krb fixit iinc idec icreate iopen istat rmtsysd
+tests: fixit iinc idec icreate iopen istat rmtsysd
 
 syscall.o: syscall.s
        @set -e; set -x; case "$(SYS_NAME)" in \
@@ -154,16 +152,7 @@ Krmtsys.h: rmtsys.xg
 rmtsysd: rmtsysd.o libsys.a
        $(AFS_LDRULE) rmtsysd.o ${LIBS} $(LIB_roken)
 
-pagsh: pagsh.o libsys.a AFS_component_version_number.o
-       $(AFS_LDRULE) pagsh.o ${LIBS} $(LIB_roken)
 
-CFLAGS_pagsh.krb.o = -DAFS_KERBEROS_ENV
-pagsh.krb.o: pagsh.c
-       $(AFS_CCRULE) $(srcdir)/pagsh.c 
-
-pagsh.krb: libsys.a pagsh.krb.o ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a
-       $(AFS_LDRULE) pagsh.krb.o ${TOP_LIBDIR}/libauth.krb.a \
-               ${TOP_LIBDIR}/librxkad.a ${LIBS} $(LIB_roken)
 
 #
 # Test programs.
@@ -223,30 +212,26 @@ afsl.exp: ${srcdir}/afsl4.exp ${srcdir}/afsl5.exp
 #
 # Installation targets
 #
-install: libsys.a rmtsysd afssyscalls.h pagsh pagsh.krb afs.exp xfsattrs.h
+install: libsys.a rmtsysd afssyscalls.h afs.exp xfsattrs.h
        ${INSTALL} -d ${DESTDIR}${libdir}/afs
        ${INSTALL} -d ${DESTDIR}${sbindir}
        ${INSTALL} -d ${DESTDIR}${includedir}/afs
        ${INSTALL_DATA} libsys.a ${DESTDIR}${libdir}/afs/libsys.a
        ${INSTALL_PROGRAM} rmtsysd ${DESTDIR}${sbindir}/rmtsysd
        ${INSTALL_DATA} ${srcdir}/afssyscalls.h ${DESTDIR}${includedir}/afs/afssyscalls.h
-       ${INSTALL_PROGRAM} pagsh ${DESTDIR}${bindir}/pagsh
-       ${INSTALL_PROGRAM} pagsh.krb ${DESTDIR}${bindir}/pagsh.krb
        ${INSTALL_DATA} ${srcdir}/xfsattrs.h ${DESTDIR}${includedir}/afs/xfsattrs.h
        @set -x; case ${SYS_NAME} in \
        rs_aix*) \
                ${INSTALL_DATA} afs.exp ${DESTDIR}${includedir}/afs/afs.exp;; \
        esac
 
-dest: libsys.a rmtsysd afssyscalls.h pagsh pagsh.krb afs.exp xfsattrs.h
+dest: libsys.a rmtsysd afssyscalls.h afs.exp xfsattrs.h
        ${INSTALL} -d ${DEST}/lib/afs
        ${INSTALL} -d ${DEST}/etc
        ${INSTALL} -d ${DEST}/bin
        ${INSTALL} -d ${DEST}/include/afs
        ${INSTALL_DATA} libsys.a ${DEST}/lib/afs/libsys.a
        ${INSTALL_PROGRAM} rmtsysd ${DEST}/etc/rmtsysd
-       ${INSTALL_PROGRAM} pagsh ${DEST}/bin/pagsh
-       ${INSTALL_PROGRAM} pagsh.krb ${DEST}/bin/pagsh.krb
        ${INSTALL_DATA} ${srcdir}/afssyscalls.h ${DEST}/include/afs/afssyscalls.h
        ${INSTALL_DATA} ${srcdir}/xfsattrs.h ${DEST}/include/afs/xfsattrs.h
        @set -x; case ${SYS_NAME} in \
@@ -262,6 +247,6 @@ include ../config/Makefile.version
 clean:
        $(RM) -f *.o libsys.a xfsinode iinc idec icreate iopen istat core \
        rmtsysc rmtsyss *.o rmtsys.ss.c rmtsys.cs.c rmtsys.xdr.c rmtsys.h \
-       rmtsysd AFS_component_version_number.c pagsh pagsh.krb \
+       rmtsysd AFS_component_version_number.c \
        afs.exp afsl.exp libafssetpag.* Krmtsys.cs.c Krmtsys.h Krmtsys.xdr.c
        $(RM) -rf picobj
diff --git a/src/sys/pagsh.c b/src/sys/pagsh.c
deleted file mode 100644 (file)
index 2083bc4..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#ifdef AFS_AIX32_ENV
-# ifdef AFS_AIX51_ENV
-#  include <sys/cred.h>
-#  ifdef HAVE_SYS_PAG_H
-#   include <sys/pag.h>
-#  endif
-# endif
-#endif
-
-#include <limits.h>
-#include <rx/rx.h>
-#include <afs/auth.h>
-
-#include "sys_prototypes.h"
-
-#include "AFS_component_version_number.c"
-
-int
-main(int argc, char *argv[])
-{
-    struct passwd *pwe;
-    int uid, gid;
-    char *shell = "/bin/sh";
-
-#ifdef AFS_AIX32_ENV
-    /*
-     * The following signal action for AIX is necessary so that in case of a
-     * crash (i.e. core is generated) we can include the user's data section
-     * in the core dump. Unfortunately, by default, only a partial core is
-     * generated which, in many cases, isn't too useful.
-     */
-    struct sigaction nsa;
-
-    sigemptyset(&nsa.sa_mask);
-    nsa.sa_handler = SIG_DFL;
-    nsa.sa_flags = SA_FULLDUMP;
-    sigaction(SIGSEGV, &nsa, NULL);
-#endif
-    gid = getgid();
-    uid = getuid();
-    pwe = getpwuid(uid);
-    if (pwe == 0) {
-       fprintf(stderr, "Intruder alert.\n");
-    } else {
-/*             shell = pwe->pw_shell; */
-    }
-    if (setpag() == -1) {
-       perror("setpag");
-    }
-#ifdef AFS_KERBEROS_ENV
-    ktc_newpag();
-#endif
-    (void)setuid(uid);
-    (void)setgid(gid);
-    argv[0] = shell;
-    execvp(shell, argv);
-    perror(shell);
-    fprintf(stderr, "No shell\n");
-    exit(1);
-}