diff --git a/lib/auth/afskauthlib/Makefile.in b/lib/auth/afskauthlib/Makefile.in new file mode 100644 index 000000000..9fff0713c --- /dev/null +++ b/lib/auth/afskauthlib/Makefile.in @@ -0,0 +1,80 @@ +# +# $Id$ +# + +SHELL = /bin/sh + +srcdir = @srcdir@ +VPATH = @srcdir@ + +CC = @CC@ +AR = ar +LN_S = @LN_S@ +RANLIB = @RANLIB@ +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @top_srcdir@/mkinstalldirs + +prefix = @prefix@ +exec_prefix = $(prefix) +libdir = $(exec_prefix)/lib + +PICFLAGS = @PICFLAGS@ +SHARED = @SHARED@ +SHLIBEXT = @SHLIBEXT@ +LD_FLAGS = @LD_FLAGS@ + +LIB = afskauthlib.$(SHLIBEXT) + +SOURCES = verify.c + +OBJECTS = verify.o + +all: $(LIB) + +Wall: + make CFLAGS="-g -Wall -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__" + +.c.o: + $(CC) -c $(CPPFLAGS) $(DEFS) -I../../.. -I../../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $< + +install: all + $(MKINSTALLDIRS) $(libdir) + -if test "$(LIB)" != ""; then \ + $(INSTALL) -m 0555 $(LIB) $(libdir) ; \ + $(LN_S) $(libdir)/$(LIB) /usr/afsws/lib/afskauthlib.so + fi + +uninstall: + +TAGS: $(SOURCES) + etags $(SOURCES) + +check: + +clean: + rm -f $(LIB) *.o + +mostlyclean: clean + +distclean: clean + rm -f Makefile *.tab.c *~ + rm -rf CVS + +realclean: distclean + rm -f TAGS + +dist: $(DISTFILES) + for file in $(DISTFILES); do \ + ln $$file ../`cat ../.fname`/lib \ + || cp -p $$file ../`cat ../.fname`/lib; \ + done + + +$(OBJECTS): ../../../config.h + +$(LIB): $(OBJECTS) + $(CC) $(CFLAGS) $(PICFLAGS) $(SHARED) -o $@ $(OBJECTS) $(LD_FLAGS) -L../../kafs -L../../krb -L../../des -L../../roken -lkafs -lkrb -ldes -lroken diff --git a/lib/auth/afskauthlib/README b/lib/auth/afskauthlib/README new file mode 100644 index 000000000..b0b41b265 --- /dev/null +++ b/lib/auth/afskauthlib/README @@ -0,0 +1,16 @@ +$Id$ + + ------------------------------------------------------------ + | NOTE: This is currently just experimental code, it might | + | not work as expected. You have been warned. | + ------------------------------------------------------------ + +This is an attempt at a module compatible with transarcs +afskauthlib.so. It should be usable on all systems where the standard +programs use this library. At least the programs on SGIs do. + +It seems that you currently have to copy libkafs.so, libkrb.so, and +libdes.so to /usr/lib, or build your afskauthlib.so statically. + +The afskauthlib.so itself is able to reside in /usr/vice/etc, +/usr/afsws/lib, or the current directory (wherever that is). diff --git a/lib/auth/afskauthlib/verify.c b/lib/auth/afskauthlib/verify.c new file mode 100644 index 000000000..356c29f28 --- /dev/null +++ b/lib/auth/afskauthlib/verify.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 1995, 1996 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 the 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 +RCSID("$Id$"); +#endif +#include +#include +#include +#include +#include + +/* + * + */ + +int +afs_verify(char *name, + char *password, + int32_t *exp, + int quiet) +{ + int ret = 1; + char lrealm[REALM_SZ + 1]; + char tkt_string[MaxPathLen]; + struct passwd *pwd; + + if (krb_get_lrealm (lrealm, 1) != KFAILURE && + (pwd = k_getpwnam (name)) != NULL) { + sprintf (tkt_string, "%s%d_%d", TKT_ROOT, (int)pwd->pw_uid, (int)getpid()); + krb_set_tkt_string (tkt_string); + ret = krb_verify_user (name, "", lrealm, password, 1, NULL); + if (ret == KSUCCESS) { + if (k_hasafs()) { + k_setpag (); + k_afsklog_uid (0, 0, pwd->pw_uid); + } + } else if (!quiet) + printf ("%s\n", krb_get_err_text (ret)); + } + if (ret) + ret = unix_verify_user (name, password); + + return ret; +} + +char * +afs_gettktstring (void) +{ + return tkt_string (); +}