Skip to content

Commit

Permalink
Merge pull request #2759 from jonludlam/formatting
Browse files Browse the repository at this point in the history
Formatting
  • Loading branch information
robhoes authored Sep 13, 2016
2 parents a3df363 + f43c221 commit 7b13c1b
Show file tree
Hide file tree
Showing 494 changed files with 74,765 additions and 74,765 deletions.
18 changes: 9 additions & 9 deletions configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ let config_mk = "config.mk"
(* Configure script *)
open Cmdliner

let dir name default docv doc =
let dir name default docv doc =
let doc = Printf.sprintf "Set the directory for installing %s" doc in
Arg.(value & opt string default & info [name] ~docv ~doc)

let path name default docv doc =
let path name default docv doc =
let doc = Printf.sprintf "Set the path for %s" doc in
Arg.(value & opt string default & info [name] ~docv ~doc)

Expand All @@ -34,7 +34,7 @@ let udevdir = dir "udevdir" "/etc/udev" "UDEVDIR" "udev scripts"

let info =
let doc = "Configures a package" in
Term.info "configure" ~version:"0.1" ~doc
Term.info "configure" ~version:"0.1" ~doc

let output_file filename lines =
let oc = open_out filename in
Expand All @@ -46,7 +46,7 @@ let configure disable_warn_error varpatchdir etcdir optdir plugindir extensiondi
Printf.printf "Configuring with the following params:\n\tdisable_warn_error=%b\n\tvarpatchdir=%s\n\tetcdir=%s\n\toptdir=%s\n\tplugindir=%s\n\textensiondir=%s\n\thooksdir=%s\n\tinventory=%s\n\txapiconf=%s\n\tlibexecdir=%s\n\tscriptsdir=%s\n\tsharedir=%s\n\twebdir=%s\n\tcluster_stack_root=%s\n\tbindir=%s\n\tsbindir=%s\n\tudevdir=%s\n\n" disable_warn_error varpatchdir etcdir optdir plugindir extensiondir hooksdir inventory xapiconf libexecdir scriptsdir sharedir webdir cluster_stack_root bindir sbindir udevdir;

(* Write config.mk *)
let lines =
let lines =
[ "# Warning - this file is autogenerated by the configure script";
"# Do not edit";
Printf.sprintf "DISABLE_WARN_ERROR=%b" disable_warn_error;
Expand All @@ -56,7 +56,7 @@ let configure disable_warn_error varpatchdir etcdir optdir plugindir extensiondi
Printf.sprintf "PLUGINDIR=%s" plugindir;
Printf.sprintf "EXTENSIONDIR=%s" extensiondir;
Printf.sprintf "HOOKSDIR=%s" hooksdir;
Printf.sprintf "INVENTORY=%s" inventory;
Printf.sprintf "INVENTORY=%s" inventory;
Printf.sprintf "XAPICONF=%s" xapiconf;
Printf.sprintf "LIBEXECDIR=%s" libexecdir;
Printf.sprintf "SCRIPTSDIR=%s" scriptsdir;
Expand All @@ -71,9 +71,9 @@ let configure disable_warn_error varpatchdir etcdir optdir plugindir extensiondi

let configure_t = Term.(pure configure $ disable_warn_error $ varpatchdir $ etcdir $ optdir $ plugindir $ extensiondir $ hooksdir $ inventory $ xapiconf $ libexecdir $ scriptsdir $ sharedir $ webdir $ cluster_stack_root $ bindir $ sbindir $ udevdir )

let () =
match
Term.eval (configure_t, info)
let () =
match
Term.eval (configure_t, info)
with
| `Error _ -> exit 1
| `Error _ -> exit 1
| _ -> exit 0
196 changes: 98 additions & 98 deletions ocaml/auth/auth_signature.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
(**
* Interface for External Authentication Plugin component
* @group Access Control
*)
*)

