Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
#
# Multilink require Trivial Database Support
#
# Multilink require Trivial Database Support
-AM_CONDITIONAL(WITH_TDB, test "x${enable_multilink}" = "xyes")
-AM_COND_IF([WITH_TDB],
- AC_DEFINE([USE_TDB], 1, ["Include TDB support"]))
+AM_CONDITIONAL(PPP_WITH_TDB, test "x${enable_multilink}" = "xyes")
+AM_COND_IF([PPP_WITH_TDB],
+ AC_DEFINE([PPP_WITH_TDB], 1, ["Include TDB support"]))
#
# Enable support for loadable plugins
#
# Enable support for loadable plugins
pppd_SOURCES += multilink.c
endif
pppd_SOURCES += multilink.c
endif
pppd_SOURCES += tdb.c spinlock.c
endif
pppd_SOURCES += tdb.c spinlock.c
endif
#include "ecp.h"
#include "pathnames.h"
#include "ecp.h"
#include "pathnames.h"
concept (eg PPPoE) */
int childwait_done; /* have timed out waiting for children */
concept (eg PPPoE) */
int childwait_done; /* have timed out waiting for children */
TDB_CONTEXT *pppdb; /* database for storing status etc. */
#endif
TDB_CONTEXT *pppdb; /* database for storing status etc. */
#endif
static int reap_kids(void);
static void childwait_end(void *);
static int reap_kids(void);
static void childwait_end(void *);
static void update_db_entry(void);
static void add_db_key(const char *);
static void delete_db_key(const char *);
static void update_db_entry(void);
static void add_db_key(const char *);
static void delete_db_key(const char *);
pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
if (pppdb != NULL) {
slprintf(db_key, sizeof(db_key), "pppd%d", getpid());
pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
if (pppdb != NULL) {
slprintf(db_key, sizeof(db_key), "pppd%d", getpid());
(*the_channel->cleanup)();
remove_pidfiles();
(*the_channel->cleanup)();
remove_pidfiles();
if (pppdb != NULL)
cleanup_db();
#endif
if (pppdb != NULL)
cleanup_db();
#endif
/* Executing in the child */
sys_close();
/* Executing in the child */
sys_close();
if (pppdb != NULL)
tdb_close(pppdb);
#endif
if (pppdb != NULL)
tdb_close(pppdb);
#endif
if (script_env != 0) {
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, varl) == 0 && p[varl] == '=') {
if (script_env != 0) {
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, varl) == 0 && p[varl] == '=') {
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
free(p-1);
script_env[i] = newstring;
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
free(p-1);
script_env[i] = newstring;
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
if (!add_script_env(i, newstring))
return;
if (!add_script_env(i, newstring))
return;
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
if (pppdb != NULL) {
if (iskey)
add_db_key(newstring);
return;
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, vl) == 0 && p[vl] == '=') {
return;
for (i = 0; (p = script_env[i]) != 0; ++i) {
if (strncmp(p, var, vl) == 0 && p[vl] == '=') {
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
if (p[-1] && pppdb != NULL)
delete_db_key(p);
#endif
if (pppdb != NULL)
update_db_entry();
#endif
if (pppdb != NULL)
update_db_entry();
#endif
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
*/
void unlock_db(void)
{
*/
void unlock_db(void)
{
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
TDB_DATA key;
key.dptr = PPPD_LOCK_KEY;
/*
* update_db_entry - update our entry in the database.
*/
/*
* update_db_entry - update our entry in the database.
*/
if (p[-1])
delete_db_key(p);
}
if (p[-1])
delete_db_key(p);
}
+#endif /* PPP_WITH_TDB */
#undef CBCP_SUPPORT
/* "Include Trivial Database support" */
#undef CBCP_SUPPORT
/* "Include Trivial Database support" */
/* "Have IPv6 support" */
#undef PPP_WITH_IPV6CP
/* "Have IPv6 support" */
#undef PPP_WITH_IPV6CP