~ubuntu-branches/ubuntu/lucid/inspircd/lucid-security

« back to all changes in this revision

Viewing changes to src/cmd_zline.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi, Darren Blaber, Matt Arnold, Giacomo Catenazzi
  • Date: 2008-03-06 07:56:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080306075647-z8a4phxkn3vo3ajx
Tags: 1.1.17+dfsg-1
[ Darren Blaber ]
* New upstream release, fix /etc/init.d/inspircd stop.
* Fix the postrm script so there is no duplicate update-rc.d
* Fix the manpage so there are no more errors in it

[ Matt Arnold ]
*  Fix prerm so it works (Closes: #466924)

[ Giacomo Catenazzi ]
* Added me as uploader
* Add again support of dpatch in debian/rules
* Build sources only once!
* Correct make clean target, not to include generated ./inspircd on sources
* Don't change permission of configuration files, when starting inspircd
  (separation of policy and program).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *       | Inspire Internet Relay Chat Daemon |
3
3
 *       +------------------------------------+
4
4
 *
5
 
 *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
 
5
 *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6
6
 * See: http://www.inspircd.org/wiki/index.php/Credits
7
7
 *
8
8
 * This program is free but copyrighted software; see
27
27
 
28
28
CmdResult cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
29
29
{
 
30
        std::string target = parameters[0];
 
31
 
30
32
        if (pcnt >= 3)
31
33
        {
32
 
                if (strchr(parameters[0],'@') || strchr(parameters[0],'!'))
 
34
                if (strchr(target.c_str(),'@') || strchr(target.c_str(),'!'))
33
35
                {
34
36
                        user->WriteServ("NOTICE %s :*** You cannot include a username or nickname in a zline, a zline must ban only an IP mask",user->nick);
35
37
                        return CMD_FAILURE;
36
38
                }
37
39
 
38
 
                if (ServerInstance->IPMatchesEveryone(parameters[0],user))
 
40
                userrec *u = ServerInstance->FindNick(target.c_str());
 
41
                
 
42
                if (u)
 
43
                {
 
44
                        target = u->GetIPString();
 
45
                }
 
46
 
 
47
                if (ServerInstance->IPMatchesEveryone(target.c_str(),user))
39
48
                        return CMD_FAILURE;
40
49
 
41
50
                long duration = ServerInstance->Duration(parameters[1]);
42
 
                if (ServerInstance->XLines->add_zline(duration,user->nick,parameters[2],parameters[0]))
 
51
                if (ServerInstance->XLines->add_zline(duration,user->nick,parameters[2],target.c_str()))
43
52
                {
44
53
                        int to_apply = APPLY_ZLINES;
45
54
 
46
 
                        FOREACH_MOD(I_OnAddZLine,OnAddZLine(duration, user, parameters[2], parameters[0]));
 
55
                        FOREACH_MOD(I_OnAddZLine,OnAddZLine(duration, user, parameters[2], target.c_str()));
47
56
                        if (!duration)
48
57
                        {
49
58
                                to_apply |= APPLY_PERM_ONLY;
50
 
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s.",user->nick,parameters[0]);
 
59
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s.",user->nick,target.c_str());
51
60
                        }
52
61
                        else
53
62
                        {
54
63
                                time_t c_requires_crap = duration + ServerInstance->Time();
55
 
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s",user->nick,parameters[0],
 
64
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s",user->nick,target.c_str(),
56
65
                                                ServerInstance->TimeString(c_requires_crap).c_str());
57
66
                        }
58
67
                        ServerInstance->XLines->apply_lines(to_apply);
59
68
                }
60
69
                else
61
70
                {
62
 
                        user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick,parameters[0]);
 
71
                        user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick,target.c_str());
63
72
                }
64
73
        }
65
74
        else
66
75
        {
67
 
                if (ServerInstance->XLines->del_zline(parameters[0]))
 
76
                if (ServerInstance->XLines->del_zline(target.c_str()))
68
77
                {
69
 
                        FOREACH_MOD(I_OnDelZLine,OnDelZLine(user, parameters[0]));
70
 
                        ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Z-line on %s.",user->nick,parameters[0]);
 
78
                        FOREACH_MOD(I_OnDelZLine,OnDelZLine(user, target.c_str()));
 
79
                        ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Z-line on %s.",user->nick,target.c_str());
71
80
                }
72
81
                else
73
82
                {
74
 
                        user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,parameters[0]);
 
83
                        user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,target.c_str());
75
84
                        return CMD_FAILURE;
76
85
                }
77
86
        }