[patch] add support for bsd style skey
[email protected] Tue, 7 Mar 2006 20:39:05 -0500
| Newsgroups | gmane.linux.pld.shadow.general |
|---|---|
| Organization | wh0rd.org |
| Message-ID | <[email protected]> |
some bsd's have updated the skeychallenge() function in the skey api to take a fourth argument ... this patch will detect in configure whether skeychallenge() takes 3 or 4 arguments and act accordingly in pwauth.c -mike
shadow-bsd-skey.patch
(text/x-diff, 1.5 KB)
Index: configure.in =================================================================== RCS file: /cvsroot/shadow/configure.in,v retrieving revision 1.136 diff -u -p -r1.136 configure.in --- configure.in 6 Mar 2006 18:57:10 -0000 1.136 +++ configure.in 8 Mar 2006 01:35:58 -0000 @@ -324,6 +332,12 @@ if test "$with_skey" = "yes"; then AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey], [AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])]) AC_DEFINE(SKEY, 1, [Define to support S/Key logins.]) + AC_TRY_COMPILE([ + #include <stdio.h> + #include <skey.h> + ],[ + skeychallenge((void*)0, (void*)0, (void*)0, 0); + ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])]) fi AM_GNU_GETTEXT_VERSION(0.12.1) Index: lib/pwauth.c =================================================================== RCS file: /cvsroot/shadow/lib/pwauth.c,v retrieving revision 1.19 diff -u -p -r1.19 pwauth.c --- lib/pwauth.c 31 Aug 2005 17:24:56 -0000 1.19 +++ lib/pwauth.c 8 Mar 2006 01:35:59 -0000 @@ -123,6 +123,14 @@ pw_auth (const char *cipher, const char * If there is no SKEY information we default to not using SKEY. */ +# ifdef SKEY_BSD_STYLE + /* + * Some BSD updates to the S/KEY API adds a fourth parameter; the + * sizeof of the challenge info buffer. + */ +# define skeychallenge(s,u,c) skeychallenge(s,u,c,sizeof(c)) +# endif + if (skeychallenge (&skey, user, challenge_info) == 0) use_skey = 1; #endif