* Double-check lengths to be sure they're sane
*/
if (strlen(hostnm) >= sizeof(c->server)) {
- radlog(L_ERR, "%s[%d]: server name of length %d is greater than the allowed maximum of %d.",
+ radlog(L_ERR, "%s[%d]: server name of length %u is greater than the allowed maximum of %u.",
file, lineno,
- (int) strlen(hostnm),
- (int) sizeof(c->server) - 1);
+ strlen(hostnm),
+ sizeof(c->server) - 1);
return -1;
}
if (strlen(realm) > sizeof(c->realm)) {
- radlog(L_ERR, "%s[%d]: realm of length %d is greater than the allowed maximum of %d.",
+ radlog(L_ERR, "%s[%d]: realm of length %u is greater than the allowed maximum of %u.",
file, lineno,
- (int) strlen(realm),
- (int) sizeof(c->realm) - 1);
+ strlen(realm),
+ sizeof(c->realm) - 1);
return -1;
}
* Double check length, just to be sure!
*/
if (strlen(authhost) >= sizeof(c->server)) {
- radlog(L_ERR, "%s[%d]: Server name of length %d is greater than allowed: %d",
+ radlog(L_ERR, "%s[%d]: Server name of length %u is greater than allowed: %u",
filename, cf_section_lineno(cs),
- (int) strlen(authhost),
- (int) sizeof(c->server) - 1);
+ strlen(authhost),
+ sizeof(c->server) - 1);
return -1;
}
}
}
if (strlen(accthost) >= sizeof(c->acct_server)) {
- radlog(L_ERR, "%s[%d]: Server name of length %d is greater than allowed: %d",
+ radlog(L_ERR, "%s[%d]: Server name of length %u is greater than allowed: %u",
filename, cf_section_lineno(cs),
- (int) strlen(accthost),
- (int) sizeof(c->acct_server) - 1);
+ strlen(accthost),
+ sizeof(c->acct_server) - 1);
return -1;
}
}
if (strlen(name2) >= sizeof(c->realm)) {
- radlog(L_ERR, "%s[%d]: Realm name of length %d is greater than allowed %d",
+ radlog(L_ERR, "%s[%d]: Realm name of length %u is greater than allowed %u",
filename, cf_section_lineno(cs),
- (int) strlen(name2),
- (int) sizeof(c->server) - 1);
+ strlen(name2),
+ sizeof(c->server) - 1);
return -1;
}
}
if (strlen(s) >= sizeof(c->secret)) {
- radlog(L_ERR, "%s[%d]: Secret of length %d is greater than the allowed maximum of %d.",
+ radlog(L_ERR, "%s[%d]: Secret of length %u is greater than the allowed maximum of %u.",
filename, cf_section_lineno(cs),
strlen(s), sizeof(c->secret) - 1);
return -1;
* ntpwdhash converts Unicode password to 16-byte NT hash
* with MD4
*/
-static void ntpwdhash (char *szHash, const char *szPassword)
+static void ntpwdhash (unsigned char *szHash, const char *szPassword)
{
char szUnicodePass[513];
int nPasswordLen;
const char *user_name, uint8_t *challenge )
{
SHA1_CTX Context;
- char hash[20];
+ uint8_t hash[20];
SHA1Init(&Context);
SHA1Update(&Context, peer_challenge, 16);
* returns 42-octet response string
*/
static void auth_response(const char *username,
- const char *nt_hash_hash,
- char *ntresponse,
+ const uint8_t *nt_hash_hash,
+ uint8_t *ntresponse,
char *peer_challenge, char *auth_challenge,
char *response)
{
SHA1_CTX Context;
- const char magic1[39] =
+ const uint8_t magic1[39] =
{0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65,
0x6E, 0x74, 0x20, 0x73, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67,
0x20, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74};
- const char magic2[41] =
+ const uint8_t magic2[41] =
{0x50, 0x61, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x6D, 0x61, 0x6B,
0x65, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6F, 0x20, 0x6D, 0x6F,
0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x6E, 0x20, 0x6F, 0x6E,
0x6E};
char challenge[8];
- char digest[20];
+ uint8_t digest[20];
SHA1Init(&Context);
SHA1Update(&Context, nt_hash_hash, 16);
static int mschap_authenticate(void * instance, REQUEST *request)
{
#define inst ((rlm_mschap_t *)instance)
- VALUE_PAIR *challenge = NULL, *response = NULL;
+ VALUE_PAIR *challenge = NULL;
+ VALUE_PAIR *response = NULL;
VALUE_PAIR *password = NULL;
VALUE_PAIR *lm_password, *nt_password, *smb_ctrl;
VALUE_PAIR *username;