diff options
author | felics | 2018-11-28 20:07:13 +0100 |
---|---|---|
committer | felics | 2018-11-28 20:07:13 +0100 |
commit | 75500820ee9c47a3beb18a61f9327c707f576d1e (patch) | |
tree | 4035b246c885fa2878b2f5d6a89849a74e03cc2a | |
parent | c43a31a9a718dccdb40720a667b6e0b0c8a3029b (diff) | |
download | aur-75500820ee9c47a3beb18a61f9327c707f576d1e.tar.gz |
Fixing an error with multiple processes trying to create the same key/ certificate.
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 9 | ||||
-rw-r--r-- | certificates.c.diff | 69 |
3 files changed, 80 insertions, 2 deletions
@@ -1,7 +1,7 @@ pkgbase = wwwoffle-svn pkgdesc = Simple caching proxy server with special features (request, recursive fetch, subscription, modify HTML, ...) for use with dial-up internet links. Includes startup scripts for OpenRC, System V init, systemd. pkgver = 2.9j+svn2242 - pkgrel = 3 + pkgrel = 4 epoch = 1 url = http://www.gedanken.org.uk/software/wwwoffle/ install = wwwoffle.install @@ -29,12 +29,14 @@ pkgbase = wwwoffle-svn backup = etc/conf.d/wwwoffle backup = etc/wwwoffle/wwwoffle.conf source = wwwoffle::svn+http://gedanken.org.uk/svn/wwwoffle/trunk + source = certificates.c.diff source = conf_d_wwwoffle source = initscript_openrc source = initscript_systemd source = initscript_sysvinit source = wwwoffle.install sha256sums = SKIP + sha256sums = aadd6ded716dff0210040f57bcb92c8f71df8a45b6183d2148ba0f89a65b8c3c sha256sums = 5491ffc23ae113db4b46167883594b5bcb6f1bbd0ce11432bc45047efbd635d2 sha256sums = d9451db92f979a6573cecbab23c26b6ca8ea026ef61b22ec4b61c0c9051142e9 sha256sums = 03bebce87a0da1b383666ab7a95b9810e15f2a024c0954f09c959d342c5d9c87 @@ -7,7 +7,7 @@ pkgname="${_pkgname}-svn" # _pkgver=2.9j epoch=1 pkgver=2.9j+svn2242 -pkgrel=3 +pkgrel=4 pkgdesc="Simple caching proxy server with special features (request, recursive fetch, subscription, modify HTML, ...) for use with dial-up internet links. Includes startup scripts for OpenRC, System V init, systemd." arch=('i686' 'x86_64' 'arm' 'arm64') url="http://www.gedanken.org.uk/software/wwwoffle/" @@ -47,6 +47,7 @@ _svnurl="http://gedanken.org.uk/svn/wwwoffle/trunk" source=( # "http://www.gedanken.org.uk/software/wwwoffle/download/${_pkgname}-${_pkgver}.tgz" "${_pkgname}::svn+${_svnurl}" + 'certificates.c.diff' 'conf_d_wwwoffle' 'initscript_openrc' 'initscript_systemd' @@ -57,6 +58,7 @@ source=( sha256sums=( # 'e6341a4ec2631dc22fd5209c7e5ffe628a5832ad191d444c56aebc3837eed2ae' # Main source, release 'SKIP' # Main source, SVN + 'aadd6ded716dff0210040f57bcb92c8f71df8a45b6183d2148ba0f89a65b8c3c' # certificates.c.diff '5491ffc23ae113db4b46167883594b5bcb6f1bbd0ce11432bc45047efbd635d2' # conf_d_wwwoffle 'd9451db92f979a6573cecbab23c26b6ca8ea026ef61b22ec4b61c0c9051142e9' # initscript_openrc '03bebce87a0da1b383666ab7a95b9810e15f2a024c0954f09c959d342c5d9c87' # initscript_systemd @@ -129,8 +131,13 @@ pkgver() { prepare() { _unpackeddir="${srcdir}/${_pkgname}" + cd "${_unpackeddir}" + ### Apply patches. + msg2 "Applying a patch to handle certificate related problems ..." + patch -N -p0 --follow-symlinks --verbose -i "${srcdir}/certificates.c.diff" + ### Update version.h to the actual version. _ver="$(_pgmver)" _rev="$(_svnrelease)" diff --git a/certificates.c.diff b/certificates.c.diff new file mode 100644 index 000000000000..648976a08c47 --- /dev/null +++ b/certificates.c.diff @@ -0,0 +1,69 @@ +Index: src/certificates.c +=================================================================== +--- src/certificates.c (revision 2241) ++++ src/certificates.c (working copy) +@@ -805,8 +805,12 @@ + + if(stat(keyfilename,&buf) || buf.st_size==0) + { +- if(CreatePrivateKey(keyfilename)) +- {PrintMessage(Warning,"Could not create the WWWOFFLE private key file '%s'.",keyfilename);goto finished;} ++ err=CreatePrivateKey(keyfilename); ++ ++ if(err<0) ++ {PrintMessage(Warning,"Could not create the WWWOFFLE private key file '%s'; already exists, using it.",keyfilename); goto readagain;} ++ else if(err>0) ++ {PrintMessage(Warning,"Could not create the WWWOFFLE private key file '%s'.",keyfilename); goto finished;} + } + + if(stat(keyfilename,&buf) || buf.st_size==0) +@@ -838,8 +842,10 @@ + else + err=CreateCertificate(crtfilename,hostname,NULL,privkey); + +- if(err) +- {PrintMessage(Warning,"Could not create the WWWOFFLE certificate file '%s'.",crtfilename);goto finished;} ++ if(err<0) ++ {PrintMessage(Warning,"Could not create the WWWOFFLE certificate file '%s'; already exists, using it.",crtfilename); goto readagain;} ++ else if(err>0) ++ {PrintMessage(Warning,"Could not create the WWWOFFLE certificate file '%s'.",crtfilename); goto finished;} + } + + if(stat(crtfilename,&buf) || buf.st_size==0) +@@ -896,8 +902,17 @@ + + err=gnutls_certificate_set_x509_key(cred,&crt,1,privkey); + if(err!=GNUTLS_E_SUCCESS) +- {PrintMessage(Warning,"Could not set private key for %s credentials for '%s' [%s].",server?"server":"fake",hostname,gnutls_strerror(err));gnutls_certificate_free_credentials(cred);goto finished;} ++ { ++ gnutls_certificate_free_credentials(cred); + ++ PrintMessage(Warning,"Could not set private key for %s credentials for '%s' [%s].",server?"server":"fake",hostname,gnutls_strerror(err)); ++ ++ if(unlink(crtfilename)) ++ {PrintMessage(Warning,"Cannot delete the invalid WWWOFFLE %s certificate file for '%s'.",server?"server":"fake",hostname); goto finished;} ++ ++ goto readagain; ++ } ++ + if(dh_params) + gnutls_certificate_set_dh_params(cred,dh_params); + +@@ -946,7 +961,7 @@ + + /* Create the file for the certificate. */ + +- fd=open(filename,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); ++ fd=open(filename,O_WRONLY|O_CREAT|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if(fd<0) + {PrintMessage(Warning,"Could not open certificate file '%s' for writing [%!s].",filename);return(-1);} + close(fd); +@@ -1102,7 +1117,7 @@ + + /* Create the file for the certificate. */ + +- fd=open(filename,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR); ++ fd=open(filename,O_WRONLY|O_CREAT|O_EXCL|O_BINARY,S_IRUSR|S_IWUSR); + if(fd<0) + {PrintMessage(Warning,"Could not open private key file '%s' for writing [%!s].",filename);return(-1);} + close(fd); |