[pubcookie-dev] WEBISO CVS update: willey; libpubcookie.c,2.47.2.1,2.47.2.2 ntmpl.c,1.2.4.1,1.2.4.2 security_legacy.c,1.18.2.1,1.18.2.2

Stephen Willey willey at cac.washington.edu
Wed Jan 29 18:58:42 PST 2003


Update of /usr/local/cvsroot/webiso/pubcookie/src
 In directory webiso-cvs.cac.washington.edu:/var/tmp/cvs-serv20769
 
 Modified Files:
       Tag: p_everywhere
 	mod_pubcookie.c libpubcookie.c ntmpl.c security_legacy.c 
 Log Message:
 made some free()s that could be run in the module pbc_free()s



Index: webiso/pubcookie/src/mod_pubcookie.c
diff -c webiso/pubcookie/src/mod_pubcookie.c:1.108.2.2 webiso/pubcookie/src/mod_pubcookie.c:1.108.2.3
*** webiso/pubcookie/src/mod_pubcookie.c:1.108.2.2	Wed Jan 29 12:08:00 2003
--- webiso/pubcookie/src/mod_pubcookie.c	Wed Jan 29 18:58:40 2003
***************
*** 18,24 ****
   */
  
  /*
!     $Id: mod_pubcookie.c,v 1.108.2.2 2003/01/29 20:08:00 willey Exp $
   */
  
  #ifdef HAVE_CONFIG_H
--- 18,24 ----
   */
  
  /*
!     $Id: mod_pubcookie.c,v 1.108.2.3 2003/01/30 02:58:40 willey Exp $
   */
  
  #ifdef HAVE_CONFIG_H
***************
*** 429,435 ****
                  res = -1;
              }
          }
-         if (blob) free(blob);
  
          /* set */
          new_cookie = ap_psprintf(r->pool, "%s=%s; path=%s;%s", 
--- 429,434 ----
***************
*** 1478,1484 ****
            cfg->cred_transfer = ap_palloc(p, plainlen);
            memcpy(cfg->cred_transfer, plain, plainlen);
            cfg->cred_transfer_len = plainlen;
-           free(plain);
        }
  
        /* set a random KRB5CCNAME */
--- 1477,1482 ----


Index: webiso/pubcookie/src/libpubcookie.c
diff -c webiso/pubcookie/src/libpubcookie.c:2.47.2.1 webiso/pubcookie/src/libpubcookie.c:2.47.2.2
*** webiso/pubcookie/src/libpubcookie.c:2.47.2.1	Wed Jan  8 16:51:27 2003
--- webiso/pubcookie/src/libpubcookie.c	Wed Jan 29 18:58:40 2003
***************
*** 18,24 ****
   */
  
  /* 
!     $Id: libpubcookie.c,v 2.47.2.1 2003/01/09 00:51:27 willey Exp $
   */
  
  #ifdef HAVE_CONFIG_H
--- 18,24 ----
   */
  
  /* 
!     $Id: libpubcookie.c,v 2.47.2.2 2003/01/30 02:58:40 willey Exp $
   */
  
  #ifdef HAVE_CONFIG_H
***************
*** 244,250 ****
  
  void free_debug(pool *p, void *ptr) {
      libpbc_debug(p, "  pbc_free= x%X\n",ptr);
!     free(ptr);
  }
  
  /* keep pumping stuff into the random state                                   */
--- 244,250 ----
  
  void free_debug(pool *p, void *ptr) {
      libpbc_debug(p, "  pbc_free= x%X\n",ptr);
!     pbc_free(p, ptr);
  }
  
  /* keep pumping stuff into the random state                                   */
***************
*** 585,596 ****
      cookie = (unsigned char *) libpbc_alloc_init(p, 4 * outlen / 3 + 20);
      if (!cookie) {
          libpbc_debug(p, "libpbc_sign_bundle_cookie: libpbc_alloc_init failed\n");
!         free(out);
          return NULL;
      }
  
      libpbc_base64_encode(p, (unsigned char *) out, cookie, outlen);
!     free(out);
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "libpbc_sign_bundle_cookie: goodbye\n");
  
      return cookie;
--- 585,596 ----
      cookie = (unsigned char *) libpbc_alloc_init(p, 4 * outlen / 3 + 20);
      if (!cookie) {
          libpbc_debug(p, "libpbc_sign_bundle_cookie: libpbc_alloc_init failed\n");
!         pbc_free(p, out);
          return NULL;
      }
  
      libpbc_base64_encode(p, (unsigned char *) out, cookie, outlen);
