udb.c (98121) | udb.c (110560) |
---|---|
1/* 2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15 16#if USERDB | 1/* 2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15 16#if USERDB |
17SM_RCSID("@(#)$Id: udb.c,v 8.153 2001/09/11 04:05:17 gshapiro Exp $ (with USERDB)") | 17SM_RCSID("@(#)$Id: udb.c,v 8.153.4.4 2002/12/03 17:57:41 gshapiro Exp $ (with USERDB)") |
18#else /* USERDB */ | 18#else /* USERDB */ |
19SM_RCSID("@(#)$Id: udb.c,v 8.153 2001/09/11 04:05:17 gshapiro Exp $ (without USERDB)") | 19SM_RCSID("@(#)$Id: udb.c,v 8.153.4.4 2002/12/03 17:57:41 gshapiro Exp $ (without USERDB)") |
20#endif /* USERDB */ 21 22#if USERDB 23 24# if NEWDB | 20#endif /* USERDB */ 21 22#if USERDB 23 24# if NEWDB |
25# include <db.h> 26# ifndef DB_VERSION_MAJOR 27# define DB_VERSION_MAJOR 1 28# endif /* ! DB_VERSION_MAJOR */ | 25# include "sm/bdb.h" |
29# else /* NEWDB */ 30# define DBT struct _data_base_thang_ 31DBT 32{ 33 void *data; /* pointer to data */ 34 size_t size; /* length of data */ 35}; 36# endif /* NEWDB */ --- 148 unchanged lines hidden (view full) --- 185 /* build actual database key */ 186 187 breakout = false; 188 for (up = UdbEnts; !breakout; up++) 189 { 190 int usersize; 191 int userleft; 192 char userbuf[MEMCHUNKSIZE]; | 26# else /* NEWDB */ 27# define DBT struct _data_base_thang_ 28DBT 29{ 30 void *data; /* pointer to data */ 31 size_t size; /* length of data */ 32}; 33# endif /* NEWDB */ --- 148 unchanged lines hidden (view full) --- 182 /* build actual database key */ 183 184 breakout = false; 185 for (up = UdbEnts; !breakout; up++) 186 { 187 int usersize; 188 int userleft; 189 char userbuf[MEMCHUNKSIZE]; |
193# if defined(HESIOD) && defined(HES_GETMAILHOST) | 190# if HESIOD && HES_GETMAILHOST |
194 char pobuf[MAXNAME]; | 191 char pobuf[MAXNAME]; |
195# endif /* defined(HESIOD) && defined(HES_GETMAILHOST) */ | 192# endif /* HESIOD && HES_GETMAILHOST */ |
196# if defined(NEWDB) && DB_VERSION_MAJOR > 1 197 DBC *dbc = NULL; 198# endif /* defined(NEWDB) && DB_VERSION_MAJOR > 1 */ 199 200 user = userbuf; 201 userbuf[0] = '\0'; 202 usersize = sizeof userbuf; 203 userleft = sizeof userbuf - 1; --- 787 unchanged lines hidden (view full) --- 991 0644, DB_BTREE, NULL); 992# else /* DB_VERSION_MAJOR < 2 */ 993 { 994 int flags = DB_RDONLY; 995# if DB_VERSION_MAJOR > 2 996 int ret; 997# endif /* DB_VERSION_MAJOR > 2 */ 998 | 193# if defined(NEWDB) && DB_VERSION_MAJOR > 1 194 DBC *dbc = NULL; 195# endif /* defined(NEWDB) && DB_VERSION_MAJOR > 1 */ 196 197 user = userbuf; 198 userbuf[0] = '\0'; 199 usersize = sizeof userbuf; 200 userleft = sizeof userbuf - 1; --- 787 unchanged lines hidden (view full) --- 988 0644, DB_BTREE, NULL); 989# else /* DB_VERSION_MAJOR < 2 */ 990 { 991 int flags = DB_RDONLY; 992# if DB_VERSION_MAJOR > 2 993 int ret; 994# endif /* DB_VERSION_MAJOR > 2 */ 995 |
999# if !HASFLOCK && defined(DB_FCNTL_LOCKING) 1000 flags |= DB_FCNTL_LOCKING; 1001# endif /* !HASFLOCK && defined(DB_FCNTL_LOCKING) */ 1002 | 996 SM_DB_FLAG_ADD(flags); |
1003 up->udb_dbp = NULL; | 997 up->udb_dbp = NULL; |
1004 | |
1005# if DB_VERSION_MAJOR > 2 1006 ret = db_create(&up->udb_dbp, NULL, 0); 1007 if (ret != 0) 1008 { 1009 (void) up->udb_dbp->close(up->udb_dbp, 1010 0); 1011 up->udb_dbp = NULL; 1012 } 1013 else 1014 { 1015 ret = up->udb_dbp->open(up->udb_dbp, | 998# if DB_VERSION_MAJOR > 2 999 ret = db_create(&up->udb_dbp, NULL, 0); 1000 if (ret != 0) 1001 { 1002 (void) up->udb_dbp->close(up->udb_dbp, 1003 0); 1004 up->udb_dbp = NULL; 1005 } 1006 else 1007 { 1008 ret = up->udb_dbp->open(up->udb_dbp, |
1009 DBTXN |
|
1016 up->udb_dbname, 1017 NULL, 1018 DB_BTREE, 1019 flags, 1020 0644); 1021 if (ret != 0) 1022 { 1023#ifdef DB_OLD_VERSION --- 295 unchanged lines hidden --- | 1010 up->udb_dbname, 1011 NULL, 1012 DB_BTREE, 1013 flags, 1014 0644); 1015 if (ret != 0) 1016 { 1017#ifdef DB_OLD_VERSION --- 295 unchanged lines hidden --- |