Replaced tabs with spaces

This commit is contained in:
goldsimon 2010-01-29 23:04:06 +00:00
parent c70c3eac62
commit 9c41e1eea3
2 changed files with 70 additions and 71 deletions

View File

@ -88,10 +88,10 @@
#if 0 /* UNUSED */ #if 0 /* UNUSED */
/* Bits in scan_authfile return value */ /* Bits in scan_authfile return value */
#define NONWILD_SERVER 1 #define NONWILD_SERVER 1
#define NONWILD_CLIENT 2 #define NONWILD_CLIENT 2
#define ISWILD(word) (word[0] == '*' && word[1] == 0) #define ISWILD(word) (word[0] == '*' && word[1] == 0)
#endif /* UNUSED */ #endif /* UNUSED */
#if PAP_SUPPORT || CHAP_SUPPORT #if PAP_SUPPORT || CHAP_SUPPORT
@ -143,8 +143,8 @@ int (*pap_check_hook) __P((void)) = NULL;
/* Hook for a plugin to check the PAP user and password */ /* Hook for a plugin to check the PAP user and password */
int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
struct wordlist **paddrs, struct wordlist **paddrs,
struct wordlist **popts)) = NULL; struct wordlist **popts)) = NULL;
/* Hook for a plugin to know about the PAP user logout */ /* Hook for a plugin to know about the PAP user logout */
void (*pap_logout_hook) __P((void)) = NULL; void (*pap_logout_hook) __P((void)) = NULL;
@ -169,15 +169,15 @@ static pid_t auth_script_pid = 0;
* Option variables. * Option variables.
* lwip: some of these are present in the ppp_settings structure * lwip: some of these are present in the ppp_settings structure
*/ */
bool uselogin = 0; /* Use /etc/passwd for checking PAP */ bool uselogin = 0; /* Use /etc/passwd for checking PAP */
bool cryptpap = 0; /* Passwords in pap-secrets are encrypted */ bool cryptpap = 0; /* Passwords in pap-secrets are encrypted */
bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */ bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */
bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */ bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */
bool usehostname = 0; /* Use hostname for our_name */ bool usehostname = 0; /* Use hostname for our_name */
bool auth_required = 0; /* Always require authentication from peer */ bool auth_required = 0; /* Always require authentication from peer */
bool allow_any_ip = 0; /* Allow peer to use any IP address */ bool allow_any_ip = 0; /* Allow peer to use any IP address */
bool explicit_remote = 0; /* User specified explicit remote name */ bool explicit_remote = 0; /* User specified explicit remote name */
char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
#endif /* UNUSED */ #endif /* UNUSED */
@ -214,8 +214,8 @@ static int ip_addr_check (u32_t, struct wordlist *);
#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */ #if 0 /* PAP_SUPPORT || CHAP_SUPPORT */
static int scan_authfile (FILE *, char *, char *, char *, static int scan_authfile (FILE *, char *, char *, char *,
struct wordlist **, struct wordlist **, struct wordlist **, struct wordlist **,
char *); char *);
static void free_wordlist (struct wordlist *); static void free_wordlist (struct wordlist *);
static void auth_script (char *); static void auth_script (char *);
static void auth_script_done (void *); static void auth_script_done (void *);
@ -296,26 +296,26 @@ setupapfile(char **argv)
ufile = fopen(*argv, "r"); ufile = fopen(*argv, "r");
seteuid(0); seteuid(0);
if (ufile == NULL) { if (ufile == NULL) {
option_error("unable to open user login data file %s", *argv); option_error("unable to open user login data file %s", *argv);
return 0; return 0;
} }
check_access(ufile, *argv); check_access(ufile, *argv);
/* get username */ /* get username */
if (fgets(user, MAXNAMELEN - 1, ufile) == NULL if (fgets(user, MAXNAMELEN - 1, ufile) == NULL
|| fgets(passwd, MAXSECRETLEN - 1, ufile) == NULL){ || fgets(passwd, MAXSECRETLEN - 1, ufile) == NULL){
option_error("unable to read user login data file %s", *argv); option_error("unable to read user login data file %s", *argv);
return 0; return 0;
} }
fclose(ufile); fclose(ufile);
/* get rid of newlines */ /* get rid of newlines */
l = strlen(user); l = strlen(user);
if (l > 0 && user[l-1] == '\n') if (l > 0 && user[l-1] == '\n')
user[l-1] = 0; user[l-1] = 0;
l = strlen(passwd); l = strlen(passwd);
if (l > 0 && passwd[l-1] == '\n') if (l > 0 && passwd[l-1] == '\n')
passwd[l-1] = 0; passwd[l-1] = 0;
return (1); return (1);
} }
@ -333,14 +333,14 @@ privgroup(char **argv)
g = getgrnam(*argv); g = getgrnam(*argv);
if (g == 0) { if (g == 0) {
option_error("group %s is unknown", *argv); option_error("group %s is unknown", *argv);
return 0; return 0;
} }
for (i = 0; i < ngroups; ++i) { for (i = 0; i < ngroups; ++i) {
if (groups[i] == g->gr_gid) { if (groups[i] == g->gr_gid) {
privileged = 1; privileged = 1;
break; break;
} }
} }
return 1; return 1;
} }
@ -360,7 +360,7 @@ set_noauth_addr(char **argv)
wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l + 1); wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l + 1);
if (wp == NULL) if (wp == NULL)
novm("allow-ip argument"); novm("allow-ip argument");
wp->word = (char *) (wp + 1); wp->word = (char *) (wp + 1);
wp->next = noauth_addrs; wp->next = noauth_addrs;
BCOPY(addr, wp->word, l); BCOPY(addr, wp->word, l);
@ -426,8 +426,8 @@ link_down(int unit)
(*protp->close)(unit, "LCP down"); (*protp->close)(unit, "LCP down");
} }
} }
num_np_open = 0; /* number of network protocols we have opened */ num_np_open = 0; /* number of network protocols we have opened */
num_np_up = 0; /* Number of network protocols which have come up */ num_np_up = 0; /* Number of network protocols which have come up */
if (lcp_phase[unit] != PHASE_DEAD) { if (lcp_phase[unit] != PHASE_DEAD) {
lcp_phase[unit] = PHASE_TERMINATE; lcp_phase[unit] = PHASE_TERMINATE;
@ -1223,10 +1223,10 @@ static int
some_ip_ok(struct wordlist *addrs) some_ip_ok(struct wordlist *addrs)
{ {
for (; addrs != 0; addrs = addrs->next) { for (; addrs != 0; addrs = addrs->next) {
if (addrs->word[0] == '-') if (addrs->word[0] == '-')
break; break;
if (addrs->word[0] != '!') if (addrs->word[0] != '!')
return 1; /* some IP address is allowed */ return 1; /* some IP address is allowed */
} }
return 0; return 0;
} }
@ -1240,10 +1240,10 @@ check_access(FILE *f, char *filename)
struct stat sbuf; struct stat sbuf;
if (fstat(fileno(f), &sbuf) < 0) { if (fstat(fileno(f), &sbuf) < 0) {
warn("cannot stat secret file %s: %m", filename); warn("cannot stat secret file %s: %m", filename);
} else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) { } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
warn("Warning - secret file %s has world and/or group access", warn("Warning - secret file %s has world and/or group access",
filename); filename);
} }
} }
@ -1264,7 +1264,7 @@ static int
scan_authfile(FILE *f, char *client, char *server, char *secret, struct wordlist **addrs, struct wordlist **opts, char *filename) scan_authfile(FILE *f, char *client, char *server, char *secret, struct wordlist **addrs, struct wordlist **opts, char *filename)
{ {
/* We do not (currently) need this in lwip */ /* We do not (currently) need this in lwip */
return 0; /* dummy */ return 0; /* dummy */
} }
/* /*
* free_wordlist - release memory allocated for a wordlist. * free_wordlist - release memory allocated for a wordlist.
@ -1291,17 +1291,17 @@ auth_script_done(void *arg)
auth_script_pid = 0; auth_script_pid = 0;
switch (auth_script_state) { switch (auth_script_state) {
case s_up: case s_up:
if (auth_state == s_down) { if (auth_state == s_down) {
auth_script_state = s_down; auth_script_state = s_down;
auth_script(_PATH_AUTHDOWN); auth_script(_PATH_AUTHDOWN);
} }
break; break;
case s_down: case s_down:
if (auth_state == s_up) { if (auth_state == s_up) {
auth_script_state = s_up; auth_script_state = s_up;
auth_script(_PATH_AUTHUP); auth_script(_PATH_AUTHUP);
} }
break; break;
} }
} }
@ -1319,10 +1319,10 @@ auth_script(char *script)
char *argv[8]; char *argv[8];
if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL) if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL)
user_name = pw->pw_name; user_name = pw->pw_name;
else { else {
slprintf(struid, sizeof(struid), "%d", getuid()); slprintf(struid, sizeof(struid), "%d", getuid());
user_name = struid; user_name = struid;
} }
slprintf(strspeed, sizeof(strspeed), "%d", baud_rate); slprintf(strspeed, sizeof(strspeed), "%d", baud_rate);

View File

@ -76,9 +76,9 @@
/* /*
* LCP-related command-line options. * LCP-related command-line options.
*/ */
int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
bool lax_recv = 0; /* accept control chars in asyncmap */ bool lax_recv = 0; /* accept control chars in asyncmap */
static int setescape (char **); static int setescape (char **);
@ -215,20 +215,19 @@ setescape(argv)
p = *argv; p = *argv;
ret = 1; ret = 1;
while (*p) { while (*p) {
n = strtol(p, &endp, 16); n = strtol(p, &endp, 16);
if (p == endp) { if (p == endp) {
option_error("escape parameter contains invalid hex number '%s'", option_error("escape parameter contains invalid hex number '%s'", p);
p); return 0;
return 0; }
} p = endp;
p = endp; if (n < 0 || n == 0x5E || n > 0xFF) {
if (n < 0 || n == 0x5E || n > 0xFF) { option_error("can't escape character 0x%x", n);
option_error("can't escape character 0x%x", n); ret = 0;
ret = 0; } else
} else xmit_accm[0][n >> 5] |= 1 << (n & 0x1F);
xmit_accm[0][n >> 5] |= 1 << (n & 0x1F); while (*p == ',' || *p == ' ')
while (*p == ',' || *p == ' ') ++p;
++p;
} }
return ret; return ret;
} }
@ -1708,7 +1707,7 @@ lcp_down(fsm *f)
static void static void
lcp_starting(fsm *f) lcp_starting(fsm *f)
{ {
link_required(f->unit); /* lwip: currently does nothing */ link_required(f->unit); /* lwip: currently does nothing */
} }