mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-04 22:33:27 +00:00
ead4ead456
PR: 4405 Submitted by: Yukihiro Nakai <nakai@TokyoNet.AD.JP>
97 lines
2.1 KiB
Plaintext
97 lines
2.1 KiB
Plaintext
--- users.c.orig Fri Jun 19 05:27:37 1998
|
|
+++ users.c Thu Dec 3 13:27:15 1998
|
|
@@ -32,6 +32,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>
|
|
@@ -50,18 +54,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 **userfp_p, char *name, char *content));
|
|
@@ -99,7 +115,15 @@
|
|
{
|
|
#if defined(DBM_MODE)
|
|
(void)userfp_p;
|
|
+#if defined(USE_NDBM)
|
|
+ if(!(dbp=dbm_open(infoname, O_RDONLY, NULL))) {
|
|
+ return(-1);
|
|
+ } else {
|
|
+ return(0);
|
|
+ }
|
|
+#else
|
|
return dbminit(infoname);
|
|
+#endif
|
|
#else
|
|
*userfp_p = fopen(infoname, "r");
|
|
return *userfp_p == (FILE *)NULL;
|
|
@@ -122,7 +146,11 @@
|
|
{
|
|
#if defined(DBM_MODE)
|
|
(void)userfp;
|
|
+#if defined(USE_NDBM)
|
|
+ dbm_close(dbp);
|
|
+#else
|
|
dbmclose();
|
|
+#endif
|
|
#else
|
|
DEBUG("userinfo_close: fclosing fp=%p\n", userfp );
|
|
fclose(userfp);
|
|
@@ -219,7 +247,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(userfp);
|
|
@@ -228,7 +260,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(userfp);
|