Fix OLD_CNFS, remove unused variables, fix cnfs_next for innconf->maxartsize==0

Alex Kiernan alexk at demon.net
Fri Apr 6 15:37:53 UTC 2001


Index: cnfs.c
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/storage/cnfs/cnfs.c,v
retrieving revision 1.85
diff -c -r1.85 cnfs.c
*** cnfs.c	2001/04/04 22:56:09	1.85
--- cnfs.c	2001/04/06 15:22:49
***************
*** 168,174 ****
  }
  
  static bool CNFSflushhead(CYCBUFF *cycbuff) {
-   int			b;
    CYCBUFFEXTERN		rpx;
  
    if (!cycbuff->needflush)
--- 168,173 ----
***************
*** 525,531 ****
  static bool CNFSinit_disks(CYCBUFF *cycbuff) {
    char		buf[64];
    CYCBUFFEXTERN	*rpx;
!   int		fd, bytes;
    CYCBUFF_OFF_T	tmpo;
    bool		oneshot;
  
--- 524,530 ----
  static bool CNFSinit_disks(CYCBUFF *cycbuff) {
    char		buf[64];
    CYCBUFFEXTERN	*rpx;
!   int		fd;
    CYCBUFF_OFF_T	tmpo;
    bool		oneshot;
  
***************
*** 1156,1166 ****
      CNFSARTHEADER	cah;
      PRIV_CNFS		*private;
      char		*p;
!     long		pagefudge, blockfudge;
      CYCBUFF_OFF_T	mmapoffset;
      static TOKEN	ret_token;
      static bool		nomessage = FALSE;
-     CYCBUFF_OFF_T	middle, limit;
      int			plusoffset = 0;
  
      if (token.type != TOKEN_CNFS) {
--- 1155,1164 ----
      CNFSARTHEADER	cah;
      PRIV_CNFS		*private;
      char		*p;
!     long		pagefudge;
      CYCBUFF_OFF_T	mmapoffset;
      static TOKEN	ret_token;
      static bool		nomessage = FALSE;
      int			plusoffset = 0;
  
      if (token.type != TOKEN_CNFS) {
***************
*** 1222,1228 ****
      if(cah.size == htonl(0x1234) && ntohl(cah.arrived) < time(NULL)-10*365*24*3600) {
  	oldCNFSARTHEADER cahh;
  	*(CNFSARTHEADER *)&cahh = cah;
! 	if(read(cycbuff->fd, ((char *)&cahh)+sizeof(CNFSARTHEADER), sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) != sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) {
              SMseterror(SMERR_UNDEFINED, "read2 failed");
              syslog(L_ERROR, "%s: could not read2 token %s %s:0x%s:%ld: %m",
                      LocalLogName, TokenToText(token), cycbuffname,
--- 1220,1226 ----
      if(cah.size == htonl(0x1234) && ntohl(cah.arrived) < time(NULL)-10*365*24*3600) {
  	oldCNFSARTHEADER cahh;
  	*(CNFSARTHEADER *)&cahh = cah;
! 	if(pread(cycbuff->fd, ((char *)&cahh)+sizeof(CNFSARTHEADER), sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER), offset+sizeof(cah)) != sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) {
              SMseterror(SMERR_UNDEFINED, "read2 failed");
              syslog(L_ERROR, "%s: could not read2 token %s %s:0x%s:%ld: %m",
                      LocalLogName, TokenToText(token), cycbuffname,
***************
*** 1258,1270 ****
      /* checking the bitmap to ensure cah.size is not broken was dropped */
      if (innconf->cnfscheckfudgesize != 0 && innconf->maxartsize != 0 &&
  	(ntohl(cah.size) > innconf->maxartsize + innconf->cnfscheckfudgesize)) {
! 	char buf1[24], buf2[24], buf3[24];
  	strcpy(buf1, CNFSofft2hex(cycbuff->free, FALSE));
- 	strcpy(buf2, CNFSofft2hex(middle, FALSE));
- 	strcpy(buf3, CNFSofft2hex(limit, FALSE));
  	SMseterror(SMERR_UNDEFINED, "CNFSARTHEADER fudge size overflow");
! 	syslog(L_ERROR, "%s: fudge size overflows bitmaps %s %s:0x%s:0x%s:0x%s: %ld",
! 	LocalLogName, TokenToText(token), cycbuffname, buf1, buf2, buf3, ntohl(cah.size));
  	if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	DISPOSE(art);
  	return NULL;
--- 1256,1266 ----
      /* checking the bitmap to ensure cah.size is not broken was dropped */
      if (innconf->cnfscheckfudgesize != 0 && innconf->maxartsize != 0 &&
  	(ntohl(cah.size) > innconf->maxartsize + innconf->cnfscheckfudgesize)) {
! 	char buf1[24];
  	strcpy(buf1, CNFSofft2hex(cycbuff->free, FALSE));
  	SMseterror(SMERR_UNDEFINED, "CNFSARTHEADER fudge size overflow");
! 	syslog(L_ERROR, "%s: fudge size overflows bitmaps %s %s:0x%s: %ld",
! 	LocalLogName, TokenToText(token), cycbuffname, buf1, ntohl(cah.size));
  	if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	DISPOSE(art);
  	return NULL;
***************
*** 1528,1534 ****
      if(cah.size == htonl(0x1234) && ntohl(cah.arrived) < time(NULL)-10*365*24*3600) {
  	oldCNFSARTHEADER cahh;
  	*(CNFSARTHEADER *)&cahh = cah;
! 	if(read(cycbuff->fd, ((char *)&cahh)+sizeof(CNFSARTHEADER), sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) != sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) {
  	    if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	    return (ARTHANDLE *)NULL;
  	}
--- 1524,1530 ----
      if(cah.size == htonl(0x1234) && ntohl(cah.arrived) < time(NULL)-10*365*24*3600) {
  	oldCNFSARTHEADER cahh;
  	*(CNFSARTHEADER *)&cahh = cah;
! 	if(pread(cycbuff->fd, ((char *)&cahh)+sizeof(CNFSARTHEADER), sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER), offset+sizeof(cah)) != sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) {
  	    if (!SMpreopen) CNFSshutdowncycbuff(cycbuff);
  	    return (ARTHANDLE *)NULL;
  	}
***************
*** 1587,1593 ****
  	    return art;
  	}
      }
!     if ((innconf->cnfscheckfudgesize != 0) && (ntohl(cah.size) > innconf->maxartsize + innconf->cnfscheckfudgesize)) {
  	art->data = NULL;
  	art->len = 0;
  	art->token = NULL;
--- 1583,1590 ----
  	    return art;
  	}
      }
!     if (innconf->cnfscheckfudgesize != 0 && innconf->maxartsize != 0 &&
! 	(ntohl(cah.size) > innconf->maxartsize + innconf->cnfscheckfudgesize)) {
  	art->data = NULL;
  	art->len = 0;
  	art->token = NULL;


More information about the inn-patches mailing list