PPP, added const modifier on auth strings

This commit is contained in:
Sylvain Rochet
2014-12-24 17:17:00 +01:00
parent 382ddac1a1
commit 482a18e6de
12 changed files with 68 additions and 67 deletions

View File

@@ -133,14 +133,14 @@ struct chap_digest_type {
* a length byte followed by the actual challenge/response data.
*/
void (*generate_challenge)(unsigned char *challenge);
int (*verify_response)(int id, char *name,
unsigned char *secret, int secret_len,
unsigned char *challenge, unsigned char *response,
int (*verify_response)(int id, const char *name,
const unsigned char *secret, int secret_len,
const unsigned char *challenge, const unsigned char *response,
char *message, int message_space);
#endif /* PPP_SERVER */
void (*make_response)(unsigned char *response, int id, char *our_name,
unsigned char *challenge, char *secret, int secret_len,
unsigned char *priv);
void (*make_response)(unsigned char *response, int id, const char *our_name,
const unsigned char *challenge, const char *secret, int secret_len,
const unsigned char *priv);
int (*check_success)(unsigned char *pkt, int len, unsigned char *priv);
void (*handle_failure)(unsigned char *pkt, int len);
};
@@ -151,7 +151,7 @@ struct chap_digest_type {
#if CHAP_SUPPORT
typedef struct chap_client_state {
u8_t flags;
char *name;
const char *name;
const struct chap_digest_type *digest;
unsigned char priv[64]; /* private area for digest's use */
} chap_client_state;
@@ -160,7 +160,7 @@ typedef struct chap_client_state {
typedef struct chap_server_state {
u8_t flags;
int id;
char *name;
const char *name;
const struct chap_digest_type *digest;
int challenge_xmits;
int challenge_pktlen;
@@ -180,11 +180,11 @@ extern int (*chap_verify_hook)(char *name, char *ourname, int id,
#if PPP_SERVER
/* Called by authentication code to start authenticating the peer. */
extern void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code);
extern void chap_auth_peer(ppp_pcb *pcb, const char *our_name, int digest_code);
#endif /* PPP_SERVER */
/* Called by auth. code to start authenticating us to the peer. */
extern void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code);
extern void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code);
/* Represents the CHAP protocol to the main pppd code */
extern const struct protent chap_protent;

View File

@@ -113,8 +113,8 @@ enum eap_state_code {
};
struct eap_auth {
char *ea_name; /* Our name */
char *ea_peer; /* Peer's name */
const char *ea_name; /* Our name */
char *ea_peer; /* Peer's name */
void *ea_session; /* Authentication library linkage */
u_char *ea_skey; /* Shared encryption key */
u_short ea_namelen; /* Length of our name */
@@ -154,8 +154,8 @@ typedef struct eap_state {
#define EAP_DEFALLOWREQ 20 /* max # times to accept requests */
#endif /* moved to opt.h */
void eap_authwithpeer(ppp_pcb *pcb, char *localname);
void eap_authpeer(ppp_pcb *pcb, char *localname);
void eap_authwithpeer(ppp_pcb *pcb, const char *localname);
void eap_authpeer(ppp_pcb *pcb, const char *localname);
extern const struct protent eap_protent;

View File

@@ -250,8 +250,8 @@ typedef struct ppp_settings_s {
#endif /* PPP_MAXCONNECT */
/* auth data */
char *user; /* Username for PAP */
char *passwd; /* Password for PAP, secret for CHAP */
const char *user; /* Username for PAP */
const char *passwd; /* Password for PAP, secret for CHAP */
#if PPP_SERVER
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
#endif /* PPP_SERVER */
@@ -515,7 +515,7 @@ void ppp_set_default(ppp_pcb *pcb);
#define PPPAUTHTYPE_EAP 0x08
#define PPPAUTHTYPE_ANY 0xff
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, char *user, char *passwd);
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
#if PPP_NOTIFY_PHASE
/*

View File

@@ -508,7 +508,7 @@ void continue_networks(ppp_pcb *pcb); /* start network [ip, etc] control protos
#if PPP_SERVER
void auth_peer_fail(ppp_pcb *pcb, int protocol);
/* peer failed to authenticate itself */
void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, char *name, int namelen);
void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *name, int namelen);
/* peer successfully authenticated itself */
#endif /* PPP_SERVER */
void auth_withpeer_fail(ppp_pcb *pcb, int protocol);
@@ -519,7 +519,7 @@ void np_up(ppp_pcb *pcb, int proto); /* a network protocol has come up */
void np_down(ppp_pcb *pcb, int proto); /* a network protocol has gone down */
void np_finished(ppp_pcb *pcb, int proto); /* a network protocol no longer needs link */
void auth_reset(ppp_pcb *pcb); /* check what secrets we have */
int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secret_len, int am_server);
int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secret, int *secret_len, int am_server);
/* get "secret" for chap */
/* Procedures exported from ipcp.c */

View File

@@ -98,9 +98,9 @@
*/
#if PAP_SUPPORT
typedef struct upap_state {
char *us_user; /* User */
const char *us_user; /* User */
u8_t us_userlen; /* User length */
char *us_passwd; /* Password */
const char *us_passwd; /* Password */
u8_t us_passwdlen; /* Password length */
u8_t us_clientstate; /* Client state */
#if PPP_SERVER
@@ -112,7 +112,7 @@ typedef struct upap_state {
#endif /* PAP_SUPPORT */
void upap_authwithpeer(ppp_pcb *pcb, char *user, char *password);
void upap_authwithpeer(ppp_pcb *pcb, const char *user, const char *password);
#if PPP_SERVER
void upap_authpeer(ppp_pcb *pcb);
#endif /* PPP_SERVER */