From: Tom Keiser Date: Thu, 13 Jul 2006 18:24:29 +0000 (+0000) Subject: aix-lam-20060712 X-Git-Tag: BP-openafs-windows-kdfs-ifs~1207 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=4c1503ee9bf5769a9de247a86d7b9dae85bbd993 aix-lam-20060712 tsm for aix5 --- diff --git a/src/auth/Makefile.in b/src/auth/Makefile.in index 975775b..b5091f8 100644 --- a/src/auth/Makefile.in +++ b/src/auth/Makefile.in @@ -22,9 +22,18 @@ KSRCS=auth.h 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 @@ -69,25 +78,14 @@ ktc_errors.c auth.h: ktc_errors.et auth.p.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 @@ -100,38 +98,73 @@ clean: 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 diff --git a/src/auth/ktc.c b/src/auth/ktc.c index 531ee60..5ef2dd7 100644 --- a/src/auth/ktc.c +++ b/src/auth/ktc.c @@ -71,7 +71,7 @@ RCSID /* For malloc() */ #include - +#include "ktc.h" #ifdef notdef /* AFS_KERBEROS_ENV is now conditionally defined in the Makefile */ @@ -132,7 +132,6 @@ int afs_tf_init(), afs_tf_get_pname(), afs_tf_get_pinst(), afs_tf_get_cred(); 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 @@ -1437,7 +1436,13 @@ char *getenv(); 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; @@ -1450,7 +1455,7 @@ ktc_tkt_string() } 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; @@ -1469,8 +1474,7 @@ ktc_tkt_string() */ void -ktc_set_tkt_string(val) - char *val; +ktc_set_tkt_string(char * val) { LOCK_GLOBAL_MUTEX; diff --git a/src/auth/ktc.h b/src/auth/ktc.h new file mode 100644 index 0000000..cf409bb --- /dev/null +++ b/src/auth/ktc.h @@ -0,0 +1,18 @@ +/* + * 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 */ diff --git a/src/tsm41/Makefile.in b/src/tsm41/Makefile.in index dc55844..f891b67 100644 --- a/src/tsm41/Makefile.in +++ b/src/tsm41/Makefile.in @@ -10,47 +10,100 @@ include @TOP_OBJDIR@/src/config/Makefile.config 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 diff --git a/src/tsm41/aix41_auth.c b/src/tsm41/aix41_auth.c index d9879a2..f74cba9 100644 --- a/src/tsm41/aix41_auth.c +++ b/src/tsm41/aix41_auth.c @@ -13,7 +13,7 @@ RCSID ("$Header$"); -#if defined(AFS_AIX41_ENV) +#if defined(AFS_AIX41_ENV) && !defined(AFS_AIX51_ENV) #include #include #include @@ -29,175 +29,7 @@ RCSID #include #include -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) @@ -216,6 +48,7 @@ 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 @@ -231,23 +64,4 @@ afs_initialize(struct secmethod_table *meths) 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 */ diff --git a/src/tsm41/aix41_ident.c b/src/tsm41/aix41_ident.c new file mode 100644 index 0000000..80062dd --- /dev/null +++ b/src/tsm41/aix41_ident.c @@ -0,0 +1,64 @@ +/* + * 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 +#include + +RCSID + ("$Header$"); + +#if defined(AFS_AIX41_ENV) && !defined(AFS_AIX51_ENV) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#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 */ diff --git a/src/tsm41/aix5_auth.c b/src/tsm41/aix5_auth.c new file mode 100644 index 0000000..bd5c55c --- /dev/null +++ b/src/tsm41/aix5_auth.c @@ -0,0 +1,57 @@ +/* + * 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 +#include + +RCSID + ("$Header$"); + +#if defined(AFS_AIX51_ENV) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#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 */ diff --git a/src/tsm41/aix_auth_common.c b/src/tsm41/aix_auth_common.c new file mode 100644 index 0000000..5f9ab3a --- /dev/null +++ b/src/tsm41/aix_auth_common.c @@ -0,0 +1,105 @@ +/* + * 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 +#include + +RCSID + ("$Header$"); + +#if defined(AFS_AIX41_ENV) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#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 */ diff --git a/src/tsm41/aix_auth_prototypes.h b/src/tsm41/aix_auth_prototypes.h new file mode 100644 index 0000000..80907a3 --- /dev/null +++ b/src/tsm41/aix_auth_prototypes.h @@ -0,0 +1,25 @@ +/* + * 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 */ diff --git a/src/tsm41/aix_ident_prototypes.h b/src/tsm41/aix_ident_prototypes.h new file mode 100644 index 0000000..686cfac --- /dev/null +++ b/src/tsm41/aix_ident_prototypes.h @@ -0,0 +1,20 @@ +/* + * 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 */ diff --git a/src/tsm41/aix_ktc.c b/src/tsm41/aix_ktc.c new file mode 100644 index 0000000..946cce9 --- /dev/null +++ b/src/tsm41/aix_ktc.c @@ -0,0 +1,56 @@ +/* + * 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 +#include + +RCSID + ("$Header$"); + +#if defined(AFS_AIX41_ENV) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "aix_auth_prototypes.h" + +#include + +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 */