From 46aa296cc94933082dbb4b9b2b1ed210a600ad2d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 29 Dec 2005 23:14:33 +0000 Subject: r12592: Remove some useless dependencies (This used to be commit ca8db1a0cd77682ac2c6dc4718f5d753a4fcc4db) --- source4/auth/config.mk | 1 + source4/auth/credentials/config.mk | 2 +- source4/auth/gensec/config.mk | 4 +- source4/client/config.mk | 7 +- source4/dsdb/config.mk | 3 +- source4/dsdb/samdb/cracknames.c | 3 +- source4/gtk/config.mk | 8 +- source4/lib/basic.mk | 9 +- source4/lib/cmdline/config.m4 | 96 -------------------- source4/lib/cmdline/config.mk | 14 +-- source4/lib/cmdline/getsmbpass.c | 158 --------------------------------- source4/lib/cmdline/popt_common.c | 88 +----------------- source4/lib/cmdline/popt_credentials.c | 115 ++++++++++++++++++++++++ source4/lib/cmdline/readline.c | 119 ------------------------- source4/lib/ldb/config.mk | 2 +- source4/lib/registry/config.mk | 8 +- source4/lib/replace/README | 2 + source4/lib/replace/config.m4 | 3 + source4/lib/replace/config.mk | 4 +- source4/lib/replace/getpass.c | 158 +++++++++++++++++++++++++++++++++ source4/lib/replace/getpass.m4 | 15 ++++ source4/lib/replace/readline.c | 119 +++++++++++++++++++++++++ source4/lib/replace/readline.m4 | 72 +++++++++++++++ source4/lib/socket/config.mk | 1 + source4/libcli/config.mk | 6 +- source4/libcli/ldap/config.mk | 3 +- source4/libcli/security/config.mk | 21 +---- source4/librpc/config.mk | 18 ++-- source4/param/config.mk | 1 + source4/scripting/ejs/config.mk | 5 +- source4/smbd/config.mk | 5 +- source4/torture/config.mk | 18 ++-- source4/torture/torture.c | 1 + source4/utils/config.mk | 20 ++--- source4/utils/ndrdump.c | 2 +- source4/utils/net/config.mk | 7 +- 36 files changed, 570 insertions(+), 548 deletions(-) delete mode 100644 source4/lib/cmdline/config.m4 delete mode 100644 source4/lib/cmdline/getsmbpass.c create mode 100644 source4/lib/cmdline/popt_credentials.c delete mode 100644 source4/lib/cmdline/readline.c create mode 100644 source4/lib/replace/getpass.c create mode 100644 source4/lib/replace/getpass.m4 create mode 100644 source4/lib/replace/readline.c create mode 100644 source4/lib/replace/readline.m4 diff --git a/source4/auth/config.mk b/source4/auth/config.mk index b24aea836a..d8fc9a8ddf 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -74,5 +74,6 @@ OBJ_FILES = \ auth_sam_reply.o \ ntlm_check.o \ auth_simple.o +REQUIRED_SUBSYSTEMS = LIB_SECURITY # End SUBSYSTEM AUTH ####################### diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk index db36b01334..f0e5ea3f21 100644 --- a/source4/auth/credentials/config.mk +++ b/source4/auth/credentials/config.mk @@ -8,7 +8,7 @@ OBJ_FILES = credentials.o \ credentials_ntlm.o \ credentials_gensec.o REQUIRED_SUBSYSTEMS = \ - HEIMDAL GENSEC + HEIMDAL GENSEC LIBCLI_AUTH LIBLDB # End SUBSYSTEM CREDENTIALS ################################# diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk index 54b082bda0..cfeab402a6 100644 --- a/source4/auth/gensec/config.mk +++ b/source4/auth/gensec/config.mk @@ -10,7 +10,7 @@ PRIVATE_PROTO_HEADER = gensec_proto.h INIT_FUNCTION = gensec_init OBJ_FILES = gensec.o REQUIRED_SUBSYSTEMS = \ - SCHANNELDB + SCHANNELDB CREDENTIALS # End SUBSYSTEM GENSEC ################################# @@ -51,7 +51,7 @@ SUBSYSTEM = GENSEC INIT_FUNCTION = gensec_schannel_init OBJ_FILES = schannel.o \ schannel_sign.o -REQUIRED_SUBSYSTEMS = AUTH SCHANNELDB +REQUIRED_SUBSYSTEMS = AUTH SCHANNELDB NDR_SCHANNEL # End MODULE gensec_schannel ################################################ diff --git a/source4/client/config.mk b/source4/client/config.mk index f263edf8d1..2cf5dbb80a 100644 --- a/source4/client/config.mk +++ b/source4/client/config.mk @@ -8,10 +8,13 @@ OBJ_FILES = \ client.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ + LIBREADLINE \ LIBBASIC \ LIBSMB \ RPC_NDR_SRVSVC \ - LIBCLI_LSA + LIBCLI_LSA \ + LIBPOPT \ + POPT_SAMBA \ + POPT_CREDENTIALS # End BINARY smbclient ################################# diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk index b691a45f21..d7188e43b5 100644 --- a/source4/dsdb/config.mk +++ b/source4/dsdb/config.mk @@ -6,13 +6,12 @@ include samdb/ldb_modules/config.mk # Start SUBSYSTEM SAMDB [SUBSYSTEM::SAMDB] PRIVATE_PROTO_HEADER = samdb/samdb.h +REQUIRED_SUBSYSTEMS = DB_WRAP OBJ_FILES = \ samdb/samdb.o \ samdb/samdb_privilege.o \ samdb/cracknames.o \ common/flag_mapping.o -REQUIRED_SUBSYSTEMS = \ - DCERPC_COMMON # # End SUBSYSTEM SAMDB ################################################ diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index b5479e89be..6c9739f245 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -24,9 +24,8 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_drsuapi.h" -#include "rpc_server/dcerpc_server.h" -#include "rpc_server/common/common.h" #include "rpc_server/drsuapi/dcesrv_drsuapi.h" +#include "rpc_server/common/common.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "system/kerberos.h" diff --git a/source4/gtk/config.mk b/source4/gtk/config.mk index 5ae5f89832..dfd42a174e 100644 --- a/source4/gtk/config.mk +++ b/source4/gtk/config.mk @@ -22,7 +22,7 @@ REQUIRED_SUBSYSTEMS = CHARSET LIBBASIC EXT_LIB_gtk RPC_NDR_SAMR [BINARY::gregedit] INSTALLDIR = BINDIR OBJ_FILES = tools/gregedit.o -REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE REGISTRY GTKSMB +REQUIRED_SUBSYSTEMS = CONFIG REGISTRY GTKSMB MANPAGE = man/gregedit.1 # End BINARY gregedit ################################################ @@ -32,7 +32,7 @@ MANPAGE = man/gregedit.1 [BINARY::gepdump] INSTALLDIR = BINDIR OBJ_FILES = tools/gepdump.o -REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE GTKSMB RPC_NDR_EPMAPPER RPC_NDR_MGMT +REQUIRED_SUBSYSTEMS = CONFIG GTKSMB RPC_NDR_EPMAPPER RPC_NDR_MGMT # End BINARY gepdump ################################################ @@ -41,7 +41,7 @@ REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE GTKSMB RPC_NDR_EPMAPPER RPC_NDR_MGMT [BINARY::gwcrontab] INSTALLDIR = BINDIR OBJ_FILES = tools/gwcrontab.o -REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE GTKSMB RPC_NDR_ATSVC +REQUIRED_SUBSYSTEMS = CONFIG GTKSMB RPC_NDR_ATSVC # End BINARY gwcrontab ################################################ @@ -50,6 +50,6 @@ REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE GTKSMB RPC_NDR_ATSVC [BINARY::gwsam] INSTALLDIR = BINDIR OBJ_FILES = tools/gwsam.o tools/gwsam_user.o -REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE RPC_NDR_SAMR GTKSMB +REQUIRED_SUBSYSTEMS = CONFIG RPC_NDR_SAMR GTKSMB # End BINARY gwsam ################################################ diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index a092f2c818..92b60bfd40 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -87,15 +87,18 @@ OBJ_FILES = version.o \ select.o \ mutex.o \ idtree.o \ - db_wrap.o \ - gendb.o \ module.o REQUIRED_SUBSYSTEMS = \ - LIBLDB CHARSET LIBREPLACE LIBNETIF LIBCRYPTO EXT_LIB_DL LIBTALLOC \ + CHARSET LIBREPLACE LIBNETIF LIBCRYPTO EXT_LIB_DL LIBTALLOC \ SOCKET_WRAPPER CONFIG # End SUBSYSTEM LIBBASIC ############################## +[SUBSYSTEM::DB_WRAP] +OBJ_FILES = db_wrap.o \ + gendb.o +REQUIRED_SUBSYSTEMS = LIBLDB + [SUBSYSTEM::PIDFILE] OBJ_FILES = pidfile.o diff --git a/source4/lib/cmdline/config.m4 b/source4/lib/cmdline/config.m4 deleted file mode 100644 index dd956642cd..0000000000 --- a/source4/lib/cmdline/config.m4 +++ /dev/null @@ -1,96 +0,0 @@ -################################################# - -############################################### -# Readline included by default unless explicitly asked not to -test "${with_readline+set}" != "set" && with_readline=yes - -# test for where we get readline() from -AC_MSG_CHECKING(whether to use readline) -AC_ARG_WITH(readline, -[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ], -[ case "$with_readline" in - yes) - AC_MSG_RESULT(yes) - - AC_CHECK_HEADERS(readline.h history.h readline/readline.h) - AC_CHECK_HEADERS(readline/history.h) - - AC_CHECK_HEADERS(readline.h readline/readline.h,[ - for termlib in ncurses curses termcap terminfo termlib tinfo; do - AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break]) - done - AC_CHECK_LIB(readline, rl_callback_handler_install, - [TERMLIBS="-lreadline $TERMLIBS" - AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline]) - break], [TERMLIBS=], $TERMLIBS)]) - ;; - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - - # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at - # alternate readline path - _ldflags=${LDFLAGS} - _cppflags=${CPPFLAGS} - - # Add additional search path - LDFLAGS="-L$with_readline/lib $LDFLAGS" - CPPFLAGS="-I$with_readline/include $CPPFLAGS" - - AC_CHECK_HEADERS(readline.h history.h readline/readline.h) - AC_CHECK_HEADERS(readline/history.h) - - AC_CHECK_HEADERS(readline.h readline/readline.h,[ - for termlib in ncurses curses termcap terminfo termlib; do - AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break]) - done - AC_CHECK_LIB(readline, rl_callback_handler_install, - [TERMLDFLAGS="-L$with_readline/lib" - TERMCPPFLAGS="-I$with_readline/include" - LDFLAGS="-L$with_readline/lib $LDFLAGS" - CPPFLAGS="-I$with_readline/include $CPPFLAGS" - TERMLIBS="-lreadline $TERMLIBS" - AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline]) - break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)]) - - ;; - esac], - AC_MSG_RESULT(no) -) - -# The readline API changed slightly from readline3 to readline4, so -# 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, - [Do we have rl_completion_matches?])], - [], - [$TERMLIBS]) - -TMP_LIBCMDLINE_OBJS="lib/cmdline/readline.o lib/cmdline/popt_common.o" -TMP_LIBCMDLINE_LIBS="$TERMLIBS" - -SMB_EXT_LIB(READLINE, [${TMP_LIBCMDLINE_LIBS}]) - -SMB_SUBSYSTEM(LIBCMDLINE, - [${TMP_LIBCMDLINE_OBJS}], - [LIBPOPT EXT_LIB_READLINE LIBCMDLINE_CREDENTIALS]) - -AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[ -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper" -AC_TRY_COMPILE([ -#define REPLACE_GETPASS 1 -#define NO_CONFIG_H 1 -#define main dont_declare_main -#include "${srcdir-.}/lib/cmdline/getsmbpass.c" -#undef main -],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no) -CPPFLAGS="$SAVE_CPPFLAGS" -]) -if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then - AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) -fi - diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 36f8ba7469..28e482d9b2 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -1,8 +1,10 @@ -############################## -# Start SUBSYSTEM LIBCMDLINE_CREDENTIALS [SUBSYSTEM::LIBCMDLINE_CREDENTIALS] -OBJ_FILES = getsmbpass.o \ - credentials.o +OBJ_FILES = credentials.o REQUIRED_SUBSYSTEMS = CREDENTIALS -# End SUBSYSTEM LIBCMDLINE_CREDENTIALS -############################## + +[SUBSYSTEM::POPT_SAMBA] +OBJ_FILES = popt_common.o + +[SUBSYSTEM::POPT_CREDENTIALS] +OBJ_FILES = popt_credentials.o +REQUIRED_SUBSYSTEMS = CREDENTIALS LIBCMDLINE_CREDENTIALS diff --git a/source4/lib/cmdline/getsmbpass.c b/source4/lib/cmdline/getsmbpass.c deleted file mode 100644 index 4ffcde8dfd..0000000000 --- a/source4/lib/cmdline/getsmbpass.c +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (C) 1992-1998 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -/* Modified to use with samba by Jeremy Allison, 8th July 1995. */ - -#include "includes.h" -#include "system/terminal.h" -#include "system/wait.h" - -#ifdef REPLACE_GETPASS - -#ifdef SYSV_TERMIO - -/* SYSTEM V TERMIO HANDLING */ - -static struct termio t; - -#define ECHO_IS_ON(t) ((t).c_lflag & ECHO) -#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO) -#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO) - -#ifndef TCSAFLUSH -#define TCSAFLUSH 1 -#endif - -#ifndef TCSANOW -#define TCSANOW 0 -#endif - -static int tcgetattr(int fd, struct termio *_t) -{ - return ioctl(fd, TCGETA, _t); -} - -static int tcsetattr(int fd, int flags, struct termio *_t) -{ - if(flags & TCSAFLUSH) - ioctl(fd, TCFLSH, TCIOFLUSH); - return ioctl(fd, TCSETS, _t); -} - -#elif !defined(TCSAFLUSH) - -/* BSD TERMIO HANDLING */ - -static struct sgttyb t; - -#define ECHO_IS_ON(t) ((t).sg_flags & ECHO) -#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO) -#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO) - -#define TCSAFLUSH 1 -#define TCSANOW 0 - -static int tcgetattr(int fd, struct sgttyb *_t) -{ - return ioctl(fd, TIOCGETP, (char *)_t); -} - -static int tcsetattr(int fd, int flags, struct sgttyb *_t) -{ - return ioctl(fd, TIOCSETP, (char *)_t); -} - -#else /* POSIX TERMIO HANDLING */ -#define ECHO_IS_ON(t) ((t).c_lflag & ECHO) -#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO) -#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO) - -static struct termios t; -#endif /* SYSV_TERMIO */ - -char *getsmbpass(const char *prompt) -{ - FILE *in, *out; - int echo_off; - static char buf[256]; - static size_t bufsize = sizeof(buf); - size_t nread; - - /* Catch problematic signals */ - CatchSignal(SIGINT, SIGNAL_CAST SIG_IGN); - - /* Try to write to and read from the terminal if we can. - If we can't open the terminal, use stderr and stdin. */ - - in = fopen ("/dev/tty", "w+"); - if (in == NULL) - { - in = stdin; - out = stderr; - } - else - out = in; - - setvbuf(in, NULL, _IONBF, 0); - - /* Turn echoing off if it is on now. */ - - if (tcgetattr (fileno (in), &t) == 0) - { - if (ECHO_IS_ON(t)) - { - TURN_ECHO_OFF(t); - echo_off = tcsetattr (fileno (in), TCSAFLUSH, &t) == 0; - TURN_ECHO_ON(t); - } - else - echo_off = 0; - } - else - echo_off = 0; - - /* Write the prompt. */ - fputs (prompt, out); - fflush (out); - - /* Read the password. */ - buf[0] = 0; - fgets(buf, bufsize, in); - nread = strlen(buf); - if (buf[nread - 1] == '\n') - buf[nread - 1] = '\0'; - - /* Restore echoing. */ - if (echo_off) - (void) tcsetattr (fileno (in), TCSANOW, &t); - - if (in != stdin) - /* We opened the terminal; now close it. */ - fclose (in); - - /* Catch problematic signals */ - CatchSignal(SIGINT, SIGNAL_CAST SIG_DFL); - - printf("\n"); - return buf; -} - -#else - void getsmbpasswd_dummy(void); - void getsmbpasswd_dummy(void) {;} -#endif diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index b1f4563fb1..b8c5b5b9d3 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -37,7 +37,7 @@ * -i,--scope */ -enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL, OPT_DEBUG_STDERR, OPT_SIMPLE_BIND_DN}; +enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR}; struct cli_credentials *cmdline_credentials = NULL; @@ -173,89 +173,3 @@ struct poptOption popt_common_version[] = { POPT_TABLEEND }; -/* Handle command line options: - * -U,--user - * -A,--authentication-file - * -k,--use-kerberos - * -N,--no-pass - * -S,--signing - * -P --machine-pass - */ - - -static BOOL dont_ask; - -/* - disable asking for a password -*/ -void popt_common_dont_ask(void) -{ - dont_ask = True; -} - -static void popt_common_credentials_callback(poptContext con, - enum poptCallbackReason reason, - const struct poptOption *opt, - const char *arg, const void *data) -{ - if (reason == POPT_CALLBACK_REASON_PRE) { - cmdline_credentials = cli_credentials_init(talloc_autofree_context()); - return; - } - - if (reason == POPT_CALLBACK_REASON_POST) { - cli_credentials_guess(cmdline_credentials); - - if (!dont_ask) { - cli_credentials_set_cmdline_callbacks(cmdline_credentials); - } - return; - } - - switch(opt->val) { - case 'U': - { - char *lp; - - cli_credentials_parse_string(cmdline_credentials, arg, CRED_SPECIFIED); - /* This breaks the abstraction, including the const above */ - if ((lp=strchr_m(arg,'%'))) { - lp[0]='\0'; - lp++; - memset(lp,0,strlen(lp)); - } - } - break; - - case 'A': - cli_credentials_parse_file(cmdline_credentials, arg, CRED_SPECIFIED); - break; - - case 'S': - lp_set_cmdline("client signing", arg); - break; - - case 'P': - /* Later, after this is all over, get the machine account details from the secrets.ldb */ - cli_credentials_set_machine_account_pending(cmdline_credentials); - - /* machine accounts only work with kerberos (fall though)*/ - break; - case OPT_SIMPLE_BIND_DN: - cli_credentials_set_bind_dn(cmdline_credentials, arg); - break; - } -} - - - -struct poptOption popt_common_credentials[] = { - { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, popt_common_credentials_callback }, - { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN\\]USERNAME[%PASSWORD]" }, - { "no-pass", 'N', POPT_ARG_NONE, &dont_ask, True, "Don't ask for a password" }, - { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" }, - { "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" }, - { "machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password (implies -k)" }, - { "simple-bind-dn", 0, POPT_ARG_STRING, NULL, OPT_SIMPLE_BIND_DN, "DN to use for a simple bind" }, - POPT_TABLEEND -}; diff --git a/source4/lib/cmdline/popt_credentials.c b/source4/lib/cmdline/popt_credentials.c new file mode 100644 index 0000000000..a974d808e3 --- /dev/null +++ b/source4/lib/cmdline/popt_credentials.c @@ -0,0 +1,115 @@ +/* + Unix SMB/CIFS implementation. + Credentials popt routines + + Copyright (C) Jelmer Vernooij 2002,2003,2005 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "version.h" +#include "system/filesys.h" +#include "system/passwd.h" +#include "lib/cmdline/popt_common.h" + +/* Handle command line options: + * -U,--user + * -A,--authentication-file + * -k,--use-kerberos + * -N,--no-pass + * -S,--signing + * -P --machine-pass + */ + + +static BOOL dont_ask; + +enum opt { OPT_SIMPLE_BIND_DN }; + +/* + disable asking for a password +*/ +void popt_common_dont_ask(void) +{ + dont_ask = True; +} + +static void popt_common_credentials_callback(poptContext con, + enum poptCallbackReason reason, + const struct poptOption *opt, + const char *arg, const void *data) +{ + if (reason == POPT_CALLBACK_REASON_PRE) { + cmdline_credentials = cli_credentials_init(talloc_autofree_context()); + return; + } + + if (reason == POPT_CALLBACK_REASON_POST) { + cli_credentials_guess(cmdline_credentials); + + if (!dont_ask) { + cli_credentials_set_cmdline_callbacks(cmdline_credentials); + } + return; + } + + switch(opt->val) { + case 'U': + { + char *lp; + + cli_credentials_parse_string(cmdline_credentials, arg, CRED_SPECIFIED); + /* This breaks the abstraction, including the const above */ + if ((lp=strchr_m(arg,'%'))) { + lp[0]='\0'; + lp++; + memset(lp,0,strlen(lp)); + } + } + break; + + case 'A': + cli_credentials_parse_file(cmdline_credentials, arg, CRED_SPECIFIED); + break; + + case 'S': + lp_set_cmdline("client signing", arg); + break; + + case 'P': + /* Later, after this is all over, get the machine account details from the secrets.ldb */ + cli_credentials_set_machine_account_pending(cmdline_credentials); + + /* machine accounts only work with kerberos (fall though)*/ + break; + case OPT_SIMPLE_BIND_DN: + cli_credentials_set_bind_dn(cmdline_credentials, arg); + break; + } +} + + + +struct poptOption popt_common_credentials[] = { + { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, popt_common_credentials_callback }, + { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN\\]USERNAME[%PASSWORD]" }, + { "no-pass", 'N', POPT_ARG_NONE, &dont_ask, True, "Don't ask for a password" }, + { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" }, + { "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" }, + { "machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password (implies -k)" }, + { "simple-bind-dn", 0, POPT_ARG_STRING, NULL, OPT_SIMPLE_BIND_DN, "DN to use for a simple bind" }, + POPT_TABLEEND +}; diff --git a/source4/lib/cmdline/readline.c b/source4/lib/cmdline/readline.c deleted file mode 100644 index 52f45eb759..0000000000 --- a/source4/lib/cmdline/readline.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - 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 2 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "pstring.h" - -#include -#include "system/readline.h" - -/**************************************************************************** - Display the prompt and wait for input. Call callback() regularly -****************************************************************************/ - -static char *smb_readline_replacement(const char *prompt, void (*callback)(void), - char **(completion_fn)(const char *text, int start, int end)) -{ - fd_set fds; - static pstring line; - struct timeval timeout; - int fd = STDIN_FILENO; - char *ret; - - do_debug("%s", prompt); - - while (1) { - timeout.tv_sec = 5; - timeout.tv_usec = 0; - - FD_ZERO(&fds); - FD_SET(fd,&fds); - - if (sys_select_intr(fd+1,&fds,NULL,NULL,&timeout) == 1) { - ret = x_fgets(line, sizeof(line), x_stdin); - return ret; - } - if (callback) - callback(); - } -} - -/**************************************************************************** - Display the prompt and wait for input. Call callback() regularly. -****************************************************************************/ - -char *smb_readline(const char *prompt, void (*callback)(void), - char **(completion_fn)(const char *text, int start, int end)) -{ -#if HAVE_LIBREADLINE - if (isatty(STDIN_FILENO)) { - char *ret; - - /* Aargh! Readline does bizzare things with the terminal width - that mucks up expect(1). Set CLI_NO_READLINE in the environment - to force readline not to be used. */ - - if (getenv("CLI_NO_READLINE")) - return smb_readline_replacement(prompt, callback, completion_fn); - - if (completion_fn) { - /* The callback prototype has changed slightly between - different versions of Readline, so the same function - works in all of them to date, but we get compiler - warnings in some. */ - rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn; - } - - if (callback) - rl_event_hook = (Function *)callback; - ret = readline(prompt); - if (ret && *ret) - add_history(ret); - return ret; - } else -#endif - return smb_readline_replacement(prompt, callback, completion_fn); -} - -/**************************************************************************** - * return line buffer text - ****************************************************************************/ -const char *smb_readline_get_line_buffer(void) -{ -#if defined(HAVE_LIBREADLINE) - return rl_line_buffer; -#else - return NULL; -#endif -} - -/**************************************************************************** - * set completion append character - ***************************************************************************/ -void smb_readline_ca_char(char c) -{ -#if defined(HAVE_LIBREADLINE) - rl_completion_append_character = c; -#endif -} - - - diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 2ae23c0fd4..2ce0d5043d 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -115,7 +115,7 @@ OBJ_FILES = \ [SUBSYSTEM::LIBLDB_CMDLINE] OBJ_FILES= \ tools/cmdline.o -REQUIRED_SUBSYSTEMS = LIBLDB LIBCMDLINE LIBBASIC +REQUIRED_SUBSYSTEMS = LIBLDB LIBBASIC LIBPOPT POPT_SAMBA POPT_CREDENTIALS # End SUBSYSTEM LIBLDB_CMDLINE ################################################ diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 3f63c5be98..c55f02aee7 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -102,7 +102,7 @@ INSTALLDIR = BINDIR OBJ_FILES= \ tools/regdiff.o REQUIRED_SUBSYSTEMS = \ - CONFIG LIBCMDLINE REGISTRY + CONFIG REGISTRY LIBPOPT POPT_SAMBA POPT_CREDENTIALS MANPAGE = man/regdiff.1 # End BINARY regdiff ################################################ @@ -114,7 +114,7 @@ INSTALLDIR = BINDIR OBJ_FILES= \ tools/regpatch.o REQUIRED_SUBSYSTEMS = \ - CONFIG LIBCMDLINE REGISTRY + CONFIG REGISTRY LIBPOPT POPT_SAMBA POPT_CREDENTIALS MANPAGE = man/regpatch.1 # End BINARY regpatch ################################################ @@ -126,7 +126,7 @@ INSTALLDIR = BINDIR OBJ_FILES= \ tools/regshell.o REQUIRED_SUBSYSTEMS = \ - CONFIG LIBCMDLINE REGISTRY + CONFIG LIBPOPT REGISTRY POPT_SAMBA POPT_CREDENTIALS LIBREADLINE MANPAGE = man/regshell.1 # End BINARY regshell ################################################ @@ -138,7 +138,7 @@ INSTALLDIR = BINDIR OBJ_FILES= \ tools/regtree.o REQUIRED_SUBSYSTEMS = \ - CONFIG LIBCMDLINE REGISTRY + CONFIG LIBPOPT REGISTRY POPT_SAMBA POPT_CREDENTIALS MANPAGE = man/regtree.1 # End BINARY regtree ################################################ diff --git a/source4/lib/replace/README b/source4/lib/replace/README index 80a2d5c163..19364e2faa 100644 --- a/source4/lib/replace/README +++ b/source4/lib/replace/README @@ -48,6 +48,8 @@ errno mkstemp (a secure one!) pread pwrite +getpass +readline (the library) Types: socklen_t diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4 index 70d13e40fd..379c14e776 100644 --- a/source4/lib/replace/config.m4 +++ b/source4/lib/replace/config.m4 @@ -124,3 +124,6 @@ LIBS="$SAVE_LIBS" AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],, [AC_MSG_ERROR([Required function not found])]) + +sinclude(lib/replace/readline.m4) +sinclude(lib/replace/getpass.m4) diff --git a/source4/lib/replace/config.mk b/source4/lib/replace/config.mk index 7ed33b2dc0..459465c64f 100644 --- a/source4/lib/replace/config.mk +++ b/source4/lib/replace/config.mk @@ -7,13 +7,13 @@ NOPROTO = YES # End SUBSYSTEM REPLACE_READDIR ############################## - ############################## # Start SUBSYSTEM LIBREPLACE [SUBSYSTEM::LIBREPLACE] OBJ_FILES = replace.o \ snprintf.o \ - dlfcn.o + dlfcn.o \ + getpass.o NOPROTO = YES REQUIRED_SUBSYSTEMS = REPLACE_READDIR # End SUBSYSTEM LIBREPLACE diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c new file mode 100644 index 0000000000..4ffcde8dfd --- /dev/null +++ b/source4/lib/replace/getpass.c @@ -0,0 +1,158 @@ +/* Copyright (C) 1992-1998 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Modified to use with samba by Jeremy Allison, 8th July 1995. */ + +#include "includes.h" +#include "system/terminal.h" +#include "system/wait.h" + +#ifdef REPLACE_GETPASS + +#ifdef SYSV_TERMIO + +/* SYSTEM V TERMIO HANDLING */ + +static struct termio t; + +#define ECHO_IS_ON(t) ((t).c_lflag & ECHO) +#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO) +#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO) + +#ifndef TCSAFLUSH +#define TCSAFLUSH 1 +#endif + +#ifndef TCSANOW +#define TCSANOW 0 +#endif + +static int tcgetattr(int fd, struct termio *_t) +{ + return ioctl(fd, TCGETA, _t); +} + +static int tcsetattr(int fd, int flags, struct termio *_t) +{ + if(flags & TCSAFLUSH) + ioctl(fd, TCFLSH, TCIOFLUSH); + return ioctl(fd, TCSETS, _t); +} + +#elif !defined(TCSAFLUSH) + +/* BSD TERMIO HANDLING */ + +static struct sgttyb t; + +#define ECHO_IS_ON(t) ((t).sg_flags & ECHO) +#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO) +#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO) + +#define TCSAFLUSH 1 +#define TCSANOW 0 + +static int tcgetattr(int fd, struct sgttyb *_t) +{ + return ioctl(fd, TIOCGETP, (char *)_t); +} + +static int tcsetattr(int fd, int flags, struct sgttyb *_t) +{ + return ioctl(fd, TIOCSETP, (char *)_t); +} + +#else /* POSIX TERMIO HANDLING */ +#define ECHO_IS_ON(t) ((t).c_lflag & ECHO) +#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO) +#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO) + +static struct termios t; +#endif /* SYSV_TERMIO */ + +char *getsmbpass(const char *prompt) +{ + FILE *in, *out; + int echo_off; + static char buf[256]; + static size_t bufsize = sizeof(buf); + size_t nread; + + /* Catch problematic signals */ + CatchSignal(SIGINT, SIGNAL_CAST SIG_IGN); + + /* Try to write to and read from the terminal if we can. + If we can't open the terminal, use stderr and stdin. */ + + in = fopen ("/dev/tty", "w+"); + if (in == NULL) + { + in = stdin; + out = stderr; + } + else + out = in; + + setvbuf(in, NULL, _IONBF, 0); + + /* Turn echoing off if it is on now. */ + + if (tcgetattr (fileno (in), &t) == 0) + { + if (ECHO_IS_ON(t)) + { + TURN_ECHO_OFF(t); + echo_off = tcsetattr (fileno (in), TCSAFLUSH, &t) == 0; + TURN_ECHO_ON(t); + } + else + echo_off = 0; + } + else + echo_off = 0; + + /* Write the prompt. */ + fputs (prompt, out); + fflush (out); + + /* Read the password. */ + buf[0] = 0; + fgets(buf, bufsize, in); + nread = strlen(buf); + if (buf[nread - 1] == '\n') + buf[nread - 1] = '\0'; + + /* Restore echoing. */ + if (echo_off) + (void) tcsetattr (fileno (in), TCSANOW, &t); + + if (in != stdin) + /* We opened the terminal; now close it. */ + fclose (in); + + /* Catch problematic signals */ + CatchSignal(SIGINT, SIGNAL_CAST SIG_DFL); + + printf("\n"); + return buf; +} + +#else + void getsmbpasswd_dummy(void); + void getsmbpasswd_dummy(void) {;} +#endif diff --git a/source4/lib/replace/getpass.m4 b/source4/lib/replace/getpass.m4 new file mode 100644 index 0000000000..2bd9d7bc1a --- /dev/null +++ b/source4/lib/replace/getpass.m4 @@ -0,0 +1,15 @@ +AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[ +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper" +AC_TRY_COMPILE([ +#define REPLACE_GETPASS 1 +#define NO_CONFIG_H 1 +#define main dont_declare_main +#include "${srcdir-.}/lib/cmdline/getsmbpass.c" +#undef main +],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no) +CPPFLAGS="$SAVE_CPPFLAGS" +]) +if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then + AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) +fi diff --git a/source4/lib/replace/readline.c b/source4/lib/replace/readline.c new file mode 100644 index 0000000000..52f45eb759 --- /dev/null +++ b/source4/lib/replace/readline.c @@ -0,0 +1,119 @@ +/* + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "pstring.h" + +#include +#include "system/readline.h" + +/**************************************************************************** + Display the prompt and wait for input. Call callback() regularly +****************************************************************************/ + +static char *smb_readline_replacement(const char *prompt, void (*callback)(void), + char **(completion_fn)(const char *text, int start, int end)) +{ + fd_set fds; + static pstring line; + struct timeval timeout; + int fd = STDIN_FILENO; + char *ret; + + do_debug("%s", prompt); + + while (1) { + timeout.tv_sec = 5; + timeout.tv_usec = 0; + + FD_ZERO(&fds); + FD_SET(fd,&fds); + + if (sys_select_intr(fd+1,&fds,NULL,NULL,&timeout) == 1) { + ret = x_fgets(line, sizeof(line), x_stdin); + return ret; + } + if (callback) + callback(); + } +} + +/**************************************************************************** + Display the prompt and wait for input. Call callback() regularly. +****************************************************************************/ + +char *smb_readline(const char *prompt, void (*callback)(void), + char **(completion_fn)(const char *text, int start, int end)) +{ +#if HAVE_LIBREADLINE + if (isatty(STDIN_FILENO)) { + char *ret; + + /* Aargh! Readline does bizzare things with the terminal width + that mucks up expect(1). Set CLI_NO_READLINE in the environment + to force readline not to be used. */ + + if (getenv("CLI_NO_READLINE")) + return smb_readline_replacement(prompt, callback, completion_fn); + + if (completion_fn) { + /* The callback prototype has changed slightly between + different versions of Readline, so the same function + works in all of them to date, but we get compiler + warnings in some. */ + rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn; + } + + if (callback) + rl_event_hook = (Function *)callback; + ret = readline(prompt); + if (ret && *ret) + add_history(ret); + return ret; + } else +#endif + return smb_readline_replacement(prompt, callback, completion_fn); +} + +/**************************************************************************** + * return line buffer text + ****************************************************************************/ +const char *smb_readline_get_line_buffer(void) +{ +#if defined(HAVE_LIBREADLINE) + return rl_line_buffer; +#else + return NULL; +#endif +} + +/**************************************************************************** + * set completion append character + ***************************************************************************/ +void smb_readline_ca_char(char c) +{ +#if defined(HAVE_LIBREADLINE) + rl_completion_append_character = c; +#endif +} + + + diff --git a/source4/lib/replace/readline.m4 b/source4/lib/replace/readline.m4 new file mode 100644 index 0000000000..0d1aa60d17 --- /dev/null +++ b/source4/lib/replace/readline.m4 @@ -0,0 +1,72 @@ +############################################### +# Readline included by default unless explicitly asked not to +test "${with_readline+set}" != "set" && with_readline=yes + +# test for where we get readline() from +AC_MSG_CHECKING(whether to use readline) +AC_ARG_WITH(readline, +[ --with-readline[=DIR] Look for readline include/libs in DIR (default=auto) ], +[ case "$with_readline" in + yes) + AC_MSG_RESULT(yes) + + AC_CHECK_HEADERS(readline.h history.h readline/readline.h) + AC_CHECK_HEADERS(readline/history.h) + + AC_CHECK_HEADERS(readline.h readline/readline.h,[ + for termlib in ncurses curses termcap terminfo termlib tinfo; do + AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break]) + done + AC_CHECK_LIB(readline, rl_callback_handler_install, + [TERMLIBS="-lreadline $TERMLIBS" + AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline]) + break], [TERMLIBS=], $TERMLIBS)]) + ;; + no) + AC_MSG_RESULT(no) + ;; + *) + AC_MSG_RESULT(yes) + + # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at + # alternate readline path + _ldflags=${LDFLAGS} + _cppflags=${CPPFLAGS} + + # Add additional search path + LDFLAGS="-L$with_readline/lib $LDFLAGS" + CPPFLAGS="-I$with_readline/include $CPPFLAGS" + + AC_CHECK_HEADERS(readline.h history.h readline/readline.h) + AC_CHECK_HEADERS(readline/history.h) + + AC_CHECK_HEADERS(readline.h readline/readline.h,[ + for termlib in ncurses curses termcap terminfo termlib; do + AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break]) + done + AC_CHECK_LIB(readline, rl_callback_handler_install, + [TERMLDFLAGS="-L$with_readline/lib" + TERMCPPFLAGS="-I$with_readline/include" + LDFLAGS="-L$with_readline/lib $LDFLAGS" + CPPFLAGS="-I$with_readline/include $CPPFLAGS" + TERMLIBS="-lreadline $TERMLIBS" + AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline]) + break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)]) + + ;; + esac], + AC_MSG_RESULT(no) +) + +# The readline API changed slightly from readline3 to readline4, so +# 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, + [Do we have rl_completion_matches?])], + [], + [$TERMLIBS]) + +SMB_EXT_LIB(READLINE, [${TERMLIBS}]) + +SMB_SUBSYSTEM(LIBREADLINE, [lib/replace/readline.o], [EXT_LIB_READLINE]) diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk index 81741aece7..60db3ab07e 100644 --- a/source4/lib/socket/config.mk +++ b/source4/lib/socket/config.mk @@ -38,5 +38,6 @@ OBJ_FILES = \ connect_multi.o \ connect.o NOPROTO=YES +REQUIRED_SUBSYSTEMS = LIBCLI_RESOLVE # End SUBSYSTEM SOCKET ################################################ diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index c3ebebed41..fb04c32d85 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -30,6 +30,9 @@ OBJ_FILES = \ smb_composite/fsinfo.o REQUIRED_SUBSYSTEMS = LIBCLI_COMPOSITE +[SUBSYSTEM::NDR_NBT_BUF] +OBJ_FILES = nbt/nbtname.o\ + [LIBRARY::LIBCLI_NBT] MAJOR_VERSION = 0 MINOR_VERSION = 0 @@ -37,14 +40,13 @@ RELEASE_VERSION = 1 DESCRIPTION = NetBios over TCP/IP client library PRIVATE_PROTO_HEADER = nbt/nbt_proto.h OBJ_FILES = \ - nbt/nbtname.o \ nbt/nbtsocket.o \ nbt/namequery.o \ nbt/nameregister.o \ nbt/namerefresh.o \ nbt/namerelease.o REQUIRED_SUBSYSTEMS = LIBNDR NDR_NBT SOCKET LIBCLI_COMPOSITE LIBEVENTS \ - LIB_SECURITY_NDR + NDR_SECURITY [SUBSYSTEM::LIBCLI_DGRAM] OBJ_FILES = \ diff --git a/source4/libcli/ldap/config.mk b/source4/libcli/ldap/config.mk index b9fcb20038..912cb133bf 100644 --- a/source4/libcli/ldap/config.mk +++ b/source4/libcli/ldap/config.mk @@ -8,6 +8,7 @@ OBJ_FILES = ldap.o \ ldap_msg.o \ ldap_ndr.o \ ldap_ildap.o -REQUIRED_SUBSYSTEMS = LIBCLI_UTILS LIBEVENTS GENSEC SOCKET RPC_NDR_SAMR LIBTLS +REQUIRED_SUBSYSTEMS = LIBCLI_UTILS LIBEVENTS GENSEC SOCKET NDR_SAMR LIBTLS \ + LIBPACKET # End SUBSYSTEM LIBCLI_LDAP ################################# diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk index 368a56d2b4..a8de499531 100644 --- a/source4/libcli/security/config.mk +++ b/source4/libcli/security/config.mk @@ -1,19 +1,3 @@ -################################# -# Start SUBSYSTEM LIB_SECURITY_NDR_HELPER -[SUBSYSTEM::LIB_SECURITY_NDR_HELPER] -OBJ_FILES = ../../librpc/ndr/ndr_sec_helper.o -# End SUBSYSTEM LIB_SECURITY_NDR_HELPER -################################# - -################################# -# Start SUBSYSTEM LIB_SECURITY_NDR -[SUBSYSTEM::LIB_SECURITY_NDR] -OBJ_FILES = ../../librpc/gen_ndr/ndr_security.o -NOPROTO = YES -REQUIRED_SUBSYSTEMS = LIB_SECURITY_NDR_HELPER -# End SUBSYSTEM LIB_SECURITY_NDR -################################# - ################################# # Start SUBSYSTEM LIB_SECURITY [SUBSYSTEM::LIB_SECURITY] @@ -22,8 +6,7 @@ OBJ_FILES = security_token.o \ dom_sid.o \ access_check.o \ privilege.o \ - sddl.o \ - ../../librpc/ndr/ndr_sec.o -REQUIRED_SUBSYSTEMS = LIB_SECURITY_NDR + sddl.o +REQUIRED_SUBSYSTEMS = NDR_SECURITY # End SUBSYSTEM LIB_SECURITY ################################# diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 556ff2ca13..06254a6748 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -28,6 +28,14 @@ REQUIRED_SUBSYSTEMS = LIBCOMPRESSION include rpc/config.mk +[SUBSYSTEM::NDR_SECURITY_HELPER] +OBJ_FILES = ndr/ndr_sec_helper.o ndr/ndr_sec.o + +[SUBSYSTEM::NDR_SECURITY] +OBJ_FILES = gen_ndr/ndr_security.o +NOPROTO = YES +REQUIRED_SUBSYSTEMS = NDR_SECURITY_HELPER + [SUBSYSTEM::NDR_AUDIOSRV] OBJ_FILES = gen_ndr/ndr_audiosrv.o NOPROTO = YES @@ -96,7 +104,7 @@ REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_DRSUAPI] OBJ_FILES = gen_ndr/ndr_drsuapi.o NOPROTO = YES -REQUIRED_SUBSYSTEMS = LIBNDR NDR_DRSUAPI_PRINT NDR_COMPRESSION +REQUIRED_SUBSYSTEMS = LIBNDR NDR_DRSUAPI_PRINT NDR_COMPRESSION NDR_SECURITY [SUBSYSTEM::NDR_DRSUAPI_PRINT] OBJ_FILES = ndr/ndr_drsuapi.o @@ -250,7 +258,7 @@ REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_NETLOGON] OBJ_FILES = gen_ndr/ndr_netlogon.o NOPROTO = YES -REQUIRED_SUBSYSTEMS = LIBNDR NDR_SAMR +REQUIRED_SUBSYSTEMS = LIBNDR NDR_SAMR NDR_LSA [SUBSYSTEM::NDR_TRKWKS] OBJ_FILES = gen_ndr/ndr_trkwks.o @@ -283,7 +291,7 @@ REQUIRED_SUBSYSTEMS = LIBNDR [SUBSYSTEM::NDR_NBT] OBJ_FILES = gen_ndr/ndr_nbt.o NOPROTO = YES -REQUIRED_SUBSYSTEMS = LIBNDR NDR_MISC +REQUIRED_SUBSYSTEMS = LIBNDR NDR_MISC NDR_NBT_BUF [SUBSYSTEM::NDR_WINSREPL] OBJ_FILES = gen_ndr/ndr_winsrepl.o @@ -308,7 +316,7 @@ REQUIRED_SUBSYSTEMS = NDR_IFACE_TABLE NDR_AUDIOSRV NDR_ECHO NDR_DCERPC NDR_EXCHA NDR_WINREG NDR_MGMT NDR_PROTECTED_STORAGE NDR_OXIDRESOLVER \ NDR_REMACT NDR_WZCSVC NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_NTSVCS \ NDR_NETLOGON NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC NDR_XATTR NDR_SCHANNEL \ - NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL LIB_SECURITY_NDR \ + NDR_ROT NDR_DRSBLOBS NDR_SVCCTL NDR_NBT NDR_WINSREPL NDR_SECURITY \ NDR_INITSHUTDOWN NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_DCOM [SUBSYSTEM::RPC_NDR_ROT] @@ -543,7 +551,7 @@ NOPROTO = YES INIT_FUNCTION = ejs_init_security OBJ_FILES = gen_ndr/ndr_security_ejs.o SUBSYSTEM = SMBCALLS -REQUIRED_SUBSYSTEMS = LIBRPC LIB_SECURITY_NDR +REQUIRED_SUBSYSTEMS = LIBRPC NDR_SECURITY NOPROTO = YES [MODULE::RPC_EJS_LSA] diff --git a/source4/param/config.mk b/source4/param/config.mk index ded7456c20..cf21871503 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -4,3 +4,4 @@ OBJ_FILES = ../dynconfig.o \ params.o \ ../passdb/secrets.o \ generic.o +REQUIRED_SUBSYSTEMS = LIBBASIC DB_WRAP diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index 902fed2fd7..47e4b99bec 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -30,7 +30,8 @@ OBJ_FILES = \ ejsnet.o \ mprutil.o REQUIRED_SUBSYSTEMS = AUTH EJS LIBBASIC EJSRPC MESSAGING LIBSAMBA3 LIBNET \ - NDR_ALL + NDR_ALL LIBSMB LIBPOPT POPT_CREDENTIALS \ + POPT_SAMBA # End SUBSYSTEM SMBCALLS ####################### @@ -40,6 +41,6 @@ REQUIRED_SUBSYSTEMS = AUTH EJS LIBBASIC EJSRPC MESSAGING LIBSAMBA3 LIBNET \ INSTALLDIR = BINDIR OBJ_FILES = \ smbscript.o -REQUIRED_SUBSYSTEMS = EJS LIBBASIC SMBCALLS CONFIG LIBSMB LIBRPC LIBCMDLINE +REQUIRED_SUBSYSTEMS = EJS LIBBASIC SMBCALLS CONFIG # End BINARY SMBSCRIPT ####################### diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk index 8c54d79432..7378b3b2c3 100644 --- a/source4/smbd/config.mk +++ b/source4/smbd/config.mk @@ -122,8 +122,9 @@ REQUIRED_SUBSYSTEMS = \ PROCESS_MODEL \ SERVER_SERVICE \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - PIDFILE + PIDFILE \ + POPT_SAMBA \ + LIBPOPT # End BINARY smbd ################################# diff --git a/source4/torture/config.mk b/source4/torture/config.mk index ec79675f65..a1776767ff 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -216,8 +216,10 @@ REQUIRED_SUBSYSTEMS = \ TORTURE_NBT \ TORTURE_NET \ CONFIG \ - LIBCMDLINE \ - LIBBASIC + LIBBASIC \ + LIBPOPT \ + POPT_SAMBA \ + POPT_CREDENTIALS MANPAGE = man/smbtorture.1 # End BINARY smbtorture ################################# @@ -232,9 +234,7 @@ OBJ_FILES = \ REQUIRED_SUBSYSTEMS = \ LIBSMB \ CONFIG \ - LIBBASIC \ - LIBCMDLINE \ - LIBRPC + LIBBASIC MANPAGE = man/gentest.1 # End BINARY gentest ################################# @@ -248,9 +248,7 @@ OBJ_FILES = \ REQUIRED_SUBSYSTEMS = \ LIBSMB \ CONFIG \ - LIBBASIC \ - LIBCMDLINE \ - LIBRPC + LIBBASIC MANPAGE = man/masktest.1 # End BINARY masktest ################################# @@ -265,9 +263,7 @@ OBJ_FILES = \ REQUIRED_SUBSYSTEMS = \ LIBSMB \ CONFIG \ - LIBBASIC \ - LIBCMDLINE \ - LIBRPC + LIBBASIC MANPAGE = man/locktest.1 # End BINARY locktest ################################# diff --git a/source4/torture/torture.c b/source4/torture/torture.c index f53fca38df..61a0af34f5 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2614,6 +2614,7 @@ static void max_runtime_handler(int sig) smbtorture_init_subsystems; + dcerpc_table_init(); if (torture_seed == 0) { torture_seed = time(NULL); diff --git a/source4/utils/config.mk b/source4/utils/config.mk index ac7739fd4b..860d2c73a1 100644 --- a/source4/utils/config.mk +++ b/source4/utils/config.mk @@ -8,10 +8,10 @@ OBJ_FILES = \ ndrdump.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ NDR_ALL \ - LIBRPC + LIBPOPT \ + POPT_SAMBA MANPAGE = man/ndrdump.1 # FIXME: ndrdump shouldn't have to depend on RPC... # End BINARY ndrdump @@ -25,10 +25,9 @@ OBJ_FILES = \ ntlm_auth.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - LIBSMB \ - LIBRPC + LIBPOPT \ + POPT_SAMBA MANPAGE = man/ntlm_auth.1 # End BINARY ntlm_auth ################################# @@ -41,9 +40,7 @@ OBJ_FILES = \ getntacl.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - LIBRPC \ NDR_XATTR \ EXT_LIB_XATTR # End BINARY getntacl @@ -57,9 +54,8 @@ OBJ_FILES = \ setntacl.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - LIBRPC + NDR_XATTR # End BINARY setntacl ################################# @@ -71,9 +67,7 @@ OBJ_FILES = \ setnttoken.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - LIBRPC \ NDR_XATTR \ NDR_SAMR # End BINARY setnttoken @@ -87,9 +81,9 @@ OBJ_FILES = \ nmblookup.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ LIBCLI_NBT \ - LIB_SECURITY_NDR + LIBPOPT \ + POPT_SAMBA # End BINARY nmblookup ################################# diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index abc6d95fb4..33bffe77b5 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -127,7 +127,7 @@ static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size) POPT_TABLEEND }; - ndrdump_init_subsystems; + dcerpc_table_init(); pc = poptGetContext("ndrdump", argc, argv, long_options, 0); diff --git a/source4/utils/net/config.mk b/source4/utils/net/config.mk index e9f7e6ef52..3d45bcec77 100644 --- a/source4/utils/net/config.mk +++ b/source4/utils/net/config.mk @@ -14,9 +14,10 @@ OBJ_FILES = \ net_user.o REQUIRED_SUBSYSTEMS = \ CONFIG \ - LIBCMDLINE \ LIBBASIC \ - LIBSMB \ - LIBNET + LIBNET \ + LIBPOPT \ + POPT_SAMBA \ + POPT_CREDENTIALS # End BINARY net ################################# -- cgit