File tree 2 files changed +16
-4
lines changed
2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -478,20 +478,30 @@ let check_verify_error line =
478
478
let split_1 c s =
479
479
match Astring.String. cut ~sep: c s with Some (x , _ ) -> x | None -> s
480
480
in
481
- if Astring.String. is_infix ~affix: " VERIFY ERROR: " line then
482
- match Astring.String. find_sub ~sub: " error=" line with
481
+ (* When verified with a mismatched certificate, one line of log from stunnel
482
+ * would look like:
483
+ SSL_connect: ssl/statem/statem_clnt.c:1889: error:0A000086:SSL routines::certificate verify failed
484
+ * in this case, Stunnel_verify_error can be raised with detailed error as
485
+ * reason if it can found in the log *)
486
+ if Astring.String. is_infix ~affix: " certificate verify failed" line then
487
+ match Astring.String. find_sub ~sub: " error:" line with
483
488
| Some e ->
484
489
raise
485
490
(Stunnel_verify_error
486
- (split_1 " ," (sub_after (e + String. length " error= " ) line))
491
+ (split_1 " ," (sub_after (e + String. length " error: " ) line))
487
492
)
488
493
| None ->
489
494
raise (Stunnel_verify_error " " )
495
+ else if
496
+ Astring.String. is_infix ~affix: " No certificate or private key specified"
497
+ line
498
+ then
499
+ raise (Stunnel_verify_error " The specified certificate is corrupt" )
490
500
else
491
501
()
492
502
493
503
let check_error s line =
494
- if Astring.String. is_infix ~affix: line s then
504
+ if Astring.String. is_infix ~affix: s line then
495
505
raise (Stunnel_error s)
496
506
497
507
let diagnose_failure st_proc =
Original file line number Diff line number Diff line change @@ -306,6 +306,8 @@ let sync ~__context ~self ~token ~token_id ~username ~password =
306
306
with
307
307
| Api_errors. Server_error (_ , _ ) as e ->
308
308
raise e
309
+ | Stunnel. Stunnel_verify_error reason ->
310
+ raise (Api_errors. Server_error (Api_errors. ssl_verify_error, [reason]))
309
311
| e ->
310
312
error " Failed to sync with remote YUM repository: %s"
311
313
(ExnHelper. string_of_exn e) ;
You can’t perform that action at this time.
0 commit comments