projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add install to .PHONY
[l2tpns.git]
/
cli.c
diff --git
a/cli.c
b/cli.c
index
4c3db99
..
b61571c
100644
(file)
--- a/
cli.c
+++ b/
cli.c
@@
-2,7
+2,7
@@
// vim: sw=8 ts=8
char const *cvs_name = "$Name: $";
// vim: sw=8 ts=8
char const *cvs_name = "$Name: $";
-char const *cvs_id_cli = "$Id: cli.c,v 1.2
1 2004-11-02 06:45:3
6 bodea Exp $";
+char const *cvs_id_cli = "$Id: cli.c,v 1.2
4 2004-11-05 04:55:2
6 bodea Exp $";
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdarg.h>
@@
-186,7
+186,7
@@
void init_cli(char *hostname)
if (!(f = fopen(CLIUSERS, "r")))
{
if (!(f = fopen(CLIUSERS, "r")))
{
-
log
(0, 0, 0, 0, "WARNING! No users specified. Command-line access is open to all\n");
+
LOG
(0, 0, 0, 0, "WARNING! No users specified. Command-line access is open to all\n");
}
else
{
}
else
{
@@
-202,12
+202,12
@@
void init_cli(char *hostname)
if (!strcmp(buf, "enable"))
{
cli_allow_enable(cli, p);
if (!strcmp(buf, "enable"))
{
cli_allow_enable(cli, p);
-
log
(3, 0, 0, 0, "Setting enable password\n");
+
LOG
(3, 0, 0, 0, "Setting enable password\n");
}
else
{
cli_allow_user(cli, buf, p);
}
else
{
cli_allow_user(cli, buf, p);
-
log
(3, 0, 0, 0, "Allowing user %s to connect to the CLI\n", buf);
+
LOG
(3, 0, 0, 0, "Allowing user %s to connect to the CLI\n", buf);
}
}
fclose(f);
}
}
fclose(f);
@@
-226,7
+226,7
@@
void init_cli(char *hostname)
addr.sin_port = htons(23);
if (bind(clifd, (void *) &addr, sizeof(addr)) < 0)
{
addr.sin_port = htons(23);
if (bind(clifd, (void *) &addr, sizeof(addr)) < 0)
{
-
log
(0, 0, 0, 0, "Error listening on cli port 23: %s\n", strerror(errno));
+
LOG
(0, 0, 0, 0, "Error listening on cli port 23: %s\n", strerror(errno));
return;
}
listen(clifd, 10);
return;
}
listen(clifd, 10);
@@
-241,18
+241,18
@@
void cli_do(int sockfd)
if (fork_and_close()) return;
if (getpeername(sockfd, (struct sockaddr *)&addr, &l) == 0)
{
if (fork_and_close()) return;
if (getpeername(sockfd, (struct sockaddr *)&addr, &l) == 0)
{
-
log
(3, 0, 0, 0, "Accepted connection to CLI from %s\n", inet_toa(addr.sin_addr.s_addr));
+
LOG
(3, 0, 0, 0, "Accepted connection to CLI from %s\n", inet_toa(addr.sin_addr.s_addr));
require_auth = addr.sin_addr.s_addr != inet_addr("127.0.0.1");
}
else
require_auth = addr.sin_addr.s_addr != inet_addr("127.0.0.1");
}
else
-
log
(0, 0, 0, 0, "getpeername() failed on cli socket. Requiring authentication: %s\n", strerror(errno));
+
LOG
(0, 0, 0, 0, "getpeername() failed on cli socket. Requiring authentication: %s\n", strerror(errno));
if (require_auth)
{
if (require_auth)
{
-
log
(3, 0, 0, 0, "CLI is remote, requiring authentication\n");
+
LOG
(3, 0, 0, 0, "CLI is remote, requiring authentication\n");
if (!cli->users) /* paranoia */
{
if (!cli->users) /* paranoia */
{
-
log
(0, 0, 0, 0, "No users for remote authentication! Exiting CLI\n");
+
LOG
(0, 0, 0, 0, "No users for remote authentication! Exiting CLI\n");
exit(0);
}
}
exit(0);
}
}
@@
-273,18
+273,18
@@
void cli_do(int sockfd)
cli_loop(cli, sockfd);
close(sockfd);
cli_loop(cli, sockfd);
close(sockfd);
-
log
(3, 0, 0, 0, "Closed CLI connection from %s\n", inet_toa(addr.sin_addr.s_addr));
+
LOG
(3, 0, 0, 0, "Closed CLI connection from %s\n", inet_toa(addr.sin_addr.s_addr));
exit(0);
}
void cli_print_log(struct cli_def *cli, char *string)
{
exit(0);
}
void cli_print_log(struct cli_def *cli, char *string)
{
-
log
(3, 0, 0, 0, "%s\n", string);
+
LOG
(3, 0, 0, 0, "%s\n", string);
}
void cli_do_file(FILE *fh)
{
}
void cli_do_file(FILE *fh)
{
-
log
(3, 0, 0, 0, "Reading configuration file\n");
+
LOG
(3, 0, 0, 0, "Reading configuration file\n");
cli_print_callback(cli, cli_print_log);
cli_file(cli, fh, PRIVILEGE_PRIVILEGED, MODE_CONFIG);
cli_print_callback(cli, NULL);
cli_print_callback(cli, cli_print_log);
cli_file(cli, fh, PRIVILEGE_PRIVILEGED, MODE_CONFIG);
cli_print_callback(cli, NULL);
@@
-538,7
+538,7
@@
int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int argc)
for (i = 1; i < MAXTUNNEL; i++)
{
int sessions = 0;
for (i = 1; i < MAXTUNNEL; i++)
{
int sessions = 0;
- if (!show_all && (!tunnel[i].ip || tunnel[i].die
|| !tunnel[i].hostname[0]
)) continue;
+ if (!show_all && (!tunnel[i].ip || tunnel[i].die)) continue;
for (x = 0; x < MAXSESSION; x++) if (session[x].tunnel == i && session[x].opened && !session[x].die) sessions++;
cli_print(cli, "%4d %20s %20s %6s %6d",
for (x = 0; x < MAXSESSION; x++) if (session[x].tunnel == i && session[x].opened && !session[x].die) sessions++;
cli_print(cli, "%4d %20s %20s %6s %6d",
@@
-1202,7
+1202,7
@@
int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK;
}
return CLI_OK;
}
- cli_print(cli, "Snooping user %s to %s:%d", argv[0], inet_toa(
session[s].snoop_ip), session[s].snoop_
port);
+ cli_print(cli, "Snooping user %s to %s:%d", argv[0], inet_toa(
ip),
port);
cli_session_actions[s].snoop_ip = ip;
cli_session_actions[s].snoop_port = port;
cli_session_actions[s].action |= CLI_SESS_SNOOP;
cli_session_actions[s].snoop_ip = ip;
cli_session_actions[s].snoop_port = port;
cli_session_actions[s].action |= CLI_SESS_SNOOP;