jabberd2
2.2.17
Main Page
Data Structures
Files
File List
Globals
sm
mod_validate.c
Go to the documentation of this file.
1
/*
2
* jabberd - Jabber Open Source Server
3
* Copyright (c) 2002 Jeremie Miller, Thomas Muldowney,
4
* Ryan Eatmon, Robert Norris
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19
*/
20
21
#include "
sm.h
"
22
30
static
mod_ret_t
_validate_in_sess
(
mod_instance_t
mi,
sess_t
sess,
pkt_t
pkt)
31
{
32
/* only want message, presence and iq */
33
if
(!(pkt->
type
&
pkt_MESSAGE
|| pkt->
type
&
pkt_PRESENCE
|| pkt->
type
&
pkt_IQ
|| pkt->
type
&
pkt_S10N
)) {
34
log_debug
(
ZONE
,
"we only take message, presence and iq packets"
);
35
return
-
stanza_err_BAD_REQUEST
;
36
}
37
38
return
mod_PASS
;
39
}
40
41
static
mod_ret_t
_validate_in_router
(
mod_instance_t
mi,
pkt_t
pkt)
42
{
43
return
_validate_in_sess
(mi, NULL, pkt);
44
}
45
46
DLLEXPORT
int
module_init
(
mod_instance_t
mi,
char
*arg) {
47
module_t
mod = mi->
mod
;
48
49
if
(mod->
init
)
return
0;
50
51
mod->
in_sess
=
_validate_in_sess
;
52
mod->
in_router
=
_validate_in_router
;
53
54
return
0;
55
}
Generated by
1.8.1.1