Index: lib/Makefile =================================================================== RCS file: /home/ncvs/src/lib/Makefile,v retrieving revision 1.114 diff -c -r1.114 Makefile *** lib/Makefile 2000/10/24 20:10:25 1.114 --- lib/Makefile 2000/11/25 10:22:26 *************** *** 19,25 **** # # Otherwise, the SUBDIR list should be in alphabetical order. ! SUBDIR= ${_csu} libcom_err ${_libcrypt} msun libmd \ libncurses libradius libskey libtacplus libutil \ ${_compat} libalias libatm ${_libbind} libc ${_libc_r} libcalendar \ libcam libcompat libdevstat libdisk libedit libfetch libform \ --- 19,25 ---- # # Otherwise, the SUBDIR list should be in alphabetical order. ! SUBDIR= ${_csu} libcom_err libcrypt msun libmd \ libncurses libradius libskey libtacplus libutil \ ${_compat} libalias libatm ${_libbind} libc ${_libc_r} libcalendar \ libcam libcompat libdevstat libdisk libedit libfetch libform \ *************** *** 41,53 **** .if !defined(NO_BIND) _libbind= libbind - .endif - - _libcrypt= libcrypt - .if exists(${.CURDIR}/../secure) && !defined(NOSECURE) && !defined(NOCRYPT) && !defined(NO_DESCRYPT) - # Build both libraries. They have different names, so no harm, - # and this avoids having stale libscrypt.* - _libcrypt+= ../secure/lib/libcrypt .endif .if ${MACHINE_ARCH} == "i386" --- 41,46 ---- Index: lib/libcrypt/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libcrypt/Makefile,v retrieving revision 1.26 diff -c -r1.26 Makefile *** lib/libcrypt/Makefile 2000/08/22 02:17:54 1.26 --- lib/libcrypt/Makefile 2000/11/25 10:22:14 *************** *** 3,68 **** # SHLIB_MAJOR= 2 ! LIB= scrypt - LCRYPTBASE= libcrypt - LSCRYPTBASE= lib${LIB} - - LCRYPTSO= ${LCRYPTBASE}.so.${SHLIB_MAJOR} - LSCRYPTSO= ${LSCRYPTBASE}.so.${SHLIB_MAJOR} - - .if ${OBJFORMAT} == elf - SONAME= ${LCRYPTSO} - .endif - .PATH: ${.CURDIR}/../libmd ! SRCS= crypt.c crypt-md5.c misc.c ! STATICSRCS= md5c.c ! STATICOBJS= ${STATICSRCS:S/.c/.o/g} MAN3= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 CFLAGS+= -I${.CURDIR}/../libmd CFLAGS+= -DLIBC_SCCS -Wall PRECIOUSLIB= yes - # Include this early to pick up the definitions of SHLIB_MAJOR and - # SHLIB_MINOR which are used in the existence tests. - .include "${.CURDIR}/../Makefile.inc" - - # We only install the links if they do not already exist. - # This may have to be revised - .if !exists(${DESTDIR}${LIBDIR}/${LCRYPTBASE}.a) - SYMLINKS+= ${LSCRYPTBASE}.a ${LIBDIR}/${LCRYPTBASE}.a - .endif - .if !defined(NOPROFILE) && !exists(${DESTDIR}${LIBDIR}/${LCRYPTBASE}_p.a) - SYMLINKS+= ${LSCRYPTBASE}_p.a ${LIBDIR}/${LCRYPTBASE}_p.a - .endif - .if !defined(NOPIC) && !exists(${DESTDIR}${SHLIBDIR}/${LCRYPTSO}) - SYMLINKS+= ${LSCRYPTSO} ${SHLIBDIR}/${LCRYPTSO} - .endif - .if !defined(NOPIC) && ${OBJFORMAT} == elf && \ - !exists(${DESTDIR}${SHLIBDIR}/${LCRYPTBASE}.so) - SYMLINKS+= ${LSCRYPTBASE}.so ${SHLIBDIR}/${LCRYPTBASE}.so - .endif - .include - - afterinstall: - .if !defined(NOPIC) - @cd ${DESTDIR}${SHLIBDIR}; \ - rm -f ${LCRYPTSO}; \ - ln -sf ${LSCRYPTSO} ${LCRYPTSO}; - .endif - .if !defined(NOPIC) && ${OBJFORMAT} == elf - @cd ${DESTDIR}${SHLIBDIR}; \ - rm -f ${LCRYPTBASE}.so; \ - ln -sf ${LSCRYPTBASE}.so libcrypt.so - .endif - @cd ${DESTDIR}${LIBDIR}; \ - rm -f ${LCRYPTBASE}.a; \ - ln -sf ${LSCRYPTBASE}.a libcrypt.a - .if !defined(NOPROFILE) - @cd ${DESTDIR}${LIBDIR}; \ - rm -f ${LCRYPTBASE}_p.a; \ - ln -sf ${LSCRYPTBASE}_p.a libcrypt_p.a - .endif --- 3,30 ---- # SHLIB_MAJOR= 2 ! LIB= crypt .PATH: ${.CURDIR}/../libmd ! SRCS= crypt.c crypt-md5.c md5c.c misc.c MAN3= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 CFLAGS+= -I${.CURDIR}/../libmd CFLAGS+= -DLIBC_SCCS -Wall + # Pull in the crypt-des.c source, assuming it is present. + .if exists(${.CURDIR}/../../secure/lib/libcrypt/crypt-des.c) && \ + !defined(NOSECURE) && !defined(NOCRYPT) + .PATH: ${.CURDIR}/../../secure/lib/libcrypt + SRCS+= crypt-des.c + CFLAGS+= -I${.CURDIR} -DHAS_DES + .endif + # And the auth_getval() code and support. + .PATH: ${.CURDIR}/../libutil + SRCS+= auth.c property.c + .for sym in MD5Init MD5Final MD5Update MD5Pad auth_getval \ + property_find properties_read properties_free + CFLAGS+= -D${sym}=__${sym} + .endfor PRECIOUSLIB= yes .include Index: lib/libcrypt/crypt-md5.c =================================================================== RCS file: /home/ncvs/src/lib/libcrypt/crypt-md5.c,v retrieving revision 1.5 diff -c -r1.5 crypt-md5.c *** lib/libcrypt/crypt-md5.c 1999/12/17 20:21:45 1.5 --- lib/libcrypt/crypt-md5.c 2000/11/25 09:28:11 *************** *** 22,39 **** #include #include "crypt.h" - #ifdef __PIC__ - #include - - #define MD5Init(ctx) dl_MD5Init(ctx) - #define MD5Update(ctx, data, len) dl_MD5Update(ctx, data, len) - #define MD5Final(dgst, ctx) dl_MD5Final(dgst, ctx) - - static void (*dl_MD5Init)(MD5_CTX *); - static void (*dl_MD5Update)(MD5_CTX *, const unsigned char *, unsigned int); - static void (*dl_MD5Final)(unsigned char digest[16], MD5_CTX *); - #endif - /* * UNIX password */ --- 22,27 ---- *************** *** 55,63 **** int sl,pl,i; MD5_CTX ctx,ctx1; unsigned long l; - #ifdef __PIC__ - void *libmd; - #endif /* Refine the Salt first */ sp = salt; --- 43,48 ---- *************** *** 73,103 **** /* get the length of the true salt */ sl = ep - sp; - #ifdef __PIC__ - libmd = dlopen("libmd.so", RTLD_NOW); - if (libmd == NULL) { - warnx("libcrypt-md5: dlopen(libmd.so): %s\n", dlerror()); - return NULL; - } - dl_MD5Init = dlsym(libmd, "MD5Init"); - if (dl_MD5Init == NULL) { - warnx("libcrypt-md5: looking for MD5Init: %s\n", dlerror()); - dlclose(libmd); - return NULL; - } - dl_MD5Update = dlsym(libmd, "MD5Update"); - if (dl_MD5Update == NULL) { - warnx("libcrypt-md5: looking for MD5Update: %s\n", dlerror()); - dlclose(libmd); - return NULL; - } - dl_MD5Final = dlsym(libmd, "MD5Final"); - if (dl_MD5Final == NULL) { - warnx("libcrypt-md5: looking for MD5Final: %s\n", dlerror()); - dlclose(libmd); - return NULL; - } - #endif MD5Init(&ctx); /* The password first, since that is what is most unknown */ --- 58,63 ---- *************** *** 160,168 **** MD5Final(final,&ctx1); } - #ifdef __PIC__ - dlclose(libmd); - #endif p = passwd + strlen(passwd); l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; --- 120,125 ---- Index: lib/libcrypt/crypt.c =================================================================== RCS file: /home/ncvs/src/lib/libcrypt/crypt.c,v retrieving revision 1.16 diff -c -r1.16 crypt.c *** lib/libcrypt/crypt.c 2000/08/24 17:51:16 1.16 --- lib/libcrypt/crypt.c 2000/11/25 10:10:38 *************** *** 28,37 **** */ #if defined(LIBC_SCCS) && !defined(lint) ! static char rcsid[] = "$FreeBSD: src/lib/libcrypt/crypt.c,v 1.16 2000/08/24 17:51:16 green Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include "crypt.h" static const struct { --- 28,39 ---- */ #if defined(LIBC_SCCS) && !defined(lint) ! static const char rcsid[] = "$FreeBSD: src/lib/libcrypt/crypt.c,v 1.16 2000/08/24 17:51:16 green Exp $"; #endif /* LIBC_SCCS and not lint */ + #include #include + #include #include "crypt.h" static const struct { *************** *** 39,45 **** char *(*const func)(const char *, const char *); const char *const magic; } crypt_types[] = { ! #ifdef NONEXPORTABLE_CRYPT { "des", crypt_des, --- 41,47 ---- char *(*const func)(const char *, const char *); const char *const magic; } crypt_types[] = { ! #ifdef HAS_DES { "des", crypt_des, *************** *** 57,74 **** } }; ! static int crypt_type = 0; const char * ! crypt_get_format(void) { return (crypt_types[crypt_type].name); } int ! crypt_set_format(char *type) { int i; for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { if (strcmp(type, crypt_types[i].name) == 0) { crypt_type = i; --- 59,102 ---- } }; ! static int crypt_type = -1; + static void + crypt_setdefault(void) + { + char *def; + int i; + + if (crypt_type != -1) + return; + def = auth_getval("auth_default"); + if (def == NULL) { + crypt_type = 0; + return; + } + for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { + if (strcmp(def, crypt_types[i].name) == 0) { + crypt_type = i; + return; + } + } + crypt_type = 0; + } + const char * ! crypt_get_format(void) ! { + crypt_setdefault(); return (crypt_types[crypt_type].name); } int ! crypt_set_format(char *type) ! { int i; + crypt_setdefault(); for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { if (strcmp(type, crypt_types[i].name) == 0) { crypt_type = i; *************** *** 83,88 **** --- 111,117 ---- { int i; + crypt_setdefault(); for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { if (crypt_types[i].magic != NULL && strncmp(salt, crypt_types[i].magic, strlen(crypt_types[i].magic)) == 0) Index: secure/lib/libcrypt/Makefile =================================================================== RCS file: Makefile diff -N Makefile *** /tmp/cvsscC2FpqDvK Sat Nov 25 03:26:01 2000 --- /dev/null Sat Nov 25 03:20:00 2000 *************** *** 1,73 **** - # - # $FreeBSD: src/secure/lib/libcrypt/Makefile,v 1.28 2000/08/22 02:15:53 green Exp $ - # - - SHLIB_MAJOR= 2 - LIB= descrypt - - LCRYPTBASE= libcrypt - LSCRYPTBASE= lib${LIB} - - LCRYPTSO= ${LCRYPTBASE}.so.${SHLIB_MAJOR} - LSCRYPTSO= ${LSCRYPTBASE}.so.${SHLIB_MAJOR} - - .if ${OBJFORMAT} == elf - SONAME= ${LCRYPTSO} - .endif - - .PATH: ${.CURDIR}/../../../lib/libmd ${.CURDIR}/../../../lib/libcrypt - SRCS= crypt.c crypt-md5.c misc.c - STATICSRCS= md5c.c - STATICOBJS= ${STATICSRCS:S/.c/.o/g} - SRCS+= crypt-des.c - MAN3= crypt.3 - MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 - CFLAGS+= -I${.CURDIR}/../../../lib/libmd - CFLAGS+= -I${.CURDIR}/../../../lib/libcrypt - CFLAGS+= -DNONEXPORTABLE_CRYPT - CFLAGS+= -DLIBC_SCCS -Wall - PRECIOUSLIB= yes - - # Include this early to pick up the definitions of SHLIB_MAJOR and - # SHLIB_MINOR which are used in the existence tests. - .include "${.CURDIR}/../../../lib/Makefile.inc" - - # We only install the links if they do not already exist. - # This may have to be revised - .if !exists(${DESTDIR}${LIBDIR}/${LCRYPTBASE}.a) - SYMLINKS+= ${LSCRYPTBASE}.a ${LIBDIR}/${LCRYPTBASE}.a - .endif - .if !defined(NOPROFILE) && !exists(${DESTDIR}${LIBDIR}/${LCRYPTBASE}_p.a) - SYMLINKS+= ${LSCRYPTBASE}_p.a ${LIBDIR}/${LCRYPTBASE}_p.a - .endif - .if !defined(NOPIC) && !exists(${DESTDIR}${SHLIBDIR}/${LCRYPTSO}) - SYMLINKS+= ${LSCRYPTSO} ${SHLIBDIR}/${LCRYPTSO} - .endif - .if !defined(NOPIC) && ${OBJFORMAT} == elf && \ - !exists(${DESTDIR}${SHLIBDIR}/${LCRYPTBASE}.so) - SYMLINKS+= ${LSCRYPTBASE}.so ${SHLIBDIR}/${LCRYPTBASE}.so - .endif - - .include - - afterinstall: - .if !defined(NODESCRYPTLINKS) - .if !defined(NOPIC) - @cd ${DESTDIR}${SHLIBDIR}; \ - rm -f ${LCRYPTSO}; \ - ln -sf ${LSCRYPTSO} ${LCRYPTSO}; - .endif - .if !defined(NOPIC) && ${OBJFORMAT} == elf - @cd ${DESTDIR}${SHLIBDIR}; \ - rm -f ${LCRYPTBASE}.so; \ - ln -sf ${LSCRYPTBASE}.so libcrypt.so - .endif - @cd ${DESTDIR}${LIBDIR}; \ - rm -f ${LCRYPTBASE}.a; \ - ln -sf ${LSCRYPTBASE}.a libcrypt.a - .if !defined(NOPROFILE) - @cd ${DESTDIR}${LIBDIR}; \ - rm -f ${LCRYPTBASE}_p.a; \ - ln -sf ${LSCRYPTBASE}_p.a libcrypt_p.a - .endif - .endif --- 0 ---- Index: release/Makefile =================================================================== RCS file: /home/ncvs/src/release/Makefile,v retrieving revision 1.586 diff -c -r1.586 Makefile *** release/Makefile 2000/11/21 04:37:30 1.586 --- release/Makefile 2000/11/25 11:25:57 *************** *** 436,450 **** fi \ done \ - # Create symlinks for the MD5-based crypt lib, too. The - # automatically created links still point to the DES stuff, - # which went into its own distribution. - for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \ - c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \ - rm -f $$c ; \ - ln -s `basename $$i` $$c ; \ - done - # Remove all the directories we don't need. -cd ${RD}/trees && \ find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir --- 436,441 ----