# include <openssl/des.h>
#endif
#ifndef NO_APR1
-# include <openssl/des.h>
+# include <openssl/md5.h>
#endif
* -reverse - switch table columns
*/
+int MAIN(int, char **);
+
int MAIN(int argc, char **argv)
{
int ret = 1;
if (passwds == NULL)
{
/* no passwords on the command line */
- passwd = passwd_malloc = Malloc(pw_maxlen + 1);
+#define PASSWD_MALLOC_SIZE (pw_maxlen + 2)
+ /* longer than necessary so that we can warn about truncation */
+ passwd = passwd_malloc = Malloc(PASSWD_MALLOC_SIZE);
if (passwd_malloc == NULL)
goto err;
}
passwds = passwds_static;
if (in == NULL)
- if (EVP_read_pw_string(passwd_malloc, pw_maxlen + 1, "Password: ", 0) != 0)
+ if (EVP_read_pw_string(passwd_malloc, PASSWD_MALLOC_SIZE, "Password: ", 0) != 0)
goto err;
passwds[0] = passwd_malloc;
}
MD5_CTX md2;
MD5_Init(&md2);
- MD5_Update(&md2, (i & 1) ? passwd : buf,
+ MD5_Update(&md2, (i & 1) ? (unsigned char *) passwd : buf,
(i & 1) ? passwd_len : sizeof buf);
if (i % 3)
MD5_Update(&md2, salt_out, salt_len);
if (i % 7)
MD5_Update(&md2, passwd, passwd_len);
- MD5_Update(&md2, (i & 1) ? buf : passwd,
+ MD5_Update(&md2, (i & 1) ? buf : (unsigned char *) passwd,
(i & 1) ? sizeof buf : passwd_len);
MD5_Final(buf, &md2);
}