diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-05-10 10:53:48 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-05-10 10:53:48 +0000 |
commit | 74d9ecfe2dd7364643d32acb62ade957bd71cd0d (patch) | |
tree | 0349374bc5655624e2cf71930cce10b3fefe3554 /source | |
parent | ab1ff35187924c31a8fa503c0d02c6b54605da4f (diff) | |
download | samba-74d9ecfe2dd7364643d32acb62ade957bd71cd0d.tar.gz samba-74d9ecfe2dd7364643d32acb62ade957bd71cd0d.tar.xz samba-74d9ecfe2dd7364643d32acb62ade957bd71cd0d.zip |
Patch from metze and me that adds dummy smb_register_*() functions so
that is now possible to, for example, load a module which contains
an auth method into a binary without the auth/ subsystem built in.
Diffstat (limited to 'source')
35 files changed, 137 insertions, 2 deletions
diff --git a/source/client/client.c b/source/client/client.c index 36c76cbf15d..c8d2ca7b04f 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -28,6 +28,8 @@ #define REGISTER 0 #endif +#include "module_dummy.h" + struct cli_state *cli; extern BOOL in_client; static int port = 0; diff --git a/source/client/smbmount.c b/source/client/smbmount.c index 1ee7dbc8cb9..eeaec642040 100644 --- a/source/client/smbmount.c +++ b/source/client/smbmount.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + #include <mntent.h> #include <asm/types.h> #include <linux/smb_fs.h> diff --git a/source/client/smbspool.c b/source/client/smbspool.c index 68165792da3..eef663ebfd2 100644 --- a/source/client/smbspool.c +++ b/source/client/smbspool.c @@ -24,6 +24,8 @@ #include "includes.h" +#include "module_dummy.h" + /* * Globals... */ diff --git a/source/include/module_dummy.h b/source/include/module_dummy.h new file mode 100644 index 00000000000..dfa0e1535b1 --- /dev/null +++ b/source/include/module_dummy.h @@ -0,0 +1,53 @@ +/* + Unix SMB/CIFS implementation. + For faking up smb_register_*() functions + e.g. smb_register_vfs() in nmbd + Copyright (C) Stefan (metze) Metzmacher 2003 + + 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. +*/ + +#ifndef _MODULE_DUMMY_H +#define _MODULE_DUMMY_H + +#ifndef HAVE_SMB_REGISTER_AUTH +NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} +#endif /*HAVE_SMB_REGISTER_AUTH*/ + +#ifndef HAVE_SMB_REGISTER_PASSDB +NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} +#endif /*HAVE_SMB_REGISTER_PASSDB*/ + +#ifndef HAVE_RPC_PIPE_REGISTER_COMMANDS +NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *srv, const struct api_struct *cmds, int size) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} +#endif /*HAVE_RPC_PIPE_REGISTER_COMMANDS*/ + +#ifndef HAVE_SMB_REGISTER_VFS +NTSTATUS smb_register_vfs(int version, const char *name, vfs_op_tuple *(*init)(const struct vfs_ops *, struct smb_vfs_handle_struct *)) +{ + return NT_STATUS_NOT_IMPLEMENTED; +} +#endif /*HAVE_SMB_REGISTER_VFS*/ + +#endif /* _MODULE_DUMMY_H */ diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c index d9300f4668f..411a406a929 100644 --- a/source/nmbd/nmbd.c +++ b/source/nmbd/nmbd.c @@ -23,6 +23,8 @@ #include "includes.h" +#include "module_dummy.h" + int ClientNMB = -1; int ClientDGRAM = -1; int global_nmb_port = -1; diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c index fb6f67625c0..7c59344be2b 100644 --- a/source/nsswitch/winbindd.c +++ b/source/nsswitch/winbindd.c @@ -24,6 +24,8 @@ #include "winbindd.h" +#include "module_dummy.h" + BOOL opt_nocache = False; BOOL opt_dual_daemon = False; diff --git a/source/passdb/pdb_interface.c b/source/passdb/pdb_interface.c index 7b44df193fc..dc2b43d204d 100644 --- a/source/passdb/pdb_interface.c +++ b/source/passdb/pdb_interface.c @@ -436,10 +436,10 @@ static NTSTATUS make_pdb_methods_name(struct pdb_methods **methods, struct pdb_c /* Try to find a module that contains this module */ if (!entry) { DEBUG(2,("No builtin backend found, trying to load plugin\n")); - if(NT_STATUS_IS_OK(smb_probe_module("pdb", module_name)) && !(entry = pdb_find_backend_entry(module_name))) { + if(NT_STATUS_IS_OK(nt_status = smb_probe_module("pdb", module_name)) && !(entry = pdb_find_backend_entry(module_name))) { DEBUG(0,("Plugin is available, but doesn't register passdb backend %s\n", module_name)); SAFE_FREE(module_name); - return NT_STATUS_UNSUCCESSFUL; + return nt_status; } } diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c index a1b0a8cd345..fb0845e615b 100644 --- a/source/rpcclient/rpcclient.c +++ b/source/rpcclient/rpcclient.c @@ -23,6 +23,10 @@ #include "includes.h" #include "rpcclient.h" + +#define HAVE_SMB_REGISTER_PASSDB +#include "module_dummy.h" + DOM_SID domain_sid; diff --git a/source/smbd/server.c b/source/smbd/server.c index d46be42eba6..e933c4d3d45 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -22,6 +22,13 @@ #include "includes.h" +#define HAVE_SMB_REGISTER_AUTH +#define HAVE_SMB_REGISTER_PASSDB +#define HAVE_RPC_PIPE_REGISTER_COMMANDS +#define HAVE_SMB_REGISTER_VFS +#include "module_dummy.h" + + int am_parent = 1; /* the last message the was processed */ diff --git a/source/torture/locktest.c b/source/torture/locktest.c index 63b9590dd61..c18d2c100bc 100644 --- a/source/torture/locktest.c +++ b/source/torture/locktest.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static fstring password[2]; static fstring username[2]; static int got_user; diff --git a/source/torture/locktest2.c b/source/torture/locktest2.c index 97844b5609e..596596eb8a8 100644 --- a/source/torture/locktest2.c +++ b/source/torture/locktest2.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static fstring password; static fstring username; static int got_pass; diff --git a/source/torture/masktest.c b/source/torture/masktest.c index 06dead3f16f..a4da1baff27 100644 --- a/source/torture/masktest.c +++ b/source/torture/masktest.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static fstring password; static fstring username; static int got_pass; diff --git a/source/torture/msgtest.c b/source/torture/msgtest.c index 8abb0a20d2e..091b6337ab1 100644 --- a/source/torture/msgtest.c +++ b/source/torture/msgtest.c @@ -25,6 +25,8 @@ #include "includes.h" +#include "module_dummy.h" + static int pong_count; /**************************************************************************** diff --git a/source/torture/nsstest.c b/source/torture/nsstest.c index a82fa05203e..27b77e2a83b 100644 --- a/source/torture/nsstest.c +++ b/source/torture/nsstest.c @@ -20,6 +20,8 @@ #include "includes.h" +#include "module_dummy.h" + static const char *so_path = "/lib/libnss_winbind.so"; static const char *nss_name = "winbind"; static int nss_errno; diff --git a/source/torture/rpctorture.c b/source/torture/rpctorture.c index 086f8d5d331..e88a39a4839 100644 --- a/source/torture/rpctorture.c +++ b/source/torture/rpctorture.c @@ -20,6 +20,8 @@ #include "includes.h" +#include "module_dummy.h" + #ifndef REGISTER #define REGISTER 0 #endif diff --git a/source/torture/smbiconv.c b/source/torture/smbiconv.c index ce21a09025e..613082225a2 100644 --- a/source/torture/smbiconv.c +++ b/source/torture/smbiconv.c @@ -23,6 +23,8 @@ #include "includes.h" +#include "module_dummy.h" + static int process_block (smb_iconv_t cd, char *addr, size_t len, FILE *output) { diff --git a/source/torture/torture.c b/source/torture/torture.c index 07d7f1547ed..4141b29cc20 100644 --- a/source/torture/torture.c +++ b/source/torture/torture.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static fstring host, workgroup, share, password, username, myname; static int max_protocol = PROTOCOL_NT1; static const char *sockops="TCP_NODELAY"; diff --git a/source/torture/vfstest.c b/source/torture/vfstest.c index 3b28a3c496b..d6b84126a0b 100644 --- a/source/torture/vfstest.c +++ b/source/torture/vfstest.c @@ -27,6 +27,12 @@ #include "includes.h" #include "vfstest.h" +#define HAVE_SMB_REGISTER_AUTH +#define HAVE_SMB_REGISTER_PASSDB +#define HAVE_RPC_PIPE_REGISTER_COMMANDS +#define HAVE_SMB_REGISTER_VFS +#include "module_dummy.h" + /* List to hold groups of commands */ static struct cmd_list { struct cmd_list *prev, *next; diff --git a/source/utils/net.c b/source/utils/net.c index aa245a920a7..b2a86bb0201 100644 --- a/source/utils/net.c +++ b/source/utils/net.c @@ -40,6 +40,10 @@ #include "includes.h" #include "../utils/net.h" +#define HAVE_SMB_REGISTER_PASSDB +#include "module_dummy.h" + + /***********************************************************************/ /* Beginning of internationalization section. Translatable constants */ /* should be kept in this area and referenced in the rest of the code. */ diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c index d2c5cbc00ed..7083961ccb5 100644 --- a/source/utils/nmblookup.c +++ b/source/utils/nmblookup.c @@ -24,6 +24,8 @@ #include "includes.h" +#include "module_dummy.h" + extern BOOL AllowDebugChange; static BOOL give_flags = False; diff --git a/source/utils/ntlm_auth.c b/source/utils/ntlm_auth.c index a713f3aa2dd..0d63afda72c 100644 --- a/source/utils/ntlm_auth.c +++ b/source/utils/ntlm_auth.c @@ -27,6 +27,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +#include "module_dummy.h" + #define SQUID_BUFFER_SIZE 2010 enum squid_mode { diff --git a/source/utils/pdbedit.c b/source/utils/pdbedit.c index 3a3d06a6452..5116855e71b 100644 --- a/source/utils/pdbedit.c +++ b/source/utils/pdbedit.c @@ -23,6 +23,9 @@ #include "includes.h" +#define HAVE_SMB_REGISTER_PASSDB +#include "module_dummy.h" + #define BIT_BACKEND 0x00000004 #define BIT_VERBOSE 0x00000008 #define BIT_SPSTYLE 0x00000010 diff --git a/source/utils/profiles.c b/source/utils/profiles.c index 7c2d820c810..8abdfd6f77e 100644 --- a/source/utils/profiles.c +++ b/source/utils/profiles.c @@ -297,6 +297,8 @@ Hope this helps.... (Although it was "fun" for me to uncover this things, #include <unistd.h> #include <sys/mman.h> +#include "module_dummy.h" + typedef unsigned int DWORD; typedef unsigned short WORD; diff --git a/source/utils/rpccheck.c b/source/utils/rpccheck.c index ae109f69b65..11a2a9d8baa 100644 --- a/source/utils/rpccheck.c +++ b/source/utils/rpccheck.c @@ -20,6 +20,8 @@ #include "includes.h" +#include "module_dummy.h" + main() { char filter[]="0123456789ABCDEF"; diff --git a/source/utils/smbcacls.c b/source/utils/smbcacls.c index 9d8a6577263..35a9b05dcd7 100644 --- a/source/utils/smbcacls.c +++ b/source/utils/smbcacls.c @@ -24,6 +24,8 @@ #include "includes.h" +#include "module_dummy.h" + static pstring owner_username; static fstring server; static int test_args = False; diff --git a/source/utils/smbcontrol.c b/source/utils/smbcontrol.c index 06add6af228..0c68bfc329a 100644 --- a/source/utils/smbcontrol.c +++ b/source/utils/smbcontrol.c @@ -25,6 +25,8 @@ #include "includes.h" +#include "module_dummy.h" + /* Default timeout value when waiting for replies (in seconds) */ #define DEFAULT_TIMEOUT 10 diff --git a/source/utils/smbcquotas.c b/source/utils/smbcquotas.c index 9c7379ca2a9..9ba243a4a58 100644 --- a/source/utils/smbcquotas.c +++ b/source/utils/smbcquotas.c @@ -24,6 +24,8 @@ #include "includes.h" +#include "module_dummy.h" + static pstring server; /* numeric is set when the user wants numeric SIDs and ACEs rather diff --git a/source/utils/smbfilter.c b/source/utils/smbfilter.c index 1a0d639f025..fe5208227d7 100644 --- a/source/utils/smbfilter.c +++ b/source/utils/smbfilter.c @@ -20,6 +20,8 @@ #include "includes.h" +#include "module_dummy.h" + #define SECURITY_MASK 0 #define SECURITY_SET 0 diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c index 577e467fbdb..2070adb3e56 100644 --- a/source/utils/smbpasswd.c +++ b/source/utils/smbpasswd.c @@ -19,6 +19,9 @@ #include "includes.h" +#define HAVE_SMB_REGISTER_PASSDB +#include "module_dummy.h" + extern BOOL AllowDebugChange; /* diff --git a/source/utils/smbtree.c b/source/utils/smbtree.c index cbe1bd448f8..bc669b4aa16 100644 --- a/source/utils/smbtree.c +++ b/source/utils/smbtree.c @@ -22,6 +22,8 @@ #include "includes.h" +#include "module_dummy.h" + static BOOL use_bcast; /* How low can we go? */ diff --git a/source/utils/status.c b/source/utils/status.c index bbaeecdd6bb..fab55baabbb 100644 --- a/source/utils/status.c +++ b/source/utils/status.c @@ -35,6 +35,8 @@ #include "includes.h" +#include "module_dummy.h" + static pstring Ucrit_username = ""; /* added by OH */ static pid_t Ucrit_pid[100]; /* Ugly !!! */ /* added by OH */ static int Ucrit_MaxPid=0; /* added by OH */ diff --git a/source/utils/testparm.c b/source/utils/testparm.c index e3d6ce02748..b3e8f8badbf 100644 --- a/source/utils/testparm.c +++ b/source/utils/testparm.c @@ -34,6 +34,8 @@ #include "includes.h" +#include "module_dummy.h" + extern BOOL AllowDebugChange; /*********************************************** diff --git a/source/utils/testprns.c b/source/utils/testprns.c index 7e52b86afb6..758e2b41dd6 100644 --- a/source/utils/testprns.c +++ b/source/utils/testprns.c @@ -32,6 +32,8 @@ #include "includes.h" +#include "module_dummy.h" + int main(int argc, char *argv[]) { const char *pszTemp; diff --git a/source/web/swat.c b/source/web/swat.c index 7f9492933a5..e93fb2e5e12 100644 --- a/source/web/swat.c +++ b/source/web/swat.c @@ -31,6 +31,9 @@ #include "includes.h" #include "../web/swat_proto.h" +#define HAVE_SMB_REGISTER_PASSDB +#include "module_dummy.h" + #define GLOBALS_SNUM -1 static BOOL demo_mode = False; diff --git a/source/wrepld/server.c b/source/wrepld/server.c index 504818b8d52..21bc2e4925b 100644 --- a/source/wrepld/server.c +++ b/source/wrepld/server.c @@ -21,6 +21,8 @@ #include "includes.h" #include "wins_repl.h" +#include "module_dummy.h" + extern pstring user_socket_options; extern WINS_OWNER *global_wins_table; |