ChangeLog 398 KB
Newer Older
Niels Möller's avatar
Niels Möller committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
2008-08-20  Niels Mller  <nisse@lysator.liu.se>

	* src/lshd.c (class lshd_port): Inherit io_listen_port.
	(kill_port): Deleted function, it was identical with
	kill_io_fd_resource.
	(lshd_port_accept): Converted from an oop callback to an accept
	method for the io_listen_port class. Use SERVER_VERSION_LINE.
	(make_lshd_port): Changed return type to struct resource *. Take a
	sockaddr as argument, rather than an fd. Create and initialize the
	socket. Use io_listen.
	(open_ports): Creation of socket moved to make_lshd_port. 
	(main): Simplified logic slightly for the daemon mode.

	* src/version.h (SERVER_PROTOCOL_VERSION): Deleted constant.
	(CLIENT_PROTOCOL_VERSION): Likewise.
	(SERVER_VERSION_LINE): New constant.
	(CLIENT_VERSION_LINE): Likewise.
	Updated all users.

2008-08-19  Niels Mller  <nisse@lysator.liu.se>

	* src/lshd.c (class lshd_port): Inherit io_listen_port.
	(kill_port): Deleted function.	

	* src/io.c (kill_io_fd_resource): New function, replacing
	kill_io_connect_state and kill_io_listen_port.
	(init_io_connect_state): Updated for new super class
	io_fd_resource.
	(oop_io_connect): Likewise.
	(io_connect): Likewise.
	(init_io_listen_port): Likewise.
	(oop_io_accept): Likewise.
	(io_listen): Likewise.
	* src/client_tcpforward.c (do_forward_local_port): Likewise.
	* src/client_x11.c (x11_connect): Likewise.
	* src/gateway.c (do_gateway_port_accept): Likewise.
	(make_gateway_port): Likewise.
	* src/server_session.c (do_kill_server_session): Likewise.
	* src/server_tcpforward.c (make_server_forward): Likewise.
	* src/server_x11.c (do_kill_x11_listen_port): Likewise.
	(do_x11_listen_port_accept): Likewise.
	(make_x11_listen_port): Likewise.
	(server_x11_setup): Likewise.
	* src/socks.c (do_make_socks_server): Likewise.
	* src/tcpforward.c (tcpforward_connect): Likewise.

	* src/io.h (class io_fd_resource): New class.
	(class io_connect_state): Inherit io_fd_resource.
	(class io_listen_port): Likewise.

Niels Möller's avatar
Niels Möller committed
51
52
53
54
2008-08-11  Niels Mller  <nisse@lysator.liu.se>

	* src/spki.c (spki_pkcs5_encrypt): Handle the case of no IV.

Niels Möller's avatar
Niels Möller committed
55
56
2008-08-04  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
57
58
	* src/lsh-writekey.c: Deleted program.

Niels Möller's avatar
Niels Möller committed
59
60
61
	* src/client_x11.c (x11_connect_error): Fixed call to
	channel_open_deny.

Niels Möller's avatar
Niels Möller committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
2008-07-27  Niels Mller  <nisse@lysator.liu.se>

	Merged lsh-writekey into lsh-keygen. Old lsh-keygen behavior is
	enabled with --write-raw, old lsh-writekey behaviour is enabled by
	--read-raw.	
	
	* src/testsuite/write-key-1-test: Use lsh-keygen --write-raw.
	* src/testsuite/write-key-2-test: Likewise.

	* src/testsuite/rapid7-lsh-test: Silence output.

	* src/testsuite/lsh-decrypt-key-test: Use the --read-raw and
	--write-raw flags to lsh-keygen.

	* src/testsuite/keygen-1-test: Don't use lsh-writekey.
	* src/testsuite/keygen-2-test: Likewise.
	* src/testsuite/lsh-encrypted-key-test: Likewise.
	* src/testsuite/setup-env: Likewise.

	* src/Makefile.in (BIN_PROGRAMS): Removed lsh-writekey.
	(INTERACT_RANDOM_SOURCES): New variable.
	(CRYPTO_SOURCES): Removed lock_file.c and randomness.c. Added
	seed_file.c.
	(CONNECTION_SOURCES): Removed command.c and exception.c.
	(lsh_SOURCES): Removed xauth.c.
	(lsh_writekey_SOURCES): Deleted.
	(lsh_writekey_OBJS): Deleted.
	(lsh-writekey$(EXEEXT)): Deleted target.
	(lsh_transport_OBJS): Added $(INTERACT_RANDOM_OBJS).
	(lsh_keygen_OBJS): Likewise.

	* src/lsh-keygen.c: New constants OPT_READ_RAW, OPT_WRITE_RAW,
	OPT_LABEL and OPT_PASSPHRASE.
	(class lsh_keygen_options): New flags read_raw and write_raw.
	Merged configuration attributes from lsh-writekey.
	(make_lsh_keygen_options): Initialize new attributes.
	(main_options): Merged lsh-writekey options.
	(main_argp_parser): Merged option handling from lsh-writekey.
	(main_argp): New shorter description.
	(dsa_generate_key): Adapted to new randomness interface. Deleted
	randomness argument.
	(rsa_generate_key): Likewise.
	(check_file): Moved from lsh-writekey.c.
	(open_file): Likewise.
	(process_private): Likewise.
	(process_public): Likewise.
	(main): Adapted to new randomness interface. Aded code to split
	key into private and public parts, stored in different files.

2008-07-07  Niels Mller  <nisse@lysator.liu.se>

	Reorganized client actions.
	
	* src/lsh.h: Deleted forward declarations of obsolete classes.

	* src/channel.c (make_channel_open_exception): Deleted function.

	* src/command.c: Deleted file.
	* src/command.h: Deleted file.
	* src/exception.c: Deleted file.
	* src/exception.h: Deleted file.

	* src/lsh.c (class lsh_options): Deleted handler attribute. Added
	detach flag.
	(make_options): Deleted handler argrment.
	(add_action): Changed argument type to client_connection_action.
	(make_client_session): Deleted handler argument in call to
	make_client_session_channel.
	(client_shell_session): Changed return type to
	client_connection_action. Use make_open_session_action.
	(client_subsystem_session): Likewise.
	(client_command_session): Likewise.
	(main_argp_parser): Changeed handling of -B, just set detach flag.
	(class lsh_default_handler): Deleted class.
	(do_lsh_default_handler): Deleted function.
	(make_lsh_default_handler): Deleted function.
	(main): Actions are now handled using the client_connection_action
	class, not as commands. This was the last use of the command and
	exception abstractions.
	(main): Handle detach (-B flag) here.

	* src/tcpforward.c (tcpforward_remove): Use CAST_SUBTYPE.

	* src/socks.c (SOCKS_HANDSHAKE): Deleted macro.
	(class make_socks_server_action): Replaces class
	make_socks_server_command.
	(make_socks_server): Changed return type to
	client_connection_action.

	* src/channel_forward.c (forward_start_io_command): Deleted unused
	command.

	* src/client_tcpforward.c (class forward_local_port_action):
	Replaces class forward_local_port_command.
	(class request_tcpip_forward_action): Replaces class
	request_tcpip_forward_command. 
	(forward_local_port): Changed return type to
	client_connection_action.
	(forward_remote_port): Likewise.

	* src/client_session.c (do_client_session_event): No special error
	handling for CHANNEL_EVENT_DENY.
	(make_client_session_channel): Deleted exception handler argument.

	* src/client.c (class session_open_action): Replaces class
	session_open_command.
	(class background_process_command): Deleted class.

	* src/client.h (class client_connection_action): New class.
	(class client_session): Deleted exception handler attribute.

	* src/server_tcpforward.c (OPEN_FORWARDED_TCPIP): Deleted unused
	macro.
	
2008-07-06  Niels Mller  <nisse@lysator.liu.se>

	Simplified interface to the randomness generator.

	* src/testsuite/Makefile.in (TEST_OBJS): Removed lock_file.o,
	randomness.o and unix_random.o.

	* src/testsuite/testutils.c (bad_random): New global variable.
	(random_generate): New fake randomness generator, replacing the
	real generator for the testcases.
	(lsh_random): Likewise.
	(test_sign): Initialize the fake randomness generator.

	* src/testsuite/functions.sh: Set $LSH_MAKE_SEED to /bin/false.

	* src/environ.h.in (FILE_LSH_MAKE_SEED): New macro.
	(ENV_LSH_MAKE_SEED): Likewise.

	* src/unix_random_user.c: New file.
	(random_init_user): New function. Replaces make_user_random. Tries
	to create the seed file automatically, if missing.

	* src/unix_random.c: Use globals for the generator state.
	(unix_random): Deleted class.
	(read_initial_seed_file): Simplified. Permission check moved to
	random_init. Seeking is done by read_seed_file.
	(update_seed_file): Deleted argument. Use seed_file.h interface.
	(trivia_source): Renamed from do_trivia_source. Use globals.
	(device_source): Renamed from do_device_source. Use globals.
	(random_generate): Replaces method do_unix_random.
	(random_add): Replaces method do_unix_random_add.
	(random_init): Use seed_file.h interface. Initialize all globals,
	including the sources'.
	(make_user_random): Deleted, replaced by random_init_user in
	unix_random_user.c. 
	(random_init_system): Replaces make_system_random.
	(lsh_random): Moved definition here, from randomness.c.

	* src/lsh-make-seed.c (enum source_type): Deleted type
	SOURCE_DEV_MEM.
	(main): Use seed_file.h interface for locking and writing to the
	seed file.

	* src/lsh-writekey.c: Adapted to new randomness interface.

	* src/lsh-transport.c (make_lsh_transport_config): No argument to
	all_signature_algorithms. Deleted call to make_user_random.
	(lsh_transport_service_packet_handler): No randomness argument to
	lsh_string_write_random.
	(try_password_auth): Use random_add to mix the secret password
	into the randomness generator.
	(main): Use random_init_user.

	* src/lsh-export-key.c: No argument to all_signature_algorithms.

	* src/client_x11.c (channel_open_x11): Deleted old #if:ed out
	code.
	(xauth_lookup): Function moved here, from xauth.c.
	* xauth.c, xauth.h: Deleted files.

	* src/gateway_tcpforward.c (do_kill_gateway_forward): Fixed typo
	in prototype.

	* src/client_keyexchange.c (client_dh_init): Updated for new
	dh_generate_secret, with no randomness argument.
	* src/server_keyexchange.c (server_dh_init): Likewise.

	* src/lock_file.c, src/lock_file.h: Deleted, replaced by
	seed_file.c and seed_file.h
	* src/seed_file.h: New file.
	* src/seed_file.c: New file.

	* src/transport.c (oop_write_ssh): Updated call to
	transport_write_flush.
	(transport_send_packet): Updated calls to transport_write_packet
	and transport_write_flush.
	(transport_send_kexinit): Updated to new make_kexinit interface.

	* src/transport_write.c (make_ignore_packet): Deleted randomness
	argument.
	(transport_write_packet): Likewise.
	(transport_write_flush): Likewise.

	* src/transport_read.c (decode_packet): Use random_add, to mix the
	received random padding into the pool.

	* src/transport.h (class transport_context): Deleted randomness
	attribute.

	* src/spki.c (spki_pkcs5_encrypt): Deleted randomness argument.

	* src/lshd.c (make_lshd_context): No randomness attribute.
	(lshd_config_handler): Adapted to new randomness interface.
	(main): Likewise.

	* src/dsa.c (class dsa_algorithm): Deleted class, randomness
	attribute no longer needed. 
	(class dsa_signer): Deleted randomness attribute.
	(do_dsa_sign): Adapted to new randomness interface.
	(make_dsa_signer): No randomness attribute.
	(make_dsa_algorithm): Deleted function. Replaced by...
	(dsa_algorithm): New static object.

	* src/encrypt.c (encrypt_packet): Deleted randomness argument.

	* src/dh_exchange.c (dh_generate_secret): Deleted randomness
	argument.

	* src/algorithms.c (all_signature_algorithms): Deleted randomness
	argument.

	* src/randomness.c: Deleted file.

	* src/lsh_string.c (lsh_string_random): Adapted to new randomness
	interface, and deleted randomness argument.
	(lsh_string_write_random): Likewise.

	* src/keyexchange.h (class make_kexinit): Deleted randomness
	argument from the make method.
	(MAKE_KEXINIT): Deleted macro.

	* src/keyexchange.c (do_make_simple_kexinit): Adapted to new
	randomness interface, and deleted randomness argument.

	* src/randomness.h: Deleted randomness class. New interface using
	plain functions random_generate and random_add.
	
Niels Möller's avatar
Niels Möller committed
303
304
2008-06-17  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
305
306
	* src/.dist_classes (dist_classes): Deleted channel.c.x,
	combinators.c.x, gateway_channel.c.x, io_commands.c.x. Added
Niels Möller's avatar
Niels Möller committed
307
308
309
310
311
	gateway_tcpforward.c.x.

	* src/.dist_headers (dist_headers): Deleted io_commands.h and
	suspend.h.

Niels Möller's avatar
Niels Möller committed
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
2008-06-16  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.in (TS_SH): Added lshg-tcpip-remote-test.

	* src/testsuite/lshg-tcpip-remote-test: New test case.

	* src/Makefile.in (lsh_SOURCES): Added gateway_tcpforward.c.

	* src/gateway.h (gateway_tcpip_forward_handler): New declaration.

	* src/gateway.c (make_gateway_connection): Add handler for
	GLOBAL_REQUEST tcpip-forward.

2008-06-15  Niels Mller  <nisse@lysator.liu.se>

	* src/gateway_tcpforward.c: New file.

Niels Möller's avatar
Niels Möller committed
329
330
331
332
333
334
335
336
337
338
2008-06-14  Niels Mller  <nisse@lysator.liu.se>

	* src/Makefile.in (lsh_SOURCES): Added gateway_x11.c.

	* src/testsuite/Makefile.in (TS_SH): Added x11-5-test.

	* src/testsuite/x11-5-test: New test for x11 forwarding over a
	gateway.

	* src/lsh.c (main): When we're starting a gateway, enable channel
Niels Möller's avatar
Niels Möller committed
339
	open handler for x11 and forwrded-tcp channels.
Niels Möller's avatar
Niels Möller committed
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

	* src/gateway_x11.c (gateway_x11_request_handler): Put the handler
	on the connection's resource list. Record the number of pending
	replies *including* the one for the x11-req.

	* src/gateway_channel.c (class gateway_channel): Moved to
	gateway.h. Adapted to changed type of chain.
	(do_kill_gateway_channel): Kill x11
	handler, if present.
	(do_gateway_channel_event): Check for the reply to x11-req, and
	install x11 handler.
	(gateway_forward_channel_open): Install handler for x11-req on the
	originating channel.

	* src/gateway.h (class gateway_channel): Moved definition here,
	from gateway_chanel.h. Changed type of chain attribute to
	gateway_channel.

	* src/gateway_x11.c: New file.

Niels Möller's avatar
Niels Möller committed
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
2008-06-09  Niels Mller  <nisse@lysator.liu.se>

	* src/xalloc.c (lsh_object_check_subtype): Removed support for
	LSH_ALLOC_STACK.

	* src/server_tcpforward.c (remove_server_forward): Deleted.
	(do_tcpip_forward_handler): Adapted to new convention. Use
	global_request_reply.
	(do_tcpip_cancel_forward): Adapted to new convention. Use
	global_request_reply, and tcpforward_remove.

	* src/pty-helper.c (pty_send_message): Moved declaration of creds.

	* src/lshd-pty-helper.c (process_request): Deleted werror messages
	for each request.

	* src/client_x11.c (channel_open_x11): Use CAST_SUBTYPE, since
	client_x11_handler has subclasses.

	* src/tcpforward.c (tcpforward_remove): New function.

	* src/client_tcpforward.c (class remote_port): Inherit
	client_tcpforward_handler.
	(do_remote_port_open): New function
	(make_remote_port): Initialize open method.
	(channel_open_forwarded_tcpip): Look up a
	client_tcpforward_handler for the port, and invoke its open
	method. Code for actual connecting is moved to
	do_remote_port_open.
	(class remote_port_state): New class, replacing
	remote_port_continuation and remote_port_exception_handler.
	(do_remote_port_state_done): New function.
	(class remote_port_continuation): Deleted.
	(do_remote_port_continuation): Deleted.
	(make_remote_port_continuation): Deleted.
	(class remote_port_exception_handler): Deleted.
	(do_remote_port_exception_handler): Deleted.
	(make_remote_port_exception_handler): Deleted.
	(do_request_tcpip_forward): Adapted to new
	channel_send_global_request convention, and use
	make_remote_port_state.

	* src/client_session.c (handle_exit_status): struct
	channel_request_info renamed to request_info.
	(handle_exit_signal): Likewise.
	* src/server_session.c (shell_request_handler): struct
	channel_request_info renamed to request_info.
	(exec_request_handler): Likewise.
	(do_spawn_subsystem): Likewise.
	(pty_request_handler): Likewise.
	(window_change_request_handler): Likewise.
	(x11_request_handler): Likewise.
