--- embedaddon/mpd/src/eap.c 2019/10/22 13:49:55 1.1.1.3 +++ embedaddon/mpd/src/eap.c 2021/03/17 00:39:23 1.1.1.4 @@ -1,7 +1,7 @@ /* * See ``COPYRIGHT.mpd'' * - * $Id: eap.c,v 1.1.1.3 2019/10/22 13:49:55 misho Exp $ + * $Id: eap.c,v 1.1.1.4 2021/03/17 00:39:23 misho Exp $ * */ @@ -23,7 +23,7 @@ static void EapRadiusProxyFinish(Link l, AuthData auth); static void EapRadiusSendMsg(void *ptr); static void EapRadiusSendMsgTimeout(void *ptr); - static int EapSetCommand(Context ctx, int ac, char *av[], void *arg); + static int EapSetCommand(Context ctx, int ac, const char *const av[], const void *arg); /* Set menu options */ enum { @@ -52,14 +52,14 @@ EapSetCommand, NULL, 2, (void *) SET_YES }, { "no [opt ...]", "Disable and deny option", EapSetCommand, NULL, 2, (void *) SET_NO }, - { NULL }, + { NULL, NULL, NULL, NULL, 0, NULL }, }; /* * INTERNAL VARIABLES */ - static struct confinfo gConfList[] = { + static const struct confinfo gConfList[] = { { 0, EAP_CONF_RADIUS, "radius-proxy" }, { 1, EAP_CONF_MD5, "md5" }, { 0, 0, NULL }, @@ -225,6 +225,7 @@ EapSendNak(Link l, u_char id, u_char type) int i = 0; u_char nak_type = 0; + (void)type; for (i = 0; i < EAP_NUM_TYPES; i++) { if (eap->peer_types[i] != 0) { nak_type = eap->peer_types[i]; @@ -272,10 +273,11 @@ EapInput(Link l, AuthData auth, const u_char *pkt, u_s Auth const a = &l->lcp.auth; EapInfo const eap = &a->eap; int data_len = len - 1, i, acc_type; - u_char *data = NULL, type = 0; + const u_char *data = NULL; + u_char type = 0; if (pkt != NULL) { - data = data_len > 0 ? (u_char *) &pkt[1] : NULL; + data = data_len > 0 ? &pkt[1] : NULL; type = pkt[0]; } @@ -393,7 +395,8 @@ static void EapRadiusProxy(Link l, AuthData auth, const u_char *pkt, u_short len) { int data_len = len - 1; - u_char *data = NULL, type = 0; + const u_char *data = NULL; + u_char type = 0; Auth const a = &l->lcp.auth; EapInfo const eap = &a->eap; struct fsmheader lh; @@ -401,7 +404,7 @@ EapRadiusProxy(Link l, AuthData auth, const u_char *pk Log(LG_AUTH, ("[%s] EAP: Proxying packet to RADIUS", l->name)); if (pkt != NULL) { - data = data_len > 0 ? (u_char *) &pkt[1] : NULL; + data = data_len > 0 ? &pkt[1] : NULL; type = pkt[0]; } @@ -413,7 +416,7 @@ EapRadiusProxy(Link l, AuthData auth, const u_char *pk data_len = AUTH_MAX_AUTHNAME - 1; } memset(eap->identity, 0, sizeof(eap->identity)); - strncpy(eap->identity, (char *) data, data_len); + strncpy(eap->identity, (const char *)data, data_len); Log(LG_AUTH, ("[%s] EAP: Identity: %s", l->name, eap->identity)); } @@ -498,7 +501,7 @@ EapRadiusSendMsg(void *ptr) Mbuf bp; Link l = (Link)ptr; Auth const a = &l->lcp.auth; - FsmHeader const f = (FsmHeader)a->params.eapmsg; + FsmHeader const f = (FsmHeader)(void *)a->params.eapmsg; char buf[32]; if (a->params.eapmsg_len > 4) { @@ -555,10 +558,14 @@ EapIdentTimeout(void *ptr) */ int -EapStat(Context ctx, int ac, char *av[], void *arg) +EapStat(Context ctx, int ac, const char *const av[], const void *arg) { EapInfo const eap = &ctx->lnk->lcp.auth.eap; + (void)ac; + (void)av; + (void)arg; + Printf("\tIdentity : %s\r\n", eap->identity); Printf("EAP options\r\n"); OptStat(ctx, &eap->conf.options, gConfList); @@ -647,7 +654,7 @@ EapTypeSupported(u_char type) */ static int -EapSetCommand(Context ctx, int ac, char *av[], void *arg) +EapSetCommand(Context ctx, int ac, const char *const av[], const void *arg) { EapInfo const eap = &ctx->lnk->lcp.auth.eap;