diff options
Diffstat (limited to 'crypto/kerberosIV/appl/afsutil')
-rw-r--r-- | crypto/kerberosIV/appl/afsutil/Makefile.in | 89 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/afsutil/aklog.c | 250 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/afsutil/kstring2key.c | 139 | ||||
-rw-r--r-- | crypto/kerberosIV/appl/afsutil/pagsh.c | 136 |
4 files changed, 0 insertions, 614 deletions
diff --git a/crypto/kerberosIV/appl/afsutil/Makefile.in b/crypto/kerberosIV/appl/afsutil/Makefile.in deleted file mode 100644 index 86adb88..0000000 --- a/crypto/kerberosIV/appl/afsutil/Makefile.in +++ /dev/null @@ -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 diff --git a/crypto/kerberosIV/appl/afsutil/aklog.c b/crypto/kerberosIV/appl/afsutil/aklog.c deleted file mode 100644 index b3370da..0000000 --- a/crypto/kerberosIV/appl/afsutil/aklog.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 1995 - 2000 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.2.1 2000/06/23 02:31:15 assar 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_1 (const char *cell, const char *filename) -{ - FILE *f; - static char buf[128]; - char *p; - - f = fopen(filename, "r"); - if(f == NULL) - return NULL; - 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 NULL; -} - -static const char * -expand_cell_name(const char *cell) -{ - char *ret; - - ret = expand_1(cell, _PATH_CELLSERVDB); - if (ret != NULL) - return ret; - ret = expand_1(cell, _PATH_ARLA_CELLSERVDB); - if (ret != NULL) - return ret; - return cell; -} - -static int -createuser (const 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) - f = fopen (_PATH_ARLA_THISCELL, "r"); - if (f == NULL) - err (1, "open(%s, %s)", _PATH_THISCELL, _PATH_ARLA_THISCELL); - if (fgets (cellbuf, sizeof(cellbuf), f) == NULL) - err (1, "read cellname from %s %s", _PATH_THISCELL, _PATH_ARLA_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; - const 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; -} diff --git a/crypto/kerberosIV/appl/afsutil/kstring2key.c b/crypto/kerberosIV/appl/afsutil/kstring2key.c deleted file mode 100644 index bdcf67d..0000000 --- a/crypto/kerberosIV/appl/afsutil/kstring2key.c +++ /dev/null @@ -1,139 +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> - -#define OPENSSL_DES_LIBDES_COMPATIBILITY -#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); -} diff --git a/crypto/kerberosIV/appl/afsutil/pagsh.c b/crypto/kerberosIV/appl/afsutil/pagsh.c deleted file mode 100644 index c6704be..0000000 --- a/crypto/kerberosIV/appl/afsutil/pagsh.c +++ /dev/null @@ -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); -} |