Niels Möller's avatar
Niels Möller committed
412
413
	* src/gateway_channel.c (gateway_forward_channel_request): struct
	channel_request_info renamed to request_info.
Niels Möller's avatar
Niels Möller committed
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451

	* src/client.h (class client_tcpforward_handler): New class.

	* src/channel.c (class request_status): Deleted.
	(make_request_status): Deleted.
	(class global_request_continuation): Deleted.
	(send_global_request_responses): Deleted.
	(do_global_request_response): Deleted.
	(make_global_request_response): Deleted.
	(class global_request_exception_handler): Deleted.
	(do_exc_global_request_handler): Deleted.
	(make_global_request_exception_handler): Deleted.
	(handle_global_request): New simplified handler convention, with
	no continuation or exception_handler.
	(global_request_reply): New function.
	(handle_global_success): Use new global_request_state class.
	(handle_global_failure): Likewise.
	(handle_channel_request): struct channel_request_info renamed to
	request_info.
	(channel_request_reply): Likewise.
	(channel_send_global_request): Use struct global_request_state
	instead of struct command_context.

	* src/channel.h (struct channel_request_info): Deleted.
	(class channel_request): Use struct request_info for the handler
	method.
	(class global_request_state): New class.

	* src/connection.c (init_ssh_connection): Deleted initialization
	of active_global_requests.

	* src/connection.h (struct request_info): New struct, replaces
	channel_request_info in channel.h. Used for both global requests
	and channel requests.
	(class ssh_connection): Deleted active_global_requests.
	(class global_request): The handler method now takes a struct
	request_info as argument, and no continuation or exception_handler.

Niels Möller's avatar
Niels Möller committed
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
2008-05-30  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh.c (maybe_x11): Pass zero single_connection argument to
	make_x11_action.

	* src/client_x11.c (make_client_x11_handler): Deleted function.
	(class client_x11_display): Inherit client_x11_handler.
	(channel_open_x11): Invoke the handler's open method.
	(client_add_x11_handler): Take an argument of type
	client_x11_handler *, not resource *.
	(do_client_x11_display_open): New function.
	(make_client_x11_display): New argument single_connection.
	Initialize super class and open method.
	(do_action_x11_success): Updated for client_x11_display inheriting
	client_x11_handler.
	(make_x11_action): New argument single_connection.

	* src/client.h (class client_x11_handler): New class, replacing
	similar class in client_x11.c.

Niels Möller's avatar
Niels Möller committed
472
473
2008-05-28  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
	* src/gateway_channel.c (do_gateway_channel_event): Pass on
	CHANNEL_SUCCESS and CHANNEL_FAILURE to the other channel.
	(do_gateway_channel_request): Deleted.
	(gateway_forward_channel_request): New channel request handler,
	replacing do_gateway_channel_request. Use channel_send_request.
	(do_gateway_channel_success): Deleted.
	(do_gateway_channel_failure): Deleted.
	(gateway_request_methods): Deleted.
	(gateway_forward_channel_open): Renamed, was gateway_forward_open.
	Updated all callers. Initialize request_fallback.

	* src/gateway.c (oop_read_gateway): Use verbose for message at EOF.
	(kill_gateway_connection): Use trace.

	* src/channel.c (handle_channel_request): Use request_fallback.
	(handle_channel_success): Deleted check for request_methods.
	(handle_channel_failure): Likewise.
	(init_channel): Initialize request_fallback.
	(channel_send_request): The type is now specified as length and
	pointer. Updated all callers.

	* src/channel.h (struct channel_request_methods): Deleted.
	(class ssh_channel): New attribute request_fallback, replacing
	request_methods.

	* src/scm/Makefile.am: Deleted obsolete file.

Niels Möller's avatar
Niels Möller committed
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
	* src/Makefile.in (CONNECTION_SOURCES): Removed combinators.c.

	* src/testsuite/Makefile.in (TS_SH): Added x11-3-test and x11-4-test.

	* src/testsuite/functions.sh (stdin_lsh): New function.

	* src/testsuite/testutils.c (test_sign): Use STATIC_HEADER, not
	STACK_HEADER.

	* src/testsuite/x11-2-test: Use xmodmap, not xdpyinfo to test
	connecting to the X server.

	* src/testsuite/x11-4-test: New test case, testing that bad
	cookies are rejected.

	* src/testsuite/x11-3-test: New test case, testing that fake and
	real cookie differs.

	* src/resource.c (resource_list_top): Corrected handling of empty
	list.

	* src/lsh.h (LSH_ALLOC_STACK): Deleted constant.
	(STACK_HEADER): Deleted macro.

	* src/gc.c (gc_mark): Removed support for LSH_ALLOC_STACK.

	* src/connection.c (connection_remember): Deleted command.

	* src/command.h: Deleted macros and declarations related to the
	combinator commands.

	* src/command.c (class command_apply): Deleted.
	(do_command_apply): Deleted function.
	(make_apply): Deleted function.
	(class gaba_continuation)): Deleted.
	(do_gaba_continuation): Deleted function.
	(gaba_apply): Deleted function.

	* src/client_x11.c (do_action_x11_success): Set session->x11.

	* src/client_session.c (do_kill_client_session): Kill pty and x11
	resources.
	(oop_read_stdin): When reading is finished, kill pty resource, and
	no other resources.
	(make_client_session_channel): Initialize pty and x11 attributes.
	Replaces initialization of the resource list.

	* src/client_pty.c (client_pty_resource): Reintroduced class.
	Previous incarnation was called client_tty_resource.
	(do_kill_client_pty_resource): Kill window change callback.
	(make_client_pty_resource): Renamed, was make_client_tty_resource.
	Added session argument. Install window change callback.
	(do_action_pty_success): Use new make_client_pty_resource, and
	store result in sesion->pty.

	* src/client.h (class client_session): Deleted resource list.
	Replaced by separate resources for pty and x11.

	* src/channel.c (channel_open_deny): Fixed assertion.
	(channel_open_confirm): Added assertion.

2008-05-26  Niels Mller  <nisse@lysator.liu.se>

	* src/combinators.c: Deleted file.

	* src/Makefile.in (CONNECTION_SOURCES): Deleted io_commands.c.

	* src/testsuite/Makefile.in (TS_SOURCES): Resurrected
	sockaddr2info-test.c.
	* src/testsuite/sockaddr2info-test.c: Resurrected file.

	* src/server_session.c (class server_session): x11 object now
	refers to the listen port. Deleted resources list.
	(x11_request_handler): Adapted to server_x11_setup changes.

	* src/server_x11.c (make_x11_server_info): Deleted function.
	(class server_x11_socket): Deleted class.
	(do_kill_x11_socket): Deleted function.
	(make_server_x11_socket): Deleted function.
	(do_kill_x11_listen_port): New function.
	(do_x11_listen_port_accept): New function.
	(make_x11_listen_port): New function.
	(open_x11_socket): Use make_x11_listen_port.
	(server_x11_setup): Use new io_listen. Return port object.

	* src/server_x11.h (class x11_listen_port): New class, merging
	server_x11_info and server_x11_socket.

	* src/socks.c (make_socks_channel): listen_value argument replaced
	by fd and peer info. Call io_register_fd.
	(socks_handshake): Deleted command.
	(socks_listen_port): New class.
	(do_socks_accept): New function.
	(make_socks_listen_port): New function.
	(class make_socks_server_command): New class.
	(do_make_socks_server): New function, wrapping
	make_socks_listen_port.
	(make_socks_server): New function, replacing the old
	expr-construction.

	* src/server_tcpforward.c (make_server_forward): Use
	make_tcpforward_listen_port and io-listen. New argument
	connection.
	(open_forwarded_tcpip_command): Deleted command.
	(expr tcpforward_forwarded_tcpip): Deleted.
	(class tcpip_forward_request_continuation): Deleted.
	(do_tcpip_forward_request_continuation): Deleted function.
	(make_tcpip_forward_request_continuation): Deleted function.
	(class tcpip_forward_request_exception_handler): Deleted.
	(do_tcpip_forward_request_exc): Deleted.
	(make_tcpip_forward_request_exc): Deleted.
	(do_tcpip_forward_handler): Simplified, letting
	make_server_forward to most of the work.

	* src/client_tcpforward.c (open_direct_tcpip_command): Deleted
	command.
	(class forward_local_port_command): New class.
	(do_forward_local_port): New function, wrapping
	make_tcpforward_listen_port.
	(forward_local_port): New function, replacing the old
	expr-construction.
	(forward_remote_port): Use const. Also affects other classes
	related to remote forwarding.

	* src/lsh.c (prepend_action): Deleted function.
	(main): Use new make_gateway_port.

	* src/gateway.c (command gateway_accept): Deleted.
	(class gateway_port): New class.
	(do_gateway_port_accept): New function.
	(expr make_gateway_setup): Deleted.
	(make_gateway_port): New function, replacing make_gateway_setup.

	* src/io.c (kill_io_connect_state): Simplified, io_close_fd
	ignores negative fd:s.
	(kill_io_listen_port): New function.
	(init_io_listen_port): New function.
	(oop_io_accept): New function.
	(io_listen): New function, replacing function in io_commands.c.
	(sockaddr2info): Resurrected function. Use const sockaddr *
	argument. Handle only AF_INET and AF_INET6.
	(io_bind_local): Use const argument.
	(io_connect_local): Likewise.

	* src/io.h (class listen_value): Deleted class.
	(class io_listen_port): New class.

	* src/io_commands.c, src/io_commands.h: Deleted files.

	* src/tcpforward.h (class forwarded_port): Use const.

	* src/tcpforward.c (tcpforward_connect): Use const for
	address_info argument.
	(tcpforward_listen_port): New class.
	(do_tcpforward_listen_port_accept): New function.
	(make_tcpforward_listen_port): New function.

	* src/client_x11.c (make_client_x11_channel): Use a write buffer
	size corresponding to a full window, and initialize
	rec_window_size to a smaller value corresponding to the initial
	X11 packet wth authentication data.

Niels Möller's avatar
Niels Möller committed
663
664
2008-05-23  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
665
666
	* src/io_commands.c (make_listen_value): Added missing break.

Niels Möller's avatar
Niels Möller committed
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
	* src/server_session.c (shell_request_handler): Updated to new
	channel_request interface.
	(exec_request_handler): Likewise.
	(do_spawn_subsystem): Likewise.
	(pty_request_handler): Likewise.
	(x11_request_handler): Likewise.
	(window_change_request_handler): Updated to new channel_request
	interface. Never send a reply. Write a warning if ioctl fails.

	* src/client_session.c (handle_exit_status): Updated to new
	channel_request interface. Never send a reply.
	(handle_exit_signal): Likewise.

	* src/channel.h (class ssh_channel): Deleted the active_requests
	queue.
	(class channel_request): Deleted contuniation and exception
	handler arguments to the handler method.
	(DEFINE_CHANNEL_REQUEST): Updated prototype.

	* src/channel.c (class channel_request_continuation): Deleted.
	(send_channel_request_responses): Deleted function.
	(do_channel_request_response): Deleted function.
	(make_channel_request_response): Deleted function.
	(class channel_request_exception_handler): Deleted.
	(do_exc_channel_request_handler): Deleted function.
	(make_channel_request_exception_handler): Deleted function.
	(handle_channel_request): Pass no continuation and exception
	handler to the request handler. Request handlers are expected to
	call channel_request_reply before returning, making unnecessary
	the old code for ensuring that requests are replied to in order.
	(channel_request_reply): New function.
	(init_channel): No initialization of active_requests.

