command.c (69303) | command.c (71657) |
---|---|
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 * $FreeBSD: head/usr.sbin/ppp/command.c 69303 2000-11-28 13:18:35Z brian $ | 20 * $FreeBSD: head/usr.sbin/ppp/command.c 71657 2001-01-26 01:41:34Z brian $ |
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> --- 1253 unchanged lines hidden (view full) --- 1282 mlen = strlen(mask); 1283 if (mlen == 0 || mlen > 4 || strspn(mask, "01234567") != mlen || 1284 (mlen == 4 && *mask != '0')) { 1285 log_Printf(LogWARN, "%s %s: %s: Invalid mask\n", 1286 arg->argv[arg->argn - 2], arg->argv[arg->argn - 1], mask); 1287 return -1; 1288 } 1289 } else if (strcasecmp(port, "none") == 0) { | 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> --- 1253 unchanged lines hidden (view full) --- 1282 mlen = strlen(mask); 1283 if (mlen == 0 || mlen > 4 || strspn(mask, "01234567") != mlen || 1284 (mlen == 4 && *mask != '0')) { 1285 log_Printf(LogWARN, "%s %s: %s: Invalid mask\n", 1286 arg->argv[arg->argn - 2], arg->argv[arg->argn - 1], mask); 1287 return -1; 1288 } 1289 } else if (strcasecmp(port, "none") == 0) { |
1290 if (server_Clear(arg->bundle)) 1291 log_Printf(LogPHASE, "Disabled server socket\n"); 1292 return 0; 1293 } else if (strcasecmp(port, "open") == 0) { 1294 switch (server_Reopen(arg->bundle)) { 1295 case SERVER_OK: 1296 return 0; 1297 case SERVER_FAILED: 1298 log_Printf(LogPHASE, "Failed to reopen server port\n"); 1299 return 1; 1300 case SERVER_UNSET: 1301 log_Printf(LogPHASE, "Cannot reopen unset server socket\n"); 1302 return 1; 1303 default: 1304 break; 1305 } 1306 return -1; 1307 } else if (strcasecmp(port, "closed") == 0) { |
|
1290 if (server_Close(arg->bundle)) | 1308 if (server_Close(arg->bundle)) |
1291 log_Printf(LogPHASE, "Disabled server port.\n"); | 1309 log_Printf(LogPHASE, "Closed server socket\n"); 1310 else 1311 log_Printf(LogWARN, "Server socket not open\n"); 1312 |
1292 return 0; 1293 } else 1294 return -1; 1295 | 1313 return 0; 1314 } else 1315 return -1; 1316 |
1296 strncpy(server.passwd, passwd, sizeof server.passwd - 1); 1297 server.passwd[sizeof server.passwd - 1] = '\0'; | 1317 strncpy(server.cfg.passwd, passwd, sizeof server.cfg.passwd - 1); 1318 server.cfg.passwd[sizeof server.cfg.passwd - 1] = '\0'; |
1298 1299 if (*port == '/') { 1300 mode_t imask; 1301 char *ptr, name[LINE_LEN + 12]; 1302 1303 if (mask == NULL) 1304 imask = (mode_t)-1; 1305 else for (imask = mlen = 0; mask[mlen]; mlen++) --- 749 unchanged lines hidden (view full) --- 2055 {"reconnect", NULL, datalink_SetReconnect, LOCAL_AUTH | LOCAL_CX, 2056 "Reconnect timeout", "set reconnect value ntries"}, 2057 {"recvpipe", NULL, SetVariable, LOCAL_AUTH, 2058 "RECVPIPE value", "set recvpipe value", (const void *)VAR_RECVPIPE}, 2059 {"redial", NULL, datalink_SetRedial, LOCAL_AUTH | LOCAL_CX, 2060 "Redial timeout", "set redial secs[+inc[-incmax]][.next] [attempts]"}, 2061 {"sendpipe", NULL, SetVariable, LOCAL_AUTH, 2062 "SENDPIPE value", "set sendpipe value", (const void *)VAR_SENDPIPE}, | 1319 1320 if (*port == '/') { 1321 mode_t imask; 1322 char *ptr, name[LINE_LEN + 12]; 1323 1324 if (mask == NULL) 1325 imask = (mode_t)-1; 1326 else for (imask = mlen = 0; mask[mlen]; mlen++) --- 749 unchanged lines hidden (view full) --- 2076 {"reconnect", NULL, datalink_SetReconnect, LOCAL_AUTH | LOCAL_CX, 2077 "Reconnect timeout", "set reconnect value ntries"}, 2078 {"recvpipe", NULL, SetVariable, LOCAL_AUTH, 2079 "RECVPIPE value", "set recvpipe value", (const void *)VAR_RECVPIPE}, 2080 {"redial", NULL, datalink_SetRedial, LOCAL_AUTH | LOCAL_CX, 2081 "Redial timeout", "set redial secs[+inc[-incmax]][.next] [attempts]"}, 2082 {"sendpipe", NULL, SetVariable, LOCAL_AUTH, 2083 "SENDPIPE value", "set sendpipe value", (const void *)VAR_SENDPIPE}, |
2063 {"server", "socket", SetServer, LOCAL_AUTH, 2064 "server port", "set server|socket TcpPort|LocalName|none password [mask]"}, | 2084 {"server", "socket", SetServer, LOCAL_AUTH, "diagnostic port", 2085 "set server|socket TcpPort|LocalName|none|open|closed [password [mask]]"}, |
2065 {"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX, 2066 "physical speed", "set speed value|sync"}, 2067 {"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX, 2068 "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"}, 2069 {"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout", 2070 "set timeout idletime", (const void *)VAR_IDLETIMEOUT}, 2071 {"urgent", NULL, SetVariable, LOCAL_AUTH, "urgent ports", 2072 "set urgent [tcp|udp] [+|-]port...", (const void *)VAR_URGENTPORTS}, --- 752 unchanged lines hidden --- | 2086 {"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX, 2087 "physical speed", "set speed value|sync"}, 2088 {"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX, 2089 "STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"}, 2090 {"timeout", NULL, SetVariable, LOCAL_AUTH, "Idle timeout", 2091 "set timeout idletime", (const void *)VAR_IDLETIMEOUT}, 2092 {"urgent", NULL, SetVariable, LOCAL_AUTH, "urgent ports", 2093 "set urgent [tcp|udp] [+|-]port...", (const void *)VAR_URGENTPORTS}, --- 752 unchanged lines hidden --- |