diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2013-01-24 23:58:56 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-01-24 23:58:56 +0400 |
commit | cf3de06a3346854d770ba147f081e3b22e93c1bc (patch) | |
tree | 0c1a138d292c140c2547361615bf556ff2b98f9f /accel-pppd/cli | |
parent | 35b55103979145284d63bc1db4ebd6e9d6666b34 (diff) | |
download | accel-ppp-cf3de06a3346854d770ba147f081e3b22e93c1bc.tar.gz accel-ppp-cf3de06a3346854d770ba147f081e3b22e93c1bc.zip |
backport 1.7
* l2tp: Fix allocation checking when adding octets AVP
* cli, tcp: Fix non-NULL terminated string reception
* Fix va_end() missing calls
* chap-secrets: implemented encryption
* auth_pap: make messages like other auth modules
* cli: check xmit_buf is not null at enter to write function
* pppoe: implemented regular expression support
* chap-secrets: implemented encryption
* ippool: fixed initialization order
* optional shaper compiling
* ppp: dns/wins code cleanup
Diffstat (limited to 'accel-pppd/cli')
-rw-r--r-- | accel-pppd/cli/cli.c | 2 | ||||
-rw-r--r-- | accel-pppd/cli/tcp.c | 10 | ||||
-rw-r--r-- | accel-pppd/cli/telnet.c | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/accel-pppd/cli/cli.c b/accel-pppd/cli/cli.c index 917634c9..90341cd3 100644 --- a/accel-pppd/cli/cli.c +++ b/accel-pppd/cli/cli.c @@ -54,6 +54,8 @@ void __export cli_register_simple_cmd2( c->hdr[i] = va_arg(ap, char *); list_add_tail(&c->entry, &simple_cmd_list); + + va_end(ap); } void __export cli_register_regexp_cmd(struct cli_regexp_cmd_t *cmd) diff --git a/accel-pppd/cli/tcp.c b/accel-pppd/cli/tcp.c index b2ed9105..48fa01a2 100644 --- a/accel-pppd/cli/tcp.c +++ b/accel-pppd/cli/tcp.c @@ -144,7 +144,7 @@ static int cln_read(struct triton_md_handler_t *h) char *d; while (1) { - n = read(h->fd, cln->cmdline + cln->recv_pos, RECV_BUF_SIZE - cln->recv_pos); + n = read(h->fd, cln->cmdline + cln->recv_pos, RECV_BUF_SIZE - 1 - cln->recv_pos); if (n == 0) break; if (n < 0) { @@ -154,11 +154,12 @@ static int cln_read(struct triton_md_handler_t *h) } cln->recv_pos += n; - + cln->cmdline[cln->recv_pos] = '\0'; + while (cln->recv_pos) { d = strchr((char *)cln->cmdline, '\n'); if (!d) { - if (cln->recv_pos == RECV_BUF_SIZE) { + if (cln->recv_pos == RECV_BUF_SIZE - 1) { log_warn("cli: tcp: recv buffer overflow\n"); goto drop; } @@ -192,6 +193,9 @@ static int cln_write(struct triton_md_handler_t *h) struct tcp_client_t *cln = container_of(h, typeof(*cln), hnd); int k; + if (!cln->xmit_buf) + return 0; + while (1) { for (; cln->xmit_pos < cln->xmit_buf->size; cln->xmit_pos += k) { k = write(cln->hnd.fd, cln->xmit_buf->buf + cln->xmit_pos, cln->xmit_buf->size - cln->xmit_pos); diff --git a/accel-pppd/cli/telnet.c b/accel-pppd/cli/telnet.c index 5a42a993..c3aab8c3 100644 --- a/accel-pppd/cli/telnet.c +++ b/accel-pppd/cli/telnet.c @@ -501,7 +501,10 @@ static int cln_write(struct triton_md_handler_t *h) { struct telnet_client_t *cln = container_of(h, typeof(*cln), hnd); int k; - + + if (!cln->xmit_buf) + return 0; + while (1) { for (; cln->xmit_pos < cln->xmit_buf->size; cln->xmit_pos += k) { k = write(cln->hnd.fd, cln->xmit_buf->buf + cln->xmit_pos, cln->xmit_buf->size - cln->xmit_pos); |