diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-11-27 18:16:10 +0100 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-11-27 18:16:10 +0100 |
commit | 8da712ea61262a0951d14dd42758a01dd6f6c97b (patch) | |
tree | cedf9a6b741480d5870d28677fa8c8d0dd360c33 | |
parent | 56cfb8036fe3f42276eca7f8835e069b3b657dd0 (diff) | |
download | libssh-8da712ea61262a0951d14dd42758a01dd6f6c97b.tar.gz libssh-8da712ea61262a0951d14dd42758a01dd6f6c97b.tar.xz libssh-8da712ea61262a0951d14dd42758a01dd6f6c97b.zip |
Compile in stub for pcap funcs when pcap disabled
Avoid that way linking problems
-rw-r--r-- | libssh/CMakeLists.txt | 9 | ||||
-rw-r--r-- | libssh/pcap.c | 33 |
2 files changed, 33 insertions, 9 deletions
diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt index 6284608..11ddcff 100644 --- a/libssh/CMakeLists.txt +++ b/libssh/CMakeLists.txt @@ -93,6 +93,7 @@ set(libssh_SRCS misc.c options.c packet.c + pcap.c poll.c session.c scp.c @@ -101,14 +102,6 @@ set(libssh_SRCS wrapper.c ) -if (WITH_PCAP) - set(libssh_SRCS - ${libssh_SRCS} - pcap.c - ) - -endif (WITH_PCAP) - if (WITH_SFTP) set(libssh_SRCS ${libssh_SRCS} diff --git a/libssh/pcap.c b/libssh/pcap.c index 2da0087..e2e8937 100644 --- a/libssh/pcap.c +++ b/libssh/pcap.c @@ -379,6 +379,37 @@ int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcap){ } -#endif /* WITH_PCAP */ +#else /* WITH_PCAP */ + +/* Simple stub returning errors when no pcap compiled in */ + +#include "libssh/libssh.h" +#include "libssh/priv.h" + +int ssh_pcap_file_close(ssh_pcap_file pcap){ + (void) pcap; + return SSH_ERROR; +} + +void ssh_pcap_file_free(ssh_pcap_file pcap){ + (void) pcap; +} + +ssh_pcap_file ssh_pcap_file_new(void){ + return NULL; +} +int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename){ + (void) pcap; + (void) filename; + return SSH_ERROR; +} + +int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile){ + (void) pcapfile; + ssh_set_error(session,SSH_REQUEST_DENIED,"Pcap support not compiled in"); + return SSH_ERROR; +} + +#endif /** @} */ /* vim: set ts=2 sw=2 et cindent: */ |