comparison src/cjr_print.sml @ 2116:ebfaab689570

The 2nd half of proper CSRF protection related to environment variables
author Adam Chlipala <adam@chlipala.net>
date Thu, 12 Feb 2015 15:09:26 -0500
parents a9159911c3ba
children f55b0e45422f e10881cd92da
comparison
equal deleted inserted replaced
2115:3dc020fb2aa1 2116:ebfaab689570
3258 ^ cookie ^ "\")), uw_Basis_strcat(ctx, \"/\", "), 3258 ^ cookie ^ "\")), uw_Basis_strcat(ctx, \"/\", "),
3259 acc, 3259 acc,
3260 string "))"])) 3260 string "))"]))
3261 NONE cookies 3261 NONE cookies
3262 3262
3263 val cookieCode = foldl (fn (evar, acc) =>
3264 SOME (case acc of
3265 NONE => string ("uw_unnull(uw_Basis_getenv(ctx, \""
3266 ^ Prim.toCString evar ^ "\"))")
3267 | SOME acc => box [string ("uw_Basis_strcat(ctx, uw_unnull(uw_Basis_getenv(ctx, \""
3268 ^ Prim.toCString evar ^ "\")), uw_Basis_strcat(ctx, \"/\", "),
3269 acc,
3270 string "))"]))
3271 cookieCode (SideCheck.readEnvVars ())
3272
3263 fun makeChecker (name, rules : Settings.rule list) = 3273 fun makeChecker (name, rules : Settings.rule list) =
3264 box [string "static int ", 3274 box [string "static int ",
3265 string name, 3275 string name,
3266 string "(const char *s) {", 3276 string "(const char *s) {",
3267 newline, 3277 newline,