The branch, v4-8-test has been updated via 300d52de7e5 s4:librpc: Fix installation of Samba via 96a229b0281 ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing via 02da215c104 ctdb: Initialize addr struct to zero before reparsing as IPV4 via aeba27d3a48 ctdb-common: Add fd argument to ctdb_connection_list_read() via cd5f1904032 ctdb-protocol: Avoid fgets in ctdb_connection_list_read via 2c89c388518 ctdb-common: Add line based I/O via 4a5868be3a9 s3:client: Fix smbspool device uri handling via e28dd0f95b3 s3:client: Make sure we work on a copy of the title via f284a5c10f7 s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups via f0f56e7e84f s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool via cc43f3cd3aa s3:script: Fix jobid check in test_smbspool.sh via c7e7ea8d953 ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT() via 7b52da5ecdc Send status to systemd on daemon start from d3e306433f7 lib:util: Move debug message for mkdir failing to log level 1
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-8-test - Log ----------------------------------------------------------------- commit 300d52de7e5ca115a9427b62c14bd20afc320015 Author: Andreas Schneider <a...@samba.org> Date: Wed Mar 20 11:09:21 2019 +0100 s4:librpc: Fix installation of Samba This breaks installation of Samba 4.10 on Fedora. https://bugzilla.samba.org/show_bug.cgi?id=13847 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> (cherry picked from commit bf469343f577e2d78df0e38d80e7976b351eaf0d) Autobuild-User(v4-8-test): Karolin Seeger <ksee...@samba.org> Autobuild-Date(v4-8-test): Tue Mar 26 12:30:35 UTC 2019 on sn-devel-144 commit 96a229b02812e3a989eb9b96f888e087d9e0969a Author: Martin Schwenke <mar...@meltin.net> Date: Thu Mar 14 16:32:02 2019 +1100 ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing ctdb_sock_addr values are hashed in some contexts. This means that all of the memory used for the ctdb_sock_addr should be consistent regardless of how parsing is done. The first 2 cases are just sanity checks but the 3rd case involving an IPv4-mapped IPv6 address is the real target of this test addition. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@samba.org> (cherry picked from commit d9286701cd9253bf3b42cac3d850ae8c23743e6d) commit 02da215c10422d28fbe8646f5dca07448c12d7e1 Author: Zhu Shangzhong <zhu.shangzh...@zte.com.cn> Date: Tue Mar 12 20:49:48 2019 +0800 ctdb: Initialize addr struct to zero before reparsing as IPV4 Failed to kill the tcp connection that using IPv4-mapped IPv6 address (e.g. ctdb_killtcp eth0 ::ffff:192.168.200.44:2049 ::ffff:192.168.200.45:863). When the ctdb_killtcp is used to kill the tcp connection, the IPs and ports in the connection will be parsed to conn.client and conn.server (call stack: main->ctdb_sock_addr_from_string->ip_from_string). In the ip_from_string, as we are using IPv4-mapped IPv6 addresses, the ipv6_from_string will be used to parse ip to addr.ip6 first. The next step the ipv4_from_string will be used to reparse ip to addr.ip. As a result, the data that dump from conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 44 0 0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 255 255 192 168 200 45 0 0 0 0". The connection will be add to conn_list by ctdb_connection_list_add. Then the reset_connections_send uses conn_list as parameter to start to reset connections in the conn_list. In the reset_connections_send, the database "connections" will be created. The connections from conn_list will be written to the database(call db_hash_add), and use the data that dump from conn_client and conn_server as key. In the reset_connections_capture_tcp_handler, the ctdb_sys_read_tcp_packet will receive data on the raw socket. And extract the IPs and ports from the tcp packet. when extracting IP and port, the tcp4_extract OR tcp6_extract will be used. Then we got the new conn.client and conn.server. the data that dump from the conn.server is "2 0 8 1 192 168 200 44 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", the data from conn.client is "2 0 3 95 192 168 200 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0". Finally, we use the data as key to check if this connection is one being reset(call db_hash_delete). The db_hash_delete will return ENOENT. Because the two key that being used by db_hash_delete and db_hash_add are different. So, the TCP RST will be NOT sent for the connection forever. We should initialize addr struct to zero before reparsing as IPV4 in the ip_from_string. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839 Signed-off-by: Zhu Shangzhong <zhu.shangzh...@zte.com.cn> Reviewed-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@samba.org> (cherry picked from commit 539b5ff32b32b7c75dfaaa119e41f5af6ff1e6fc) commit aeba27d3a48fc4bbe06cf2f0d646711f7fb86d31 Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Jul 18 19:00:42 2018 +1000 ctdb-common: Add fd argument to ctdb_connection_list_read() This makes testing easier. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> (cherry picked from commit 3bf753e830c20183ef4f3278880d3be362e53bef) commit cd5f1904032e9fcb62ad8094addc841a6b9cb73a Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Jul 11 18:35:46 2018 +1000 ctdb-protocol: Avoid fgets in ctdb_connection_list_read C library buffering API can behave in unexpected fashion if underlying fd for stdin, stdout or stderr is closed and re-opened. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> (cherry picked from commit c9b42d27e6cf9e6ae36f44970f0a388edc737a7a) commit 2c89c38851874637e1a7c92ce913427279b1cbe6 Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Jul 18 18:42:10 2018 +1000 ctdb-common: Add line based I/O BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <ami...@gmail.com> Reviewed-by: Martin Schwenke <mar...@meltin.net> (cherry picked from commit c7041b0faf490661818244dd032ad413ce906e5c) commit 4a5868be3a9b15ed83731a31d42fbd3c5b11678a Author: Andreas Schneider <a...@samba.org> Date: Tue Mar 12 11:40:30 2019 +0100 s3:client: Fix smbspool device uri handling If we are executed as a CUPS backend, argv[0] is set to the device uri. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Bryan Mason <bma...@redhat.com> Signed-off-by: Guenther Deschner <g...@samba.org> (cherry picked from commit 69d7a496d3bf52eaa10e81132bb61430863fdd8a) commit e28dd0f95b307fcbff2f06f73eb5fe7293b3c24c Author: Andreas Schneider <a...@samba.org> Date: Tue Mar 12 10:09:14 2019 +0100 s3:client: Make sure we work on a copy of the title We can't be sure we can write to the input buffer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Bryan Mason <bma...@redhat.com> Signed-off-by: Guenther Deschner <g...@samba.org> (cherry picked from commit 129ae27946318a075e99c9e6d1bacf8963f72282) commit f284a5c10f7c8df63f1303f8aa695ec09f7ea711 Author: Andreas Schneider <a...@samba.org> Date: Fri Jan 4 09:21:24 2019 +0100 s3:client: Evaluate the AUTH_INFO_REQUIRED variable set by cups This should not switch to username,password if cups has been configured to use negotiate (Kerberos authentication). BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Bryan Mason <bma...@redhat.com> Signed-off-by: Guenther Deschner <g...@samba.org> (cherry picked from commit 5274b09fbaa5e45cc58f3301818d4e9f6a402845) commit f0f56e7e84f44a6336dd9aef2d57bfbdb9c89347 Author: Andreas Schneider <a...@samba.org> Date: Tue Mar 12 09:40:58 2019 +0100 s3:client: Pass DEVICE_URI and AUTH_INFO_REQUIRED env to smbspool BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Bryan Mason <bma...@redhat.com> Signed-off-by: Guenther Deschner <g...@samba.org> (cherry picked from commit 43160184d254a57f87bb2adeba47f48d8539533a) commit cc43f3cd3aa4ba7a85a8deaaf04058bc57e3c588 Author: Andreas Schneider <a...@samba.org> Date: Tue Mar 12 10:15:05 2019 +0100 s3:script: Fix jobid check in test_smbspool.sh BUG: https://bugzilla.samba.org/show_bug.cgi?id=13832 Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Bryan Mason <bma...@redhat.com> Signed-off-by: Guenther Deschner <g...@samba.org> (cherry picked from commit fad5e4eaeb9202c1b63c42ea09254c17c473e33a) commit c7e7ea8d9539ce8bd37887092aa8130642969154 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Mar 1 15:48:18 2019 +0100 ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT() BUG: https://bugzilla.samba.org/show_bug.cgi?id=13818 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Reviewed-by: Björn Jacke <bja...@samba.org> Reviewed-by: Günther Deschner <g...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Garming Sam <garm...@catalyst.net.nz> (cherry picked from commit 6da3664f8a11397fd3fb38e89c2432b8bf321e59) commit 7b52da5ecdc43c2876e0e500302a8590714b0c95 Author: Marcos Mello <marcos...@gmail.com> Date: Fri Nov 30 09:25:07 2018 -0200 Send status to systemd on daemon start systemd service files run in no-forking mode (--foreground) since 8b6f58194da7e849cdb9d20712dff49b17a93a77. Rearrange sd_notify() call in become_daemon() to only send status to systemd in this mode (Type=notify is not designed to monitor forking). Drop READY=0 (it does nothing) and MAINPID= (unnecessary because the process spawned by systemd is already the main PID). Also remove STATUS= prefix from debug messages. Signed-off-by: Marcos Mello <marcos...@gmail.com> Reviewed-by: Andreas Schneider <a...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> (cherry picked from commit 440ddf8470b11a46066d282bf8945201d547c192) BUG: https://bugzilla.samba.org/show_bug.cgi?id=11568 ----------------------------------------------------------------------- Summary of changes: ctdb/common/line.c | 145 ++++++++++++++++++++++++++++ ctdb/common/line.h | 62 ++++++++++++ ctdb/protocol/protocol_util.c | 91 +++++++++++------- ctdb/protocol/protocol_util.h | 4 +- ctdb/tests/cunit/line_test_001.sh | 90 +++++++++++++++++ ctdb/tests/src/line_test.c | 102 ++++++++++++++++++++ ctdb/tests/src/protocol_util_test.c | 37 ++++--- ctdb/tools/ctdb.c | 6 +- ctdb/tools/ctdb_killtcp.c | 2 +- ctdb/wscript | 9 +- lib/util/become_daemon.c | 18 ++-- librpc/ndr/ndr_spoolss_buf.c | 4 +- source3/client/smbspool.c | 170 ++++++++++++++++++++++++--------- source3/client/smbspool_krb5_wrapper.c | 24 ++++- source3/script/tests/test_smbspool.sh | 4 +- source4/librpc/wscript_build | 8 -- 16 files changed, 651 insertions(+), 125 deletions(-) create mode 100644 ctdb/common/line.c create mode 100644 ctdb/common/line.h create mode 100755 ctdb/tests/cunit/line_test_001.sh create mode 100644 ctdb/tests/src/line_test.c Changeset truncated at 500 lines: diff --git a/ctdb/common/line.c b/ctdb/common/line.c new file mode 100644 index 00000000000..c4c6726875b --- /dev/null +++ b/ctdb/common/line.c @@ -0,0 +1,145 @@ +/* + Line based I/O over fds + + Copyright (C) Amitay Isaacs 2018 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "replace.h" + +#include <talloc.h> + +#include "lib/util/sys_rw.h" + +#include "common/line.h" + +struct line_read_state { + line_process_fn_t callback; + void *private_data; + char *buf; + size_t hint, len, offset; + int num_lines; +}; + +static bool line_read_one(char *buf, size_t start, size_t len, size_t *pos) +{ + size_t i; + + for (i=start; i<len; i++) { + if (buf[i] == '\n' || buf[i] == '\0') { + *pos = i; + return true; + } + } + + return false; +} + +static int line_read_process(struct line_read_state *state) +{ + size_t start = 0; + size_t pos = 0; + + while (1) { + int ret; + bool ok; + + ok = line_read_one(state->buf, start, state->offset, &pos); + if (! ok) { + break; + } + + state->buf[pos] = '\0'; + state->num_lines += 1; + + ret = state->callback(state->buf + start, state->private_data); + if (ret != 0) { + return ret; + } + + start = pos+1; + } + + if (pos > 0) { + if (pos+1 < state->offset) { + memmove(state->buf, + state->buf + pos+1, + state->offset - (pos+1)); + } + state->offset -= (pos+1); + } + + return 0; +} + +int line_read(int fd, + size_t length, + TALLOC_CTX *mem_ctx, + line_process_fn_t callback, + void *private_data, + int *num_lines) +{ + struct line_read_state state; + + if (length < 32) { + length = 32; + } + + state = (struct line_read_state) { + .callback = callback, + .private_data = private_data, + .hint = length, + }; + + while (1) { + ssize_t n; + int ret; + + if (state.offset == state.len) { + state.len += state.hint; + state.buf = talloc_realloc_size(mem_ctx, + state.buf, + state.len); + if (state.buf == NULL) { + return ENOMEM; + } + } + + n = sys_read(fd, + state.buf + state.offset, + state.len - state.offset); + if (n < 0) { + return errno; + } + if (n == 0) { + break; + } + + state.offset += n; + + ret = line_read_process(&state); + if (ret != 0) { + if (num_lines != NULL) { + *num_lines = state.num_lines; + } + return ret; + } + } + + if (num_lines != NULL) { + *num_lines = state.num_lines; + } + return 0; +} diff --git a/ctdb/common/line.h b/ctdb/common/line.h new file mode 100644 index 00000000000..6b67f1e92e1 --- /dev/null +++ b/ctdb/common/line.h @@ -0,0 +1,62 @@ +/* + Line based I/O over fds + + Copyright (C) Amitay Isaacs 2018 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __CTDB_LINE_H__ +#define __CTDB_LINE_H__ + +#include <talloc.h> + +/** + * @file line.h + * + * @brief Line based I/O over pipes and sockets + */ + +/** + * @brief The callback routine called to process a line + * + * @param[in] line The line read + * @param[in] private_data Private data for callback + * @return 0 to continue processing lines, non-zero to stop reading + */ +typedef int (*line_process_fn_t)(char *line, void *private_data); + +/** + * @brief Read a line (terminated by \n or \0) + * + * If there is any read error on fd, then errno will be returned. + * If callback function returns a non-zero value, then that value will be + * returned. + * + * @param[in] fd The file descriptor + * @param[in] length The expected length of a line (this is only a hint) + * @param[in] mem_ctx Talloc memory context + * @param[in] callback Callback function called when a line is read + * @param[in] private_data Private data for callback + * @param[out] num_lines Number of lines read so far + * @return 0 on on success, errno on failure + */ +int line_read(int fd, + size_t length, + TALLOC_CTX *mem_ctx, + line_process_fn_t callback, + void *private_data, + int *num_lines); + +#endif /* __CTDB_LINE_H__ */ diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index c75555fa734..a46cde9f46f 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -22,6 +22,8 @@ #include <talloc.h> +#include "common/line.h" + #include "protocol.h" #include "protocol_util.h" @@ -249,6 +251,9 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr) if (memcmp(&addr->ip6.sin6_addr.s6_addr[0], ipv4_mapped_prefix, sizeof(ipv4_mapped_prefix)) == 0) { + /* Initialize addr struct to zero before reparsing as IPV4 */ + ZERO_STRUCTP(addr); + /* Reparse as IPv4 */ ret = ipv4_from_string(p+1, &addr->ip); } @@ -603,56 +608,68 @@ const char *ctdb_connection_list_to_string( return out; } -int ctdb_connection_list_read(TALLOC_CTX *mem_ctx, bool client_first, - struct ctdb_connection_list **conn_list) -{ +struct ctdb_connection_list_read_state { struct ctdb_connection_list *list; - char line[128]; /* long enough for IPv6 */ + bool client_first; +}; + +static int ctdb_connection_list_read_line(char *line, void *private_data) +{ + struct ctdb_connection_list_read_state *state = + (struct ctdb_connection_list_read_state *)private_data; + struct ctdb_connection conn; int ret; - if (conn_list == NULL) { - return EINVAL; + /* Skip empty lines */ + if (line[0] == '\0') { + return 0; } - list = talloc_zero(mem_ctx, struct ctdb_connection_list); - if (list == NULL) { - return ENOMEM; + /* Comment */ + if (line[0] == '#') { + return 0; } - while (fgets(line, sizeof(line), stdin) != NULL) { - char *t; - struct ctdb_connection conn; + ret = ctdb_connection_from_string(line, state->client_first, &conn); + if (ret != 0) { + return ret; + } - /* Skip empty lines */ - if (line[0] == '\n') { - continue; - } + ret = ctdb_connection_list_add(state->list, &conn); + if (ret != 0) { + return ret; + } - /* Comment */ - if (line[0] == '#') { - continue; - } + return 0; +} - t = strtok(line, "\n"); - if (t == NULL) { - goto fail; - } +int ctdb_connection_list_read(TALLOC_CTX *mem_ctx, + int fd, + bool client_first, + struct ctdb_connection_list **conn_list) +{ + struct ctdb_connection_list_read_state state; + int ret; - ret = ctdb_connection_from_string(t, client_first, &conn); - if (ret != 0) { - goto fail; - } + if (conn_list == NULL) { + return EINVAL; + } - ret = ctdb_connection_list_add(list, &conn); - if (ret != 0) { - goto fail; - } + state.list = talloc_zero(mem_ctx, struct ctdb_connection_list); + if (state.list == NULL) { + return ENOMEM; } - *conn_list = list; - return 0; + state.client_first = client_first; + + ret = line_read(fd, + 128, + mem_ctx, + ctdb_connection_list_read_line, + &state, + NULL); -fail: - talloc_free(list); - return EINVAL; + *conn_list = state.list; + + return ret; } diff --git a/ctdb/protocol/protocol_util.h b/ctdb/protocol/protocol_util.h index 66a49136576..347fe8a275a 100644 --- a/ctdb/protocol/protocol_util.h +++ b/ctdb/protocol/protocol_util.h @@ -66,7 +66,9 @@ int ctdb_connection_list_sort(struct ctdb_connection_list *conn_list); const char *ctdb_connection_list_to_string( TALLOC_CTX *mem_ctx, struct ctdb_connection_list *conn_list, bool client_first); -int ctdb_connection_list_read(TALLOC_CTX *mem_ctx, bool client_first, +int ctdb_connection_list_read(TALLOC_CTX *mem_ctx, + int fd, + bool client_first, struct ctdb_connection_list **conn_list); #endif /* __CTDB_PROTOCOL_UTIL_H__ */ diff --git a/ctdb/tests/cunit/line_test_001.sh b/ctdb/tests/cunit/line_test_001.sh new file mode 100755 index 00000000000..991d01a24e7 --- /dev/null +++ b/ctdb/tests/cunit/line_test_001.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +tfile="${TEST_VAR_DIR}/line.$$" + +remove_files () +{ + rm -f "$tfile" +} + +test_cleanup remove_files + +> "$tfile" + +ok_null +unit_test line_test "$tfile" + +printf "\0" > "$tfile" + +required_result 1 <<EOF + +EOF + +unit_test line_test "$tfile" + +echo -n "hello" > "$tfile" + +ok_null +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +hello +world +EOF + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +required_result 2 << EOF +hello +world +EOF +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +This is a really long long line full of random words and hopefully it will be read properly by the line test program and identified as a single line +EOF + +required_result 1 <<EOF +This is a really long long line full of random words and hopefully it will be read properly by the line test program and identified as a single line +EOF +unit_test line_test "$tfile" + +cat <<EOF > "$tfile" +line number one +line number two +line number one +line number two +line number one +EOF + +required_result 5 <<EOF +line number one +line number two +line number one +line number two +line number one +EOF +unit_test line_test "$tfile" 64 + +cat <<EOF > "$tfile" +this is line number one +this is line number two +this is line number three +this is line number four +this is line number five +EOF + +required_result 5 <<EOF +this is line number one +this is line number two +this is line number three +this is line number four +this is line number five +EOF +unit_test line_test "$tfile" 64 diff --git a/ctdb/tests/src/line_test.c b/ctdb/tests/src/line_test.c new file mode 100644 index 00000000000..0c5a8211392 --- /dev/null +++ b/ctdb/tests/src/line_test.c @@ -0,0 +1,102 @@ +/* + Test code for line based I/O over fds + + Copyright (C) Amitay Isaacs 2018 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "replace.h" +#include "system/filesys.h" + +#include <talloc.h> +#include <assert.h> + +#include "common/line.c" + +static int line_print(char *line, void *private_data) +{ + printf("%s\n", line); + fflush(stdout); + + return 0; +} + -- Samba Shared Repository