Add id strings to tun.[ch].

Don't try to open ppp.secret if we're never going to use it.
This commit is contained in:
Brian Somers 1997-11-17 00:42:41 +00:00
parent 6a6b4bbb08
commit c7d4711f9e
6 changed files with 43 additions and 18 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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");

View File

@ -1,3 +1,7 @@
/*
* $Id$
*/
#include <sys/param.h>
#include <sys/time.h>
#include <sys/select.h>

View File

@ -1,3 +1,7 @@
/*
* $Id$
*/
struct tun_data {
#ifdef __OpenBSD__
struct tunnel_header head;