@@ -57,6 +57,8 @@ type Check struct {
5757 errorRespAction modconfig.FailAction
5858 addHdrAction modconfig.FailAction
5959 rewriteSubjAction modconfig.FailAction
60+ rejectAction modconfig.FailAction
61+ softRejectAction modconfig.FailAction
6062
6163 client * http.Client
6264}
@@ -117,6 +119,15 @@ func (c *Check) Configure(inlineArgs []string, cfg *config.Map) error {
117119 func () (interface {}, error ) {
118120 return modconfig.FailAction {Quarantine : true }, nil
119121 }, modconfig .FailActionDirective , & c .rewriteSubjAction )
122+ cfg .Custom ("reject_action" , false , false ,
123+ func () (interface {}, error ) {
124+ return modconfig.FailAction {Reject : true }, nil
125+ }, modconfig .FailActionDirective , & c .rejectAction )
126+ cfg .Custom ("soft_reject_action" , false , false ,
127+ func () (interface {}, error ) {
128+ return modconfig.FailAction {Reject : true }, nil
129+ }, modconfig .FailActionDirective , & c .softRejectAction )
130+
120131 cfg .StringList ("flags" , false , false , []string {"pass_all" }, & flags )
121132 if _ , err := cfg .Process (); err != nil {
122133 return err
@@ -320,7 +331,7 @@ func (s *state) CheckBody(ctx context.Context, hdr textproto.Header, body buffer
320331 Header : hdrAdd ,
321332 })
322333 case "soft reject" :
323- return module.CheckResult {
334+ return s . c . softRejectAction . Apply ( module.CheckResult {
324335 Reject : true ,
325336 Reason : & exterrors.SMTPError {
326337 Code : 450 ,
@@ -329,9 +340,9 @@ func (s *state) CheckBody(ctx context.Context, hdr textproto.Header, body buffer
329340 CheckName : modName ,
330341 Misc : map [string ]interface {}{"action" : "soft reject" },
331342 },
332- }
343+ })
333344 case "reject" :
334- return module.CheckResult {
345+ return s . c . rejectAction . Apply ( module.CheckResult {
335346 Reject : true ,
336347 Reason : & exterrors.SMTPError {
337348 Code : 550 ,
@@ -340,7 +351,7 @@ func (s *state) CheckBody(ctx context.Context, hdr textproto.Header, body buffer
340351 CheckName : modName ,
341352 Misc : map [string ]interface {}{"action" : "reject" },
342353 },
343- }
354+ })
344355 }
345356
346357 s .log .Msg ("unhandled action" , "action" , respData .Action )
0 commit comments