|* DATABASE_NAME - name of the database the function accesses *|
|* (e.g., hosts, servicess, ...) *|
|* *|
+|* One additional symbol may optionally be defined: *|
+|* *|
+|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *|
+|* *|
\*******************************************************************/
#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
#define STRINGIFY1(Name) STRINGIFY2 (Name)
#define STRINGIFY2(Name) #Name
+#ifndef DEFAULT_CONFIG
+#define DEFAULT_CONFIG 0
+#endif
static service_user *database = NULL;
DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp)
{
if (database == NULL
- && __nss_database_lookup (DATABASE_NAME_STRING, &database) < 0)
+ && __nss_database_lookup (DATABASE_NAME_STRING, DEFAULT_CONFIG,
+ &database) < 0)
return -1;
*ni = database;
/* Interface functions for NSS. */
-/* Get the data structure representing the specified database. More
+/* Get the data structure representing the specified database.
+ If there is no configuration for this database in the file,
+ parse a service list from DEFCONFIG and use that. More
than one function can use the database. */
-int __nss_database_lookup (const char *database, service_user **ni);
+int __nss_database_lookup (const char *database, const char *defconfig,
+ service_user **ni);
/* Put first function with name FCT_NAME for SERVICE in FCTP. The