Fossil SCM

Reformat some code in http_ssl.c

dmitry 2009-11-09 21:22 UTC ssl
Commit d92945e5dad0360a1b234a4e11cfb761524f8da6
1 file changed +5 -7
+5 -7
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -135,11 +135,11 @@
135135
136136
/* Get certificate for current server from global config and
137137
* (if we have it in config) add it to certificate store.
138138
*/
139139
cert = ssl_get_certificate();
140
- if ( cert != NULL ){
140
+ if ( cert!=NULL ){
141141
X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
142142
X509_free(cert);
143143
hasSavedCertificate = 1;
144144
}
145145
@@ -170,11 +170,11 @@
170170
return 1;
171171
}
172172
/* Check if certificate is valid */
173173
cert = SSL_get_peer_certificate(ssl);
174174
175
- if ( cert == NULL ){
175
+ if ( cert==NULL ){
176176
ssl_set_errmsg("No SSL certificate was presented by the peer");
177177
ssl_close();
178178
return 1;
179179
}
180180
@@ -199,11 +199,11 @@
199199
BIO_free(mem);
200200
201201
Blob ans;
202202
blob_zero(&ans);
203203
prompt_user(prompt, &ans);
204
- free( prompt );
204
+ free(prompt);
205205
if( blob_str(&ans)[0]!='y' && blob_str(&ans)[0]!='a' ) {
206206
X509_free(cert);
207207
ssl_set_errmsg("SSL certificate declined");
208208
ssl_close();
209209
return 1;
@@ -217,12 +217,11 @@
217217
}
218218
219219
/*
220220
** Save certificate to global config.
221221
*/
222
-void ssl_save_certificate(X509 *cert)
223
-{
222
+void ssl_save_certificate(X509 *cert){
224223
BIO *mem;
225224
char *zCert, *zHost;
226225
227226
mem = BIO_new(BIO_s_mem());
228227
PEM_write_bio_X509(mem, cert);
@@ -236,12 +235,11 @@
236235
237236
/*
238237
** Get certificate for g.urlName from global config.
239238
** Return NULL if no certificate found.
240239
*/
241
-X509 *ssl_get_certificate()
242
-{
240
+X509 *ssl_get_certificate(void){
243241
char *zHost, *zCert;
244242
BIO *mem;
245243
X509 *cert;
246244
247245
zHost = mprintf("cert:%s", g.urlName);
248246
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -135,11 +135,11 @@
135
136 /* Get certificate for current server from global config and
137 * (if we have it in config) add it to certificate store.
138 */
139 cert = ssl_get_certificate();
140 if ( cert != NULL ){
141 X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
142 X509_free(cert);
143 hasSavedCertificate = 1;
144 }
145
@@ -170,11 +170,11 @@
170 return 1;
171 }
172 /* Check if certificate is valid */
173 cert = SSL_get_peer_certificate(ssl);
174
175 if ( cert == NULL ){
176 ssl_set_errmsg("No SSL certificate was presented by the peer");
177 ssl_close();
178 return 1;
179 }
180
@@ -199,11 +199,11 @@
199 BIO_free(mem);
200
201 Blob ans;
202 blob_zero(&ans);
203 prompt_user(prompt, &ans);
204 free( prompt );
205 if( blob_str(&ans)[0]!='y' && blob_str(&ans)[0]!='a' ) {
206 X509_free(cert);
207 ssl_set_errmsg("SSL certificate declined");
208 ssl_close();
209 return 1;
@@ -217,12 +217,11 @@
217 }
218
219 /*
220 ** Save certificate to global config.
221 */
222 void ssl_save_certificate(X509 *cert)
223 {
224 BIO *mem;
225 char *zCert, *zHost;
226
227 mem = BIO_new(BIO_s_mem());
228 PEM_write_bio_X509(mem, cert);
@@ -236,12 +235,11 @@
236
237 /*
238 ** Get certificate for g.urlName from global config.
239 ** Return NULL if no certificate found.
240 */
241 X509 *ssl_get_certificate()
242 {
243 char *zHost, *zCert;
244 BIO *mem;
245 X509 *cert;
246
247 zHost = mprintf("cert:%s", g.urlName);
248
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -135,11 +135,11 @@
135
136 /* Get certificate for current server from global config and
137 * (if we have it in config) add it to certificate store.
138 */
139 cert = ssl_get_certificate();
140 if ( cert!=NULL ){
141 X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
142 X509_free(cert);
143 hasSavedCertificate = 1;
144 }
145
@@ -170,11 +170,11 @@
170 return 1;
171 }
172 /* Check if certificate is valid */
173 cert = SSL_get_peer_certificate(ssl);
174
175 if ( cert==NULL ){
176 ssl_set_errmsg("No SSL certificate was presented by the peer");
177 ssl_close();
178 return 1;
179 }
180
@@ -199,11 +199,11 @@
199 BIO_free(mem);
200
201 Blob ans;
202 blob_zero(&ans);
203 prompt_user(prompt, &ans);
204 free(prompt);
205 if( blob_str(&ans)[0]!='y' && blob_str(&ans)[0]!='a' ) {
206 X509_free(cert);
207 ssl_set_errmsg("SSL certificate declined");
208 ssl_close();
209 return 1;
@@ -217,12 +217,11 @@
217 }
218
219 /*
220 ** Save certificate to global config.
221 */
222 void ssl_save_certificate(X509 *cert){
 
223 BIO *mem;
224 char *zCert, *zHost;
225
226 mem = BIO_new(BIO_s_mem());
227 PEM_write_bio_X509(mem, cert);
@@ -236,12 +235,11 @@
235
236 /*
237 ** Get certificate for g.urlName from global config.
238 ** Return NULL if no certificate found.
239 */
240 X509 *ssl_get_certificate(void){
 
241 char *zHost, *zCert;
242 BIO *mem;
243 X509 *cert;
244
245 zHost = mprintf("cert:%s", g.urlName);
246

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button