File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use ngx::collections::Vec;
18
18
use ngx:: ngx_log_debug;
19
19
use openssl:: pkey:: { PKey , PKeyRef , Private } ;
20
20
use openssl:: x509:: { self , extension as x509_ext, X509Req } ;
21
- use types:: ProblemCategory ;
21
+ use types:: { AccountStatus , ProblemCategory } ;
22
22
23
23
use self :: account_key:: { AccountKey , AccountKeyError } ;
24
24
use self :: types:: { AuthorizationStatus , ChallengeKind , ChallengeStatus , OrderStatus } ;
@@ -287,6 +287,11 @@ where
287
287
288
288
let res = self . post ( & self . directory . new_account , payload) . await ?;
289
289
290
+ let account: types:: Account = deserialize_body ( res. body ( ) ) ?;
291
+ if !matches ! ( account. status, AccountStatus :: Valid ) {
292
+ return Err ( NewAccountError :: Status ( account. status ) ) ;
293
+ }
294
+
290
295
let key_id: & str =
291
296
try_get_header ( res. headers ( ) , http:: header:: LOCATION ) . ok_or ( NewAccountError :: Url ) ?;
292
297
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use ngx::allocator::{unsize_box, Box};
9
9
use thiserror:: Error ;
10
10
11
11
use super :: solvers:: SolverError ;
12
- use super :: types:: { Problem , ProblemCategory } ;
12
+ use super :: types:: { AccountStatus , Problem , ProblemCategory } ;
13
13
use crate :: net:: http:: HttpClientError ;
14
14
15
15
#[ derive( Debug , Error ) ]
@@ -26,6 +26,9 @@ pub enum NewAccountError {
26
26
#[ error( "account request failed ({0})" ) ]
27
27
Request ( RequestError ) ,
28
28
29
+ #[ error( "unexpected account status {0:?}" ) ]
30
+ Status ( AccountStatus ) ,
31
+
29
32
#[ error( "no account URL in response" ) ]
30
33
Url ,
31
34
}
@@ -47,6 +50,7 @@ impl NewAccountError {
47
50
err. category( ) ,
48
51
ProblemCategory :: Account | ProblemCategory :: Malformed
49
52
) ,
53
+ Self :: Status ( _) => true ,
50
54
_ => false ,
51
55
}
52
56
}
You can’t perform that action at this time.
0 commit comments