Niels Möller's avatar
Niels Möller committed
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
	* src/testsuite/Makefile.in (TS_SH): Added x11-1-test and
	x11-2-test.

	* src/testsuite/functions.sh (XAUTHORITY: New exported variables.
	(TEST_DISPLAY): New variable.
	(DISPLAY): Unset.

	* src/testsuite/x11-1-test: Use LSH_FLAGS to pass the --x11 flag to lsh.

	* src/testsuite/x11-2-test: New testcase, using an Xvfb X server.

	* src/Makefile.in (lshd_connection_SOURCES): Added server_x11.c.

	* src/server_x11.h (class server_x11_info): Use const strings.

	* src/server_x11.c (make_x11_server_info): New function.
	(class forwarded_x11_callback): New class, replacing
	channel_open_command_x11.
	(do_open_forwarded_x11): New function, replacing new_x11_channel.
	(make_forwarded_x11_callback): New function.
	(class open_forwarded_x11): Deleted.
	(expr server_x11_callback): Deleted.
	(class server_x11_socket): Replaced old lsh_fd pointer by an fd.
	This class should be merged with the corresponding port object.
	(make_server_x11_socket): New function.
	(open_x11_socket): Updated to new io_bind_sockaddr. Use
	make_server_x11_socket. Don't call io_listen, leave that to the
	caller.
	(class xauth_exit_callback): Deleted.
	(make_xauth_exit_callback): Deleted function.
	(bad_string): Deleted function.
	(create_xauth): New function using XauWriteAuth.
	(server_x11_setup): Support the single flag. Deleted code for
	spawnign an xauth process, use create_xauth and libXau instead.
	Use io_listen and make_forwarded_x11_callback. Deleted
	continuation and exception handling arguments. Changed DISPLAY to
	unix:<number>:<screen>. 

	* src/server_session.c (class server_session): New attribute
	resources.
	(do_kill_server_session): Kill additional resources.
	(make_server_session): Initialize resources.
	(x11_request_handler): Decode hex cookie. Deleted continuation
	and exception handler arguments to server_x11_setup.

	* src/lshd-userauth.c (main_argp_parser): Use lsh_string_hex_decode.
	(decode_hex): Deleted function.

	* src/lshd-connection.c (make_lshd_connection): Enable X11 forwarding.

	* src/lsh_string.c (lsh_string_hex_decode): New function.

	* src/io_commands.c (io_listen): New function.
	(listen_tcp_command): Use io_listen. Deallocate sockaddr also in the
	success case.
	(listen_local_command): Use io_listen.

	* src/io.h (class local_info): Use const strings.
	* src/io.c (make_local_info): Use const arguments.

	* src/xauth.c (xauth_process): Deleted function.
	(xauth_lookup): Set family correctly for IPv6. Use XauGetAuthByAddr.

	* src/scm/gaba.scm (process-class): Allow absent variable list.

	* src/alist.h (class alist): Deleted size attribute. 
	* src/alist.c: Deleted code to update size.

Niels Möller's avatar
Niels Möller committed
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
2008-05-20  Niels Mller  <nisse@lysator.liu.se>

	* configure.ac: Deleted check for cfmakeraw.

	* src/lsh-transport.c (class lsh_transport_config): Deleted tty attribute.
	(try_password_auth): Use interact_read_password.
	(send_userauth_info_response): Use interact_dialog.
	(read_user_key): Updated for alist_select_l change.
	(OPT_ASKPASS): New constant. Use an enum for all the options constants.
	(main_options): Added --askpass option.
	(main_argp_parser): Use interact_set_askpass.
	(main): Use unix_interact_init.

	* src/lsh-decrypt-key.c (main): Updated for alist_select_l change.

	* src/alist.h (meta-class alist): Use const for the get method. 

	* src/alist.c (alist_select_l): Changed to return the new alist.
	Inlined work, no longer calls alist_select and make_int_list.
	(alist_select): Deleted unused function.
	
	* src/lsh.c (class lsh_options): Deleted tty attribute.
	(maybe_pty): Use interact_is_tty and client_request_pty.
	(main_argp_parser): Removed call to suspend_install_handler.
	Pass on --askpass option to lsh-transport.
	(main): Call unix_interact_init.

2008-05-19  Niels Mller  <nisse@lysator.liu.se>

	* src/lshd-connection.c (make_lshd_connection): Install
	window-change handler.

	* src/server_session.c (pty_request_handler): Convert dimensions
	to struct winsize.
	(window_change_request_handler): Likewise. Also use ioctl, not
	tty_setwinsize, and use DEFINE_CHANNEL_REQUEST.

	* src/server_pty.c (pty_open_slave): Replaced uses of tty_getattr,
	tty_setattr and tty_setwinsize, by calls to the underlying
	functions tcgetattr, tcsetattr and ioctl with TIOCSWINSZ.

	* src/server_pty.h: Don't include tty.h. Include sys/ioctl.h.
	(class pty_info): Change type of the dims attribute to struct
	winsize.

	* src/Makefile.in (INTERACT_SOURCES): Deleted suspend.c.
	(CRYPTO_CLIENT_SOURCES): New variable.
	(SOURCES): Added CRYPTO_CLIENT_SOURCES.
	(CRYPTO_CLIENT_OBJS): New variable.
	(lsh_transport_OBJS): Deleted TTY_OBJS. Added CRYPTO_CLIENT_OBJS.
	(lsh_decrypt_key_OBJS): Likewise.
	(lsh_writekey_OBJS): Deleted TTY_OBJS.

	* src/lsh-decrypt-key.c: Updated for interact changes.
	* src/lsh-writekey.c: Likewise.
	* src/srp-gen.c: Likewise.

	* src/client_pty.c (class client_tty_resource): Deleted class, it
	needs no attributes beyond the superclass resource.
	(do_kill_client_tty_resource): Use interact_set_mode.
	(make_client_tty_resource): Deleted arguments.
	(do_client_winch_handler): Updated to new interface, with new
	domensions as argument.
	(class client_pty_action): Deleted class, it needs no attributes
	beyond the superclass client_session_action.
	(do_action_pty_start): Updated for interact changes.
	(do_action_pty_success): Likewise.
	(client_request_pty): New static object, replacing
	make_pty_action.
	(make_pty_action): Deleted function.

	* src/client.c (suspend_callback): Moved here, from deleted file
	suspend.c.

	* src/tty.h (struct terminal_dimensions): Deleted struct. Replaced
	by struct winsize, from sys/ioctl.h.
	(CFMAKERAW): Deleted macro.
	
	* src/tty.c: (tty_getattr, tty_setattr): Deleted functions.
	(tty_getwinsize, tty_setwinsize): Deleted functions.	
	(termios_cc_index): Renamed, was cc_ndx. Made const.
	(termios_iflags): Renamed, was cc_iflags. Made const.
	(termios_oflags): Renamed, was cc_oflags. Made const.
	(termios_cflags): Renamed, was cc_cflags. Made const.
	(termios_lflags): Renamed, was cc_lflags. Made const.
	(ENCODE_FLAGS): Renamed, was PARSE_FLAGS.
	(tty_encode_term_mode): Updated for new names. Made the argument
	const.
	(TTY_SET_VALUE): Deleted macro.
	(TTY_DECODE_FLAG): Renamed, was TTY_SET_FLAG. Use SIZE macro.
	Fixed test for non-existent flag.
	(tty_decode_term_mode): Fixed off-by-one error in check for
	SSH_TTY_OP_RESERVED. Inlined handling of c_cc.

	* src/unix_interact.c (tty_fd): New global variable.
	(askpass_program): Likewise.
	(original_mode): Likewise.
	(raw_mode): Likewise.
	(unix_interact_init): New function. Optionally installs signal
	handler and atexit handler to restore tty modes.
	(interact_is_tty): New function, replacing method unix_is_tty.
	(interact_set_askpass): Likewise.
	(read_line): Deleted fd argument.
	(class window_subscriber): Deleted class.
	(class unix_interact): Deleted class.
	(interact_yes_or_no): New function, replacing unix_yes_or_no. Loop
	until we get a yes or no answer.
	(read_password): Deleted self argument. Use globals instead.
	(interact_read_password): New function, replacing method
	unix_read_password.
	(interact_dialog): New function, replacing unix_dialog method.
	(class unix_termio): Deleted class.
	(interact_set_mode): New function, replacing methods
	unix_set_attributes and do_make_raw.
	(interact_get_window_size): New function, replacing
	unix_window_size method.
	(class winch_handler): Replace interact poitner with a pointer
	directly to a window_change_callback.
	(do_winch_handler): Pass new window size to callback. Invoke a
	single window_change_callback, not a list of subscribers.
	(interact_on_window_change): New function, replacing
	unix_window_change_subscribe method.
	(make_unix_interact): Deleted function.
	(interact_get_terminal_mode): New function, unix_get_attributes
	method.

	* src/interact.h: Forward declare struct winsize and struct
	termios.
	(class terminal_attributes): Deleted.
	(class window_change_callback): Change callback argument, it now
	gets the new window size.
	(class interact): Deleted class. Use ordinary functions instead.

	* src/suspend.c: Deleted file. Moved signal handler to
	unix_interact.c. Moved suspend_callback to client.c.

	* src/suspend.h: Deleted file.

	* src/spki.c (spki_algorithm_lookup): Made non-static. Moved
	functions depending on interact_read_password to a separat file
	spki-decrypt.c.

	* src/spki-decrypt.c: New file.
	(parse_pkcs5): Moved function from spki.c.
	(parse_pkcs5_payload): Likewise.
	(spki_pkcs5_decrypt): Likewise. Deleted interact argument.

Niels Möller's avatar
Niels Möller committed
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
2008-05-17  Niels Mller  <nisse@lysator.liu.se>

	* src/client_session.c (oop_read_stdin): Implemented handling of
	escape character.
	(make_client_session_channel): Initialize escape_state.

	* src/client.h (enum escape_state): Moved here, from
	client_escape.c. Renamed constants with ESCAPE_ prefixes.
	(class client_session): New attribute escape_state.

	* src/client_escape.c (do_escape_help): Better display of ^Z.
	(class escape_handler): Deleted class.
	(scan_escape): Deleted function.
	(do_escape_handler): Deleted function.
	(make_handle_escape): Deleted function.
	(escape_dispatch): Use const argument.
	(client_escape_process): New function, replacing old code.

Niels Möller's avatar
Niels Möller committed
933
934
935
936
937
938
939
940
941
942
2008-05-15  Niels Mller  <nisse@lysator.liu.se>

	* src/channel.h: Deleted old if:ed out code.
	* src/gc.c, src/gc.h: Likewise.
	* src/io.c, src/io_commands.h: Likewise.
	* src/lsh-make-seed.c: Likewise.
	* src/queue.c: Likewise.
	* src/server_config.c: Likewise.
	* src/werror.c: Likewise.

Niels Möller's avatar
Niels Möller committed
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
2008-05-14  Niels Mller  <nisse@lysator.liu.se>

	* src/channel.h (CHANNEL_RECEIVE): Deleted macro, updated the only
	call in channel.c.
	(CHANNEL_SEND_ADJUST): Likewise.
	(CHANNEL_REQUEST): Likewise.
	(CHANNEL_OPEN_CONFIRM): Deleted macro.
	(CHANNEL_OPEN_FAILURE): Likewise.

	* src/.dist_classes: Added client_session.c.x, client_x11.c.x and
	gateway.c.x.

	* src/make-class-map: Use /usr/bin/awk as interpreter.

	* src/lsh.h (MAX, SQR): Deleted unused macros.

	* src/testsuite/sockaddr2info-test.c: Deleted file. Tested
	function no longer exists.
	* src/testsuite/Makefile.in (TS_SOURCES): Removed
	sockaddr2info-test.c.
	(TS_SH): Added lsh-13-test.

	* src/Makefile.in (lsh_SOURCES): Added client_x11.c and xauth.c.
	(class-map): New target.

	* src/lsh.c (command gateway_accept): Moved to gateway.c.
	(make_gateway_setup): Likewise.
	(maybe_x11): New function, replacing client_maybe_x11 in client.c.
	(client_shell_session, client_command_session): X11 handling.
	(main): Install CHANNEL_OPEN handler for x11.

	* src/io.c (io_lookup_address): Fixed error message.

	* src/gateway.c (gateway_packet_handler): Implemented
	SSH_LSH_GATEWAY_STOP.
	(make_gateway_connection): Set port attribute. Corresponding new
	argument.
	(command gateway_accept): Moved here, from lsh.c. Use the port
	object provided in the listen_value.
	(make_gateway_setup): Moved here, from lsh.c.

	* src/client.h: Updated x11-related prototypes.

	* src/client.c (oop_read_service): More debug output for
	unexpected message types.
	(client_maybe_x11): Deleted function (moved to lsh.c).

	* src/client_pty.c (do_kill_client_tty_resource): Check alive
	flag. New trace message.

	* src/client_session.c (do_client_session_event): Deleted call to
	channel_start_receive.
	(do_action_shell_success): New function. Calls
	channel_start_receive. The old ordering of the CHANNEL_REQUEST
	message and the CHANNEL_WINDOW_ADJUST caused interoperability
	problems with Sun_SSH_1.1 (no comprehensive interoperability
	testing done).
	(client_request_shell): Use do_action_shell_success.
	(make_action_command): Use do_action_shell_success. Set the serial
	attribute to true.

	* src/client_x11.c: Total reorganization. Adapted to new
	client_session_action conventions, and the new handling of channel
	open and channel requests.

	* src/testsuite/daemon-fd-test: Use ls -1, to get the same output
	regardless of presence of pty.

	* src/lsh-transport.c (lsh_transport_service_packet_handler):
	Fixed handling of SSH_LSH_RANDOM_REQUEST.

	* src/format.c (format_string): Fixed length calculation for hex output.

	* src/channel.c (channel_send_request): Check if we have sent
	channel_close. Return success/failure.

2008-05-12  Niels Mller  <nisse@lysator.liu.se>

	* src/io_commands.c (make_listen_value): Moved function here, from
	io.c. Also made static, changed interface to take a sockaddr as
	argument, and merged contents of sockaddr2info,
	(oop_io_port_accept): Updated call to make_listen_value.

	* src/io.h (class listen_value): Added port attribute.

	* src/io.c (make_listen_value, sockaddr2info): Deleted, moved to
	io_commands.c.

	* src/lsh.c (DEFAULT_ESCAPE_CHAR, DEFAULT_SOCKS_PORT): Moved from
	client.c.
	(class lsh_options): Don't inherit client_options, its contents is
	moved here.
	(make_options): Moved initialization code from init_client_options.
	(add_action, prepend_action): New functions, moved from client.c.
	(make_client_session): New function, moved from client.c.
	(maybe_pty): New function, moved from client.c. 
	(client_shell_session): Rewritten to use client_session_action.
	(client_subsystem_session): Likewise.
	(client_command_session): Likewise.
	(main_options): Copied options from client.c.
	(main_argp_children): Inherit werror_argp, not client_argp.
	(parse_arg_unsigned, parse_forward_arg): Moved from client.c.
	(CASE_ARG, CASE_FLAG): Updated, not member is no longer in super class.
	(main_argp_parser): Moved option parsing from client.c.
	(fork_lsh_transport): Updated to changes in lsh_options.
	(main): Updated to changes in lsh_options. Modify inhibit_actions
	flag around call to env_parse.

	Moved option parsing and configuration from client.c.

	* src/client_pty.c (class pty_request): Deleted.
	(do_client_winch_handler): Updated call to channel_send_request.
	(class client_pty_action): New class, more or less replaces the
	pty_request class.
	(do_pty_continuation): Deleted function.
	(make_pty_continuation): Deleted function.
	(do_pty_request): Deleted function.
	(make_pty_request): Deleted function.
	(do_action_pty_start): New function.
	(do_action_pty_success): New function.
	(do_action_pty_failure): New function.
	(make_pty_action): New function.

	* src/client_session.c (session_next_action): New function.
	(do_client_session_event): Deleted installation of exit-status and
	exit-signal. Use session_next_action, and implement the new way of
	sending channel requests for the session.
	(handle_exit_status): Moved from client.c, and rewritten to use
	DEFINE_CHANNEL_REQUEST, and to use the exit_status pointer in the
	session.
	(handle_exit_signal): Likewise.
	(make_client_session_channel): New argument actions. Initialize
	actions, action_next and action_done. Initialize the request_types
	alist with handlers for exit-status and exit-signal.
	(do_action_shell_start): New function. (These and below related to
	session actions).
	(class client_action_command): New class.
	(do_action_command_start): New function.
	(make_action_command): New function.
	(make_exec_action): New function.
	(make_subsystem_action): New function.

	* src/client.h (class client_session_action): New class.
	(class client_session): New attributes actions, action_next,
	action_done, replacing the attribute requests.
	(class client_options)): Deleted, merged with lsh_options in
	lsh.c.

	* src/client.c: All code related to options and configuration
	moved to lsh.c.
	(make_client_escape): New function.
	(env_parse): Don't touch the inhibit_actions flag, let the caller
	do that.

	* src/server_session.c (do_exit_shell): Updated call to
	channel_send_request.
	(do_server_session_event): Ignore CHANNEL_EVENT_SUCCESS and
	CHANNEL_EVENT_FAILURE.

	* src/channel_forward.c (do_channel_forward_event): Ignore
	CHANNEL_EVENT_SUCCESS and CHANNEL_EVENT_FAILURE.
	* src/gateway_channel.c (do_gateway_channel_event): Likewise.
	* src/socks.c (do_socks_channel_event): Likewise.

	* src/channel.c (handle_channel_success): Generate a
	CHANNEL_EVENT_SUCCESS to notify the channel.
	(handle_channel_failure): Generate a CHANNEL_EVENT_FAILURE.
	(init_channel): Updated initialization of pending_requests.
	(channel_send_request): Deleted command_context argument.

	* src/channel.h (enum channel_event): New constants
	CHANNEL_EVENT_SUCCESS, CHANNEL_EVENT_FAILURE.
	(class ssh_channel): Made pending_requests a simple counter, not a
	queue of objects.

Niels Möller's avatar
Niels Möller committed
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
2008-05-04  Niels Mller  <nisse@lysator.liu.se>

	* src/client.c (handle_random_reply): New function.
	(client_random_request): New function.
	(client_gateway_random_request): New function.
	(oop_read_service): Use handle_random_reply.

	Moved and renamed class lsh_connection.
	* src/lsh.c (class lsh_connection): Moved definition to client.h.
	Renamed to client_connection. Renamed all related function.
	Related i/o code moved to client.c.

	* src/client.h (class client_connection): Moved here from lsh.c.
	New attribute pending_random.
	(client_random_handler): New class.

	* src/client.c: Moved client_connection i/o code here.
	(handle_random_reply): New function.
	(client_random_request): New function.
	(client_gateway_random_request): New function.
	(oop_read_service): Use handle_random_reply.

	* src/gateway.c (gateway_write_packet): Made non-static.
	(gateway_packet_handler): Handle SSH_LSH_RANDOM_REQUEST.
	(make_gateway_connection): Changed argument type from
	ssh_connection to client_connection.

	* src/gateway.h (class gateway_connection): Changed type of shared
	attribute to client_connection. Needs inclusion of client.h

	* src/gateway_channel.c (gateway_channel_open): Updated for new
	type of the shared attribute.

Niels Möller's avatar
Niels Möller committed
1151
1152
2008-05-03  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
	* src/transport_forward.c (forward_packet_handler): Refuse to
	forward "local" messages, with message numbers from
	SSH_FIRST_LOCAL and up.

	* src/resource.c (resource_list_top): Bug fixes.

	* src/gateway.h (gateway_forward_channel): Added prototype.

	* src/gateway_channel.c (gateway_forward_channel): Renamed
	function, was make_gateway_pair.
	(gateway_channel_open): Moved check for pending_close earlier.

