Deleted Added
full compact
command.c (31953) command.c (31962)
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: command.c,v 1.116 1997/12/21 03:16:09 brian Exp $
20 * $Id: command.c,v 1.117 1997/12/23 22:38:52 brian Exp $
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 732 unchanged lines hidden (view full) ---

761{
762 if (argc > 0) {
763 if (LogIsKept(LogCOMMAND)) {
764 static char buf[LINE_LEN];
765 int f, n;
766
767 *buf = '\0';
768 if (label) {
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 732 unchanged lines hidden (view full) ---

761{
762 if (argc > 0) {
763 if (LogIsKept(LogCOMMAND)) {
764 static char buf[LINE_LEN];
765 int f, n;
766
767 *buf = '\0';
768 if (label) {
769 strncpy(buf, label, sizeof(buf) - 3);
770 buf[sizeof(buf)-3] = '\0';
769 strncpy(buf, label, sizeof buf - 3);
770 buf[sizeof buf - 3] = '\0';
771 strcat(buf, ": ");
772 }
773 n = strlen(buf);
774 for (f = 0; f < argc; f++) {
771 strcat(buf, ": ");
772 }
773 n = strlen(buf);
774 for (f = 0; f < argc; f++) {
775 if (n < sizeof(buf)-1 && f)
775 if (n < sizeof buf - 1 && f)
776 buf[n++] = ' ';
777 if (arghidden(argc, argv, f))
776 buf[n++] = ' ';
777 if (arghidden(argc, argv, f))
778 strncpy(buf+n, HIDDEN, sizeof(buf)-n-1);
778 strncpy(buf+n, HIDDEN, sizeof buf - n - 1);
779 else
779 else
780 strncpy(buf+n, argv[f], sizeof(buf)-n-1);
780 strncpy(buf+n, argv[f], sizeof buf - n - 1);
781 n += strlen(buf+n);
782 }
783 LogPrintf(LogCOMMAND, "%s\n", buf);
784 }
785 FindExec(Commands, argc, argv, "");
786 }
787}
788

--- 205 unchanged lines hidden (view full) ---

994 if (!ismask(mask))
995 return -1;
996 } else
997 passwd = mask = NULL;
998
999 if (passwd == NULL)
1000 VarHaveLocalAuthKey = 0;
1001 else {
781 n += strlen(buf+n);
782 }
783 LogPrintf(LogCOMMAND, "%s\n", buf);
784 }
785 FindExec(Commands, argc, argv, "");
786 }
787}
788

--- 205 unchanged lines hidden (view full) ---

