[Libwebsockets] Crash when compile with openssl support

Andy Green andy at warmcat.com
Tue Aug 12 04:11:54 CEST 2014



On 12 August 2014 09:54:03 GMT+08:00, Sazali Hisham <sazalihisham at gmail.com> wrote:
>Hi Andy,
>
>Thank you for your fast response. You are right. I forgot to replace
>the
>header with the new one.
>However I am facing another issue. The server won't bind if I use SSL
>mode
>with port 443. It works if I use other port number. I tried "netstat -a
>|
>grep 443" to see if there is any other application that use the port
>443
>but nothing shown.

Port numbers below 1024 require you to be root to listen on them.

lws lets you start as root, and after the context and listening socket is created, downgrade to another user for the rest of its lifetime.

Have a look at .uid and .gid in the info struct used for context creation.

>[411724:9299] NOTICE: Initial logging level 7
>[411724:9300] NOTICE: Library version: 1.3 eabed8d
>[411724:9300] NOTICE: IPV6 not compiled in
>[411724:9300] NOTICE: libev support not compiled in
>[411724:9301] NOTICE:  static allocation: 4472 + (12 x 1024 fds) =
>16760
>bytes
>[411724:9301] NOTICE:  canonical_hostname = ubuntu
>[411724:9301] NOTICE:  Proxy ��:0

This seems messed up... if you create the info struct dynamically, you should take care to memset it to 0 before setting the members you care about.

-Andy

>[411724:9302] NOTICE:  per-conn mem: 128 + 1594 headers + protocol rx
>buf
>[411724:9302] NOTICE:  Compiled with OpenSSL support
>[411724:9302] NOTICE:  Using SSL mode
>[411724:9319] ERR: ERROR on binding to port 443 (-1 13)
>[411724:9320] NOTICE: libwebsocket_context_destroy
>
>Appreciate your guidance. Thanks!
>
>Regards,
>sazali
>
>
>On Mon, Aug 11, 2014 at 7:31 PM, Andy Green <andy at warmcat.com> wrote:
>
>>
>>
>> On 11 August 2014 19:13:04 GMT+08:00, Sazali Hisham <
>> sazalihisham at gmail.com> wrote:
>> >Hi,
>> >
>> >I am using libwebsocket 1.2 without any problem and now planning to
>> >upgrade
>> >it to v1.3. However, my application crashed if I used the build with
>> >openssl support. gdb was pointing at libwebsocket_create_context().
>It
>> >works just fine if I compile it without openssl support. Is there
>> >anything
>> >different between v1.2 and v.1.3 where change(s) is needed?
>>
>> If you recompiled your app also against 1.3 headers, you should be
>okay.
>>
>> If you already did that, can you let us know what line gdb blew
>chunks on?
>>
>> -Andy
>>
>> >Thanks!
>> >
>> >
>>
>>------------------------------------------------------------------------
>> >
>> >_______________________________________________
>> >Libwebsockets mailing list
>> >Libwebsockets at ml.libwebsockets.org
>> >http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>>
>>




More information about the Libwebsockets mailing list