@@ -19,6 +19,8 @@ module D = Debug.Make (struct let name = "extauth_plugin_PAM_NSS" end)
19
19
20
20
open D
21
21
22
+ let ( let @ ) = ( @@ )
23
+
22
24
module AuthX : Auth_signature .AUTH_MODULE = struct
23
25
(*
24
26
* External Authentication Plugin component
@@ -113,7 +115,8 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
113
115
auth/directory service.
114
116
Raises Not_found if authentication is not succesful.
115
117
*)
116
- let get_subject_identifier subject_name =
118
+ let get_subject_identifier ~__context subject_name =
119
+ let @ __context = Context. with_tracing ~__context __FUNCTION__ in
117
120
try (* looks up list of users*)
118
121
" u" ^ getent_idbyname " passwd" subject_name
119
122
with Not_found ->
@@ -131,15 +134,16 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
131
134
Raises auth_failure if authentication is not successful
132
135
*)
133
136
134
- let authenticate_username_password username password =
137
+ let authenticate_username_password ~__context username password =
138
+ let @ __context = Context. with_tracing ~__context __FUNCTION__ in
135
139
(* we try to authenticate against our user database using PAM *)
136
140
let () =
137
141
try
138
142
Pam. authenticate username password
139
143
(* no exception raised, then authentication succeeded *)
140
144
with Failure msg -> raise (Auth_signature. Auth_failure msg)
141
145
in
142
- try get_subject_identifier username
146
+ try get_subject_identifier ~__context username
143
147
with Not_found ->
144
148
raise
145
149
(Auth_signature. Auth_failure
@@ -155,7 +159,7 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
155
159
*)
156
160
(* not implemented now, not needed for our tests, only for a *)
157
161
(* future single sign-on feature *)
158
- let authenticate_ticket _tgt =
162
+ let authenticate_ticket ~ __context : _ _tgt =
159
163
failwith " authx authenticate_ticket not implemented"
160
164
161
165
(* ((string*string) list) query_subject_information(string subject_identifier)
@@ -168,7 +172,8 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
168
172
it's a string*string list anyway for possible future expansion.
169
173
Raises Not_found if subject_id cannot be resolved by external auth service
170
174
*)
171
- let query_subject_information subject_identifier =
175
+ let query_subject_information ~__context subject_identifier =
176
+ let @ __context = Context. with_tracing ~__context __FUNCTION__ in
172
177
(* we are expecting an id such as u0, g0, u123 etc *)
173
178
if String. length subject_identifier < 2 then raise Not_found ;
174
179
match subject_identifier.[0 ] with
@@ -246,7 +251,8 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
246
251
*)
247
252
(* in unix, groups cannot contain groups, so we just verify the groups a user *)
248
253
(* belongs to and, if that fails, if some group has the required identifier *)
249
- let query_group_membership subject_identifier =
254
+ let query_group_membership ~__context subject_identifier =
255
+ let @ __context = Context. with_tracing ~__context __FUNCTION__ in
250
256
(* 1. first we try to see if our subject identifier is a user id...*)
251
257
let sanitized_subject_id = String. escaped subject_identifier in
252
258
(* we are expecting an id such as u0, g0, u123 etc *)
@@ -303,7 +309,7 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
303
309
explicitly filter any one-time credentials [like AD username/password for example] that it
304
310
does not need long-term.]
305
311
*)
306
- let on_enable _config_params =
312
+ let on_enable ~ __context : _ _config_params =
307
313
(* nothing to do in this unix plugin, we always have /etc/passwd and /etc/group *)
308
314
()
309
315
@@ -314,7 +320,7 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
314
320
service are cleared (i.e. so you can access the config params you need from the pool metadata
315
321
within the body of the on_disable method)
316
322
*)
317
- let on_disable _config_params =
323
+ let on_disable ~ __context : _ _config_params =
318
324
(* nothing to disable in this unix plugin, we should not disable /etc/passwd and /etc/group:) *)
319
325
()
320
326
@@ -323,29 +329,30 @@ module AuthX : Auth_signature.AUTH_MODULE = struct
323
329
Called internally by xapi whenever it starts up. The system_boot flag is true iff xapi is
324
330
starting for the first time after a host boot
325
331
*)
326
- let on_xapi_initialize _system_boot =
332
+ let on_xapi_initialize ~ __context : _ _system_boot =
327
333
(* again, nothing to be initialized here in this unix plugin *)
328
334
()
329
335
330
336
(* unit on_xapi_exit()
331
337
332
338
Called internally when xapi is doing a clean exit.
333
339
*)
334
- let on_xapi_exit () =
340
+ let on_xapi_exit ~ __context : _ () =
335
341
(* nothing to do here in this unix plugin *)
336
342
()
337
343
338
344
(* Implement the single value required for the module signature *)
339
345
let methods =
340
- {
341
- Auth_signature. authenticate_username_password
342
- ; Auth_signature. authenticate_ticket
343
- ; Auth_signature. get_subject_identifier
344
- ; Auth_signature. query_subject_information
345
- ; Auth_signature. query_group_membership
346
- ; Auth_signature. on_enable
347
- ; Auth_signature. on_disable
348
- ; Auth_signature. on_xapi_initialize
349
- ; Auth_signature. on_xapi_exit
350
- }
346
+ Auth_signature.
347
+ {
348
+ authenticate_username_password
349
+ ; authenticate_ticket
350
+ ; get_subject_identifier
351
+ ; query_subject_information
352
+ ; query_group_membership
353
+ ; on_enable
354
+ ; on_disable
355
+ ; on_xapi_initialize
356
+ ; on_xapi_exit
357
+ }
351
358
end
0 commit comments