Commit Graph

42 Commits

Author SHA1 Message Date
Felipe Magno de Almeida d688766d0f ecore_con: Rename EAPI macro to ECORE_CON_API in Ecore Con library
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.

EAPI was designed to be able to pass
```__attribute__ ((visibility ("default")))``` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.

MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.

For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.

With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).

Example 1:
dll1:
```
EAPI void foo(void);

EAPI void bar()
{
  foo();
}
```
dll2:
```
EAPI void foo()
{
  printf ("foo\n");
}
```

This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
```__atttribute__((visibility("default")))```.

However, the following:
Example 2:

dll1:

```
EAPI extern int foo;
EAPI void foobar(void);

EAPI void bar()
{
  foo = 5;
  foobar();
}
```

dll2:

```
EAPI int foo = 0;
EAPI void foobar()
{
  printf ("foo %d\n", foo);
}
```

This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.

Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
2020-09-15 10:16:24 -03:00
Carsten Haitzler fe56edae3f systemd - make libsystemd use/supprot entirely runtime "dlopened"
so i've moved all systemd and elogind support to be runtime only with
dlopen (eina_module) of libsystemd.so.0 (or libelogind.so.0 for elput)
and finding of symbols manually at runtime (if the right code paths or
env vars are set), thus remvoing the need to decide at compile time if
efl needs systemd support or not as it no longer needs systemd
headers/libs at compile time and just at runtime. this simplifies
building a bit and makes efl more adaptive to the final target system
at runtime.
2020-05-18 09:36:55 +01:00
Vincent Torri a6ade14c5e Evil: remove pwd code in Evil and fix compilation failures after the removal
Summary: remove pwd code in Evil

Test Plan: compilation

Reviewers: zmike, cedric, raster

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9420
2019-07-28 09:27:27 +01:00
Vincent Torri b41ed254a9 remove useless check of ws2tcpip.h
Summary: it is useless to check for header files which necessarly exist

Test Plan: compilation

Reviewers: raster, cedric, zmike

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8535
2019-04-02 10:09:24 -04:00
Wonki Kim 1cdedaa33b ecore_con: Fix potentional problems around ecore_con
non-thread safe functions are used like rand(), strerror().
this patch replace them with thread safe one.
and also this patch contains a change to fix a memory leak problem.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7917
2019-02-13 16:37:08 -08:00
Marcel Hollerbach f6579e47ab ecore_con: migrate to eina_vpath
Summary:
the logic here was against the xdg standard, thus we migrate to
eina_vpath which uses the correct xdg standard

Depends on D6745

Reviewers: zmike, stefan_schmidt, #committers

Reviewed By: zmike, #committers

Subscribers: #reviewers, cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6746
2018-08-20 12:58:35 -04:00
Andy Williams d234458dfc Fix and simpligy windows behaviour.
Author: Vincent Torri
2017-12-31 16:08:31 +00:00
Gustavo Sverzut Barbieri a4be1e479c ecore_con_local_path_new(): implemented for Windows 2017-03-29 12:44:19 -03:00
Carsten Haitzler c6ff925132 ecore_con - only use XDG_RUNTIME_DIR if not setuid
this should address possible misuse of this env var in setuid apps.
keep using home and tmp to maintain socket "abi" (the filenames that
are used).
2017-02-08 21:19:39 +09:00
Gustavo Sverzut Barbieri f4306d654d ecore_con: Ecore_Con_Server now on top of Efl_Net!
This is a major work and unfortunately couldn't be split into smaller
pieces as old code was highly coupled.

Ecore_Con_Server is now a wrapper around Efl_Net_Dialer_Simple
(ecore_con_server_connect()) and Efl_Net_Server_Simple
(ecore_con_server_add()), doing all that the original version did with
some fixes so ecore_con_ssl_server_upgrade() and
ecore_con_ssl_client_upgrade() are more usable -- see the examples and
-t/--type=tcp+ssl.

