mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
PPP, PPPAPI: remove useless pppapi_set_auth function
Setting PPP authentication most only be done when the PPP PCB is in the dead phase (i.e. disconnected). This is safe to access the PPP PCB members while the session is down, therefore providing a thread-safe function of it is meaningless and it might even be misleading. All our new ppp_set_* functions do not have their equivalent pppapi_set_* functions and they are not going to have them. At least we make ppp_set_auth consistent with all others ppp_set_*, so that it doesn't look like special.
This commit is contained in:
parent
b9b36084a5
commit
50b5b4c4dd
@ -423,7 +423,12 @@ struct ppp_pcb_s {
|
||||
************************/
|
||||
|
||||
/*
|
||||
* Set auth helper, optional, you can either fill ppp_pcb->settings.
|
||||
* WARNING: For multi-threads environment, all ppp_set_* functions most
|
||||
* only be called while the PPP is in the dead phase (i.e. disconnected).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set PPP authentication.
|
||||
*
|
||||
* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
|
||||
* RFC 1994 says:
|
||||
|
@ -47,11 +47,6 @@ extern "C" {
|
||||
struct pppapi_msg_msg {
|
||||
ppp_pcb *ppp;
|
||||
union {
|
||||
struct {
|
||||
u8_t authtype;
|
||||
const char *user;
|
||||
const char *passwd;
|
||||
} setauth;
|
||||
#if PPP_NOTIFY_PHASE
|
||||
struct {
|
||||
ppp_notify_phase_cb_fn notify_phase_cb;
|
||||
@ -109,7 +104,6 @@ struct pppapi_msg {
|
||||
|
||||
/* API for application */
|
||||
err_t pppapi_set_default(ppp_pcb *pcb);
|
||||
err_t pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
|
||||
#if PPP_NOTIFY_PHASE
|
||||
err_t pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb);
|
||||
#endif /* PPP_NOTIFY_PHASE */
|
||||
|
@ -81,40 +81,6 @@ pppapi_set_default(ppp_pcb *pcb)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call ppp_set_auth() inside the tcpip_thread context.
|
||||
*/
|
||||
static err_t
|
||||
pppapi_do_ppp_set_auth(struct tcpip_api_call_data *m)
|
||||
{
|
||||
struct pppapi_msg *msg = (struct pppapi_msg *)m;
|
||||
|
||||
ppp_set_auth(msg->msg.ppp, msg->msg.msg.setauth.authtype,
|
||||
msg->msg.msg.setauth.user, msg->msg.msg.setauth.passwd);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ppp_set_auth() in a thread-safe way by running that function inside the
|
||||
* tcpip_thread context.
|
||||
*/
|
||||
err_t
|
||||
pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd)
|
||||
{
|
||||
err_t err;
|
||||
PPPAPI_VAR_DECLARE(msg);
|
||||
PPPAPI_VAR_ALLOC(msg);
|
||||
|
||||
PPPAPI_VAR_REF(msg).msg.ppp = pcb;
|
||||
PPPAPI_VAR_REF(msg).msg.msg.setauth.authtype = authtype;
|
||||
PPPAPI_VAR_REF(msg).msg.msg.setauth.user = user;
|
||||
PPPAPI_VAR_REF(msg).msg.msg.setauth.passwd = passwd;
|
||||
err = tcpip_api_call(pppapi_do_ppp_set_auth, &PPPAPI_VAR_REF(msg).call);
|
||||
PPPAPI_VAR_FREE(msg);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
#if PPP_NOTIFY_PHASE
|
||||
/**
|
||||
* Call ppp_set_notify_phase_callback() inside the tcpip_thread context.
|
||||
|
Loading…
x
Reference in New Issue
Block a user