!     pbc_free(p, out);
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "libpbc_sign_bundle_cookie: goodbye\n");
  
      return cookie;
***************
*** 703,713 ****
      cookie_data = (pbc_cookie_data *) pbc_malloc(p, sizeof(pbc_cookie_data));
      if (!cookie_data) {
          libpbc_debug(p, "libpbc_unbundle_cookie: pbc_malloc(p, ) failed");
!         free(plain);
          return 0;
      }
      memcpy((*cookie_data).string, plain, sizeof(pbc_cookie_data));
!     free(plain);
  
      cookie_data = libpbc_destringify_cookie_data(p, cookie_data);
  
--- 703,713 ----
      cookie_data = (pbc_cookie_data *) pbc_malloc(p, sizeof(pbc_cookie_data));
      if (!cookie_data) {
          libpbc_debug(p, "libpbc_unbundle_cookie: pbc_malloc(p, ) failed");
!         pbc_free(p, plain);
          return 0;
      }
      memcpy((*cookie_data).string, plain, sizeof(pbc_cookie_data));
!     pbc_free(p, plain);
  
      cookie_data = libpbc_destringify_cookie_data(p, cookie_data);
  


Index: webiso/pubcookie/src/ntmpl.c
diff -c webiso/pubcookie/src/ntmpl.c:1.2.4.1 webiso/pubcookie/src/ntmpl.c:1.2.4.2
*** webiso/pubcookie/src/ntmpl.c:1.2.4.1	Wed Jan  8 16:51:27 2003
--- webiso/pubcookie/src/ntmpl.c	Wed Jan 29 18:58:40 2003
***************
*** 57,63 ****
        pbc_log_activity(PBC_LOG_ERROR,
  		 "abend: read %d bytes when expecting %d for template file %s", 
  		 readlen, len, fname);
!       free(template);
        return NULL;
    }
  
--- 57,63 ----
        pbc_log_activity(PBC_LOG_ERROR,
  		 "abend: read %d bytes when expecting %d for template file %s", 
  		 readlen, len, fname);
!       pbc_free(p, template);
        return NULL;
    }
  
***************
*** 133,139 ****
      /* print out everything from the last % on */
      fputs(t, htmlout);
  
!     free(template);
  }
  
  #ifdef TEST_NTMPL
--- 133,139 ----
      /* print out everything from the last % on */
      fputs(t, htmlout);
  
!     pbc_free(p, template);
  }
  
  #ifdef TEST_NTMPL


Index: webiso/pubcookie/src/security_legacy.c
diff -c webiso/pubcookie/src/security_legacy.c:1.18.2.1 webiso/pubcookie/src/security_legacy.c:1.18.2.2
*** webiso/pubcookie/src/security_legacy.c:1.18.2.1	Wed Jan  8 16:51:28 2003
--- webiso/pubcookie/src/security_legacy.c	Wed Jan 29 18:58:40 2003
***************
*** 165,177 ****
      /* first we try to use the ssl files */
      keyfile = mystrdup(p, libpbc_config_getstring(p, "ssl_key_file", NULL));
      if (keyfile && access(keyfile, R_OK | F_OK)) {
!         free(keyfile);
          /* not there ? */
          keyfile = NULL;
      }
      certfile = mystrdup(p, libpbc_config_getstring(p, "ssl_cert_file", NULL));
      if (certfile && access(certfile, R_OK | F_OK)) {
!         free(certfile);
          /* not there ? */
          certfile = NULL;
      }
--- 165,177 ----
      /* first we try to use the ssl files */
      keyfile = mystrdup(p, libpbc_config_getstring(p, "ssl_key_file", NULL));
      if (keyfile && access(keyfile, R_OK | F_OK)) {
!         pbc_free(p, keyfile);
          /* not there ? */
          keyfile = NULL;
      }
      certfile = mystrdup(p, libpbc_config_getstring(p, "ssl_cert_file", NULL));
      if (certfile && access(certfile, R_OK | F_OK)) {
!         pbc_free(p, certfile);
          /* not there ? */
          certfile = NULL;
      }
***************
*** 188,195 ****
  
          if (access(keyfile, R_OK | F_OK) || access(certfile, R_OK | F_OK)) {
              /* session keys not valid */
!             free(keyfile);
!             free(certfile);
              keyfile = NULL;
              certfile = NULL;
          }
