The branch, master has been updated via 229f544 testprogs: print architecture used in win32 spoolss testsuite. via a88a7c7 s3-dcerpc: no point for printing NDR twice for internal pipes in log level 10. via 0ff7e0c samba: share readline wrappers among all buildsystems. via 405b7d8 s3-readline: move cmd_history to smbclient, the only user. via b38d054 samba: share select wrappers. from 0adc164 s4-auth: fixed a vagrind error when creating keytabs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 229f5443b75d8de2b816c1ddc40d51a0a858e907 Author: Günther Deschner <g...@samba.org> Date: Fri Oct 1 20:37:45 2010 +0200 testprogs: print architecture used in win32 spoolss testsuite. Guenther commit a88a7c76de759aaad14c00263df1daeb49ee8533 Author: Günther Deschner <g...@samba.org> Date: Fri Oct 1 19:48:11 2010 +0200 s3-dcerpc: no point for printing NDR twice for internal pipes in log level 10. Guenther commit 0ff7e0c998bb4fbc67925be762b528ae6585c4f3 Author: Günther Deschner <g...@samba.org> Date: Fri Oct 1 10:34:14 2010 +0200 samba: share readline wrappers among all buildsystems. Guenther commit 405b7d843f9103a29e923892337472e0fd891037 Author: Günther Deschner <g...@samba.org> Date: Fri Oct 1 10:33:32 2010 +0200 s3-readline: move cmd_history to smbclient, the only user. Guenther commit b38d0542e193512796d5d9502ac8d688a1036157 Author: Günther Deschner <g...@samba.org> Date: Fri Oct 1 10:08:15 2010 +0200 samba: share select wrappers. Guenther ----------------------------------------------------------------------- Summary of changes: lib/util/config.mk | 3 +- {source3/lib => lib/util}/select.c | 19 +++++---- testsuite/smbd/sec_ctx1.c => lib/util/select.h | 36 ++++++---------- lib/util/wscript_build | 2 +- {source4/lib => libcli}/smbreadline/readline.m4 | 2 +- .../readline.c => libcli/smbreadline/smbreadline.c | 40 ++++++------------ {source4/lib => libcli}/smbreadline/smbreadline.h | 3 +- {source4/lib => libcli}/smbreadline/wscript_build | 0 .../lib => libcli}/smbreadline/wscript_configure | 0 source3/Makefile.in | 7 ++- source3/client/client.c | 23 ++++++++++ source3/include/proto.h | 15 ------- source3/lib/events.c | 1 + source3/lib/g_lock.c | 1 + source3/lib/packet.c | 1 + source3/lib/util_sock.c | 1 + source3/libsmb/nmblib.c | 1 + source3/nmbd/nmbd_packets.c | 1 + source3/rpc_server/rpc_ncacn_np.c | 2 +- source3/rpcclient/rpcclient.c | 1 + source3/smbd/process.c | 1 + source3/torture/vfstest.c | 1 + source3/utils/net_rpc_shell.c | 1 + source3/utils/smbfilter.c | 1 + source3/winbindd/winbindd_dual.c | 1 + source3/wscript | 1 + source3/wscript_build | 20 ++++----- source4/Makefile.in | 2 +- source4/client/client.c | 2 +- source4/configure.ac | 2 +- source4/lib/registry/tools/regshell.c | 2 +- source4/lib/smbreadline/smbreadline.c | 45 -------------------- source4/torture/shell.c | 2 +- source4/torture/smbtorture.c | 2 +- source4/wscript | 2 +- source4/wscript_build | 2 +- testprogs/win32/spoolss/testspoolss.c | 14 ++++-- 37 files changed, 109 insertions(+), 151 deletions(-) rename {source3/lib => lib/util}/select.c (97%) copy testsuite/smbd/sec_ctx1.c => lib/util/select.h (61%) rename {source4/lib => libcli}/smbreadline/readline.m4 (98%) rename source3/lib/readline.c => libcli/smbreadline/smbreadline.c (89%) rename {source4/lib => libcli}/smbreadline/smbreadline.h (71%) rename {source4/lib => libcli}/smbreadline/wscript_build (100%) rename {source4/lib => libcli}/smbreadline/wscript_configure (100%) Changeset truncated at 500 lines: diff --git a/lib/util/config.mk b/lib/util/config.mk index 0a5d62f..719f5f2 100644 --- a/lib/util/config.mk +++ b/lib/util/config.mk @@ -35,7 +35,8 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \ smb_threads.o \ params.o \ parmlist.o \ - util_id.o) + util_id.o + select.o) PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \ dlinklist.h \ diff --git a/source3/lib/select.c b/lib/util/select.c similarity index 97% rename from source3/lib/select.c rename to lib/util/select.c index 846e6af..61df649 100644 --- a/source3/lib/select.c +++ b/lib/util/select.c @@ -1,29 +1,32 @@ -/* +/* Unix SMB/Netbios implementation. Version 3.0 Samba select/poll implementation Copyright (C) Andrew Tridgell 1992-1998 - + 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 "includes.h" +#include "system/filesys.h" +#include "system/select.h" +#include "lib/util/select.h" -/* This is here because it allows us to avoid a nasty race in signal handling. +/* This is here because it allows us to avoid a nasty race in signal handling. We need to guarantee that when we get a signal we get out of a select immediately - but doing that involves a race condition. We can avoid the race by getting the - signal handler to write to a pipe that is in the select/poll list + but doing that involves a race condition. We can avoid the race by getting the + signal handler to write to a pipe that is in the select/poll list This means all Samba signal handlers should call sys_select_signal(). */ @@ -33,7 +36,7 @@ static int select_pipe[2]; static volatile unsigned pipe_written, pipe_read; /******************************************************************* - Call this from all Samba signal handlers if you want to avoid a + Call this from all Samba signal handlers if you want to avoid a nasty signal race condition. ********************************************************************/ diff --git a/testsuite/smbd/sec_ctx1.c b/lib/util/select.h similarity index 61% copy from testsuite/smbd/sec_ctx1.c copy to lib/util/select.h index a6e61d1..13c85ce 100644 --- a/testsuite/smbd/sec_ctx1.c +++ b/lib/util/select.h @@ -1,39 +1,29 @@ -/* +/* Unix SMB/Netbios implementation. - Version 1.9. - Security context tests - Copyright (C) Tim Potter 2000 - + Samba select/poll implementation + Copyright (C) Andrew Tridgell 1992-1998 + 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 "includes.h" - -void exit_server(char *reason) {} - -int main (int argc, char **argv) -{ - /* Become a non-root user */ - - setuid(1); - setgid(1); +#ifndef _select_h_ +#define _select_h_ - /* Try to push a security context. This should fail with a - smb_assert() error. */ +/* The following definitions come from lib/util/select.c */ - push_sec_ctx(2, 2); - printf("FAIL\n"); +void sys_select_signal(char c); +int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); +int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); - return 0; -} +#endif diff --git a/lib/util/wscript_build b/lib/util/wscript_build index 0da6ec5..457dee2 100644 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -1,7 +1,7 @@ #!/usr/bin/env python bld.SAMBA_LIBRARY('LIBSAMBA-UTIL', - source='xfile.c debug.c fault.c signal.c system.c time.c genrand.c dprintf.c util_str.c rfc1738.c substitute.c util_strlist.c util_file.c data_blob.c util.c blocking.c util_net.c fsusage.c ms_fnmatch.c mutex.c idtree.c become_daemon.c rbtree.c talloc_stack.c smb_threads.c params.c parmlist.c util_id.c', + source='xfile.c debug.c fault.c signal.c system.c time.c genrand.c dprintf.c util_str.c rfc1738.c substitute.c util_strlist.c util_file.c data_blob.c util.c blocking.c util_net.c fsusage.c ms_fnmatch.c mutex.c idtree.c become_daemon.c rbtree.c talloc_stack.c smb_threads.c params.c parmlist.c util_id.c select.c', public_deps='talloc LIBCRYPTO CHARSET execinfo UID_WRAPPER tevent', public_headers='attr.h byteorder.h data_blob.h debug.h memory.h mutex.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h util.h tevent_ntstatus.h tevent_unix.h', header_path= [ ('dlinklist.h util.h', '.'), ('*', 'util') ], diff --git a/source4/lib/smbreadline/readline.m4 b/libcli/smbreadline/readline.m4 similarity index 98% rename from source4/lib/smbreadline/readline.m4 rename to libcli/smbreadline/readline.m4 index 06d60ca..f450cac 100644 --- a/source4/lib/smbreadline/readline.m4 +++ b/libcli/smbreadline/readline.m4 @@ -63,7 +63,7 @@ AC_ARG_WITH(readline, # code will generate warnings on one of them unless we have a few # special cases. AC_CHECK_LIB(readline, rl_completion_matches, - [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1, + [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1, [Do we have rl_completion_matches?])], [], [$TERMLIBS]) diff --git a/source3/lib/readline.c b/libcli/smbreadline/smbreadline.c similarity index 89% rename from source3/lib/readline.c rename to libcli/smbreadline/smbreadline.c index 4b82291..f8441ac 100644 --- a/source3/lib/readline.c +++ b/libcli/smbreadline/smbreadline.c @@ -1,24 +1,31 @@ -/* +/* Unix SMB/CIFS implementation. Samba readline wrapper implementation Copyright (C) Simo Sorce 2001 Copyright (C) Andrew Tridgell 2001 - + 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 "includes.h" +#include "../lib/util/select.h" +#include "system/filesys.h" +#include "system/select.h" +#include "system/readline.h" +#include "libcli/smbreadline/smbreadline.h" + +#undef malloc #ifdef HAVE_LIBREADLINE # ifdef HAVE_READLINE_READLINE_H @@ -60,7 +67,7 @@ void smb_readline_done(void) Display the prompt and wait for input. Call callback() regularly ****************************************************************************/ -static char *smb_readline_replacement(const char *prompt, void (*callback)(void), +static char *smb_readline_replacement(const char *prompt, void (*callback)(void), char **(completion_fn)(const char *text, int start, int end)) { fd_set fds; @@ -75,7 +82,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void) x_fflush(x_stdout); } - line = (char *)SMB_MALLOC(BUFSIZ); + line = (char *)malloc(BUFSIZ); if (!line) { return NULL; } @@ -171,24 +178,3 @@ void smb_readline_ca_char(char c) rl_completion_append_character = c; #endif } - -/**************************************************************************** -history -****************************************************************************/ -int cmd_history(void) -{ -#if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST) - HIST_ENTRY **hlist; - int i; - - hlist = history_list(); - - for (i = 0; hlist && hlist[i]; i++) { - DEBUG(0, ("%d: %s\n", i, hlist[i]->line)); - } -#else - DEBUG(0,("no history without readline support\n")); -#endif - - return 0; -} diff --git a/source4/lib/smbreadline/smbreadline.h b/libcli/smbreadline/smbreadline.h similarity index 71% rename from source4/lib/smbreadline/smbreadline.h rename to libcli/smbreadline/smbreadline.h index cde2b47..102106f 100644 --- a/source4/lib/smbreadline/smbreadline.h +++ b/libcli/smbreadline/smbreadline.h @@ -1,9 +1,10 @@ #ifndef __SMBREADLINE_H__ #define __SMBREADLINE_H__ -char *smb_readline(const char *prompt, void (*callback)(void), +char *smb_readline(const char *prompt, void (*callback)(void), char **(completion_fn)(const char *text, int start, int end)); const char *smb_readline_get_line_buffer(void); void smb_readline_ca_char(char c); +void smb_readline_done(void); #endif /* __SMBREADLINE_H__ */ diff --git a/source4/lib/smbreadline/wscript_build b/libcli/smbreadline/wscript_build similarity index 100% rename from source4/lib/smbreadline/wscript_build rename to libcli/smbreadline/wscript_build diff --git a/source4/lib/smbreadline/wscript_configure b/libcli/smbreadline/wscript_configure similarity index 100% rename from source4/lib/smbreadline/wscript_configure rename to libcli/smbreadline/wscript_configure diff --git a/source3/Makefile.in b/source3/Makefile.in index 8a0364d..8be50fc 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -430,7 +430,8 @@ UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \ ../lib/util/become_daemon.o ../lib/util/system.o \ ../lib/util/tevent_unix.o ../lib/util/tevent_ntstatus.o \ ../lib/util/smb_threads.o ../lib/util/util_id.o \ - ../lib/util/blocking.o ../lib/util/rfc1738.o + ../lib/util/blocking.o ../lib/util/rfc1738.o \ + ../lib/util/select.o CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \ ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \ @@ -460,7 +461,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \ lib/util.o lib/util_names.o \ lib/util_sock.o lib/sock_exec.o lib/util_sec.o \ lib/substitute.o lib/dbwrap_util.o \ - lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \ + lib/ms_fnmatch.o lib/errmap_unix.o \ lib/tallocmsg.o lib/dmallocmsg.o \ libsmb/clisigning.o libsmb/smb_signing.o \ lib/iconv.o lib/pam_errors.o intl/lang_tdb.o \ @@ -480,7 +481,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \ LIB_DUMMY_OBJ = lib/dummysmbd.o lib/dummyroot.o LIB_NONSMBD_OBJ = $(LIB_OBJ) $(LIB_DUMMY_OBJ) -READLINE_OBJ = lib/readline.o +READLINE_OBJ = ../libcli/smbreadline/smbreadline.o # Also depends on $(SECRETS_OBJ) $(LIBSAMBA_OBJ) # Be sure to include them into your application diff --git a/source3/client/client.c b/source3/client/client.c index 86d64f6..a24b7e3 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -25,6 +25,9 @@ #include "popt_common.h" #include "client/client_proto.h" #include "../librpc/gen_ndr/cli_srvsvc.h" +#include "../lib/util/select.h" +#include "system/readline.h" +#include "../libcli/smbreadline/smbreadline.h" #ifndef REGISTER #define REGISTER 0 @@ -4005,6 +4008,26 @@ int cmd_iosize(void) return 0; } +/**************************************************************************** +history +****************************************************************************/ +static int cmd_history(void) +{ +#if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST) + HIST_ENTRY **hlist; + int i; + + hlist = history_list(); + + for (i = 0; hlist && hlist[i]; i++) { + DEBUG(0, ("%d: %s\n", i, hlist[i]->line)); + } +#else + DEBUG(0,("no history without readline support\n")); +#endif + + return 0; +} /* Some constants for completing filename arguments */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 866836f..7fb0a3d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -654,15 +654,6 @@ void privilege_set_free(PRIVILEGE_SET *priv_set); bool is_privileged_sid( const struct dom_sid *sid ); bool grant_all_privileges( const struct dom_sid *sid ); -/* The following definitions come from lib/readline.c */ - -void smb_readline_done(void); -char *smb_readline(const char *prompt, void (*callback)(void), - char **(completion_fn)(const char *text, int start, int end)); -const char *smb_readline_get_line_buffer(void); -void smb_readline_ca_char(char c); -int cmd_history(void); - /* The following definitions come from lib/recvfile.c */ ssize_t sys_recvfile(int fromfd, @@ -716,12 +707,6 @@ NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx, const struct security_descriptor *parent_ctr, bool container); -/* The following definitions come from lib/select.c */ - -void sys_select_signal(char c); -int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); -int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); - /* The following definitions come from lib/sendfile.c */ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); diff --git a/source3/lib/events.c b/source3/lib/events.c index 21a13b6..70a0d7c 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -20,6 +20,7 @@ #include "includes.h" #include <tevent_internal.h> +#include "../lib/util/select.h" /* * Return if there's something in the queue diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 2c06502..378e464 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -21,6 +21,7 @@ #include "g_lock.h" #include "librpc/gen_ndr/messaging.h" #include "ctdbd_conn.h" +#include "../lib/util/select.h" static NTSTATUS g_lock_force_unlock(struct g_lock_ctx *ctx, const char *name, struct server_id pid); diff --git a/source3/lib/packet.c b/source3/lib/packet.c index c131b97..fefb74a 100644 --- a/source3/lib/packet.c +++ b/source3/lib/packet.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "../lib/util/select.h" struct packet_context { int fd; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 2b33816..188e117 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -22,6 +22,7 @@ #include "includes.h" #include "memcache.h" #include "../lib/async_req/async_sock.h" +#include "../lib/util/select.h" /**************************************************************************** Get a port number in host byte order from a sockaddr_storage. diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 1c95d0e..943cbcb 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "../lib/util/select.h" static const struct opcode_names { const char *nmb_opcode_name; diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 2dd218a..5d5a67b 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -22,6 +22,7 @@ #include "includes.h" #include "nmbd/nmbd.h" +#include "../lib/util/select.h" extern int ClientNMB; extern int ClientDGRAM; diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c index cbf5248..b6cf58b 100644 --- a/source3/rpc_server/rpc_ncacn_np.c +++ b/source3/rpc_server/rpc_ncacn_np.c @@ -394,7 +394,7 @@ static void rpcint_bh_do_ndr_print(struct dcerpc_binding_handle *h, { void *struct_ptr = discard_const(_struct_ptr); - if (DEBUGLEVEL < 10) { + if (DEBUGLEVEL < 11) { return; } diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index a1faca7..b0412ef 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -27,6 +27,7 @@ #include "rpc_client/cli_lsarpc.h" #include "../librpc/gen_ndr/ndr_netlogon.h" #include "rpc_client/cli_netlogon.h" +#include "../libcli/smbreadline/smbreadline.h" enum pipe_auth_type_spnego { PIPE_AUTH_TYPE_SPNEGO_NONE = 0, diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 4db54f3..a484dfd 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -24,6 +24,7 @@ #include "librpc/gen_ndr/messaging.h" #include "../lib/async_req/async_sock.h" #include "ctdbd_conn.h" +#include "../lib/util/select.h" extern bool global_machine_password_needs_changing; diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 923b547..76025ee 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -26,6 +26,7 @@ #include "includes.h" #include "popt_common.h" #include "vfstest.h" +#include "../libcli/smbreadline/smbreadline.h" /* List to hold groups of commands */ static struct cmd_list { diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c -- Samba Shared Repository