Niels Möller's avatar
Niels Möller committed
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
	Reorganized handling of SSH_MSG_CHANNEL_OPEN.

	* src/connection.h (class ssh_connection): New attribute
	open_fallback, used by the gateway code.
	(class channel_open_info): Upgraded to a first-class object. Added
	attributes connection and local_channel_number.
	(class channel_open): Deleted the connection, continuation, and
	exception_handler arguments from the handler method.
	(DEFINE_CHANNEL_OPEN): Updated for shorter argument list.
	* src/connection.c (init_ssh_connection): Initialize open_fallback.

	* src/channel.c (class channel_open_continuation): Deleted class.
	(class exc_channel_open_handler): Deleted class.
	(make_channel_open_continuation): Deleted function.
	(make_exc_channel_open_handler): Deleted function.
	(channel_open_confirm): New function, replaces
	channel_open_continuation. Don't generate CHANNEL_EVENT_CONFIRM.
	(channel_open_deny): New function, replaces exc_channel_open_handler.
	(parse_channel_open): New function. Creates a channel_open_info
	object.
	(handle_channel_open): Use parse_channel_open. Set the connection
	and local_channel_number attributes of the channel_open_info. Check the
	open_fallback pointer. Less arguments to CHANNEL_OPEN.

	* src/channel.h (make_channel_io_exception_handler): Deleted
	prototype of obsolete function.
	(enum channel_event): CHANNEL_EVENT_CONFIRM is generated only for
	channels opened by our side.

	* src/tcpforward.c (class tcpforward_connect_state): Replaced
	continuation and exception handler attributes with a
	channel_open_info.
	(tcpforward_connect_done): Replaced COMMAND_CONTINUATION call with
	calls to channel_open_confirm and channel_forward_start_io.
	(tcpforward_connect_error): Replaced EXCEPTION_RAISE call with a
	call to channel_open_deny.
	(tcpforward_connect): Take a channel_open_info as argument.
	Adapted to new CHANNEL_OPEN convention.

	* src/server_tcpforward.c (channel_open_direct_tcpip): Adapted to
	new CHANNEL_OPEN convention.

	* src/client_tcpforward.c (channel_open_forwarded_tcpip): Adapted
	to new CHANNEL_OPEN convention.

	* src/server_session.c (do_open_session): Adapted to new
	CHANNEL_OPEN convention.

	* src/gateway_channel.c (class gateway_channel): New attribute
	channel_open_info.
	(do_gateway_channel_event): Use channel_open_confirm and
	channel_open_deny.
	(make_gateway_pair): Take a chennel_open_info as argument,
	replacing origin_connection. Leave most of the initialization of
	the originating channel to channel_open_confirm.
	(gateway_channel_open): Regular channel open handler, replacing
	function gateway_handle_channel_open.

	* src/gateway.c (gateway_packet_handler): Deleted special handling
	of SSH_MSG_CHANNEL_OPEN.
	(make_gateway_connection): Set open_fallback to gateway_channel_open.

2008-05-01  Niels Mller  <nisse@lysator.liu.se>

	* src/server_tcpforward.c (channel_open_direct_tcpip): Use DEFINE_CHANNEL_OPEN.

	* src/connection.h (DEFINE_CHANNEL_OPEN): Fixed colliding argument
	names in prototype.

	* src/client_tcpforward.c (channel_open_forwarded_tcpip): Use DEFINE_CHANNEL_OPEN.

2008-04-28  Niels Mller  <nisse@lysator.liu.se>

	* src/channel_forward.c (init_channel_forward): Use
	do_channel_forward_event if the given event handler is NULL.
	(channel_forward_write): New function.
	(do_channel_forward_receive): Use it.

	* src/resource.c (resource_list_top): New function.

	* src/lshd-connection.c (class lshd_connection): Renamed class,
	was connection. Updated users and renamed related functions for
	consistency.

	* src/gateway_channel.c (make_gateway_pair): Changed interface to
	take the two connections as arguments.
	(gateway_handle_channel_open): Likewise. Also made non-static.
	(gateway_packet_handler): Moved to gateway.c.
	* src/gateway.c (gateway_packet_handler): Moved function here.

	* src/connection.h (class ssh_connection): Removed attribute
	x11_display.	

Niels Möller's avatar
Niels Möller committed
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
2008-04-24  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh-transport.c (lsh_transport_service_packet_handler): New
	function, implementing SSH_LSH_RANDOM_REQUEST.
	(make_lsh_transport_connection): Use
	lsh_transport_service_packet_handler.

	* src/transport_forward.c (transport_forward_service_packet): New
	function, extracted from forward_packet_handler.

	* src/ssh.h (RANDOM_REQUEST_MAX): New constant.

	* src/format.c (ssh_vformat_length): Cleaned up handling of %r.

Niels Möller's avatar
Niels Möller committed
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
2008-04-23  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh-transport.c (make_lsh_transport_connection): Updated for
	init_transport_forward change.

	* src/transport_forward.c (init_transport_forward): New argument
	packet_handler.
	(transport_forward_packet): Default implementation fo the
	packet_handler method.
	(make_transport_forward): Updated for init_transport_forward
	change.
	(oop_read_service): Use packet_handler method.

	* src/transport_forward.h (class transport_forward): New method
	packet_handler.

	* src/ssh.h (SSH_LSH_RANDOM_REQUEST, SSH_LSH_RANDOM_REPLY): New
	local message types.

Niels Möller's avatar
Niels Möller committed
1291
1292
2008-03-03  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1293
1294
1295
	* src/client.c (env_parse): Can't free the allocated copy of the
	environment value, as the argument parser stores pointers into it.

Niels Möller's avatar
Niels Möller committed
1296
1297
1298
1299
1300
1301
1302
1303
	* src/lsh.c (main): Adapted to changed env_parse. Use ENV_LSHFLAGS.

	* src/client.c (env_parse): Take environment value as argument.
	Don't iterate over envp, instead, caller is expected to use
	the ordinary getenv. Renamed, used to be envp_parse.

	* src/environ.h.in (ENV_LSHFLAGS): New constant.

Niels Möller's avatar
Niels Möller committed
1304
1305
1306
1307
1308
2008-02-24  Niels Mller  <nisse@lysator.liu.se>

	* doc/Makefile.in (DISTFILES): Removed srp-spec.txt; already
	included in $(TARGETS).

Niels Möller's avatar
Niels Möller committed
1309
1310
1311
1312
1313
1314
1315
1316
1317
2008-02-06  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh-transport.c (read_host_acls): Message when host-acls
	cannot be opened is displayed only in verbose mode. Fixed message
	about old known_hosts file.

	* src/werror.c (werror_vformat): For %e, don't display the numeric
	errno value.

Niels Möller's avatar
Niels Möller committed
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
2008-01-08  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh-transport.c (lsh_transport_packet_handler): Handle
	SSH_MSG_USERAUTH_BANNER.
	(lsh_transport_lookup_verifier): Use spki_lookup_key.

	* src/spki.c (spki_lookup_key): New function.

2008-01-07  Niels Mller  <nisse@lysator.liu.se>

	* src/gateway.c (oop_write_gateway): New function.
	(gateway_start_write, gateway_stop_write): New functions.
	(gateway_write_data): Use gateway_start_write and
	gateway_stop_write.
	(make_gateway_connection): Initialize write_active.

	* src/gateway.h (class gateway_connection): New attribute
	write_active.

	* src/transport_forward.c (forward_packet_handler): Fixed error
	message.

	* src/lsh.c (write_packet): Deleted FIXME. Stopping channels and
	gateways when the transport write buffer is getting full, is
	implemented in service_start_write.

Niels Möller's avatar
Niels Möller committed
1344
1345
1346
1347
1348
2007-09-19  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.in (prgrp-timeout): Added rule
	for building prgrp-timeout executable.

Niels Möller's avatar
Niels Möller committed
1349
1350
2007-09-13  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1351
1352
1353
	* misc/xenofarm.sh: Updated for moved argp, nettle and spki
	directories.

Niels Möller's avatar
Niels Möller committed
1354
1355
1356
	* src/testsuite/functions.sh: Avoid using type -p, since it's not
	portable. 

Niels Möller's avatar
Niels Möller committed
1357
1358
2007-09-12  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1359
1360
	* src/testsuite/lsh-10-test: Fixed typo in check for local tty.

Niels Möller's avatar
Niels Möller committed
1361
1362
	* src/testsuite/Makefile.in (TEST_LIBS): Added $(LIBS).

Niels Möller's avatar
Niels Möller committed
1363
1364
1365
	* src/testsuite/testutils.c (test_cipher): Adapted to new
	crypt_string interface.

Niels Möller's avatar
Niels Möller committed
1366
1367
	* doc/Makefile.in (DISTFILES): Added srp-spec.txt.

Niels Möller's avatar
Niels Möller committed
1368
1369
1370
1371
2007-09-10  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/lsh-10-test: Skip test if we have no tty locally.

Niels Möller's avatar
Niels Möller committed
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
2007-09-09  Niels Mller  <nisse@lysator.liu.se>

	* src/spki.c (spki_pkcs5_encrypt): Updated use of
	crypt_string_pad.
	(spki_pkcs5_decrypt): Updated use of crypt_string_unpad.

	* src/lsh-writekey.c (process_private): Consume input string.
	(main): Adapt to process_private destroying the input. Do all
	conversions before writing the output files.

	* src/crypto.c (crypt_string, crypt_string_pad)
	(crypt_string_unpad): Deleted argument free. Now always consumes
	input string.

Niels Möller's avatar
Niels Möller committed
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
2007-09-07  Niels Mller  <nisse@lysator.liu.se>

	* src/atoms.c (get_atom_length, get_atom_name): Changed argument
	type to enum lsh_atom.

	* src/werror.c (get_error_stream): New function.

	* src/lsh.c (class lsh_connection): New attributes write_active
	and write_blocked.
	(CONNECTION_WRITE_BUFFER_STOP_THRESHOLD)
	(CONNECTION_WRITE_BUFFER_START_THRESHOLD): New constants.
	(stop_gateway, start_gateway): New functions.
	(oop_write_service): New function.
	(service_start_write, service_stop_write): New functions.
	(write_packet): Use service_start_write and service_stop_write.
	(oop_read_service): Added assert.
	(make_lsh_connection): Initialize write_active and write_blocked.
	(DEFINE_COMMAND2): Call gateway_start_read.
	(fork_lsh_transport): If messages are logged to file, dup that fd
	to stderr for the child process.

	* src/lsh-transport.c (main_argp_parser): Added -l/--user option.

	* src/gateway.c (gateway_start_read): Made non-static. Check
	read_active.
	(gateway_stop_read): New function.
	(make_gateway_connection): Initialize read_active. Don't call
	gateway_start_read. 

	* src/gateway.h (class gateway_connection): New attribute
	read_active. 

	* src/channel.c (send_stop, ssh_connection_stop_channels)
	(send_start, ssh_connection_start_channels): New functions.
	* src/connection.c (ssh_connection_foreach): New function.
	* src/connection.h: Prototypes for the above.

Niels Möller's avatar
Niels Möller committed
1423
1424
1425
1426
1427
1428
1429
1430
2007-05-29  Niels Mller  <nisse@lysator.liu.se>

	* src/gateway_channel.c (do_gateway_channel_event): When opening
	the target channel fails, we should deallocate the originating
	channel, not the target one.

	* src/Makefile.in (lshd-pty-helper): Added rules for this program.

Niels Möller's avatar
Niels Möller committed
1431
1432
1433
1434
1435
1436
1437
2007-05-14  Niels Mller  <niels@s3.kth.se>

	* src/testsuite/Makefile.in (TEST_OBJS): Added compress.o.
	(TEST_LIBS): Link with -lhogweed.

	* src/Makefile.in: Link programs with -lhogweed.

Niels Möller's avatar
Niels Möller committed
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
2007-05-10  Niels Mller  <nisse@lysator.liu.se>

	* Makefile.in (install uninstall): Typo fix.
	(SUBDIRS): Added misc directory.

	* doc/Makefile.in: Set VPATH. Fixed distclean rule. Fixed install
	and distclean targets.

	* contrib/Makefile.in: Set VPATH. Fixed distclean rule.
	* misc/Makefile.in (tags): Likewise.

Niels Möller's avatar
Niels Möller committed
1449
1450
2007-05-09  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
	* src/config.make.in (LIBS): Add @LIB_ARGP.

	* misc/Makefile.in (DISTFILES): New file.

	* configure.ac: Generate doc/Makefile misc/Makefile
	contrib/Makefile contrib/lsh.spec and contrib/solpkg.sh.
	(dummy-dep-files): Use only files in src and src/testsuite.
	(LIB_ARGP): New variable. We can't put -largp i LIBS, since that
	will cause the configure tests to fail.


Niels Möller's avatar
Niels Möller committed
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
	* Makefile.in (SUBDIRS): Added doc and contrib directories.
	(BUILD_SUBDIRS): Added doc directory.
	(install uninstall): Recurse also into doc directory.

	* doc/Makefile.in: New file.
	* doc/Makefile.am: Deleted.

	* contrib/Makefile.in: New file.
	* contrib/Makefile.am: Deleted.

Niels Möller's avatar
Niels Möller committed
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
2007-05-08  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.in (clean, distclean): New targets.

	* src/Makefile.in: New install, uninstall and clean targets.

	* src/config.make.in (sbindir): New variable.

	* Makefile.in (all check): Recurse only into the directories
	listed in BUILD_SUBDIRS.
	(install uninstall): Recurse into src.
	(distclean-here, maintainer-clean-here): Bugfix, depend on the
	corresponding clean-here targets.

	* configure.ac: Add -largp to LIBS, if we're using the bundled
	argp library. Use AC_PROG_INSTALL and AC_PROG_MKDIR_P.	

Niels Möller's avatar
Niels Möller committed
1489
1490
1491
1492
1493
1494
1495
2007-05-04  Niels Mller  <niels@s3.kth.se>

	* configure.ac: Commented out --without-zlib handling. For now,
	it's always disabled.

	* Makefile.am: Deleted obsolete file.

1496
1497
1498
1499
2007-05-04  Niels Mller  <nisse@lysator.liu.se>

	* INSTALL, install-sh, texinfo.tex: New files, copied from automake-1.10.

Niels Möller's avatar
Niels Möller committed
1500
1501
2007-05-03  Niels Mller  <nisse@lysator.liu.se>

1502
1503
	* aclocal.m4: Renamed, used to be acinclude.m4.

Niels Möller's avatar
Niels Möller committed
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
	* src/argp, src/nettle, src/rsync, src/spki: Removed directories
	and all files. They have moved one level up.

	* src/symmetric: Deleted obsolete directory and files.

	* src/testsuite/lshd-random-input-test: Use $LFIB_STREAM.

	* src/testsuite/functions.sh (SEXP_CONV, LFIB_STREAM): Locate
	programs by looking in nettle_builddir and in $PATH.

	* src/testsuite/Makefile.am: Deleted file.

	* src/testsuite/Makefile.in: Fixed distribution target, and
	dependencies.

	* src/testsuite/.test-rules.make: New file.

	* src/version.h (SOFTWARE_CLIENT_VERSION)
	(SOFTWARE_SERVER_VERSION): Deleted. 

	* src/parse.c (parse_bignum): Compile only when LSH_MINIMAL is
	undefined. 

	* src/lshd.c: Use PACKAGE_STRING.
	(add_key, read_host_key): Moved here...
	* src/server.c: ... from here.	

	* src/lsh.c (make_options): Disable use of randomness generator.
	Breaks X11 forwarding (generation of fake X11 cookies).

	* src/config.make.in: New file.

	* src/Makefile.in: Fixes to distribution target.

	* src/Makefile.am: Deleted file.

	* configure.ac: Removed automake-related macros. New options
	--with-system-nettle and --with-system-libspki.

	* Makefile.in: Deleted config.h rules. Fixed DISTFILES.

	* .bootstrap: Updated for directory reorganization.

