summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/basic.mk9
-rw-r--r--source4/lib/cmdline/config.mk14
-rw-r--r--source4/lib/cmdline/popt_common.c88
-rw-r--r--source4/lib/cmdline/popt_credentials.c115
-rw-r--r--source4/lib/ldb/config.mk2
-rw-r--r--source4/lib/registry/config.mk8
-rw-r--r--source4/lib/replace/README2
-rw-r--r--source4/lib/replace/config.m43
-rw-r--r--source4/lib/replace/config.mk4
-rw-r--r--source4/lib/replace/getpass.c (renamed from source4/lib/cmdline/getsmbpass.c)0
-rw-r--r--source4/lib/replace/getpass.m415
-rw-r--r--source4/lib/replace/readline.c (renamed from source4/lib/cmdline/readline.c)0
-rw-r--r--source4/lib/replace/readline.m4 (renamed from source4/lib/cmdline/config.m4)28
-rw-r--r--source4/lib/socket/config.mk1
14 files changed, 160 insertions, 129 deletions
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.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/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/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/cmdline/getsmbpass.c b/source4/lib/replace/getpass.c
index 4ffcde8dfd..4ffcde8dfd 100644
--- a/source4/lib/cmdline/getsmbpass.c
+++ b/source4/lib/replace/getpass.c
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/cmdline/readline.c b/source4/lib/replace/readline.c
index 52f45eb759..52f45eb759 100644
--- a/source4/lib/cmdline/readline.c
+++ b/source4/lib/replace/readline.c
diff --git a/source4/lib/cmdline/config.m4 b/source4/lib/replace/readline.m4
index dd956642cd..0d1aa60d17 100644
--- a/source4/lib/cmdline/config.m4
+++ b/source4/lib/replace/readline.m4
@@ -1,5 +1,3 @@
-#################################################
-
###############################################
# Readline included by default unless explicitly asked not to
test "${with_readline+set}" != "set" && with_readline=yes
@@ -69,28 +67,6 @@ AC_CHECK_LIB(readline, 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
+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
################################################