allow twenty byte passwords

This commit is contained in:
Jeremy Ellington 2004-10-01 15:17:48 +00:00
parent 3d790edc6e
commit 3d4acbd829
2 changed files with 6 additions and 4 deletions

View File

@ -61,14 +61,14 @@ enum LANPLUS_SESSION_STATE {
};
#define IPMI_AUTHCODE_BUFFER_SIZE 16
#define IPMI_AUTHCODE_BUFFER_SIZE 20
#define IPMI_SIK_BUFFER_SIZE 20
#define IPMI_KG_BUFFER_SIZE 21 /* key plus null byte */
struct ipmi_session {
unsigned char hostname[64];
unsigned char username[16];
unsigned char authcode[IPMI_AUTHCODE_BUFFER_SIZE];
unsigned char authcode[IPMI_AUTHCODE_BUFFER_SIZE + 1];
unsigned char challenge[16];
unsigned char authtype;
unsigned char authtype_set;

View File

@ -146,11 +146,13 @@ void ipmi_intf_session_set_username(struct ipmi_intf * intf, char * username)
void ipmi_intf_session_set_password(struct ipmi_intf * intf, char * password)
{
if (intf && intf->session) {
memset(intf->session->authcode, 0, 16);
memset(intf->session->authcode, 0, sizeof(intf->session->authcode));
intf->session->password = 0;
if (password) {
intf->session->password = 1;
memcpy(intf->session->authcode, password, min(strlen(password), 16));
memcpy(intf->session->authcode,
password,
min(strlen(password), IPMI_AUTHCODE_BUFFER_SIZE));
}
}
}