* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define RCSID "$Id: main.c,v 1.111 2002/01/22 16:02:58 dfs Exp $"
+#define RCSID "$Id: main.c,v 1.118 2002/10/27 12:19:58 fcusack Exp $"
#include <stdio.h>
#include <ctype.h>
#include "upap.h"
#include "chap.h"
#include "ccp.h"
+#include "ecp.h"
#include "pathnames.h"
#ifdef USE_TDB
static char pidfilename[MAXPATHLEN]; /* name of pid file */
static char linkpidfile[MAXPATHLEN]; /* name of linkname pid file */
char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
-char remote_number[MAXNAMELEN]; /* Remote telephone number, if available */
uid_t uid; /* Our real user-id */
struct notifier *pidchange = NULL;
struct notifier *phasechange = NULL;
int (*holdoff_hook) __P((void)) = NULL;
int (*new_phase_hook) __P((int)) = NULL;
+void (*snoop_recv_hook) __P((unsigned char *p, int len)) = NULL;
+void (*snoop_send_hook) __P((unsigned char *p, int len)) = NULL;
static int conn_running; /* we have a [dis]connector running */
static int devfd; /* fd of underlying device */
static struct timeval start_time; /* Time when link was started. */
struct pppd_stats link_stats;
-int link_connect_time;
+unsigned link_connect_time;
int link_stats_valid;
/*
&ipv6cp_protent,
#endif
&ccp_protent,
+ &ecp_protent,
#ifdef IPX_CHANGE
&ipxcp_protent,
#endif
init_pr_log(NULL, LOG_INFO);
print_options(pr_log, NULL);
end_pr_log();
- if (dryrun)
- die(0);
}
+ /*
+ * Early check for remote number authorization.
+ */
+ if (!auth_number()) {
+ warn("calling number %q is not authorized", remote_number);
+ exit(EXIT_CNID_AUTH_FAILED);
+ }
+
+ if (dryrun)
+ die(0);
+
/*
* Initialize system-dependent stuff.
*/
}
dump_packet("rcvd", p, len);
+ if (snoop_recv_hook) snoop_recv_hook(p, len);
p += 2; /* Skip address and control */
GETSHORT(protocol, p);
link_connect_time = now.tv_sec - start_time.tv_sec;
link_stats_valid = 1;
- slprintf(numbuf, sizeof(numbuf), "%d", link_connect_time);
+ slprintf(numbuf, sizeof(numbuf), "%u", link_connect_time);
script_setenv("CONNECT_TIME", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%d", link_stats.bytes_out);
+ slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_out);
script_setenv("BYTES_SENT", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%d", link_stats.bytes_in);
+ slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_in);
script_setenv("BYTES_RCVD", numbuf, 0);
}
}
/*
- * notify - call a set of functions registered with add_notify.
+ * notify - call a set of functions registered with add_notifier.
*/
void
notify(notif, val)