• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

processone / ejabberd / 1258

12 Dec 2025 03:57PM UTC coverage: 33.638% (-0.006%) from 33.644%
1258

push

github

badlop
Container: Apply commit a22c88a

ejabberdctl.template: Show meaningful error when ERL_DIST_PORT is in use

15554 of 46240 relevant lines covered (33.64%)

1078.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

35.71
/src/mod_proxy65_lib.erl
1
%%%----------------------------------------------------------------------
2
%%% File    : mod_proxy65_lib.erl
3
%%% Author  : Evgeniy Khramtsov <xram@jabber.ru>
4
%%% Purpose : SOCKS5 parsing library.
5
%%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru>
6
%%%
7
%%%
8
%%% ejabberd, Copyright (C) 2002-2025   ProcessOne
9
%%%
10
%%% This program is free software; you can redistribute it and/or
11
%%% modify it under the terms of the GNU General Public License as
12
%%% published by the Free Software Foundation; either version 2 of the
13
%%% License, or (at your option) any later version.
14
%%%
15
%%% This program is distributed in the hope that it will be useful,
16
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
17
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
%%% General Public License for more details.
19
%%%
20
%%% You should have received a copy of the GNU General Public License along
21
%%% with this program; if not, write to the Free Software Foundation, Inc.,
22
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
%%%
24
%%%----------------------------------------------------------------------
25

26
-module(mod_proxy65_lib).
27

28
-author('xram@jabber.ru').
29

30
-include("mod_proxy65.hrl").
31

32
-export([unpack_init_message/1, unpack_auth_request/1,
33
         unpack_request/1, make_init_reply/1, make_auth_reply/1,
34
         make_reply/1, make_error_reply/1, make_error_reply/2]).
35

36
unpack_init_message(<<(?VERSION_5), N,
37
                      AuthMethodList:N/binary>>)
38
    when N > 0, N < 256 ->
39
    {ok, binary_to_list(AuthMethodList)};
2✔
40
unpack_init_message(_) -> error.
×
41

42
unpack_auth_request(<<1, ULen, User:ULen/binary, PLen,
43
                      Pass:PLen/binary>>)
44
    when ULen < 256, PLen < 256 ->
45
    {(User), (Pass)};
×
46
unpack_auth_request(_) -> error.
×
47

48
unpack_request(<<(?VERSION_5), CMD, RSV,
49
                 (?ATYP_DOMAINNAME), 40, SHA1:40/binary, 0, 0>>)
50
    when CMD == (?CMD_CONNECT); CMD == (?CMD_UDP) ->
51
    Command = if CMD == (?CMD_CONNECT) -> connect;
2✔
52
                 CMD == (?CMD_UDP) -> udp
×
53
              end,
54
    #s5_request{cmd = Command, rsv = RSV, sha1 = (SHA1)};
2✔
55
unpack_request(_) -> error.
×
56

57
make_init_reply(Method) -> [?VERSION_5, Method].
2✔
58

59
make_auth_reply(true) -> [1, ?SUCCESS];
×
60
make_auth_reply(false) -> [1, ?ERR_NOT_ALLOWED].
×
61

62
make_reply(#s5_request{rsv = RSV, sha1 = SHA1}) ->
63
    [?VERSION_5, ?SUCCESS, RSV, ?ATYP_DOMAINNAME,
2✔
64
     byte_size(SHA1), SHA1, 0, 0].
65

66
make_error_reply(Request) ->
67
    make_error_reply(Request, ?ERR_NOT_ALLOWED).
×
68

69
make_error_reply(#s5_request{rsv = RSV, sha1 = SHA1},
70
                 Reason) ->
71
    [?VERSION_5, Reason, RSV, ?ATYP_DOMAINNAME,
×
72
     byte_size(SHA1), SHA1, 0, 0].
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc