summaryrefslogtreecommitdiff
path: root/net/ascend-radius/files/patch-af
blob: a5d2ca238c2c52fdd2a05e515b59c3ed9aee5087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
--- users.c.orig	Thu Sep 19 20:04:29 1996
+++ users.c	Mon Sep 23 21:44:51 1996
@@ -30,6 +30,10 @@
 static char sccsid[] =
 "@(#)users.c	1.12 Copyright 1992 Livingston Enterprises Inc";
 
+#if defined(_HAVE_PARAM_H)
+#include	<sys/param.h>
+#endif
+
 #include	<sys/types.h>
 #include	<sys/socket.h>
 #include	<sys/time.h>
@@ -48,18 +52,30 @@
 #	if defined(SOLARIS)
 #		include	</usr/ucbinclude/dbm.h>
 #	else
+#	if defined(USE_NDBM)
+#		include <ndbm.h>
+#	else
 #		include	<dbm.h>
+#	endif
 #	endif	/* SOLARIS */
 #endif /* DBM_MODE */
 
 #include	"radius.h"
 #include	"protos.h"
 
+#if (defined(BSD) && (BSD>=199306))
+#include	<fcntl.h>
+#endif
+
 extern char		*progname;
 extern int		debug_flag;
 extern char		*radius_dir;
 extern char		*radius_users;
 
+#if (defined(DBM_MODE) && defined(USE_NDBM))
+DBM			*dbp;
+#endif
+
 static int parse_record P__((char *name, char *linep,
 	VALUE_PAIR **check_first, VALUE_PAIR **reply_first));
 extern int user_read P__((FILE **userfd, char *name, char *content));
@@ -97,7 +113,15 @@
 {
 #if defined(DBM_MODE)
 	(void)userfd;
+#if defined(USE_NDBM)
+	if(!(dbp=dbm_open(infoname, O_RDONLY, NULL))) {
+		return(-1);
+	} else {
+		return(0);
+	}
+#else
 	return dbminit(infoname);
+#endif
 #else
 	*userfd = fopen(infoname, "r");
 	return *userfd == (FILE *)NULL;
@@ -120,7 +144,11 @@
 {
 #if defined(DBM_MODE)
 	(void)userfd;
+#if defined(USE_NDBM)
+	dbm_close(dbp);
+#else
 	dbmclose();
+#endif
 #else
 	fclose(userfd);
 #endif
@@ -210,7 +238,11 @@
 #ifdef DBM_MODE
 	named.dptr = name;
 	named.dsize = strlen(name)+1;
+#if defined(USE_NDBM)
+	contentd = dbm_fetch(dbp,named);
+#else
 	contentd = fetch(named);
+#endif
 	if(contentd.dsize != 0) {	/* name found */
 		*user_data = contentd.dptr;
 		userinfo_close(userfd);
@@ -219,7 +251,11 @@
 
 	named.dptr = "DEFAULT";
 	named.dsize = sizeof("DEFAULT");
+#if defined(USE_NDBM)
+	contentd = dbm_fetch(dbp,named);
+#else
 	contentd = fetch(named);
+#endif
 	if(contentd.dsize != 0) {	/* DEFAULT found */
 		*user_data = contentd.dptr;
 		userinfo_close(userfd);