I tried to be bug-compatible, with code annotations where things
doesn't make sense. This was based on ecore_con_suite tests and some
manual experimenting with the examples, these can be helpful if you
find regressions (report/assign to me).
2016-12-10 08:44:06 -02:00
Gustavo Sverzut Barbieri 48049a4ce2 efl_net_server_unix: add leading_directories_create property.
This allows us to crete any parent directories that are missing.
2016-11-25 18:01:29 -02:00
Gustavo Sverzut Barbieri 2f91934502 ecore_con: export function to create local path string.
The new efl_net code won't compose any path own its own, allowing the
user to connect to non-EFL systems.

However we need a way to use the same path Ecore_Con_Server does, so
we can reach it. Then export and use ecore_con_local_path_new() to do
exactly that.
2016-11-23 12:57:10 -02:00
Ji-Youn Park 0a39fae0a2 ecore_con_local: fix memory leak.
after socket function call, close file descriptor.
2016-09-20 16:14:04 +08:30
Prateek Thakur 9348a84aa0 ecore_con: add '\0' termination to path.
Summary:
Copying from string 'buf' of length 4095 to '&socket_unix.sun_path[0]'
may form a non-terminated C string of size 108. So added null termination.

Signed-off-by: Prateek Thakur <prateek.th@samsung.com>

Reviewers: cedric, thiepha

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D4247

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-08-22 11:04:13 -07:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Carsten Haitzler 865b10d739 ecore-con - dont complain about socket setup issues when api handles it
ecore-con api returns failure cases and ecore-con shouldt go spamming
stderr with this as it's inteded to be handled at the api level, so
slience!
2016-06-13 18:12:33 +09:00
Tom Hacohen d4bd7d7033 Ecore con local: properly clean up fd on error.
This wasn't done correctly in the previous commit. First of all, the
order of cleanup was wrong, the cleanup area should only be called if
failures occurred after the fd allocation, not before. Also, fd should
be reinitialised to -1 once we close the socket.
2016-02-05 11:48:36 +00:00
Awadhesh Singh f05577c3ae Ecore con: Close server socket fd on failure.
Summary:
Socket fd must be closed to avoid file discripter leak.
Programs can usually only open a limited number of file descriptors,
so if this happens a lot, it may turn into a problem.

@fix

Reviewers: raster, Hermet, wonsik, spacegrapher, cedric, jpeg, tasn

Reviewed By: tasn

Subscribers: cedric, alok25, yashu21985, singh.amitesh

Differential Revision: https://phab.enlightenment.org/D3660
2016-02-05 11:44:41 +00:00
Srivardhan Hebbar fca9ff1322 ecore_con: changing Ecore.Con.Server to Efl.Network.Server.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3549

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-02-05 08:10:52 +01:00
Tom Hacohen 681328feb5 Ecore con: Prevent possible use of uninitialised buffer on the stack.
I'm not actually sure if it's a false, because finding the possible
options is hard. Just to be safe, it's better to set buf to "" in the
else case. I'm doing this instead of initialising the variable so the
compiler/static analyser will be able to warn us if there are other code
paths that should probably set buf, but don't.

CID 1316016

@fix
2015-10-04 16:31:43 +01:00
Tom Hacohen fa2ecb3af6 Ecore Con: Fix possible timing attacks.
Gist of it: we check, and then there's a window between our check and
the mkdir. We don't really need it anyway, because we just want to mkdir
and if it exists, just go on and do nothing.

CID 1039559
CID 1039558

@fix
2015-10-04 16:16:07 +01:00
Cedric BAIL 94eaaf889b ecore_con: use portable environment lookup. 2015-05-14 18:41:48 +02:00
Srivardhan Hebbar 9c03e3e728 ecore_con: clean up, refactor and unpdate documentation.
Summary:
1. Have refactored code in ecore_con_local.c
2. Changed env variable from "TMP" to "TMPDIR".
3. Added check for negetive port number when type is ECORE_CON_LOCAL_USER.
4. Added check to check TMPDIR before assuming /tmp as temp directory.
5. Updated documentation in Ecore_Con.h explaining about local socket and port number.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2194

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-23 19:44:27 +01:00
Srivardhan Hebbar b1f74c615a ecore_con: fix ECORE_CON_LOCAL_SYSTEM use with negative port number.
Summary:
The socket can be created even with negative port number, but in that case the port
is ignored so that you can connect to non Ecore_Con based IPC. This patch remove
that test to make the client and server match.

@fix

Bug: While creating ECORE_CON_LOCAL_SYSTEM server and client pair, when the socket
name was "test_socket" and port number "-8" (Any negative number). Then while creating
listening socket, the code would go to line no 291 and socket is created in tmp by
".ecore_servicetest_socket|-8". When the same is passed to bind then the code would
go to line 118 and the socket it would try to bind would be ".ecore_servicetest_socket" !!
So the bind would fail.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2186

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-18 15:37:09 +01:00
Mike Blumenkrantz 08e1f2f4f3 ecore-con now prints error messages when local socket creation fails 2014-12-05 13:20:13 -05:00
Carsten Haitzler 8762004bf1 ecore-con - check return of mkdir
fix CID 1039699
2014-08-27 16:28:46 +09:00
Carsten Haitzler cbf5e0ef1d ecore-con - check return of ecore con ssl init
check return of ssl init for server connection

fixes CID 1039700
2014-08-27 16:25:51 +09:00
Marcel Hollerbach 8749504b5c ecore_con: pass the correct pointer as data in the callback.
Summary:
The pass of the wrong pointer caused a wrong scope get call cause the the
passed pointer was not a valid eo pointer.

Test Plan: Run enlightenment entrance, it wont crash anymore

Reviewers: tasn

Subscribers: cedric, Sachiel

Differential Revision: https://phab.enlightenment.org/D1352
2014-08-23 16:39:14 +09:00
Tom Hacohen d72f809fb8 Ecore con server: Migrate to eo. 2014-08-22 17:37:56 +01:00
Cedric BAIL 313cd699f2 ecore_con: fix build on windows by matching the #if around the if statement. 2014-01-09 14:30:43 +09:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
discomfitor 41fe698fc2 reformat ecore_con so I can read it... 2013-12-20 00:08:43 -05:00
Carsten Haitzler 8cdef1831c ecore-con - fix possible unterminated buffers
this should fix CID 1039725 and CID 1039724
2013-12-13 21:26:05 +09:00
Cedric Bail 8e7921dffa ecore_con: remove unecessary code. 2013-11-28 16:36:21 +09:00
Cedric Bail 1e70d703b3 ecore_con: fix unitialized use of buffer from strncpy.
Fix CID 1039725.
2013-11-27 14:30:03 +09:00
Cedric Bail 9176271492 ecore_con: add systemd socket activation.
Be careful, systemd socket activation require you to always order
server socket creation in the same order as defined in the unit file.
This means ecore_con_server_add should always been in the same order
for those of them using systemd socket activation.
2013-03-10 16:00:32 +09:00
Lucas De Marchi 06ff74834f efl: remove checks for socket.h, net/*, arpa/*
SVN revision: 82585
2013-01-10 20:26:02 +00:00
Lucas De Marchi 3e4eb4437e efl: remove check for errno.h
SVN revision: 82581
2013-01-10 20:25:44 +00:00
Carsten Haitzler 717f0823e0 small change - use xdg runtime dir if available instead of home. nicer
in xdg worlds. still falls back tho.



SVN revision: 81858
2012-12-29 03:39:20 +00:00
Carsten Haitzler 4cd65475d4 this is small but critical - failure to connect isnt something to
ERR() log about... it's simply a matter of the other end not being
there... it can be a perfectly normal condition.



SVN revision: 81734
2012-12-27 08:16:05 +00:00
Vincent Torri 7d6010b12c merge: add escape ecore, fix several bugs
SVN revision: 79995
2012-12-02 22:35:45 +00:00