summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-11-17 00:42:41 +0000
committerbrian <brian@FreeBSD.org>1997-11-17 00:42:41 +0000
commit674fc92d54c1a0eadba4706ec31ac423c35adff7 (patch)
treef5eb6d98e8df8e08a811f9f51b592a74080e9a7d /usr.sbin
parent5696a07f36cde36ef7955344c7b33fc5c7c57248 (diff)
downloadFreeBSD-src-674fc92d54c1a0eadba4706ec31ac423c35adff7.zip
FreeBSD-src-674fc92d54c1a0eadba4706ec31ac423c35adff7.tar.gz
Add id strings to tun.[ch].
Don't try to open ppp.secret if we're never going to use it.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/auth.c15
-rw-r--r--usr.sbin/ppp/defs.c30
-rw-r--r--usr.sbin/ppp/defs.h3
-rw-r--r--usr.sbin/ppp/main.c5
-rw-r--r--usr.sbin/ppp/tun.c4
-rw-r--r--usr.sbin/ppp/tun.h4
6 files changed, 43 insertions, 18 deletions
diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c
index a2f328b..1a6758c 100644
--- a/usr.sbin/ppp/auth.c
+++ b/usr.sbin/ppp/auth.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: auth.c,v 1.21 1997/11/09 22:07:27 brian Exp $
+ * $Id: auth.c,v 1.22 1997/11/11 22:58:09 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@@ -47,19 +47,6 @@
void
LocalAuthInit()
{
- if (*VarShortHost == '\0') {
- char *p;
-
- if (gethostname(VarShortHost, sizeof(VarShortHost))) {
- VarLocalAuth = LOCAL_DENY;
- return;
- }
-
- p = strchr(VarShortHost, '.');
- if (p)
- *p = '\0';
- }
-
if (!(mode&MODE_DAEMON))
/* We're allowed in interactive mode */
VarLocalAuth = LOCAL_AUTH;
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c
index 3b4142f..fed64e9 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -1,11 +1,22 @@
/*
- * $Id: defs.c,v 1.1 1997/10/26 01:02:30 brian Exp $
+ * $Id: defs.c,v 1.2 1997/11/11 22:58:10 brian Exp $
*/
+#include <sys/param.h>
+#include <netinet/in.h>
+
+#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "defs.h"
+#include "mbuf.h"
+#include "log.h"
+#include "loadalias.h"
+#include "command.h"
+#include "vars.h"
int mode = MODE_INTER;
int BGFiledes[2] = { -1, -1 };
@@ -41,3 +52,20 @@ randinit()
srandomdev();
}
}
+
+
+int
+GetShortHost()
+{
+ char *p;
+
+ if (gethostname(VarShortHost, sizeof(VarShortHost))) {
+ LogPrintf(LogERROR, "GetShortHost: gethostbyname: %s\n", strerror(errno));
+ return 0;
+ }
+
+ if ((p = strchr(VarShortHost, '.')))
+ *p = '\0';
+
+ return 1;
+}
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index b5eaf47..79f2fce 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: defs.h,v 1.24 1997/11/09 14:18:37 brian Exp $
+ * $Id: defs.h,v 1.25 1997/11/11 22:58:10 brian Exp $
*
* TODO:
*/
@@ -90,3 +90,4 @@ extern int netfd;
extern void SetLabel(const char *);
extern const char *GetLabel(void);
extern void randinit(void);
+extern int GetShortHost(void);
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index 54a5ede..19a24b1 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.98 1997/11/13 15:35:06 brian Exp $
+ * $Id: main.c,v 1.99 1997/11/16 22:15:05 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -391,9 +391,10 @@ main(int argc, char **argv)
return 1;
}
+ if (!GetShortHost())
+ return 1;
Greetings();
IpcpDefAddress();
- LocalAuthInit();
if (SelectSystem("default", CONFFILE) < 0 && VarTerm)
fprintf(VarTerm, "Warning: No default entry is given in config file.\n");
diff --git a/usr.sbin/ppp/tun.c b/usr.sbin/ppp/tun.c
index c848c7e..bee63cb 100644
--- a/usr.sbin/ppp/tun.c
+++ b/usr.sbin/ppp/tun.c
@@ -1,3 +1,7 @@
+/*
+ * $Id$
+ */
+
#include <sys/param.h>
#include <sys/time.h>
#include <sys/select.h>
diff --git a/usr.sbin/ppp/tun.h b/usr.sbin/ppp/tun.h
index bc495e1..1d1d693 100644
--- a/usr.sbin/ppp/tun.h
+++ b/usr.sbin/ppp/tun.h
@@ -1,3 +1,7 @@
+/*
+ * $Id$
+ */
+
struct tun_data {
#ifdef __OpenBSD__
struct tunnel_header head;
OpenPOWER on IntegriCloud