994 if (!ismask(mask))
995 return -1;
996 } else
997 passwd = mask = NULL;
998
999 if (passwd == NULL)
1000 VarHaveLocalAuthKey = 0;
1001 else {
1002 strncpy(VarLocalAuthKey, passwd, sizeof(VarLocalAuthKey) - 1);
1002 strncpy(VarLocalAuthKey, passwd, sizeof VarLocalAuthKey - 1);
1003 VarLocalAuthKey[sizeof VarLocalAuthKey - 1] = '\0';
1004 VarHaveLocalAuthKey = 1;
1005 }
1006 LocalAuthInit();
1007
1008 if (strcasecmp(port, "none") == 0) {
1009 int oserver;
1010

--- 313 unchanged lines hidden (view full) ---

1324
1325 if (arg->argc > 0)
1326 argp = *arg->argv;
1327 else
1328 argp = "";
1329
1330 switch (param) {
1331 case VAR_AUTHKEY:
1003 VarLocalAuthKey[sizeof VarLocalAuthKey - 1] = '\0';
1004 VarHaveLocalAuthKey = 1;
1005 }
1006 LocalAuthInit();
1007
1008 if (strcasecmp(port, "none") == 0) {
1009 int oserver;
1010

--- 313 unchanged lines hidden (view full) ---

1324
1325 if (arg->argc > 0)
1326 argp = *arg->argv;
1327 else
1328 argp = "";
1329
1330 switch (param) {
1331 case VAR_AUTHKEY:
1332 strncpy(VarAuthKey, argp, sizeof(VarAuthKey) - 1);
1333 VarAuthKey[sizeof(VarAuthKey) - 1] = '\0';
1332 strncpy(VarAuthKey, argp, sizeof VarAuthKey - 1);
1333 VarAuthKey[sizeof VarAuthKey - 1] = '\0';
1334 break;
1335 case VAR_AUTHNAME:
1334 break;
1335 case VAR_AUTHNAME:
1336 strncpy(VarAuthName, argp, sizeof(VarAuthName) - 1);
1337 VarAuthName[sizeof(VarAuthName) - 1] = '\0';
1336 strncpy(VarAuthName, argp, sizeof VarAuthName - 1);
1337 VarAuthName[sizeof VarAuthName - 1] = '\0';
1338 break;
1339 case VAR_DIAL:
1338 break;
1339 case VAR_DIAL:
1340 strncpy(VarDialScript, argp, sizeof(VarDialScript) - 1);
1341 VarDialScript[sizeof(VarDialScript) - 1] = '\0';
1340 strncpy(VarDialScript, argp, sizeof VarDialScript - 1);
1341 VarDialScript[sizeof VarDialScript - 1] = '\0';
1342 break;
1343 case VAR_LOGIN:
1342 break;
1343 case VAR_LOGIN:
1344 strncpy(VarLoginScript, argp, sizeof(VarLoginScript) - 1);
1345 VarLoginScript[sizeof(VarLoginScript) - 1] = '\0';
1344 strncpy(VarLoginScript, argp, sizeof VarLoginScript - 1);
1345 VarLoginScript[sizeof VarLoginScript - 1] = '\0';
1346 break;
1347 case VAR_DEVICE:
1348 if (modem != -1)
1349 LogPrintf(LogWARN, "Cannot change device to \"%s\" when \"%s\" is open\n",
1350 argp, VarDevice);
1351 else {
1346 break;
1347 case VAR_DEVICE:
1348 if (modem != -1)
1349 LogPrintf(LogWARN, "Cannot change device to \"%s\" when \"%s\" is open\n",
1350 argp, VarDevice);
1351 else {
1352 strncpy(VarDeviceList, argp, sizeof(VarDeviceList) - 1);
1353 VarDeviceList[sizeof(VarDeviceList) - 1] = '\0';
1352 strncpy(VarDeviceList, argp, sizeof VarDeviceList - 1);
1353 VarDeviceList[sizeof VarDeviceList - 1] = '\0';
1354 }
1355 break;
1356 case VAR_ACCMAP:
1357 sscanf(argp, "%lx", &map);
1358 VarAccmap = map;
1359 break;
1360 case VAR_PHONE:
1354 }
1355 break;
1356 case VAR_ACCMAP:
1357 sscanf(argp, "%lx", &map);
1358 VarAccmap = map;
1359 break;
1360 case VAR_PHONE:
1361 strncpy(VarPhoneList, argp, sizeof(VarPhoneList) - 1);
1362 VarPhoneList[sizeof(VarPhoneList) - 1] = '\0';
1363 strncpy(VarPhoneCopy, VarPhoneList, sizeof(VarPhoneCopy) - 1);
1364 VarPhoneCopy[sizeof(VarPhoneCopy) - 1] = '\0';
1361 strncpy(VarPhoneList, argp, sizeof VarPhoneList - 1);
1362 VarPhoneList[sizeof VarPhoneList - 1] = '\0';
1363 strncpy(VarPhoneCopy, VarPhoneList, sizeof VarPhoneCopy - 1);
1364 VarPhoneCopy[sizeof VarPhoneCopy - 1] = '\0';
1365 VarNextPhone = VarPhoneCopy;
1366 VarAltPhone = NULL;
1367 break;
1368 case VAR_HANGUP:
1365 VarNextPhone = VarPhoneCopy;
1366 VarAltPhone = NULL;
1367 break;
1368 case VAR_HANGUP:
1369 strncpy(VarHangupScript, argp, sizeof(VarHangupScript) - 1);
1370 VarHangupScript[sizeof(VarHangupScript) - 1] = '\0';
1369 strncpy(VarHangupScript, argp, sizeof VarHangupScript - 1);
1370 VarHangupScript[sizeof VarHangupScript - 1] = '\0';
1371 break;
1372#ifdef HAVE_DES
1373 case VAR_ENC:
1374 VarMSChap = !strcasecmp(argp, "mschap");
1375 break;
1376#endif
1377 }
1378 return 0;

--- 291 unchanged lines hidden ---
1371 break;
1372#ifdef HAVE_DES
1373 case VAR_ENC:
1374 VarMSChap = !strcasecmp(argp, "mschap");
1375 break;
1376#endif
1377 }
1378 return 0;

--- 291 unchanged lines hidden ---