Nothing to see here, folks. Move along.
do {
if (pl->sockets[i].sockfd == -1) {
ps = &pl->sockets[i];
- start = i;
break;
}
if (!vp) return 0;
name = vp->name;
- len = 0;
if (!name || !*name) {
if (!vp_print_name(namebuf, sizeof(namebuf), vp->attribute, vp->attribute)) {
if (vp->flags.extended) {
ptr[2] = (attribute & 0xff00) >> 8;
- len++;
} else if (vp->flags.extended_flags) {
if (room < 4) return 0;
ptr[1] = 4;
ptr[2] = (attribute & 0xff00) >> 8;
ptr[3] = 0;
-
- len += 2;
}
/*
{
int len, redo;
uint32_t lvalue;
- uint8_t *ptr = start, *vsa = start;
+ uint8_t *ptr, *vsa;
uint32_t maxattr;
VALUE_PAIR *vp = reply;
size_t total;
ssize_t this;
- total = this = 0;
+ total = 0;
while (total < sizeof(fr_rand_pool.randrsl)) {
this = read(fd, fr_rand_pool.randrsl,
sizeof(fr_rand_pool.randrsl) - total);
char *s;
const char *p;
int quote, end = 0;
- int escape;
unsigned int x;
const FR_NAME_NUMBER*t;
FR_TOKEN rcode;
p++;
}
s = buf;
- escape = 0;
while (*p && buflen-- > 1) {
if (quote && (*p == '\\')) {
*/
FR_TOKEN getstring(const char **ptr, char *buf, int buflen)
{
- const char *p = *ptr;
+ const char *p;
+
+ if (!ptr || !*ptr || !buf) return T_OP_INVALID;
+
+ p = *ptr;
while (p && (isspace((int)*p))) p++;
}
#ifdef WITH_PROXY
else {
- int count = this->count;
+ int count;
/*
* Duplicate code
radclient->request->id, vp);
vp->length = 17;
- } else if ((vp = pairfind(radclient->request->vps, PW_MSCHAP_PASSWORD, 0)) != NULL) {
+ } else if (pairfind(radclient->request->vps, PW_MSCHAP_PASSWORD, 0) != NULL) {
mschapv1_encode(&radclient->request->vps,
radclient->password);
} else if (fr_debug_flag) {
eaptls_status_t status;
REQUEST *request = handler->request;
+ rad_assert(request != NULL);
+
RDEBUG2("processing EAP-TLS");
if (handler->certs) pairadd(&request->packet->vps,
paircopy(handler->certs));
*/
static int eap_handler_ptr_cmp(const void *a, const void *b)
{
- return (a - b);
+ return (((uint8_t *) a) - ((uint8_t *) b));
}
memcpy(p, session->peer_challenge, 8); /* PC */
p += 8;
memcpy(p, session->peer_response, 24); /* PR */
- p += 24;
/*
* These 16 bytes are the session key to use.
*/
static int vp2eap(REQUEST *request, tls_session_t *tls_session, VALUE_PAIR *vp)
{
+ rad_assert(vp != NULL);
+
/*
* Skip the id, code, and length. Just write the EAP
* type & data to the client.
tls_session_t *tls_session = (tls_session_t *) data;
REQUEST *fake, *request = handler->request;
+ rad_assert(request != NULL);
RDEBUG2("Passing reply from proxy back into the tunnel.");
/*
*/
fake->options &= ~RAD_REQUEST_OPTION_PROXY_EAP;
RDEBUG2("Passing reply back for EAP-MS-CHAP-V2");
- rcode = module_post_proxy(0, fake);
+ module_post_proxy(0, fake);
/*
* FIXME: If rcode returns fail, do something
REQUEST *request = handler->request;
EAP_DS *eap_ds = handler->eap_ds;
+ rad_assert(request != NULL);
+
/*
* Just look at the buffer directly, without doing
* record_minus. This lets us avoid another data copy.
ttls_tunnel_t *t = tls_session->opaque;
handler = handler; /* -Wunused */
+ rad_assert(request != NULL);
+ rad_assert(handler->request == request);
/*
* If the response packet was Access-Accept, then
tls_session_t *tls_session = (tls_session_t *) data;
REQUEST *fake, *request = handler->request;
+ rad_assert(request != NULL);
RDEBUG("Passing reply from proxy back into the tunnel.");
/*
size_t data_len;
REQUEST *request = handler->request;
+ rad_assert(request != NULL);
+
/*
* Just look at the buffer directly, without doing
* record_minus.
{
uint8_t calculated[24];
+ rad_assert(request != NULL);
+
/*
* Do normal authentication.
*/
return -1;
}
- smbdes_mschap(password->vp_strvalue, challenge, calculated);
+ smbdes_mschap(password->vp_octets, challenge, calculated);
if (memcmp(response, calculated, 24) != 0) {
return -1;
}
*
* The win_password MUST be exactly 16 bytes long.
*/
-void smbdes_mschap(const char *win_password,
+void smbdes_mschap(const uint8_t win_password[16],
const uint8_t *challenge, uint8_t *response)
{
uint8_t p21[21];
RCSIDH(smbdes_h, "$Id$")
void smbdes_lmpwdhash(const char *password, uint8_t *lmhash);
-void smbdes_mschap(const char *win_password,
+void smbdes_mschap(const uint8_t win_password[16],
const uint8_t *challenge, uint8_t *response);
#endif /*_SMBDES_H*/
if (!fdp || fdp->fd == -1)
return -1;
- if (otp_write(fdp, (const char *) request, sizeof(*request)) != 0) {
- if (rc == 0)
+ if ((rc = otp_write(fdp, (const char *) request, sizeof(*request))) != sizeof(*request)) { if (rc == 0)
goto retry; /* otpd disconnect */ /*TODO: pause */
else
return -1;
{
char namebuf[MAX_STRING_LEN];
char *username;
- char *realmname = NULL;
+ const char *realmname = NULL;
char *ptr;
VALUE_PAIR *vp;
REALM *realm;
case REALM_FORMAT_SUFFIX:
/* DEBUG2(" rlm_realm: Checking for suffix after \"%c\"", inst->delim[0]); */
- realmname = strrchr(username, inst->delim[0]);
- if (realmname) {
- *realmname = '\0';
- realmname++;
+ ptr = strrchr(username, inst->delim[0]);
+ if (ptr) {
+ *ptr = '\0';
+ realmname = ptr + 1;
}
break;