Debian Codegraph @

src/withsctp/sctp_socket.c

raw symbols SCIP
1 /* Wrap socket() to force the protocol to SCTP for STREAM connections.
2 *
3 * Thanks to Midgard Security Services for
4 * http://www.securiteam.com/tools/3D5PTR5QAE.html
5 * from whence I cribbed the code to find the old socket().
6 *
7 * gcc sctp_socket.c -o sctp_socket.so -ldl -shared -O2 -s
8 * export LD_PRELOAD=./sctp_socket.so
9 *
10 * Copyright 2003 La Monte HP Yarroll <[email protected]>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials provided with
21 * the distribution.
22 * 3. The name of the author may not be used to endorse or promote
23 * products derived from this software without specific prior written
24 * permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
30 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
34 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
36 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38 #include <string.h> /* for strncmp() */
39 #include <stdio.h>
40 #include "sctp_socket.h"cxx . . $ `<file>/src/withsctp/sctp_socket.h`/
41
42 /* IPPROTO_SCTP SHOULD be defined in
43 * /usr/include/linux/in.h but probably isn't.
44 * It is an enum element, not a #define, so we can't easily check.
45 */
46 #define SHOULD_IPPROTO_SCTPcxx . . $ `src/withsctp/sctp_socket.c:46:9`! 132
47
48 int
49 socketcxx . . $ socket(2326284602b0bb2d).(int domain, int type, int protocol)
50 {
51 _sctp_load_libscxx . . $ _sctp_load_libs(49f6e7a06ebc5aa8).();
52
53 if (((PF_INETcxx . . $ `<external>/8962547315054503424/socket.h:45:9`! == domain) || (PF_INET6cxx . . $ `<external>/8962547315054503424/socket.h:53:9`! == domain))
54 && (SOCK_STREAMcxx . . $ `<external>/5956532346368192945/socket_type.h:28:9`! == type)) {
55 protocol = SHOULD_IPPROTO_SCTPcxx . . $ `src/withsctp/sctp_socket.c:46:9`!;
56 }
57
58 return (real_socketcxx . . $ real_socket.)(domain, type, protocol);
59 }