changed order of args to strlcpy/strlcat.
move remote_name/explicit_remote to auth.c.
remote unused code.
-static char rcsid[] = "$Id: options.c,v 1.51 1999/03/12 06:07:19 paulus Exp $";
+static char rcsid[] = "$Id: options.c,v 1.52 1999/03/19 01:27:43 paulus Exp $";
#endif
#include <ctype.h>
#endif
#include <ctype.h>
#include <net/ppp-comp.h>
#include <net/ppp-comp.h>
-#define FALSE 0
-#define TRUE 1
-
#if defined(ultrix) || defined(NeXT)
char *strdup __P((char *));
#endif
#if defined(ultrix) || defined(NeXT)
char *strdup __P((char *));
#endif
char passwd[MAXSECRETLEN]; /* Password for PAP */
bool persist = 0; /* Reopen link after it goes down */
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
char passwd[MAXSECRETLEN]; /* Password for PAP */
bool persist = 0; /* Reopen link after it goes down */
char our_name[MAXNAMELEN]; /* Our name for authentication purposes */
-char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
-int explicit_remote = 0; /* User specified explicit remote name */
bool demand = 0; /* do dial-on-demand */
char *ipparam = NULL; /* Extra parameter for ip up/down scripts */
int idle_time_limit = 0; /* Disconnect if idle for this many seconds */
bool demand = 0; /* do dial-on-demand */
char *ipparam = NULL; /* Extra parameter for ip up/down scripts */
int idle_time_limit = 0; /* Disconnect if idle for this many seconds */
static int callfile __P((char **));
static int showversion __P((char **));
static int showhelp __P((char **));
static int callfile __P((char **));
static int showversion __P((char **));
static int showhelp __P((char **));
+static void usage __P((void));
#ifdef PPP_FILTER
static int setpassfilter __P((char **));
#ifdef PPP_FILTER
static int setpassfilter __P((char **));
static option_t *find_option __P((char *name));
static int process_option __P((option_t *, char **));
static int n_arguments __P((option_t *));
static option_t *find_option __P((char *name));
static int process_option __P((option_t *, char **));
static int n_arguments __P((option_t *));
+static int number_option __P((char *, u_int32_t *, int));
option_error("Can't open options file %s: %m", filename);
return 0;
}
option_error("Can't open options file %s: %m", filename);
return 0;
}
-#if 0 /* check done by setting effective UID above */
- if (check_prot && !readable(fileno(f))) {
- option_error("Can't open options file %s: access denied", filename);
- fclose(f);
- return 0;
- }
-#endif
oldpriv = privileged_option;
privileged_option = priv;
oldpriv = privileged_option;
privileged_option = priv;
case o_string:
if (opt->flags & OPT_STATIC) {
case o_string:
if (opt->flags & OPT_STATIC) {
- strlcpy((char *)(opt->addr), opt->upper_limit, *argv);
+ strlcpy((char *)(opt->addr), *argv, opt->upper_limit);
} else {
sv = strdup(*argv);
if (sv == NULL)
} else {
sv = strdup(*argv);
if (sv == NULL)
/*
* usage - print out a message telling how to use the program.
*/
/*
* usage - print out a message telling how to use the program.
*/
usage()
{
if (phase == PHASE_INITIALIZE)
usage()
{
if (phase == PHASE_INITIALIZE)
syslog(LOG_ERR, "%s", buf);
}
syslog(LOG_ERR, "%s", buf);
}
/*
* readable - check if a file is readable by the real user.
*/
/*
* readable - check if a file is readable by the real user.
*/
return sbuf.st_mode & S_IRGRP;
return sbuf.st_mode & S_IROTH;
}
return sbuf.st_mode & S_IRGRP;
return sbuf.st_mode & S_IROTH;
}
/*
* Read a word from a file.
/*
* Read a word from a file.
/*
* number_option - parse an unsigned numeric parameter for an option.
*/
/*
* number_option - parse an unsigned numeric parameter for an option.
*/
number_option(str, valp, base)
char *str;
u_int32_t *valp;
number_option(str, valp, base)
char *str;
u_int32_t *valp;
return 0;
if (strncmp("/dev/", cp, 5) != 0) {
return 0;
if (strncmp("/dev/", cp, 5) != 0) {
- strlcpy(dev, sizeof(dev), "/dev/");
- strlcat(dev, sizeof(dev), cp);
+ strlcpy(dev, "/dev/", sizeof(dev));
+ strlcat(dev, cp, sizeof(dev));
- strlcpy(devnam, sizeof(devnam), cp);
- default_device = FALSE;
+ strlcpy(devnam, cp, sizeof(devnam));
+ default_device = 0;
devnam_info.priv = privileged_option;
devnam_info.source = option_source;
devnam_info.priv = privileged_option;
devnam_info.source = option_source;
} else {
remote = *(u_int32_t *)hp->h_addr;
if (remote_name[0] == 0)
} else {
remote = *(u_int32_t *)hp->h_addr;
if (remote_name[0] == 0)
- strlcpy(remote_name, sizeof(remote_name), colon);
+ strlcpy(remote_name, colon, sizeof(remote_name));
}
}
if (bad_ip_adrs(remote)) {
}
}
if (bad_ip_adrs(remote)) {