on Wed, Sep 01, 2004 at 05:01:14PM -0400, [EMAIL PROTECTED] wrote:
> Magnus Fromreide wrote:
> > On Wed, Sep 01, 2004 at 03:02:39PM +0100, Dave Shield wrote:
> > 
> 
> Magnus,
> Following your example, do you have a test case that
> would produce this expected result ?
> 
>   1.3.6.1.3.4 - 1.3.6.1.3.5
>   1.3.6.1.3.5 - 1.3.6.1.3.6
>   1.3.6.1.3.6 - 1.3.6.1.3.7
> 

The attached file registers that range but doesn't handle it.

With the current agent, get on 1.3.6.1.3.4.* terminates the program
while get on 1.3.6.1.3.5.* or 1.3.6.1.3.6.* doesn't.

With my patch get on 1.3.6.1.3.[4-6].* kills the program.

/MF
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>

int main()
{
    char buf[256];
    int fd;
    struct sockaddr_un sa;

    sa.sun_family = AF_UNIX;
    strcpy(sa.sun_path, "/var/master/agentx");

    fd = socket(PF_UNIX, SOCK_STREAM, 0);

    connect(fd, (struct sockaddr*)&sa, sizeof(sa));

    /* Open-PDU */
    write(fd,
          "\1\1\20\0"
          "\0\0\0\0"
          "\0\0\0\0"
          "\0\0\0\0"
          "\0\0\0\14"
          "\0\0\0\0"
          "\0\0\0\0"
          "\0\0\0\0", 32);

    /* Response-PDU */
    read(fd, buf, 256);

    /* Register-PDU */
    memcpy(buf, "\1\3\20\0", 4);
    memcpy(buf + 8,
          "\0\0\0\0"
          "\0\0\0\1"
          "\0\0\0\20"
          "\0\177\6\0"
          "\1\3\0\0"
          "\0\0\0\4"
          "\0\0\0\6",  28);
    write(fd, buf, 36);

    /* Response-PDU */
    read(fd, buf, 256);

    /* Block to avoid dying... */
    read(fd, buf, 256);

    /* Terminate */
    close(fd);
    return 0;
}

Reply via email to