Init functions in winbind idmap modules

Christof Schmitt cs at samba.org
Tue Apr 1 17:05:48 MDT 2014


On Tue, Apr 01, 2014 at 01:25:49PM -0700, Jeremy Allison wrote:
> On Tue, Apr 01, 2014 at 11:39:39AM -0700, Christof Schmitt wrote:
> > The init functions in the winbind idmap modules are not very consistent,
> > some are called samba_init_module, others use different names:
> > 
> > source3/winbindd/idmap_ad.c:NTSTATUS samba_init_module(void)
> > source3/winbindd/idmap_autorid.c:NTSTATUS samba_init_module(void)
> > source3/winbindd/idmap_ldap.c:NTSTATUS idmap_ldap_init(void)
> > source3/winbindd/idmap_nss.c:NTSTATUS idmap_nss_init(void)
> > source3/winbindd/idmap_passdb.c:NTSTATUS idmap_passdb_init(void)
> > source3/winbindd/idmap_rfc2307.c:NTSTATUS idmap_rfc2307_init(void)
> > source3/winbindd/idmap_rid.c:NTSTATUS samba_init_module(void)
> > 
> > I also saw that there is some code in waf to create a define to
> > samba_init_module, but i find that somewhat confusing.
> > 
> > Should all modules use a similar init function name for consistency?
> 
> That would probably help. Send in a patch and I'll
> review !

Maybe this patch would be a start. It renames all init functions named
samba_init_module to a name based on the module. The complexity with the
define in waf is still there, but at least all modules are treated the
same.

Christof
-------------- next part --------------
>From fa566648e78309617a028e9ec5a233216b54ccb2 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Tue, 1 Apr 2014 15:45:38 -0700
Subject: [PATCH] Rename module init functions from samba_init_module

Some modules use samba_init_module as the name for the init functions,
others use a name based on he module name.

Rename the init functions from samba_init_module, to be consistent
across all modules. This change also allows to build idmap_tdb2 and
perfcount_test statically.

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 source3/modules/perfcount_test.c         |    2 +-
 source3/winbindd/idmap_ad.c              |    2 +-
 source3/winbindd/idmap_autorid.c         |    2 +-
 source3/winbindd/idmap_hash/idmap_hash.c |    2 +-
 source3/winbindd/idmap_rid.c             |    2 +-
 source3/winbindd/idmap_tdb2.c            |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/source3/modules/perfcount_test.c b/source3/modules/perfcount_test.c
index 8d17ee5..c0b5336 100644
--- a/source3/modules/perfcount_test.c
+++ b/source3/modules/perfcount_test.c
@@ -381,7 +381,7 @@ static struct smb_perfcount_handlers perfcount_test_handlers = {
 	perfcount_test_end
 };
 
-NTSTATUS samba_init_module(void)
+NTSTATUS perfcount_test_init(void)
 {
 	return smb_register_perfcounter(SMB_PERFCOUNTER_INTERFACE_VERSION,
 					"pc_test", &perfcount_test_handlers);
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 8b63801..047511f 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -962,7 +962,7 @@ static struct nss_info_methods nss_sfu20_methods = {
  Initialize the plugins
  ***********************************************************************/
 
-NTSTATUS samba_init_module(void)
+NTSTATUS idmap_ad_init(void)
 {
 	static NTSTATUS status_idmap_ad = NT_STATUS_UNSUCCESSFUL;
 	static NTSTATUS status_nss_rfc2307 = NT_STATUS_UNSUCCESSFUL;
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 4669b8d..35b4b68 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -688,7 +688,7 @@ static struct idmap_methods autorid_methods = {
 	.allocate_id	 = idmap_autorid_allocate_id
 };
 
-NTSTATUS samba_init_module(void)
+NTSTATUS idmap_autorid_init(void)
 {
 	return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION,
 				  "autorid", &autorid_methods);
diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c
index bff1e9e..1dbd300 100644
--- a/source3/winbindd/idmap_hash/idmap_hash.c
+++ b/source3/winbindd/idmap_hash/idmap_hash.c
@@ -366,7 +366,7 @@ static struct nss_info_methods hash_nss_methods = {
  state.
  **********************************************************************/
 
-NTSTATUS samba_init_module(void)
+NTSTATUS idmap_hash_init(void)
 {
 	static NTSTATUS idmap_status = NT_STATUS_UNSUCCESSFUL;
 	static NTSTATUS nss_status = NT_STATUS_UNSUCCESSFUL;
diff --git a/source3/winbindd/idmap_rid.c b/source3/winbindd/idmap_rid.c
index f10f493..0856c80 100644
--- a/source3/winbindd/idmap_rid.c
+++ b/source3/winbindd/idmap_rid.c
@@ -189,7 +189,7 @@ static struct idmap_methods rid_methods = {
 	.sids_to_unixids = idmap_rid_sids_to_unixids,
 };
 
-NTSTATUS samba_init_module(void)
+NTSTATUS idmap_rid_init(void)
 {
 	return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "rid", &rid_methods);
 }
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 942490d..1abc938 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -609,7 +609,7 @@ static struct idmap_methods db_methods = {
 	.allocate_id     = idmap_tdb_common_get_new_id
 };
 
-NTSTATUS samba_init_module(void)
+NTSTATUS idmap_tdb2_init(void)
 {
 	return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_methods);
 }
-- 
1.7.1



More information about the samba-technical mailing list