rpms/nss-softokn/F-13 nss-softokn-3.12.4-prelink.patch, 1.1, 1.2 nss-softokn.spec, 1.32, 1.33

Elio Maldonado emaldonado at fedoraproject.org
Tue Apr 20 20:38:25 UTC 2010


Author: emaldonado

Update of /cvs/pkgs/rpms/nss-softokn/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv9666

Modified Files:
	nss-softokn-3.12.4-prelink.patch nss-softokn.spec 
Log Message:
Updated prelink patch rhbz#504949

nss-softokn-3.12.4-prelink.patch:
 Makefile |    6 ++
 shvfy.c  |  174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 stubs.c  |   33 +++++++++++
 stubs.h  |    2 
 4 files changed, 215 insertions(+)

Index: nss-softokn-3.12.4-prelink.patch
===================================================================
RCS file: /cvs/pkgs/rpms/nss-softokn/F-13/nss-softokn-3.12.4-prelink.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- nss-softokn-3.12.4-prelink.patch	15 Apr 2010 15:38:52 -0000	1.1
+++ nss-softokn-3.12.4-prelink.patch	20 Apr 2010 20:38:25 -0000	1.2
@@ -1,6 +1,6 @@
 diff -up ./mozilla/security/nss/lib/freebl/Makefile.prelink ./mozilla/security/nss/lib/freebl/Makefile
---- ./mozilla/security/nss/lib/freebl/Makefile.prelink	2010-04-14 15:35:18.233310000 -0700
-+++ ./mozilla/security/nss/lib/freebl/Makefile	2010-04-14 15:35:46.662165000 -0700
+--- ./mozilla/security/nss/lib/freebl/Makefile.prelink	2009-06-10 17:55:43.000000000 -0700
++++ ./mozilla/security/nss/lib/freebl/Makefile	2010-04-14 15:47:01.000000000 -0700
 @@ -77,6 +77,12 @@ endif
  ifdef FREEBL_NO_DEPEND
  	DEFINES += -DFREEBL_NO_DEPEND
@@ -15,8 +15,8 @@ diff -up ./mozilla/security/nss/lib/free
  # NSS_X64 means the target is a 64-bits x64 CPU architecture
  # NSS_X86_OR_X64 means the target is either x86 or x64
 diff -up ./mozilla/security/nss/lib/freebl/shvfy.c.prelink ./mozilla/security/nss/lib/freebl/shvfy.c
---- ./mozilla/security/nss/lib/freebl/shvfy.c.prelink	2010-04-14 15:35:29.013260000 -0700
-+++ ./mozilla/security/nss/lib/freebl/shvfy.c	2010-04-14 15:35:46.672165000 -0700
+--- ./mozilla/security/nss/lib/freebl/shvfy.c.prelink	2008-11-18 11:48:24.000000000 -0800
++++ ./mozilla/security/nss/lib/freebl/shvfy.c	2010-04-16 10:29:33.418528000 -0700
 @@ -35,6 +35,7 @@
   *
   * ***** END LICENSE BLOCK ***** */
@@ -25,7 +25,7 @@ diff -up ./mozilla/security/nss/lib/free
  
  #ifdef FREEBL_NO_DEPEND
  #include "stubs.h"
-@@ -48,6 +49,130 @@
+@@ -48,6 +49,168 @@
  #include "stdio.h"
  #include "prmem.h"
  