(*
* v1 22Oct08
*
Expand All @@ -27,114 +27,114 @@ exception Auth_service_error of auth_service_error_tag * string
exception Subject_cannot_be_resolved

let suffix_of_tag errtag =
match errtag with
| E_GENERIC -> ""
| E_LOOKUP -> Api_errors.auth_suffix_domain_lookup_failed
| E_DENIED -> Api_errors.auth_suffix_permission_denied
| E_CREDENTIALS -> Api_errors.auth_suffix_wrong_credentials
| E_UNAVAILABLE -> Api_errors.auth_suffix_unavailable
| E_INVALID_OU -> Api_errors.auth_suffix_invalid_ou
match errtag with
| E_GENERIC -> ""
| E_LOOKUP -> Api_errors.auth_suffix_domain_lookup_failed
| E_DENIED -> Api_errors.auth_suffix_permission_denied
| E_CREDENTIALS -> Api_errors.auth_suffix_wrong_credentials
| E_UNAVAILABLE -> Api_errors.auth_suffix_unavailable
| E_INVALID_OU -> Api_errors.auth_suffix_invalid_ou

(* required fields in subject.other_config *)
let subject_information_field_subject_name = "subject-name"

type t =
{

(* subject_id Authenticate_username_password(string username, string password)
Takes a username and password, and tries to authenticate against an already configured
auth service (see XenAPI requirements Wiki page for details of how auth service configuration
takes place and the appropriate values are stored within the XenServer Metadata).
If authentication is successful then a subject_id is returned representing the account
corresponding to the supplied credentials (where the subject_id is in a namespace managed by
the auth module/service itself -- e.g. maybe a SID or something in the AD case).
Raises auth_failure if authentication is not successful
*)
authenticate_username_password : string -> string -> string;
{

(* subject_id Authenticate_username_password(string username, string password)
Takes a username and password, and tries to authenticate against an already configured
auth service (see XenAPI requirements Wiki page for details of how auth service configuration
takes place and the appropriate values are stored within the XenServer Metadata).
If authentication is successful then a subject_id is returned representing the account
corresponding to the supplied credentials (where the subject_id is in a namespace managed by
the auth module/service itself -- e.g. maybe a SID or something in the AD case).
Raises auth_failure if authentication is not successful
*)
authenticate_username_password : string -> string -> string;

(* subject_id Authenticate_ticket(string ticket)
As above but uses a ticket as credentials (i.e. for single sign-on)
*)
authenticate_ticket : string -> string;

(* subject_id get_subject_identifier(string subject_name)
Takes a subject_name (as may be entered into the XenCenter UI when defining subjects --
see Access Control wiki page); and resolves it to a subject_id against the external
auth/directory service.
Raises Not_found if authentication is not succesful.
*)
get_subject_identifier : string -> string;

(* ((string*string) list) query_subject_information(string subject_identifier)
Takes a subject_identifier and returns the user record from the directory service as
key/value pairs. In the returned string*string map, there _must_ be a key called
subject_name that refers to the name of the account (e.g. the user or group name as may
be displayed in XenCenter). There is no other requirements to include fields from the user
record -- initially I'd imagine that we wouldn't bother adding anything else here, but
it's a string*string list anyway for possible future expansion.
Raises Not_found if subject_id cannot be resolved by external auth service
*)
query_subject_information : string -> ((string*string) list);

(* (string list) query_group_membership(string subject_identifier)
Takes a subject_identifier and returns its group membership (i.e. a list of subject
identifiers of the groups that the subject passed in belongs to). The set of groups returned
_must_ be transitively closed wrt the is_member_of relation if the external directory service
supports nested groups (as AD does for example)
*)
query_group_membership : string -> (string list);

(* subject_id Authenticate_ticket(string ticket)
As above but uses a ticket as credentials (i.e. for single sign-on)
*)
authenticate_ticket : string -> string;

(* subject_id get_subject_identifier(string subject_name)
Takes a subject_name (as may be entered into the XenCenter UI when defining subjects --
see Access Control wiki page); and resolves it to a subject_id against the external
auth/directory service.
Raises Not_found if authentication is not succesful.
*)
get_subject_identifier : string -> string;

(* ((string*string) list) query_subject_information(string subject_identifier)
Takes a subject_identifier and returns the user record from the directory service as
key/value pairs. In the returned string*string map, there _must_ be a key called
subject_name that refers to the name of the account (e.g. the user or group name as may
be displayed in XenCenter). There is no other requirements to include fields from the user
record -- initially I'd imagine that we wouldn't bother adding anything else here, but
it's a string*string list anyway for possible future expansion.
Raises Not_found if subject_id cannot be resolved by external auth service
*)
query_subject_information : string -> ((string*string) list);

(* (string list) query_group_membership(string subject_identifier)
Takes a subject_identifier and returns its group membership (i.e. a list of subject
identifiers of the groups that the subject passed in belongs to). The set of groups returned
_must_ be transitively closed wrt the is_member_of relation if the external directory service
supports nested groups (as AD does for example)
*)
query_group_membership : string -> (string list);

(*
In addition, there are some event hooks that auth modules implement as follows:
*)

(* unit on_enable(((string*string) list) config_params)
Called internally by xapi _on each host_ when a client enables an external auth service for the
pool via the XenAPI [see AD integration wiki page]. The config_params here are the ones passed
by the client as part of the corresponding XenAPI call.
On receiving this hook, the auth module should:
(i) do whatever it needs to do (if anything) to register with the external auth/directory
service [using the config params supplied to get access]
(ii) Write the config_params that it needs to store persistently in the XenServer metadata
into the Pool.external_auth_configuration field. [Note - the rationale for making the plugin
write the config params it needs long-term into the XenServer metadata itself is so it can
explicitly filter any one-time credentials [like AD username/password for example] that it
does not need long-term.]
*)
on_enable : ((string*string) list) -> unit;

(* unit on_disable()
Called internally by xapi _on each host_ when a client disables an auth service via the XenAPI.
The hook will be called _before_ the Pool configuration fields relating to the external-auth
service are cleared (i.e. so you can access the config params you need from the pool metadata
within the body of the on_disable method)
*)
on_disable : ((string*string) list) -> unit;

(* unit on_xapi_initialize(bool system_boot)
Called internally by xapi whenever it starts up. The system_boot flag is true iff xapi is
starting for the first time after a host boot
*)
on_xapi_initialize : bool -> unit;

(* unit on_xapi_exit()
Called internally when xapi is doing a clean exit.
*)
on_xapi_exit : unit -> unit;

}
(* unit on_enable(((string*string) list) config_params)
Called internally by xapi _on each host_ when a client enables an external auth service for the
pool via the XenAPI [see AD integration wiki page]. The config_params here are the ones passed
by the client as part of the corresponding XenAPI call.
On receiving this hook, the auth module should:
(i) do whatever it needs to do (if anything) to register with the external auth/directory
service [using the config params supplied to get access]
(ii) Write the config_params that it needs to store persistently in the XenServer metadata
into the Pool.external_auth_configuration field. [Note - the rationale for making the plugin
write the config params it needs long-term into the XenServer metadata itself is so it can
explicitly filter any one-time credentials [like AD username/password for example] that it
does not need long-term.]
*)
on_enable : ((string*string) list) -> unit;

(* unit on_disable()
Called internally by xapi _on each host_ when a client disables an auth service via the XenAPI.
The hook will be called _before_ the Pool configuration fields relating to the external-auth
service are cleared (i.e. so you can access the config params you need from the pool metadata
within the body of the on_disable method)
*)
on_disable : ((string*string) list) -> unit;

(* unit on_xapi_initialize(bool system_boot)
Called internally by xapi whenever it starts up. The system_boot flag is true iff xapi is
starting for the first time after a host boot
*)
on_xapi_initialize : bool -> unit;

(* unit on_xapi_exit()
Called internally when xapi is doing a clean exit.
*)
on_xapi_exit : unit -> unit;

}

(* Auth modules must implement this signature:*)
module type AUTH_MODULE =
sig
val methods : t
val methods : t
end
Loading

0 comments on commit 7b13c1b

Please sign in to comment.