Beispiel #1
0
void AddEvent( ModuleEvent *eventptr )
{
	Module *mod_ptr;

	if( !eventptr )
	{
		nlog( LOG_ERROR, "AddEvent: eventptr passed as NULL" );
		return;
	}
	mod_ptr = GET_CUR_MODULE();
	dlog( DEBUG9, "AddEvent: adding %s to %s", EventStrings[eventptr->event], mod_ptr->info->name );
#ifdef USE_PERL
	if( ( eventptr->flags & EVENT_FLAG_PERLCALL ) )
	{
		if( ( mod_ptr->pm && !mod_ptr->pm->event_list ) )
			mod_ptr->pm->event_list = ns_calloc( sizeof( ModuleEvent * ) * EVENT_COUNT );
		mod_ptr->pm->event_list[eventptr->event] = eventptr;
	}
	else
#endif /* USE_PERL */
	{
		if( !eventptr->handler )
		{
			nlog( LOG_ERROR, "AddEvent: missing handler for %s in module %s", EventStrings[eventptr->event], mod_ptr->info->name );
			return;
		}
		if( !mod_ptr->event_list )
			mod_ptr->event_list = ns_calloc( sizeof( ModuleEvent * ) * EVENT_COUNT );
		mod_ptr->event_list[eventptr->event] = eventptr;
	}
	if( eventptr->event == EVENT_NICKIP )
		me.want_nickip = 1; 		
}
Beispiel #2
0
int InitTLDStatistics( void )
{
	TLD *t;

	SET_SEGV_LOCATION();
	tldstatlist = nv_list_create( LISTCOUNT_T_MAX, "StatServ-TLD", nv_ss_tld, NV_FLAGS_RO, NULL );
	if( !tldstatlist )
	{
		nlog( LOG_CRITICAL, "Unable to create TLD list" );
		return NS_FAILURE;
	}
	gi = NULL;
	/* now open the various DB's */
	if( GeoIP_db_avail( GEOIP_COUNTRY_EDITION ) )
	{
		gi = GeoIP_open_type( GEOIP_COUNTRY_EDITION, GEOIP_STANDARD );
		if( gi != NULL )
			nlog( LOG_NOTICE, "Loaded %s GeoIP Database", GeoIPDBDescription[GEOIP_COUNTRY_EDITION] );
		else
			nlog( LOG_WARNING, "%s Database may be corrupt", GeoIPDBDescription[GEOIP_COUNTRY_EDITION] );
	}
	else
	{
		nlog( LOG_WARNING, "GeoIP Database is not available. TLD stats will not be available" );
	}
	t = ns_calloc( sizeof( TLD ) );
	ircsnprintf( t->tld, 5, UNKNOWN_COUNTRY_CODE );
	strlcpy( t->country, "Unknown", 8 );
	lnode_create_append( tldstatlist, t );
	DBAOpenTable( TLD_TABLE );
	LoadTLDStats();
	return NS_SUCCESS;
}
Beispiel #3
0
void AddTLDUser( const Client *u )
{
	const char *country_name;
	const char *country_code;
	TLD *t = NULL;

	if( !gi )
		return;
	country_code = GeoIP_country_code_by_addr( gi, u->hostip );
	if( country_code )
	{
		t = lnode_find( tldstatlist, country_code, FindTLD );
		if( !t )
		{
			country_name = GeoIP_country_name_by_addr( gi, u->hostip );
			t = ns_calloc( sizeof( TLD ) );
			strlcpy( t->tld, country_code, 5 );
			strlcpy( t->country, country_name, 32 );
			lnode_create_append( tldstatlist, t );
		}
	}
	else
	{
		t = lnode_find( tldstatlist, UNKNOWN_COUNTRY_CODE, FindTLD );
	}
	IncStatistic( &t->users );
}
Beispiel #4
0
static Thread *
NewThread(ThreadArg *argPtr)
{
    Thread *thrPtr;
    int stack;

    thrPtr = ns_calloc(1, sizeof(Thread));
    Ns_GetTime(&thrPtr->ctime);
    thrPtr->tid = Ns_ThreadId();
    sprintf(thrPtr->name, "-thread%d-", thrPtr->tid);
    if (argPtr == NULL) {
    	thrPtr->flags = FLAG_DETACHED;
    } else {
	thrPtr->flags = argPtr->flags;
	thrPtr->proc = argPtr->proc;
	thrPtr->arg = argPtr->arg;
	strcpy(thrPtr->parent, argPtr->parent);
    }
    stack = NsGetStack(&thrPtr->stackaddr, &thrPtr->stacksize);
    if (stack) {
	thrPtr->flags |= FLAG_HAVESTACK;
	if (stack < 0) {
	    thrPtr->flags |= FLAG_STACKDOWN;
	}
    }
    Ns_TlsSet(&key, thrPtr);
    Ns_MutexLock(&threadlock);
    thrPtr->nextPtr = firstThreadPtr;
    firstThreadPtr = thrPtr;
    Ns_MutexUnlock(&threadlock);
    return thrPtr;
}
Beispiel #5
0
static int LoadAccessListEntry( void *data, int size )
{
	AccessEntry *access;
	
	if( size != sizeof( AccessEntry ) )
		return NS_FALSE;
	access = ns_calloc( sizeof( AccessEntry ) );
	os_memcpy( access, data, sizeof( AccessEntry ) );
	hnode_create_insert( accesshash, access, access->nick );
	return NS_FALSE;
}
Beispiel #6
0
static int new_tld( void *data, int size )
{
	TLD *t;

	if( size != sizeof( TLD ) )
	{
		nlog( LOG_CRITICAL, "TLD data size invalid" );		
		return NS_FALSE;
	}
	t = ns_calloc( sizeof( TLD ) );
	os_memcpy( t, data, sizeof( TLD ) );
	lnode_create_append( tldstatlist, t );
	return NS_FALSE;
}
Beispiel #7
0
void AddStringToList( char ***List, char S[], int *C )
{
	static unsigned int numargs = 8;

	if( *C == 0 ) {
		numargs = 8;
		*List = ns_calloc( sizeof( char * ) * numargs );
	} else if( *C  == numargs ) {
		numargs += 8;
		*List = ns_realloc( *List, sizeof( char * ) * numargs );
	}
	( *List )[*C] = S;
	++*C;
}
Beispiel #8
0
static Timer *new_timer( const char *name )
{
	Timer *timer;

	SET_SEGV_LOCATION();
	if( list_isfull( timerlist ) )
	{
		nlog( LOG_WARNING, "new_timer: timer hash is full" );
		return NULL;
	}
	dlog( DEBUG2, "new_timer: %s", name );
	timer = ns_calloc( sizeof( Timer ) );
	strlcpy( timer->name, name, MAX_MOD_NAME );
	return timer;
}
Beispiel #9
0
void
Ns_MutexInit(Ns_Mutex *mutex)
{
    Mutex *mutexPtr;
    static unsigned int nextid;

    mutexPtr = ns_calloc(1, sizeof(Mutex));
    mutexPtr->lock = NsLockAlloc();
    Ns_MasterLock();
    mutexPtr->nextPtr = firstMutexPtr;
    firstMutexPtr = mutexPtr;
    mutexPtr->id = nextid++;
    sprintf(mutexPtr->name, "mu%d", mutexPtr->id);
    Ns_MasterUnlock();
    *mutex = (Ns_Mutex) mutexPtr;
}
Beispiel #10
0
unsigned int ircsplitbuf( char *buf, char ***argv, int colon_special )
{
	unsigned int argvsize = 8;
	unsigned int argc;
	char *s;
	int colcount = 0;
	
	SET_SEGV_LOCATION();
	if( buf == NULL )
		return 0;
	*argv = ns_calloc( sizeof( char * ) * argvsize );
	argc = 0;
	/*if( *buf == ':' )
		buf++;*/
	while( *buf != '\0' ) {
		if( argc == argvsize ) {
			argvsize += 8;
			*argv = ns_realloc( *argv, sizeof( char * ) * argvsize );
		}
		if( ( *buf == ':' ) && ( colcount < 1 ) ) {
			buf++;
			colcount++;
			if( colon_special ) {
				( *argv )[argc++] = buf;
				break;
			}
		}
		s = strpbrk( buf, " " );
		if( s ) {
			*s++ = 0;
			while( isspace( *s ) )
				s++;
		} else {
			s = buf + strnlen( buf, BUFSIZE );
		}
		if( *buf == 0 ) {
			buf++;
		}
		( *argv )[argc++] = buf;
		buf = s;
	}
	return argc;
}
static Thread *
NewThread(void)
{
    Thread *thrPtr;
    static unsigned int nextuid = 0;
    pthread_t tid;
#if defined(HAVE_PTHREAD_GETATTR_NP)
    static char *func = "NewThread";
    pthread_attr_t attr;
    int err;
#endif

    thrPtr = ns_calloc(1, sizeof(Thread));
    Ns_MutexLock(&uidlock);
    thrPtr->uid = nextuid++;
    Ns_MutexUnlock(&uidlock);

    tid = pthread_self();
#if defined(HAVE_PTHREAD_GETATTR_NP)
    err = pthread_getattr_np(tid, &attr);
    if (err != 0) {
	NsThreadFatal(func, "pthread_getattr_np", err);
    }
    err = pthread_attr_getstackaddr(&attr, &thrPtr->stackaddr);
    if (err != 0) {
	NsThreadFatal(func, "pthread_attr_getstackaddr", err);
    }
    err = pthread_attr_getstacksize(&attr, &thrPtr->stacksize);
    if (err != 0) {
	NsThreadFatal(func, "pthread_attr_getstacksize", err);
    }
    thrPtr->stacksize -= guardsize;
    err = pthread_attr_destroy(&attr);
    if (err != 0) {
	NsThreadFatal(func, "pthread_attr_destroy", err);
    }
#elif defined(HAVE_PTHREAD_GET_STACKADDR_NP)
    thrPtr->stackaddr = pthread_get_stackaddr_np(tid);
    thrPtr->stacksize = pthread_get_stacksize_np(tid) - guardsize;
#endif
    return thrPtr;
}
Beispiel #12
0
static int AccessAdd( const CmdParams *cmdparams )
{
	int level = 0;
	AccessEntry *access;
	
	SET_SEGV_LOCATION();
	dlog(DEBUG1, "Current Run Level %s", GET_CUR_MODNAME());
	if( cmdparams->ac < 3 ) 
	{
		return NS_ERR_NEED_MORE_PARAMS;
	}
	if( hash_lookup( accesshash, cmdparams->av[1] ) ) 
	{
		irc_prefmsg( NULL, cmdparams->source, "Entry for %s already exists", cmdparams->av[1] );
		return NS_SUCCESS;
	}
	if( !strstr( cmdparams->av[2], "@" ) ) 
	{
		irc_prefmsg( NULL, cmdparams->source, "Invalid format for hostmask. Must be of the form user@host." );
		return NS_ERR_SYNTAX_ERROR;
	}
	level = atoi( cmdparams->av[3] );
	if( level < 0 || level > NS_ULEVEL_ROOT) 
	{
		irc_prefmsg( NULL, cmdparams->source, "Level out of range. Valid values range from 0 to 200." );
		return NS_ERR_PARAM_OUT_OF_RANGE;
	}
	access = ns_calloc( sizeof( AccessEntry) );
	strlcpy( access->nick, cmdparams->av[1], MAXNICK );
	strlcpy( access->mask, cmdparams->av[2], USERHOSTLEN );
	access->level = level;
 	hnode_create_insert( accesshash, access, access->nick );
	/* save the entry */
	DBAStore( "AccessList", access->nick, ( void *)access, sizeof( AccessEntry) );
	irc_prefmsg( NULL, cmdparams->source, "Successfully added %s for host %s with level %d to access list", access->nick, access->mask, access->level );
	return NS_SUCCESS;
}
Beispiel #13
0
static int
JsInit(Tcl_Interp *interp, void *arg) 
{
	jsEnv *jsEnvPtr;
	
	Ns_TlsAlloc(&tls, JsCleanup);
	
	jsEnvPtr = ns_calloc(1, sizeof(jsEnv));
	
	jsEnvPtr->runtime = JS_NewRuntime(8L * 1024L * 1024L);
	jsEnvPtr->context = JS_NewContext(jsEnvPtr->runtime, 8192);
	jsEnvPtr->object = JS_NewObject(jsEnvPtr->context, NULL, NULL, NULL);
	
	JS_InitStandardClasses(jsEnvPtr->context, jsEnvPtr->object);
	JS_SetErrorReporter(jsEnvPtr->context, JsLogError);
	
	Ns_TlsSet(&tls, jsEnvPtr);
	
	Ns_Log(Debug, "JsInit: %p", jsEnvPtr);
	
	Tcl_CreateObjCommand(interp, "js.eval", JsEvalObjCmd, NULL, NULL);
	
	return TCL_OK;
}
Ns_Request *
Ns_ParseRequestEx(char *line, Tcl_Encoding encoding)
{
    char       *url;
    char       *p;
    Ns_DString  ds;
    Ns_Request *request;
    unsigned int major, minor;
    int i;

    request = ns_calloc(1, sizeof(Ns_Request));
    Ns_DStringInit(&ds);

    /*
     * Make a copy of the line to chop up. Make sure it isn't blank.
     */
    
    if (line == NULL) {
        goto done;
    }
    Ns_DStringAppend(&ds, line);
    line = Ns_StrTrim(ds.string);
    if (*line == '\0') {
        goto done;
    }

    /*
     * Save the trimmed line for logging purposes.
     */
    
    request->line = ns_strdup(line);

    /*
     * Look for the minimum of method and url.
     */
    
    url = line;
    while (*url != '\0' && !isspace(UCHAR(*url))) {
        ++url;
    }
    if (*url == '\0') {
        goto done;
    }
    *url++ = '\0';
    while (*url != '\0' && isspace(UCHAR(*url))) {
        ++url;
    }
    if (*url == '\0') {
        goto done;
    }
    request->method = ns_strdup(line);


    /*
     * Look for a valid version.
     */
    
    request->version = 0.0;
    p = NsFindVersion(url, &major, &minor);
    if (p != NULL) {
	*p = '\0';
	i = 10;
	while ((minor / i) > 0) {
	    i *= 10;
	}
	request->version = major + (double) minor / i;
    }
    url = Ns_StrTrim(url);
    if (*url == '\0') {
        goto done;
    }

    /*
     * Look for a protocol in the URL.
     */
    
    request->protocol = NULL;
    request->host = NULL;
    request->port = 0;
    if (*url != '/') {
        p = url;
        while (*p != '\0' && *p != '/' && *p != ':') {
            ++p;
        }
        if (*p == ':') {

            /*
             * Found a protocol - copy it and search for host:port.
             */

	    *p++ = '\0';
            request->protocol = ns_strdup(url);
            url = p;
            if ((strlen(url) > 3) && (*p++ == '/')
                && (*p++ == '/') && (*p != '\0') && (*p != '/')) {
                char *h;

                h = p;
                while (*p != '\0' && *p != '/') {
                    ++p;
                }
                if (*p == '/') {
                    *p++ = '\0';
                }
                url = p;
                p = strchr(h, ':');
                if (p != NULL) {
                    *p++ = '\0';
		    if (Tcl_GetInt(NULL, p, &i) != TCL_OK) {
			goto done;
		    }
		    request->port = (unsigned short) i;
                }
                request->host = ns_strdup(h);
            }
        }
    }
    SetUrl(request, url, encoding);

done:
    if (request->url == NULL) {
        Ns_FreeRequest(request);
        request = NULL;
    }
    Ns_DStringFree(&ds);
    return request;
}
Beispiel #15
0
nspointer ns_io_calloc( nssize num, nssize size, NsIO *io )
	{
	NS_USE_VARIABLE( io );
	return ns_calloc( num, size );
	}
