Fix bug #152 - disable self-registering

This commit is contained in:
Jan Vidar Krey
2011-08-16 15:09:02 +02:00
parent 472c489ae1
commit 998f5a57e2
4 changed files with 37 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
/*
* uhub - A tiny ADC p2p connection hub
* Copyright (C) 2007-2010, Jan Vidar Krey
* Copyright (C) 2007-2011, Jan Vidar Krey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -732,15 +732,22 @@ static int command_register(struct hub_info* hub, struct hub_user* user, struct
data.password[MAX_PASS_LEN] = '\0';
data.credentials = auth_cred_user;
if (acl_register_user(hub, &data))
if (hub->config->register_self)
{
sprintf(tmp, "User \"%s\" registered.", user->id.nick);
return command_status(hub, user, cmd, tmp);
if (acl_register_user(hub, &data))
{
sprintf(tmp, "User \"%s\" registered.", user->id.nick);
return command_status(hub, user, cmd, tmp);
}
else
{
sprintf(tmp, "Unable to register user \"%s\".", user->id.nick);
return command_status(hub, user, cmd, tmp);
}
}
else
{
sprintf(tmp, "Unable to register user \"%s\".", user->id.nick);
return command_status(hub, user, cmd, tmp);
return command_status(hub, user, cmd, "You are not allowed to register.");
}
}