I need a quick fix on the module i'm developing

These are old archives. They are kept for historic purposes only.
Post Reply
sup_stephen
Posts: 3
Joined: Wed Jun 20, 2007 10:07 am

I need a quick fix on the module i'm developing

Post by sup_stephen »

I've decided to dedicate myself to module coding/learning the ins and outs of unrealircd. I'm slightly new, so forgive me if i've overlooked something. I'm developing a module that will stop people from joining any channel that isn't listed as an official channel if they've been 'chlined'

The problem is on the override function, i'm assuming i've made an error in the check against the official_channels block.

Code: Select all

int chline_join_override(Cmdoverride *ovr, aClient *cptr, aClient *sptr, int parc, char *parv[]) 
{
	aChannel *chptr;
	chptr = find_channel(parv[1], NULL);
	ConfigItem_offchans *walker;
	for (walker = conf_offchans; walker; walker = (ConfigItem_offchans *)walker->next)
		{		
			if (strcmp(walker->chname, chptr->chname) == 0 && HasUmodeCh(sptr))
				sendto_one(sptr, "You have been banned from joining non-official channels.");
			else
				CallCmdoverride(overide, cptr, sptr, parc, parv); /* let the original command have it */
	}
}

I also need to point out that the reason I haven't checked to see if official_channels is defined is because it checks for it during the beginning stages and fails to load if it isn't. There are no compile errors, but there's a servercrash when the join command is used. Forgive me if i've made a stupid mistake,
I don't need a really huge handout, just point me in the direction of what i'm doing wrong :D
Jobe
Official supporter
Posts: 1180
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Post by Jobe »

I know youre mainly doing it as a learning experiance, but do you realise that there is a way to restrict which channels users can join by using a combination of a deny channel block for the channel mask "*" and allow channel blocks for each official channel.

Since updating the official-channels block has to be done in the config too it shouldnt be that much of a problem.
sup_stephen
Posts: 3
Joined: Wed Jun 20, 2007 10:07 am

Post by sup_stephen »

Jobe1986 wrote:I know youre mainly doing it as a learning experiance, but do you realise that there is a way to restrict which channels users can join by using a combination of a deny channel block for the channel mask "*" and allow channel blocks for each official channel.

Since updating the official-channels block has to be done in the config too it shouldnt be that much of a problem.

Yeah, I do, but it doesn't restrict just individual users. It is mainly just a learning experience, but i also wanted to use it as a way to stop people who use user-created channels in a negative way such as spam/advertising/warez/porn/etc. I realise you could block the channels by using the deny channel block, however... a creative name can get around that. if i deny'd the channel, they could change the name and register another. However, if i disallow them to join any new channels, they couldn't create any new channels. I could forbid them services access, but then they could still create the channel and keep a bot or something to preserve modes. This seemed logical to me. The purpose isn't to block EVERY user from having a channel, just the misbehaving ones.
Jobe
Official supporter
Posts: 1180
Joined: Wed May 03, 2006 7:09 pm
Location: United Kingdom

Post by Jobe »

You could use a deny channel block to deny ALL channels using the mask "*" as I said, and then add an allow channel for specific channels.

With a deny channel on "*" NOBODY except opers can get around it, not even with a creative name simply because * matchs EVERYTHING where allow channels then override the deny channel allowing you to deny all and then allow specific.
sup_stephen
Posts: 3
Joined: Wed Jun 20, 2007 10:07 am

Post by sup_stephen »

Yes I am familiar with the concept of * :D What i'm trying to say is I don't want to COMPLETELY block people from using user created channels. what i'm saying is, i want to block certain users from joining them. With a deny block, i cant choose which user cant join the channel, it simply blocks everyone except IRCops. With the module, I issue a command (/chline) and it sets a custom usermode +U on the person. Then if that person tries to join a channel that isn't official, they cant. However, if someone ELSE who i DIDNT chline wanted to join the channel, they could.
Trocotronic
Posts: 7
Joined: Sun Aug 22, 2004 4:38 pm
Contact:

Post by Trocotronic »

Firstly, if you uircd crashes, you may check core files.
Secondly, you should check if find_channel is returning null pointer. If it does, chptr->chname will crash.
Post Reply