-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
Bugfix: removed the () from the tokenized representation
of RFC 822 comments, so that comments with \( or \) can be
unparsed correctly. Problem reported by Bodo Moeller.
+
+20000423
+
+ Bugfix: mail_copy() could prepend > or . in the middle of
+ long lines. Found by code inspection.
+
+20000427
+
+ New code: unescape module that translates C escape sequences
+ into their equivalent character values. File: util/unescape.c.
+
+ Feature: the pipe mailer now has a way to specify the output
+ record delimiter (for example, eol=\r\n). This is necessary
+ for transports that require CRLF instead of UNIX-style LF.
+
+20000428
+
+ New code: added support to the vstring module for fixed-size
+ buffers. This may help to avoid clumsy code that would have
+ to prevent memory leaks. The buffers cause a fatal error
+ when they turn out too small. File: util/vstring.[hc].
+
+20000502
+
+ In order to support timeouts with SSL more conveniently,
+ VSTREAMs now have built into them the concept of timeout.
+ Instead of calling read() and write(), the low-level VSTREAM
+ interface now uses timed_read() and timed_write() which
+ have an additional timeout parameter; vstream_ctl(stream,
+ VSTREAM_CTL_TIMEOUT) sets the timeout deadline on a stream,
+ and vstream_ftimeout(stream) queries a stream for timeout
+ errors. This change simplified timeout handling considerably.
+ Files: util/vbuf.h, util/vstrean.[hc], global/smtp_stream.c,
+ global/timed_ipc.c.
+
+20000504
+
+ In order to support application-specific state, VSTREAMs
+ now provide an optional open attribute list. An example is
+ the per-stream jump buffer that was needed in order to
+ clean up the smtp_stream module. Files: util/vstream.[hc],
+ util/binattr.[hc].
+
+ Cleaned up the smtp_stream module further and got rid of
+ the global state that limited the use of this module to
+ one stream per process. Files: global/smtp_stream.[hc].
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
while ((ch = *UCHAR(cp++)) != 0) {
switch (ch) {
case '\\':
- oval = 0;
for (oval = 0, i = 0; i < 3 && (ch = *UCHAR(cp)) != 0; i++) {
if (!ISDIGIT(ch) || ch == '8' || ch == '9')
break;
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
bounce.o: ../include/vstring.h
bounce.o: ../include/vbuf.h
bounce.o: ../include/vstream.h
+bounce.o: ../include/binattr.h
bounce.o: ../include/stringops.h
bounce.o: ../include/mail_proto.h
bounce.o: ../include/iostuff.h
bounce_append_service.o: ../include/vstring.h
bounce_append_service.o: ../include/vbuf.h
bounce_append_service.o: ../include/vstream.h
+bounce_append_service.o: ../include/binattr.h
bounce_append_service.o: ../include/stringops.h
bounce_append_service.o: ../include/mail_queue.h
bounce_append_service.o: ../include/quote_822_local.h
bounce_cleanup.o: ../include/vbuf.h
bounce_cleanup.o: ../include/mail_queue.h
bounce_cleanup.o: ../include/vstream.h
+bounce_cleanup.o: ../include/binattr.h
bounce_cleanup.o: bounce_service.h
bounce_notify_service.o: bounce_notify_service.c
bounce_notify_service.o: ../include/sys_defs.h
bounce_notify_service.o: ../include/vstring.h
bounce_notify_service.o: ../include/vbuf.h
bounce_notify_service.o: ../include/vstream.h
+bounce_notify_service.o: ../include/binattr.h
bounce_notify_service.o: ../include/vstring_vstream.h
bounce_notify_service.o: ../include/mymalloc.h
bounce_notify_service.o: ../include/stringops.h
bounce_recip_service.o: ../include/vstring.h
bounce_recip_service.o: ../include/vbuf.h
bounce_recip_service.o: ../include/vstream.h
+bounce_recip_service.o: ../include/binattr.h
bounce_recip_service.o: ../include/vstring_vstream.h
bounce_recip_service.o: ../include/mymalloc.h
bounce_recip_service.o: ../include/stringops.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
cleanup.o: ../include/vbuf.h
cleanup.o: ../include/dict.h
cleanup.o: ../include/vstream.h
+cleanup.o: ../include/binattr.h
cleanup.o: ../include/argv.h
cleanup.o: ../include/mail_conf.h
cleanup.o: ../include/cleanup_user.h
cleanup_api.o: ../include/cleanup_user.h
cleanup_api.o: ../include/mail_queue.h
cleanup_api.o: ../include/vstream.h
+cleanup_api.o: ../include/binattr.h
cleanup_api.o: ../include/mail_proto.h
cleanup_api.o: ../include/iostuff.h
cleanup_api.o: ../include/bounce.h
cleanup_envelope.o: ../include/vstring.h
cleanup_envelope.o: ../include/vbuf.h
cleanup_envelope.o: ../include/vstream.h
+cleanup_envelope.o: ../include/binattr.h
cleanup_envelope.o: ../include/mymalloc.h
cleanup_envelope.o: ../include/record.h
cleanup_envelope.o: ../include/rec_type.h
cleanup_extracted.o: ../include/vstring.h
cleanup_extracted.o: ../include/vbuf.h
cleanup_extracted.o: ../include/vstream.h
+cleanup_extracted.o: ../include/binattr.h
cleanup_extracted.o: ../include/argv.h
cleanup_extracted.o: ../include/mymalloc.h
cleanup_extracted.o: ../include/cleanup_user.h
cleanup_init.o: ../include/vstring.h
cleanup_init.o: ../include/vbuf.h
cleanup_init.o: ../include/vstream.h
+cleanup_init.o: ../include/binattr.h
cleanup_init.o: ../include/argv.h
cleanup_init.o: ../include/maps.h
cleanup_init.o: ../include/dict.h
cleanup_map11.o: ../include/vbuf.h
cleanup_map11.o: ../include/dict.h
cleanup_map11.o: ../include/vstream.h
+cleanup_map11.o: ../include/binattr.h
cleanup_map11.o: ../include/argv.h
cleanup_map11.o: ../include/mymalloc.h
cleanup_map11.o: ../include/cleanup_user.h
cleanup_map1n.o: ../include/vbuf.h
cleanup_map1n.o: ../include/dict.h
cleanup_map1n.o: ../include/vstream.h
+cleanup_map1n.o: ../include/binattr.h
cleanup_map1n.o: ../include/mail_addr_map.h
cleanup_map1n.o: ../include/maps.h
cleanup_map1n.o: ../include/cleanup_user.h
cleanup_masquerade.o: ../include/quote_822_local.h
cleanup_masquerade.o: cleanup.h
cleanup_masquerade.o: ../include/vstream.h
+cleanup_masquerade.o: ../include/binattr.h
cleanup_masquerade.o: ../include/maps.h
cleanup_masquerade.o: ../include/dict.h
cleanup_masquerade.o: ../include/been_here.h
cleanup_message.o: ../include/vstring.h
cleanup_message.o: ../include/vbuf.h
cleanup_message.o: ../include/vstream.h
+cleanup_message.o: ../include/binattr.h
cleanup_message.o: ../include/argv.h
cleanup_message.o: ../include/split_at.h
cleanup_message.o: ../include/mymalloc.h
cleanup_out.o: ../include/vstring.h
cleanup_out.o: ../include/vbuf.h
cleanup_out.o: ../include/vstream.h
+cleanup_out.o: ../include/binattr.h
cleanup_out.o: ../include/record.h
cleanup_out.o: ../include/rec_type.h
cleanup_out.o: ../include/cleanup_user.h
cleanup_out_recipient.o: ../include/vstring.h
cleanup_out_recipient.o: ../include/vbuf.h
cleanup_out_recipient.o: ../include/vstream.h
+cleanup_out_recipient.o: ../include/binattr.h
cleanup_out_recipient.o: ../include/maps.h
cleanup_out_recipient.o: ../include/dict.h
cleanup_out_recipient.o: ../include/tok822.h
cleanup_rewrite.o: ../include/quote_822_local.h
cleanup_rewrite.o: cleanup.h
cleanup_rewrite.o: ../include/vstream.h
+cleanup_rewrite.o: ../include/binattr.h
cleanup_rewrite.o: ../include/argv.h
cleanup_rewrite.o: ../include/maps.h
cleanup_rewrite.o: ../include/dict.h
cleanup_state.o: ../include/mail_params.h
cleanup_state.o: cleanup.h
cleanup_state.o: ../include/vstream.h
+cleanup_state.o: ../include/binattr.h
cleanup_state.o: ../include/maps.h
cleanup_state.o: ../include/dict.h
cleanup_state.o: ../include/tok822.h
/*
* Add a missing destination header.
*/
-#define VISIBLE_RCPT (HDR_TO | HDR_RESENT_TO | HDR_CC | HDR_RESENT_CC)
+#define VISIBLE_RCPT ((1 << HDR_TO) | (1 << HDR_RESENT_TO) \
+ | (1 << HDR_CC) | (1 << HDR_RESENT_CC))
if ((state->headers_seen & VISIBLE_RCPT) == 0)
cleanup_out_format(state, REC_TYPE_NORM, "%s", var_rcpt_witheld);
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
test_dns_lookup.o: ../include/msg.h
test_dns_lookup.o: ../include/msg_vstream.h
test_dns_lookup.o: ../include/vstream.h
+test_dns_lookup.o: ../include/binattr.h
test_dns_lookup.o: dns.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
error.o: ../include/msg.h
error.o: ../include/vstream.h
error.o: ../include/vbuf.h
+error.o: ../include/binattr.h
error.o: ../include/deliver_request.h
error.o: ../include/vstring.h
error.o: ../include/recipient_list.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
bounce.o: mail_params.h
bounce.o: mail_proto.h
bounce.o: ../include/vstream.h
+bounce.o: ../include/binattr.h
bounce.o: ../include/iostuff.h
bounce.o: defer.h
bounce.o: bounce.h
clnt_stream.o: ../include/mymalloc.h
clnt_stream.o: ../include/vstream.h
clnt_stream.o: ../include/vbuf.h
+clnt_stream.o: ../include/binattr.h
clnt_stream.o: ../include/events.h
clnt_stream.o: ../include/iostuff.h
clnt_stream.o: mail_proto.h
defer.o: ../include/vbuf.h
defer.o: mail_queue.h
defer.o: ../include/vstream.h
+defer.o: ../include/binattr.h
defer.o: mail_proto.h
defer.o: ../include/iostuff.h
defer.o: bounce.h
deliver_completed.o: ../include/msg.h
deliver_completed.o: ../include/vstream.h
deliver_completed.o: ../include/vbuf.h
+deliver_completed.o: ../include/binattr.h
deliver_completed.o: record.h
deliver_completed.o: ../include/vstring.h
deliver_completed.o: rec_type.h
deliver_pass.o: ../include/vstring.h
deliver_pass.o: ../include/vbuf.h
deliver_pass.o: ../include/vstream.h
+deliver_pass.o: ../include/binattr.h
deliver_pass.o: deliver_pass.h
deliver_pass.o: deliver_request.h
deliver_pass.o: recipient_list.h
deliver_request.o: ../include/msg.h
deliver_request.o: ../include/vstream.h
deliver_request.o: ../include/vbuf.h
+deliver_request.o: ../include/binattr.h
deliver_request.o: ../include/vstring.h
deliver_request.o: ../include/mymalloc.h
deliver_request.o: ../include/iostuff.h
mail_addr.o: mail_addr.c
mail_addr.o: ../include/sys_defs.h
mail_addr.o: ../include/stringops.h
+mail_addr.o: ../include/vstring.h
+mail_addr.o: ../include/vbuf.h
mail_addr.o: mail_params.h
mail_addr.o: mail_addr.h
mail_addr_crunch.o: mail_addr_crunch.c
mail_addr_find.o: ../include/dict.h
mail_addr_find.o: ../include/vstream.h
mail_addr_find.o: ../include/vbuf.h
+mail_addr_find.o: ../include/binattr.h
mail_addr_find.o: ../include/argv.h
mail_addr_find.o: ../include/stringops.h
-mail_addr_find.o: ../include/mymalloc.h
mail_addr_find.o: ../include/vstring.h
+mail_addr_find.o: ../include/mymalloc.h
mail_addr_find.o: mail_params.h
mail_addr_find.o: split_addr.h
mail_addr_find.o: mail_addr_find.h
mail_addr_map.o: ../include/vbuf.h
mail_addr_map.o: ../include/dict.h
mail_addr_map.o: ../include/vstream.h
+mail_addr_map.o: ../include/binattr.h
mail_addr_map.o: ../include/argv.h
mail_addr_map.o: ../include/mymalloc.h
mail_addr_map.o: mail_addr_find.h
mail_command_read.o: ../include/vstring.h
mail_command_read.o: ../include/vbuf.h
mail_command_read.o: ../include/vstream.h
+mail_command_read.o: ../include/binattr.h
mail_command_read.o: mail_proto.h
mail_command_read.o: ../include/iostuff.h
mail_command_write.o: mail_command_write.c
mail_command_write.o: ../include/sys_defs.h
mail_command_write.o: ../include/vstream.h
mail_command_write.o: ../include/vbuf.h
+mail_command_write.o: ../include/binattr.h
mail_command_write.o: mail_proto.h
mail_command_write.o: ../include/iostuff.h
mail_conf.o: mail_conf.c
mail_conf.o: ../include/mymalloc.h
mail_conf.o: ../include/vstream.h
mail_conf.o: ../include/vbuf.h
+mail_conf.o: ../include/binattr.h
mail_conf.o: ../include/vstring.h
mail_conf.o: ../include/dict.h
mail_conf.o: ../include/argv.h
mail_conf_bool.o: ../include/dict.h
mail_conf_bool.o: ../include/vstream.h
mail_conf_bool.o: ../include/vbuf.h
+mail_conf_bool.o: ../include/binattr.h
mail_conf_bool.o: ../include/argv.h
mail_conf_bool.o: mail_conf.h
mail_conf_int.o: mail_conf_int.c
mail_conf_int.o: ../include/dict.h
mail_conf_int.o: ../include/vstream.h
mail_conf_int.o: ../include/vbuf.h
+mail_conf_int.o: ../include/binattr.h
mail_conf_int.o: ../include/argv.h
mail_conf_int.o: ../include/stringops.h
+mail_conf_int.o: ../include/vstring.h
mail_conf_int.o: mail_conf.h
mail_conf_raw.o: mail_conf_raw.c
mail_conf_raw.o: ../include/sys_defs.h
mail_connect.o: ../include/msg.h
mail_connect.o: ../include/vstream.h
mail_connect.o: ../include/vbuf.h
+mail_connect.o: ../include/binattr.h
mail_connect.o: ../include/connect.h
mail_connect.o: ../include/iostuff.h
mail_connect.o: ../include/mymalloc.h
mail_copy.o: ../include/htable.h
mail_copy.o: ../include/vstream.h
mail_copy.o: ../include/vbuf.h
+mail_copy.o: ../include/binattr.h
mail_copy.o: ../include/vstring.h
mail_copy.o: ../include/vstring_vstream.h
mail_copy.o: ../include/stringops.h
mail_flush.o: mail_proto.h
mail_flush.o: ../include/vstream.h
mail_flush.o: ../include/vbuf.h
+mail_flush.o: ../include/binattr.h
mail_flush.o: ../include/iostuff.h
mail_flush.o: mail_flush.h
mail_open_ok.o: mail_open_ok.c
mail_open_ok.o: ../include/vstring.h
mail_open_ok.o: ../include/vbuf.h
mail_open_ok.o: ../include/vstream.h
+mail_open_ok.o: ../include/binattr.h
mail_open_ok.o: mail_open_ok.h
mail_params.o: mail_params.c
mail_params.o: ../include/sys_defs.h
mail_params.o: ../include/get_hostname.h
mail_params.o: ../include/valid_hostname.h
mail_params.o: ../include/stringops.h
+mail_params.o: ../include/vstring.h
+mail_params.o: ../include/vbuf.h
mail_params.o: mynetworks.h
mail_params.o: mail_conf.h
mail_params.o: mail_version.h
mail_pathname.o: mail_pathname.c
mail_pathname.o: ../include/sys_defs.h
mail_pathname.o: ../include/stringops.h
+mail_pathname.o: ../include/vstring.h
+mail_pathname.o: ../include/vbuf.h
mail_pathname.o: mail_proto.h
mail_pathname.o: ../include/vstream.h
-mail_pathname.o: ../include/vbuf.h
+mail_pathname.o: ../include/binattr.h
mail_pathname.o: ../include/iostuff.h
mail_print.o: mail_print.c
mail_print.o: ../include/sys_defs.h
mail_print.o: ../include/mymalloc.h
mail_print.o: ../include/vstream.h
mail_print.o: ../include/vbuf.h
+mail_print.o: ../include/binattr.h
mail_print.o: mail_proto.h
mail_print.o: ../include/iostuff.h
mail_queue.o: mail_queue.c
mail_queue.o: ../include/vstring.h
mail_queue.o: ../include/vbuf.h
mail_queue.o: ../include/vstream.h
+mail_queue.o: ../include/binattr.h
mail_queue.o: ../include/mymalloc.h
mail_queue.o: ../include/argv.h
mail_queue.o: ../include/dir_forest.h
mail_run.o: ../include/sys_defs.h
mail_run.o: ../include/msg.h
mail_run.o: ../include/stringops.h
+mail_run.o: ../include/vstring.h
+mail_run.o: ../include/vbuf.h
mail_run.o: ../include/mymalloc.h
mail_run.o: mail_params.h
mail_run.o: mail_run.h
mail_scan.o: ../include/vstring.h
mail_scan.o: ../include/vbuf.h
mail_scan.o: ../include/vstream.h
+mail_scan.o: ../include/binattr.h
mail_scan.o: ../include/vstring_vstream.h
mail_scan.o: ../include/mymalloc.h
mail_scan.o: mail_proto.h
mail_stream.o: ../include/vstring.h
mail_stream.o: ../include/vbuf.h
mail_stream.o: ../include/vstream.h
+mail_stream.o: ../include/binattr.h
mail_stream.o: ../include/stringops.h
mail_stream.o: cleanup_user.h
mail_stream.o: mail_proto.h
mail_trigger.o: mail_proto.h
mail_trigger.o: ../include/vstream.h
mail_trigger.o: ../include/vbuf.h
+mail_trigger.o: ../include/binattr.h
mail_version.o: mail_version.c
maps.o: maps.c
maps.o: ../include/sys_defs.h
maps.o: ../include/dict.h
maps.o: ../include/vstream.h
maps.o: ../include/vbuf.h
+maps.o: ../include/binattr.h
maps.o: ../include/stringops.h
+maps.o: ../include/vstring.h
maps.o: ../include/split_at.h
maps.o: mail_conf.h
maps.o: maps.h
mark_corrupt.o: ../include/msg.h
mark_corrupt.o: ../include/vstream.h
mark_corrupt.o: ../include/vbuf.h
+mark_corrupt.o: ../include/binattr.h
mark_corrupt.o: mail_queue.h
mark_corrupt.o: ../include/vstring.h
mark_corrupt.o: mark_corrupt.h
mkmap_db.o: ../include/msg.h
mkmap_db.o: ../include/mymalloc.h
mkmap_db.o: ../include/stringops.h
+mkmap_db.o: ../include/vstring.h
+mkmap_db.o: ../include/vbuf.h
mkmap_db.o: ../include/dict.h
mkmap_db.o: ../include/vstream.h
-mkmap_db.o: ../include/vbuf.h
+mkmap_db.o: ../include/binattr.h
mkmap_db.o: ../include/argv.h
mkmap_db.o: ../include/dict_db.h
mkmap_db.o: mkmap.h
mkmap_dbm.o: ../include/msg.h
mkmap_dbm.o: ../include/mymalloc.h
mkmap_dbm.o: ../include/stringops.h
+mkmap_dbm.o: ../include/vstring.h
+mkmap_dbm.o: ../include/vbuf.h
mkmap_dbm.o: ../include/dict.h
mkmap_dbm.o: ../include/vstream.h
-mkmap_dbm.o: ../include/vbuf.h
+mkmap_dbm.o: ../include/binattr.h
mkmap_dbm.o: ../include/argv.h
mkmap_dbm.o: ../include/dict_dbm.h
mkmap_dbm.o: mkmap.h
mkmap_open.o: ../include/dict.h
mkmap_open.o: ../include/vstream.h
mkmap_open.o: ../include/vbuf.h
+mkmap_open.o: ../include/binattr.h
mkmap_open.o: ../include/argv.h
mkmap_open.o: ../include/sigdelay.h
mkmap_open.o: ../include/mymalloc.h
own_inet_addr.o: ../include/inet_addr_local.h
own_inet_addr.o: ../include/inet_addr_host.h
own_inet_addr.o: ../include/stringops.h
+own_inet_addr.o: ../include/vstring.h
+own_inet_addr.o: ../include/vbuf.h
own_inet_addr.o: mail_params.h
own_inet_addr.o: own_inet_addr.h
peer_name.o: peer_name.c
pipe_command.o: ../include/msg.h
pipe_command.o: ../include/vstream.h
pipe_command.o: ../include/vbuf.h
+pipe_command.o: ../include/binattr.h
pipe_command.o: ../include/vstring.h
pipe_command.o: ../include/stringops.h
pipe_command.o: ../include/iostuff.h
post_mail.o: ../include/msg.h
post_mail.o: ../include/vstream.h
post_mail.o: ../include/vbuf.h
+post_mail.o: ../include/binattr.h
post_mail.o: ../include/vstring.h
post_mail.o: mail_params.h
post_mail.o: record.h
rec2stream.o: ../include/vstring.h
rec2stream.o: ../include/vbuf.h
rec2stream.o: ../include/vstream.h
+rec2stream.o: ../include/binattr.h
rec2stream.o: record.h
rec2stream.o: rec_streamlf.h
rec2stream.o: rec_type.h
rec_streamlf.o: ../include/vstring.h
rec_streamlf.o: ../include/vbuf.h
rec_streamlf.o: ../include/vstream.h
+rec_streamlf.o: ../include/binattr.h
rec_streamlf.o: record.h
rec_streamlf.o: rec_type.h
rec_streamlf.o: rec_streamlf.h
recdump.o: ../include/msg_vstream.h
recdump.o: ../include/vstream.h
recdump.o: ../include/vbuf.h
+recdump.o: ../include/binattr.h
recdump.o: record.h
recdump.o: ../include/vstring.h
recdump.o: rec_streamlf.h
record.o: ../include/mymalloc.h
record.o: ../include/vstream.h
record.o: ../include/vbuf.h
+record.o: ../include/binattr.h
record.o: ../include/vstring.h
record.o: record.h
remove.o: remove.c
resolve_clnt.o: ../include/msg.h
resolve_clnt.o: ../include/vstream.h
resolve_clnt.o: ../include/vbuf.h
+resolve_clnt.o: ../include/binattr.h
resolve_clnt.o: ../include/vstring.h
resolve_clnt.o: ../include/vstring_vstream.h
resolve_clnt.o: ../include/events.h
rewrite_clnt.o: ../include/vstring.h
rewrite_clnt.o: ../include/vbuf.h
rewrite_clnt.o: ../include/vstream.h
+rewrite_clnt.o: ../include/binattr.h
rewrite_clnt.o: ../include/vstring_vstream.h
rewrite_clnt.o: ../include/events.h
rewrite_clnt.o: ../include/iostuff.h
smtp_stream.o: ../include/vstring.h
smtp_stream.o: ../include/vbuf.h
smtp_stream.o: ../include/vstream.h
+smtp_stream.o: ../include/binattr.h
smtp_stream.o: ../include/vstring_vstream.h
smtp_stream.o: ../include/msg.h
smtp_stream.o: ../include/iostuff.h
stream2rec.o: ../include/sys_defs.h
stream2rec.o: ../include/vstream.h
stream2rec.o: ../include/vbuf.h
+stream2rec.o: ../include/binattr.h
stream2rec.o: ../include/vstring.h
stream2rec.o: record.h
stream2rec.o: rec_streamlf.h
timed_ipc.o: ../include/msg.h
timed_ipc.o: ../include/vstream.h
timed_ipc.o: ../include/vbuf.h
-timed_ipc.o: ../include/iostuff.h
+timed_ipc.o: ../include/binattr.h
timed_ipc.o: mail_params.h
timed_ipc.o: timed_ipc.h
tok822_find.o: tok822_find.c
/* SYNOPSIS
/* #include <mail_copy.h>
/*
-/* int mail_copy(sender, delivered, src, dst, flags, why)
+/* int mail_copy(sender, delivered, src, dst, flags, eol, why)
/* const char *sender;
/* const char *delivered;
/* VSTREAM *src;
/* VSTREAM *dst;
/* int flags;
+/* const char *eol;
/* VSTRING *why;
/* DESCRIPTION
/* mail_copy() copies a mail message from record stream to stream-lf
/* The manifest constant MAIL_COPY_MBOX is a convenient shorthand for
/* all MAIL_COPY_XXX options that are appropriate for mailbox delivery.
/* Use MAIL_COPY_NONE to copy a message without any options enabled.
+/* .IP eol
+/* Record delimiter, for example, LF or CF LF.
/* .IP why
/* A null pointer, or storage for the reason of failure.
/* DIAGNOSTICS
int mail_copy(const char *sender, const char *delivered,
VSTREAM *src, VSTREAM *dst,
- int flags, VSTRING *why)
+ int flags, const char *eol, VSTRING *why)
{
char *myname = "mail_copy";
VSTRING *buf;
asctime(localtime(&now)));
}
if (flags & MAIL_COPY_RETURN_PATH) {
- vstream_fprintf(dst, "Return-Path: <%s>\n",
- *sender ? vstring_str(buf) : "");
+ vstream_fprintf(dst, "Return-Path: <%s>%s",
+ *sender ? vstring_str(buf) : "", eol);
}
}
if (flags & MAIL_COPY_DELIVERED) {
if (delivered == 0)
msg_panic("%s: null delivered", myname);
quote_822_local(buf, delivered);
- vstream_fprintf(dst, "Delivered-To: %s\n", lowercase(vstring_str(buf)));
+ vstream_fprintf(dst, "Delivered-To: %s%s",
+ lowercase(vstring_str(buf)), eol);
}
/*
if (type != REC_TYPE_NORM && type != REC_TYPE_CONT)
break;
bp = vstring_str(buf);
- if ((flags & MAIL_COPY_QUOTE) && *bp == 'F' && !strncmp(bp, "From ", 5))
- VSTREAM_PUTC('>', dst);
- if ((flags & MAIL_COPY_DOT) && *bp == '.')
- VSTREAM_PUTC('.', dst);
+ if (prev_type == REC_TYPE_NORM) {
+ if ((flags & MAIL_COPY_QUOTE) && *bp == 'F' && !strncmp(bp, "From ", 5))
+ VSTREAM_PUTC('>', dst);
+ if ((flags & MAIL_COPY_DOT) && *bp == '.')
+ VSTREAM_PUTC('.', dst);
+ }
if (VSTRING_LEN(buf) && VSTREAM_FWRITE_BUF(dst, buf) != VSTRING_LEN(buf))
break;
- if (type == REC_TYPE_NORM && VSTREAM_PUTC('\n', dst) == VSTREAM_EOF)
+ if (type == REC_TYPE_NORM && vstream_fputs(eol, dst) == VSTREAM_EOF)
break;
prev_type = type;
}
if (type != REC_TYPE_XTRA)
corrupt_error = mark_corrupt(src);
if (prev_type != REC_TYPE_NORM)
- VSTREAM_PUTC('\n', dst);
+ vstream_fputs(eol, dst);
if (flags & MAIL_COPY_FROM)
- VSTREAM_PUTC('\n', dst);
+ vstream_fputs(eol, dst);
}
vstring_free(buf);
* External interface.
*/
extern int mail_copy(const char *, const char *, VSTREAM *, VSTREAM *,
- int, VSTRING *);
+ int, const char *, VSTRING *);
#define MAIL_COPY_QUOTE (1<<0) /* prepend > to From_ */
#define MAIL_COPY_TOFILE (1<<1) /* fsync, ftruncate() */
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "Snapshot-20000422"
+#define DEF_MAIL_VERSION "Snapshot-20000503"
extern char *var_mail_version;
/* LICENSE
#include "mkmap.h"
#ifdef HAS_DBM
+#ifdef PATH_NDBM_H
+#include PATH_NDBM_H
+#else
#include <ndbm.h>
+#endif
/* mkmap_dbm_open - create or open database */
/* .IP "PIPE_CMD_DELIVERED (char *)"
/* The recipient envelope address, which is passed on to the
/* \fImail_copy\fR() routine.
+/* .IP "PIPE_CMD_EOL (char *)"
+/* End-of-line delimiter. The default is to use the newline character.
/* .IP "PIPE_CMD_UID (int)"
/* The user ID to execute the command as. The default is
/* the user ID corresponding to the \fIdefault_privs\fR
int flags; /* see mail_copy.h */
char *sender; /* envelope sender */
char *delivered; /* envelope recipient */
+ char *eol; /* carriagecontrol */
char **argv; /* either an array */
char *command; /* or a plain string */
uid_t uid; /* privileges */
args->flags = 0;
args->sender = 0;
args->delivered = 0;
+ args->eol = "\n";
args->argv = 0;
args->command = 0;
args->uid = var_default_uid;
case PIPE_CMD_DELIVERED:
args->delivered = va_arg(ap, char *);
break;
+ case PIPE_CMD_EOL:
+ args->eol = va_arg(ap, char *);
+ break;
case PIPE_CMD_ARGV:
if (args->command)
msg_panic("%s: got PIPE_CMD_ARGV and PIPE_CMD_COMMAND", myname);
#define DONT_CARE_WHY ((VSTRING *) 0)
write_status = mail_copy(args.sender, args.delivered, src,
- cmd_in_stream, args.flags, DONT_CARE_WHY);
+ cmd_in_stream, args.flags,
+ args.eol, DONT_CARE_WHY);
/*
* Capture a limited amount of command output, for inclusion in a
#define PIPE_CMD_TIME_LIMIT 8 /* time limit */
#define PIPE_CMD_ENV 9 /* extra environment */
#define PIPE_CMD_SHELL 10 /* alternative shell */
+#define PIPE_CMD_EOL 11 /* record delimiter */
/*
* Command completion status.
/* SYNOPSIS
/* #include <smtp_stream.h>
/*
-/* jmp_buf smtp_timeout_buf;
+/* void smtp_jump_setup(stream, jbuf)
+/* VSTREAM *stream;
+/* jmp_buf *jbuf;
/*
/* void smtp_timeout_setup(stream, timeout)
/* VSTREAM *stream;
/* with error detection: timeouts or unexpected end-of-file.
/* A trailing CR LF is added upon writing and removed upon reading.
/*
+/* smtp_jump_setup() registers a caller context that will be
+/* jumped to (with longjmp()) when any routine in this module
+/* experiences an error condition (timeout, I/O error, or
+/* unexpected EOF).
+/*
/* smtp_timeout_setup() arranges for a time limit on the smtp read
/* and write operations described below.
/* This routine alters the behavior of streams as follows:
/* .fi
/* .ad
/* In case of error, a longjmp() is performed to the context
-/* saved in the global \fIsmtp_timeout_buf\fR.
+/* specified with the smtp_jump_setup() call.
/* Error codes passed along with longjmp() are:
/* .IP SMTP_ERR_EOF
-/* The peer has disconnected unexpectedly.
+/* An I/O error happened, or the peer has disconnected unexpectedly.
/* .IP SMTP_ERR_TIME
/* The time limit specified to smtp_timeout_setup() was exceeded.
/* BUGS
-/* The timeout etc. context is static, so this module can handle
-/* only one SMTP session at a time.
+/* The timeout deadline affects all I/O on the named stream, not
+/* just the I/O done on behalf of this module.
/*
-/* The timeout protection, including longjmp(), affects all I/O
-/* on the named stream, not just the I/O done by this module.
+/* The timeout deadline and exception handling context overwrite
+/* any previously set up state on the named stream.
/* LICENSE
/* .ad
/* .fi
#include "smtp_stream.h"
-jmp_buf smtp_timeout_buf;
-
/*
- * Timeout handling. When a timeout happens, we shut down the connection in
- * the appropriate direction, to force the I/O operation to fail.
+ * Our private VSTREAM attribute name for keeping track of the
+ * caller-supplied context for exception handling.
*/
-static int smtp_timeout_done;
-static int smtp_maxtime;
+#define SMTP_ATTR_JBUF "smtp_timeout_buf"
-#define SMTP_DIR_READ 0 /* read direction */
-#define SMTP_DIR_WRITE 1 /* write direction */
+/* smtp_timeout_jump - release timeout trap */
-/* smtp_timeout_event - timeout handler */
-
-static void smtp_timeout_event(int fd, int direction)
+static void smtp_timeout_jump(VSTREAM *stream, int what)
{
+ char *myname = "smtp_timeout_jump";
+ jmp_buf *jbuf;
- /*
- * Yes, this is gross, but we cannot longjump() away. Although timeouts
- * are restricted to read() and write() operations, we could still leave
- * things in an inconsistent state. Instead, we set a flag and force an
- * I/O error on the smtp stream.
- */
- if (shutdown(fd, direction) < 0)
- if (errno != ENOTCONN)
- msg_warn("smtp_timeout_event: shutdown: %m");
- smtp_timeout_done = 1;
-}
-
-/* smtp_read - read with timeout */
-
-static int smtp_read(int fd, void *buf, unsigned len)
-{
- if (read_wait(fd, smtp_maxtime) < 0) {
- smtp_timeout_event(fd, SMTP_DIR_READ);
- return (-1);
- } else {
- return (read(fd, buf, len));
- }
+ if ((jbuf = (jmp_buf *) vstream_attr_get(stream, SMTP_ATTR_JBUF)) == 0)
+ msg_panic("%s: no jump buffer", myname);
+ longjmp(jbuf[0], what);
}
-/* smtp_write - write with timeout */
+/* smtp_jump_setup - configure exception handling context */
-static int smtp_write(int fd, void *buf, unsigned len)
+void smtp_jump_setup(VSTREAM *stream, jmp_buf * jbuf)
{
- if (write_wait(fd, smtp_maxtime) < 0) {
- smtp_timeout_event(fd, SMTP_DIR_WRITE);
- return (-1);
- } else {
- return (write(fd, buf, len));
- }
+ vstream_attr_set(stream, SMTP_ATTR_JBUF,
+ (char *) jbuf, (VSTREAM_ATTR_FREE_FN) 0);
}
-/* smtp_timeout_protect - setup timeout trap for specified stream. */
+/* smtp_timeout_protect - reset per-stream timeout flag */
-static void smtp_timeout_protect(void)
+static void smtp_timeout_protect(VSTREAM *stream)
{
- smtp_timeout_done = 0;
+ vstream_clearerr(stream);
}
-/* smtp_timeout_unprotect - finish timeout trap */
+/* smtp_timeout_detect - test the per-stream timeout flag */
-static void smtp_timeout_unprotect(void)
+static void smtp_timeout_detect(VSTREAM *stream)
{
- if (smtp_timeout_done)
- longjmp(smtp_timeout_buf, SMTP_ERR_TIME);
+ if (vstream_ftimeout(stream))
+ smtp_timeout_jump(stream, SMTP_ERR_TIME);
}
/* smtp_timeout_setup - configure timeout trap */
{
/*
- * XXX The timeout etc. state is static, so a process can have at most
- * one SMTP session at a time. We could use the VSTREAM file descriptor
- * number as key into a BINHASH table with per-stream contexts. This
- * would allow us to talk to multiple SMTP streams at the same time.
- * Another possibility is to use the file descriptor as an index into a
- * linear table of structure pointers. In either case we would need to
- * provide an smtp_timeout_cleanup() routine to dispose of memory that is
- * no longer needed.
+ * Stick your TLS/whatever read-write routines here. Notice that the
+ * read/write interface now includes a timeout parameter, and that a
+ * read/write routine is supposed to set errno to ETIMEDOUT when the
+ * alarm clock goes off.
*/
vstream_control(stream,
- VSTREAM_CTL_READ_FN, smtp_read,
- VSTREAM_CTL_WRITE_FN, smtp_write,
+ VSTREAM_CTL_TIMEOUT, maxtime,
VSTREAM_CTL_DOUBLE,
VSTREAM_CTL_END);
- smtp_maxtime = maxtime;
}
/* smtp_vprintf - write one line to SMTP peer */
/*
* Do the I/O, protected against timeout.
*/
- smtp_timeout_protect();
+ smtp_timeout_protect(stream);
vstream_vfprintf(stream, fmt, ap);
vstream_fputs("\r\n", stream);
err = vstream_fflush(stream);
- smtp_timeout_unprotect();
+ smtp_timeout_detect(stream);
/*
* See if there was a problem.
if (err != 0) {
if (msg_verbose)
msg_info("smtp_vprintf: EOF");
- longjmp(smtp_timeout_buf, SMTP_ERR_EOF);
+ smtp_timeout_jump(stream, SMTP_ERR_EOF);
}
}
* allow for lines ending in bare LF. The idea is to be liberal in what
* we accept, strict in what we send.
*/
- smtp_timeout_protect();
+ smtp_timeout_protect(stream);
last_char = (bound == 0 ? vstring_get(vp, stream) :
vstring_get_bound(vp, stream, bound));
default:
break;
}
- smtp_timeout_unprotect();
+ smtp_timeout_detect(stream);
/*
* EOF is bad, whether or not it happens in the middle of a record. Don't
if (vstream_feof(stream) || vstream_ferror(stream)) {
if (msg_verbose)
msg_info("smtp_get: EOF");
- longjmp(smtp_timeout_buf, SMTP_ERR_EOF);
+ smtp_timeout_jump(stream, SMTP_ERR_EOF);
}
return (last_char);
}
/*
* Do the I/O, protected against timeout.
*/
- smtp_timeout_protect();
+ smtp_timeout_protect(stream);
err = (vstream_fwrite(stream, cp, todo) != todo
|| vstream_fputs("\r\n", stream) == VSTREAM_EOF);
- smtp_timeout_unprotect();
+ smtp_timeout_detect(stream);
/*
* See if there was a problem.
if (err != 0) {
if (msg_verbose)
msg_info("smtp_fputs: EOF");
- longjmp(smtp_timeout_buf, SMTP_ERR_EOF);
+ smtp_timeout_jump(stream, SMTP_ERR_EOF);
}
}
/*
* Do the I/O, protected against timeout.
*/
- smtp_timeout_protect();
+ smtp_timeout_protect(stream);
err = (vstream_fwrite(stream, cp, todo) != todo);
- smtp_timeout_unprotect();
+ smtp_timeout_detect(stream);
/*
* See if there was a problem.
if (err != 0) {
if (msg_verbose)
msg_info("smtp_fwrite: EOF");
- longjmp(smtp_timeout_buf, SMTP_ERR_EOF);
+ smtp_timeout_jump(stream, SMTP_ERR_EOF);
}
}
/*
* Do the I/O, protected against timeout.
*/
- smtp_timeout_protect();
+ smtp_timeout_protect(stream);
stat = VSTREAM_PUTC(ch, stream);
- smtp_timeout_unprotect();
+ smtp_timeout_detect(stream);
/*
* See if there was a problem.
if (stat == VSTREAM_EOF) {
if (msg_verbose)
msg_info("smtp_fputc: EOF");
- longjmp(smtp_timeout_buf, SMTP_ERR_EOF);
+ smtp_timeout_jump(stream, SMTP_ERR_EOF);
}
}
#define SMTP_ERR_EOF 1 /* unexpected client disconnect */
#define SMTP_ERR_TIME 2 /* time out */
-extern jmp_buf smtp_timeout_buf;
-
+extern void smtp_jump_setup(VSTREAM *, jmp_buf *);
extern void smtp_timeout_setup(VSTREAM *, int);
extern void smtp_printf(VSTREAM *, const char *,...);
extern int smtp_get(VSTRING *, VSTREAM *, int);
/* System library. */
#include <sys_defs.h>
-#include <unistd.h>
/* Utility library. */
#include <msg.h>
#include <vstream.h>
-#include <iostuff.h>
/* Global library. */
#include "mail_params.h"
#include "timed_ipc.h"
-/* timed_ipc_read - read with timeout */
-
-static int timed_ipc_read(int fd, void *buf, unsigned len)
-{
- if (read_wait(fd, var_ipc_timeout) < 0)
- msg_fatal("timed_ipc_read: command read timeout");
- return (read(fd, buf, len));
-}
-
-/* timed_ipc_write - read with timeout */
-
-static int timed_ipc_write(int fd, void *buf, unsigned len)
-{
- if (write_wait(fd, var_ipc_timeout) < 0)
- msg_fatal("timed_ipc_write: command write timeout");
- return (write(fd, buf, len));
-}
-
/* timed_ipc_setup - enable ipc with timeout */
void timed_ipc_setup(VSTREAM *stream)
msg_panic("timed_ipc_setup: bad ipc_timeout %d", var_ipc_timeout);
vstream_control(stream,
- VSTREAM_CTL_READ_FN, timed_ipc_read,
- VSTREAM_CTL_WRITE_FN, timed_ipc_write,
+ VSTREAM_CTL_TIMEOUT, var_ipc_timeout,
VSTREAM_CTL_END);
}
<b>hopcount</b><i>_</i><b>limit</b>
Limit the number of <b>Received:</b> message headers.
- <b>recipients</b><i>_</i><b>witheld</b><i>_</i><b>header</b>
+ <b>undisclosed</b><i>_</i><b>recipients</b><i>_</i><b>header</b>
The header line that is inserted when no recipients
were specified in (Resent-)To: or (Resent-)Cc: mes-
sage headers.
PIPE(8) PIPE(8)
+ <b>eol=string</b> (default: <b>\n</b>)
+ The output record delimiter. Typically one would
+ use either <b>\r\n</b> or <b>\n</b>. You can specify the usual C-
+ style backslash escape sequences.
+
<b>argv</b>=<i>command</i>... (required)
The command to be executed. This must be specified
as the last command attribute. The command is exe-
<b>${user</b>} expands into as many command-line
arguments as there are recipients.
- In addition to the form ${<i>name</i>}, the forms $<i>name</i> and
- $(<i>name</i>) are also recognized. Specify <b>$$</b> where a single <b>$</b>
- is wanted.
-
-
2
PIPE(8) PIPE(8)
+ In addition to the form ${<i>name</i>}, the forms $<i>name</i> and
+ $(<i>name</i>) are also recognized. Specify <b>$$</b> where a single <b>$</b>
+ is wanted.
+
<b>DIAGNOSTICS</b>
Command exit status codes are expected to follow the con-
ventions defined in <<b>sysexits.h</b>>.
ter. The limit is enforced by the Postfix queue
manager.
-<b>SEE</b> <b>ALSO</b>
- <a href="bounce.8.html">bounce(8)</a> non-delivery status reports
- <a href="master.8.html">master(8)</a> process manager
- <a href="qmgr.8.html">qmgr(8)</a> queue manager
PIPE(8) PIPE(8)
+<b>SEE</b> <b>ALSO</b>
+ <a href="bounce.8.html">bounce(8)</a> non-delivery status reports
+ <a href="master.8.html">master(8)</a> process manager
+ <a href="qmgr.8.html">qmgr(8)</a> queue manager
syslogd(8) system logging
<b>LICENSE</b>
-
-
-
-
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
alias.o: ../include/dict.h
alias.o: ../include/vstream.h
alias.o: ../include/vbuf.h
+alias.o: ../include/binattr.h
alias.o: ../include/argv.h
alias.o: ../include/stringops.h
-alias.o: ../include/mymalloc.h
alias.o: ../include/vstring.h
+alias.o: ../include/mymalloc.h
alias.o: ../include/mail_params.h
alias.o: ../include/mail_addr.h
alias.o: ../include/sent.h
command.o: ../include/vstring.h
command.o: ../include/vbuf.h
command.o: ../include/vstream.h
+command.o: ../include/binattr.h
command.o: ../include/argv.h
command.o: ../include/defer.h
command.o: ../include/bounce.h
deliver_attr.o: ../include/msg.h
deliver_attr.o: ../include/vstream.h
deliver_attr.o: ../include/vbuf.h
+deliver_attr.o: ../include/binattr.h
deliver_attr.o: local.h
deliver_attr.o: ../include/htable.h
deliver_attr.o: ../include/vstring.h
delivered.o: ../include/vstring.h
delivered.o: ../include/vbuf.h
delivered.o: ../include/vstream.h
+delivered.o: ../include/binattr.h
delivered.o: ../include/vstring_vstream.h
delivered.o: ../include/stringops.h
delivered.o: ../include/record.h
dotforward.o: ../include/vstring.h
dotforward.o: ../include/vbuf.h
dotforward.o: ../include/vstream.h
+dotforward.o: ../include/binattr.h
dotforward.o: ../include/htable.h
dotforward.o: ../include/open_as.h
dotforward.o: ../include/lstat_as.h
file.o: ../include/vstring.h
file.o: ../include/vbuf.h
file.o: ../include/vstream.h
+file.o: ../include/binattr.h
file.o: ../include/deliver_flock.h
file.o: ../include/open_as.h
file.o: ../include/mail_copy.h
forward.o: ../include/vstring.h
forward.o: ../include/vbuf.h
forward.o: ../include/vstream.h
+forward.o: ../include/binattr.h
forward.o: ../include/vstring_vstream.h
forward.o: ../include/iostuff.h
forward.o: ../include/stringops.h
include.o: ../include/mymalloc.h
include.o: ../include/vstream.h
include.o: ../include/vbuf.h
+include.o: ../include/binattr.h
include.o: ../include/open_as.h
include.o: ../include/stat_as.h
include.o: ../include/iostuff.h
indirect.o: local.h
indirect.o: ../include/vstream.h
indirect.o: ../include/vbuf.h
+indirect.o: ../include/binattr.h
indirect.o: ../include/vstring.h
indirect.o: ../include/tok822.h
indirect.o: ../include/resolve_clnt.h
local.o: ../include/vstring.h
local.o: ../include/vbuf.h
local.o: ../include/vstream.h
+local.o: ../include/binattr.h
local.o: ../include/iostuff.h
local.o: ../include/name_mask.h
local.o: ../include/set_eugid.h
local_expand.o: local.h
local_expand.o: ../include/htable.h
local_expand.o: ../include/vstream.h
+local_expand.o: ../include/binattr.h
local_expand.o: ../include/been_here.h
local_expand.o: ../include/tok822.h
local_expand.o: ../include/resolve_clnt.h
mailbox.o: ../include/vstring.h
mailbox.o: ../include/vbuf.h
mailbox.o: ../include/vstream.h
+mailbox.o: ../include/binattr.h
mailbox.o: ../include/mymalloc.h
mailbox.o: ../include/stringops.h
mailbox.o: ../include/set_eugid.h
maildir.o: ../include/msg.h
maildir.o: ../include/mymalloc.h
maildir.o: ../include/stringops.h
-maildir.o: ../include/vstream.h
-maildir.o: ../include/vbuf.h
maildir.o: ../include/vstring.h
+maildir.o: ../include/vbuf.h
+maildir.o: ../include/vstream.h
+maildir.o: ../include/binattr.h
maildir.o: ../include/make_dirs.h
maildir.o: ../include/set_eugid.h
maildir.o: ../include/get_hostname.h
recipient.o: ../include/htable.h
recipient.o: ../include/split_at.h
recipient.o: ../include/stringops.h
+recipient.o: ../include/vstring.h
+recipient.o: ../include/vbuf.h
recipient.o: ../include/dict.h
recipient.o: ../include/vstream.h
-recipient.o: ../include/vbuf.h
+recipient.o: ../include/binattr.h
recipient.o: ../include/argv.h
recipient.o: ../include/bounce.h
recipient.o: ../include/mail_params.h
recipient.o: ../include/split_addr.h
recipient.o: ../include/ext_prop.h
recipient.o: local.h
-recipient.o: ../include/vstring.h
recipient.o: ../include/been_here.h
recipient.o: ../include/tok822.h
recipient.o: ../include/resolve_clnt.h
resolve.o: ../include/htable.h
resolve.o: ../include/mail_proto.h
resolve.o: ../include/vstream.h
+resolve.o: ../include/binattr.h
resolve.o: ../include/iostuff.h
resolve.o: ../include/resolve_clnt.h
resolve.o: ../include/rewrite_clnt.h
token.o: ../include/vstring.h
token.o: ../include/vbuf.h
token.o: ../include/vstream.h
+token.o: ../include/binattr.h
token.o: ../include/htable.h
token.o: ../include/readlline.h
token.o: ../include/mymalloc.h
unknown.o: ../include/sys_defs.h
unknown.o: ../include/msg.h
unknown.o: ../include/stringops.h
-unknown.o: ../include/mymalloc.h
unknown.o: ../include/vstring.h
unknown.o: ../include/vbuf.h
+unknown.o: ../include/mymalloc.h
unknown.o: ../include/been_here.h
unknown.o: ../include/mail_params.h
unknown.o: ../include/mail_proto.h
unknown.o: ../include/vstream.h
+unknown.o: ../include/binattr.h
unknown.o: ../include/iostuff.h
unknown.o: ../include/bounce.h
unknown.o: local.h
path, STR(why));
#endif
} else if (mail_copy(COPY_ATTR(state.msg_attr), dst, S_ISREG(st.st_mode) ?
- copy_flags : (copy_flags & ~MAIL_COPY_TOFILE), why)) {
+ copy_flags : (copy_flags & ~MAIL_COPY_TOFILE), "\n", why)) {
status = defer_append(BOUNCE_FLAG_KEEP, BOUNCE_ATTR(state.msg_attr),
"cannot append destination file %s: %s",
path, STR(why));
if (deliver_flock(vstream_fileno(dst), why) < 0)
vstream_fclose(dst);
else if (mail_copy(COPY_ATTR(state.msg_attr), dst,
- copy_flags, why) == 0) {
+ copy_flags, "\n", why) == 0) {
status = 0;
if (var_biff) {
biff = vstring_alloc(100);
|| (dst = vstream_fopen(tmpfile, O_WRONLY | O_CREAT | O_EXCL, 0600)) == 0)) {
vstring_sprintf(why, "create %s: %m", tmpfile);
} else {
- if (mail_copy(COPY_ATTR(state.msg_attr), dst, copy_flags, why) == 0) {
+ if (mail_copy(COPY_ATTR(state.msg_attr), dst, copy_flags, "\n", why) == 0) {
if (sane_link(tmpfile, newfile) < 0
&& (errno != ENOENT
|| (make_dirs(curdir, 0700), make_dirs(newdir, 0700)) < 0
Address to send a copy of each message that enters the system.
.IP \fBhopcount_limit\fR
Limit the number of \fBReceived:\fR message headers.
-.IP \fBrecipients_witheld_header\fR
+.IP \fBundisclosed_recipients_header\fR
The header line that is inserted when no recipients were
specified in (Resent-)To: or (Resent-)Cc: message headers.
.SH "Address transformations"
mail system owner. If \fIgroupname\fR is specified, the
corresponding group ID is used instead of the group ID of
\fIusername\fR.
+.IP "\fBeol=string\fR (default: \fB\en\fR)"
+The output record delimiter. Typically one would use either
+\fB\er\en\fR or \fB\en\fR. You can specify the usual C-style
+backslash escape sequences.
.IP "\fBargv\fR=\fIcommand\fR... (required)"
The command to be executed. This must be specified as the
last command attribute.
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
master.o: ../include/mymalloc.h
master.o: ../include/iostuff.h
master.o: ../include/vstream.h
+master.o: ../include/binattr.h
master.o: ../include/stringops.h
master.o: ../include/myflock.h
master.o: ../include/watchdog.h
master_ent.o: ../include/vstring.h
master_ent.o: ../include/vbuf.h
master_ent.o: ../include/vstream.h
+master_ent.o: ../include/binattr.h
master_ent.o: ../include/argv.h
master_ent.o: ../include/stringops.h
master_ent.o: ../include/readlline.h
master_listen.o: ../include/iostuff.h
master_listen.o: ../include/mymalloc.h
master_listen.o: ../include/stringops.h
+master_listen.o: ../include/vstring.h
+master_listen.o: ../include/vbuf.h
master_listen.o: ../include/inet_addr_list.h
master_listen.o: ../include/set_eugid.h
master_listen.o: ../include/mail_params.h
master_vars.o: ../include/sys_defs.h
master_vars.o: ../include/msg.h
master_vars.o: ../include/stringops.h
+master_vars.o: ../include/vstring.h
+master_vars.o: ../include/vbuf.h
master_vars.o: ../include/mymalloc.h
master_vars.o: ../include/mail_conf.h
master_vars.o: ../include/mail_params.h
master_wakeup.o: ../include/mail_proto.h
master_wakeup.o: ../include/vstream.h
master_wakeup.o: ../include/vbuf.h
+master_wakeup.o: ../include/binattr.h
master_wakeup.o: ../include/iostuff.h
master_wakeup.o: mail_server.h
master_wakeup.o: master.h
multi_server.o: ../include/vstring.h
multi_server.o: ../include/vbuf.h
multi_server.o: ../include/vstream.h
+multi_server.o: ../include/binattr.h
multi_server.o: ../include/msg_vstream.h
multi_server.o: ../include/mymalloc.h
multi_server.o: ../include/stringops.h
multi_server.o: ../include/myflock.h
multi_server.o: ../include/safe_open.h
multi_server.o: ../include/watchdog.h
+multi_server.o: ../include/split_at.h
multi_server.o: ../include/mail_task.h
multi_server.o: ../include/debug_process.h
multi_server.o: ../include/mail_params.h
single_server.o: ../include/vstring.h
single_server.o: ../include/vbuf.h
single_server.o: ../include/vstream.h
+single_server.o: ../include/binattr.h
single_server.o: ../include/msg_vstream.h
single_server.o: ../include/mymalloc.h
single_server.o: ../include/events.h
single_server.o: ../include/safe_open.h
single_server.o: ../include/listen.h
single_server.o: ../include/watchdog.h
+single_server.o: ../include/split_at.h
single_server.o: ../include/mail_params.h
single_server.o: ../include/mail_task.h
single_server.o: ../include/debug_process.h
trigger_server.o: ../include/vstring.h
trigger_server.o: ../include/vbuf.h
trigger_server.o: ../include/vstream.h
+trigger_server.o: ../include/binattr.h
trigger_server.o: ../include/msg_vstream.h
trigger_server.o: ../include/mymalloc.h
trigger_server.o: ../include/events.h
trigger_server.o: ../include/safe_open.h
trigger_server.o: ../include/listen.h
trigger_server.o: ../include/watchdog.h
+trigger_server.o: ../include/split_at.h
trigger_server.o: ../include/mail_params.h
trigger_server.o: ../include/mail_task.h
trigger_server.o: ../include/debug_process.h
#include <safe_open.h>
#include <listen.h>
#include <watchdog.h>
+#include <split_at.h>
/* Global library. */
VSTRING *why;
int alone = 0;
WATCHDOG *watchdog;
+ char *oval;
/*
* Process environment options as early as we can.
*/
signal(SIGPIPE, SIG_IGN);
- /*
+ /*
* Don't die for frivolous reasons.
*/
#ifdef SIGXFSZ
* stderr, because no-one is going to see them.
*/
opterr = 0;
- while ((c = GETOPT(argc, argv, "cDi:lm:n:s:St:uv")) > 0) {
+ while ((c = GETOPT(argc, argv, "cDi:lm:n:o:s:St:uv")) > 0) {
switch (c) {
case 'c':
root_dir = var_queue_dir;
case 'n':
service_name = optarg;
break;
+ case 'o':
+ mail_conf_update(optarg,
+ (oval = split_at(optarg, '=')) ? oval : "");
+ mail_params_init(); /* XXX */
+ break;
case 's':
if ((socket_count = atoi(optarg)) <= 0)
msg_fatal("invalid socket_count: %s", optarg);
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
#endif
+
/* Utility library. */
#include <msg.h>
#include <safe_open.h>
#include <listen.h>
#include <watchdog.h>
+#include <split_at.h>
/* Global library. */
VSTRING *why;
int alone = 0;
WATCHDOG *watchdog;
+ char *oval;
/*
* Process environment options as early as we can.
*/
signal(SIGPIPE, SIG_IGN);
- /*
+ /*
* Don't die for frivolous reasons.
*/
#ifdef SIGXFSZ
* stderr, because no-one is going to see them.
*/
opterr = 0;
- while ((c = GETOPT(argc, argv, "cDi:lm:n:s:St:uv")) > 0) {
+ while ((c = GETOPT(argc, argv, "cDi:lm:n:o:s:St:uv")) > 0) {
switch (c) {
case 'c':
root_dir = var_queue_dir;
case 'n':
service_name = optarg;
break;
+ case 'o':
+ mail_conf_update(optarg,
+ (oval = split_at(optarg, '=')) ? oval : "");
+ mail_params_init(); /* XXX */
+ break;
case 's':
if ((socket_count = atoi(optarg)) <= 0)
msg_fatal("invalid socket_count: %s", optarg);
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
#endif
+
/* Utility library. */
#include <msg.h>
#include <safe_open.h>
#include <listen.h>
#include <watchdog.h>
+#include <split_at.h>
/* Global library. */
VSTRING *why;
int alone = 0;
WATCHDOG *watchdog;
+ char *oval;
/*
* Process environment options as early as we can.
*/
signal(SIGPIPE, SIG_IGN);
- /*
+ /*
* Don't die for frivolous reasons.
*/
#ifdef SIGXFSZ
* stderr, because no-one is going to see them.
*/
opterr = 0;
- while ((c = GETOPT(argc, argv, "cDi:lm:n:s:St:uv")) > 0) {
+ while ((c = GETOPT(argc, argv, "cDi:lm:n:o:s:St:uv")) > 0) {
switch (c) {
case 'c':
root_dir = var_queue_dir;
case 'n':
service_name = optarg;
break;
+ case 'o':
+ mail_conf_update(optarg,
+ (oval = split_at(optarg, '=')) ? oval : "");
+ mail_params_init(); /* XXX */
+ break;
case 's':
if ((socket_count = atoi(optarg)) <= 0)
msg_fatal("invalid socket_count: %s", optarg);
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
pickup.o: ../include/vstring.h
pickup.o: ../include/vbuf.h
pickup.o: ../include/vstream.h
+pickup.o: ../include/binattr.h
pickup.o: ../include/open_as.h
pickup.o: ../include/set_eugid.h
pickup.o: ../include/mail_queue.h
* network clients that mount the maildrop remotely - especially clients
* that can't get their daylight savings offsets right.
*/
-#define DAY_SECONDS 864000
+#define DAY_SECONDS 86400
#define HOUR_SECONDS 3600
if (info->st.st_mtime > now + 2 * HOUR_SECONDS) {
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
pipe.o: ../include/msg.h
pipe.o: ../include/vstream.h
pipe.o: ../include/vbuf.h
+pipe.o: ../include/binattr.h
pipe.o: ../include/vstring.h
pipe.o: ../include/argv.h
pipe.o: ../include/htable.h
/* mail system owner. If \fIgroupname\fR is specified, the
/* corresponding group ID is used instead of the group ID of
/* \fIusername\fR.
+/* .IP "\fBeol=string\fR (default: \fB\en\fR)"
+/* The output record delimiter. Typically one would use either
+/* \fB\er\en\fR or \fB\en\fR. You can specify the usual C-style
+/* backslash escape sequences.
/* .IP "\fBargv\fR=\fIcommand\fR... (required)"
/* The command to be executed. This must be specified as the
/* last command attribute.
uid_t uid; /* command privileges */
gid_t gid; /* command privileges */
int flags; /* mail_copy() flags */
+ VSTRING *eol; /* output record delimiter */
} PIPE_ATTR;
/* parse_callback - callback for mac_parse() */
group = 0;
attr->command = 0;
attr->flags = 0;
+ attr->eol = vstring_strcpy(vstring_alloc(1), "\n");
/*
* Iterate over the command-line attribute list.
}
}
+ /*
+ * eol=string
+ */
+ else if (strncasecmp("eol=", *argv, sizeof("eol=") - 1) == 0) {
+ unescape(attr->eol, *argv + sizeof("eol=") -1);
+ }
+
/*
* argv=command...
*/
PIPE_CMD_COPY_FLAGS, attr.flags,
PIPE_CMD_ARGV, expanded_argv->argv,
PIPE_CMD_TIME_LIMIT, conf.time_limit,
+ PIPE_CMD_EOL, STR(attr.eol),
PIPE_CMD_END);
deliver_status = eval_command_status(command_status, service, request,
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postalias.o: ../include/vstring.h
postalias.o: ../include/vbuf.h
postalias.o: ../include/vstream.h
+postalias.o: ../include/binattr.h
postalias.o: ../include/msg_vstream.h
postalias.o: ../include/readlline.h
postalias.o: ../include/stringops.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postcat.o: ../include/msg.h
postcat.o: ../include/vstream.h
postcat.o: ../include/vbuf.h
+postcat.o: ../include/binattr.h
postcat.o: ../include/vstring.h
postcat.o: ../include/msg_vstream.h
postcat.o: ../include/vstring_vstream.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postconf.o: ../include/msg.h
postconf.o: ../include/vstream.h
postconf.o: ../include/vbuf.h
+postconf.o: ../include/binattr.h
postconf.o: ../include/msg_vstream.h
postconf.o: ../include/get_hostname.h
postconf.o: ../include/stringops.h
+postconf.o: ../include/vstring.h
postconf.o: ../include/htable.h
postconf.o: ../include/dict.h
postconf.o: ../include/argv.h
postconf.o: ../include/mymalloc.h
postconf.o: ../include/split_at.h
postconf.o: ../include/readlline.h
-postconf.o: ../include/vstring.h
postconf.o: ../include/myflock.h
postconf.o: ../include/mynetworks.h
postconf.o: ../include/mail_conf.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postdrop.o: ../include/mymalloc.h
postdrop.o: ../include/vstream.h
postdrop.o: ../include/vbuf.h
+postdrop.o: ../include/binattr.h
postdrop.o: ../include/vstring.h
postdrop.o: ../include/msg_vstream.h
postdrop.o: ../include/msg_syslog.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postfix.o: ../include/sys_defs.h
postfix.o: ../include/vstream.h
postfix.o: ../include/vbuf.h
+postfix.o: ../include/binattr.h
postfix.o: ../include/msg.h
postfix.o: ../include/msg_vstream.h
postfix.o: ../include/msg_syslog.h
postfix.o: ../include/stringops.h
+postfix.o: ../include/vstring.h
postfix.o: ../include/mail_conf.h
postfix.o: ../include/mail_params.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postkick.o: ../include/mymalloc.h
postkick.o: ../include/vstream.h
postkick.o: ../include/vbuf.h
+postkick.o: ../include/binattr.h
postkick.o: ../include/msg_vstream.h
postkick.o: ../include/safe.h
postkick.o: ../include/mail_proto.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postlock.o: ../include/vstring.h
postlock.o: ../include/vbuf.h
postlock.o: ../include/vstream.h
+postlock.o: ../include/binattr.h
postlock.o: ../include/msg_vstream.h
postlock.o: ../include/iostuff.h
postlock.o: ../include/mail_params.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postlog.o: ../include/vstring.h
postlog.o: ../include/vbuf.h
postlog.o: ../include/vstream.h
+postlog.o: ../include/binattr.h
postlog.o: ../include/vstring_vstream.h
postlog.o: ../include/msg_output.h
postlog.o: ../include/msg_vstream.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postmap.o: ../include/vstring.h
postmap.o: ../include/vbuf.h
postmap.o: ../include/vstream.h
+postmap.o: ../include/binattr.h
postmap.o: ../include/msg_vstream.h
postmap.o: ../include/readlline.h
postmap.o: ../include/stringops.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
postsuper.o: ../include/msg_syslog.h
postsuper.o: ../include/vstream.h
postsuper.o: ../include/vbuf.h
+postsuper.o: ../include/binattr.h
postsuper.o: ../include/msg_vstream.h
postsuper.o: ../include/scan_dir.h
postsuper.o: ../include/vstring.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
qmgr.o: ../include/events.h
qmgr.o: ../include/vstream.h
qmgr.o: ../include/vbuf.h
+qmgr.o: ../include/binattr.h
qmgr.o: ../include/dict.h
qmgr.o: ../include/argv.h
qmgr.o: ../include/mail_queue.h
qmgr_active.o: ../include/mymalloc.h
qmgr_active.o: ../include/vstream.h
qmgr_active.o: ../include/vbuf.h
+qmgr_active.o: ../include/binattr.h
qmgr_active.o: ../include/mail_params.h
qmgr_active.o: ../include/mail_open_ok.h
qmgr_active.o: ../include/mail_queue.h
qmgr_bounce.o: ../include/deliver_completed.h
qmgr_bounce.o: ../include/vstream.h
qmgr_bounce.o: ../include/vbuf.h
+qmgr_bounce.o: ../include/binattr.h
qmgr_bounce.o: qmgr.h
qmgr_bounce.o: ../include/scan_dir.h
qmgr_bounce.o: ../include/maps.h
qmgr_defer.o: ../include/msg.h
qmgr_defer.o: ../include/vstream.h
qmgr_defer.o: ../include/vbuf.h
+qmgr_defer.o: ../include/binattr.h
qmgr_defer.o: ../include/defer.h
qmgr_defer.o: ../include/bounce.h
qmgr_defer.o: qmgr.h
qmgr_deliver.o: ../include/vstring.h
qmgr_deliver.o: ../include/vbuf.h
qmgr_deliver.o: ../include/vstream.h
+qmgr_deliver.o: ../include/binattr.h
qmgr_deliver.o: ../include/vstring_vstream.h
qmgr_deliver.o: ../include/events.h
qmgr_deliver.o: ../include/iostuff.h
qmgr_enable.o: ../include/msg.h
qmgr_enable.o: ../include/vstream.h
qmgr_enable.o: ../include/vbuf.h
+qmgr_enable.o: ../include/binattr.h
qmgr_enable.o: qmgr.h
qmgr_enable.o: ../include/scan_dir.h
qmgr_enable.o: ../include/maps.h
qmgr_entry.o: ../include/events.h
qmgr_entry.o: ../include/vstream.h
qmgr_entry.o: ../include/vbuf.h
+qmgr_entry.o: ../include/binattr.h
qmgr_entry.o: ../include/mail_params.h
qmgr_entry.o: qmgr.h
qmgr_entry.o: ../include/scan_dir.h
qmgr_message.o: ../include/vstring.h
qmgr_message.o: ../include/vbuf.h
qmgr_message.o: ../include/vstream.h
+qmgr_message.o: ../include/binattr.h
qmgr_message.o: ../include/split_at.h
qmgr_message.o: ../include/valid_hostname.h
qmgr_message.o: ../include/argv.h
qmgr_move.o: ../include/vstring.h
qmgr_move.o: ../include/vbuf.h
qmgr_move.o: ../include/vstream.h
+qmgr_move.o: ../include/binattr.h
qmgr_move.o: ../include/mail_scan_dir.h
qmgr_move.o: qmgr.h
qmgr_move.o: ../include/maps.h
qmgr_queue.o: qmgr.h
qmgr_queue.o: ../include/vstream.h
qmgr_queue.o: ../include/vbuf.h
+qmgr_queue.o: ../include/binattr.h
qmgr_queue.o: ../include/scan_dir.h
qmgr_queue.o: ../include/maps.h
qmgr_queue.o: ../include/dict.h
qmgr_rcpt_list.o: qmgr.h
qmgr_rcpt_list.o: ../include/vstream.h
qmgr_rcpt_list.o: ../include/vbuf.h
+qmgr_rcpt_list.o: ../include/binattr.h
qmgr_rcpt_list.o: ../include/scan_dir.h
qmgr_rcpt_list.o: ../include/maps.h
qmgr_rcpt_list.o: ../include/dict.h
qmgr_scan.o: qmgr.h
qmgr_scan.o: ../include/vstream.h
qmgr_scan.o: ../include/vbuf.h
+qmgr_scan.o: ../include/binattr.h
qmgr_scan.o: ../include/maps.h
qmgr_scan.o: ../include/dict.h
qmgr_scan.o: ../include/argv.h
qmgr_transport.o: ../include/mymalloc.h
qmgr_transport.o: ../include/vstream.h
qmgr_transport.o: ../include/vbuf.h
+qmgr_transport.o: ../include/binattr.h
qmgr_transport.o: ../include/iostuff.h
qmgr_transport.o: ../include/mail_proto.h
qmgr_transport.o: ../include/recipient_list.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
sendmail.o: ../include/mymalloc.h
sendmail.o: ../include/vstream.h
sendmail.o: ../include/vbuf.h
+sendmail.o: ../include/binattr.h
sendmail.o: ../include/vstring.h
sendmail.o: ../include/msg_vstream.h
sendmail.o: ../include/msg_syslog.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
showq.o: ../include/vstring.h
showq.o: ../include/vbuf.h
showq.o: ../include/vstream.h
+showq.o: ../include/binattr.h
showq.o: ../include/vstring_vstream.h
showq.o: ../include/stringops.h
showq.o: ../include/mymalloc.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
smtp.o: ../include/dict.h
smtp.o: ../include/vstream.h
smtp.o: ../include/vbuf.h
+smtp.o: ../include/binattr.h
smtp.o: ../include/argv.h
smtp.o: ../include/msg.h
smtp.o: ../include/mymalloc.h
smtp.o: ../include/deliver_pass.h
smtp.o: ../include/mail_proto.h
smtp.o: ../include/iostuff.h
+smtp.o: ../include/smtp_stream.h
smtp.o: ../include/mail_server.h
smtp.o: smtp.h
smtp.o: smtp_sasl.h
smtp_addr.o: ../include/dns.h
smtp_addr.o: smtp.h
smtp_addr.o: ../include/vstream.h
+smtp_addr.o: ../include/binattr.h
smtp_addr.o: ../include/argv.h
smtp_addr.o: ../include/deliver_request.h
smtp_addr.o: ../include/recipient_list.h
smtp_chat.o: ../include/vstring.h
smtp_chat.o: ../include/vbuf.h
smtp_chat.o: ../include/vstream.h
+smtp_chat.o: ../include/binattr.h
smtp_chat.o: ../include/argv.h
smtp_chat.o: ../include/stringops.h
smtp_chat.o: ../include/line_wrap.h
smtp_connect.o: ../include/msg.h
smtp_connect.o: ../include/vstream.h
smtp_connect.o: ../include/vbuf.h
+smtp_connect.o: ../include/binattr.h
smtp_connect.o: ../include/vstring.h
smtp_connect.o: ../include/split_at.h
smtp_connect.o: ../include/mymalloc.h
smtp_proto.o: ../include/vstring.h
smtp_proto.o: ../include/vbuf.h
smtp_proto.o: ../include/vstream.h
+smtp_proto.o: ../include/binattr.h
smtp_proto.o: ../include/vstring_vstream.h
smtp_proto.o: ../include/stringops.h
smtp_proto.o: ../include/mymalloc.h
smtp_sasl_glue.o: ../include/msg.h
smtp_sasl_glue.o: ../include/mymalloc.h
smtp_sasl_glue.o: ../include/stringops.h
+smtp_sasl_glue.o: ../include/vstring.h
+smtp_sasl_glue.o: ../include/vbuf.h
smtp_sasl_glue.o: ../include/split_at.h
smtp_sasl_glue.o: ../include/name_mask.h
smtp_sasl_glue.o: ../include/mail_params.h
smtp_sasl_glue.o: ../include/maps.h
smtp_sasl_glue.o: ../include/dict.h
smtp_sasl_glue.o: ../include/vstream.h
-smtp_sasl_glue.o: ../include/vbuf.h
+smtp_sasl_glue.o: ../include/binattr.h
smtp_sasl_glue.o: ../include/argv.h
smtp_sasl_glue.o: smtp.h
-smtp_sasl_glue.o: ../include/vstring.h
smtp_sasl_glue.o: ../include/deliver_request.h
smtp_sasl_glue.o: ../include/recipient_list.h
smtp_sasl_glue.o: smtp_sasl.h
smtp_sasl_proto.o: smtp.h
smtp_sasl_proto.o: ../include/vstream.h
smtp_sasl_proto.o: ../include/vbuf.h
+smtp_sasl_proto.o: ../include/binattr.h
smtp_sasl_proto.o: ../include/vstring.h
smtp_sasl_proto.o: ../include/argv.h
smtp_sasl_proto.o: ../include/deliver_request.h
smtp_session.o: ../include/mymalloc.h
smtp_session.o: ../include/vstream.h
smtp_session.o: ../include/vbuf.h
+smtp_session.o: ../include/binattr.h
smtp_session.o: ../include/stringops.h
-smtp_session.o: smtp.h
smtp_session.o: ../include/vstring.h
+smtp_session.o: smtp.h
smtp_session.o: ../include/argv.h
smtp_session.o: ../include/deliver_request.h
smtp_session.o: ../include/recipient_list.h
smtp_state.o: ../include/vstring.h
smtp_state.o: ../include/vbuf.h
smtp_state.o: ../include/vstream.h
+smtp_state.o: ../include/binattr.h
smtp_state.o: ../include/mail_conf.h
smtp_state.o: smtp.h
smtp_state.o: ../include/argv.h
smtp_trouble.o: ../include/mymalloc.h
smtp_trouble.o: ../include/smtp_stream.h
smtp_trouble.o: ../include/vstream.h
+smtp_trouble.o: ../include/binattr.h
smtp_trouble.o: ../include/deliver_request.h
smtp_trouble.o: ../include/recipient_list.h
smtp_trouble.o: ../include/deliver_completed.h
smtp_unalias.o: ../include/dns.h
smtp_unalias.o: smtp.h
smtp_unalias.o: ../include/vstream.h
+smtp_unalias.o: ../include/binattr.h
smtp_unalias.o: ../include/argv.h
smtp_unalias.o: ../include/deliver_request.h
smtp_unalias.o: ../include/recipient_list.h
#include <debug_peer.h>
#include <mail_error.h>
#include <deliver_pass.h>
+#include <smtp_stream.h>
/* Single server skeleton. */
"%s", vstring_str(why));
} else {
debug_peer_check(state->session->host, state->session->addr);
+ smtp_jump_setup(state->session->stream, state->jbuf);
if (smtp_helo(state) == 0)
smtp_xfer(state);
if (state->history != 0
/* DESCRIPTION
/* .nf
+ /*
+ * System library.
+ */
+#include <setjmp.h>
+
/*
* SASL library.
*/
VSTRING *sasl_decoded; /* decoding buffer */
sasl_callback_t *sasl_callbacks; /* stateful callbacks */
#endif
+ jmp_buf jbuf[1]; /* exception context */
} SMTP_STATE;
#define SMTP_FEATURE_ESMTP (1<<0)
* Prepare for disaster.
*/
smtp_timeout_setup(state->session->stream, var_smtp_helo_tmout);
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(state->jbuf[0])) != 0)
return (smtp_stream_except(state, except, "sending HELO"));
/*
*/
smtp_timeout_setup(state->session->stream,
*xfer_timeouts[recv_state]);
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(state->jbuf[0])) != 0)
RETURN(smtp_stream_except(state, except,
xfer_states[recv_state]));
resp = smtp_chat_resp(state);
if (send_state == SMTP_STATE_DOT && nrcpt > 0) {
smtp_timeout_setup(state->session->stream,
var_smtp_data1_tmout);
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(state->jbuf[0])) != 0)
RETURN(smtp_stream_except(state, except,
"sending message body"));
#include <sys_defs.h>
#include <stdlib.h> /* 44BSD stdarg.h uses abort() */
-#include <setjmp.h>
#include <stdarg.h>
/* Utility library. */
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
smtpd.o: ../include/vstring.h
smtpd.o: ../include/vbuf.h
smtpd.o: ../include/vstream.h
+smtpd.o: ../include/binattr.h
smtpd.o: ../include/vstring_vstream.h
smtpd.o: ../include/stringops.h
smtpd.o: ../include/events.h
smtpd_chat.o: ../include/vstring.h
smtpd_chat.o: ../include/vbuf.h
smtpd_chat.o: ../include/vstream.h
+smtpd_chat.o: ../include/binattr.h
smtpd_chat.o: ../include/stringops.h
smtpd_chat.o: ../include/line_wrap.h
smtpd_chat.o: ../include/mymalloc.h
smtpd_check.o: ../include/mymalloc.h
smtpd_check.o: ../include/dict.h
smtpd_check.o: ../include/vstream.h
+smtpd_check.o: ../include/binattr.h
smtpd_check.o: ../include/htable.h
smtpd_check.o: ../include/dns.h
smtpd_check.o: ../include/namadr_list.h
smtpd_peer.o: ../include/mymalloc.h
smtpd_peer.o: ../include/valid_hostname.h
smtpd_peer.o: ../include/stringops.h
+smtpd_peer.o: ../include/vstring.h
+smtpd_peer.o: ../include/vbuf.h
smtpd_peer.o: smtpd.h
smtpd_peer.o: ../include/vstream.h
-smtpd_peer.o: ../include/vbuf.h
-smtpd_peer.o: ../include/vstring.h
+smtpd_peer.o: ../include/binattr.h
smtpd_peer.o: ../include/argv.h
smtpd_peer.o: ../include/mail_stream.h
smtpd_sasl_glue.o: smtpd_sasl_glue.c
smtpd_sasl_glue.o: ../include/vstring.h
smtpd_sasl_glue.o: ../include/vbuf.h
smtpd_sasl_glue.o: ../include/vstream.h
+smtpd_sasl_glue.o: ../include/binattr.h
smtpd_sasl_glue.o: smtpd.h
smtpd_sasl_glue.o: ../include/argv.h
smtpd_sasl_glue.o: ../include/mail_stream.h
smtpd_sasl_proto.o: ../include/mail_proto.h
smtpd_sasl_proto.o: ../include/vstream.h
smtpd_sasl_proto.o: ../include/vbuf.h
+smtpd_sasl_proto.o: ../include/binattr.h
smtpd_sasl_proto.o: ../include/iostuff.h
smtpd_sasl_proto.o: ../include/mail_error.h
smtpd_sasl_proto.o: ../include/name_mask.h
smtpd_state.o: ../include/mymalloc.h
smtpd_state.o: ../include/vstream.h
smtpd_state.o: ../include/vbuf.h
+smtpd_state.o: ../include/binattr.h
smtpd_state.o: ../include/name_mask.h
smtpd_state.o: ../include/msg.h
smtpd_state.o: ../include/cleanup_user.h
* cleans up, but no attempt is made to inform the client of the nature
* of the problem.
*/
+ smtp_jump_setup(state->client, state->jbuf);
smtp_timeout_setup(state->client, var_smtpd_tmout);
- switch (setjmp(smtp_timeout_buf)) {
+ switch (setjmp(state->jbuf[0])) {
default:
msg_panic("smtpd_proto: unknown error reading from %s[%s]",
/* DESCRIPTION
/* .nf
+ /*
+ * System library
+ */
+#include <setjmp.h>
+
/*
* SASL library.
*/
VSTRING *sasl_encoded;
VSTRING *sasl_decoded;
#endif
+ jmp_buf jbuf[1];
} SMTPD_STATE;
extern void smtpd_state_init(SMTPD_STATE *, VSTREAM *);
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
smtp-sink.o: ../include/vstring.h
smtp-sink.o: ../include/vbuf.h
smtp-sink.o: ../include/vstream.h
+smtp-sink.o: ../include/binattr.h
smtp-sink.o: ../include/vstring_vstream.h
smtp-sink.o: ../include/get_hostname.h
smtp-sink.o: ../include/listen.h
smtp-source.o: ../include/msg_vstream.h
smtp-source.o: ../include/vstream.h
smtp-source.o: ../include/vbuf.h
+smtp-source.o: ../include/binattr.h
smtp-source.o: ../include/vstring.h
smtp-source.o: ../include/vstring_vstream.h
smtp-source.o: ../include/get_hostname.h
int data_state;
int (*read) (struct SINK_STATE *);
int rcpts;
+ jmp_buf jbuf[1];
} SINK_STATE;
#define ST_ANY 0
SINK_STATE *state = (SINK_STATE *) context;
do {
- switch (setjmp(smtp_timeout_buf)) {
+ switch (setjmp(state->jbuf[0])) {
default:
msg_panic("unknown error reading input");
state->stream = vstream_fdopen(fd, O_RDWR);
state->read = command_read;
state->data_state = 0;
+ smtp_jump_setup(state->stream, state->jbuf);
smtp_timeout_setup(state->stream, var_tmout);
smtp_printf(state->stream, "220 %s ESMTP", var_myhostname);
event_enable_read(fd, read_event, (char *) state);
/* DESCRIPTION
/* smtp-source connects to the named host and port (default 25)
/* and sends one or more little messages to it, either sequentially
-/* or in parallel.
+/* or in parallel. The program speaks either SMTP (default) or
+/* LMTP.
/*
/* Options:
/* .IP -c
VSTREAM *stream; /* open connection */
int connect_count; /* # of connect()s to retry */
struct SESSION *next; /* connect() queue linkage */
+ jmp_buf jbuf[1]; /* exception handling */
} SESSION;
static SESSION *last_session; /* connect() queue tail */
(void) non_blocking(fd, NON_BLOCKING);
session->stream = vstream_fdopen(fd, O_RDWR);
event_enable_write(fd, connect_done, (char *) session);
+ smtp_jump_setup(session->stream, session->jbuf);
smtp_timeout_setup(session->stream, var_timeout);
if (connect(fd, (struct sockaddr *) & sin, sizeof(sin)) < 0
&& errno != EINPROGRESS)
/*
* Prepare for disaster.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
- msg_fatal("%s while reading HELO", exception_text(except));
+ if ((except = setjmp(session->jbuf[0])) != 0)
+ msg_fatal("%s while reading server greeting", exception_text(except));
/*
* Read and parse the server's SMTP greeting banner.
/*
* Send the standard greeting with our hostname
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending HELO", exception_text(except));
command(session->stream, "%s %s", protocol, var_myhostname);
/*
* Get response to HELO command.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending HELO", exception_text(except));
if ((resp = response(session->stream, buffer))->code / 100 != 2)
/*
* Send the envelope sender address.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending sender", exception_text(except));
command(session->stream, "MAIL FROM:<%s>", sender);
/*
* Get response to MAIL command.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending sender", exception_text(except));
if ((resp = response(session->stream, buffer))->code / 100 != 2)
/*
* Send envelope recipient address.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending recipient", exception_text(except));
if (session->rcpt_count > 1)
/*
* Get response to RCPT command.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending recipient", exception_text(except));
if ((resp = response(session->stream, buffer))->code / 100 != 2)
/*
* Request data transmission.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending DATA command", exception_text(except));
command(session->stream, "DATA");
/*
* Get response to DATA command.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending DATA command", exception_text(except));
if ((resp = response(session->stream, buffer))->code != 354)
msg_fatal("data %d %s", resp->code, resp->str);
/*
* Send some garbage.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending message", exception_text(except));
if (message_length == 0) {
smtp_fputs("La de da de da 1.", 17, session->stream);
/*
* Get response to "." command.
*/
- if ((except = setjmp(smtp_timeout_buf)) != 0)
+ if ((except = setjmp(session->jbuf[0])) != 0)
msg_fatal("%s while sending message", exception_text(except));
do { /* XXX this could block */
if ((resp = response(session->stream, buffer))->code / 100 != 2)
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
/* .IP \fIservice\fB_command_time_limit\fR
/* The amount of time the command is allowed to run before it is
/* killed with force. The \fIservice\fR name is the name of the entry
-/* in the \fBmastr.cf\fR file. The default time limit is given by the
+/* in the \fBmaster.cf\fR file. The default time limit is given by the
/* global \fBcommand_time_limit\fR configuration parameter.
/* SEE ALSO
/* master(8) process manager
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
resolve.o: ../include/vstring.h
resolve.o: ../include/vbuf.h
resolve.o: ../include/vstream.h
+resolve.o: ../include/binattr.h
resolve.o: ../include/vstring_vstream.h
resolve.o: ../include/split_at.h
resolve.o: ../include/mail_params.h
rewrite.o: ../include/vstring.h
rewrite.o: ../include/vbuf.h
rewrite.o: ../include/vstream.h
+rewrite.o: ../include/binattr.h
rewrite.o: ../include/vstring_vstream.h
rewrite.o: ../include/split_at.h
rewrite.o: ../include/mail_params.h
transport.o: ../include/sys_defs.h
transport.o: ../include/msg.h
transport.o: ../include/stringops.h
-transport.o: ../include/mymalloc.h
transport.o: ../include/vstring.h
transport.o: ../include/vbuf.h
+transport.o: ../include/mymalloc.h
transport.o: ../include/split_at.h
transport.o: ../include/dict.h
transport.o: ../include/vstream.h
+transport.o: ../include/binattr.h
transport.o: ../include/argv.h
transport.o: ../include/mail_params.h
transport.o: ../include/maps.h
trivial-rewrite.o: ../include/vstring.h
trivial-rewrite.o: ../include/vbuf.h
trivial-rewrite.o: ../include/vstream.h
+trivial-rewrite.o: ../include/binattr.h
trivial-rewrite.o: ../include/vstring_vstream.h
trivial-rewrite.o: ../include/split_at.h
trivial-rewrite.o: ../include/stringops.h
-TALIAS_TOKEN
-TARGV
-TBH_TABLE
+-TBINATTR
+-TBINATTR_INFO
-TBINHASH
-TBINHASH_INFO
-TBOUNCE_STAT
-THTABLE_INFO
-TINET_ADDR_LIST
-TINT_TABLE
+-TJMP_BUF_WRAPPER
-TLOCAL_EXP
-TLOCAL_STATE
-TMAC_EXP
write_buf.c write_wait.c dict_unix.c dict_pcre.c stream_listen.c \
stream_connect.c stream_trigger.c dict_regexp.c mac_expand.c \
clean_env.c watchdog.c spawn_command.c duplex_pipe.c sane_rename.c \
- sane_link.c
+ sane_link.c unescape.c timed_read.c timed_write.c binattr.c \
+ vstream_attr.c
OBJS = argv.o argv_split.o attr.o basename.o binhash.o chroot_uid.o \
close_on_exec.o concatenate.o dict.o dict_db.o dict_dbm.o \
dict_env.o dict_ht.o dict_ldap.o dict_mysql.o dict_ni.o dict_nis.o \
write_buf.o write_wait.o dict_unix.o dict_pcre.o stream_listen.o \
stream_connect.o stream_trigger.o dict_regexp.o mac_expand.o \
clean_env.o watchdog.o spawn_command.o duplex_pipe.o sane_rename.o \
- sane_link.o
+ sane_link.o unescape.o timed_read.o timed_write.o binattr.o \
+ vstream_attr.o
HDRS = argv.h attr.h binhash.h chroot_uid.h connect.h dict.h dict_db.h \
dict_dbm.h dict_env.h dict_ht.h dict_ldap.h dict_mysql.h \
dict_ni.h dict_nis.h dict_nisplus.h dir_forest.h events.h \
timed_connect.h timed_wait.h trigger.h username.h valid_hostname.h \
vbuf.h vbuf_print.h vstream.h vstring.h vstring_vstream.h \
dict_unix.h dict_pcre.h dict_regexp.h mac_expand.h clean_env.h \
- watchdog.h spawn_command.h sane_fsops.h
+ watchdog.h spawn_command.h sane_fsops.h binattr.h
TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
stream_test.c dup2_pass_on_exec.c
WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \
inet_addr_host inet_addr_local mac_parse make_dirs msg_syslog \
mystrtok peer_name sigdelay translit valid_hostname vstream_popen \
vstring vstring_vstream doze select_bug stream_test mac_expand \
- watchdog
+ watchdog unescape
LIB_DIR = ../lib
INC_DIR = ../include
$(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
mv junk $@.o
+unescape: $(LIB)
+ mv $@.o junk
+ $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
+ mv junk $@.o
+
depend: $(MAKES)
(sed '1,/^# do not edit/!d' Makefile.in; \
set -e; for i in [a-z][a-z0-9]*.c; do \
stream_test: stream_test.c $(LIB)
$(CC) $(CFLAGS) -o $@ $@.c $(LIB) $(SYSLIBS)
-tests: valid_hostname_test mac_expand_test dict_test
+tests: valid_hostname_test mac_expand_test dict_test unescape_test
valid_hostname_test: valid_hostname valid_hostname.in valid_hostname.ref
./valid_hostname <valid_hostname.in 2>valid_hostname.tmp
diff mac_expand.ref mac_expand.tmp
rm -f mac_expand.tmp
+unescape_test: unescape unescape.in unescape.ref
+ ./unescape <unescape.in | od -cb >unescape.tmp
+ diff -b unescape.ref unescape.tmp
+ rm -f unescape.tmp
+
DB_TYPE = `../postconf/postconf -h default_database_type`
dict_test: dict_open testdb dict_test.in dict_test.ref
argv_split.o: sys_defs.h
argv_split.o: mymalloc.h
argv_split.o: stringops.h
+argv_split.o: vstring.h
+argv_split.o: vbuf.h
argv_split.o: argv.h
attr.o: attr.c
attr.o: sys_defs.h
basename.o: basename.c
basename.o: sys_defs.h
basename.o: stringops.h
+basename.o: vstring.h
+basename.o: vbuf.h
+binattr.o: binattr.c
+binattr.o: sys_defs.h
+binattr.o: mymalloc.h
+binattr.o: htable.h
+binattr.o: binattr.h
binhash.o: binhash.c
binhash.o: sys_defs.h
binhash.o: mymalloc.h
concatenate.o: sys_defs.h
concatenate.o: mymalloc.h
concatenate.o: stringops.h
+concatenate.o: vstring.h
+concatenate.o: vbuf.h
dict.o: dict.c
dict.o: sys_defs.h
dict.o: msg.h
dict.o: mymalloc.h
dict.o: vstream.h
dict.o: vbuf.h
+dict.o: binattr.h
dict.o: vstring.h
dict.o: readlline.h
dict.o: mac_parse.h
dict_db.o: myflock.h
dict_db.o: dict.h
dict_db.o: vstream.h
+dict_db.o: binattr.h
dict_db.o: argv.h
dict_db.o: dict_db.h
dict_dbm.o: dict_dbm.c
dict_env.o: dict.h
dict_env.o: vstream.h
dict_env.o: vbuf.h
+dict_env.o: binattr.h
dict_env.o: argv.h
dict_env.o: dict_env.h
dict_ht.o: dict_ht.c
dict_ht.o: dict.h
dict_ht.o: vstream.h
dict_ht.o: vbuf.h
+dict_ht.o: binattr.h
dict_ht.o: argv.h
dict_ht.o: dict_ht.h
dict_ldap.o: dict_ldap.c
dict_nis.o: vbuf.h
dict_nis.o: dict.h
dict_nis.o: vstream.h
+dict_nis.o: binattr.h
dict_nis.o: argv.h
dict_nis.o: dict_nis.h
dict_nisplus.o: dict_nisplus.c
dict_nisplus.o: dict.h
dict_nisplus.o: vstream.h
dict_nisplus.o: vbuf.h
+dict_nisplus.o: binattr.h
dict_nisplus.o: argv.h
dict_nisplus.o: dict_nisplus.h
dict_open.o: dict_open.c
dict_open.o: dict.h
dict_open.o: vstream.h
dict_open.o: vbuf.h
+dict_open.o: binattr.h
dict_open.o: dict_env.h
dict_open.o: dict_unix.h
dict_open.o: dict_dbm.h
dict_open.o: dict_pcre.h
dict_open.o: dict_regexp.h
dict_open.o: stringops.h
+dict_open.o: vstring.h
dict_open.o: split_at.h
dict_open.o: htable.h
dict_pcre.o: dict_pcre.c
dict_regexp.o: safe.h
dict_regexp.o: vstream.h
dict_regexp.o: vbuf.h
+dict_regexp.o: binattr.h
dict_regexp.o: vstring.h
dict_regexp.o: stringops.h
dict_regexp.o: readlline.h
dict_unix.o: vbuf.h
dict_unix.o: dict.h
dict_unix.o: vstream.h
+dict_unix.o: binattr.h
dict_unix.o: argv.h
dict_unix.o: dict_unix.h
dir_forest.o: dir_forest.c
lowercase.o: lowercase.c
lowercase.o: sys_defs.h
lowercase.o: stringops.h
+lowercase.o: vstring.h
+lowercase.o: vbuf.h
lstat_as.o: lstat_as.c
lstat_as.o: sys_defs.h
lstat_as.o: msg.h
make_dirs.o: msg.h
make_dirs.o: mymalloc.h
make_dirs.o: stringops.h
+make_dirs.o: vstring.h
+make_dirs.o: vbuf.h
make_dirs.o: make_dirs.h
match_list.o: match_list.c
match_list.o: sys_defs.h
match_list.o: vstring.h
match_list.o: vbuf.h
match_list.o: vstream.h
+match_list.o: binattr.h
match_list.o: vstring_vstream.h
match_list.o: stringops.h
match_list.o: argv.h
match_ops.o: dict.h
match_ops.o: vstream.h
match_ops.o: vbuf.h
+match_ops.o: binattr.h
match_ops.o: argv.h
match_ops.o: match_ops.h
match_ops.o: stringops.h
+match_ops.o: vstring.h
msg.o: msg.c
msg.o: sys_defs.h
msg.o: msg.h
msg_output.o: vstring.h
msg_output.o: vbuf.h
msg_output.o: vstream.h
+msg_output.o: binattr.h
msg_output.o: msg_vstream.h
msg_output.o: stringops.h
msg_output.o: percentm.h
msg_vstream.o: sys_defs.h
msg_vstream.o: vstream.h
msg_vstream.o: vbuf.h
+msg_vstream.o: binattr.h
msg_vstream.o: msg.h
msg_vstream.o: msg_output.h
msg_vstream.o: msg_vstream.h
mystrtok.o: mystrtok.c
mystrtok.o: sys_defs.h
mystrtok.o: stringops.h
+mystrtok.o: vstring.h
+mystrtok.o: vbuf.h
name_mask.o: name_mask.c
name_mask.o: sys_defs.h
name_mask.o: msg.h
name_mask.o: mymalloc.h
name_mask.o: stringops.h
+name_mask.o: vstring.h
+name_mask.o: vbuf.h
name_mask.o: name_mask.h
non_blocking.o: non_blocking.c
non_blocking.o: sys_defs.h
open_lock.o: msg.h
open_lock.o: vstream.h
open_lock.o: vbuf.h
+open_lock.o: binattr.h
open_lock.o: vstring.h
open_lock.o: safe_open.h
open_lock.o: myflock.h
printable.o: printable.c
printable.o: sys_defs.h
printable.o: stringops.h
+printable.o: vstring.h
+printable.o: vbuf.h
read_wait.o: read_wait.c
read_wait.o: sys_defs.h
read_wait.o: msg.h
readlline.o: sys_defs.h
readlline.o: vstream.h
readlline.o: vbuf.h
+readlline.o: binattr.h
readlline.o: vstring.h
readlline.o: readlline.h
ring.o: ring.c
safe_open.o: msg.h
safe_open.o: vstream.h
safe_open.o: vbuf.h
+safe_open.o: binattr.h
safe_open.o: vstring.h
safe_open.o: safe_open.h
sane_accept.o: sane_accept.c
select_bug.o: msg.h
select_bug.o: vstream.h
select_bug.o: vbuf.h
+select_bug.o: binattr.h
select_bug.o: msg_vstream.h
set_eugid.o: set_eugid.c
set_eugid.o: sys_defs.h
skipblanks.o: skipblanks.c
skipblanks.o: sys_defs.h
skipblanks.o: stringops.h
+skipblanks.o: vstring.h
+skipblanks.o: vbuf.h
spawn_command.o: spawn_command.c
spawn_command.o: sys_defs.h
spawn_command.o: msg.h
stream_test.o: msg_vstream.h
stream_test.o: vstream.h
stream_test.o: vbuf.h
+stream_test.o: binattr.h
stream_test.o: listen.h
stream_test.o: connect.h
stream_trigger.o: stream_trigger.c
timed_connect.o: msg.h
timed_connect.o: iostuff.h
timed_connect.o: timed_connect.h
+timed_read.o: timed_read.c
+timed_read.o: sys_defs.h
+timed_read.o: iostuff.h
timed_wait.o: timed_wait.c
timed_wait.o: sys_defs.h
timed_wait.o: msg.h
timed_wait.o: posix_signals.h
timed_wait.o: timed_wait.h
+timed_write.o: timed_write.c
+timed_write.o: sys_defs.h
+timed_write.o: iostuff.h
translit.o: translit.c
translit.o: sys_defs.h
translit.o: stringops.h
+translit.o: vstring.h
+translit.o: vbuf.h
trimblanks.o: trimblanks.c
trimblanks.o: sys_defs.h
trimblanks.o: stringops.h
+trimblanks.o: vstring.h
+trimblanks.o: vbuf.h
+unescape.o: unescape.c
+unescape.o: sys_defs.h
+unescape.o: vstring.h
+unescape.o: vbuf.h
+unescape.o: stringops.h
unix_connect.o: unix_connect.c
unix_connect.o: sys_defs.h
unix_connect.o: msg.h
valid_hostname.o: msg.h
valid_hostname.o: mymalloc.h
valid_hostname.o: stringops.h
+valid_hostname.o: vstring.h
+valid_hostname.o: vbuf.h
valid_hostname.o: valid_hostname.h
vbuf.o: vbuf.c
vbuf.o: sys_defs.h
vstream.o: msg.h
vstream.o: vbuf_print.h
vstream.o: vbuf.h
+vstream.o: iostuff.h
vstream.o: vstring.h
+vstream.o: binattr.h
vstream.o: vstream.h
+vstream_attr.o: vstream_attr.c
+vstream_attr.o: sys_defs.h
+vstream_attr.o: vstream.h
+vstream_attr.o: vbuf.h
+vstream_attr.o: binattr.h
+vstream_attr.o: htable.h
vstream_popen.o: vstream_popen.c
vstream_popen.o: sys_defs.h
vstream_popen.o: msg.h
vstream_popen.o: exec_command.h
vstream_popen.o: vstream.h
vstream_popen.o: vbuf.h
+vstream_popen.o: binattr.h
vstream_popen.o: argv.h
vstream_popen.o: set_ugid.h
vstream_popen.o: clean_env.h
vstring_vstream.o: vstring.h
vstring_vstream.o: vbuf.h
vstring_vstream.o: vstream.h
+vstring_vstream.o: binattr.h
vstring_vstream.o: vstring_vstream.h
watchdog.o: watchdog.c
watchdog.o: sys_defs.h
--- /dev/null
+/*++
+/* NAME
+/* binattr 3
+/* SUMMARY
+/* binary-valued attribute list manager
+/* SYNOPSIS
+/* #include <binattr.h>
+/*
+/* typedef struct {
+/* .in +4
+/* char *key;
+/* char *value;
+/* /* private fields... */
+/* .in -4
+/* } BINATTR_ENTRY;
+/*
+/* BINATTR *binattr_create(size)
+/* int size;
+/*
+/* char *binattr_get(table, name)
+/* BINATTR *table;
+/* const char *name;
+/*
+/* BINATTR_ENTRY *binattr_set(table, name, value, free_fn)
+/* BINATTR *table;
+/* const char *name;
+/* void (*free_fn)(char *);
+/*
+/* void binattr_unset(table, name)
+/* BINATTR *table;
+/* const char *name;
+/*
+/* void binattr_free(table)
+/* BINATTR *table;
+/* DESCRIPTION
+/* This module maintains open attribute lists of arbitrary
+/* binary values. Each attribute has a string-valued name.
+/* The caller specifies the memory management policy for
+/* attribute values, which can be arbitrary binary data.
+/* Attribute lists grow on demand as entries are added.
+/*
+/* binattr_create() creates a table of the specified size,
+/* or whatever the underlying code deems suitable.
+/*
+/* binattr_get() looks up the named attribute in the specified
+/* attribute list, and returns the value that was stored with
+/* binattr_set(). The result is a null pointer when the requested
+/* information is not found.
+/*
+/* binattr_set() adds or replaces the named entry in the specified
+/* attribute list. This function expects as attribute value a
+/* generic character pointer. Use proper casts when storing data of
+/* a different type, or the result will be undefined.
+/*
+/* binattr_unset() removes the named attribute from the specified
+/* attribute list. This operation is undefined for non-existing
+/* attributes.
+/*
+/* binattr_free() destroys the specified attribute list including
+/* the information that is stored in it.
+/*
+/* Arguments:
+/* .IP table
+/* Open attribute list created with binattr_create.
+/* .IP name
+/* Attribute name. Attribute names are unique within a list.
+/* .IP value
+/* The value stored under the named attribute.
+/* .IP free_fn
+/* Pointer to function that destroys the value stored under the
+/* named attribute, or a null pointer.
+/* DIAGNOSTICS
+/* Panic: interface violations and internal consistency problems.
+/* Fatal errors: out of memory.
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+
+/* Utility library. */
+
+#include <mymalloc.h>
+#include <htable.h>
+#include "binattr.h"
+
+/* binattr_create - create binary attribute list */
+
+BINATTR *binattr_create(int size)
+{
+ return (htable_create(size));
+}
+
+/* binattr_free - destroy binary attribute list */
+
+void binattr_free(BINATTR *table)
+{
+ HTABLE_INFO **info;
+ HTABLE_INFO **ht;
+ BINATTR_INFO *h;
+
+ for (ht = info = htable_list(table); *ht != 0; ht++) {
+ h = (BINATTR_INFO *) (ht[0]->value);
+ if (h->free_fn)
+ h->free_fn(h->value);
+ }
+ myfree((char *) info);
+}
+
+/* binattr_get - look up binary attribute */
+
+char *binattr_get(BINATTR *table, const char *name)
+{
+ BINATTR_INFO *info;
+
+ return ((info = (BINATTR_INFO *) htable_find(table, name)) == 0 ? 0 : info->value);
+}
+
+/* binattr_set - set or replace binary attribute */
+
+BINATTR_INFO *binattr_set(BINATTR *table, const char *name, char *value, BINATTR_FREE_FN free_fn)
+{
+ BINATTR_INFO *info;
+
+ if ((info = (BINATTR_INFO *) htable_find(table, name)) != 0) {
+ if (info->value != value) {
+ if (info->free_fn)
+ info->free_fn(info->value);
+ info->value = value;
+ }
+ info->free_fn = free_fn;
+ } else {
+ info = (BINATTR_INFO *) mymalloc(sizeof(*info));
+ info->value = value;
+ info->free_fn = free_fn;
+ htable_enter(table, name, (char *) info);
+ }
+ return (info);
+}
+
+/* binattr_free_callback - destructor callback */
+
+static void binattr_free_callback(char *ptr)
+{
+ BINATTR_INFO *info = (BINATTR_INFO *) ptr;
+
+ if (info->free_fn)
+ info->free_fn(info->value);
+}
+
+/* binattr_unset - remove attribute */
+
+void binattr_unset(BINATTR *table, const char *name)
+{
+ htable_delete(table, name, binattr_free_callback);
+}
--- /dev/null
+#ifndef _BINATTR_H_INCLUDED_
+#define _BINATTR_H_INCLUDED_
+
+/*++
+/* NAME
+/* binattr 3h
+/* SUMMARY
+/* binary-valued attribute list manager
+/* SYNOPSIS
+/* #include <binattr.h>
+/* DESCRIPTION
+/* .nf
+
+ /* Structure of one hash table entry. */
+
+typedef void (*BINATTR_FREE_FN) (char *);
+
+typedef struct BINATTR_INFO {
+ char *key; /* lookup key */
+ char *value; /* associated value */
+ BINATTR_FREE_FN free_fn; /* destructor */
+} BINATTR_INFO;
+
+ /* Structure of one hash table. */
+
+typedef struct HTABLE BINATTR;
+
+extern BINATTR *binattr_create(int);
+extern void binattr_free(BINATTR *);
+extern char *binattr_get(BINATTR *, const char *);
+extern BINATTR_INFO *binattr_set(BINATTR *, const char *, char *, BINATTR_FREE_FN);
+extern void binattr_unset(BINATTR *, const char *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/* CREATION DATE
+/* Fri Feb 14 13:43:19 EST 1997
+/* LAST MODIFICATION
+/* %E% %U%
+/* VERSION/RELEASE
+/* %I%
+/*--*/
+
+#endif
/* System library. */
#include <sys/stat.h>
+#ifdef PATH_NDBM_H
+#include PATH_NDBM_H
+#else
#include <ndbm.h>
+#endif
#include <string.h>
#include <unistd.h>
/* void (*action)(HTABLE_INFO *, char *ptr);
/* char *ptr;
/*
-/* HTABLE_INFO *htable_list(table)
+/* HTABLE_INFO **htable_list(table)
/* HTABLE *table;
/* DESCRIPTION
/* This module maintains one or more hash tables. Each table entry
extern int read_wait(int, int);
extern int write_wait(int, int);
extern int write_buf(int, const char *, int, int);
+extern int timed_read(int, void *, unsigned, int);
+extern int timed_write(int, void *, unsigned, int);
extern void doze(unsigned);
extern int duplex_pipe(int *);
/* DESCRIPTION
/* .nf
- /* External interface. */
+ /*
+ * Utility library.
+ */
+#include <vstring.h>
+ /*
+ * External interface.
+ */
extern char *printable(char *, int);
extern char *lowercase(char *);
extern char *skipblanks(const char *);
#ifndef HAVE_BASENAME
extern char *basename(const char *);
#endif
+extern VSTRING *unescape(VSTRING *, const char *);
/* LICENSE
/* .ad
--- /dev/null
+/*++
+/* NAME
+/* timed_read 3
+/* SUMMARY
+/* read operation with pre-read timeout
+/* SYNOPSIS
+/* #include <iostuff.h>
+/*
+/* int timed_read(fd, buf, buf_len, timeout)
+/* int fd;
+/* void *buf;
+/* unsigned len;
+/* int timeout;
+/* DESCRIPTION
+/* timed_read() performs a read() operation when the specified
+/* descriptor becomes readable within a user-specified deadline.
+/*
+/* Arguments:
+/* .IP fd
+/* File descriptor in the range 0..FD_SETSIZE.
+/* .IP buf
+/* Read buffer pointer.
+/* .IP buf_len
+/* Read buffer size.
+/* .IP timeout
+/* The deadline in seconds. If this is <= 0, the deadline feature
+/* is disabled.
+/* DIAGNOSTICS
+/* When the operation does not complete within the deadline, the
+/* result value is -1, and errno is set to ETIMEDOUT.
+/* All other returns are identical to those of a read(2) operation.
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <unistd.h>
+
+/* Utility library. */
+
+#include "iostuff.h"
+
+/* timed_read - read with deadline */
+
+int timed_read(int fd, void *buf, unsigned len, int timeout)
+{
+
+ /*
+ * Wait for a limited amount of time for something to happen. If nothing
+ * happens, report an ETIMEDOUT error.
+ */
+ if (timeout > 0 && read_wait(fd, timeout) < 0)
+ return (-1);
+ else
+ return (read(fd, buf, len));
+}
--- /dev/null
+/*++
+/* NAME
+/* timed_write 3
+/* SUMMARY
+/* write operation with pre-write timeout
+/* SYNOPSIS
+/* #include <iostuff.h>
+/*
+/* int timed_write(fd, buf, buf_len, timeout)
+/* int fd;
+/* const void *buf;
+/* unsigned len;
+/* int timeout;
+/* DESCRIPTION
+/* timed_write() performs a write() operation when the specified
+/* descriptor becomes writable within a user-specified deadline.
+/*
+/* Arguments:
+/* .IP fd
+/* File descriptor in the range 0..FD_SETSIZE.
+/* .IP buf
+/* Write buffer pointer.
+/* .IP buf_len
+/* Write buffer size.
+/* .IP timeout
+/* The deadline in seconds. If this is <= 0, the deadline feature
+/* is disabled.
+/* DIAGNOSTICS
+/* When the operation does not complete within the deadline, the
+/* result value is -1, and errno is set to ETIMEDOUT.
+/* All other returns are identical to those of a write(2) operation.
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <unistd.h>
+
+/* Utility library. */
+
+#include "iostuff.h"
+
+/* timed_write - write with deadline */
+
+int timed_write(int fd, void *buf, unsigned len, int timeout)
+{
+
+ /*
+ * Wait for a limited amount of time for something to happen. If nothing
+ * happens, report an ETIMEDOUT error.
+ */
+ if (timeout > 0 && write_wait(fd, timeout) < 0)
+ return (-1);
+ else
+ return (write(fd, buf, len));
+}
--- /dev/null
+/*++
+/* NAME
+/* unescape 3
+/* SUMMARY
+/* translate C-like escape sequences
+/* SYNOPSIS
+/* #include <stringops.h>
+/*
+/* VSTRING *unescape(result, input)
+/* VSTRING *result;
+/* const char *input;
+/* DESCRIPTION
+/* unescape() translates C-like escape sequences in the null-terminated
+/* string \fIinput\fR and places the result in \fIresult\fR. The result
+/* is null-terminated.
+/*
+/* Escape sequences and their translations:
+/* .IP \ea
+/* Bell character.
+/* .IP \eb
+/* Backspace character.
+/* .IP \ef
+/* formfeed character.
+/* .IP \en
+/* newline character
+/* .IP \er
+/* Carriage-return character.
+/* .IP \et
+/* Horizontal tab character.
+/* .IP \ev
+/* Vertical tab character.
+/* .IP \e\e
+/* Backslash character.
+/* .IP \enum
+/* 8-bit character whose ASCII value is the 1..3 digit
+/* octal number \fInum\fR.
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <ctype.h>
+
+/* Utility library. */
+
+#include <vstring.h>
+#include <stringops.h>
+
+/* unescape - process escape sequences */
+
+VSTRING *unescape(VSTRING *result, const char *data)
+{
+ int ch;
+ int oval;
+ int i;
+
+#define UCHAR(cp) ((unsigned char *) (cp))
+#define ISOCTAL(ch) (ISDIGIT(ch) && (ch) != '8' && (ch) != '9')
+
+ VSTRING_RESET(result);
+
+ while ((ch = *UCHAR(data++)) != 0) {
+ if (ch == '\\') {
+ if ((ch = *UCHAR(data++)) == 0)
+ break;
+ switch (ch) {
+ case 'a': /* \a -> audible bell */
+ ch = '\a';
+ break;
+ case 'b': /* \b -> backspace */
+ ch = '\b';
+ break;
+ case 'f': /* \f -> formfeed */
+ ch = '\f';
+ break;
+ case 'n': /* \n -> newline */
+ ch = '\n';
+ break;
+ case 'r': /* \r -> carriagereturn */
+ ch = '\r';
+ break;
+ case 't': /* \t -> horizontal tab */
+ ch = '\t';
+ break;
+ case 'v': /* \v -> vertical tab */
+ ch = '\v';
+ break;
+ case '0': /* \nnn -> ASCII value */
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ for (oval = ch - '0', i = 0;
+ i < 2 && (ch = *UCHAR(data)) != 0 && ISOCTAL(ch);
+ i++, data++) {
+ oval = (oval << 3) | (ch - '0');
+ }
+ ch = oval;
+ break;
+ default: /* \any -> any */
+ break;
+ }
+ }
+ VSTRING_ADDCH(result, ch);
+ }
+ VSTRING_TERMINATE(result);
+ return (result);
+}
+
+#ifdef TEST
+
+#include <vstring_vstream.h>
+
+int main(int unused_argc, char **unused_argv)
+{
+ VSTRING *in = vstring_alloc(10);
+ VSTRING *out = vstring_alloc(10);
+
+ while (vstring_fgets_nonl(in, VSTREAM_IN)) {
+ unescape(out, vstring_str(in));
+ vstream_fwrite(VSTREAM_OUT, vstring_str(out), VSTRING_LEN(out));
+ }
+ vstream_fflush(VSTREAM_OUT);
+ exit(0);
+}
+
+#endif
--- /dev/null
+\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+\1\2\3\4\5\6\7\8\9
+\1234\2345\3456\4567
--- /dev/null
+0000000 007 \b c d e \f g h i j k l m \n o p
+ 007 010 143 144 145 014 147 150 151 152 153 154 155 012 157 160
+0000020 q \r s \t u 013 w x y z 001 002 003 004 005 006
+ 161 015 163 011 165 013 167 170 171 172 001 002 003 004 005 006
+0000040 007 8 9 S 4 234 5 345 6 . 7
+ 007 070 071 123 064 234 065 345 066 056 067
+0000053
*/
#define VBUF_FLAG_ERR (1<<0) /* some I/O error */
#define VBUF_FLAG_EOF (1<<1) /* end of data */
-#define VBUF_FLAG_BAD (VBUF_FLAG_ERR | VBUF_FLAG_EOF)
-#define VBUF_FLAG_FIXED (1<<2) /* fixed-size buffer */
+#define VBUF_FLAG_TIMEOUT (1<<2) /* timeout error */
+#define VBUF_FLAG_BAD (VBUF_FLAG_ERR | VBUF_FLAG_EOF | VBUF_FLAG_TIMEOUT)
+#define VBUF_FLAG_FIXED (1<<3) /* fixed-size buffer */
#define vbuf_error(v) ((v)->flags & VBUF_FLAG_ERR)
#define vbuf_eof(v) ((v)->flags & VBUF_FLAG_EOF)
+#define vbuf_timeout(v) ((v)->flags & VBUF_FLAG_TIMEOUT)
#define vbuf_clearerr(v) ((v)->flags &= ~VBUF_FLAG_BAD)
/*
/* int vstream_ferror(stream)
/* VSTREAM *stream;
/*
+/* int vstream_ftimeout(stream)
+/* VSTREAM *stream;
+/*
/* int vstream_feof(stream)
/* VSTREAM *stream;
/*
/* The following lists the names and the types of the corresponding
/* value arguments.
/* .IP "VSTREAM_CTL_READ_FN (int (*)(int, void *, unsigned))"
-/* The argument specifies an alternative for the read(2) function,
-/* for example, a read function that enforces a time limit.
+/* The argument specifies an alternative for the timed_read(3) function,
+/* for example, a read function that performs encryption.
/* .IP "VSTREAM_CTL_WRITE_FN (int (*)(int, void *, unsigned))"
-/* The argument specifies an alternative for the write(2) function,
-/* for example, a write function that enforces a time limit.
+/* The argument specifies an alternative for the timed_write(3) function,
+/* for example, a write function that performs encryption.
/* .IP "VSTREAM_CTL_PATH (char *)"
/* Updates the stored pathname of the specified stream. The pathname
/* is copied.
/* .IP "VSTREAM_CTL_WAITPID_FN (int (*)(pid_t, WAIT_STATUS_T *, int))"
/* A pointer to function that behaves like waitpid(). This information
/* is used by the vstream_pclose() routine.
+/* .IP "VSTREAM_CTL_TIMEOUT (int)
+/* The deadline for a descriptor to become readable in case of a read
+/* request, or writable in case of a write request. Specify a value
+/* <= 0 to disable deadlines.
/* .PP
/* vstream_fileno() gives access to the file handle associated with
/* a buffered stream. With streams that have separate read/write
/* with vstream_fopen() or with vstream_control(). The macro is
/* unsafe because it evaluates some arguments more than once.
/*
-/* vstream_ferror() (vstream_feof()) returns non-zero when a previous
-/* operation on the specified stream caused an error (end-of-file)
-/* condition.
+/* vstream_feof() returns non-zero when a previous operation on the
+/* specified stream caused an end-of-file condition.
+/*
+/* vstream_ferror() returns non-zero when a previous operation on the
+/* specified stream caused a non-EOF error condition, including timeout.
/*
-/* vstream_clearerr() resets the error and end-of-file indication of
-/* specified stream, and returns no useful result.
+/* vstream_ftimeout() returns non-zero when a previous operation on the
+/* specified stream caused a timeout error condition.
+/*
+/* vstream_clearerr() resets the timeout, error and end-of-file indication
+/* of the specified stream, and returns no useful result.
/*
/* vstream_vfprintf() provides an alternate interface
/* for formatting an argument list according to a format string.
/* DIAGNOSTICS
/* Panics: interface violations. Fatal errors: out of memory.
/* SEE ALSO
+/* timed_read(3) default read routine
+/* timed_write(3) default write routine
/* vbuf_print(3) formatting engine
/* BUGS
/* Should use mmap() on reasonable systems.
#include "mymalloc.h"
#include "msg.h"
#include "vbuf_print.h"
+#include "iostuff.h"
#include "vstring.h"
+#include "binattr.h"
#include "vstream.h"
/* Application-specific. */
0, /* flags */
0, 0, 0, 0, /* buffer */
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
- }, STDIN_FILENO, (VSTREAM_FN) read, (VSTREAM_FN) write,},
+ }, STDIN_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write,},
{{
0, /* flags */
0, 0, 0, 0, /* buffer */
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
- }, STDOUT_FILENO, (VSTREAM_FN) read, (VSTREAM_FN) write,},
+ }, STDOUT_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write,},
{{
VBUF_FLAG_FIXED | VSTREAM_FLAG_WRITE,
vstream_fstd_buf, VSTREAM_BUFSIZE, VSTREAM_BUFSIZE, vstream_fstd_buf,
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
- }, STDERR_FILENO, (VSTREAM_FN) read, (VSTREAM_FN) write,},
+ }, STDERR_FILENO, (VSTREAM_FN) timed_read, (VSTREAM_FN) timed_write,},
};
#define VSTREAM_STATIC(v) ((v) >= VSTREAM_IN && (v) <= VSTREAM_ERR)
* any.
*/
for (data = (char *) bp->data, len = to_flush; len > 0; len -= n, data += n) {
- if ((n = stream->write_fn(stream->fd, data, len)) <= 0) {
+ if ((n = stream->write_fn(stream->fd, data, len, stream->timeout)) <= 0) {
bp->flags |= VSTREAM_FLAG_ERR;
+ if (errno == ETIMEDOUT)
+ bp->flags |= VSTREAM_FLAG_TIMEOUT;
return (VSTREAM_EOF);
}
if (msg_verbose > 2 && stream != VSTREAM_ERR && n != to_flush)
* data as is available right now, whichever is less. Update the cached
* file seek position, if any.
*/
- switch (n = stream->read_fn(stream->fd, bp->data, bp->len)) {
+ switch (n = stream->read_fn(stream->fd, bp->data, bp->len, stream->timeout)) {
case -1:
bp->flags |= VSTREAM_FLAG_ERR;
+ if (errno == ETIMEDOUT)
+ bp->flags |= VSTREAM_FLAG_TIMEOUT;
return (VSTREAM_EOF);
case 0:
bp->flags |= VSTREAM_FLAG_EOF;
*/
stream = (VSTREAM *) mymalloc(sizeof(*stream));
stream->fd = fd;
- stream->read_fn = VSTREAM_CAN_READ(flags) ? (VSTREAM_FN) read : 0;
- stream->write_fn = VSTREAM_CAN_WRITE(flags) ? (VSTREAM_FN) write : 0;
+ stream->read_fn = VSTREAM_CAN_READ(flags) ? (VSTREAM_FN) timed_read : 0;
+ stream->write_fn = VSTREAM_CAN_WRITE(flags) ? (VSTREAM_FN) timed_write : 0;
vstream_buf_init(&stream->buf, flags);
stream->offset = 0;
stream->path = 0;
stream->pid = 0;
stream->waitpid_fn = 0;
+ stream->timeout = 0;
+ stream->attr = 0;
return (stream);
}
}
if (stream->path)
myfree(stream->path);
+ if (stream->attr)
+ binattr_free(stream->attr);
if (!VSTREAM_STATIC(stream))
myfree((char *) stream);
return (err ? VSTREAM_EOF : 0);
case VSTREAM_CTL_WAITPID_FN:
stream->waitpid_fn = va_arg(ap, VSTREAM_WAITPID_FN);
break;
+ case VSTREAM_CTL_TIMEOUT:
+ stream->timeout = va_arg(ap, int);
+ break;
default:
msg_panic("%s: bad name %d", myname, name);
}
* Utility library.
*/
#include <vbuf.h>
+#include <binattr.h>
/*
* Simple buffered stream. The members of this structure are not part of the
* official interface and can change without prior notice.
*/
-typedef int (*VSTREAM_FN) (int, void *, unsigned);
+typedef int (*VSTREAM_FN) (int, void *, unsigned, int);
typedef int (*VSTREAM_WAITPID_FN) (pid_t, WAIT_STATUS_T *, int);
typedef struct VSTREAM {
int write_fd; /* write channel (double-buffered) */
VBUF read_buf; /* read buffer (double-buffered) */
VBUF write_buf; /* write buffer (double-buffered) */
+ int timeout; /* read/write timout */
pid_t pid; /* vstream_popen/close() */
VSTREAM_WAITPID_FN waitpid_fn; /* vstream_popen/close() */
+ BINATTR *attr; /* optional binary attribute list */
} VSTREAM;
extern VSTREAM vstream_fstd[]; /* pre-defined streams */
#define VSTREAM_FLAG_ERR VBUF_FLAG_ERR /* some I/O error */
#define VSTREAM_FLAG_EOF VBUF_FLAG_EOF /* end of file */
+#define VSTREAM_FLAG_TIMEOUT VBUF_FLAG_TIMEOUT /* timeout error */
#define VSTREAM_FLAG_FIXED VBUF_FLAG_FIXED /* fixed-size buffer */
#define VSTREAM_FLAG_BAD VBUF_FLAG_BAD
#define vstream_fileno(vp) ((vp)->fd)
#define vstream_ferror(vp) vbuf_error(&(vp)->buf)
#define vstream_feof(vp) vbuf_eof(&(vp)->buf)
+#define vstream_ftimeout(vp) vbuf_timeout(&(vp)->buf)
#define vstream_clearerr(vp) vbuf_clearerr(&(vp)->buf)
#define VSTREAM_PATH(vp) ((vp)->path ? (vp)->path : "unknown_stream")
#define VSTREAM_CTL_READ_FD 5
#define VSTREAM_CTL_WRITE_FD 6
#define VSTREAM_CTL_WAITPID_FN 7
+#define VSTREAM_CTL_TIMEOUT 8
extern VSTREAM *vstream_printf(const char *,...);
extern VSTREAM *vstream_fprintf(VSTREAM *, const char *,...);
extern int vstream_peek(VSTREAM *);
+ /*
+ * Attribute management, a way of tacking on arbitrary information onto a
+ * VSTREAM without destroying the VSTREAM abstraction itself.
+ */
+#define VSTREAM_ATTR_FREE_FN BINATTR_FREE_FN
+
+extern void vstream_attr_set(VSTREAM *, const char *, char *, VSTREAM_ATTR_FREE_FN);
+extern char *vstream_attr_get(VSTREAM *, const char *);
+extern void vstream_attr_unset(VSTREAM *, const char *);
+
/* LICENSE
/* .ad
/* .fi
--- /dev/null
+/*++
+/* NAME
+/* vstream_attr 3
+/* SUMMARY
+/* per-stream attribute list management
+/* SYNOPSIS
+/* #include <vstream.h>
+/*
+/* void vstream_attr_set(stream, name, value, free_fn)
+/* VSTREAM *stream;
+/* const char *name;
+/* char *value;
+/* void (*free_fn)(char *);
+/*
+/* char *vstream_attr_get(stream, name)
+/* VSTREAM *stream;
+/* const char *name;
+/*
+/* void vstream_attr_unset(stream, name)
+/* VSTREAM *stream;
+/* const char *name;
+/* DESCRIPTION
+/* This module maintains an optional per-stream open attribute
+/* list for arbitrary binary values. It is in fact a convienience
+/* interface built on top of the binattr(3) module.
+/*
+/* vstream_attr_set() adds or replaces the named attribute.
+/*
+/* vstream_attr_get() looks up the named attribute. The result
+/* is the value stored with vstream_attr_set() or a null pointer
+/* when the requested information is not found.
+/*
+/* vstream_attr_unset() removes the named attribute. This operation
+/* is undefined for attributes that do not exist.
+/*
+/* Arguments:
+/* .IP stream
+/* Open VSTREAM.
+/* .IP name
+/* Attribute name, in the form of a null-terminated list.
+/* The name is copied.
+/* .IP value
+/* Arbitrary binary value. The value is not copied.
+/* .IP free_fn
+/* Null pointer, or pointer to function that destroys the value
+/* that was stored with vstream_attr_set().
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+
+/* Utility library. */
+
+#include <vstream.h>
+#include <htable.h>
+
+/* vstream_attr_set - add or replace per-stream attribute */
+
+void vstream_attr_set(VSTREAM *stream, const char *name, char *value, BINATTR_FREE_FN free_fn)
+{
+ if (stream->attr == 0)
+ stream->attr = binattr_create(1);
+ binattr_set(stream->attr, name, value, free_fn);
+}
+
+/* vstream_attr_get - look up per-stream attribute */
+
+char *vstream_attr_get(VSTREAM *stream, const char *name)
+{
+ if (stream->attr == 0)
+ return (0);
+ else
+ return (binattr_get(stream->attr, name));
+}
+
+/* vstream_attr_unset - unset per-stream attribute */
+
+void vstream_attr_unset(VSTREAM *stream, const char *name)
+{
+ if (stream->attr)
+ binattr_unset(stream->attr, name);
+}
+/*++
/* NAME
/* vstring 3
/* SUMMARY
/* VSTRING *vstring_alloc(len)
/* int len;
/*
+/* VSTRING *vstring_init(vp, buf, len)
+/* VSTRING *vp;
+/* char *buf;
+/* int len;
+/*
/* vstring_ctl(vp, type, value, ..., VSTRING_CTL_END)
/* VSTRING *vp;
/* int type;
/* of at least "len" bytes. The minimal length is 1. The result
/* is a null-terminated string of length zero.
/*
+/* vstring_init() initializes a fixed-size buffer. Attempts to
+/* allocate space beyond the buffer end cause the process to
+/* terminate with a fatal run-time error.
+/*
/* vstring_ctl() gives control over memory management policy.
/* The function takes a VSTRING pointer and a list of zero
/* or more (name,value) pairs. The expected valye type of the
#include <sys_defs.h>
#include <stddef.h>
-#include <stdlib.h> /* 44BSD stdarg.h uses abort() */
+#include <stdlib.h> /* 44BSD stdarg.h uses abort() */
#include <stdarg.h>
#include <string.h>
return (vp);
}
+/* vstring_fixed_get_ready - vbuf callback for read buffer empty condition */
+
+static int vstring_fixed_get_ready(VBUF *unused_buf)
+{
+ msg_panic("vstring_fixed_get: write-only buffer");
+}
+
+/* vstring_fixed_put_ready - vbuf callback for write buffer full condition */
+
+static int vstring_fixed_put_ready(VBUF *unused_bp)
+{
+ msg_fatal("fixed-size string buffer full");
+}
+
+/* vstring_fixed_space - vbuf callback to reserve space */
+
+static int vstring_fixed_space(VBUF *bp, int len)
+{
+ if (len < 0)
+ msg_panic("vstring_fixed_space: bad length %d", len);
+ if (len - bp->cnt > 0)
+ msg_fatal("fixed-size string buffer full");
+ return (0);
+}
+
+/* vstring_init - initialize fixed-length buffer */
+
+VSTRING *vstring_init(VSTRING *vp, char *buf, int len)
+{
+ if (len < 1)
+ msg_panic("vstring_init: bad length %d", len);
+ vp->vbuf.flags = 0;
+ vp->vbuf.data = (unsigned char *) buf;
+ vp->vbuf.len = len;
+ VSTRING_RESET(vp);
+ vp->vbuf.data[0] = 0;
+ vp->vbuf.get_ready = vstring_fixed_get_ready;
+ vp->vbuf.put_ready = vstring_fixed_put_ready;
+ vp->vbuf.space = vstring_fixed_space;
+ vp->maxlen = 0;
+ return (vp);
+}
+
/* vstring_free - destroy variable-length string */
VSTRING *vstring_free(VSTRING *vp)
int maxlen;
} VSTRING;
-extern void vstring_init(VSTRING *, int);
-extern void vstring_wipe(VSTRING *);
extern VSTRING *vstring_alloc(int);
+extern VSTRING *vstring_init(VSTRING *, char *, int);
extern void vstring_ctl(VSTRING *,...);
extern VSTRING *vstring_truncate(VSTRING *, int);
extern VSTRING *vstring_free(VSTRING *);