#include "numeric.h"
#include "s_conf.h"
#include "modules.h"
+#include "messages.h"
+#include "send.h"
#include <string.h>
{
static time_t last_used = 0;
char *salt;
+ const char *crypted;
const char *hashtype;
const char hashdefault[] = "SHA512";
return 0;
}
- sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
+ crypted = rb_crypt(parv[1], salt);
+ sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
}
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *salt;
+ const char *crypted;
const char *hashtype;
const char hashdefault[] = "SHA512";
return 0;
}
- sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
+ crypted = rb_crypt(parv[1], salt);
+ sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
}
if(read(fd, buf, length) != length)
{
free(buf);
+ close(fd);
return (generate_poor_salt(salt, length));
}
salt[i] = saltChars[abs(buf[i]) % 64];
}
free(buf);
+ close(fd);
return (salt);
}