This removes the need to include the following heades in pppd.h
<limits.h>, this is included where needed (main.c). The number of groups already retrieved is stored in the "int ngroups" variable.
<sys/params.h>, use MAXPATHLEN where needed
<net/if.h>, such that the value of IFNAMSIZ doesn't have to be declared to include <pppd/pppd.h>
Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
#include <arpa/inet.h>
#include <limits.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <limits.h>
#include <inttypes.h>
#include "pppd.h"
#include "magic.h"
#include "pppd.h"
#include "magic.h"
struct protent *protp;
char numbuf[16];
struct protent *protp;
char numbuf[16];
- strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup));
- strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown));
+ strlcpy(path_ipup, _PATH_IPUP, MAXPATHLEN);
+ strlcpy(path_ipdown, _PATH_IPDOWN, MAXPATHLEN);
#ifdef PPP_WITH_IPV6CP
strlcpy(path_ipv6up, _PATH_IPV6UP, MAXPATHLEN);
#ifdef PPP_WITH_IPV6CP
strlcpy(path_ipv6up, _PATH_IPV6UP, MAXPATHLEN);
#include <syslog.h>
#include <string.h>
#include <pwd.h>
#include <syslog.h>
#include <string.h>
#include <pwd.h>
+#include <sys/param.h>
+#include <net/if.h>
#ifdef PPP_WITH_PLUGINS
#include <dlfcn.h>
#endif
#ifdef PPP_WITH_PLUGINS
#include <dlfcn.h>
#endif
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
#include <syslog.h>
#include <pppd/pppd.h>
#include <syslog.h>
#include <pppd/pppd.h>
#include <sys/stat.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <pppd/pppd.h>
#include <pppd/pathnames.h>
#include <pppd/pppd.h>
#include <pppd/pathnames.h>
return 1;
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
return 1;
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
- strlcpy(devnam, cp, sizeof devnam);
+ strlcpy(devnam, cp, MAXPATHLEN);
devstat.st_mode = S_IFSOCK;
if (the_channel != &pppoa_channel) {
the_channel = &pppoa_channel;
devstat.st_mode = S_IFSOCK;
if (the_channel != &pppoa_channel) {
the_channel = &pppoa_channel;
pppoatm_max_mtu = lcp_allowoptions[0].mru;
pppoatm_max_mru = lcp_wantoptions[0].mru;
set_line_discipline_pppoatm(fd);
pppoatm_max_mtu = lcp_allowoptions[0].mru;
pppoatm_max_mru = lcp_wantoptions[0].mru;
set_line_discipline_pppoatm(fd);
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
pppoa_fd = fd;
return fd;
}
pppoa_fd = fd;
return fd;
}
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
conn->acName = acName;
conn->serviceName = pppd_pppoe_service;
conn->acName = acName;
conn->serviceName = pppd_pppoe_service;
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
if (existingSession) {
unsigned int mac[ETH_ALEN];
int i, ses;
if (existingSession) {
unsigned int mac[ETH_ALEN];
int i, ses;
/* Close socket */
close(fd);
if (r && doit) {
/* Close socket */
close(fd);
if (r && doit) {
- strlcpy(devnam, cmd, sizeof(devnam));
+ strlcpy(devnam, cmd, MAXPATHLEN);
if (the_channel != &pppoe_channel) {
the_channel = &pppoe_channel;
if (the_channel != &pppoe_channel) {
the_channel = &pppoe_channel;
#include <string.h>
#include <time.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pppd/pppd.h>
#include "radiusclient.h"
#include <pppd/pppd.h>
#include "radiusclient.h"
#include <stdarg.h>
#include <stdint.h>
#include <sys/types.h> /* for u_int32_t, if defined */
#include <stdarg.h>
#include <stdint.h>
#include <sys/types.h> /* for u_int32_t, if defined */
-#include <sys/time.h> /* for struct timeval */
#include <net/ppp_defs.h>
#include <net/ppp_defs.h>
#ifdef PPP_WITH_IPV6CP
#include "eui64.h"
#ifdef PPP_WITH_IPV6CP
#include "eui64.h"
extern int got_sigterm; /* SIGINT or SIGTERM was received */
extern int hungup; /* Physical layer has disconnected */
extern int ifunit; /* Interface unit number */
extern int got_sigterm; /* SIGINT or SIGTERM was received */
extern int hungup; /* Physical layer has disconnected */
extern int ifunit; /* Interface unit number */
-extern char ifname[]; /* Interface name */
+extern char ifname[]; /* Interface name (IFNAMSIZ) */
extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int devfd; /* fd of underlying device */
extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int devfd; /* fd of underlying device */
extern int need_holdoff; /* Need holdoff period after link terminates */
extern char **script_env; /* Environment variables for scripts */
extern int detached; /* Have detached from controlling tty */
extern int need_holdoff; /* Need holdoff period after link terminates */
extern char **script_env; /* Environment variables for scripts */
extern int detached; /* Have detached from controlling tty */
-extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
+extern GIDSET_TYPE groups[]; /* groups the user is in */
extern int ngroups; /* How many groups valid in groups */
extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
extern int link_stats_valid; /* set if link_stats is valid */
extern int ngroups; /* How many groups valid in groups */
extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
extern int link_stats_valid; /* set if link_stats is valid */
extern int do_callback; /* set if we want to do callback next */
extern int doing_callback; /* set if this is a callback */
extern int error_count; /* # of times error() has been called */
extern int do_callback; /* set if we want to do callback next */
extern int doing_callback; /* set if this is a callback */
extern int error_count; /* # of times error() has been called */
-extern char ppp_devnam[MAXPATHLEN];
+extern char ppp_devnam[]; /* name of PPP tty (maybe ttypx) */
extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
extern int ppp_session_number; /* Session number (eg PPPoE session) */
extern int fd_devnull; /* fd open to /dev/null */
extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
extern int ppp_session_number; /* Session number (eg PPPoE session) */
extern int fd_devnull; /* fd open to /dev/null */
extern int debug; /* Debug flag */
extern int kdebugflag; /* Tell kernel to print debug messages */
extern int default_device; /* Using /dev/tty or equivalent */
extern int debug; /* Debug flag */
extern int kdebugflag; /* Tell kernel to print debug messages */
extern int default_device; /* Using /dev/tty or equivalent */
-extern char devnam[MAXPATHLEN]; /* Device name */
+extern char devnam[]; /* Device name */
extern int crtscts; /* Use hardware flow control */
extern int stop_bits; /* Number of serial port stop bits */
extern bool modem; /* Use modem control lines */
extern int crtscts; /* Use hardware flow control */
extern int stop_bits; /* Number of serial port stop bits */
extern bool modem; /* Use modem control lines */
extern char *record_file; /* File to record chars sent/received */
extern bool sync_serial; /* Device is synchronous serial device */
extern int maxfail; /* Max # of unsuccessful connection attempts */
extern char *record_file; /* File to record chars sent/received */
extern bool sync_serial; /* Device is synchronous serial device */
extern int maxfail; /* Max # of unsuccessful connection attempts */
-extern char linkname[MAXPATHLEN]; /* logical name for link */
+extern char linkname[]; /* logical name for link */
extern bool tune_kernel; /* May alter kernel settings as necessary */
extern int connect_delay; /* Time to delay after connect script */
extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */
extern bool tune_kernel; /* May alter kernel settings as necessary */
extern int connect_delay; /* Time to delay after connect script */
extern int max_data_rate; /* max bytes/sec through charshunt */
extern int req_unit; /* interface unit number to use */
-extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
-extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */
-extern char req_ifname[IFNAMSIZ]; /* interface name to use */
+extern char path_ipup[]; /* pathname of ip-up script */
+extern char path_ipdown[]; /* pathname of ip-down script */
+extern char req_ifname[]; /* interface name to use (IFNAMSIZ) */
extern bool multilink; /* enable multilink operation */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
extern char *bundle_name; /* bundle name for multilink */
extern bool multilink; /* enable multilink operation */
extern bool noendpoint; /* don't send or accept endpt. discrim. */
extern char *bundle_name; /* bundle name for multilink */
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/sysmacros.h>
#include <errno.h>
#include <stddef.h>
#include <errno.h>
#include <stddef.h>
- strlcpy(devnam, cp, sizeof(devnam));
+ strlcpy(devnam, cp, MAXPATHLEN);
devstat = statbuf;
default_device = 0;
}
devstat = statbuf;
default_device = 0;
}
option_error("no device specified and stdin is not a tty");
exit(EXIT_OPTION_ERROR);
}
option_error("no device specified and stdin is not a tty");
exit(EXIT_OPTION_ERROR);
}
- strlcpy(devnam, p, sizeof(devnam));
+ strlcpy(devnam, p, MAXPATHLEN);
if (stat(devnam, &devstat) < 0)
fatal("Couldn't stat default device %s: %m", devnam);
}
if (stat(devnam, &devstat) < 0)
fatal("Couldn't stat default device %s: %m", devnam);
}
* Get a pty master/slave pair if the pty, notty, socket,
* or record options were specified.
*/
* Get a pty master/slave pair if the pty, notty, socket,
* or record options were specified.
*/
- strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam));
+ strlcpy(ppp_devnam, devnam, MAXPATHLEN);
pty_master = -1;
pty_slave = -1;
real_ttyfd = -1;
pty_master = -1;
pty_slave = -1;
real_ttyfd = -1;