Brakujace biblioteki... ale jakie ?

pszemaz WP pszemaz w wp.pl
Czw, 1 Wrz 2005, 23:35:47 CEST


Witaj pld-users-pl!

Mam taki malutki skrypcik do zrobienia/skompilowania.
Na programowaniu ogolnie za bardzo sie nie znam, ale od razu mowie ze
wertowalem google i doinstalowywalem paczki jakie tam spotkalem w
opisach/podpowiedziach gdy cytowalem moje "errory" no ale nie pomoglo.

Oto skrypt, w nim w komentarzu na poczatku jest takze linia jaka mam
wywolac:

===========

/*

Compilation:
  gcc -s -O3 -D_GNU_SOURCE -fPIC -shared -ldl -o hllinfix.so hllinfix.c

*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <dlfcn.h>

/* uncomment the following #define to know
   the possible IP address of the attacker
   (remember that the attacker can spoof it) */
#define SHOW_ATTACKER 1

static ssize_t (*old_recvfrom)(int s, void *buf, size_t len, int flags,
    struct sockaddr *from, socklen_t *fromlen) = 0;

ssize_t recvfrom(int s, void *buf, size_t len, int flags,
    struct sockaddr *from, socklen_t *fromlen)
{
    ssize_t ret;

    if(!old_recvfrom) {
        old_recvfrom = dlsym(RTLD_NEXT, "recvfrom");
        if(!old_recvfrom) exit(-1);
    }

    ret = old_recvfrom(s, buf, len, flags, from, fromlen);
    if((ret == 8 && *(unsigned long *)buf == 0xfffffffe) ||
            (ret > 9 && *(unsigned long *)buf == 0xfffffffe && 
             ((((unsigned char*)buf)[8] & 0xf0) >> 4) * 1391 + ret - 9 > 0xfaa)) {
#ifdef SHOW_ATTACKER
        printf("- Packet split attack from %s\n",
                inet_ntoa(((struct sockaddr_in *)from)->sin_addr));
#endif
        return(0);
    }

    return(ret);
}
==============

a oto co jest wynikiem:

hlds_20040707fix.c:27:19: stdio.h: No such file or directory
hlds_20040707fix.c:28:20: stdlib.h: No such file or directory
hlds_20040707fix.c:29:20: unistd.h: No such file or directory
hlds_20040707fix.c:30:23: sys/types.h: No such file or directory
hlds_20040707fix.c:31:24: sys/socket.h: No such file or directory
hlds_20040707fix.c:32:23: arpa/inet.h: No such file or directory
hlds_20040707fix.c:33:24: netinet/in.h: No such file or directory
hlds_20040707fix.c:34:20: string.h: No such file or directory
hlds_20040707fix.c:35:19: dlfcn.h: No such file or directory
hlds_20040707fix.c:42: error: parse error before '*' token
hlds_20040707fix.c:42: error: parse error before "size_t"
hlds_20040707fix.c:43: error: `ssize_t' declared as function returning a function
hlds_20040707fix.c:43: error: function `ssize_t' is initialized like a variable
hlds_20040707fix.c:45: error: parse error before "recvfrom"
hlds_20040707fix.c:45: error: parse error before "size_t"
hlds_20040707fix.c: In function `recvfrom':
hlds_20040707fix.c:48: error: parse error before "ret"
hlds_20040707fix.c:50: error: `old_recvfrom' undeclared (first use in this function)
hlds_20040707fix.c:50: error: (Each undeclared identifier is reported only once
hlds_20040707fix.c:50: error: for each function it appears in.)
hlds_20040707fix.c:51: error: `RTLD_NEXT' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `ret' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `old_recvfrom' used prior to declaration
hlds_20040707fix.c:55: error: `s' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `buf' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `len' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `flags' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `from' undeclared (first use in this function)
hlds_20040707fix.c:55: error: `fromlen' undeclared (first use in this function)



No i nie wiem jak to ugrysc :(
Moze ktos mi pomoze, bede wdzieczny.. niby niewielka sprawa, ale dla
mnie jednak..
Pozdrawiam!

-- 
Pozdrowienia,
 pszemaz WP





Więcej informacji o liście dyskusyjnej pld-users-pl