mirror of
https://github.com/pissnet/pissircd.git
synced 2025-07-29 22:42:24 +01:00
- initialize uid subsystem when ircd config is loaded
This commit is contained in:
parent
e338c318c3
commit
432afdef0f
4 changed files with 42 additions and 3 deletions
|
@ -70,4 +70,9 @@ char *get_mode_str(aClient *acptr);
|
|||
|
||||
/* whowas.c */
|
||||
void initwhowas(void);
|
||||
|
||||
/* uid.c */
|
||||
void uid_init(void);
|
||||
const char *uid_get(void);
|
||||
|
||||
#endif /* proto_h */
|
||||
|
|
|
@ -1115,8 +1115,7 @@ struct _configitem {
|
|||
};
|
||||
|
||||
struct _configitem_me {
|
||||
char *name, *info;
|
||||
unsigned short numeric;
|
||||
char *name, *info, *sid;
|
||||
};
|
||||
|
||||
struct _configitem_files {
|
||||
|
|
|
@ -1441,6 +1441,8 @@ int InitwIRCD(int argc, char *argv[])
|
|||
*/
|
||||
strlcpy(me.info, conf_me->info, sizeof(me.info));
|
||||
strlcpy(me.name, conf_me->name, sizeof(me.name));
|
||||
strlcpy(me.id, conf_me->sid, sizeof(me.name));
|
||||
uid_init();
|
||||
run_configuration();
|
||||
ircd_log(LOG_ERROR, "UnrealIRCd started.");
|
||||
|
||||
|
|
35
src/s_conf.c
35
src/s_conf.c
|
@ -3298,13 +3298,17 @@ int _conf_me(ConfigFile *conf, ConfigEntry *ce)
|
|||
{
|
||||
ircstrdup(conf_me->info, cep->ce_vardata);
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "sid"))
|
||||
{
|
||||
ircstrdup(conf_me->sid, cep->ce_vardata);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _test_me(ConfigFile *conf, ConfigEntry *ce)
|
||||
{
|
||||
char has_name = 0, has_info = 0;
|
||||
char has_name = 0, has_info = 0, has_sid = 0;
|
||||
ConfigEntry *cep;
|
||||
int errors = 0;
|
||||
|
||||
|
@ -3387,6 +3391,30 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce)
|
|||
errors++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "sid"))
|
||||
{
|
||||
if (has_sid)
|
||||
{
|
||||
config_warn_duplicate(cep->ce_fileptr->cf_filename,
|
||||
cep->ce_varlinenum, "me::sid");
|
||||
continue;
|
||||
}
|
||||
has_sid = 1;
|
||||
|
||||
if (strlen(cep->ce_vardata) != 3)
|
||||
{
|
||||
config_error("%s:%i: me::sid must be 3 characters long and begin with a number",
|
||||
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
|
||||
errors++;
|
||||
}
|
||||
|
||||
if (!isdigit(*cep->ce_vardata))
|
||||
{
|
||||
config_error("%s:%i: me::sid must be 3 characters long and begin with a number",
|
||||
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
/* Unknown entry */
|
||||
else
|
||||
{
|
||||
|
@ -3405,6 +3433,11 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce)
|
|||
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me::info");
|
||||
errors++;
|
||||
}
|
||||
if (!has_sid)
|
||||
{
|
||||
config_error_missing(ce->ce_fileptr->cf_filename, ce->ce_varlinenum, "me::sid");
|
||||
errors++;
|
||||
}
|
||||
requiredstuff.conf_me = 1;
|
||||
return errors;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue