Ettercap / ettercap

Ettercap Project
http://www.ettercap-project.org
GNU General Public License v2.0
2.36k stars 492 forks source link

ettercap 0.8.0 fails on OS X (undefined symbol safe_free_mem) #344

Closed nieder closed 11 years ago

nieder commented 11 years ago

On OS X 10.7 with apple-clang-4.2 or llvm-gcc-4.2 (Xcode 4.6.3), the ettercap-0.8.0 build fails with this error:

/sw/var/lib/fink/path-prefix-clang/cc  -MD -O2  -dynamiclib -Wl,-headerpad_max_install_names  -L/sw/lib/system-openssl/lib -L/sw/lib -o libettercap.dylib -install_name /sw/build.build/ettercap-0.8.0-1/ettercap-0.8.0/finkbuild/src/libettercap.dylib CMakeFiles/lib_ettercap.dir/ec_capture.c.o CMakeFiles/lib_ettercap.dir/ec_checksum.c.o CMakeFiles/lib_ettercap.dir/ec_conf.c.o CMakeFiles/lib_ettercap.dir/ec_connbuf.c.o CMakeFiles/lib_ettercap.dir/ec_conntrack.c.o CMakeFiles/lib_ettercap.dir/ec_debug.c.o CMakeFiles/lib_ettercap.dir/ec_decode.c.o CMakeFiles/lib_ettercap.dir/ec_dispatcher.c.o CMakeFiles/lib_ettercap.dir/ec_dissect.c.o CMakeFiles/lib_ettercap.dir/ec_encryption_ccmp.c.o CMakeFiles/lib_ettercap.dir/ec_encryption_tkip.c.o CMakeFiles/lib_ettercap.dir/ec_encryption.c.o CMakeFiles/lib_ettercap.dir/ec_error.c.o CMakeFiles/lib_ettercap.dir/ec_exit.c.o CMakeFiles/lib_ettercap.dir/ec_file.c.o CMakeFiles/lib_ettercap.dir/ec_filter.c.o CMakeFiles/lib_ettercap.dir/ec_fingerprint.c.o CMakeFiles/lib_ettercap.dir/ec_format.c.o CMakeFiles/lib_ettercap.dir/ec_globals.c.o CMakeFiles/lib_ettercap.dir/ec_hash.c.o CMakeFiles/lib_ettercap.dir/ec_hook.c.o CMakeFiles/lib_ettercap.dir/ec_inet.c.o CMakeFiles/lib_ettercap.dir/ec_inject.c.o CMakeFiles/lib_ettercap.dir/ec_log.c.o CMakeFiles/lib_ettercap.dir/ec_manuf.c.o CMakeFiles/lib_ettercap.dir/ec_mitm.c.o CMakeFiles/lib_ettercap.dir/ec_network.c.o CMakeFiles/lib_ettercap.dir/ec_packet.c.o CMakeFiles/lib_ettercap.dir/ec_parser.c.o CMakeFiles/lib_ettercap.dir/ec_passive.c.o CMakeFiles/lib_ettercap.dir/ec_plugins.c.o CMakeFiles/lib_ettercap.dir/ec_poll.c.o CMakeFiles/lib_ettercap.dir/ec_profiles.c.o CMakeFiles/lib_ettercap.dir/ec_resolv.c.o CMakeFiles/lib_ettercap.dir/ec_scan.c.o CMakeFiles/lib_ettercap.dir/ec_send.c.o CMakeFiles/lib_ettercap.dir/ec_services.c.o CMakeFiles/lib_ettercap.dir/ec_session.c.o CMakeFiles/lib_ettercap.dir/ec_signals.c.o CMakeFiles/lib_ettercap.dir/ec_sniff_bridge.c.o CMakeFiles/lib_ettercap.dir/ec_sniff.c.o CMakeFiles/lib_ettercap.dir/ec_sniff_unified.c.o CMakeFiles/lib_ettercap.dir/ec_socket.c.o CMakeFiles/lib_ettercap.dir/ec_sslwrap.c.o CMakeFiles/lib_ettercap.dir/ec_stats.c.o CMakeFiles/lib_ettercap.dir/ec_streambuf.c.o CMakeFiles/lib_ettercap.dir/ec_strings.c.o CMakeFiles/lib_ettercap.dir/ec_threads.c.o CMakeFiles/lib_ettercap.dir/ec_ui.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_bgp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_cvs.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_dhcp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_ftp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_http.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_icq.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_imap.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_irc.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_iscsi.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_ldap.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_mdns.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_mongodb.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_mountd.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_msn.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_mysql.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_nbns.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_nntp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_o5logon.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_ospf.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_pop.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_postgresql.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_portmap.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_radius.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_rcon.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_rip.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_rlogin.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_smb.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_smtp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_snmp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_socks.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_telnet.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_TN3270.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_vnc.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_vrrp.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_x11.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_ymsg.c.o CMakeFiles/lib_ettercap.dir/mitm/ec_arp_poisoning.c.o CMakeFiles/lib_ettercap.dir/mitm/ec_dhcp_spoofing.c.o CMakeFiles/lib_ettercap.dir/mitm/ec_icmp_redirect.c.o CMakeFiles/lib_ettercap.dir/mitm/ec_port_stealing.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_arp.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_cooked.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_erf.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_eth.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_fddi.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_gre.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_icmp.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_ip.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_mpls.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_pap.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_ppi.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_ppp.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_pppoe.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_rawip.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_tcp.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_tr.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_udp.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_vlan.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_wifi.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_wifi_eapol.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_wifi_prism.c.o CMakeFiles/lib_ettercap.dir/protocols/ec_wifi_radiotap.c.o CMakeFiles/lib_ettercap.dir/ec_interfaces.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_dns.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_ssh.c.o CMakeFiles/lib_ettercap.dir/dissectors/ec_gg.c.o CMakeFiles/lib_ettercap.dir/os/ec_darwin.c.o interfaces/libec_interfaces.a /sw/lib/libcurses.dylib /sw/lib/libform.dylib /sw/lib/libncurses.dylib /sw/lib/libform.dylib /sw/lib/libpanel.dylib /sw/lib/libmenu.dylib /usr/lib/libssl.dylib /usr/lib/libcrypto.dylib /usr/lib/libz.dylib /sw/lib/libiconv.dylib /sw/lib/libpcap.dylib /sw/lib/libnet.dylib /usr/lib/libresolv.dylib /sw/lib/libpcre.dylib /sw/lib/libncurses.dylib /sw/lib/libpanel.dylib /sw/lib/libmenu.dylib /usr/lib/libssl.dylib /usr/lib/libcrypto.dylib /usr/lib/libz.dylib /sw/lib/libiconv.dylib /sw/lib/libpcap.dylib /sw/lib/libnet.dylib /usr/lib/libresolv.dylib /sw/lib/libpcre.dylib 
Undefined symbols for architecture x86_64:
  "_safe_free_mem", referenced from:
      _ssl_wrap_init in ec_sslwrap.c.o
      _ssl_wrap_fini in ec_sslwrap.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
eaescob commented 11 years ago

I'm going to try to tackle this but I no longer have OS X. I might need to download/install on a VM. @justfalter do you have time for this?

justfalter commented 11 years ago

I'm literally moving to a new house at this very moment. :(

Lemme see if I can scare up someone who has a Mac to help us out.

On Oct 4, 2013, at 10:38 AM, "Emilio A. Escobar" notifications@github.com wrote:

I'm going to try to tackle this but I no longer have OS X. I might need to download/install on a VM. @justfalter do you have time for this?

— Reply to this email directly or view it on GitHub.

eaescob commented 11 years ago

No problem :) I can install a VM or try from my iMac. I might have time on Sunday. Where you moving/going to?

Emilio Escobar / eescobar@gmail.com

On Fri, Oct 4, 2013 at 8:48 AM, Mike Ryan notifications@github.com wrote:

I'm literally moving to a new house at this very moment. :(

Lemme see if I can scare up someone who has a Mac to help us out.

On Oct 4, 2013, at 10:38 AM, "Emilio A. Escobar" < notifications@github.com> wrote:

I'm going to try to tackle this but I no longer have OS X. I might need to download/install on a VM. @justfalter do you have time for this?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/Ettercap/ettercap/issues/344#issuecomment-25708990 .

justfalter commented 11 years ago

The beautiful suburbs of Chicago :) I've been cooped up in a a 750 sq foot condo for too long. I'm looking forward to having a yard and a grill!

On Oct 4, 2013, at 11:02 AM, "Emilio A. Escobar" notifications@github.com wrote:

No problem :) I can install a VM or try from my iMac. I might have time on Sunday. Where you moving/going to?

Emilio Escobar / eescobar@gmail.com

  • Great spirits have always encountered strong oppositions from mediocre minds. -- Einstein

On Fri, Oct 4, 2013 at 8:48 AM, Mike Ryan notifications@github.com wrote:

I'm literally moving to a new house at this very moment. :(

Lemme see if I can scare up someone who has a Mac to help us out.

On Oct 4, 2013, at 10:38 AM, "Emilio A. Escobar" < notifications@github.com> wrote:

I'm going to try to tackle this but I no longer have OS X. I might need to download/install on a VM. @justfalter do you have time for this?

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHubhttps://github.com/Ettercap/ettercap/issues/344#issuecomment-25708990 .

— Reply to this email directly or view it on GitHub.

nosteve commented 11 years ago

Think I found it. Change about 2 months ago that modified some mem usage but only updated ec_linux.c:

https://github.com/AntonioCollarino/ettercap/commit/079ea1682c8ae019bd7742ced349396658e217be

Look for the addition of safe_free_mem. Doesn't exist in ec_darwin.c - also consider other platforms that may be affected.

Gave this a shot in ec_darwin.c and seems to work. Here's where I added his stuff:

...
void disable_ip_forward(void);
static void restore_ip_forward(void);
u_int16 get_iface_mtu(const char *iface);

void safe_free_mem(char **param, int *param_length, char *command); //here

/*******************************************/
...

then just added the function as the last one:

void safe_free_mem(char **param, int *param_length, char *command)
{
   int k;

   SAFE_FREE(command);
  for(k= 0; k < (*param_length); ++k)
    SAFE_FREE(param[k]);
  SAFE_FREE(param);
}

/* EOF */

Compiles now, haven't tested it much yet but the binary executes.

eaescob commented 11 years ago

Thanks! Pull request should fix it

ghost commented 11 years ago

@eaescob you were faster than me ;) thank you!

nieder commented 11 years ago

33ac95f fixes the safe_free_mem failure for me on git-head an 0.8.0.

eaescob commented 11 years ago

Closing