Niels Möller's avatar
Niels Möller committed
1547
1548
2007-05-02  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
	* src/lsh-decode-key.c (argp_program_version): Use PACKAGE_STRING.
	* src/lsh-decrypt-key.c: Likewise.
	* src/lsh-export-key.c: Likewise.
	* src/lsh-keygen.c: Likewise.
	* src/lsh-make-seed.c: Likewise.
	* src/lsh-transport.c: Likewise.
	* src/lsh-writekey.c: Likewise.
	* src/lshd-connection.c: Likewise.
	* src/lshd-userauth.c: Likewise.

Niels Möller's avatar
Niels Möller committed
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
	* src/lcp: Support filenames containing white space. Fix from
	Ludovic Courts.	

2007-04-26  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.in (distdir): New target.

	* src/Makefile.in (distdir): New target.

	* src/lsh_string.c: Use #ifndef LSH_MINIMAL around functions that
	need crypto or bignums.
	* src/format.c: Likewise, for "%n" formatting.
	* src/werror.c: Likewise, for "%n" formatting.

	* Makefile.in: New manually written Makefile.in.

	* src/Makefile.in (PRE_CPPFLAGS, PRE_LDFLAGS): List argp_builddir,
	nettle_builddir and spki_builddir.
	(SUBDIRS): List testsuite.

2007-04-23  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.in: New manually written Makefile.in.

Niels Möller's avatar
Niels Möller committed
1583
1584
1585
1586
1587
1588
1589
1590
2007-04-07  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh_string.c (lsh_string_ntop): Use HAVE_INET_NTOP, not
	WITH_IPV6. Fixes problem with --disable-ipv6, reported by Sonny
	Rao.

	* configure.ac: Check for inet_ntop.

1591
1592
1593
1594
1595
1596
2007-04-04  Niels Mller  <nisse@lysator.liu.se>

	* configure.ac: Bumped version number to 2.9.1-exp.

	* Released lsh-2.9-exp

Niels Möller's avatar
Niels Möller committed
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
2007-03-27  Niels Mller  <nisse@lysator.liu.se>

	* src/gateway_channel.c (do_gateway_channel_event): For
	CHANNEL_EVENT_DENY, use the right channel number when propagating
	the error to the chained connection.

	* src/client_session.c (oop_read_stdin): Reset tty modes if we get
	EOF or I/O error on stdin.

	* src/channel.c (ssh_connection_register_channel): Reintroduced
	initialization of channel->local_channel_number. Unclear when this
	change from 2005-09-15 was lost.

	* src/unix_process.c (spawn_error): Deleted sync argument, let the
	caller be responsible for that.
	(spawn_parent): Only the reading end of the sync pipe passed as
	argument.
	(spawn_child): Only writing end of sync pipe passed as argument.
	(spawn_shell): Close the sync fd:s that aren't needed by the
	helper functions.

	* src/testsuite/lsh-10-test: Added extra delay before sending EOF,
	to avoid trigging a race condition when signalling EOF on a pty.

	* src/testsuite/Makefile.am (TS_SH): Added lsh-12-test.
	(EXTRA_DIST): Added socks4-config and socks5-config.

	* src/testsuite/lsh-12-test: New test, which executes two commands
	in parallel.

2007-03-05  Niels Mller  <nisse@lysator.liu.se>

	* configure.ac: By default, don't use the system's argp.

Niels Möller's avatar
Niels Möller committed
1631
1632
2007-03-01  Niels Mller  <nisse@lysator.liu.se>

1633
1634
	* configure.ac: Changed version "number" to 2.9-exp.

Niels Möller's avatar
Niels Möller committed
1635
1636
	* src/Makefile.am (EXTRA_DIST): Added lshg.

Niels Möller's avatar
Niels Möller committed
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
2007-02-28  Niels Mller  <nisse@lysator.liu.se>

	* src/lsh-transport.c: Implemented password authentication, both
	"password" and "keyboard-interactive".
	(lsh_transport_packet_handler): Try password authentication if supported.
	(try_password_auth): New function.
	(try_keyboard_interactive_auth): New function.
	(format_userauth_info_response): New function.
	(send_userauth_info_response): New function.
	(make_lsh_transport_config): Added support for
	diffie_hellman_group1_sha1.
	(start_service): Send hello message.

	* src/lsh.c (gateway_accept): Send hello message.
	(process_hello_message): New function.
	(main): Use process_hello_message. Implies that lsh -B will stay
	in the forground until after user authentication. Better error
	handling if connection fails.

	* src/ssh.h (LSH_HELLO_LINE_LENGTH, LSH_HELLO_VERSION): New
	constants. Use a fix length line as hello message between local
	components. 

	* src/werror.c (werror_argp_parser): Don't handle ARGP_KEY_INIT.
	At the time it is called, state->name is not yet valid.

	* src/list.c (int_list_member): New function.
	* src/keyexchange.c (select_algorithm): Use int_list_member.

	* src/gateway.c (gateway_write_data): New function.
	(gateway_write_packet): Use it.

	* src/environ.h.in: Helper programs are in SBINDIR and BINDIR, not
	LIBEXECDIR. 

2007-02-26  Niels Mller  <nisse@lysator.liu.se>

	* src/lshg: New shell script.
	* src/Makefile.am (bin_SCRIPTS): Added lshg.

Niels Möller's avatar
Niels Möller committed
1677
1678
2007-02-13  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1679
1680
1681
	* src/werror.c (werror_vformat): For %e, use the passed in number,
	not errno.

Niels Möller's avatar
Niels Möller committed
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
	* src/testsuite/prgrp-timeout.c (main): Close tty before exec.
	Display a message before the 10s sleep.

	* src/ssh_write.c (ssh_write_data): Enqueue the given data also in
	the i/o error case. This is necessary for proper handling of
	EWOULDBLOCK.

	* src/lshd-pty-helper.c (process_request): Record errno before
	calling other functions.

Niels Möller's avatar
Niels Möller committed
1692
1693
2007-02-08  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1694
1695
1696
1697
1698
1699
1700
	* src/testsuite/Makefile.am (TIMEOUT_PROGRAM): Pass -n to
	prgrp-timeout.

	* src/testsuite/prgrp-timeout.c (main): Don't create a new process
	group when running interactively, as it will confuse the shell.
	New option -n.

Niels Möller's avatar
Niels Möller committed
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
	* src/testsuite/functions.sh (spawn_lshd): Use --no-setsid, so
	that lshd stays in the same process group.

	* src/lshd.c: New option --no-setsid.

	* src/lshd-pty-helper.c (process_request): Display a message with
	the request return code, if it is non-zero.

	* src/daemon.c (daemon_init): New argument daemon_flags. Skip the
	call to setsid if DAEMON_FLAG_NO_SETSID is set.

	* src/testsuite/prgrp-timeout.c: Propagate SIGINT and SIGTERM to
	child process.

Niels Möller's avatar
Niels Möller committed
1715
1716
2007-02-07  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1717
1718
1719
1720
1721
1722
1723
1724
	* src/unix_process.c (send_helper_request): Better error message
	on EOF.

	* src/server_pty.c (pty_open_master): Better error messages if
	grantpt or unlockpt fails. Moved io_set_close_on_exec after
	grantpt, since it may be implemented be execing a separate (suid)
	program. 

Niels Möller's avatar
Niels Möller committed
1725
1726
	* src/testsuite/config/lshd-connection.conf: Don't enable quiet mode.

Niels Möller's avatar
Niels Möller committed
1727
1728
1729
1730
	* src/testsuite/prgrp-timeout.c: Include signal.h and string.h.
	Made the internal functions static.
	(main): Cast exit_pid to int before printing it.

Niels Möller's avatar
Niels Möller committed
1731
1732
1733
1734
1735
1736
	* src/testsuite/Makefile.am (noinst_PROGRAMS): Added prgrp-timeout.
	(check): Use prgrp-timeout.

	* src/testsuite/prgrp-timeout.c: New program, used to enforce
	a timeout and process cleanup when running the tests.

Niels Möller's avatar
Niels Möller committed
1737
1738
2007-02-06  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1739
1740
1741
	* src/testsuite/lsh-11-test: Workaround for the broken /bin/sh on
	Solaris. On Solaris, just exec ksh instead.

Niels Möller's avatar
Niels Möller committed
1742
1743
1744
1745
1746
1747
1748
1749
1750
	* src/testsuite/Makefile.am (TS_SH): Added lsh-11-test.

	* src/testsuite/lsh-11-test: New test, checking environment setup.

	* src/unix_process.c (exec_shell): Fixed off-by-one error, which
	broke inheritance of $HOME.

	* src/lcp: Quote argument to basename.

Niels Möller's avatar
Niels Möller committed
1751
1752
2007-02-05  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
	* src/transport_read.c (DEBUG_PACKET_HEADER): Disabled this debug
	output.

	* src/lshd-pty-helper.c (process_request): Require creds on all
	messages, only if configure indicates that credentials passing
	work. They are strictly needed only for utmp handling, to get an
	authentic pid.
	(process_request): For PTY_REQUEST_LOGIN, fixed missing break.
	Require creds.

Niels Möller's avatar
Niels Möller committed
1763
1764
1765
1766
1767
	* src/testsuite/lsh-10-test: Skip test if /dev/ptmx doesn't exist.

	* configure.ac (HAVE_SOCKET_CREDENTIALS_PASSING): Check for
	working credentials passing.

Niels Möller's avatar
Niels Möller committed
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
2007-01-27  Niels Mller  <nisse@lysator.liu.se>

	* src/transport.c: (format_newkeys): Moved to keyexchange.c.
	(transport_keyexchange_finish): Don't send the NEWKEYS message
	here, let keyexchange_finish handle that.

	* src/keyexchange.c (format_newkeys): Moved from transport.c. 
	(keyexchange_finish): Generate the newkeys packet here, after
	checking for weak keys. Skip the TRANSPORT_WRITE_FLAG_PUSH when
	sending this packet; otherwise any added IGNORE packet will be
	encrypted with the wrong keys. Instead, try pushing the packet out
	after the new keys have been installed.

Niels Möller's avatar
Niels Möller committed
1781
1782
1783
1784
1785
2007-01-26  Niels Mller  <nisse@lysator.liu.se>

	* src/client_tcpforward.c (do_channel_open_forwarded_tcpip): Fixed
	bug in verbose message.

Niels Möller's avatar
Niels Möller committed
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
2007-01-11  Niels Mller  <nisse@lysator.liu.se>

	* src/lshd-userauth.c (read_packet): No need for EINTR loop around
	lsh_string_read.

	* src/transport_read.c (read_some): Deleted function.
	(class transport_read_state): Inherit ssh_read_state.

	* src/service_read.c (read_some): Deleted function.
	(class service_read_state): Inherit ssh_read_state.

	* src/transport.c: enum transport_read_status replaced by
	ssh_read_status.

	* src/gateway.c: enum service_read_status replaced by
	ssh_read_status. 
	* src/lsh.c (oop_read_service): Likewise.
	* src/lshd-connection.c (oop_read_service): Likewise.
	* src/transport_forward.c (oop_read_service): Likewise.

	* src/transport.h (enum transport_read_status): Deleted, replaced
	by enum ssh_read_status.
	* src/service.h (enum service_read_status): Likewise.

	* src/ssh_read.h (class ssh_read_state): New simpler class,
	replacing the old and unused file of the same name. It is intended
	as a base class for service_read_state and transport_read_state,
	to reduce code duplication.
	(enum ssh_read_status): New enum.

	* src/ssh_read.c (ssh_read_some, init_ssh_read_state): New functions.

Niels Möller's avatar
Niels Möller committed
1818
1819
2007-01-09  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1820
1821
	* src/ssh_read.c, src/ssh_read.h: Deleted obsolete files.

Niels Möller's avatar
Niels Möller committed
1822
1823
	* src/write_packet.c: Deleted obsolete file.

Niels Möller's avatar
Niels Möller committed
1824
1825
2007-01-05  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1826
1827
1828
	* src/transport_read.c (transport_read_packet): Debug output in
	the case that the packet header is invalid.

Niels Möller's avatar
Niels Möller committed
1829
1830
1831
1832
1833
1834
	* configure.ac: Disable utmp support if pututline is not
	available.

	* src/lshd-pty-helper.c (main): Fixed copy-paste error in error
	message.

Niels Möller's avatar
Niels Möller committed
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
2006-12-08  Niels Mller  <nisse@lysator.liu.se>

	* src/pty-helper.c (CMSG_SPACE): Fixed typo.

2006-12-06  Niels Mller  <nisse@lysator.liu.se>

	* src/pty-helper.c (CMSG_LEN, CMSG_SPACE): If <sys/socket.h> fails
	to define these macros, define them here.

	* src/lshd-pty-helper.c (init_pty_state): Portability fixes for
	systems without utmpx. 

	* src/lshd-connection.c: Include <sys/uio>, for writev.

Niels Möller's avatar
Niels Möller committed
1849
1850
1851
1852
2006-12-06  Niels Mller  <niels@s3.kth.se>

	* src/unix_user.c: Deleted obsolete file.

Niels Möller's avatar
Niels Möller committed
1853
1854
2006-12-05  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1855
1856
1857
1858
1859
1860
	* src/lshd-pty-helper.c: Attempted to make the utmp/wtmp handling
	more portable.

	* configure.ac: When checking for utmp members, first include
	<sys/types.h>.

Niels Möller's avatar
Niels Möller committed
1861
1862
1863
	* contrib/solpkg.sh.in (datarootdir): New directory variable (for
	autoconf-2.61).

1864
1865
1866
1867
1868
2006-12-04  Niels Mller  <nisse@lysator.liu.se>

	* .bootstrap: Commented out linking of install-sh, texinfo.tex,
	INSTALL and COPYING into the nettle subdirectory.

Niels Möller's avatar
Niels Möller committed
1869
1870
1871
1872
1873
1874
1875
2006-05-26  Niels Mller  <niels@s3.kth.se>

	* src/lshd_read.c: Deleted unused file.

	* src/lshd-userauth.c (spawn_helper): Use SOCK_DGRAM for Solaris
	style ucred passing, otherwise SOCK_STREAM.

Niels Möller's avatar
Niels Möller committed
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
2006-05-26  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/functions.sh: Don't use set -e, since it made the
	cleanup code unreliable. FIXME: Check if any tests depended on this.

	* src/testsuite/setup-env: Reverted previous change. No -v flag to
	lsh-make-seed.

	* src/pty-helper.c: Moved inclusion of sys/types.h and
	sys/socket.h, from pty-helper.h.
	(pty_send_message): Check if SCM_CREDENTIALS is defined.
	(pty_recv_message): Check if SCM_CREDENTIALS or SCM_UCRED is
	defined, and support both interfaces (for Linux and Solaris,
	respectively).	

	* src/lshd-pty-helper.c: Include sys/socket.h
	(main): Use setsockopt SO_RECVUCRED, if available.

	* configure.ac: Check for ucred.h.

Niels Möller's avatar
Niels Möller committed
1896
1897
1898
1899
1900
1901
1902
2006-05-25  Niels Mller  <niels@s3.kth.se>

	* src/testsuite/lsh-10-test: Check that the client gets a tty.

	* src/lshd-userauth.c (spawn_helper): Use SOCK_DGRAM for the
	pty-helper socketpair.

Niels Möller's avatar
Niels Möller committed
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
2006-05-25  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/setup-env: Pass -v flag to lsh-make-seed.

	* src/lsh-make-seed.c (struct unix_random_source_state): New field
	start_time.
	(spawn_source_process): Save process start time.
	(SOURCE_TIMEOUT): New constant.
	(get_system): Use a 30 timeout for the select call, and kill
	processes that run for too long.

	* src/lshd-userauth.c (start_service): Fixed ENV_MAX handling.

