You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sc...@apache.org on 2011/11/07 19:33:36 UTC
svn commit: r1198861 - in /apr/apr/branches/1.4.x: random/unix/apr_random.c
threadproc/unix/proc.c
Author: sctemme
Date: Mon Nov 7 18:33:35 2011
New Revision: 1198861
URL: http://svn.apache.org/viewvc?rev=1198861&view=rev
Log:
Backport r1198860, small fix to apr_proc_fork() to make behavior
of child random entropy mix-in in apr_random_after_fork() more
in line with expectation.
Modified:
apr/apr/branches/1.4.x/random/unix/apr_random.c
apr/apr/branches/1.4.x/threadproc/unix/proc.c
Modified: apr/apr/branches/1.4.x/random/unix/apr_random.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/random/unix/apr_random.c?rev=1198861&r1=1198860&r2=1198861&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/random/unix/apr_random.c (original)
+++ apr/apr/branches/1.4.x/random/unix/apr_random.c Mon Nov 7 18:33:35 2011
@@ -159,6 +159,11 @@ APR_DECLARE(void) apr_random_after_fork(
apr_random_t *r;
for (r = all_random; r; r = r->next)
+ /*
+ * XXX Note: the pid does not provide sufficient entropy to
+ * actually call this secure. See Ben's paper referenced at
+ * the top of this file.
+ */
mixer(r,proc->pid);
}
Modified: apr/apr/branches/1.4.x/threadproc/unix/proc.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/threadproc/unix/proc.c?rev=1198861&r1=1198860&r2=1198861&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/threadproc/unix/proc.c (original)
+++ apr/apr/branches/1.4.x/threadproc/unix/proc.c Mon Nov 7 18:33:35 2011
@@ -219,15 +219,14 @@ APR_DECLARE(apr_status_t) apr_procattr_d
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
{
int pid;
+
+ memset(proc, 0, sizeof(apr_proc_t));
if ((pid = fork()) < 0) {
return errno;
}
else if (pid == 0) {
- proc->pid = pid;
- proc->in = NULL;
- proc->out = NULL;
- proc->err = NULL;
+ proc->pid = getpid();
apr_random_after_fork(proc);
@@ -235,9 +234,6 @@ APR_DECLARE(apr_status_t) apr_proc_fork(
}
proc->pid = pid;
- proc->in = NULL;
- proc->out = NULL;
- proc->err = NULL;
return APR_INPARENT;
}