cvs: php-src(PHP_4_3) /ext/openssl openssl.c

From: Date: Sun, 13 Jul 2003 10:13:19 +0000
Subject: cvs: php-src(PHP_4_3) /ext/openssl openssl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-22535@lists.php.net to get a copy of this message
sr Sun Jul 13 06:13:19 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/openssl openssl.c Log: MFH: fixed certificate version, serial number not always 0. Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.52.2.14 php-src/ext/openssl/openssl.c:1.52.2.15 --- php-src/ext/openssl/openssl.c:1.52.2.14 Sun Jun 8 19:42:44 2003 +++ php-src/ext/openssl/openssl.c Sun Jul 13 06:13:19 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.52.2.14 2003/06/08 23:42:44 iliaa Exp $ */ +/* $Id: openssl.c,v 1.52.2.15 2003/07/13 10:13:19 sr Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1424,12 +1424,13 @@ } /* }}} */ -/* {{{ proto resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days) +/* {{{ proto resource openssl_csr_sign(mixed csr, mixed x509, mixed priv_key, long days [, array config_args [, long serial]]) Signs a cert with another CERT */ PHP_FUNCTION(openssl_csr_sign) { zval * zcert = NULL, *zcsr, *zpkey, *args = NULL; long num_days; + long serial = 0L; X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key; @@ -1437,7 +1438,7 @@ int i; struct php_x509_request req; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!", &zcsr, &zcert, &zpkey, &num_days, &args) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) return; RETVAL_FALSE; @@ -1493,11 +1494,10 @@ goto cleanup; } /* Version 3 cert */ - if (!X509_set_version(new_cert, 3)) + if (!X509_set_version(new_cert, 2)) goto cleanup; - /* TODO: Allow specifying */ - ASN1_INTEGER_set(X509_get_serialNumber(new_cert), 0L); + ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr));

« previous php.cvs (#22535) next »