Update to 0.5.

Unbreak on -current.

PR:		ports/48239
Submitted by:	Sergey Matveychuk <sem@ciam.ru>
This commit is contained in:
Anders Nordby 2003-06-01 21:27:03 +00:00
parent 0cfe1e7e78
commit b3480a0721
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=81933
4 changed files with 109 additions and 68 deletions

View file

@ -6,7 +6,7 @@
# #
PORTNAME= pam_mysql PORTNAME= pam_mysql
PORTVERSION= 0.4.7 PORTVERSION= 0.5
CATEGORIES= security databases CATEGORIES= security databases
MASTER_SITES= http://download.sourceforge.net/pam-mysql/ \ MASTER_SITES= http://download.sourceforge.net/pam-mysql/ \
http://atreides.freenix.no/~anders/ http://atreides.freenix.no/~anders/
@ -22,10 +22,6 @@ WRKSRC= ${WRKDIR}/${PORTNAME}
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
.if !exists(/usr/include/security/_pam_types.h) && ${OSVERSION} >= 500031
BROKEN= "Does not work with OpenPAM (yet)"
.endif
post-patch: post-patch:
@cd ${WRKSRC} && ${GMAKE} clean @cd ${WRKSRC} && ${GMAKE} clean

View file

@ -1 +1 @@
MD5 (pam_mysql-0.4.7.tar.gz) = 8442ec07c3de929720bbb8783750a1ff MD5 (pam_mysql-0.5.tar.gz) = 8cf002392292ae2a5774545324739a94

View file

@ -1,63 +1,90 @@
--- pam_mysql.c.old Sun Sep 24 02:26:17 2000 --- pam_mysql.c.orig Sun Sep 15 10:28:58 2002
+++ pam_mysql.c Sun Sep 24 02:42:23 2000 +++ pam_mysql.c Thu Feb 13 14:58:21 2003
@@ -14,7 +14,6 @@ @@ -23,6 +23,7 @@
#include <unistd.h> #include <sys/socket.h>
#include <syslog.h> #include <netinet/in.h>
#include <stdarg.h> #include <arpa/inet.h>
-#include <alloca.h> +#include <time.h>
#include <string.h>
#include <mysql/mysql.h>
@@ -332,40 +331,40 @@ /* AFAIK, only FreeBSD has MD5Data() defined in md5.h
} @@ -54,7 +55,53 @@
strcpy (junk, argv[i]); #define DEBUG
if ((strchr (junk, (int) '=') != NULL)) {
- strncpy (mybuf, strtok (junk, "="), 255); #include <security/pam_modules.h>
- strncpy (myval, strtok (NULL, "="), 255); +#ifdef _OPENPAM
+ strlcpy (mybuf, strtok (junk, "="), 255); +#include <security/pam_appl.h>
+ strlcpy (myval, strtok (NULL, "="), 255); +#else
free (junk); #include <security/pam_misc.h>
if (!strcasecmp ("host", mybuf)) { +#endif
- strncpy (options.host, myval, 255); +
+ strlcpy (options.host, myval, 255); +#ifdef _OPENPAM
D (("host changed.")); +/* some macros not defined in OpenPAM */
} else if (!strcasecmp ("where", mybuf)) { +
while ( (mj = strtok(NULL,"=")) != NULL ) +/* Good policy to strike out passwords with some characters not just
{ + free the memory */
- strcat(myval, "="); +
- strcat(myval, mj); +#define _pam_overwrite(x) \
+ strlcat(myval, "=", 255); +do { \
+ strlcat(myval, mj, 255); + register char *__xx__; \
} + if ((__xx__=(x))) \
- strncpy (options.where, myval, 256); + while (*__xx__) \
+ strlcpy (options.where, myval, 256); + *__xx__++ = '\0'; \
D (("where changed.")); +} while (0)
#ifdef DEBUG +
syslog(LOG_ERR, "pam_mysql: where now is %s", options.where); +/*
#endif + * Don't just free it, forget it too.
} else if (!strcasecmp ("db", mybuf)) { + */
- strncpy (options.database, myval, 16); +
+ strlcpy (options.database, myval, 16); +#define _pam_drop(X) \
D (("database changed.")); +do { \
} else if (!strcasecmp ("user", mybuf)) { + if (X) { \
- strncpy (options.dbuser, myval, 16); + free(X); \
+ strlcpy (options.dbuser, myval, 16); + X=NULL; \
D (("dbuser changed.")); + } \
} else if (!strcasecmp ("passwd", mybuf)) { +} while (0)
- strncpy (options.dbpasswd, myval, 16); +
+ strlcpy (options.dbpasswd, myval, 16); +#define _pam_drop_reply(/* struct pam_response * */ reply, /* int */ replies) \
D (("dbpasswd changed.")); +do { \
} else if (!strcasecmp ("table", mybuf)) { + int reply_i; \
- strncpy (options.table, myval, 16); + \
+ strlcpy (options.table, myval, 16); + for (reply_i=0; reply_i<replies; ++reply_i) { \
D (("table changed.")); + if (reply[reply_i].resp) { \
} else if (!strcasecmp ("usercolumn", mybuf)) { + _pam_overwrite(reply[reply_i].resp); \
- strncpy (options.usercolumn, myval, 16); + free(reply[reply_i].resp); \
+ strlcpy (options.usercolumn, myval, 16); + } \
D (("usercolumn changed.")); + } \
} else if (!strcasecmp ("passwdcolumn", mybuf)) { + if (reply) \
- strncpy (options.passwdcolumn, myval, 16); + free(reply); \
+ strlcpy (options.passwdcolumn, myval, 16); +} while (0)
D (("passwdcolumn changed.")); +
} else if (!strcasecmp ("crypt", mybuf)) { +#endif
if ((!strcmp (myval, "1")) ||
struct optionstruct {
char host[257];
@@ -620,7 +667,11 @@
retval = conv->conv(nargs,
(const struct pam_message **) message,
response, conv->appdata_ptr);
- if ((retval != PAM_SUCCESS) && (retval != PAM_CONV_AGAIN))
+ if ((retval != PAM_SUCCESS)
+#ifndef _OPENPAM
+ && (retval != PAM_CONV_AGAIN)
+#endif
+ )
syslog(LOG_DEBUG, "pam_mysql: conversation failure [%s]",
pam_strerror(pamh, retval));
} else {
@@ -827,8 +878,12 @@
if (retval != PAM_SUCCESS) {
if (resp != NULL)
_pam_drop_reply(resp,i);
+#ifndef _OPENPAM
return ((retval == PAM_CONV_AGAIN)
? PAM_INCOMPLETE : PAM_AUTHINFO_UNAVAIL);
+#else
+ return PAM_AUTHINFO_UNAVAIL;
+#endif
}
/* we have a password so set AUTHTOK

View file

@ -0,0 +1,18 @@
--- Makefile.orig Thu Nov 21 02:13:01 2002
+++ Makefile Mon May 19 23:41:43 2003
@@ -3,13 +3,9 @@
ifndef FULL_LINUX_PAM_SOURCE_TREE
export DYNAMIC=-DPAM_DYNAMIC
export CC=gcc
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
- -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
- -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
- -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
- -Wshadow -pedantic -fPIC
+export CFLAGS+=-I${LOCALBASE}/include -fPIC
export MKDIR=mkdir -p
-export LD_D=gcc -shared -Xlinker -x -L/usr/lib/mysql -lz
+export LD_D=${CC} -shared -Xlinker -x -L${LOCALBASE}/lib/mysql -lz
endif
#