On Mon, Feb 23, 2015 at 04:33:53PM -0800, Tim Rice wrote: > On Tue, 24 Feb 2015, Damien Miller wrote: > > > On Mon, 23 Feb 2015, Peter Stuge wrote: > > > > > Darren Tucker wrote: > > > > Question is: what to do? > > > > c) make packet_disconnect a real function. > > > > > > I say c. > > > > yeah, stick it in opacket.c > > packet_send_debug too. Yeah, ran in to that too. OKs? diff --git a/opacket.c b/opacket.c index dd443c3..ba10085 100644 --- a/opacket.c +++ b/opacket.c @@ -319,3 +319,27 @@ packet_read_expect(int expected_type) if ((r = ssh_packet_read_expect(active_state, expected_type)) != 0) sshpkt_fatal(active_state, __func__, r); } + +void +packet_disconnect(const char *fmt, ...) +{ + char buf[1024]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + ssh_packet_disconnect(active_state, "%s", buf); +} + +void +packet_send_debug(const char *fmt,...) +{ + char buf[1024]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + ssh_packet_send_debug(active_state, "%s", buf); +} diff --git a/opacket.h b/opacket.h index 16fcb9e..3e4d75e 100644 --- a/opacket.h +++ b/opacket.h @@ -102,10 +102,12 @@ void packet_read_expect(int expected_type); ssh_packet_get_string_ptr(active_state, (length_ptr)) #define packet_get_cstring(length_ptr) \ ssh_packet_get_cstring(active_state, (length_ptr)) -#define packet_send_debug(fmt, args...) \ - ssh_packet_send_debug(active_state, (fmt), ##args) -#define packet_disconnect(fmt, args...) \ - ssh_packet_disconnect(active_state, (fmt), ##args) +void packet_send_debug(const char *, ...) + __attribute__((format(printf, 1, 2))) + __attribute__((noreturn)); +void packet_disconnect(const char *, ...) + __attribute__((format(printf, 1, 2))) + __attribute__((noreturn)); #define packet_have_data_to_write() \ ssh_packet_have_data_to_write(active_state) #define packet_not_very_much_data_to_write() \ -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement. _______________________________________________ openssh-unix-dev mailing list openssh-unix-dev@xxxxxxxxxxx https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev