File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -478,20 +478,30 @@ let check_verify_error line =
478478 let split_1 c s =
479479 match Astring.String. cut ~sep: c s with Some (x , _ ) -> x | None -> s
480480 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
483488 | Some e ->
484489 raise
485490 (Stunnel_verify_error
486- (split_1 " ," (sub_after (e + String. length " error= " ) line))
491+ (split_1 " ," (sub_after (e + String. length " error: " ) line))
487492 )
488493 | None ->
489494 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" )
490500 else
491501 ()
492502
493503let check_error s line =
494- if Astring.String. is_infix ~affix: line s then
504+ if Astring.String. is_infix ~affix: s line then
495505 raise (Stunnel_error s)
496506
497507let 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 =
306306 with
307307 | Api_errors. Server_error (_ , _ ) as e ->
308308 raise e
309+ | Stunnel. Stunnel_verify_error reason ->
310+ raise (Api_errors. Server_error (Api_errors. ssl_verify_error, [reason]))
309311 | e ->
310312 error " Failed to sync with remote YUM repository: %s"
311313 (ExnHelper. string_of_exn e) ;
You can’t perform that action at this time.
0 commit comments