| 1 | #include"main.h" |
|---|
| 2 | |
|---|
| 3 | struct service help; |
|---|
| 4 | struct service list; |
|---|
| 5 | struct service multiplex; |
|---|
| 6 | struct service ssl; |
|---|
| 7 | struct service auth; |
|---|
| 8 | struct service host; |
|---|
| 9 | struct service shell; |
|---|
| 10 | struct service echo; |
|---|
| 11 | struct service hello; |
|---|
| 12 | struct service rot13; |
|---|
| 13 | struct service web; |
|---|
| 14 | struct service web2; |
|---|
| 15 | |
|---|
| 16 | struct sockaddr_in6 shellsocket; |
|---|
| 17 | struct sockaddr_in6 shellsocket2; |
|---|
| 18 | struct sockaddr_in6 s_hello; |
|---|
| 19 | struct sockaddr_in6 s_rot13; |
|---|
| 20 | struct sockaddr_in6 s_web; |
|---|
| 21 | struct sockaddr_in6 s_web2; |
|---|
| 22 | |
|---|
| 23 | char * listmsg; |
|---|
| 24 | int listlen; |
|---|
| 25 | |
|---|
| 26 | void config_do() |
|---|
| 27 | { |
|---|
| 28 | help.name = "HELP\0"; |
|---|
| 29 | help.service_type = HELP_SERVICE; |
|---|
| 30 | help.next = &list; |
|---|
| 31 | list.name = "LIST\0"; |
|---|
| 32 | list.service_type = LIST_SERVICE; |
|---|
| 33 | list.next = &multiplex; |
|---|
| 34 | multiplex.name = "MULTIPLEX\0"; |
|---|
| 35 | multiplex.service_type = MULTIPLEX_SERVICE; |
|---|
| 36 | multiplex.next = &ssl; |
|---|
| 37 | ssl.name = "SSL\0"; |
|---|
| 38 | ssl.service_type = SSL_SERVICE; |
|---|
| 39 | ssl.next = &auth; |
|---|
| 40 | auth.name = "AUTH\0"; |
|---|
| 41 | auth.service_type = AUTH_SERVICE; |
|---|
| 42 | auth.next = &host; |
|---|
| 43 | host.name = "HOST\0"; |
|---|
| 44 | host.service_type = HOST_SERVICE; |
|---|
| 45 | host.next = &shell; |
|---|
| 46 | shell.name = "SHELL\0"; |
|---|
| 47 | shell.service_type = CUSTOM_SERVICE; |
|---|
| 48 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(shellsocket.sin6_addr)); |
|---|
| 49 | shellsocket.sin6_family=AF_INET6; |
|---|
| 50 | shellsocket.sin6_port=htons(9000); |
|---|
| 51 | shell.info = &shellsocket; |
|---|
| 52 | shell.restrict_user = "demo"; |
|---|
| 53 | shell.next = &echo; |
|---|
| 54 | echo.name = "ECHO\0"; |
|---|
| 55 | echo.service_type = CUSTOM_SERVICE; |
|---|
| 56 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(shellsocket2.sin6_addr)); |
|---|
| 57 | shellsocket2.sin6_family=AF_INET6; |
|---|
| 58 | shellsocket2.sin6_port=htons(9001); |
|---|
| 59 | echo.info = &shellsocket2; |
|---|
| 60 | echo.restrict_host = "toys"; |
|---|
| 61 | echo.next = &hello; |
|---|
| 62 | hello.name = "HELLO\0"; |
|---|
| 63 | hello.service_type = CUSTOM_SERVICE; |
|---|
| 64 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_hello.sin6_addr)); |
|---|
| 65 | s_hello.sin6_family=AF_INET6; |
|---|
| 66 | s_hello.sin6_port=htons(9002); |
|---|
| 67 | hello.info = &s_hello; |
|---|
| 68 | hello.restrict_host = "toys"; |
|---|
| 69 | hello.next = &web; |
|---|
| 70 | rot13.name = "ROT13\0"; |
|---|
| 71 | rot13.service_type = CUSTOM_SERVICE; |
|---|
| 72 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_rot13.sin6_addr)); |
|---|
| 73 | s_rot13.sin6_family=AF_INET6; |
|---|
| 74 | s_rot13.sin6_port=htons(9003); |
|---|
| 75 | rot13.info = &s_rot13; |
|---|
| 76 | rot13.restrict_host = "toys"; |
|---|
| 77 | rot13.next = &web; |
|---|
| 78 | web.name = "WEB\0"; |
|---|
| 79 | web.service_type = CUSTOM_SERVICE; |
|---|
| 80 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_web.sin6_addr)); |
|---|
| 81 | s_web.sin6_family=AF_INET6; |
|---|
| 82 | s_web.sin6_port=htons(9004); |
|---|
| 83 | web.info = &s_web; |
|---|
| 84 | web.restrict_host = "main"; |
|---|
| 85 | web.next = &web2; |
|---|
| 86 | web2.name = "WEB\0"; |
|---|
| 87 | web2.service_type = CUSTOM_SERVICE; |
|---|
| 88 | inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_web2.sin6_addr)); |
|---|
| 89 | s_web2.sin6_family=AF_INET6; |
|---|
| 90 | s_web2.sin6_port=htons(9005); |
|---|
| 91 | web2.info = &s_web2; |
|---|
| 92 | web2.restrict_host = "toys"; |
|---|
| 93 | web2.next = NULL; |
|---|
| 94 | |
|---|
| 95 | port_number = 31337; |
|---|
| 96 | servicelist = &help; |
|---|
| 97 | } |
|---|