mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 16:30:52 +01:00
Cope with rb_crypt() returning NULL.
This commit is contained in:
parent
df2516e6d8
commit
e69375f3ac
5 changed files with 13 additions and 7 deletions
|
@ -46,6 +46,7 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
{
|
{
|
||||||
static time_t last_used = 0;
|
static time_t last_used = 0;
|
||||||
char *salt;
|
char *salt;
|
||||||
|
const char *crypted;
|
||||||
const char *hashtype;
|
const char *hashtype;
|
||||||
const char hashdefault[] = "SHA512";
|
const char hashdefault[] = "SHA512";
|
||||||
|
|
||||||
|
@ -82,7 +83,8 @@ m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
return 0;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ static int
|
||||||
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||||
{
|
{
|
||||||
char *salt;
|
char *salt;
|
||||||
|
const char *crypted;
|
||||||
const char *hashtype;
|
const char *hashtype;
|
||||||
const char hashdefault[] = "SHA512";
|
const char hashdefault[] = "SHA512";
|
||||||
|
|
||||||
|
@ -121,7 +124,8 @@ mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const ch
|
||||||
return 0;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
else
|
else
|
||||||
encr = parv[1];
|
encr = parv[1];
|
||||||
|
|
||||||
if (strcmp(encr, aconf->passwd))
|
if (encr == NULL || strcmp(encr, aconf->passwd))
|
||||||
{
|
{
|
||||||
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
|
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -196,7 +196,7 @@ match_oper_password(const char *password, struct oper_conf *oper_p)
|
||||||
else
|
else
|
||||||
encr = password;
|
encr = password;
|
||||||
|
|
||||||
if(strcmp(encr, oper_p->passwd) == 0)
|
if(encr != NULL && strcmp(encr, oper_p->passwd) == 0)
|
||||||
return YES;
|
return YES;
|
||||||
else
|
else
|
||||||
return NO;
|
return NO;
|
||||||
|
|
|
@ -326,6 +326,7 @@ check_server(const char *name, struct Client *client_p)
|
||||||
struct server_conf *tmp_p;
|
struct server_conf *tmp_p;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
int error = -1;
|
int error = -1;
|
||||||
|
const char *encr;
|
||||||
|
|
||||||
s_assert(NULL != client_p);
|
s_assert(NULL != client_p);
|
||||||
if(client_p == NULL)
|
if(client_p == NULL)
|
||||||
|
@ -360,8 +361,9 @@ check_server(const char *name, struct Client *client_p)
|
||||||
{
|
{
|
||||||
if(ServerConfEncrypted(tmp_p))
|
if(ServerConfEncrypted(tmp_p))
|
||||||
{
|
{
|
||||||
if(!strcmp(tmp_p->passwd, rb_crypt(client_p->localClient->passwd,
|
encr = rb_crypt(client_p->localClient->passwd,
|
||||||
tmp_p->passwd)))
|
tmp_p->passwd);
|
||||||
|
if(encr != NULL && !strcmp(tmp_p->passwd, encr))
|
||||||
{
|
{
|
||||||
server_p = tmp_p;
|
server_p = tmp_p;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -373,7 +373,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
|
||||||
else
|
else
|
||||||
encr = source_p->localClient->passwd;
|
encr = source_p->localClient->passwd;
|
||||||
|
|
||||||
if(strcmp(encr, aconf->passwd))
|
if(encr == NULL || strcmp(encr, aconf->passwd))
|
||||||
{
|
{
|
||||||
ServerStats.is_ref++;
|
ServerStats.is_ref++;
|
||||||
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
|
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
|
||||||
|
|
Loading…
Reference in a new issue