Niels Möller's avatar
Niels Möller committed
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
2006-05-23  Niels Mller  <nisse@lysator.liu.se>

	* src/pty-helper.c (_XPG4_2): Define before including system
	headers. Needed for CMSG_SPACE and friends on Solaris.

	* src/service_read.c: Include "io.h".
	* src/transport_read.c: Likewise.

	* src/lshd.c (open_ports): Cast second argument to bind to struct
	sockaddr *.

	* src/lshd-pty-helper.c (main): Use _WTMP_FILE, when defined.
	Needed on Solaris. Otherwise, use _PATH_WTMPX.
	(main): Call setsockopt with SO_PASSCRED only if SO_PASSCRED is
	defined, which it is on Linux.

	* src/lshd-connection.c: Include <limits.h>.

	* src/daemon.c: Include <limits.h>.
	(getdtablesize): Use INT_MAX, not MAX_INT.

	* src/arglist.c (arglist_push_optarg): Use malloc + strcpy instead
	of asprintf, for better portability.

Niels Möller's avatar
Niels Möller committed
1940
1941
2006-05-23  Niels Mller  <niels@s3.kth.se>

Niels Möller's avatar
Niels Möller committed
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
	* src/io.c (io_readable_p): New function, replacing the static
	function readable_p in service_read.c and transport_read.c.

	* src/service_read.c (readable_p): Deleted function.
	(read_some): Use io_readable_p.
	* src/transport_read.c (readable_p): Deleted function.
	(read_some): Use io_readable_p.

	* configure.ac (HAVE_IOCTL_FIONREAD): Improved test.
	
Niels Möller's avatar
Niels Möller committed
1952
1953
1954
1955
	* configure.ac: New check for filio.h.
	(HAVE_IOCTL_FIONREAD): New check, if ioctl FIONREAD exists, and
	takes an int argument.
	
Niels Möller's avatar
Niels Möller committed
1956
1957
2006-05-19  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
1958
1959
1960
1961
1962
	* src/jpoll.c, src/jpoll.h: Deleted files.
	* src/Makefile.am (EXTRA_DIST): Deleted jpoll.h and jpoll.c.
	* configure.ac: Deleted tests for poll.h, sys/poll.h and the poll
	function. 

Niels Möller's avatar
Niels Möller committed
1963
1964
1965
1966
	* src/lsh-make-seed.c (get_dev_mem): Deleted function.
	(main): Deleted call to get_dev_mem.
	(update_zlib): Deleted function, and the rest of the zlib-related
	code.
Niels Möller's avatar
Niels Möller committed
1967
	(get_system): Rewritten to use select instead of poll.
Niels Möller's avatar
Niels Möller committed
1968

Niels Möller's avatar
Niels Möller committed
1969
1970
1971
1972
1973
1974
1975
1976
	* src/xalloc.c, src/xalloc.h: Some cleanup.
	(lsh_space_alloc, lsh_space_free, lsh_space_realloc): Don't use
	these wrapper functions in the !DEBUG_ALLOC case, instead, use
	xalloc, free and xrealloc directly using some preprocessor
	hacks.

	* src/lshd-pty-helper.c (main): Declare argc and argv UNUSED.

Niels Möller's avatar
Niels Möller committed
1977
1978
2006-05-19  Niels Mller  <niels@s3.kth.se>

Niels Möller's avatar
Niels Möller committed
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
	* configure.ac: Deleted canonicalize_file_name check, reverting
	earlier change.

	* src/lshd-userauth.c (main): Display a warning if the name of the
	lshd-connectiion executable doesn't start with a "/".
	(canonicalize_file_name): Deleted function, reverting earlier
	change.
	(start_service): For simplicity, removed special handling of
	relative file names and the canonicalize_file_name call. If user
	insists on using a relative file name, it will be interpreted
	relative to the logged in user's home directory.

Niels Möller's avatar
Niels Möller committed
1991
1992
1993
1994
1995
1996
1997
1998
	* src/lshd-userauth.c (canonicalize_file_name): As a fallback, try
	implementing canonicalize_file_name on top of the broken realpath
	function. Not 100% robust.
	(start_service): Avoid using canonicalize_file_name for absolute
	filenames.

	* configure.ac: Check for canonicalize_file_name.

Niels Möller's avatar
Niels Möller committed
1999
2000
	* src/lsh-transport.c: Include sys/stat.h.

Niels Möller's avatar
Niels Möller committed
2001
2002
2003
2004
2005
2006-05-19  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.am (EXTRA_DIST): Added configuration
	files.

Niels Möller's avatar
Niels Möller committed
2006
2007
2006-05-18  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
	* src/pty-helper.c (pty_send_message, pty_recv_message): Make
	linux style ucred handling conditional on SCM_CREDENTIALS being
	defined.

	* src/pty-helper.h (struct pty_message): Don't depend on the
	system to define struct ucred, instead, inline a struct with pid,
	uid and gid.

	* src/xalloc.h (lsh_realloc): New define.
	* src/xalloc.c (lsh_space_realloc): New function.

Niels Möller's avatar
Niels Möller committed
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
	* src/parse_config.c (parse_groups): Made group name optional.
	This change from 2005-09-06 was appearantly lost in the merge.

	* src/lshd.c (main): Moved call of make_lshd_config after
	daemon_close_fds.

	* src/io.c (lsh_pushd): Close fd if stat fails.
	(lsh_pushd): Set close-on-exec flag on the fd that may be returned
	in *result.
	(lsh_pushd): Fixed EINTR handling for fchdir.

	* src/daemon.c: Don't include wait.h.

	* src/atoms.in: Deleted serpent-cbc@lysator.liu.se.
	* src/algorithms.c (all_symmetric_algorithms): Deleted
	ATOM_SERPENT_CBC_LOCAL.
	(all_crypto_algorithms): Likewise.

2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2006-05-16  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/server-config-test.c: New file (merged manually
	from experimental branch).

	* src/lshd.c (make_lshd_config): Initialize werror_config.
	(lshd_config_handler): Pass self->werror_config to child parser.
	(main): Merged new daemonic handling from main branch.

	* src/testsuite/functions.sh (spawn_lshd): Use --daemonic option.

	* Merged experimental branch. Start of branch changes below.

Niels Möller's avatar
Niels Möller committed
2050
2051
2052
2053
2054
2006-05-11  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/lsh-encrypted-key-test: Disabled test for now.
	* src/testsuite/login-auth-test: Likewise.

Niels Möller's avatar
Niels Möller committed
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2006-05-09  Niels Mller  <nisse@lysator.liu.se>

	* src/testsuite/Makefile.am (TS_PROGS): Added server-config-test.

	* src/lsh-make-seed.c (get_dev_random): Use uint8_t for the read
	buffer.

	* src/channel.c (handle_open_confirm): Impose limit on
	send_max_packet.

Niels Möller's avatar
Niels Möller committed
2065
2066
2067
2068
2069
2070
2071
2006-05-08  Niels Mller  <nisse@lysator.liu.se>

	* configure.ac: Set version to lsh-2x1.

	* src/channel_forward.c: Use CAST_SUBTYPE, not CAST, to allow for
	subclassing.

Niels Möller's avatar
Niels Möller committed
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2006-02-28  Niels Mller  <niels@s3.kth.se>

	* src/testsuite/setup-env: Create empty utmp and wtmp files.

	* src/testsuite/lcp-test: Updated to use new gateway interface.

	* src/testsuite/functions.sh (LSHD_PTY_HELPER, LSHD_UTMP)
	(LSHD_WTMP): Define and export.
	(run_lsh): Moved -nt flag before $LSH_FLAGS, so it can be
	overridden.
	(exec_lsh, exec_lshg): Removed -nt flag, as no tty is the default
	behaviour.

	* src/testsuite/Makefile.am (TS_SH): Added lsh-10-test.

	* src/lshd-userauth.c (lookup_group): New function.
	(spawn_helper): New function.
	(main): Start a helper program, and pass an fd connected to the
	helper to the started service, using the --helper-fd option.

	* src/lshd-connection.c (lshd_connection_config): New class.
	(class connection): New attribute config.
	(make_connection): New argument config. Enable pty support.
	(make_lshd_connection_config): New function.
	(OPT_HELPER_FD): New constant.
	(main_options): New options struct, and new option --helper-fd.
	(main_argp_parser): New function.
	(main_argp): Include new options.
	(main): Use make_lshd_connection_config, and pass configuration to
	make_connection.

	* src/io.h (SHUT_RD_UNIX, SHUT_WR_UNIX, SHUT_RD_WR_UNIX): Deleted.

	* src/io.c (fd2info): Deleted.
	(lsh_make_pipe): Don't use SHUT_RD_UNIX and SHUT_WR_UNIX.
	(choose_address, io_resolv_address, address_info2sockaddr): #if:ed
	out.

2006-02-27  Niels Mller  <niels@s3.kth.se>

	* src/format.c (ssh_format): Fixed bug for the case DEBUG_ALLOC &&
	!__GNUC__.
	(write_decimal_length): Deleted function.
	(format_decimal): Made static.
	(format_string): New function, for the common parts of
	ssh_vformat_write. Includes the code from...
	(format_hex_string): Deleted function.
	(ssh_vformat_write): Deleted the feature of including a sexp-style
	decimal length, "3:foo". Unified handling of %s, %S and %z, using
	the new function format_string.

	* src/exception.c (make_exception_handler) 
	(make_report_exception_info): Deleted.
	(class report_exception_handler): Deleted.
	(do_report_exception_handler, make_report_exception_handler):
	Deleted. 

	* src/command.h (CONTINUATION_USED_P): Deleted.
	(class catch_report_collect): Deleted.
	(STATIC_CATCH_REPORT): Deleted.
	(PROGN, PROTECT): Deleted.

	* src/command.c (class parallell_progn): Deleted.
	(do_parallell_progn, make_parallell_progn)
	(progn_command): Deleted.
	(class catch_handler_info): Deleted.
	(make_catch_handler_info): Deleted.
	(class catch_handler): Deleted.
	(do_catch_handler, make_catch_handler): Deleted.
	(class catch_apply): Deleted.
	(do_catch_apply, make_catch_apply): Deleted.
	(class catch_report_apply): Deleted.
	(do_catch_report_apply, make_catch_report_apply)
	(do_catch_report_collect): Deleted.
	(class protect_handler): Deleted.
	(do_exc_protect_handler, make_protect_exception_handler)
	(protect_command): Deleted.

	* src/unix_process.c: Deleted old code to handle utmp and wtmp.
	That work is now delegated to a helper process, which can run with
	sufficient privileges.
	(make_unix_process): Made static.
	(send_helper_request): New function.
	(class logout_notice): New attributes helper_fd and helper_ref.
	(do_logout_notice): Send a PTY_REQUEST_LOGOUT to the helper
	process.
	(exec_shell): Made static.
	(spawn_error): New arguments helper_fd and helper_ref. Send a
	PTY_REQUEST_DESTROY to the helper process.
	(make_logout_notice): New arguments helper_fd and helper_ref.
	(spawn_parent): Pass helper_fd and helper_ref to
	make_logout_notice.
	(spawn_child): New arguments helper_fd and helper_ref. Send a
	PTY_REQUEST_LOGIN to the helper process.
	(spawn_shell): New arguments helper_fd. Send a PTY_REQUEST_CREATE
	to the helper process. Pass on helper_Fd and helper_ref to help
	functions.

	* src/server_session.c (class server_session): New attribute
	helper_fd.
	(make_server_session): Made static. New argument helper_fd.
	(class open_session): New attribute helper_fd.
	(do_open_session): Pass helper_fd to make_server_session.
	(make_open_session): New argument helper_fd.
	(do_exit_shell): Updated calls of channel_send_request. Cosmetic
	change to verbose message.
	(make_pty): Dup the master fd for both stdin and stdout, and leave
	the fd in the pty_info object intact.
	(spawn_process): Pass helper_fd to spawn_shell. If we're using a
	pty, set ignored_error = EIO on the read state correspondign to
	stdout. If we don't have a separate stderr channel, set
	channel->sources to 1, not 2.

	* src/lshg.c: Deleted file.

	* src/testsuite/lsh-10-test: New testcase, using a pty request.

	* src/lsh_process.h: Deleted prototypes for make_unix_process and
	exec_shell, and updated prototype for spawn_shell to include
	helper_fd.

	* src/lsh.h (struct catch_report_collect): Deleted forward
	declaration.

	* src/lsh.c (do_lsh_default_handler): Don't treat
	EXC_CHANNEL_REQUEST as an error.
	(transport_exit_callback): Fixed format strings.
	(fork_lsh_transport): Deleted if:ed out code.

	* src/lsh-decode-key.c (lsh_decode_key): Cosmetic changes to
	werror messages.

	* src/environ.h.in: Changed "_CONFIG_FILE" to "_CONF" in the names
	of environment variables.
	(FILE_LSHD_PTY_HELPER, ENV_LSHD_PTY_HELPER): New constants.
	(ENV_LSHD_UTMP, ENV_LSHD_WTMP): Likewise.

	* src/client_pty.c (class pty_request): Inherit command.
	(do_client_winch_handler): Use channel_send_request.
	(format_window_change): Deleted function.
	(do_pty_continuation): Use the session's resource list; a general
	channel no longer includes a resource list.
	(do_pty_request): New function, replacing do_format_pty_request.
	(do_format_pty_request): Deleted function.
	(make_pty_request): Update for changed inheritance.

	* src/client.h (class client_session): New attribute with the
	channel's resources. Needed for the pty support.
	* src/client_session.c (do_kill_client_session): Kill associated
	resources.
	(make_client_session_channel): Initialize resource list.

	* src/client.c: Cosmetic changes to werror messages.
	(request_shell, do_session_channel_request): Pass a NULL ctx to
	channel_send_request.
	(client_maybe_pty): Enabled pty allocation.

	* src/channel_io.h (class channel_read_state): New attribute
	ignored_error.

	* src/channel_io.c (init_channel_read_state): Initialize
	ignored_error.
	(channel_io_read): If ignored_error is non-zero, tread read errors
	with matching errno as EOF.
	(channel_io_write, channel_io_flush): Fixed werror format string.

	* src/channel.c (handle_channel_success, handle_channel_failure):
	Use the command_context associated with the request, if it's
	non-NULL.
	(format_channel_request_i): Deleted function.
	(channel_send_request): Changed arguments to include a want_reply
	flag and a struct command_context *.

	* src/Makefile.am: Deleted lshg rules.
	(liblsh_a_SOURCES): Added client_pty.c.
	

	* src/lshd-pty-helper.c: Rewritten. Uses the functions in
	pty-helper.c. Handle utmp and wtmp.

	* src/pty-helper.h: New file.
	* src/pty-helper.c: New file.

Niels Möller's avatar
Niels Möller committed
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2006-02-23  Niels Mller  <niels@s3.kth.se>

	* src/testsuite/lshg-1-test: Use --start-gateway. Don't use
	need_lshg.
	* src/testsuite/lshg-cat-2-test: Likewise.
	* src/testsuite/lshg-cat-test: Likewise.
	* src/testsuite/lshg-tcpip-local-test: Likewise.

	* src/testsuite/rapid7-lshd-test: Less verbosity.
	* src/testsuite/rapid7-lsh-test: Likewise.

	* src/testsuite/functions.sh: Use new gateway flags. Deleted
	function need_lshg. 

	* src/lsh.c (class lsh_connection): Renamed, was connection. New
	attribute gateway_connections.
	(oop_read_service): Fixed cut and paste errors in error messages.
	(make_lsh_connection): Initialize gateway_connections.
	(gateway_accept): New command.
	(expr make_gateway_setup): Moved from gateway_commands.c.
	(class lsh_options): New attributes, use_gateway, start_gateway,
	stop_gateway, and gateway.
	(make_options): Initialize gateway related attributes.
	(main_options): Use an enum to define option values. New options
	--use-gateway, --no-use-gateway, -G, --start-gateway,
	--stop-gateway.
	(main_argp_parser): Handle gateway related options.
	(fork_lsh_transport): Return a plain fd, not an object.
	(main): Start and stop gateway, as appropriate. Use a loop with
	object_queue_is_empty and object_queue_remove_head, instead of the
	FOR_OBJECT_QUEUE macro.

	* src/gateway_channel.c: Much of the old implementation deleted.
	(class gateway_channel): New class.
	(do_kill_gateway_channel): New function.
	(do_receive): Use channel_transmit_data and
	channel_transmit_extended, on the chained channel.
	(do_send_adjust): Use channel_adjust_rec_window.
	(do_gateway_channel_event): New function.
	(do_gateway_channel_request): New function.
	(do_gateway_channel_success): New function.
	(do_gateway_channel_failure): New function.
	(gateway_request_methods): New method struct.
	(make_gateway_pair): New function.
	(gateway_handle_channel_open): New function.
	(gateway_packet_handler): New function.

	* src/gateway.h (class gateway_connection): New class.

	* src/gateway.c (kill_gateway_connection): New function.
	(gateway_write_packet): New function.
	(gateway_disconnect): New function.
	(oop_read_gateway): New function.
	(gateway_start_read): New function.
	(do_write_packet): New function.
	(do_disconnect): New function.
	(make_gateway_connection): New function.

	* src/client_tcpforward.c (open_direct_tcpip_command): Don't setup
	any channel_open_context.

	* src/client.c (do_exit_status): Updated for const
	channel_request_info.
	(do_exit_signal): Updated for const channel_request_info. Use enum
	lsh_atom.
	(class session_open_command): New class, replacing command of the
	same name.
	(do_open_session_command): Don't setup any channel_open_context.
	(make_open_session_command): New function.
	(request_shell): Pass non-zero close_on_error to
