diff --git a/http_server.c b/http_server.c index 91b68e3..5b77625 100644 --- a/http_server.c +++ b/http_server.c @@ -952,11 +952,15 @@ int execute_plugin(void* client, const char *path, const char *method, dictionar //load the plugin if((plugin = plugin_lookup(pname)) == NULL) if((plugin= plugin_load(pname)) == NULL) + { + if(orgs) free(orgs); return -1; + } // load the function fn = (void (*)(void*, const char *, const char*, dictionary))dlsym(plugin->handle, PLUGIN_HANDLER); if ((error = dlerror()) != NULL) { + if(orgs) free(orgs); LOG("Problem when finding %s method from %s : %s \n", PLUGIN_HANDLER, pname,error); return -1; } diff --git a/httpd.c b/httpd.c index d3c9c88..f14bf3c 100644 --- a/httpd.c +++ b/httpd.c @@ -189,7 +189,7 @@ int main(int argc, char* argv[]) struct sockaddr_in client_name; socklen_t client_name_len = sizeof(client_name); pthread_t newthread; - + char* client_ip = NULL; // ignore the broken PIPE error when writing //or reading to/from a closed socked connection signal(SIGPIPE, SIG_IGN); @@ -224,6 +224,15 @@ int main(int argc, char* argv[]) perror("Cannot accept client request\n"); continue; } + /* + get the remote IP + */ + if (client_name.sin_family == AF_INET) + { + client_ip = inet_ntoa(client_name.sin_addr); + LOG("Client IP: %s\n", client_ip); + } + //return &(((struct sockaddr_in6*)sa)->sin6_addr); /* accept_request(client_sock); */ client->sock = client_sock; server_config.connection++;