File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,17 @@ type event =
30
30
| Set_env of (string * string )
31
31
| Start_shell of int32
32
32
33
+ let pp_event ppf = function
34
+ | Channel_exec (c , cmd ) -> Fmt. pf ppf " channel exec %lu: %S" c cmd
35
+ | Channel_subsystem (c , cmd ) -> Fmt. pf ppf " channel subsystem %lu: %S" c cmd
36
+ | Channel_data (c , data ) -> Fmt. pf ppf " channel data %lu: %d bytes" c (Cstruct. length data)
37
+ | Channel_eof c -> Fmt. pf ppf " channel end-of-file %lu" c
38
+ | Disconnected s -> Fmt. pf ppf " disconnected with messsage %S" s
39
+ | Pty _ -> Fmt. pf ppf " pty"
40
+ | Pty_set _ -> Fmt. pf ppf " pty set"
41
+ | Set_env (k , v ) -> Fmt. pf ppf " Set env %S=%S" k v
42
+ | Start_shell c -> Fmt. pf ppf " start shell %lu" c
43
+
33
44
type t = {
34
45
client_version : string option ; (* Without crlf *)
35
46
server_version : string ; (* Without crlf *)
Original file line number Diff line number Diff line change @@ -177,7 +177,23 @@ let rec serve t cmd =
177
177
Logs. info (fun m -> m " %s" msg);
178
178
let * t = Driver. disconnect t in
179
179
serve t cmd end
180
- | _ -> failwith " Invalid SSH event"
180
+ | Set_env (k , v ) ->
181
+ Logs. info (fun m -> m " Ignoring Set_env (%S, %S)" k v);
182
+ serve t cmd
183
+ | Pty _ | Pty_set _ ->
184
+ let msg =
185
+ Ssh. disconnect_msg Ssh. DISCONNECT_SERVICE_NOT_AVAILABLE
186
+ " Sorry no PTY for you"
187
+ in
188
+ let * _ = Driver. send_msg t msg in
189
+ Ok ()
190
+ | Start_shell _ ->
191
+ let msg =
192
+ Ssh. disconnect_msg Ssh. DISCONNECT_SERVICE_NOT_AVAILABLE
193
+ " Sorry no shell for you"
194
+ in
195
+ let * _ = Driver. send_msg t msg in
196
+ Ok ()
181
197
182
198
let user_db =
183
199
(* User foo auths by passoword *)
You can’t perform that action at this time.
0 commit comments