@@ -45,8 +45,12 @@ diff -up ./mozilla/security/nss/lib/free
 +bl_OpenUnPrelink(const char *shName, int *pid)
 +{
 +    char *command= strdup(FREEBL_PRELINK_COMMAND);
++    char *argString = NULL;
++    char  **argv = NULL;
++    char *shNameArg = NULL;
 +    char *cp;
 +    pid_t child;
++    int argc = 0, argNext = 0;
 +    struct stat statBuf;
 +    int pipefd[2] = {-1,-1};
 +    int ret;
@@ -57,24 +61,75 @@ diff -up ./mozilla/security/nss/lib/free
 +     * just reading the file */
 +    for (cp = command; *cp ; cp++) {
 +	if (*cp == ' ') {
-+	    *cp = 0;
++	    *cp++ = 0;
++	    argString = cp;
 +	    break;
 +        }
 +    }
 +    memset (&statBuf, 0, sizeof(statBuf));
 +    /* stat the file, follow the link */
 +    ret = stat(command, &statBuf);
-+    free(command);
 +    if (ret < 0) {
++	free(command);
 +	return PR_Open(shName, PR_RDONLY, 0);
 +    }
 +    /* file exits, make sure it's an executable */
 +    if (!S_ISREG(statBuf.st_mode) || 
 +			((statBuf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) == 0)) {
++	free(command);
 +	return PR_Open(shName, PR_RDONLY, 0);
 +    }
-+    
++
 +    /* OK, the prelink command exists and looks correct, use it */
++    /* build the arglist while we can still malloc */
++    /* count the args if any */
++    if (argString && *argString) {
++	/* argString may have leading spaces, strip them off*/
++	for (cp = argString; *cp && *cp == ' '; cp++);
++	argString = cp;
++	if (*cp) {
++	   /* there is at least one arg.. */
++	   argc = 1;
++	}
++
++        /* count the rest: Note there is no provision for escaped
++         * spaces here */
++	for (cp = argString; *cp ; cp++) {
++	    if (*cp == ' ') {
++		while (*cp && *cp == ' ') cp++;
++		if (*cp) argc++;
++	    }
++	}
++    }
++
++    /* add the additional args: argv[0] (command), shName, NULL*/
++    argc += 3;
++    argv = PORT_NewArray(char *, argc);
++    if (argv == NULL) {
++	goto loser;
++    }
++
++    /* fill in the arglist */
++    argv[argNext++] = command;
++    if (argString && *argString) {
++	argv[argNext++] = argString;
++	for (cp = argString; *cp; cp++) {
++	    if (*cp == ' ') {
++		*cp++ = 0;
++		while (*cp && *cp == ' ') cp++;
++		if (*cp) argv[argNext++] = cp;
++	    }
++	}
++    }
++    /* exec doesn't advertise taking const char **argv, do the paranoid
++     * copy */
++    shNameArg = strdup(shName);
++    if (shNameArg == NULL) {
++	goto loser;
++    }
++    argv[argNext++] = shNameArg;
++    argv[argNext++] = 0;
++    
 +    ret = pipe(pipefd);
 +    if (ret < 0) {
 +	goto loser;
@@ -84,53 +139,32 @@ diff -up ./mozilla/security/nss/lib/free
 +    child = vfork();
 +    if (child < 0) goto loser;
 +    if (child == 0) {
-+	char **argv;
-+	int args= 0, argNext = 0;
-+
 +	/* set up the file descriptors */
 +	close(0);
 +	/* associate pipefd[1] with stdout */
 +	if (pipefd[1] != 1) dup2(pipefd[1], 1);
 +	close(2);
++	close(pipefd[0]);
 +	/* should probably close the other file descriptors? */
 +
-+	command =  strdup(FREEBL_PRELINK_COMMAND);
-+
-+	/* exec prelink command to create a temp file */
-+        /* first count the args: Note there is no provision for escaped
-+         * spaces here */
-+	for (cp = command; *cp ; cp++) {
-+	    if (*cp == ' ') {
-+		while (*cp && *cp == ' ') cp++;
-+		if (*cp) args++;
-+	    }
-+	}
-+        /* add the additional args: argv[0] (path), shName, NULL*/
-+	args += 3;
-+	argv = PORT_NewArray(char *, args);
-+	if (argv == NULL) {
-+	    exit(1);
-+	}
 +
-+	argv[argNext++] = command;
-+	for (cp = command; *cp; cp++) {
-+	    if (*cp == ' ') {
-+		*cp++ = 0;
-+		while (*cp && *cp == ' ') cp++;
-+		if (*cp) argv[argNext++] = cp;
-+	    }
-+	}
-+	argv[argNext++] = strdup(shName);
-+	argv[argNext++] = 0;
 +	execv(command, argv);
-+	exit(1); /* shouldn't reach here except on an error */
++	/* avoid at_exit() handlers */
++	_exit(1); /* shouldn't reach here except on an error */
 +    }
 +    close(pipefd[1]);
 +    pipefd[1] = -1;
 +
++    /* this is safe because either vfork() as full fork() semantics, and thus
++     * already has it's own address space, or because vfork() has paused
++     * the parent util the exec or exit */
++    free(command);
++    free(shNameArg);
++    PORT_Free(argv);
++
 +    *pid = child;
 +
-+    return PR_ImportFile(pipefd[0]);
++    return PR_ImportPipe(pipefd[0]);
 +
 +loser:
 +    if (pipefd[0] != -1) {
@@ -139,24 +173,28 @@ diff -up ./mozilla/security/nss/lib/free
 +    if (pipefd[1] != -1) {
 +	close(pipefd[1]);
 +    }
-+    *pid = 0;
++    free(command);
++    free(shNameArg);
++    PORT_Free(argv);
 +
 +    return NULL;
 +}
 +
-+PRFileDesc *
++void
 +bl_CloseUnPrelink( PRFileDesc *file, int pid)
 +{
 +    /* close the file descriptor */
 +    PR_Close(file);
 +    /* reap the child */
-+    waitpid(pid, NULL, 0);
++    if (pid) {
++	waitpid(pid, NULL, 0);
++    }
 +}
 +#endif
  
  /* #define DEBUG_SHVERIFY 1 */
  
-@@ -117,6 +242,9 @@ BLAPI_SHVerify(const char *name, PRFuncP
+@@ -117,6 +280,9 @@ BLAPI_SHVerify(const char *name, PRFuncP
      SECStatus rv;
      DSAPublicKey key;
      int count;
@@ -166,7 +204,7 @@ diff -up ./mozilla/security/nss/lib/free
  
      PRBool result = PR_FALSE; /* if anything goes wrong,
  			       * the signature does not verify */
-@@ -197,7 +325,11 @@ BLAPI_SHVerify(const char *name, PRFuncP
+@@ -197,7 +363,11 @@ BLAPI_SHVerify(const char *name, PRFuncP
      checkFD = NULL;
  
      /* open our library file */
@@ -178,7 +216,7 @@ diff -up ./mozilla/security/nss/lib/free
      if (shFD == NULL) {
  #ifdef DEBUG_SHVERIFY
          fprintf(stderr, "Failed to open the library file %s: (%d, %d)\n",
-@@ -218,7 +350,11 @@ BLAPI_SHVerify(const char *name, PRFuncP
+@@ -218,7 +388,11 @@ BLAPI_SHVerify(const char *name, PRFuncP
  	SHA1_Update(hashcx, buf, bytesRead);
  	count += bytesRead;
      }
@@ -191,8 +229,8 @@ diff -up ./mozilla/security/nss/lib/free
  
      SHA1_End(hashcx, hash.data, &hash.len, hash.len);
 diff -up ./mozilla/security/nss/lib/freebl/stubs.c.prelink ./mozilla/security/nss/lib/freebl/stubs.c
---- ./mozilla/security/nss/lib/freebl/stubs.c.prelink	2010-04-14 15:35:37.353215000 -0700
-+++ ./mozilla/security/nss/lib/freebl/stubs.c	2010-04-14 15:35:46.680165000 -0700
+--- ./mozilla/security/nss/lib/freebl/stubs.c.prelink	2009-06-11 16:11:22.000000000 -0700
++++ ./mozilla/security/nss/lib/freebl/stubs.c	2010-04-14 15:47:01.000000000 -0700
 @@ -69,6 +69,7 @@
  #include <secport.h>
  #include <secitem.h>
@@ -255,8 +293,8 @@ diff -up ./mozilla/security/nss/lib/free
      STUB_FETCH_FUNCTION(PR_Read);
      STUB_FETCH_FUNCTION(PR_Seek);
 diff -up ./mozilla/security/nss/lib/freebl/stubs.h.prelink ./mozilla/security/nss/lib/freebl/stubs.h
---- ./mozilla/security/nss/lib/freebl/stubs.h.prelink	2010-04-14 15:35:43.782180000 -0700
-+++ ./mozilla/security/nss/lib/freebl/stubs.h	2010-04-14 15:35:46.690166000 -0700
+--- ./mozilla/security/nss/lib/freebl/stubs.h.prelink	2009-03-28 19:21:50.000000000 -0700
++++ ./mozilla/security/nss/lib/freebl/stubs.h	2010-04-14 15:47:01.000000000 -0700
 @@ -78,6 +78,8 @@
  #define PR_Lock  PR_Lock_stub
  #define PR_NewLock  PR_NewLock_stub


Index: nss-softokn.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nss-softokn/F-13/nss-softokn.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -p -r1.32 -r1.33
--- nss-softokn.spec	15 Apr 2010 15:39:31 -0000	1.32
+++ nss-softokn.spec	20 Apr 2010 20:38:25 -0000	1.33
@@ -18,7 +18,7 @@
 Summary:          Network Security Services Soktoken Module
 Name:             nss-softokn
 Version:          3.12.4
-Release:          16%{?dist}
+Release:          17%{?dist}
 License:          MPLv1.1 or GPLv2+ or LGPLv2+
 URL:              http://www.mozilla.org/projects/security/pki/nss/
 Group:            System Environment/Libraries
@@ -310,6 +310,9 @@ done
 %{_includedir}/nss3/shsign.h
 
 %changelog
+* Tue Apr 20 2010 Elio Maldonado <emaldona at redhat.com> - 3.12.4-17
+- Updated prelink patch rhbz#504949
+
 * Wed Apr 14 2010 Elio Maldonado <emaldona at redhat.com> - 3.12.4-16
 - allow prelink of softoken and freebl. Change the verify code to use
   prelink -u if prelink is installed. Fix by Robert Relyea rhbz#504949



More information about the scm-commits mailing list