diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-04-16 12:13:07 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-04-16 12:13:07 +0000 |
commit | a8c95d79f83b4097ee20d5f3f1005c38ccf00186 (patch) | |
tree | 266efebe2aa517548513d2eee9a673f16b79d5af | |
parent | cf00ce3e87a0d714fb38f709f9635b8a045866e3 (diff) | |
download | samba-a8c95d79f83b4097ee20d5f3f1005c38ccf00186.tar.gz samba-a8c95d79f83b4097ee20d5f3f1005c38ccf00186.tar.bz2 samba-a8c95d79f83b4097ee20d5f3f1005c38ccf00186.zip |
Add support for the new modules system to auth/ (merge from HEAD)
(This used to be commit c7a1de090db35835be1a1623bfc80c04065c5dd9)
-rw-r--r-- | source3/Makefile.in | 62 | ||||
-rw-r--r-- | source3/auth/auth.c | 100 | ||||
-rw-r--r-- | source3/auth/auth_builtin.c | 52 | ||||
-rw-r--r-- | source3/auth/auth_domain.c | 9 | ||||
-rw-r--r-- | source3/auth/auth_rhosts.c | 7 | ||||
-rw-r--r-- | source3/auth/auth_sam.c | 7 | ||||
-rw-r--r-- | source3/auth/auth_server.c | 5 | ||||
-rw-r--r-- | source3/auth/auth_unix.c | 4 | ||||
-rw-r--r-- | source3/auth/auth_winbind.c | 5 | ||||
-rw-r--r-- | source3/include/auth.h | 4 | ||||
-rw-r--r-- | source3/include/libsmbclient.h | 11 | ||||
-rw-r--r-- | source3/smbd/process.c | 2 | ||||
-rw-r--r-- | source3/smbd/server.c | 4 |
13 files changed, 159 insertions, 113 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 81ed00e721..2ce267c935 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -143,7 +143,8 @@ QUOTAOBJS=@QUOTAOBJS@ VFS_MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_extd_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@ PDB_MODULES = @PDB_MODULES@ RPC_MODULES = @RPC_MODULES@ -MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) +AUTH_MODULES = @AUTH_MODULES@ +MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(AUTH_MODULES) ###################################################################### # object file lists @@ -243,11 +244,11 @@ RPC_WKS_OBJ = rpc_server/srv_wkssvc.o rpc_server/srv_wkssvc_nt.o RPC_DFS_OBJ = rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o -RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o - RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o rpc_server/srv_util.o \ rpc_server/srv_pipe.o rpc_server/srv_lsa_hnd.o +RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o + RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ) # this includes only the low level parse code, not stuff @@ -260,7 +261,8 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_net.o \ rpc_parse/parse_samr.o rpc_parse/parse_srv.o \ rpc_parse/parse_wks.o rpc_parse/parse_ds.o \ rpc_parse/parse_spoolss.o rpc_parse/parse_dfs.o \ - rpc_parse/parse_echo.o $(REGOBJS_OBJ) + rpc_parse/parse_echo.o \ + $(REGOBJS_OBJ) RPC_CLIENT_OBJ = rpc_client/cli_pipe.o @@ -273,12 +275,14 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \ passdb/machine_sid.o passdb/util_sam_sid.o \ passdb/pdb_compat.o @PDB_STATIC@ -PDB_XML_OBJ = passdb/pdb_xml.o -PDB_MYSQL_OBJ = passdb/pdb_mysql.o +XML_OBJ = passdb/pdb_xml.o +MYSQL_OBJ = passdb/pdb_mysql.o +DEVEL_HELP_OBJ = modules/developer.o GROUPDB_OBJ = groupdb/mapping.o PROFILE_OBJ = profile/profile.o +PROFILES_OBJ = utils/profiles.o OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o smbd/oplock_linux.o @@ -288,9 +292,16 @@ PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o UNIGRP_OBJ = libsmb/netlogon_unigrp.o -AUTH_OBJ = auth/auth.o auth/auth_sam.o auth/auth_server.o auth/auth_domain.o \ - auth/auth_rhosts.o auth/auth_unix.o auth/auth_util.o auth/auth_winbind.o \ - auth/auth_builtin.o auth/auth_compat.o auth/auth_ntlmssp.o \ +AUTH_BUILTIN_OBJ = auth/auth_builtin.o +AUTH_DOMAIN_OBJ = auth/auth_domain.o +AUTH_SAM_OBJ = auth/auth_sam.o +AUTH_RHOSTS_OBJ = auth/auth_rhosts.o +AUTH_SERVER_OBJ = auth/auth_server.o +AUTH_UNIX_OBJ = auth/auth_unix.o +AUTH_WINBIND_OBJ = auth/auth_winbind.o + +AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/auth_compat.o \ + auth/auth_ntlmssp.o \ $(PLAINTEXT_AUTH_OBJ) $(UNIGRP_OBJ) MANGLE_OBJ = smbd/mangle.o smbd/mangle_hash.o smbd/mangle_map.o smbd/mangle_hash2.o @@ -313,7 +324,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \ smbd/change_trust_pw.o \ $(MANGLE_OBJ) -SMBD_OBJ_BASE = $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \ +SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \ $(RPC_SERVER_OBJ) $(RPC_PARSE_OBJ) $(SECRETS_OBJ) \ $(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \ $(LIB_OBJ) $(PRINTBACKEND_OBJ) $(QUOTAOBJS) $(OPLOCK_OBJ) \ @@ -332,7 +343,7 @@ PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o printing/notify.o MSDFS_OBJ = msdfs/msdfs.o -SMBD_OBJ = $(SMBD_OBJ_MAIN) $(SMBD_OBJ_BASE) +SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN) NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \ @@ -347,27 +358,27 @@ NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ nmbd/nmbd_subnetdb.o nmbd/nmbd_winsproxy.o nmbd/nmbd_winsserver.o \ nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o -NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ) \ +NMBD_OBJ = $(PARAM_OBJ) $(NMBD_OBJ1) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(UBIQX_OBJ) \ $(PROFILE_OBJ) $(LIB_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) WREPL_OBJ1 = wrepld/server.o wrepld/process.o wrepld/parser.o wrepld/socket.o \ wrepld/partners.o -WREPL_OBJ = $(WREPL_OBJ1) $(PARAM_OBJ) $(UBIQX_OBJ) \ +WREPL_OBJ = $(PARAM_OBJ) $(WREPL_OBJ1) $(UBIQX_OBJ) \ $(PROFILE_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ) SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \ web/swat.o web/neg_lang.o -SWAT_OBJ = $(SWAT_OBJ1) $(PRINTING_OBJ) $(LIBSMB_OBJ) $(LOCKING_OBJ) \ - $(PARAM_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \ +SWAT_OBJ = $(PARAM_OBJ) $(SWAT_OBJ1) $(PRINTING_OBJ) $(LIBSMB_OBJ) $(LOCKING_OBJ) \ + $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \ $(POPT_LIB_OBJ) -SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \ - $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) +SMBSH_OBJ = $(PARAM_OBJ) smbwrapper/smbsh.o smbwrapper/shared.o \ + $(UBIQX_OBJ) $(LIB_OBJ) -STATUS_OBJ = utils/status.o $(LOCKING_OBJ) $(PARAM_OBJ) \ +STATUS_OBJ = $(PARAM_OBJ) utils/status.o $(LOCKING_OBJ) \ $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ) SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \ @@ -594,7 +605,7 @@ NTLM_AUTH_OBJ = utils/ntlm_auth.o $(LIBNTLMSSP_OBJ) $(LIBSAMBA_OBJ) $(POPT_LIB_O ###################################################################### # now the rules... ###################################################################### -all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(SHLIBS) $(RPC_MODULES) @EXTRA_ALL_TARGETS@ +all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(SHLIBS) $(MODULES) @EXTRA_ALL_TARGETS@ pam_smbpass : SHOWFLAGS bin/pam_smbpass.@SHLIBEXT@ @@ -665,6 +676,7 @@ MAKEDIR = || exec false; \ # rebuild it's a bit hard. dynconfig.o: dynconfig.c Makefile + @$(MAKE) modules_clean @echo Compiling $*.c @$(CC) $(FLAGS) $(PATH_FLAGS) -c $< -o $@ @@ -1023,10 +1035,11 @@ installbin: all installdirs @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES) -installmodules: all installdirs +installmodules: modules installdirs @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(VFS_MODULES) @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(PDB_MODULES) @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES) + @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(AUTH_MODULES) installscripts: installdirs @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS) @@ -1037,10 +1050,10 @@ installdat: installdirs installswat: installdirs @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) -installclientlib: +installclientlib: libsmbclient -$(INSTALLCLIENTCMD_SH) bin/libsmbclient.@SHLIBEXT@ $(DESTDIR)${prefix}/lib -$(INSTALLCLIENTCMD_A) bin/libsmbclient.a $(DESTDIR)${prefix}/lib - -$(INSTALLCMD) -d $(DESTDIR)${prefix}/include + @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)${prefix}/include -$(INSTALLCMD) $(srcdir)/include/libsmbclient.h $(DESTDIR)${prefix}/include # Python extensions @@ -1107,6 +1120,7 @@ uninstallmodules: @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(VFS_MODULES) @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(PDB_MODULES) @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES) + @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(DESTDIR)$(AUTH_MODULES) uninstallscripts: @$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS) @@ -1119,6 +1133,10 @@ clean: delheaders python_clean $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(MODULES) $(TORTURE_PROGS) \ $(LIBSMBCLIENT) $(EVERYTHING_PROGS) .headers.stamp +# This is quite ugly actually.. But we need to make +# sure the changes to include/config.h are used. +modules_clean: + @-rm -f @MODULES_CLEAN@ auth/auth.o passdb/pdb_interface.o rpc_server/srv_pipe_hnd.o lib/iconv.o smbd/vfs.o # Making this target will just make sure that the prototype files # exist, not necessarily that they are up to date. Since they're diff --git a/source3/auth/auth.c b/source3/auth/auth.c index 126a712fbd..71e9ab0428 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -23,26 +23,45 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_AUTH -/** List of various built-in authentication modules */ - -static const struct auth_init_function_entry builtin_auth_init_functions[] = { - { "guest", auth_init_guest }, - { "rhosts", auth_init_rhosts }, - { "hostsequiv", auth_init_hostsequiv }, - { "sam", auth_init_sam }, - { "samstrict", auth_init_samstrict }, - { "unix", auth_init_unix }, - { "smbserver", auth_init_smbserver }, - { "ntdomain", auth_init_ntdomain }, - { "trustdomain", auth_init_trustdomain }, - { "winbind", auth_init_winbind }, -#ifdef DEVELOPER - { "name_to_ntstatus", auth_init_name_to_ntstatus }, - { "fixed_challenge", auth_init_fixed_challenge }, -#endif - { "plugin", auth_init_plugin }, - { NULL, NULL} -}; +static struct auth_init_function_entry *backends = NULL; + +BOOL smb_register_auth(const char *name, auth_init_function init, int version) +{ + struct auth_init_function_entry *entry = backends; + + if(version != AUTH_INTERFACE_VERSION) + return False; + + DEBUG(5,("Attempting to register auth backend %s\n", name)); + + while(entry) { + if (strequal(name, entry->name)) { + DEBUG(0,("There already is an auth backend registered with the name %s!\n", name)); + return False; + } + entry = entry->next; + } + + entry = smb_xmalloc(sizeof(struct auth_init_function_entry)); + entry->name = smb_xstrdup(name); + entry->init = init; + + DLIST_ADD(backends, entry); + DEBUG(5,("Successfully added auth backend '%s'\n", name)); + return True; +} + +static struct auth_init_function_entry *auth_find_backend_entry(const char *name) +{ + struct auth_init_function_entry *entry = backends; + + while(entry) { + if (strequal(entry->name, name)) return entry; + entry = entry->next; + } + + return NULL; +} /**************************************************************************** Try to get a challenge out of the various authentication modules. @@ -324,8 +343,8 @@ static NTSTATUS make_auth_context_text_list(struct auth_context **auth_context, auth_methods *list = NULL; auth_methods *t = NULL; auth_methods *tmp; - int i; NTSTATUS nt_status; + static BOOL initialised_static_modules = False; if (!text_list) { DEBUG(2,("make_auth_context_text_list: No auth method list!?\n")); @@ -334,15 +353,22 @@ static NTSTATUS make_auth_context_text_list(struct auth_context **auth_context, if (!NT_STATUS_IS_OK(nt_status = make_auth_context(auth_context))) return nt_status; + + /* Initialise static modules if not done so yet */ + if(!initialised_static_modules) { + static_init_auth; + initialised_static_modules = True; + } for (;*text_list; text_list++) { - DEBUG(5,("make_auth_context_text_list: Attempting to find an auth method to match %s\n", - *text_list)); - for (i = 0; builtin_auth_init_functions[i].name; i++) { + struct auth_init_function_entry *entry; char *module_name = smb_xstrdup(*text_list); char *module_params = NULL; char *p; + DEBUG(5,("make_auth_context_text_list: Attempting to find an auth method to match %s\n", + *text_list)); + p = strchr(module_name, ':'); if (p) { *p = 0; @@ -352,20 +378,20 @@ static NTSTATUS make_auth_context_text_list(struct auth_context **auth_context, trim_string(module_name, " ", " "); - if (strequal(builtin_auth_init_functions[i].name, module_name)) { - DEBUG(5,("make_auth_context_text_list: Found auth method %s (at pos %d)\n", *text_list, i)); - if (NT_STATUS_IS_OK(builtin_auth_init_functions[i].init(*auth_context, module_params, &t))) { - DEBUG(5,("make_auth_context_text_list: auth method %s has a valid init\n", - *text_list)); - DLIST_ADD_END(list, t, tmp); - } else { - DEBUG(0,("make_auth_context_text_list: auth method %s did not correctly init\n", - *text_list)); - } - break; + entry = auth_find_backend_entry(module_name); + + if(!(entry = auth_find_backend_entry(module_name)) && !smb_probe_module("auth", module_name) && + !(entry = auth_find_backend_entry(module_name))) { + DEBUG(0,("make_auth_context_text_list: can't find auth method %s!\n", module_name)); + } else if (!NT_STATUS_IS_OK(entry->init(*auth_context, module_params, &t))) { + DEBUG(0,("make_auth_context_text_list: auth method %s did not correctly init\n", + *text_list)); + } else { + DEBUG(5,("make_auth_context_text_list: auth method %s has a valid init\n", + *text_list)); + DLIST_ADD_END(list, t, tmp); } SAFE_FREE(module_name); - } } (*auth_context)->auth_method_list = list; @@ -417,7 +443,7 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) break; case SEC_ADS: DEBUG(5,("Making default auth method list for security=ADS\n")); - auth_method_list = str_list_make("guest sam ads winbind ntdomain", NULL); + auth_method_list = str_list_make("guest sam winbind ntdomain", NULL); break; default: DEBUG(5,("Unknown auth method!\n")); diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c index a19c532fc9..509a4afba9 100644 --- a/source3/auth/auth_builtin.c +++ b/source3/auth/auth_builtin.c @@ -161,50 +161,12 @@ NTSTATUS auth_init_fixed_challenge(struct auth_context *auth_context, const char return NT_STATUS_OK; } -/** - * Outsorce an auth module to an external loadable .so - * - * Only works on systems with dlopen() etc. - **/ - -/* Plugin modules initialisation */ - -NTSTATUS auth_init_plugin(struct auth_context *auth_context, const char *param, auth_methods **auth_method) +int auth_builtin_init(void) { - void * dl_handle; - char *plugin_param, *plugin_name, *p; - auth_init_function plugin_init; - - if (param == NULL) { - DEBUG(0, ("auth_init_plugin: The plugin module needs an argument!\n")); - return NT_STATUS_UNSUCCESSFUL; - } - - plugin_name = smb_xstrdup(param); - p = strchr(plugin_name, ':'); - if (p) { - *p = 0; - plugin_param = p+1; - trim_string(plugin_param, " ", " "); - } else plugin_param = NULL; - - trim_string(plugin_name, " ", " "); - - DEBUG(5, ("auth_init_plugin: Trying to load auth plugin %s\n", plugin_name)); - dl_handle = sys_dlopen(plugin_name, RTLD_NOW ); - if (!dl_handle) { - DEBUG(0, ("auth_init_plugin: Failed to load auth plugin %s using sys_dlopen (%s)\n", - plugin_name, sys_dlerror())); - return NT_STATUS_UNSUCCESSFUL; - } - - plugin_init = sys_dlsym(dl_handle, "auth_init"); - if (!plugin_init){ - DEBUG(0, ("Failed to find function 'auth_init' using sys_dlsym in sam plugin %s (%s)\n", - plugin_name, sys_dlerror())); - return NT_STATUS_UNSUCCESSFUL; - } - - DEBUG(5, ("Starting sam plugin %s with paramater %s\n", plugin_name, plugin_param?plugin_param:"(null)")); - return plugin_init(auth_context, plugin_param, auth_method); + smb_register_auth("guest", auth_init_guest, AUTH_INTERFACE_VERSION); +#ifdef DEVELOPER + smb_register_auth("fixed_challenge", auth_init_fixed_challenge, AUTH_INTERFACE_VERSION); + smb_register_auth("name_to_ntstatus", auth_init_name_to_ntstatus, AUTH_INTERFACE_VERSION); +#endif + return True; } diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 534af2257d..24a5bb562c 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -24,7 +24,7 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_AUTH -BOOL global_machine_password_needs_changing = False; +extern BOOL global_machine_password_needs_changing; extern userdom_struct current_user_info; @@ -545,3 +545,10 @@ NTSTATUS auth_init_trustdomain(struct auth_context *auth_context, const char* pa (*auth_method)->auth = check_trustdomain_security; return NT_STATUS_OK; } + +int auth_domain_init(void) +{ + smb_register_auth("trustdomain", auth_init_trustdomain, AUTH_INTERFACE_VERSION); + smb_register_auth("ntdomain", auth_init_ntdomain, AUTH_INTERFACE_VERSION); + return True; +} diff --git a/source3/auth/auth_rhosts.c b/source3/auth/auth_rhosts.c index 5451f7d930..db37193579 100644 --- a/source3/auth/auth_rhosts.c +++ b/source3/auth/auth_rhosts.c @@ -242,3 +242,10 @@ NTSTATUS auth_init_rhosts(struct auth_context *auth_context, const char *param, (*auth_method)->name = "rhosts"; return NT_STATUS_OK; } + +int auth_rhosts_init(void) +{ + smb_register_auth("rhosts", auth_init_rhosts, AUTH_INTERFACE_VERSION); + smb_register_auth("hostsequiv", auth_init_hostsequiv, AUTH_INTERFACE_VERSION); + return True; +} diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index b309833440..1fc8aa51bb 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -518,4 +518,9 @@ NTSTATUS auth_init_samstrict(struct auth_context *auth_context, const char *para return NT_STATUS_OK; } - +int auth_sam_init(void) +{ + smb_register_auth("samstrict", auth_init_samstrict, AUTH_INTERFACE_VERSION); + smb_register_auth("sam", auth_init_sam, AUTH_INTERFACE_VERSION); + return True; +} diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 5144852d3b..a311f01dc3 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -400,3 +400,8 @@ NTSTATUS auth_init_smbserver(struct auth_context *auth_context, const char* para (*auth_method)->free_private_data = free_server_private_data; return NT_STATUS_OK; } + +int auth_server_init(void) +{ + return smb_register_auth("smbserver", auth_init_smbserver, AUTH_INTERFACE_VERSION); +} diff --git a/source3/auth/auth_unix.c b/source3/auth/auth_unix.c index 4f44767a81..efab2046c3 100644 --- a/source3/auth/auth_unix.c +++ b/source3/auth/auth_unix.c @@ -130,3 +130,7 @@ NTSTATUS auth_init_unix(struct auth_context *auth_context, const char* param, au return NT_STATUS_OK; } +int auth_unix_init(void) +{ + return smb_register_auth("unix", auth_init_unix, AUTH_INTERFACE_VERSION); +} diff --git a/source3/auth/auth_winbind.c b/source3/auth/auth_winbind.c index 5e1567d3c1..e2a292dd01 100644 --- a/source3/auth/auth_winbind.c +++ b/source3/auth/auth_winbind.c @@ -134,3 +134,8 @@ NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, (*auth_method)->auth = check_winbind_security; return NT_STATUS_OK; } + +int auth_winbind_init(void) +{ + return smb_register_auth("winbind", auth_init_winbind, AUTH_INTERFACE_VERSION); +} diff --git a/source3/include/auth.h b/source3/include/auth.h index e37f181082..626b9f3ba0 100644 --- a/source3/include/auth.h +++ b/source3/include/auth.h @@ -148,6 +148,8 @@ struct auth_init_function_entry { /* Function to create a member of the authmethods list */ auth_init_function init; + + struct auth_init_function_entry *prev, *next; }; typedef struct auth_ntlmssp_state @@ -158,4 +160,6 @@ typedef struct auth_ntlmssp_state struct ntlmssp_state *ntlmssp_state; } AUTH_NTLMSSP_STATE; +#define AUTH_INTERFACE_VERSION 1 + #endif /* _SMBAUTH_H_ */ diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 0c905edcbc..f5d653f697 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -257,9 +257,8 @@ typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv); * */ typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv, - char * server, char * share, - char * workgroup, char * username); - + const char * server, const char * share, + const char * workgroup, const char * username); /**@ingroup callback * Look up a server in the cache system @@ -277,9 +276,9 @@ typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv, * @return pointer to SMBCSRV on success. NULL on failure. * */ -typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, char * server, - char * share, char * workgroup, char * username); - +typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server, + const char * share, const char * workgroup, + const char * username); /**@ingroup callback * Check if a server is still good diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 16ef30c46c..de1bea493f 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -44,7 +44,7 @@ extern userdom_struct current_user_info; extern int smb_read_error; SIG_ATOMIC_T reload_after_sighup = 0; SIG_ATOMIC_T got_sig_term = 0; -extern BOOL global_machine_password_needs_changing; +BOOL global_machine_password_needs_changing = False; extern int max_send; /**************************************************************************** diff --git a/source3/smbd/server.c b/source3/smbd/server.c index a6d3d92a8a..5c59dce4df 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -836,6 +836,10 @@ static BOOL init_structs(void ) if(!initialize_password_db(False)) exit(1); + static_init_rpc; + + init_modules(); + uni_group_cache_init(); /* Non-critical */ /* possibly reload the services file. */ |