23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
< |
#include "tools.h" |
26 |
> |
#include "list.h" |
27 |
|
#include "modules.h" |
28 |
|
#include "s_log.h" |
29 |
|
#include "ircd.h" |
36 |
|
#include "ircd_defs.h" |
37 |
|
#include "irc_string.h" |
38 |
|
#include "memory.h" |
39 |
– |
#include "list.h" |
39 |
|
|
41 |
– |
/* -TimeMr14C: |
42 |
– |
* I have moved the dl* function definitions and |
43 |
– |
* the two functions (load_a_module / unload_a_module) to the |
44 |
– |
* file dynlink.c |
45 |
– |
* And also made the necessary changes to those functions |
46 |
– |
* to comply with shl_load and friends. |
47 |
– |
* In this file, to keep consistency with the makefile, |
48 |
– |
* I added the ability to load *.sl files, too. |
49 |
– |
* 27/02/2002 |
50 |
– |
*/ |
40 |
|
|
41 |
|
dlink_list mod_list = { NULL, NULL, 0 }; |
42 |
|
|
43 |
|
static const char *core_module_table[] = |
44 |
|
{ |
45 |
|
"m_die.la", |
46 |
+ |
"m_error.la", |
47 |
|
"m_join.la", |
48 |
|
"m_kick.la", |
49 |
|
"m_kill.la", |
93 |
|
}; |
94 |
|
|
95 |
|
|
106 |
– |
extern struct Message error_msgtab; |
107 |
– |
|
96 |
|
/* |
97 |
|
* modules_init |
98 |
|
* |
110 |
|
mod_add_cmd(&modreload_msgtab); |
111 |
|
mod_add_cmd(&modlist_msgtab); |
112 |
|
mod_add_cmd(&modrestart_msgtab); |
125 |
– |
mod_add_cmd(&error_msgtab); |
113 |
|
} |
114 |
|
|
115 |
|
/* mod_find_path() |
315 |
|
* side effects - module is loaded if found. |
316 |
|
*/ |
317 |
|
int |
318 |
< |
load_one_module(char *path, int coremodule) |
318 |
> |
load_one_module(const char *path, int coremodule) |
319 |
|
{ |
320 |
|
dlink_node *ptr = NULL; |
321 |
|
char modpath[PATH_MAX + 1]; |
355 |
|
mo_modload(struct Client *client_p, struct Client *source_p, |
356 |
|
int parc, char *parv[]) |
357 |
|
{ |
358 |
< |
char *m_bn; |
358 |
> |
const char *m_bn = NULL; |
359 |
|
|
360 |
< |
if (!IsAdmin(source_p)) |
360 |
> |
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
361 |
|
{ |
362 |
|
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
363 |
|
me.name, source_p->name); |
364 |
|
return; |
365 |
|
} |
366 |
|
|
367 |
< |
m_bn = basename(parv[1]); |
367 |
> |
m_bn = libio_basename(parv[1]); |
368 |
|
|
369 |
|
if (findmodule_byname(m_bn) != NULL) |
370 |
|
{ |
381 |
|
mo_modunload(struct Client *client_p, struct Client *source_p, |
382 |
|
int parc, char *parv[]) |
383 |
|
{ |
384 |
< |
char *m_bn; |
384 |
> |
const char *m_bn = NULL; |
385 |
|
dlink_node *ptr; |
386 |
|
struct module *modp; |
387 |
|
|
388 |
< |
if (!IsAdmin(source_p)) |
388 |
> |
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
389 |
|
{ |
390 |
|
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
391 |
|
me.name, source_p->name); |
392 |
|
return; |
393 |
|
} |
394 |
|
|
395 |
< |
m_bn = basename(parv[1]); |
395 |
> |
m_bn = libio_basename(parv[1]); |
396 |
|
|
397 |
|
if ((ptr = findmodule_byname(m_bn)) == NULL) |
398 |
|
{ |
425 |
|
mo_modreload(struct Client *client_p, struct Client *source_p, |
426 |
|
int parc, char *parv[]) |
427 |
|
{ |
428 |
< |
char *m_bn; |
428 |
> |
const char *m_bn = NULL; |
429 |
|
dlink_node *ptr; |
430 |
|
struct module *modp; |
431 |
|
int check_core; |
432 |
|
|
433 |
< |
if (!IsAdmin(source_p)) |
433 |
> |
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
434 |
|
{ |
435 |
|
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
436 |
|
me.name, source_p->name); |
437 |
|
return; |
438 |
|
} |
439 |
|
|
440 |
< |
m_bn = basename(parv[1]); |
440 |
> |
m_bn = libio_basename(parv[1]); |
441 |
|
|
442 |
|
if ((ptr = findmodule_byname(m_bn)) == NULL) |
443 |
|
{ |
472 |
|
{ |
473 |
|
const dlink_node *ptr = NULL; |
474 |
|
|
475 |
< |
if (!IsAdmin(source_p)) |
475 |
> |
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
476 |
|
{ |
477 |
|
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
478 |
|
me.name, source_p->name); |
503 |
|
unsigned int modnum = 0; |
504 |
|
dlink_node *ptr = NULL, *ptr_next = NULL; |
505 |
|
|
506 |
< |
if (!IsAdmin(source_p)) |
506 |
> |
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
507 |
|
{ |
508 |
|
sendto_one(source_p, form_str(ERR_NOPRIVILEGES), |
509 |
|
me.name, source_p->name); |
526 |
|
load_core_modules(0); |
527 |
|
|
528 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
529 |
< |
"Module Restart: %u modules unloaded, %lu modules loaded", |
529 |
> |
"Module Restart: %u modules unloaded, %u modules loaded", |
530 |
|
modnum, dlink_list_length(&mod_list)); |
531 |
< |
ilog(L_WARN, "Module Restart: %u modules unloaded, %lu modules loaded", |
531 |
> |
ilog(L_WARN, "Module Restart: %u modules unloaded, %u modules loaded", |
532 |
|
modnum, dlink_list_length(&mod_list)); |
533 |
|
} |