blob: 216e99ccd6b7b24ab338027c63bdb6804f4e03ec [file] [log] [blame]
Benny Prijono8fe2ed52007-02-26 22:31:06 +00001/* $Id$ */
2/*
Benny Prijono32177c02008-06-20 22:44:47 +00003 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono8fe2ed52007-02-26 22:31:06 +00004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20static int decode_test(void)
21{
22 /* Invalid message type */
23
24 /* Short message */
25
26 /* Long, random message */
27
28 /* Message length in header is shorter */
29
30 /* Message length in header is longer */
31
32 /* Invalid magic */
33
34 /* Attribute length is not valid */
35
36 /* Unknown mandatory attribute type should generate error */
37
38 /* Unknown but non-mandatory should be okay */
39
40 /* String/binary attribute length is larger than the message */
41
42 /* Valid message with MESSAGE-INTEGRITY */
43
44 /* Valid message with FINGERPRINT */
45
46 /* Valid message with MESSAGE-INTEGRITY and FINGERPRINT */
47
48 /* Another attribute not FINGERPRINT exists after MESSAGE-INTEGRITY */
49
50 /* Another attribute exists after FINGERPRINT */
51
52 return 0;
53}
54
55static int decode_verify(void)
56{
57 /* Decode all attribute types */
58 return 0;
59}
60
61static int auth_test(void)
62{
63 /* REALM and USERNAME is present, but MESSAGE-INTEGRITY is not present.
64 * For short term, must with reply 401 without REALM.
65 * For long term, must reply with 401 with REALM.
66 */
67
68 /* USERNAME is not present, server must respond with 432 (Missing
69 * Username).
70 */
71
72 /* If long term credential is wanted and REALM is not present, server
73 * must respond with 434 (Missing Realm)
74 */
75
76 /* If REALM doesn't match, server must respond with 434 (Missing Realm)
77 * too, containing REALM and NONCE attribute.
78 */
79
80 /* When long term authentication is wanted and NONCE is NOT present,
81 * server must respond with 435 (Missing Nonce), containing REALM and
82 * NONCE attribute.
83 */
84
85 /* Simulate 438 (Stale Nonce) */
86
87 /* Simulate 436 (Unknown Username) */
88
89 /* When server wants to use short term credential, but request has
90 * REALM, reject with .... ???
91 */
92
93 /* Invalid HMAC */
94
95 /* Valid static short term, without NONCE */
96
97 /* Valid static short term, WITH NONCE */
98
99 /* Valid static long term (with NONCE */
100
101 /* Valid dynamic short term (without NONCE) */
102
103 /* Valid dynamic short term (with NONCE) */
104
105 /* Valid dynamic long term (with NONCE) */
106
107 return 0;
108}
109
110
111int stun_test(void)
112{
113 decode_verify();
114 decode_test();
115 auth_test();
116 return 0;
117}
118