Permalink
Browse files

Renaming library

  • Loading branch information...
1 parent cbb15ef commit de8720ec7a5951f049f5fe440ce512b9dc795d9d @andrenth committed Jul 10, 2012
Showing with 77 additions and 81 deletions.
  1. +1 −1 _oasis
  2. +3 −3 lib/{spf.ml → SPF.ml}
  3. +1 −1 lib/{spf.mli → SPF.mli}
  4. +0 −4 lib/libspf.clib
  5. +2 −2 lib/spf.mllib
  6. +1 −1 lib/spf_stubs.c
  7. +26 −26 lib_test/test.ml
  8. +3 −3 setup.ml
  9. +13 −13 src/milter_callbacks.ml
  10. +25 −25 src/policy.ml
  11. +1 −1 src/policy.mli
  12. +1 −1 src/spf_policyd.ml
View
2 _oasis
@@ -9,7 +9,7 @@ Library spf
Path: lib
BuildTools: ocamlbuild
CompiledObject: best
- Modules: Spf
+ Modules: SPF
CSources: spf_stubs.c
CCLib: -lspf2
CCOpt: -Wall -Werror
@@ -43,9 +43,9 @@ type response =
; header_comment : string
}
-exception Spf_error of string
+exception SPF_error of string
-let _ = Callback.register_exception "Spf.Spf_error" (Spf_error "")
+let _ = Callback.register_exception "SPF.SPF_error" (SPF_error "")
external server : ?debug:bool -> dns -> server = "caml_spf_server_new"
@@ -91,7 +91,7 @@ let set_envelope_from req from =
let process req =
try
`Response (query_mailfrom req.request)
- with Spf_error err ->
+ with SPF_error err ->
`Error err
let check_helo server client_addr helo =
@@ -20,7 +20,7 @@ type result
| Temperror
| Permerror
-exception Spf_error of string
+exception SPF_error of string
val server : ?debug:bool -> dns -> server
View
@@ -1,4 +0,0 @@
-# OASIS_START
-# DO NOT EDIT (digest: e8fb27d18a680ca65d3ec258b53da541)
-spf_stubs.o
-# OASIS_STOP
View
@@ -1,4 +1,4 @@
# OASIS_START
-# DO NOT EDIT (digest: 5fe65aaadc52937c34be7016e4dd4d14)
-Spf
+# DO NOT EDIT (digest: b4efb35349e5d93905531be07dbacd6d)
+SPF
# OASIS_STOP
View
@@ -42,7 +42,7 @@ dns_type_of_val(value v)
static void
spf_error(const char *err)
{
- caml_raise_with_string(*caml_named_value("Spf.Spf_error"), err);
+ caml_raise_with_string(*caml_named_value("SPF.SPF_error"), err);
}
static void
View
@@ -1,50 +1,50 @@
open Printf
let () =
- let server = Spf.server Spf.Dns_cache in
+ let server = SPF.server SPF.Dns_cache in
let client_addr = Unix.inet_addr_of_string "187.73.32.159" in
let helo = "mta98.f1.k8.com.br" in
let from = "andre@andrenathan.com" in
- match Spf.check_from server client_addr helo from with
+ match SPF.check_from server client_addr helo from with
| `Error e ->
printf "SPF error: %s\n%!" e
| `Response r ->
printf "SPF response:\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n%!"
- (Spf.string_of_result (Spf.result r))
- (Spf.string_of_reason (Spf.reason r))
- (Spf.received_spf r)
- (Spf.received_spf_value r)
- (Spf.header_comment r);
- match Spf.result r with
- | Spf.Neutral c
- | Spf.Fail c
- | Spf.Softfail c ->
+ (SPF.string_of_result (SPF.result r))
+ (SPF.string_of_reason (SPF.reason r))
+ (SPF.received_spf r)
+ (SPF.received_spf_value r)
+ (SPF.header_comment r);
+ match SPF.result r with
+ | SPF.Neutral c
+ | SPF.Fail c
+ | SPF.Softfail c ->
printf "\t\t%s\n\t\t%s\n%!"
- (Spf.explanation c)
- (Spf.smtp_comment c)
+ (SPF.explanation c)
+ (SPF.smtp_comment c)
| _ -> ()
let () =
- let server = Spf.server ~debug:false Spf.Dns_cache in
+ let server = SPF.server ~debug:false SPF.Dns_cache in
let client_addr = Unix.inet_addr_of_string "189.57.226.93" in
let helo = "gwmail.bradescoseguros.com.br" in
let _from = "andre@bradescoseguros.com.br" in
- match Spf.check_helo server client_addr helo with
+ match SPF.check_helo server client_addr helo with
| `Error e ->
printf "SPF error: %s\n%!" e
| `Response r ->
printf "SPF response:\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n%!"
- (Spf.string_of_result (Spf.result r))
- (Spf.string_of_reason (Spf.reason r))
- (Spf.received_spf r)
- (Spf.received_spf_value r)
- (Spf.header_comment r);
+ (SPF.string_of_result (SPF.result r))
+ (SPF.string_of_reason (SPF.reason r))
+ (SPF.received_spf r)
+ (SPF.received_spf_value r)
+ (SPF.header_comment r);
printf ">>>\n%!";
- match Spf.result r with
- | Spf.Neutral c
- | Spf.Fail c
- | Spf.Softfail c ->
+ match SPF.result r with
+ | SPF.Neutral c
+ | SPF.Fail c
+ | SPF.Softfail c ->
printf "\t\t%s\n\t\t%s\n%!"
- (Spf.explanation c)
- (Spf.smtp_comment c)
+ (SPF.explanation c)
+ (SPF.smtp_comment c)
| _ -> ()
View
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.2.0 *)
(* OASIS_START *)
-(* DO NOT EDIT (digest: ca6cad8e2e57eac64dc639c68761d1f6) *)
+(* DO NOT EDIT (digest: 38e3df07861572eab06a4b5f381256dd) *)
(*
Regenerated by OASIS v0.3.0
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -5655,7 +5655,7 @@ let setup_t =
bs_nativeopt = [(OASISExpr.EBool true, [])];
},
{
- lib_modules = ["Spf"];
+ lib_modules = ["SPF"];
lib_pack = false;
lib_internal_modules = [];
lib_findlib_parent = None;
@@ -5797,7 +5797,7 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.3.0";
- oasis_digest = Some "v \015[\142\207q;\241\232C\242\222\031+\157";
+ oasis_digest = Some "\253\155\\\184\230ml{\018\170\241z\177\160\205\146";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false;
View
@@ -4,15 +4,15 @@ open Util
type result
= No_result
| Whitelisted of string
- | Spf_response of Spf.response
+ | Spf_response of SPF.response
type priv =
{ addr : Unix.inet_addr
; helo : string option
; result : result
}
-let spf_server = Spf.server Spf.Dns_cache
+let spf_server = SPF.server SPF.Dns_cache
let config = Config.default
@@ -50,13 +50,13 @@ let milter_tempfail ctx comment =
let spf_check_helo ctx priv =
let addr = priv.addr in
let helo = some (priv.helo) in
- let spf_res = unbox_spf (Spf.check_helo spf_server addr helo) in
- let milter_res = match Spf.result spf_res with
- | Spf.Fail c ->
- milter_reject ctx (Spf.smtp_comment c)
- | Spf.Temperror ->
+ let spf_res = unbox_spf (SPF.check_helo spf_server addr helo) in
+ let milter_res = match SPF.result spf_res with
+ | SPF.Fail c ->
+ milter_reject ctx (SPF.smtp_comment c)
+ | SPF.Temperror ->
if config.Config.fail_on_helo_temperror then
- milter_tempfail ctx (Spf.header_comment spf_res)
+ milter_tempfail ctx (SPF.header_comment spf_res)
else
Milter.Continue
| _ ->
@@ -66,10 +66,10 @@ let spf_check_helo ctx priv =
let spf_check_from ctx priv from =
let addr = priv.addr in
let helo = some (priv.helo) in
- let spf_res = unbox_spf (Spf.check_from spf_server addr helo from) in
- let milter_res = match Spf.result spf_res with
- | Spf.Fail c -> milter_reject ctx (Spf.smtp_comment c)
- | Spf.Temperror -> milter_tempfail ctx (Spf.header_comment spf_res)
+ let spf_res = unbox_spf (SPF.check_from spf_server addr helo from) in
+ let milter_res = match SPF.result spf_res with
+ | SPF.Fail c -> milter_reject ctx (SPF.smtp_comment c)
+ | SPF.Temperror -> milter_tempfail ctx (SPF.header_comment spf_res)
| _ -> Milter.Continue in
spf_res, milter_res
@@ -149,7 +149,7 @@ let eom ctx =
(match priv.result with
| No_result -> ()
| Whitelisted s -> milter_add_header ctx s
- | Spf_response r -> milter_add_header ctx (Spf.received_spf r));
+ | Spf_response r -> milter_add_header ctx (SPF.received_spf r));
priv, Milter.Continue)
let abort ctx =
View
@@ -9,13 +9,13 @@ type response
type cache =
{ instance : string
- ; mutable helo_response : Spf.response option
- ; mutable from_response : Spf.response option
+ ; mutable helo_response : SPF.response option
+ ; mutable from_response : SPF.response option
; mutable spf_header_added : bool
; mutable timestamp : float
}
-type handler = (Spf.server -> Postfix.attrs -> cache -> response Lwt.t)
+type handler = (SPF.server -> Postfix.attrs -> cache -> response Lwt.t)
let new_cache_entry instance =
{ instance = instance
@@ -77,51 +77,51 @@ let fail_on_helo_temperror = true
let handle_helo_response sender cache =
let res = some cache.helo_response in
- match Spf.result res with
- | Spf.Fail comment ->
- Five_zero_five (Spf.smtp_comment comment)
- | Spf.Temperror ->
+ match SPF.result res with
+ | SPF.Fail comment ->
+ Five_zero_five (SPF.smtp_comment comment)
+ | SPF.Temperror ->
if fail_on_helo_temperror then
- let comment = Spf.header_comment res in
+ let comment = SPF.header_comment res in
Defer_if_permit (sprintf "SPF-Result=%s" comment)
else
Dunno
| _ ->
if sender = "" && not cache.spf_header_added then begin
cache.spf_header_added <- true;
- let expl = match Spf.result res with
- | Spf.Neutral c | Spf.Fail c
- | Spf.Softfail c ->
- sprintf " %s" (Spf.smtp_comment c)
+ let expl = match SPF.result res with
+ | SPF.Neutral c | SPF.Fail c
+ | SPF.Softfail c ->
+ sprintf " %s" (SPF.smtp_comment c)
| _ ->
"" in
- Prepend (sprintf "%s%s" (Spf.received_spf res) expl)
+ Prepend (sprintf "%s%s" (SPF.received_spf res) expl)
end else
Dunno
let handle_from_response cache =
let res = some cache.from_response in
- match Spf.result res with
- | Spf.Fail comment ->
- Five_zero_five (Spf.explanation comment)
- | Spf.Temperror ->
- let comment = Spf.header_comment res in
+ match SPF.result res with
+ | SPF.Fail comment ->
+ Five_zero_five (SPF.explanation comment)
+ | SPF.Temperror ->
+ let comment = SPF.header_comment res in
Defer_if_permit (sprintf "SPF-Result=%s" comment)
| _ ->
if not cache.spf_header_added then begin
cache.spf_header_added <- true;
- let expl = match Spf.result res with
- | Spf.Neutral c | Spf.Fail c
- | Spf.Softfail c ->
- sprintf " %s" (Spf.explanation c)
+ let expl = match SPF.result res with
+ | SPF.Neutral c | SPF.Fail c
+ | SPF.Softfail c ->
+ sprintf " %s" (SPF.explanation c)
| _ ->
"" in
- Prepend (sprintf "%s%s" (Spf.received_spf res) expl)
+ Prepend (sprintf "%s%s" (SPF.received_spf res) expl)
end else
Dunno
let check_helo server addr helo =
- Lwt_preemptive.detach (fun () -> Spf.check_helo server addr helo) ()
+ Lwt_preemptive.detach (fun () -> SPF.check_helo server addr helo) ()
let process_helo spf_server client_addr helo_name sender cache =
lwt () = if cache.helo_response = None then begin
@@ -134,7 +134,7 @@ let process_helo spf_server client_addr helo_name sender cache =
return (handle_helo_response sender cache)
let check_from server addr helo sender =
- Lwt_preemptive.detach (fun () -> Spf.check_from server addr helo sender) ()
+ Lwt_preemptive.detach (fun () -> SPF.check_from server addr helo sender) ()
let process_from spf_server client_addr helo_name sender cache =
lwt () = if cache.from_response = None then begin
View
@@ -1 +1 @@
-val handle_attrs : Spf.server -> Postfix.attrs -> string Lwt.t
+val handle_attrs : SPF.server -> Postfix.attrs -> string Lwt.t
View
@@ -29,7 +29,7 @@ let handle_sigterm _ =
exit 0
let spf_handler fd =
- let spf_server = Spf.server Spf.Dns_cache in
+ let spf_server = SPF.server SPF.Dns_cache in
match_lwt Postfix.parse_attrs fd with
| None ->
return ()

0 comments on commit de8720e

Please sign in to comment.