Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "ocsigenserver"
version: "2.12.0"
version: "2.13.0"
maintainer: "dev@ocsigen.org"
synopsis: "A full-featured and extensible Web server."
description: "Ocsigen Server implements most features of the HTTP protocol, and has a very powerful extension mechanism that makes it very easy to plug your own OCaml modules for generating pages. Many extensions are already implemented, like a reverse proxy, content compression, access control, authentication, etc."
Expand Down
6 changes: 3 additions & 3 deletions src/baselib/ocsigen_config.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ let set_mimefile s = mimefile := s
let () = Lwt_log.add_rule "*" Lwt_log.Warning (* without --verbose *)
let set_verbose () =
verbose := true;
Lwt_log.add_rule "*" Lwt_log.Notice
Lwt_log.add_rule "ocsigen:*" Lwt_log.Notice
let set_silent () = silent := true
let set_daemon () = set_silent (); daemon := true
let set_veryverbose () =
verbose := true;
veryverbose := true;
Lwt_log.add_rule "*" Lwt_log.Info
Lwt_log.add_rule "ocsigen:*" Lwt_log.Info
let set_debug () =
verbose := true;
veryverbose := true;
debug := true;
Lwt_log.add_rule "*" Lwt_log.Debug
Lwt_log.add_rule "ocsigen:*" Lwt_log.Debug

let set_minthreads i = minthreads := i
let set_maxthreads i = maxthreads := i
Expand Down
22 changes: 11 additions & 11 deletions src/baselib/ocsigen_messages.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,7 @@ let open_files ?(user = Ocsigen_config.get_user ()) ?(group = Ocsigen_config.get
| _ -> Lwt_log.null);
Lwt_log.dispatch
(fun sect lev ->
let show =
match lev with
| Lwt_log.Error | Lwt_log.Fatal ->
not (Ocsigen_config.get_silent ())
| _ ->
Ocsigen_config.get_verbose ()
in
if show then stderr else Lwt_log.null)];
if Ocsigen_config.get_silent () then Lwt_log.null else stderr)];

let gid = match group with
| None -> Unix.getgid ()
Expand All @@ -103,9 +96,16 @@ let open_files ?(user = Ocsigen_config.get_user ()) ?(group = Ocsigen_config.get
(Unix.getpwnam user).Unix.pw_uid
with Not_found as e -> ignore (Lwt_log.error "Error: Wrong user"); raise e)
in
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if ocsigenserver is started as root and calls setuid to change its user ID?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traité.

Lwt_unix.chown (full_path error_file) uid gid
Lwt.catch
(fun () ->
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
Lwt_unix.chown (full_path error_file) uid gid)
(fun e -> match e with
| Unix.Unix_error (Unix.EPERM, _, _) ->
(* to allow for symlinks to /dev/null *)
Lwt.return_unit
| _ -> Lwt.fail e)

(****)

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ocsipersist-dbm/ocsipersist.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
open Ocsidbmtypes
open Lwt

let section = Lwt_log.Section.make "ocsipersist:dbm"
let section = Lwt_log.Section.make "ocsigen:ocsipersist:dbm"
(** Data are divided into stores.
Create one store for your project, where you will save all your data.
*)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ocsipersist-pgsql/ocsipersist.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(** PostgreSQL (>= 9.5) backend for Ocsipersist. *)

let section = Lwt_log.Section.make "ocsipersist:pgsql"
let section = Lwt_log.Section.make "ocsigen:ocsipersist:pgsql"

module Lwt_thread = struct
include Lwt
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ocsipersist-sqlite/ocsipersist.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

let section = Lwt_log.Section.make "ocsipersist:sqlite"
let section = Lwt_log.Section.make "ocsigen:ocsipersist:sqlite"

(** Module Ocsipersist: persistent data *)

Expand Down