Niels Möller's avatar
Niels Möller committed
2325
2326
	channel_send_request. Mark continuation and exception arguments as
	UNUSED.
Niels Möller's avatar
Niels Möller committed
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
	(do_session_channel_request): Likewise.
	(client_options): Cosmetic changes.
	(expr make_start_session): Deleted.
	(client_shell_session, client_subsystem_session) 
	(client_command_session): Use request queue in client_session
	object.
	(make_client_session): Changed return type to struct
	client_session *.

	* src/client_session.c (do_client_session_event): On
	CHANNEL_EVENT_CONFIRM, send all queued channel requests. On
	CHANNEL_EVENT_DENY, raise an exception. On CHANNEL_EVENT_CLOSE, do
	nothing.

	* src/client.h (class client_session): Moved definition here, from
	client_session.c. New queue of requests to send. New attribute
	with an exception handler to use for failed CHANNEL_OPEN and
	CHANNEL_REQUEST.

	* src/server_session.c (do_server_session_event): Handle and
	ignore CHANNEL_EVENT_CLOSE and CHANNEL_EVENT_DENY.
	(do_exit_shell): Updated call to channel_send_request.
	(shell_request_handler, exec_request_handler): Updated for const
	channel_request_info.
	(pty_request_handler): Likewise.

	* src/server_tcpforward.c (open_forwarded_tcpip_command): Don't
	setup any channel_open_context.

	* src/socks.c (class socks_channel): Replaces class
	socks_connection, and inherits channel_forward.
	(class socks_continuation): Deleted.
	(do_socks_continuation, make_socks_continuation): Deleted.
	(class socks_exception_handler): Deleted.
	(do_exc_socks_handler, make_socks_exception_handler): Deleted.
	(do_socks_channel_event): New function, in particular handling
	CHANNEL_EVENT_CONFIRM and CHANNEL_EVENT_DENY.

	* src/channel_forward.c (channel_forward_shutdown): Made
	non-static.
	(channel_forward_start_read): New function.
	(channel_forward_start_io): Use channel_forward_start_read.
	(do_channel_forward_event): Use channel_forward_start_read.
	Recognize CHANNEL_EVENT_DENY and CHANNEL_EVENT_CLOSE, and do
	nothing.	
	(init_channel_forward): Take event handler as argument.
	(make_channel_forward): Pass do_channel_forward_event to
	init_channel_forward.
	(forward_open_report, catch_channel_open): Deleted.

	* src/channel.h (format_channel_close, format_channel_eof):
	Deleted prototypes.

	* src/channel.c: Generally, use ssh_connection_lookup_channel with
	type CHANNEL_ALLOC_ACTIVE.
	(format_open_confirmation, format_open_failure)
	(format_channel_success, format_channel_failure)
	(format_channel_window_adjust): New function.
	(lookup_channel, lookup_channel_reserved): Deleted, replaced by
	ssh_connection_lookup_channel.
	(ssh_connection_register_channel): Renamed, was register_channel.
	(send_window_adjust): New function, replacing
	prepare_window_adjust.
	(channel_adjust_rec_window, channel_start_receive): Use
	send_window_adjust.
	(handle_global_request): Use enum lsh_atom.
	(handle_channel_request): Use request_methods, if non-NULL. Treat
	a request on non-existing channel as a protocol error.
	(do_channel_open_continue): Use ssh_connection_register_channel
	and ssh_connection_activate_channel.
	(do_exc_channel_open_handler): Updated for in_use / alloc_state
	renaming.
	(handle_channel_open): Don't use open_fallback handler. Use type
	CHANNEL_ALLOC_RECEIVED_OPEN when allocating the channel number.
	(handle_channel_close): Generate CHANNEL_EVENT_CLOSE.
	(handle_open_confirm): Use ssh_connection_activate_channel. Don't
	use channel_open_context.
	(handle_open_failure): Use ssh_connection_lookup_channel with type
	CHANNEL_ALLOC_SENT_OPEN. Generate CHANNEL_EVENT_DENY. Don't use
	channel_open_context.
	(handle_channel_success, handle_channel_failure): Use
	request_methods if non-NULL. For now, don't invoke any
	continuation or exception.
	(init_channel): Updated initialization for added and removed
	attributes.
	(channel_transmit_data): Use format_channel_data.
	(channel_transmit_extended): Use format_channel_extended_data.
	(channel_open_new_v): Alloc channel with type
	CHANNEL_ALLOC_SENT_OPEN. Call ssh_connection_register_channel.
	(channel_open_new_type): Replaced type argument, an atom, with
	length and const uint8_t *
	(channel_send_request): Replaced the context argument with a flag
	saying if the channel should be closed on failure.

	* src/channel.h (enum channel_event): New event types
	CHANNEL_EVENT_DENY and CHANNEL_EVENT_CLOSE.
	(struct channel_request_info): Use enum lsh_atom for the type.
	(struct channel_request_methods): New struct, used by gateway
	channels to replace the handling of channel requests.
	(class ssh_channel): New attribute request_methods. Deleted
	request_fallback and channel_open_context.
	(class channel_request): Made the struct channel_request_info *
	argument const.

	* src/connection.c (init_ssh_connection): Initialize alloc_state.
	(ssh_connection_alloc_channel): Added type argument. Proper
	reallocation of alloc_state.
	(ssh_connection_dealloc_channel): Updated for in_use / alloc_state
	renaming.
	(ssh_connection_activate_channel): Renamed function, was
	ssh_connection_use_channel.
	(ssh_connection_lookup_channel): New function, replacing
	lookup_channel and lookup_channel_reserved in channel.c.

	* src/connection.h (enum channel_alloc_state): New name for enum.
	Replaced CHANNEL_RESERVED and CHANNEL_IN_USE with three values,
	CHANNEL_ALLOC_SENT_OPEN, CHANNEL_ALLOC_RECEIVED_OPEN, and
	CHANNEL_ALLOC_ACTIVE. 
	(class ssh_connection): Deleted open_fallback. Renamed array
	in_use to alloc_state.

	* src/gateway_channel.h: Deleted obsolete file.
	* src/gateway_commands.h: Likewise.
	* src/gateway_commands.c: Likewise.
	* src/debug.c: Likewise.
	
	* src/resource.c (resource_iterate): New function.
	(do_mark_resources): Use resource_iterate.
	(resource_list_foreach): New function.
	(kill_resource): New function.
	(do_kill_resource_list): Renamed, was do_kill_all. Use
	resource_list_foreach.

	* src/ssh.h (SSH_LSH_GATEWAY_STOP): New, local, message number.

	* src/charset.c: No longer includes format.h.

	* src/io_commands.c (listen_tcp_command): Use io_bind_sockaddr.
	(listen_local_command): New command.

	* src/io.c (io_bind_local, io_connect_local): Changed to return a
	plain fd, no lsh_fd object.
	(io_bind_sockaddr): New function, used for both AF_LOCAL and
	AF_INET sockets.

	* src/lsh_string.c (lsh_string_dup): New function, replacing...
	* src/format.h (lsh_string_dup): ... deleted macro.

	* src/dsa.c (do_dsa_verify, make_ssh_dss_verifier): Use enum
	lsh_atom.
	* src/rsa.c (do_rsa_verify, make_ssh_rsa_verifier): Likewise.
	* src/lsh-decode-key.c (lsh_decode_key): Likewise.
	* src/lshd-userauth.c (get_verifier, handle_publickey)
	(handle_userauth): Likewise.
	* src/spki.c (spki_algorithm_lookup): Likewise.

	* src/sexp.c (lsh_sexp_to_atom, lsh_sexp_get_type): Return enum
	lsh_atom, not int.

	* src/process_atoms: For the header file, generate an enum, not a
	list of #define:s.

	* src/parse.c (parse_atom, parse_next_atom): Use enum lsh_atom for
	result.
	(parse_atoms): Convert from enum lsh_atom to int, when
	constructing the list.

	* src/atoms.in: Deleted unused spki-related atoms, p, q, g, y, x,
	r, s, n, e, d, a, b, c.

	* src/atoms.h (ATOM_LD): New macro.

	* src/atoms.c (lookup_atom): Return enum lsh_atom, not int.

	* src/Makefile.am (sbin_PROGRAMS): Added lshd-pty-helper.
	(liblsh_a_SOURCES): Added gateway.c and gateway_channel.c.

	* src/lshd-pty-helper.c: New program.

	* src/server_config.h: Fixed include guard.
	* src/tokenize_config.h: Likewise.

	* src/arglist.h: Added missing include guard.
	* src/channel_io.h: Likewise.
	* src/lock_file.h: Likewise.
	* src/environ.h.in: Likewise.
	* src/transport_forward.h: Likewise.

Niels Möller's avatar
Niels Möller committed
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2006-02-14  Niels Mller  <niels@s3.kth.se>

	* src/testsuite/parse-config-test.c (test_main): Pass dummy file
	name to config_parse_string.

	* src/testsuite/lshd-random-input-test: Use "localhost" instead of
	$INTERFACE. 
	* src/testsuite/rapid7-lshd-test: Likewise.


	* src/testsuite/lshd-no-auth-test: Deleted --interface option.

	* src/lshd_keyexchange.c: Deleted obsolete file.

	* src/Makefile.am (lsh_execuv_LDADD): Deleted.

	* src/unix_process.c (format_env_pair): Use const char * for the
	value.
	(format_env_pair_c): Deleted.
	(exec_shell): Updated for above changes.

	* src/transport_forward.c: Adapted event handler functions to
	return void.
	(oop_read_service): Fix cut and paste error, should use
	SERVICE_READ_PUSH and SERVICE_READ_PENDING, not TRANSPORT_READ_*.

	* src/transport.c (format_newkeys): Moved function here, and made
	static. Used to be in format.c.
	(transport_close): Clarified comment on disconnect handling.
	The event handler no longer returns and value for
	TRANSPORT_EVENT_CLOSE. Simplified logic deciding if the connection
	should be closed immediately, or if we should allow some time for
	the buffer to drain.

	* src/server_session.c (make_server_session): Cleanup of
	initialization. 
	(init_spawn_info): Now plain const char * is used for environment
	values.
	(shell_request_handler): Deleted FIXME comment.
	(lookup_subsystem): Deleted function, replaced by
	server_lookup_module.
	(do_spawn_subsystem): Use server_lookup_module.

	* src/lshd.c (lshd_event_handler): Return void.
	(lookup_service): Deleted function, replaced by
	server_lookup_module.
	(lshd_service_request_handler): Use server_lookup_module.

	* src/server.c (server_lookup_module): New function, replacing
	lookup_service and lookup_subsystem.

	* src/lsh_string.h: Added include guards. Declare
	lsh_string_colonize, lsh_string_bubblebabble_c and
	lsh_string_bubblebabble. 

	* src/lsh_string.c (lsh_string_colonize) 
	(lsh_string_bubblebabble_c, lsh_string_bubblebabble): Functions
	moved here, used to be in format.c.

	* src/lsh_process.h (struct env_value): Use a const char * for the
	value.

	* src/lsh-transport.c (lsh_transport_event_handler): Changed
	return type to void.
	(lsh_transport_lookup_verifier): Use spki_add_acls.
	(read_host_acls): Use spki_add_acls.

	* src/spki.c (spki_add_acls): New function, replacing
	spki_add_acl. The new function takes a string as argument,
	containing zero or more acls.

	* src/transport.h (class transport_connection): Changed the
	event_handler method to return void.

	* src/keyexchange.c (parse_kexinit, format_kexinit) 
	(do_make_simple_kexinit): Use sizeof to get the size of
	kex->cookie, instead of hardcoding the value 16.

	* src/format.c (ssh_vformat_length): Removed support for negative
	numbers.
	(ssh_vformat_write): Likewise.
	(format_newkeys): Function moved to transport.c.
	(lsh_string_colonize): Function moved to lsh_string.c.
	(lsh_string_bubblebabble_c): Likewise.
	(lsh_string_bubblebabble): Likewise.

	* src/dsa.c (DSA_BLOB_LENGTH): New constant.
	(dsa_blob_length): Deleted function.
	(dsa_blob_write): Deleted length argument.
	(do_dsa_sign): Use a constant size DSA_BLOB_LENGTH for writing r
	and s.

	* src/channel_io.c (init_channel_read_state) 
	(init_channel_write_state): Let fd < 0 mean that no buffer should
	be allocated yet.

Niels Möller's avatar
Niels Möller committed
2611
2612
2006-02-13  Niels Mller  <niels@s3.kth.se>

Niels Möller's avatar
Niels Möller committed
2613
2614
2615
2616
2617
2618
2619
	* src/testsuite/functions.sh (LSHD_CONFIG_DIR): Set and export.
	(INTERFACE): Deleted variable.

	* src/testsuite/config/lshd-connection.conf: New file.
	* src/testsuite/config/lshd-userauth.conf: New file.
	* src/testsuite/config/lshd.conf: New file.

