summaryrefslogtreecommitdiff
path: root/source4/passdb/pdb_ldap.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-02-03 11:10:56 +0000
committerStefan Metzmacher <metze@samba.org>2004-02-03 11:10:56 +0000
commit1c798aba40fb0e389c7a54ad3d8f7d45876f2809 (patch)
tree3ee4790e25089106db52b1f16d20583f7bf90b9e /source4/passdb/pdb_ldap.c
parenta9b28120b84fd63e333d5be26fe8116c85f12c87 (diff)
downloadsamba-1c798aba40fb0e389c7a54ad3d8f7d45876f2809.tar.gz
samba-1c798aba40fb0e389c7a54ad3d8f7d45876f2809.tar.bz2
samba-1c798aba40fb0e389c7a54ad3d8f7d45876f2809.zip
- port AUTH and PASSDB subsystems to new
SMB_SUBSYSTEM() scheme - some const fixes in ntvfs metze (This used to be commit af89a78123068767b1d134969c5651a0fd978b0d)
Diffstat (limited to 'source4/passdb/pdb_ldap.c')
-rw-r--r--source4/passdb/pdb_ldap.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/source4/passdb/pdb_ldap.c b/source4/passdb/pdb_ldap.c
index 6bab5b9bca..5f7db7f5de 100644
--- a/source4/passdb/pdb_ldap.c
+++ b/source4/passdb/pdb_ldap.c
@@ -28,7 +28,6 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
-#ifdef HAVE_LDAP
/* TODO:
* persistent connections: if using NSS LDAP, many connections are made
* however, using only one within Samba would be nice
@@ -1979,7 +1978,7 @@ static void free_private_data(void **vp)
/* No need to free any further, as it is talloc()ed */
}
-NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+static NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
struct ldapsam_privates *ldap_state;
@@ -2036,7 +2035,7 @@ NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
return NT_STATUS_OK;
}
-NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+static NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
struct ldapsam_privates *ldap_state;
@@ -2064,20 +2063,36 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method
return NT_STATUS_OK;
}
-
-#else
-
-NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+NTSTATUS pdb_ldap_init(void)
{
- DEBUG(0, ("ldap not detected at configure time, ldapsam not availalble!\n"));
- return NT_STATUS_UNSUCCESSFUL;
-}
+ NTSTATUS ret;
+ struct passdb_ops ops;
+
+ /* fill in our name */
+ ops.name = "ldapsam";
+ /* fill in all the operations */
+ ops.init = pdb_init_ldapsam;
+
+ /* register ourselves with the PASSDB subsystem. */
+ ret = register_backend("passdb", &ops);
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(0,("Failed to register '%s' PASSDB backend!\n",
+ ops.name));
+ return ret;
+ }
-NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
-{
- DEBUG(0, ("ldap not dectected at configure time, ldapsam_nua not available!\n"));
- return NT_STATUS_UNSUCCESSFUL;
-}
+ /* fill in our name */
+ ops.name = "ldapsam_nua";
+ /* fill in all the operations */
+ ops.init = pdb_init_ldapsam_nua;
+ /* register ourselves with the PASSDB subsystem. */
+ ret = register_backend("passdb", &ops);
+ if (!NT_STATUS_IS_OK(ret)) {
+ DEBUG(0,("Failed to register '%s' PASSDB backend!\n",
+ ops.name));
+ return ret;
+ }
-#endif
+ return ret;
+}