UKSRCS=${KSRCS} cellconfig.h acfg_errors.c keys.h cellconfig.c \
ktc.c authcon.c ktc_errors.c
-all: ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libauth.krb.a depinstall copyauth setkey
-
-depinstall: ${TOP_INCDIR}/afs/keys.h ${TOP_INCDIR}/afs/cellconfig.h ${TOP_INCDIR}/afs/auth.h
+all: \
+ ${TOP_LIBDIR}/libauth.a \
+ ${TOP_LIBDIR}/libauth.krb.a \
+ depinstall \
+ copyauth \
+ setkey
+
+depinstall: \
+ ${TOP_INCDIR}/afs/keys.h \
+ ${TOP_INCDIR}/afs/cellconfig.h \
+ ${TOP_INCDIR}/afs/auth.h \
+ ${TOP_INCDIR}/afs/ktc.h
cellconfig.o: cellconfig.c ${INCLS}
ktc.o: ktc.c ${INCLS} ${TOP_INCDIR}/afs/vice.h
#
# Install targets
#
-install: ${DESTDIR}${libdir}/afs/libauth.a ${DESTDIR}${libdir}/afs/libauth.krb.a ${DESTDIR}${includedir}/afs/keys.h ${DESTDIR}${includedir}/afs/cellconfig.h ${DESTDIR}${includedir}/afs/auth.h ${DESTDIR}${sbindir}/copyauth
-
-${DEST}/lib/afs/libauth.a: libauth.a
- ${INSTALL} $? $@
-
-${DEST}/lib/afs/libauth.krb.a: libauth.krb.a
- ${INSTALL} $? $@
-
-${DEST}/etc/copyauth: copyauth
- ${INSTALL} $? $@
-
-${DEST}/include/afs/keys.h: keys.h
- ${INSTALL} $? $@
-
-${DEST}/include/afs/cellconfig.h: cellconfig.h
- ${INSTALL} $? $@
-
-${DEST}/include/afs/auth.h: auth.h
- ${INSTALL} $? $@
+install: \
+ ${DESTDIR}${libdir}/afs/libauth.a \
+ ${DESTDIR}${libdir}/afs/libauth.krb.a \
+ ${DESTDIR}${includedir}/afs/keys.h \
+ ${DESTDIR}${includedir}/afs/cellconfig.h \
+ ${DESTDIR}${includedir}/afs/auth.h \
+ ${DESTDIR}${includedir}/afs/ktc.h \
+ ${DESTDIR}${sbindir}/copyauth
#
# Misc. targets
cd test; $(MAKE)
clean:
- $(RM) -f *.o *.a copyauth setkey auth.h cellconfig.h acfg_errors.c ktc_errors.c core\
- AFS_component_version_number.c
+ $(RM) -f *.o *.a \
+ copyauth setkey auth.h cellconfig.h acfg_errors.c \
+ ktc_errors.c core AFS_component_version_number.c
include ../config/Makefile.version
+
+
${DESTDIR}${libdir}/afs/libauth.a: libauth.a
${INSTALL} $? $@
${TOP_LIBDIR}/libauth.a: libauth.a
${INSTALL} $? $@
+${DEST}/lib/afs/libauth.a: libauth.a
+ ${INSTALL} $? $@
+
${DESTDIR}${libdir}/afs/libauth.krb.a: libauth.krb.a
${INSTALL} $? $@
${TOP_LIBDIR}/libauth.krb.a: libauth.krb.a
${INSTALL} $? $@
+${DEST}/lib/afs/libauth.krb.a: libauth.krb.a
+ ${INSTALL} $? $@
+
${DESTDIR}${includedir}/afs/keys.h: keys.h
${INSTALL} $? $@
${TOP_INCDIR}/afs/keys.h: keys.h
${INSTALL} $? $@
+${DEST}/include/afs/keys.h: keys.h
+ ${INSTALL} $? $@
+
${DESTDIR}${includedir}/afs/cellconfig.h: cellconfig.h
${INSTALL} $? $@
${TOP_INCDIR}/afs/cellconfig.h: cellconfig.h
${INSTALL} $? $@
+${DEST}/include/afs/cellconfig.h: cellconfig.h
+ ${INSTALL} $? $@
+
${DESTDIR}${includedir}/afs/auth.h: auth.h
${INSTALL} $? $@
${TOP_INCDIR}/afs/auth.h: auth.h
${INSTALL} $? $@
+${DEST}/include/afs/auth.h: auth.h
+ ${INSTALL} $? $@
+
+${DESTDIR}${includedir}/afs/ktc.h: ktc.h
+ ${INSTALL} $? $@
+
+${TOP_INCDIR}/afs/ktc.h: ktc.h
+ ${INSTALL} $? $@
+
+${DEST}/include/afs/ktc.h: ktc.h
+ ${INSTALL} $? $@
+
${DESTDIR}${sbindir}/copyauth: copyauth
${INSTALL} $? $@
-dest: ${DEST}/lib/afs/libauth.a ${DEST}/lib/afs/libauth.krb.a ${DEST}/include/afs/keys.h ${DEST}/include/afs/cellconfig.h ${DEST}/include/afs/auth.h ${DEST}/etc/copyauth
+${DEST}/etc/copyauth: copyauth
+ ${INSTALL} $? $@
+
+
+
+
+dest: \
+ ${DEST}/lib/afs/libauth.a \
+ ${DEST}/lib/afs/libauth.krb.a \
+ ${DEST}/include/afs/keys.h \
+ ${DEST}/include/afs/cellconfig.h \
+ ${DEST}/include/afs/auth.h \
+ ${DEST}/include/afs/ktc.h \
+ ${DEST}/etc/copyauth
/* For malloc() */
#include <stdlib.h>
-
+#include "ktc.h"
#ifdef notdef
/* AFS_KERBEROS_ENV is now conditionally defined in the Makefile */
int afs_tf_save_cred(), afs_tf_close(), afs_tf_create();
int afs_tf_dest_tkt();
static void ktc_LocalCell();
-char *ktc_tkt_string();
#endif /* AFS_KERBEROS_ENV */
#ifdef AFS_DUX40_ENV
static char krb_ticket_string[4096] = "";
char *
-ktc_tkt_string()
+ktc_tkt_string(void)
+{
+ return ktc_tkt_string_uid(getuid());
+}
+
+char *
+ktc_tkt_string_uid(uid_t uid)
{
char *env;
} else {
/* 32 bits of signed integer will always fit in 11 characters
* (including the sign), so no need to worry about overflow */
- (void)sprintf(krb_ticket_string, "%s%d", TKT_ROOT, getuid());
+ (void)sprintf(krb_ticket_string, "%s%d", TKT_ROOT, uid);
}
}
UNLOCK_GLOBAL_MUTEX;
*/
void
-ktc_set_tkt_string(val)
- char *val;
+ktc_set_tkt_string(char * val)
{
LOCK_GLOBAL_MUTEX;
--- /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
+ */
+
+#ifndef _AFS_AUTH_KTC_H
+#define _AFS_AUTH_KTC_H
+
+extern char * ktc_tkt_string(void);
+extern char * ktc_tkt_string_uid(uid_t);
+extern void ktc_set_tkt_string(char *);
+
+
+#endif /* _AFS_AUTH_KTC_H */
CFLAGS=${OPTIMIZE} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS}
-AFSLIBS = ${TOP_LIBDIR}/libkauth.a ${TOP_LIBDIR}/libprot.a \
- ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/libauth.a \
- ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
- ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a \
- ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
- ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a \
- ${TOP_LIBDIR}/libaudit.a
-KAFSLIBS = ${TOP_LIBDIR}/libkauth.krb.a ${TOP_LIBDIR}/libprot.a \
- ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/libauth.krb.a \
- ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
- ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a \
- ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
- ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a \
- ${TOP_LIBDIR}/libaudit.a
-AUTHLIBS=afs_dynamic_auth afs_dynamic_kerbauth
+CCRULE=${CC} ${CFLAGS} -c $? -o $@
+
+AFSLIBS = \
+ ${TOP_LIBDIR}/libkauth.a \
+ ${TOP_LIBDIR}/libprot.a \
+ ${TOP_LIBDIR}/libubik.a \
+ ${TOP_LIBDIR}/libauth.a \
+ ${TOP_LIBDIR}/librxkad.a \
+ ${TOP_LIBDIR}/libsys.a \
+ ${TOP_LIBDIR}/libdes.a \
+ ${TOP_LIBDIR}/librx.a \
+ ${TOP_LIBDIR}/liblwp.a \
+ ${TOP_LIBDIR}/libcmd.a \
+ ${TOP_LIBDIR}/libcom_err.a \
+ ${TOP_LIBDIR}/util.a \
+ ${TOP_LIBDIR}/libaudit.a
+
+KAFSLIBS = \
+ ${TOP_LIBDIR}/libkauth.krb.a \
+ ${TOP_LIBDIR}/libprot.a \
+ ${TOP_LIBDIR}/libubik.a \
+ ${TOP_LIBDIR}/libauth.krb.a \
+ ${TOP_LIBDIR}/librxkad.a \
+ ${TOP_LIBDIR}/libsys.a \
+ ${TOP_LIBDIR}/libdes.a \
+ ${TOP_LIBDIR}/librx.a \
+ ${TOP_LIBDIR}/liblwp.a \
+ ${TOP_LIBDIR}/libcmd.a \
+ ${TOP_LIBDIR}/libcom_err.a \
+ ${TOP_LIBDIR}/util.a \
+ ${TOP_LIBDIR}/libaudit.a
+
+AUTH_OBJS = \
+ aix_auth.o \
+ aix_ident.o \
+ aix_auth_common.o \
+ aix_ktc_null.o
+
+AUTH_KRB_OBJS = \
+ aix_auth.o \
+ aix_ident.o \
+ aix_auth_common.o \
+ aix_ktc_krb.o \
+
+AUTHLIBS= \
+ afs_dynamic_auth \
+ afs_dynamic_kerbauth
+
IMPORTS = -bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp
LDFLAGS = -eafs_initialize ${IMPORTS} -lsys -lcsys -lc
all: $(AUTHLIBS)
-install install.noversion:
+install install.noversion:
clean:
$(RM) -f $(AUTHLIBS) $(AUTHFILES) so_locations
-afs_dynamic_auth: aix41_auth.o ${AFSLIBS} ${AUTHFILES}
- $(LD) -o afs_dynamic_auth aix41_auth.o $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
+afs_dynamic_auth: ${AUTH_OBJS} ${AFSLIBS} ${AUTHFILES}
+ $(LD) -o $@ ${AUTH_OBJS} $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
+
+afs_dynamic_kerbauth: ${AUTH_KRB_OBJS} ${KAFSLIBS} ${AUTHFILES}
+ $(LD) -o $@ ${AUTH_KRB_OBJS} $(KAFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
+
+aix_auth_common.o: ${srcdir}/aix_auth_common.c
+ ${CCRULE}
+
+aix_ktc_krb.o: ${srcdir}/aix_ktc.c
+ ${CCRULE} -DAFS_KERBEROS_ENV
+
+aix_ktc_null.o: ${srcdir}/aix_ktc.c
+ ${CCRULE}
-afs_dynamic_kerbauth: aix41_auth_krb.o ${KAFSLIBS} ${AUTHFILES}
- $(LD) -o afs_dynamic_kerbauth aix41_auth_krb.o $(KAFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
+aix_auth.o:
+ case ${SYS_NAME} in \
+ rs_aix4*) \
+ ${CC} ${CFLAGS} -c ${srcdir}/aix41_auth.c -o $@ ;; \
+ rs_aix5*) \
+ ${CC} ${CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
+ *) \
+ echo "not building aix lam binary for ${SYS_NAME}" ;; \
+ esac
-aix41_auth.o: ${srcdir}/aix41_auth.c
- ${CC} ${CFLAGS} -c ${srcdir}/aix41_auth.c
+# aix41_ident.c is a null source file for rs_aix5*
+aix_ident.o: ${srcdir}/aix41_ident.c
+ ${CCRULE}
-aix41_auth_krb.o: ${srcdir}/aix41_auth.c
- ${CC} ${CFLAGS} -DAFS_KERBEROS_ENV -c ${srcdir}/aix41_auth.c -o aix41_auth_krb.o
${DEST}/root.client/usr/vice/etc/afs_dynamic_auth: afs_dynamic_auth
${INSTALL} $? $@
${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth: afs_dynamic_kerbauth
${INSTALL} $? $@
-dest: ${DEST}/root.client/usr/vice/etc/afs_dynamic_auth ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth
+dest: \
+ ${DEST}/root.client/usr/vice/etc/afs_dynamic_auth \
+ ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth
RCSID
("$Header$");
-#if defined(AFS_AIX41_ENV)
+#if defined(AFS_AIX41_ENV) && !defined(AFS_AIX51_ENV)
#include <sys/types.h>
#include <sys/param.h>
#include <stdio.h>
#include <afs/kauth.h>
#include <afs/kautils.h>
-struct passwd *afs_getpwnam_int(char *, int);
-
-int
-afs_authenticate(char *userName, char *response, int *reenter, char **message)
-{
- char *reason, *pword, prompt[256];
- struct passwd *pwd;
- int code, unixauthneeded, password_expires = -1;
-
- *reenter = 0;
- *message = (char *)0;
- if (response) {
- pword = response;
- } else {
- sprintf(prompt, "Enter AFS password for %s: ", userName);
- pword = getpass(prompt);
- if (strlen(pword) == 0) {
- printf
- ("Unable to read password because zero length passord is illegal\n");
- *message = (char *)malloc(256);
- sprintf(*message,
- "Unable to read password because zero length passord is illegal\n");
- return AUTH_FAILURE;
- }
- }
-#ifdef AFS_AIX51_ENV
- if ((pwd = afs_getpwnam_int(userName, 1)) == NULL)
-#else
- if ((pwd = getpwnam(userName)) == NULL)
-#endif
- {
- *message = (char *)malloc(256);
- sprintf(*message, "getpwnam for user failed\n");
- return AUTH_FAILURE;
- }
- if (code =
- ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG,
- userName, (char *)0, (char *)0, pword, 0,
- &password_expires, 0, &reason)) {
- if (code == KANOENT)
- return AUTH_NOTFOUND;
- *message = (char *)malloc(1024);
- sprintf(*message, "Unable to authenticate to AFS because %s.\n",
- reason);
- return AUTH_FAILURE;
- }
-#if defined(AFS_KERBEROS_ENV)
- setup_ticket_file(userName);
-#endif
- return AUTH_SUCCESS;
-}
-
-int
-afs_chpass(char *userName, char *oldPasswd, char *newPasswd, char **message)
-{
- return AUTH_SUCCESS;
-}
-
-int
-afs_passwdexpired(char *userName, char **message)
-{
- return AUTH_SUCCESS;
-}
-
-int
-afs_passwdrestrictions(char *userName, char *newPasswd, char *oldPasswd,
- char **message)
-{
- return AUTH_SUCCESS;
-}
-
-int
-afs_getgrset(char *userName)
-{
- return NULL;
-}
-
-struct group *
-afs_getgrgid(int id)
-{
-#ifdef AFS_AIX51_ENV
- static char name[64];
- static char passwd[64];
- static struct group grp;
- struct group *g;
- char *mem = NULL;
-
- while ((g = getgrent()) != NULL) {
- if (g->gr_gid == id) {
- strncpy(&name, g->gr_name, sizeof(name));
- strncpy(&passwd, g->gr_passwd, sizeof(passwd));
- grp.gr_name = &name;
- grp.gr_passwd = &passwd;
- grp.gr_gid = g->gr_gid;
- grp.gr_mem = &mem;
- break;
- }
- }
- endgrent();
- if (g)
- return &grp;
-#endif
- return NULL;
-}
-
-struct group *
-afs_getgrnam(char *name)
-{
- return NULL;
-}
-
-#ifdef AFS_AIX51_ENV
-struct passwd *
-afs_getpwnam(char *user)
-{
- return (NULL);
-}
-
-struct passwd *
-afs_getpwnam_int(char *user, int ignore)
-{
- static char name[64];
- static char passwd[64];
- static char gecos[256];
- static char dir[256];
- static char shell[256];
- static struct passwd pwd;
- struct passwd *p;
-
- pwd.pw_uid = 4294967294;
- pwd.pw_gid = 4294967294;
- strcpy((char *)&shell, "/bin/false");
- if (!user)
- return &pwd;
-
- p = getpwnam (user);
-
- if (p) {
- strncpy(&name, p->pw_name, sizeof(name));
- strncpy(&passwd, p->pw_passwd, sizeof(passwd));
- strncpy(&gecos, p->pw_gecos, sizeof(gecos));
- strncpy(&dir, p->pw_dir, sizeof(dir));
- strncpy(&shell, p->pw_shell, sizeof(shell));
- }
- pwd.pw_name = &name;
- pwd.pw_passwd = &passwd;
- pwd.pw_uid = p->pw_uid;
- pwd.pw_gid = p->pw_gid;
- pwd.pw_gecos = &gecos;
- pwd.pw_dir = &dir;
- pwd.pw_shell = &shell;
-
- if (ignore && (p == NULL))
- return NULL;
- return &pwd;
-}
-#else
-int
-afs_getpwnam(int id)
-{
- return NULL;
-}
-#endif
-
-int
-afs_getpwuid(char *name)
-{
- return NULL;
-}
+#include "aix_auth_prototypes.h"
int
afs_initialize(struct secmethod_table *meths)
meths->method_authenticate = afs_authenticate;
meths->method_passwdexpired = afs_passwdexpired;
meths->method_passwdrestrictions = afs_passwdrestrictions;
+
/*
* These we need to bring in because, for afs users, /etc/security/user's
* "registry" must non-local (i.e. DCE) since otherwise it assumes it's a
return (0);
}
-#if defined(AFS_KERBEROS_ENV)
-
-setup_ticket_file(userName)
- char *userName;
-{
- extern char *ktc_tkt_string();
- struct passwd *pwd;
-
- setpwent(); /* open the pwd database */
- pwd = getpwnam(userName);
- if (pwd) {
- if (chown(ktc_tkt_string(), pwd->pw_uid, pwd->pw_gid) < 0)
- perror("chown: ");
- } else
- perror("getpwnam : ");
- endpwent(); /* close the pwd database */
-}
-#endif /* AFS_KERBEROS_ENV */
-
-#endif
+#endif /* AFS_AIX41_ENV && !AFS_AIX51_ENV */
--- /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
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+RCSID
+ ("$Header$");
+
+#if defined(AFS_AIX41_ENV) && !defined(AFS_AIX51_ENV)
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <pwd.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <errno.h>
+#include <usersec.h>
+
+#include <afs/kauth.h>
+#include <afs/kautils.h>
+
+#include "aix_ident_prototypes.h"
+
+int
+afs_getgrset(char *userName)
+{
+ return NULL;
+}
+
+struct group *
+afs_getgrgid(int id)
+{
+ return NULL;
+}
+
+struct group *
+afs_getgrnam(char *name)
+{
+ return NULL;
+}
+
+int
+afs_getpwnam(int id)
+{
+ return NULL;
+}
+
+int
+afs_getpwuid(char *name)
+{
+ return NULL;
+}
+
+#endif /* AFS_AIX41_ENV && !AFS_AIX51_ENV */
--- /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
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+RCSID
+ ("$Header$");
+
+#if defined(AFS_AIX51_ENV)
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <pwd.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <errno.h>
+#include <usersec.h>
+
+#include <afs/kauth.h>
+#include <afs/kautils.h>
+
+#include "aix_auth_prototypes.h"
+
+int
+afs_initialize(struct secmethod_table *meths)
+{
+ /*
+ * Initialize kauth package here so we don't have to call it
+ * each time we call the authenticate routine.
+ */
+ ka_Init(0);
+ memset(meths, 0, sizeof(struct secmethod_table));
+
+ /*
+ * Initialize the exported interface routines.
+ * Aside from method_authenticate, these are just no-ops.
+ */
+ meths->method_chpass = afs_chpass;
+ meths->method_authenticate = afs_authenticate;
+ meths->method_passwdexpired = afs_passwdexpired;
+ meths->method_passwdrestrictions = afs_passwdrestrictions;
+ meths->method_getpasswd = afs_getpasswd;
+
+ return (0);
+}
+
+#endif /* AFS_AIX51_ENV */
--- /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
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+RCSID
+ ("$Header$");
+
+#if defined(AFS_AIX41_ENV)
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <pwd.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <errno.h>
+#include <usersec.h>
+
+#include <afs/kauth.h>
+#include <afs/kautils.h>
+
+#include "aix_auth_prototypes.h"
+
+int
+afs_authenticate(char *userName, char *response, int *reenter, char **message)
+{
+ char *reason, *pword, prompt[256];
+ struct passwd *pwd;
+ int code, unixauthneeded, password_expires = -1;
+
+ *reenter = 0;
+ *message = (char *)0;
+ if (response) {
+ pword = response;
+ } else {
+ sprintf(prompt, "Enter AFS password for %s: ", userName);
+ pword = getpass(prompt);
+ if (strlen(pword) == 0) {
+ printf
+ ("Unable to read password because zero length passord is illegal\n");
+ *message = (char *)malloc(256);
+ sprintf(*message,
+ "Unable to read password because zero length passord is illegal\n");
+ return AUTH_FAILURE;
+ }
+ }
+
+ if ((pwd = getpwnam(userName)) == NULL) {
+ *message = (char *)malloc(256);
+ sprintf(*message, "getpwnam for user failed\n");
+ return AUTH_FAILURE;
+ }
+
+ if (code =
+ ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG,
+ userName, (char *)0, (char *)0, pword, 0,
+ &password_expires, 0, &reason)) {
+ if (code == KANOENT)
+ return AUTH_NOTFOUND;
+ *message = (char *)malloc(1024);
+ sprintf(*message, "Unable to authenticate to AFS because %s.\n",
+ reason);
+ return AUTH_FAILURE;
+ }
+ aix_ktc_setup_ticket_file(userName);
+ return AUTH_SUCCESS;
+}
+
+int
+afs_chpass(char *userName, char *oldPasswd, char *newPasswd, char **message)
+{
+ return AUTH_SUCCESS;
+}
+
+int
+afs_passwdexpired(char *userName, char **message)
+{
+ return AUTH_SUCCESS;
+}
+
+int
+afs_passwdrestrictions(char *userName, char *newPasswd, char *oldPasswd,
+ char **message)
+{
+ return AUTH_SUCCESS;
+}
+
+char *
+afs_getpasswd(char * userName)
+{
+ errno = ENOSYS;
+ return NULL;
+}
+
+#endif /* AFS_AIX41_ENV */
--- /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
+ */
+
+#ifndef _AFS_TSM41_AIX_AUTH_PROTOTYPES_H
+#define _AFS_TSM41_AIX_AUTH_PROTOTYPES_H
+
+extern int afs_authenticate(char *userName,
+ char *response,
+ int *reenter,
+ char **message);
+extern int afs_chpass(char *userName, char *oldPasswd,
+ char *newPasswd, char **message);
+extern int afs_passwdexpired(char *userName, char **message);
+extern int afs_passwdrestrictions(char *userName, char *newPasswd,
+ char *oldPasswd, char ** message);
+extern char * afs_getpasswd(char * userName);
+extern void aix_ktc_setup_ticket_file(char * userName);
+
+#endif /* _AFS_TSM41_AIX_AUTH_PROTOTYPES_H */
--- /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
+ */
+
+#ifndef _AFS_TSM41_AIX_IDENT_PROTOTYPES_H
+#define _AFS_TSM41_AIX_IDENT_PROTOTYPES_H
+
+extern int afs_getgrset(char *userName);
+extern struct group * afs_getgrgid(int id);
+extern struct group * afs_getgrnam(char *name);
+extern struct passwd * afs_getpwnam(char *user);
+extern int afs_getpwnam(int id);
+extern int afs_getpwuid(char *name);
+
+#endif /* _AFS_TSM41_AIX_IDENT_PROTOTYPES_H */
--- /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
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+RCSID
+ ("$Header$");
+
+#if defined(AFS_AIX41_ENV)
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <locale.h>
+#include <nl_types.h>
+#include <pwd.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <sys/file.h>
+#include <errno.h>
+#include <usersec.h>
+
+#include <afs/kauth.h>
+#include <afs/kautils.h>
+
+#include "aix_auth_prototypes.h"
+
+#include <afs/ktc.h>
+
+void
+aix_ktc_setup_ticket_file(char * userName)
+{
+#if defined(AFS_KERBEROS_ENV)
+ struct passwd *pwd;
+
+ setpwent(); /* open the pwd database */
+ pwd = getpwnam(userName);
+ if (pwd) {
+ if (chown(ktc_tkt_string_uid(pwd->pw_uid),
+ pwd->pw_uid, pwd->pw_gid) < 0) {
+ perror("chown: ");
+ }
+ } else {
+ perror("getpwnam : ");
+ }
+ endpwent(); /* close the pwd database */
+#endif /* AFS_KERBEROS_ENV */
+}
+
+#endif /* AFS_AIX41_ENV */