{"action":"opened","issue":{"url":"https://api.github.com/repos/processone/ejabberd/issues/2296","repository_url":"https://api.github.com/repos/processone/ejabberd","labels_url":"https://api.github.com/repos/processone/ejabberd/issues/2296/labels{/name}","comments_url":"https://api.github.com/repos/processone/ejabberd/issues/2296/comments","events_url":"https://api.github.com/repos/processone/ejabberd/issues/2296/events","html_url":"https://github.com/processone/ejabberd/issues/2296","id":299607407,"number":2296,"title":"External auth fails after successfully authenticating a few times","user":{"login":"hahahatrick","id":33310702,"avatar_url":"https://avatars3.githubusercontent.com/u/33310702?v=4","gravatar_id":"","url":"https://api.github.com/users/hahahatrick","html_url":"https://github.com/hahahatrick","followers_url":"https://api.github.com/users/hahahatrick/followers","following_url":"https://api.github.com/users/hahahatrick/following{/other_user}","gists_url":"https://api.github.com/users/hahahatrick/gists{/gist_id}","starred_url":"https://api.github.com/users/hahahatrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hahahatrick/subscriptions","organizations_url":"https://api.github.com/users/hahahatrick/orgs","repos_url":"https://api.github.com/users/hahahatrick/repos","events_url":"https://api.github.com/users/hahahatrick/events{/privacy}","received_events_url":"https://api.github.com/users/hahahatrick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-23T05:58:11Z","updated_at":"2018-02-23T05:58:11Z","closed_at":null,"author_association":"NONE","body":"> What version of ejabberd are you using?\r\n\r\n18.0\r\n\r\n\r\n> What operating system (version) are you using?\r\n\r\nfreeBSD\r\n\r\n\r\n> How did you install ejabberd (source, package, distribution)?\r\n\r\nAs an elixir dependency.\r\n\r\n\r\n> What did not work as expected? \r\n\r\nI'm using external auth script for authentication. The exception is not consistent. The auth succeeds a few times (between 0-3 times) and then when it fails every subsequent auth requests fail. \r\n\r\n> Are there error messages in the log?\r\n\r\n```\r\n19:33:14.359 [error] Process #PID<0.553.0> raised an exception\r\n** (ArgumentError) argument error\r\n    :erlang.iolist_to_binary([\"auth\", [[\":\", \"name\"], [\":\", \"49.69.40.191\"], [\":\", nil]]])\r\n    (ejabberd) src/str.erl:204: :str.join/2\r\n    (ejabberd) src/extauth.erl:113: :extauth.loop/4\r\n\r\n19:33:16.878 [error] GenServer #PID<0.838.0> terminating\r\n** (ArgumentError) argument error\r\n    (ejabberd) src/extauth.erl:101: :extauth.call_port/2\r\n    (ejabberd) src/ejabberd_auth_external.erl:88: :ejabberd_auth_external.check_password_extauth/4\r\n    (ejabberd) src/ejabberd_auth.erl:222: anonymous fn/8 in :ejabberd_auth.check_password_with_authmodule/6\r\n    (stdlib) lists.erl:1263: :lists.foldl/3\r\n    (ejabberd) src/cyrsasl_plain.erl:55: :cyrsasl_plain.mech_step/2\r\n    (ejabberd) src/cyrsasl.erl:209: :cyrsasl.server_step/2\r\n    (ejabberd) src/xmpp_stream_in.erl:807: :xmpp_stream_in.process_sasl_request/2\r\n    (ejabberd) src/xmpp_stream_in.erl:354: :xmpp_stream_in.handle_info/2\r\nLast message: {:\"$gen_event\", {:xmlstreamelement, {:xmlel, \"auth\", [{\"xmlns\", \"urn:ietf:params:xml:ns:xmpp-sasl\"}, {\"mechanism\", \"PLAIN\"}], [xmlcdata: \"AHZpZGh1bgBleUpoYkdjaU9pSklVekkxTmlJc0luUjVjQ0k2SWtwWFZDSjkuZXlKMWMyVnlJanA3SWw5cFpDSTZJalZoTjJKa09XUmpOV00zTlRZMk1EZG1PREptTWpJeE5DSXNJbXh2WTJGc0lqcDdJblZ6WlhKdVlXMWxJam9pZG1sa2FIVnVJaXdpWlcxaGFXd2lPaUoyYVdSb2RXNTJNVUJuYldGcGJDNWpiMjBpZlgwc0ltbGhkQ0k2TVRVeE9USTNORFl4TVgwLkpzM3FvUms5b3RYMW4xVjVFbDU1ZW1MZGtrZjc1Vk1mRklYUVFjWGl6LVU=\"]}}}\r\nState: %{mod: :ejabberd_c2s, socket_monitor: #Reference<0.0.1.6200>, stream_id: \"2515559973377061377\", stream_timeout: {30000, -576460728270}, tls_required: false, stream_version: {1, 0}, stream_restarted: true, tls_verify: false, mgmt_timeout: 300, shaper: :c2s_shaper, access: :c2s, zlib: false, stream_encrypted: true, stream_state: :wait_for_sasl_request, resource: \"\", mgmt_max_timeout: 300, csi_queue: {0, %{}}, mgmt_stanzas_in: 0, tls_options: [:compression_none, {:protocol_options, \"no_sslv3\"}, {:certfile, \"/home/name/certs/main.pem\"}], socket: {:socket_state, :fast_tls, {:tlssock, #Port<0.20687>, \"\"}, 65536, \"\", {:maxrate, 1000, 331.5192773536227, 1519327996829701}, :undefined}, mgmt_stanzas_req: 0, lang: \"en\", mgmt_ack_timeout: 60000, stream_compressed: false, csi_state: :active, stream_authenticated: false, mgmt_max_queue: 5000, stream_header_sent: true, user: \"\", mgmt_queue_type: :ram, lserver: \"49.69.40.191\", pres_a: {0, nil}, mgmt_resend: false, xmlns: \"jabber:client\", mgmt_state: :inactive, stream_direction: :in, ip: {{157, 50, 22, 114}, 39341}, server: \"49.69.40.191\", owner: #PID<0.838.0>, tls_enabled: true, mgmt_stanzas_out: 0}\r\n\r\n=CRASH REPORT==== 22-Feb-2018::19:33:16 ===\r\n  crasher:\r\n    initial call: xmpp_stream_in:init/1\r\n    pid: <0.838.0>\r\n    registered_name: []\r\n    exception exit: {badarg,\r\n                        [{extauth,call_port,2,\r\n                             [{file,\"src/extauth.erl\"},{line,101}]},\r\n                         {ejabberd_auth_external,check_password_extauth,4,\r\n                             [{file,\"src/ejabberd_auth_external.erl\"},\r\n                              {line,88}]},\r\n                         {ejabberd_auth,\r\n                             '-check_password_with_authmodule/6-fun-0-',8,\r\n                             [{file,\"src/ejabberd_auth.erl\"},{line,222}]},\r\n                         {lists,foldl,3,[{file,\"lists.erl\"},{line,1263}]},\r\n                         {cyrsasl_plain,mech_step,2,\r\n                             [{file,\"src/cyrsasl_plain.erl\"},{line,55}]},\r\n                         {cyrsasl,server_step,2,\r\n                             [{file,\"src/cyrsasl.erl\"},{line,209}]},\r\n                         {xmpp_stream_in,process_sasl_request,2,\r\n                             [{file,\"src/xmpp_stream_in.erl\"},{line,807}]},\r\n                         {xmpp_stream_in,handle_info,2,\r\n                             [{file,\"src/xmpp_stream_in.erl\"},{line,354}]}]}\r\n      in function  p1_server:terminate/7 (/usr/home/name/deps/p1_utils/src/p1_server.erl, line 878)\r\n    ancestors: [ejabberd_c2s_sup,ejabberd_sup,<0.259.0>]\r\n    messages: []\r\n    links: [<0.558.0>]\r\n    dictionary: [{'$internal_queue_len',0},\r\n                  {rand_seed,{#{max => 288230376151711743,\r\n                                next => #Fun<rand.8.41921595>,\r\n                                type => exsplus,\r\n                                uniform => #Fun<rand.9.41921595>,\r\n                                uniform_n => #Fun<rand.10.41921595>},\r\n                              [57866657856794574|134726995936430188]}},\r\n                  {already_terminated,true}]\r\n    trap_exit: false\r\n    status: running\r\n    heap_size: 2586\r\n    stack_size: 27\r\n    reductions: 4520\r\n  neighbours:\r\n\r\n=SUPERVISOR REPORT==== 22-Feb-2018::19:33:16 ===\r\n     Supervisor: {local,ejabberd_c2s_sup}\r\n     Context:    child_terminated\r\n     Reason:     {badarg,\r\n                     [{extauth,call_port,2,\r\n                          [{file,\"src/extauth.erl\"},{line,101}]},\r\n                      {ejabberd_auth_external,check_password_extauth,4,\r\n                          [{file,\"src/ejabberd_auth_external.erl\"},{line,88}]},\r\n                      {ejabberd_auth,\r\n                          '-check_password_with_authmodule/6-fun-0-',8,\r\n                          [{file,\"src/ejabberd_auth.erl\"},{line,222}]},\r\n                      {lists,foldl,3,[{file,\"lists.erl\"},{line,1263}]},\r\n                      {cyrsasl_plain,mech_step,2,\r\n                          [{file,\"src/cyrsasl_plain.erl\"},{line,55}]},\r\n                      {cyrsasl,server_step,2,\r\n                          [{file,\"src/cyrsasl.erl\"},{line,209}]},\r\n                      {xmpp_stream_in,process_sasl_request,2,\r\n                          [{file,\"src/xmpp_stream_in.erl\"},{line,807}]},\r\n                      {xmpp_stream_in,handle_info,2,\r\n                          [{file,\"src/xmpp_stream_in.erl\"},{line,354}]}]}\r\n     Offender:   [{pid,<0.838.0>},\r\n                  {id,undefined},\r\n                  {mfargs,{ejabberd_c2s,start_link,undefined}},\r\n                  {restart_type,temporary},\r\n                  {shutdown,1000},\r\n                  {child_type,worker}]\r\n```\r\n\r\nAlso, this piece of exception occurs even if the auth goes through and succeeds.\r\n\r\n```\r\n19:33:14.359 [error] Process #PID<0.553.0> raised an exception\r\n** (ArgumentError) argument error\r\n    :erlang.iolist_to_binary([\"auth\", [[\":\", \"name\"], [\":\", \"49.69.40.191\"], [\":\", nil]]])\r\n    (ejabberd) src/str.erl:204: :str.join/2\r\n    (ejabberd) src/extauth.erl:113: :extauth.loop/4\r\n```\r\n"}}
{"actor":{"display_login":"hahahatrick"}}