View | Details | Raw Unified | Return to bug 48239
Collapse All | Expand All

(-)pam-mysql/Makefile (-5 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	pam_mysql
8
PORTNAME=	pam_mysql
9
PORTVERSION=	0.4.7
9
PORTVERSION=	0.5
10
CATEGORIES=	security databases
10
CATEGORIES=	security databases
11
MASTER_SITES=	http://download.sourceforge.net/pam-mysql/ \
11
MASTER_SITES=	http://download.sourceforge.net/pam-mysql/ \
12
		http://atreides.freenix.no/~anders/
12
		http://atreides.freenix.no/~anders/
Lines 20-29 Link Here
20
WRKSRC=		${WRKDIR}/${PORTNAME}
20
WRKSRC=		${WRKDIR}/${PORTNAME}
21
21
22
.include <bsd.port.pre.mk>
22
.include <bsd.port.pre.mk>
23
24
.if !exists(/usr/include/security/_pam_types.h) && ${OSVERSION} >= 500031
25
BROKEN=		"Does not work with OpenPAM (yet)"
26
.endif
27
23
28
post-patch:
24
post-patch:
29
	@cd ${WRKSRC} && ${GMAKE} clean
25
	@cd ${WRKSRC} && ${GMAKE} clean
(-)pam-mysql/distinfo (-1 / +1 lines)
Line 1 Link Here
1
MD5 (pam_mysql-0.4.7.tar.gz) = 8442ec07c3de929720bbb8783750a1ff
1
MD5 (pam_mysql-0.5.tar.gz) = 8cf002392292ae2a5774545324739a94
(-)pam-mysql/files/patch-aa (-62 / +17 lines)
Lines 1-63 Link Here
1
--- pam_mysql.c.old	Sun Sep 24 02:26:17 2000
1
--- Makefile.orig	Thu Nov 21 05:13:01 2002
2
+++ pam_mysql.c	Sun Sep 24 02:42:23 2000
2
+++ Makefile	Thu Feb 13 13:39:07 2003
3
@@ -14,7 +14,6 @@
3
@@ -3,13 +3,9 @@
4
 #include <unistd.h>
4
 ifndef FULL_LINUX_PAM_SOURCE_TREE
5
 #include <syslog.h>
5
 export DYNAMIC=-DPAM_DYNAMIC
6
 #include <stdarg.h>
6
 export CC=gcc
7
-#include <alloca.h>
7
-export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
8
 #include <string.h>
8
-       -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
9
-       -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
10
-       -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
11
-       -Wshadow -pedantic -fPIC
12
+export CFLAGS=-O2 -I/usr/local/include -fPIC
13
 export MKDIR=mkdir -p
14
-export LD_D=gcc -shared -Xlinker -x -L/usr/lib/mysql -lz
15
+export LD_D=gcc -shared -Xlinker -x -L/usr/local/lib/mysql -lz
16
 endif
9
 
17
 
10
 #include <mysql/mysql.h>
18
 #
11
@@ -332,40 +331,40 @@
12
 		}
13
 		strcpy (junk, argv[i]);
14
 		if ((strchr (junk, (int) '=') != NULL)) {
15
-			strncpy (mybuf, strtok (junk, "="), 255);
16
-			strncpy (myval, strtok (NULL, "="), 255);
17
+			strlcpy (mybuf, strtok (junk, "="), 255);
18
+			strlcpy (myval, strtok (NULL, "="), 255);
19
 			free (junk);
20
 			if (!strcasecmp ("host", mybuf)) {
21
-				strncpy (options.host, myval, 255);
22
+				strlcpy (options.host, myval, 255);
23
 				D (("host changed."));
24
 			} else if (!strcasecmp ("where", mybuf)) {
25
 				while ( (mj = strtok(NULL,"=")) != NULL )
26
 				{
27
-					strcat(myval, "=");
28
-					strcat(myval, mj);
29
+					strlcat(myval, "=", 255);
30
+					strlcat(myval, mj, 255);
31
 				}
32
-				strncpy (options.where, myval, 256);
33
+				strlcpy (options.where, myval, 256);
34
 				D (("where changed."));
35
 #ifdef DEBUG
36
 				syslog(LOG_ERR, "pam_mysql: where now is %s", options.where);
37
 #endif
38
 			} else if (!strcasecmp ("db", mybuf)) {
39
-				strncpy (options.database, myval, 16);
40
+				strlcpy (options.database, myval, 16);
41
 				D (("database changed."));
42
 			} else if (!strcasecmp ("user", mybuf)) {
43
-				strncpy (options.dbuser, myval, 16);
44
+				strlcpy (options.dbuser, myval, 16);
45
 				D (("dbuser changed."));
46
 			} else if (!strcasecmp ("passwd", mybuf)) {
47
-				strncpy (options.dbpasswd, myval, 16);
48
+				strlcpy (options.dbpasswd, myval, 16);
49
 				D (("dbpasswd changed."));
50
 			} else if (!strcasecmp ("table", mybuf)) {
51
-				strncpy (options.table, myval, 16);
52
+				strlcpy (options.table, myval, 16);
53
 				D (("table changed."));
54
 			} else if (!strcasecmp ("usercolumn", mybuf)) {
55
-				strncpy (options.usercolumn, myval, 16);
56
+				strlcpy (options.usercolumn, myval, 16);
57
 				D (("usercolumn changed."));
58
 			} else if (!strcasecmp ("passwdcolumn", mybuf)) {
59
-				strncpy (options.passwdcolumn, myval, 16);
60
+				strlcpy (options.passwdcolumn, myval, 16);
61
 				D (("passwdcolumn changed."));
62
 			} else if (!strcasecmp ("crypt", mybuf)) {
63
 				if ((!strcmp (myval, "1")) ||
(-)pam-mysql/files/patch-ab (+90 lines)
Line 0 Link Here
1
--- pam_mysql.c.orig	Sun Sep 15 10:28:58 2002
2
+++ pam_mysql.c	Thu Feb 13 14:58:21 2003
3
@@ -23,6 +23,7 @@
4
 #include <sys/socket.h>
5
 #include <netinet/in.h>
6
 #include <arpa/inet.h>
7
+#include <time.h>
8
 
9
 
10
 /* AFAIK, only FreeBSD has MD5Data() defined in md5.h
11
@@ -54,7 +55,53 @@
12
 #define DEBUG 
13
 
14
 #include <security/pam_modules.h>
15
+#ifdef _OPENPAM
16
+#include <security/pam_appl.h>
17
+#else
18
 #include <security/pam_misc.h>
19
+#endif
20
+
21
+#ifdef _OPENPAM
22
+/* some macros not defined in OpenPAM */
23
+
24
+/* Good policy to strike out passwords with some characters not just
25
+   free the memory */
26
+
27
+#define _pam_overwrite(x)        \
28
+do {                             \
29
+     register char *__xx__;      \
30
+     if ((__xx__=(x)))           \
31
+          while (*__xx__)        \
32
+               *__xx__++ = '\0'; \
33
+} while (0)
34
+
35
+/*
36
+ * Don't just free it, forget it too.
37
+ */
38
+
39
+#define _pam_drop(X) \
40
+do {                 \
41
+    if (X) {         \
42
+        free(X);     \
43
+        X=NULL;      \
44
+    }                \
45
+} while (0)
46
+
47
+#define _pam_drop_reply(/* struct pam_response * */ reply, /* int */ replies) \
48
+do {                                              \
49
+    int reply_i;                                  \
50
+                                                  \
51
+    for (reply_i=0; reply_i<replies; ++reply_i) { \
52
+	if (reply[reply_i].resp) {                \
53
+	    _pam_overwrite(reply[reply_i].resp);  \
54
+	    free(reply[reply_i].resp);            \
55
+	}                                         \
56
+    }                                             \
57
+    if (reply)                                    \
58
+	free(reply);                              \
59
+} while (0)
60
+
61
+#endif
62
 
63
 struct optionstruct {
64
 	char host[257];
65
@@ -620,7 +667,11 @@
66
 		retval = conv->conv(nargs,
67
 		                    (const struct pam_message **) message,
68
 		                    response, conv->appdata_ptr);
69
-		if ((retval != PAM_SUCCESS) && (retval != PAM_CONV_AGAIN))
70
+		if ((retval != PAM_SUCCESS)
71
+#ifndef _OPENPAM
72
+			&& (retval != PAM_CONV_AGAIN)
73
+#endif
74
+		   )
75
 			syslog(LOG_DEBUG, "pam_mysql: conversation failure [%s]",
76
 			       pam_strerror(pamh, retval));
77
 	} else {
78
@@ -827,8 +878,12 @@
79
 	if (retval != PAM_SUCCESS) {
80
 		if (resp != NULL)
81
 			_pam_drop_reply(resp,i);
82
+#ifndef _OPENPAM
83
 		return ((retval == PAM_CONV_AGAIN)
84
 		        ? PAM_INCOMPLETE : PAM_AUTHINFO_UNAVAIL);
85
+#else
86
+		return PAM_AUTHINFO_UNAVAIL;
87
+#endif
88
 	}
89
 
90
 	/* we have a password so set AUTHTOK

Return to bug 48239