1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source4/smbd/rewrite.c
Jelmer Vernooij 71db46ea66 r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be
specified in .mk files (INIT_FUNCTION = ...)

The build system will define :
 - SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal
 - BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on

This removes the hack with the "static bool Initialised = " and the
"lazy_init" functions
(This used to be commit 7a8244761b)
2007-10-10 13:05:36 -05:00

82 lines
1.8 KiB
C

#include "includes.h"
#include "dynconfig.h"
/*
this is a set of temporary stub functions used during the core smbd rewrite.
This file will need to go away before the rewrite is complete
*/
BOOL pcap_printername_ok(const char *service, const char *foo)
{ return True; }
BOOL share_access_check(struct smbsrv_request *req, struct smbsrv_tcon *tcon, int snum, uint32_t desired_access)
{ return True; }
/*
* initialize an smb process. Guaranteed to be called only once per
* smbd instance (so it can assume it is starting from scratch, and
* delete temporary files etc)
*/
void smbd_process_init(void)
{
/* possibly reload the services file. */
reload_services(NULL, True);
if (*lp_rootdir()) {
if (sys_chroot(lp_rootdir()) == 0)
DEBUG(2,("Changed root to %s\n", lp_rootdir()));
}
service_cleanup_tmp_files();
}
void init_subsystems(void)
{
/* Do *not* remove this, until you have removed
* passdb/secrets.c, and proved that Samba still builds... */
/* Setup the SECRETS subsystem */
if (!secrets_init()) {
exit(1);
}
smbd_init_subsystems;
}
/****************************************************************************
Reload the services file.
**************************************************************************/
BOOL reload_services(struct smbsrv_connection *smb, BOOL test)
{
BOOL ret;
if (lp_loaded()) {
pstring fname;
pstrcpy(fname,lp_configfile());
if (file_exist(fname, NULL) &&
!strcsequal(fname, dyn_CONFIGFILE)) {
pstrcpy(dyn_CONFIGFILE, fname);
test = False;
}
}
reopen_logs();
if (test && !lp_file_list_changed())
return(True);
ret = lp_load(dyn_CONFIGFILE, False, False, True);
/* perhaps the config filename is now set */
if (!test)
reload_services(smb, True);
reopen_logs();
load_interfaces();
return(ret);
}