Niels Möller's avatar
Niels Möller committed
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
	* src/.dist_classes (dist_classes): Added lshd-userauth.c.x,
	server.h.x and werror.h.x.


	* src/Makefile.am (sbin_PROGRAMS): Deleted lsh-execuv.
	(liblsh_a_SOURCES): Added server_config.c and tokenize_config.c.

	* src/lshd.c (class lshd_configuration): Split in two classes,
	lshd_config and lshd_context.
	(lshd_packet_handler): Improved trace message. Never dump userauth
	packets to the log.
	(class lshd_port): Use lshd_context class.
	(open_ports): Likewise.
	(make_lshd_context): New function.
	(class pid_file_resource): Use a proper string for saving the file
	name.
	(class lshd_config): New class.
	(make_lshd_config): New function.
	(main_options): Use uppercase for metasyntactic variables in help
	output, to match other GNU programs.
	(main_argp_children): Use server_argp as a child parser, making
	werror_argp a grand child.
	(main_argp_parser): At ARGP_KEY_INIT, set up child_inputs. At
	ARGP_KEY_END, key handling etc has been moved to after the
	configuration file is parsed, in lshd_config_handler.
	(lshd_config_options): New config file keywords.
	(lshd_config_handler): New function.
	(lshd_config_children, lshd_config_parser): New constant structs.
	(main): Adapted to lshd_config/lshd_context split.

	* src/lshd-userauth.c (start_service): Propagate $LSHD_CONFIG_DIR
	to the new process.
	(main_argp_children): Use server_argp as child parser, which makes
	werror_argp a grand child.
	(class lshd_userauth_config): New class, inheriting server_config.
	(make_lshd_userauth_config): New function.
	(main_argp_parser): At ARGP_KEY_INIT, setup child_inputs[0].
	(main): Use make_lshd_userauth_config. Deleted hack to
	unconditionally pass -v and --trace to the child process.

	* src/lshd-connection.c (main_argp_children): Use server_argp as
	child parser, which makes werror_argp a grand child.
	(main): Use make_server_config, with configuration file pointer
	out by FILE_LSHD_CONNECTION_CONF and
	ENV_LSHD_CONNECTION_CONFIG_FILE.

	* src/transport.c (transport_process_packet): Improved trace
	message.

	* src/server.c (server_parse_config_file): New function.
	(init_server_config, make_server_config): New functions.
	(server_argp): New config file parser, responsible for options
	related to the configuration files, and for processing of the
	configuration file.

	* src/lsh.c (main_argp_children): werror_argp is no longer a
	direct child parser, it's a grand child via client_argp.
	(main_argp_parser): At ARGP_KEY_INIT, no longer set
	child_inputs[1]. At ARGP_KEY_END, deleted old transport-level
	setup which has been  moved to lsh-transport.c.
	(fork_lsh_transport): Examing the werror_config object to figure
	out which flags to pass on, instead of using the global variables
	quiet_flag and friends.

	* src/lsh-transport.c (class lsh_transport_config): Include a
	pointer to a werror_config.
	(make_lsh_transport_config): Use make_werror_config.
	(lsh_transport_packet_handler): Use debug, not werror, for dumping
	packet contents.
	(lsh_transport_lookup_verifier): Use werror_quiet_p.
	(main_argp_parser): At ARGP_KEY_INIT, set child_inputs[1]. At
	ARGP_KEY_END, call werror_init.

	* src/client.c (do_exit_signal): Use int type for signal.
	(init_client_options): Call init_werror_config.
	(quiet_callback, verbose_callback, trace_callback)
	(debug_callback): Call the correspnding toggle_* function.
	(client_argp_parser): At ARGP_KEY_INIT, set child_inputs[0]. At
	ARGP_KEY_END, call werror_init.
	(client_argp_children, client_argp): Use werror_argp as a child
	parser.

	* src/client.h (class client_options): Inherit werror_config.

	* src/xauth.c: Deleted obsolete xauth parsing code.

	* src/xalloc.h (number_of_strings): Deleted declaration.

	* src/werror.h (class werror_config): New class.

	* src/werror.c (trace_flag, debug_flag, quiet_flag, verbose_flag):
	Made static.	
	(toggle_quiet, toggle_verbose, toggle_trace, toggle_debug): New
	functions.
	(set_error_syslog): Deleted argument.
	(werror_format): Made non-static.
	(werror_quiet_p, init_werror_config, make_werror_config): New
	functions.
	(werror_init): New function.
	(werror_config_parser): New configuration file parser.

	* src/unix_interact.c (read_password): Use werror_quiet_p.
	(unix_yes_or_no): Don't check for quiet mode; let the caller do
	that.

	* src/io_commands.c (command listen_command): Deleted.
	(resolve_exception):Deleted.
	(command bind_address_command): Deleted.
	(command bind_local_command): Deleted.
	(class connect_continuation): Deleted.
	(do_connect_continuation): Deleted.
	(make_connect_continuation): Deleted.
	(do_connect): Deleted.
	(class connect_port): Deleted.
	(do_connect_port): Deleted.
	(make_connect_port): Deleted.
	(command connect_simple_command): Deleted.
	(command connect_list_command): Deleted.
	(command connect_connection_command): Deleted.
	(command connect_local_command): Deleted.

	* src/lsh_string.c (lsh_string_put_base64_single): Deleted unused
	function.

	* src/srp-gen.c (class srp_gen_options): Inherit werror_config. 
	(make_srp_gen_options): Call init_werror_config.
	(main_argp_parser): At ARGP_KEY_INIT, set child_inputs[0]. At
	ARGP_KEY_END, call werror_init.
	* src/lsh-decode-key.c: Analogous changes.
	* src/lsh-decrypt-key.c: Analogous changes.
	* src/lsh-export-key.c: Analogous changes.
	* src/lsh-keygen.c: Analogous changes.
	* src/lsh-writekey.c: Analogous changes.
	* src/lsh-make-seed.c: Analogous changes.
	(main): Use werror_quiet_p.

	* src/parse_config.c: Tokenizer code moved to a separate file,
	tokenize_config.c.
	(config_parse_string): Added file name argument.

	* src/exception.h (class report_exception_info): Deleted.
	(make_report_exception_info): Deleted.
	(STATIC_REPORT_EXCEPTION_INFO): Deleted.
	(make_report_exception_handler): Deleted.
	(make_exception_handler): Deleted.
	(class protocol_exception): Deleted.
	(make_protocol_exception): Deleted.
	(STATIC_PROTOCOL_EXCEPTION): Deleted.
	(PROTOCOL_ERROR): Deleted.
	(PROTOCOL_ERROR_DISCONNECT): Deleted.

	* src/exception.c (default_exception_handler): Deleted.
	(make_protocol_exception): Deleted.
	
	* src/environ.h.in (FILE_LSHD_CONFIG_DIR, FILE_LSHD_CONF) 
	(FILE_LSHD_USERAUTH_CONF, FILE_LSHD_CONNECTION_CONF) 
	(ENV_LSHD_CONFIG_DIR, ENV_LSHD_CONNECTION_CONFIG_FILE) 
	(ENV_LSHD_USERAUTH_CONFIG_FILE): New string constants.

	* src/dh_exchange.c (dh_make_client_msg, dh_process_server_msg):
	Deleted obsolete functions. 

	* src/connection.c (kill_ssh_connection): Deleted obsolete
	function.

	* src/client_session.c (client_start_io): Deleted obsolete
	command.
	(make_client_session_channel): Comment fix.

	* src/channel_forward.c (channel_forward_start_io_read): Deleted
	obsolete function.

	* src/channel.c (lookup_channel, lookup_channel_reserved): Made
	static. 

	* src/algorithms.c (algorithms_options): Use uppercase for
	metasyntactic variables in help output, to match other GNU
	programs. 

	* src/tokenize_config.h: New file.
	* src/tokenize_config.c: New file.
	* src/server_config.h: New file.
	* src/server_config.c: New file.

	* src/handshake.c, src/handshake.h, src/lsh-execuv.c,
	src/oop-line-file.c, src/oop-line.h: Removed obsolete files.

	* configure.ac: For gcc-4.x, add -Wno-pointer-sign to CFLAGS.

Niels Möller's avatar
Niels Möller committed
2809
2810
2811
2812
2813
2814
2815
2816
2005-10-10  Niels Mller  <niels@s3.kth.se>

	* src/.dist_classes (dist_classes): Removed a bunch of obsolete
	class files.

	* src/client_userauth.c: Deleted file.
	* src/client_userauth.h: Deleted file.

Niels Möller's avatar
Niels Möller committed
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2005-10-10  Niels Mller  <nisse@lysator.liu.se>

	* src/client.c (client_argp_parser): Enable socks forwarding.

	* src/Makefile.am (liblsh_a_SOURCES): Added socks.c.

	* src/socks.c: Adapted to new i/o and channel_forward interfaces.

2005-10-09  Niels Mller  <nisse@lysator.liu.se>

	* src/io.c: Deleted obsoleted functionality.
	(class io_listen_callback): Deleted class.
	(do_listen_callback, make_listen_callback): Deleted functions.
	(class io_connect_callback): Deleted class.
	(do_connect_callback, make_connect_callback): Deleted functions.
	(do_kill_fd, do_exc_io_handler): Deleted functions.
	(read_raw): Deleted function.
	(io_connect): Deleted old connect interface.
	(do_connect_list_kill, make_connect_list_state): Deleted functions.
	(class connect_list_callback): Deleted class.
	(connect_attempt, do_connect_list_callback) 
	(make_connect_list_callback, io_connect_list): Deleted functions.
	(io_bind_sockaddr, io_listen, io_listen_list): Deleted old listen interface.
	(io_read_write, io_read, io_write): Deleted old constructors.
	(class write_only_file)): Deleted class.
	(io_write_file): Deleted function.
	(close_fd, close_fd_nicely, close_fd_read, close_fd_write):
	Deleted old close interface.
	(class exc_finish_read_handler)): Deleted class.
	(finish_read_exception, finish_io_exception): Deleted exceptions.
	(make_io_exception): Deleted function.
	* src/io.h (connect_list_state): Deleted class.

	* src/Makefile.am (liblsh_a_SOURCES): Removed string_buffer.c.

	* src/io.c: Don't include string_buffer.h.
	(io_read_file_raw): Use lsh_string_realloc, not the
	string_buffer abstraction.

	* src/lsh_string.c (lsh_string_realloc): New function.

	* src/string_buffer.c, src/string_buffer.h: Deleted files.

Niels Möller's avatar
Niels Möller committed
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2005-10-09  Niels Mller  <niels@s3.kth.se>

	* src/gateway_commands.c: Don't include connection_commands.h.
	* src/lsh.c: Likewise.
	* src/socks.c: Likewise.

	* src/connection_commands.c, src/connection_commands.h: Deleted
	files.

	* src/tcpforward_commands.c: Deleted file.

	* src/tcpforward.h: Deleted old declarations.
	(forward_remote_port): New declaration.

	* src/tcpforward.c: Deleted old tcpforwarding code.

	* src/server_tcpforward.c (do_tcpip_forward_request_continuation):
	Fixed assert.

	* src/server_session.c: Don't include channel_commands.h.
	(format_exit_signal, format_exit): Deleted functions.
	(do_exit_shell): Use channel_send_request.

	* src/lsh.c: Enabled remote port forwarding.
	(main): Add handler for CHANNEL_OPEN "forwarded-tcpip".

	* src/client_pty.c: Don't include channel_commands.h.
	* src/gateway_channel.c: Likewise.
	* src/server_x11.c: Likewise.
	* src/tcpforward.c: Likewise.

	* src/client_tcpforward.c (forward_remote_port): Reimplemented.

	* src/client_session.c: Include channel.h, not channel_commands.h.

	* src/client.h: Don't include channel_commands.h.
	(request_service): Deleted class.

	* src/client.c (request_shell): Use channel_send_request.
	(session_channel_request): New class, replacing exec_request and
	subsystem_request. 
	(do_session_channel_request, make_session_channel_request): New
	functions, using channel_send_request. 
	(make_exec_request, make_subsystem_request): Use
	make_session_channel_request. 
	(client_parse_forward_arg): Use client_arg_unsigned.

	* src/channel_commands.c: Deleted file.
	* src/channel_commands.h: Deleted file.

	* src/channel.c (channel_send_request)
	(channel_send_global_request): New functions. 
	(format_channel_request, format_global_request): Deleted
	functions.

	* src/Makefile.am (liblsh_a_SOURCES): Removed channel_commands.c.

Niels Möller's avatar
Niels Möller committed
2917
2918
2005-10-07  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
	* src/tcpforward.h (remote_port): Removed class. Replaced by new
	version in client_tcpforward.c.

	* src/server_tcpforward.c (do_channel_open_direct_tcpip): Fixed
	messages.

	* src/server.h (make_offer_service): Deleted prototype.

	* src/exception.h: Deleted old definition of exception type
	constants.

	* src/client_tcpforward.c (make_remote_port): New function.
	(do_channel_open_forwarded_tcpip): New function.
	(class remote_port): New class. Both replace older versions in
	tcpforward.c

	* src/channel_commands.h (class channel_open_command): Deleted class.
	* src/channel_commands.c (do_channel_open_command): Deleted function.

Niels Möller's avatar
Niels Möller committed
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
	* src/testsuite/functions.sh (need_lshg): New function.
	* src/testsuite/lshg-1-test: Skip test if lshg isn't built.
	* src/testsuite/lshg-cat-2-test: Likewise.
	* src/testsuite/lshg-cat-test: Likewise.
	* src/testsuite/lshg-tcpip-local-test: Likewise.

	* src/client.c (client_parse_forward_arg): Use io_lookup_address.
	(client_argp_parser): Use forward_local_port (renamed).

	* src/tcpforward.c (class tcpforward_connect_state): New class.
	(tcpforward_connect_done, tcpforward_connect_error) 
	(tcpforward_connect): New functions, using the new io_connect
	interface.

	* src/tcpforward.h (TCPIP_WINDOW_SIZE): Moved constant definition
	here.

	* src/client_tcpforward.c (open_direct_tcpip_command): Call
	io_register_fd. Added trace message.
	(expr forward_local_port): Reverted earlier renaming, was called
	tcpforward_direct_tcpip.

	* src/server_tcpforward.c (open_forwarded_tcpip_command): Call
	io_register_fd.
	(do_channel_open_direct_tcpip): New function, replacing the old
	one in tcpforward.c. Uses tcpforward_connect.

	* src/server_session.c (do_server_session_event): Ignore
	CHANNEL_EVENT_CONFIRM.

	* src/lshd-connection.c (make_connection): Enabled direct-tcpip.

	* src/io.c (kill_io_connect_state, init_io_connect_state) 
	(oop_io_connect): New functions.
	(io_connect): New different interface, using class
	io_connect_state.
	(get_portno): Changed return type to unsigned.
	(io_make_sockaddr): Bug fixes. Now it seems to actually work.
	(io_lookup_address): New function.

	* src/io.h (class io_connect_state): New class.

	* src/channel_forward.c (init_channel_forward): Don't call
	io_register_fd; it's now the responsibility of the caller.

	* src/channel.c (do_channel_open_continue): Generate a
	CHANNEL_EVENT_CONFIRM.

2005-10-06  Niels Mller  <nisse@lysator.liu.se>

	* src/io_commands.c (listen_tcp_command): Use io_make_sockaddr.

	* src/io.c (io_make_sockaddr): New function.

	* src/transport_write.c: Include werror.h, needed for trace.

	* src/lshd.c (class lshd_configuration): Renamed, was
	configuration. Merged attributes from class lshd_options.
	(class lshd_options): Deleted class.
	(main_argp_children): Use algorithms_argp as a child parser.
	(main_argp_parser): When handling ARGP_KEY_END, read host key, and
	set up kexinit according to the algorithm options.

2005-09-22  Niels Mller  <nisse@lysator.liu.se>

	* src/Makefile.am (liblsh_a_SOURCES): Added client_tcpforward.c
	and server_tcpforward.c. Removed tcpforward_commands.c.

	* src/tcpforward_commands.c: Code related to direct-tcpip moved to
	client_tcpforward.c.

	* src/tcpforward.c: Code related to tcpip-forward moved to
	server_tcpforward.c.
	(tcpforward_lookup): Renamed, was lookup_forward, and made
	non-static.
	(tcpforward_remove_port): New function.

	* src/server_tcpforward.c: New file. Moved handling of remote port
	forwarding here, including open_forwarded_tcpip_command and
	tcpip_forward_handler. 

	* src/lshd-connection.c (make_connection): Enable global request
	handlers for tcpip-forward and cancel-tcpip-forward.

	* src/connection.c (init_ssh_connection): Initialize
	connection->forwarded_ports. 

	* src/connection.h (class ssh_connection): Replaced remote_ports
	and local_ports with a single queue forwarded_ports..

	* src/client.c (client_argp_parser): Use tcpforward_direct_tcpip,
	not forward_local_port.

	* src/client_tcpforward.c: New file. Moved
	open_direct_tcpip_command and tcpforward_direct_tcpip. The latter
	used to be called forward_local_port.

Niels Möller's avatar
Niels Möller committed
3035
3036
2005-09-21  Niels Mller  <nisse@lysator.liu.se>

Niels Möller's avatar
Niels Möller committed
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
	* src/command.h (class command_2): Changed invoke to be a plain
	function pointer, not a method.
	(COMMAND_2_INVOKE): Deleted macro.
	(DEFINE_COMMAND2): Deleted unused first argument. Updated all
	users.

	* src/command.c (do_command_2_invoke): Don't pass self when using
	the invoke function pointer.

	* src/unix_process.c (class utmp_cleanup): Commented out class.

	* src/reaper.c (reaper_handle): Added trace message.

	* src/lsh_proxy.c: Deleted file. Also deleted all other proxy*.c
	and proxy*.h files.

Niels Möller's avatar
Niels Möller committed
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121