--- 188,195 ----
  
          if (access(keyfile, R_OK | F_OK) || access(certfile, R_OK | F_OK)) {
              /* session keys not valid */
!             pbc_free(p, keyfile);
!             pbc_free(p, certfile);
              keyfile = NULL;
              certfile = NULL;
          }
***************
*** 207,214 ****
  
          if (access(keyfile, R_OK | F_OK) || access(certfile, R_OK | F_OK)) {
              /* login keys not valid */
!             free(keyfile);
!             free(certfile);
              keyfile = NULL;
              certfile = NULL;
          }
--- 207,214 ----
  
          if (access(keyfile, R_OK | F_OK) || access(certfile, R_OK | F_OK)) {
              /* login keys not valid */
!             pbc_free(p, keyfile);
!             pbc_free(p, certfile);
              keyfile = NULL;
              certfile = NULL;
          }
***************
*** 375,387 ****
  #endif
  
      if (keyfile != NULL)
!         free(keyfile);
      if (certfile != NULL)
!         free(certfile);
      if (g_keyfile != NULL)
!         free(g_keyfile);
      if (g_certfile != NULL)
!         free(g_certfile);
      
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "security_init: goodbye\n");
  
--- 375,387 ----
  #endif
  
      if (keyfile != NULL)
!         pbc_free(p, keyfile);
      if (certfile != NULL)
!         pbc_free(p, certfile);
      if (g_keyfile != NULL)
!         pbc_free(p, g_keyfile);
      if (g_certfile != NULL)
!         pbc_free(p, g_certfile);
      
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "security_init: goodbye\n");
  
***************
*** 519,531 ****
          if (!*outbuf) {
              pbc_log_activity(p, PBC_LOG_ERROR, 
                               "libpbc_mk_priv: pbc_malloc failed");
!             free(mysig);
              return -1;
          }
  
  	des_cfb64_encrypt( (unsigned char *) mysig, (unsigned char *) *outbuf, 
                             siglen, ks, &ivec, &i, DES_ENCRYPT);
! 	free(mysig);
  
  	des_cfb64_encrypt( (unsigned char *) buf, 
                         (unsigned char *) (*outbuf) + siglen, len, 
--- 519,532 ----
          if (!*outbuf) {
              pbc_log_activity(p, PBC_LOG_ERROR, 
                               "libpbc_mk_priv: pbc_malloc failed");
!             pbc_free(p, mysig);
              return -1;
          }
  
  	des_cfb64_encrypt( (unsigned char *) mysig, (unsigned char *) *outbuf, 
                             siglen, ks, &ivec, &i, DES_ENCRYPT);
! 
! 	pbc_free(p, mysig);
  
  	des_cfb64_encrypt( (unsigned char *) buf, 
                         (unsigned char *) (*outbuf) + siglen, len, 
***************
*** 537,543 ****
      if (r) {
          pbc_log_activity(p, PBC_LOG_ERROR, 
                           "libpbc_mk_safe() failed");
! 	free(*outbuf);
  	*outbuf = NULL;
      }
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "libpbc_mk_priv: goodbye\n");
--- 538,544 ----
      if (r) {
          pbc_log_activity(p, PBC_LOG_ERROR, 
                           "libpbc_mk_safe() failed");
! 	pbc_free(p, *outbuf);
  	*outbuf = NULL;
      }
      pbc_log_activity(p, PBC_LOG_DEBUG_LOW, "libpbc_mk_priv: goodbye\n");
***************
*** 618,624 ****
      if (r) {
          pbc_log_activity(p, PBC_LOG_ERROR, 
                           "plaintext received was %s", *outbuf);
!         free(*outbuf);
          *outbuf = 0;
      }
  
--- 619,625 ----
      if (r) {
          pbc_log_activity(p, PBC_LOG_ERROR, 
                           "plaintext received was %s", *outbuf);
!         pbc_free(p, *outbuf);
          *outbuf = 0;
      }
  
***************
*** 668,674 ****
  	/* xxx log openssl error */
  	pbc_log_activity(p, PBC_LOG_ERROR, 
                           "EVP_SignFinal failed");
!         free(sig);
  	r = -1;
      }
  
--- 669,675 ----
  	/* xxx log openssl error */
  	pbc_log_activity(p, PBC_LOG_ERROR, 
                           "EVP_SignFinal failed");
!         pbc_free(p, sig);
  	r = -1;
      }
  



end of message


More information about the pubcookie-dev mailing list