i have a small program i wrote to do this it is functional

it has been posted to devel ... 

ie clamctrl PING
   clamctrl SCAN /tmp/badvirus

gcc clamctrl.c -DBUFF_SIZE=2048 -o clamctrl

#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>

#ifndef BUFF_SIZE
#define BUFF_SIZE 8192
#endif


int main(int argc, char **argv) {

  int sockfd,len;
  struct sockaddr_un server;
  char* buff;

  if (argc < 2) {
    fprintf(stderr,"No Arguments Supplied\n");
    exit(1);
  }
  if((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
    fprintf(stderr, "ERROR: socket() error: ");
    exit(1);
  }
  server.sun_family = AF_UNIX;
  strncpy(server.sun_path,"/tmp/clamd", sizeof(server.sun_path));

  if(connect(sockfd,(struct sockaddr *)&server, sizeof(struct
sockaddr_un)) == -1) {
    fprintf(stderr, "ERROR: can't connect(): \n");
    exit(1);
  }

  buff=(char*)malloc(BUFF_SIZE);
  strcpy(buff,argv[1]);
  if (argc == 3) {
    strcat(buff," ");
    strcat(buff,argv[2]);
  }
  len=write(sockfd,buff,strlen(buff));
  read(sockfd,buff,BUFF_SIZE);
  fprintf(stdout,"%s",buff);
  free(buff);
}


On Thu, 2002-11-07 at 10:43, Mike Friedrich wrote:
> In Network-Socket-Mode i use natcat or telnet to send commands to clamd.
> What command should i use in local socket mode?
> (echo "PING" >/tmp/clamd-socketfile seems not to work)
> 
> -----Ursprungliche Nachricht-----
> Von: Tomasz Kojm [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 7. November 2002 08:50
> An: [EMAIL PROTECTED]
> Betreff: Re: [clamav-users] problems with clamd/clamuko/dazuko
> 
> 
> > I use SuSe Linux 7.0 and have 3 problems with
> > clam 0.53 and dazuko 1.1.1:
> > 1. dazuko/clamuko blocks the file access if clamd is stopped.
> >    Is there any solution known?
> 
> rmmod dazuko
> 
> > 2. dazuko/clamuko doesn't "remove" file excludes/includes
> >    if i change the configs (restart of clamd is not working here).
> >    Is here a rmmod+insmod required to reset dazuko?
> 
> clamd currently can't reload the config file on the fly.
> 
> > 3. The shutdown through QUIT command of clamd (tcp-socket-mode)
> >    works, but it needs one or two minutes until the port is freed
> >    and the process is gone (after a network-timeout? the socket
> >    is in mode TIMEDWAIT). Is this a bug?
>  
> This is not a bug. If you are nervous ;) just use a local socket.
> 
> Best regards,
> Tomasz Kojm
> -- 
>       oo    .....             [EMAIL PROTECTED]
>      (\/)\.........           http://www.konarski.edu.pl/~zolw
>         \..........._         I nie zapomnij kliknac w brzuszek... 
>           //\   /\\   <- C. Amboinensis    www.pajacyk.pl        
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to