s4-smbtorture: add ndr test for nbt_netlogon_packet to avoid future regressions.
[Samba/gebeck_regimport.git] / lib / util / samba_module.c
blobb15885be0360a8886d628779bd67fd4259b0d3ca
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Jelmer Vernooij 2002-2003,2005-2007
5 Copyright (C) Stefan (metze) Metzmacher 2003
6 Copyright (C) Andrew Bartlett 2011
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "dynconfig/dynconfig.h"
24 #include "lib/util/internal_module.h"
25 #include "system/filesys.h"
26 #include "system/dir.h"
28 /**
29 * Run the specified init functions.
31 * @return true if all functions ran successfully, false otherwise
33 bool samba_module_init_fns_run(samba_module_init_fn *fns)
35 int i;
36 bool ret = true;
38 if (fns == NULL)
39 return true;
41 for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
43 return ret;
46 /**
47 * Load the initialization functions from DSO files for a specific subsystem.
49 * Will return an array of function pointers to initialization functions
52 samba_module_init_fn *samba_module_init_fns_for_subsystem(TALLOC_CTX *mem_ctx, const char *subsystem)
54 char *path = modules_path(mem_ctx, subsystem);
55 samba_module_init_fn *ret;
57 ret = load_modules(mem_ctx, path);
59 talloc_free(path);
61 return ret;