mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-25 16:44:04 +00:00
CHAP is now using pbuf instead of pcb->outpacket_buf
This commit is contained in:
parent
22fad86453
commit
503162ec54
@ -280,7 +280,7 @@ static void chap_generate_challenge(ppp_pcb *pcb) {
|
|||||||
static void chap_handle_response(ppp_pcb *pcb, int id,
|
static void chap_handle_response(ppp_pcb *pcb, int id,
|
||||||
unsigned char *pkt, int len) {
|
unsigned char *pkt, int len) {
|
||||||
int response_len, ok, mlen;
|
int response_len, ok, mlen;
|
||||||
unsigned char *response, *p;
|
unsigned char *response, *outp;
|
||||||
char *name = NULL; /* initialized to shut gcc up */
|
char *name = NULL; /* initialized to shut gcc up */
|
||||||
int (*verifier)(char *, char *, int, struct chap_digest_type *,
|
int (*verifier)(char *, char *, int, struct chap_digest_type *,
|
||||||
unsigned char *, unsigned char *, char *, int);
|
unsigned char *, unsigned char *, char *, int);
|
||||||
@ -329,17 +329,22 @@ static void chap_handle_response(ppp_pcb *pcb, int id,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* send the response */
|
/* send the response */
|
||||||
p = pcb->outpacket_buf;
|
|
||||||
MAKEHEADER(p, PPP_CHAP);
|
|
||||||
mlen = strlen(pcb->chap_server.message);
|
mlen = strlen(pcb->chap_server.message);
|
||||||
len = CHAP_HDRLEN + mlen;
|
len = CHAP_HDRLEN + mlen;
|
||||||
p[0] = (pcb->chap_server.flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
|
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +len), PBUF_RAM);
|
||||||
p[1] = id;
|
if(NULL == p)
|
||||||
p[2] = len >> 8;
|
return;
|
||||||
p[3] = len;
|
|
||||||
|
outp = p->payload;
|
||||||
|
MAKEHEADER(outp, PPP_CHAP);
|
||||||
|
|
||||||
|
outp[0] = (pcb->chap_server.flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
|
||||||
|
outp[1] = id;
|
||||||
|
outp[2] = len >> 8;
|
||||||
|
outp[3] = len;
|
||||||
if (mlen > 0)
|
if (mlen > 0)
|
||||||
memcpy(p + CHAP_HDRLEN, pcb->chap_server.message, mlen);
|
memcpy(outp + CHAP_HDRLEN, pcb->chap_server.message, mlen);
|
||||||
ppp_write(pcb, pcb->outpacket_buf, PPP_HDRLEN + len);
|
ppp_write_pbuf(pcb, p);
|
||||||
|
|
||||||
if (pcb->chap_server.flags & CHALLENGE_VALID) {
|
if (pcb->chap_server.flags & CHALLENGE_VALID) {
|
||||||
pcb->chap_server.flags &= ~CHALLENGE_VALID;
|
pcb->chap_server.flags &= ~CHALLENGE_VALID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user