summaryrefslogtreecommitdiff
path: root/src/login/login.c
AgeCommit message (Collapse)AuthorFilesLines
2016-08-20Re-added HPM support for configuration settingsHaru1-1/+2
Plugin settings should be relative to the the libconfig file root. For example, a configuration setting of type HPCT_CHAR will be relative to the root of conf/char/char-server.conf. In order to add a configuration entry inside the char_configuration block, the full configuration path (slash-delimited) should be passed to addCharConf(), as in the following example: `addCharConf("char_configuration/my_setting", my_parser_function);` Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported socket.conf (was packet.conf) to libconfigHaru1-0/+1
Ported to modern Hercules and cleaned up from Panikon's commits: b10f2a88073882bea812c6278fdec7848102ab87, bc5007299a92898ea4630f2a977d9a1b42b6c145 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported login-server.conf to libconfigHaru1-122/+425
Ported to modern Hercules and cleaned up from Panikon's commits: ceb8a486ac47c2ed9aae4baa1ec39a11f31e9368, c1049123a4ea6ae6f0992ffe766db8aed7435ab5, 6feb097046355610d2288670a569ccc175358580, 9f6e27a96d655f2b4555310786d9d10898754404, 21fa5d24255ba026f96b1dbedf74ac5ef831d3ae, e22a56ad4def8ca22e94d44377a5364b9db1a425, f753a754923140bfec02057c16e6e8429b863d0e, 25dde7e46524ace330b83cb4bf0255cc4d796792 Signed-off-by: Haru <haru@dotalux.com>
2016-08-10Fix login and char servers null pointer access if packet handler in plugin ↵Andrei Karas1-1/+4
initiate server termination.
2016-07-12Interface md5calc.chemagx1-7/+7
2016-07-10Fixed some issues with NULL dates in the login tableHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-07-03Add --run-once flag into login server.Andrei Karas1-0/+14
2016-04-16Added missing documentationHaru1-0/+4
Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 6)hemagx1-714/+18
Moved login clif code to lclif.c/lclif.h Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 5)hemagx1-15/+24
Renamed login->connection_problem() to login->connection_error() Split login->send_auth_failed() out of login->auth_failed() Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 4)hemagx1-3/+7
Changed login server packet processing so that no more than 3 packets are processed at once (same as the map server's clif processing) Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 3)hemagx1-213/+294
Rewritten login clif parser, using a packet db Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 2)hemagx1-159/+203
Split login packet-related code into functions Signed-off-by: Haru <haru@dotalux.com>
2016-04-16Rewrite client interface for login server (part 1)hemagx1-168/+445
Rewritten incoming/outgoing packet handlers to use structs instead of manipulating the WFIFO buffer bytes directly Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedefs from union DBKey and struct DBDataHaru1-3/+3
Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Removed various redundant typecastsHaru1-6/+6
Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Removed several unnecessary explicit casts of the WFIFOP resultHaru1-15/+15
Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Removed several unnecessary RFIFOP typecastsHaru1-11/+11
- While this is arguable, those explicit typecasts are potentially dangerous/misleading (for example, a const specifier might get accidentally dropped without even generating a compiler warning, or a variable type might change during code changes, and any related warning would get silenced by the explicit typecast). - As a reminder Hercules is written in C, and not in C++ (and there's no such thing as "compiling in C++ mode" - they're two different languages.) As such, it is legal to let the compiler automatically promote void* from/to any non-const pointer type, as well as const void* from/to any const pointer type. Signed-off-by: Haru <haru@dotalux.com>
2016-02-24Added const qualifier to several variable/argument pointersHaru1-2/+2
- This is necessary for compatibility with a const RFIFOP. Signed-off-by: Haru <haru@dotalux.com>
2016-02-19Fix all known warnings from compiler flags -Wformat*Andrei Karas1-5/+5
Add all missing -Wformat flags into configure.
2016-02-17Replaced some now unnecessary includes with forward declarations in header filesHaru1-1/+0
Added some forgotten <stdio.h> and "common/conf.h" includes to .c files, that were previously masked by the above. Signed-off-by: Haru <haru@dotalux.com>
2016-01-25Fix packet id being sent encrypted to Hercules Plugin Manager.hemagx1-6/+6
Now packet id will be passed to Hercules Plugin Manager instead of let it figure it on itself
2016-01-10Move declaration of login config struct to login interfacehemagx1-89/+89
Closes #1030 as merged Signed-off-by: Haru <haru@dotalux.com>
2016-01-09Corrected various zero-argument function definitionsHaru1-1/+1
- Functions should always specify their arguments, even if they take none. In C, not specifying arguments is different than specifying (void). Signed-off-by: Haru <haru@dotalux.com>
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-12-15Added GPL information on interactive server startupHaru1-0/+4
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-10-11Changed HPM->packets[] into an array of VECTORHaru1-12/+13
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Automatic HPM symbol sharingHaru1-6/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added core HPM interfaceHaru1-9/+9
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15HPM compatibility improvementsHaru1-0/+1
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Moved session array into the socket interfaceHaru1-13/+13
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Added showmsg HPM interfaceHaru1-4/+4
- The showmsg interface is automatically imported into plugins by the HPM (just like previously, the various Show* functions were). This change requires no actions from plugin developers. - stdout_with_ansisequence is now available through showmsg->stdout_with_ansisequence - msg_silent is now available through showmsg->silent - console_msg_log is now available through showmsg->console_log - timestamp_format is now available through showmsg->timestamp_format - Plugin-safe macros are provided, so that all Show* and Clear* calls will require no changes. - vShowMessage is provided through the public API, as va_list variant of ShowMessage. - vShowMessage_ is no longer part of the public API. If necessary, va_list variants of the other Show* functions will be added at a later time as follow-ups. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up socket interfaceHaru1-26/+25
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds API changes summary: - WFIFOSET() can now be safely used both inside and outside socket.c - RFIFOSKIP() can now be safely used both inside and outside socket.c - do_close() is now sockt->close() - flush_fifo() is now sockt->flush() - flush_fifos() is now sockt->flush_fifos() - getips() is now sockt->getips() - host2ip() is now sockt->host2ip() - ip2str() is now sockt->ip2str() - ntows() is now sockt->ntows() - make_connection() is now sockt->make_connection() - make_listen_bind() is now sockt->make_listen_bind() - realloc_fifo() is now sockt->realloc_fifo() - realloc_writefifo() is now sockt->realloc_writefifo() - session_isActive() is now sockt->session_is_active() - session_isValid() is now sockt->session_is_valid() - set_defaultparse() is now sockt->set_defaultparse() - set_eof() is now sockt->eof() - set_noblocking() is now sockt->set_noblocking() - str2ip() is now sockt->str2ip() Signed-off-by: Haru <haru@dotalux.com>
2015-08-11subnet.conf overhaulHaru1-76/+27
The subnet.conf system has been rewritten to offer greater flexibility, and to fix some issues that appeared with 838321a36c79e71117320154c9b611c99e93af03. It is now possible to enter, separately, LAN subnets: - `lan_subnets`: This is essentially the same feature present in the old subnet.conf. Each entry in this list defines a (LAN, private) subnet the server is in. Clients connecting from the same subnet, will be redirected to the LAN IP rather than the default public IP. The format has been simplified, and it only requires one IP and one subnet mask (as opposed to a character and a map server IP). - `allowed`: Allowed IPs are IP ranges a server (char to login or map to char) can connect from. Any attempt to connect as a server from an IP not included here, will fail. For convenience, a wildcard range (matching all possible IP addresses) has been provided (`0.0.0.0:0.0.0.0`), but it is very advisable to edit it to a more restrictive set. - `trusted`: Trusted IPs are IP ranges excluded from the IPban checks. This may be useful, for example, to exclude the server's own IP from ipbans, in case of false positives. Any IP ranges added to this list are also implicitly included in the allowed IP ranges.
2015-08-05Add checks for servers ip address in inter server connections.Andrei Karas1-6/+8
If ip not in configured subnet, connection refused. This can protect servers from brutforcing attacks.
2015-07-12Add missing checks into login.cAndrei Karas1-2/+9
Also add some NONNULL attributes for known non null parameters.
2015-06-19Cleaned up some #includesHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-17/+17
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-06-01Replaced some of the hardcoded values with constants (login)Haru1-21/+18
- Replaced several hardcoded values with the appropriate enums. - Added documentation for some hardcoded values that haven't been replaced by enums (yet) - Minor code legibility improvements. Signed-off-by: Haru <haru@dotalux.com>
2015-04-09Add checks to login.cAndrei Karas1-5/+31
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-9/+6
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Command line arguments handling overhaulHaru1-21/+47
- login_server, char_server, map_server as well as the tools (mapcache) now have a common command line arguments handling mechanism. - All of them now accept `--help` (`-h`), `--version` (`-v`) and `--load-plugin`. - login_server now accepts `--login-config` and `--lan-config` instead of relying on positional arguments to override those files. The old syntax will no longer work, please update your custom startup scripts. - char_server now accepts `--char-config`, `--inter-config`, `--lan-config` instead of relying on positional arguments. The old syntax will no longer work, please update your custom startup scripts. - mapcache now accepts `--grf-list`, `--map-list`, `--map-cache`, `--rebuild` in place of, respectively, `-grf`, `-list`, `-cache`, `-rebuild`. - A new macro `CMDLINEARG()` is provided, to help defining new command line argument handlers (i.e. in plugins). the `addArg()` call is still required, but its syntax has changed. The `help` argument is now of type `const char *` rather than a function pointer, and it is supposed to contain the message to show in the `--help` screen. Pass `NULL` if no help message is desired. Signed-off-by: Haru <haru@dotalux.com>
2015-01-1710 Distinct fixesshennetsind1-1/+1
Addressing out of bounds read-write. Special Thanks to 4144, Haruna! Signed-off-by: shennetsind <ind@henn.et>
2014-12-31Improve performance a bit by removing strlen(str) > 0.Andrei Karas1-3/+3
2014-11-16Whitespace cleanup (no code changes)Haru1-28/+28
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
2014-11-15In login server move config options handling by plugins after all other ↵Andrei Karas1-3/+2
handling.
2014-11-15Add support for plugin options in login server config.Andrei Karas1-0/+2
2014-11-11add AccountDB into login interface.Andrei Karas1-2/+3
2014-11-09Fixed a compilation error in MSVC <= 2012Haru1-2/+4
Special thanks to Angelmelody Signed-off-by: Haru <haru@dotalux.com>