Beispiel #16
0
int unload_module( const char *modname, Client * u )
{
	Module *mod_ptr;
	hnode_t *modnode;
	int moduleindex;
	int( *ModFini )( void );
	CmdParams *cmdparams;

	SET_SEGV_LOCATION();
	/* Check to see if module is loaded */
	modnode = hash_lookup( modulehash, modname );
	if( !modnode ) {
		if( u ) {
			irc_prefmsg( ns_botptr, u, __( "Module %s not loaded, try /msg %s modlist", u ), modname, ns_botptr->name );
			irc_chanalert( ns_botptr, _( "%s tried to unload %s but its not loaded" ), u->name, modname );
		}
		return NS_FAILURE;
	}
	mod_ptr = hnode_get( modnode );
	irc_chanalert( ns_botptr, _( "Unloading module %s" ), modname );

	MQModuleDelcmd(mod_ptr);
	
	if( mod_ptr->info->flags & MODULE_FLAG_AUTH )
		DelAuthModule( mod_ptr );
	if( mod_ptr->info->flags & MODULE_FLAG_CTCP_VERSION )
		me.versionscan --;
	moduleindex = mod_ptr->modnum;
	/* canx any DNS queries used by this module */
	canx_dns( mod_ptr );
	/* Delete any timers used by this module */
	del_timers( mod_ptr );
	/* Delete any sockets used by this module */
	del_sockets( mod_ptr );
	/* Delete any associated event list */
	FreeEventList( mod_ptr );

#ifdef USE_PERL
	/* unload any extensions first */
	if ((mod_ptr->pm) && (mod_ptr->pm->type == TYPE_EXTENSION)) {
		PerlExtensionFini(mod_ptr);
		unload_perlextension(mod_ptr);
	}
#endif /* USE_PERL */

	/* Remove from the module hash so we dont call events for this module 
	 * during signoff 
	 */
	dlog( DEBUG1, "Deleting Module %s from Hash", modname );
	hash_delete_destroy_node( modulehash, modnode );		

	/* now determine if its perl, or standard module */
	if( IS_STANDARD_MOD( mod_ptr ) ) {
		/* call ModFini( replacement for library __fini() call */
		ModFini = ns_dlsym( ( int * ) mod_ptr->handle, "ModFini" );
		if( ModFini ) {
			SET_RUN_LEVEL( mod_ptr );
			( *ModFini )();
			RESET_RUN_LEVEL();
			SET_SEGV_LOCATION();
		}
#ifdef USE_PERL
	} else {
		SET_RUN_LEVEL( mod_ptr );
		PerlModFini( mod_ptr );
		RESET_RUN_LEVEL();
		SET_SEGV_LOCATION();
#endif /* USE_PERL */
	}
	/* Delete any bots used by this module. Done after ModFini, so the bot 
	 * can still send messages during ModFini 
	 */
	DelModuleBots( mod_ptr );
	/* Close module */
	irc_globops( NULL, _( "%s Module unloaded" ), modname );
	SET_RUN_LEVEL( mod_ptr );
	if( mod_ptr->info->flags & MODULE_FLAG_LOCAL_EXCLUDES ) 
	{
		FiniModExcludes( mod_ptr );
	}
	cmdparams = ns_calloc( sizeof( CmdParams ) );
	cmdparams->param = ( char * )modname;
	SendAllModuleEvent( EVENT_MODULEUNLOAD, cmdparams );
	ns_free( cmdparams );
	RESET_RUN_LEVEL();

	SET_RUN_LEVEL( mod_ptr );
	DBACloseDatabase();
	/* Cleanup moddata */
	CleanupUserModdata();
	CleanupServerModdata();
	CleanupChannelModdata();

	if( IS_STANDARD_MOD( mod_ptr ) )
		ns_dlclose( mod_ptr->handle );
#ifdef USE_PERL
	else
		unload_perlmod( mod_ptr );
#endif /* USE_PERL */
	RESET_RUN_LEVEL();
	ns_free( mod_ptr );
	/* free the module number */
	if( moduleindex >= 0 ) {
		dlog( DEBUG1, "Free %d from Module Numbers", moduleindex );
		ModList[moduleindex] = NULL;
	}
	return NS_SUCCESS;
}
Beispiel #17
0
static Module *load_stdmodule( const char *modfilename, Client * u )
{
	int err;
	void *handle;
	ModuleInfo *infoptr = NULL;
	ModuleEvent *eventlistptr = NULL;
	Module *mod_ptr = NULL;
	int( *ModInit )( void );
	CmdParams *cmd;

	SET_SEGV_LOCATION();
	if( hash_isfull( modulehash ) ) {
		load_module_error( u, modfilename, __( "module list is full", u ) );
		return NULL;
	} 
	handle = ns_dlopen( modfilename, RTLD_NOW | RTLD_GLOBAL );
	if( !handle ) {
		load_module_error( u, modfilename, ns_dlerrormsg, modfilename );
		return NULL;
	}
	infoptr = ns_dlsym( handle, "module_info" );
	if( infoptr == NULL ) {
		load_module_error( u, modfilename, __( "missing module_info", u ) );
		ns_dlclose( handle );
		return NULL;
	}
	/* Check module was built for this version of NeoStats */
	if( ircstrncasecmp( NEOSTATS_VERSION, infoptr->neostats_version, VERSIONSIZE ) !=0 ) {
		load_module_error( u, modfilename, __( "module built with an old version of NeoStats and must be rebuilt.", u ) );
		ns_dlclose( handle );
		return NULL;
	}
	if( !infoptr->copyright || ircstrcasecmp( infoptr->copyright[0], "Copyright (c) <year>, <your name>" ) ==0 ) {
		load_module_error( u, modfilename, __( "missing copyright text.", u ) );
		ns_dlclose( handle );
		return NULL;
	}	
	if( !infoptr->about_text || ircstrcasecmp( infoptr->about_text[0], "About your module" ) ==0 ) {
		load_module_error( u, modfilename, __( "missing about text.", u ) );
		ns_dlclose( handle );
		return NULL;
	}	
	/* Check that the Module hasn't already been loaded */
	if( hash_lookup( modulehash, infoptr->name ) ) {
		ns_dlclose( handle );
		load_module_error( u, modfilename, __( "already loaded", u ) );
		return NULL;
	}
	/* Check we have require PROTOCOL/FEATURE support for module */
	if( ( infoptr->features & ircd_srv.features ) != infoptr->features ) {
		load_module_error( u, modfilename, __( "Required module features not available on this IRCd.", u ), modfilename );
		ns_dlclose( handle );
		return NULL;
	}
	/* Lookup ModInit( replacement for library __init() call */
	ModInit = ns_dlsym( ( int * ) handle, "ModInit" );
	if( !ModInit ) {
		load_module_error( u, modfilename, __( "missing ModInit.", u ) );
		ns_dlclose( handle );
		return NULL;
	}
	/* Allocate module */
	mod_ptr = ( Module * ) ns_calloc( sizeof( Module ) );
	dlog( DEBUG1, "Module internal name: %s", infoptr->name );
	dlog( DEBUG1, "Module description: %s", infoptr->description );
	mod_ptr->info = infoptr;
	mod_ptr->handle = handle;
	insert_module( mod_ptr );
	mod_ptr->type = MOD_TYPE_STANDARD;
	/* Extract pointer to event list */
	eventlistptr = ns_dlsym( handle, "module_events" );
	if( eventlistptr ) {
		SET_RUN_LEVEL( mod_ptr );
		AddEventList( eventlistptr );
		RESET_RUN_LEVEL();
	}
    /* For Auth modules, register auth function */
	if( infoptr->flags & MODULE_FLAG_AUTH ) {
		if( AddAuthModule( mod_ptr ) != NS_SUCCESS ) {
			load_module_error( u, modfilename, __( "Unable to load auth module: %s missing ModAuthUser function",u ), infoptr->name );
			unload_module( mod_ptr->info->name, NULL );
			return NULL;
		}
	}
    /* Module side user authentication for e.g. SecureServ helpers 
     * Not available on auth modules */
	if( !( infoptr->flags & MODULE_FLAG_AUTH ) )
		mod_ptr->authcb = ns_dlsym( ( int * ) handle, "ModAuthUser" );
	if( infoptr->flags & MODULE_FLAG_CTCP_VERSION )
		me.versionscan ++;		
	/* assign a module number to this module */
	assign_mod_number( mod_ptr );

	SET_SEGV_LOCATION();
	SET_RUN_LEVEL( mod_ptr );
	DBAOpenDatabase();
	err = ( *ModInit )(); 
	RESET_RUN_LEVEL();
	if( err < 1 || IsModuleError( mod_ptr ) ) {
		load_module_error( u, modfilename, __( "See %s.log for further information.",u ), mod_ptr->info->name );
		unload_module( mod_ptr->info->name, NULL );
		return NULL;
	}
	if( infoptr->flags & MODULE_FLAG_LOCAL_EXCLUDES ) 
	{
		SET_RUN_LEVEL( mod_ptr );	
		InitExcludes( mod_ptr );
		RESET_RUN_LEVEL();
	}
	SET_SEGV_LOCATION();

	/* Let this module know we are online if we are! */
	if( IsNeoStatsSynched() ) {
		if( SynchModule( mod_ptr ) != NS_SUCCESS || IsModuleError( mod_ptr ) )
		{
			load_module_error( u, modfilename, __( "See %s.log for further information.", u ), mod_ptr->info->name );
			unload_module( mod_ptr->info->name, NULL );
			return NULL;
		}
	}
	cmd = ns_calloc( sizeof( CmdParams ) );
	cmd->param = ( char * )infoptr->name;
	SendAllModuleEvent( EVENT_MODULELOAD, cmd );
	ns_free( cmd );
	if( u ) {
		irc_prefmsg( ns_botptr, u, __( "Module %s loaded, %s",u ), infoptr->name, infoptr->description );
		irc_globops( NULL, _( "Module %s loaded" ), infoptr->name );
	}
	return mod_ptr;
}
Beispiel #18
0
void *
Ns_Calloc(size_t nelem, size_t elsize)
{
    return ns_calloc(nelem, elsize);
}
Beispiel #19
0
void *
Ns_PoolCalloc(Ns_Pool *pool, size_t nelem, size_t elsize)
{
    return ns_calloc(nelem, elsize);
}