summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-05-10 01:22:19 +0000
committerbrian <brian@FreeBSD.org>1997-05-10 01:22:19 +0000
commit82bac13560d095243e9988bfb770da73089749c1 (patch)
tree262cfd051516c08f29f6f133a950e9de9f2d42fd /usr.sbin/ppp/command.c
parent1da867bda76bc701006945dfbc4733f550c91c2d (diff)
downloadFreeBSD-src-82bac13560d095243e9988bfb770da73089749c1.zip
FreeBSD-src-82bac13560d095243e9988bfb770da73089749c1.tar.gz
Tidy up the code - bounds checking, return
value checking etc. Submitted by: eivind
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 36d398c..64d5f80 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.41 1997/05/08 01:26:31 brian Exp $
+ * $Id: command.c,v 1.42 1997/05/09 23:34:56 brian Exp $
*
*/
#include <sys/types.h>
@@ -34,7 +34,8 @@
#include "command.h"
#include "hdlc.h"
#include "vars.h"
-#include "auth.h"
+#include "systems.h"
+#include "chat.h"
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -223,10 +224,10 @@ char **argv;
argv[i] = strdup(inet_ntoa(IpcpInfo.want_ipaddr));
}
}
- execvp(argv[0], argv);
+ (void)execvp(argv[0], argv);
}
else
- execl(shell, shell, NULL);
+ (void)execl(shell, shell, NULL);
fprintf(stdout, "exec() of %s failed\n", argc > 0? argv[0]: shell);
exit(255);
@@ -563,7 +564,7 @@ int prompt;
}
}
if (val && prompt)
- Prompt(0);
+ Prompt();
}
static int
@@ -884,19 +885,30 @@ char **argv;
{
DefMyAddress.ipaddr.s_addr = DefHisAddress.ipaddr.s_addr = 0L;
+ if (argc > 4) {
+ printf("set ifaddr: too many arguments (%d > 4)\n", argc);
+ return(0);
+ }
if (argc > 0) {
- ParseAddr(argc, argv++,
- &DefMyAddress.ipaddr, &DefMyAddress.mask, &DefMyAddress.width);
+ if (ParseAddr(argc, argv++,
+ &DefMyAddress.ipaddr,
+ &DefMyAddress.mask,
+ &DefMyAddress.width) == 0)
+ return(0);
if (--argc > 0) {
- ParseAddr(argc, argv++,
- &DefHisAddress.ipaddr, &DefHisAddress.mask, &DefHisAddress.width);
+ if (ParseAddr(argc, argv++,
+ &DefHisAddress.ipaddr,
+ &DefHisAddress.mask,
+ &DefHisAddress.width) == 0)
+ return(0);
if (--argc > 0) {
ifnetmask = GetIpAddr(*argv);
if (--argc > 0) {
- ParseAddr(argc, argv++,
- &DefTriggerAddress.ipaddr,
- &DefTriggerAddress.mask,
- &DefTriggerAddress.width);
+ if (ParseAddr(argc, argv++,
+ &DefTriggerAddress.ipaddr,
+ &DefTriggerAddress.mask,
+ &DefTriggerAddress.width) == 0)
+ return(0);
}
}
}
@@ -915,7 +927,8 @@ char **argv;
if ((mode & MODE_AUTO) ||
((mode & MODE_DEDICATED) && dstsystem)) {
- OsSetIpaddress(DefMyAddress.ipaddr, DefHisAddress.ipaddr, ifnetmask);
+ if (OsSetIpaddress(DefMyAddress.ipaddr, DefHisAddress.ipaddr, ifnetmask) < 0)
+ return(0);
}
return(1);
}
OpenPOWER on IntegriCloud