summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/passdb/pdb_interface.c24
-rw-r--r--source3/passdb/pdb_smbpasswd.c5
-rw-r--r--source3/passdb/pdb_tdb.c12
3 files changed, 30 insertions, 11 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index b5e7273520..7c6f5e4da9 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -174,12 +174,27 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
Make a pdb_context, given a text string.
*******************************************************************/
-NTSTATUS make_pdb_context_name(struct pdb_context **context, char *selected)
+NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selected)
{
/* HINT: Don't store 'selected' becouse its often an lp_ string and will 'go away' */
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
int i;
+ char *module_name = smb_xstrdup(selected);
+ char *module_location = NULL;
+ char *p;
+
+ p = strchr(module_name, ':');
+
+ if (p) {
+ *p = 0;
+ module_location = p+1;
+
+ trim_string(module_location, " ", " ");
+ }
+
+ trim_string(module_name, " ", " ");
+
if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context))) {
return nt_status;
}
@@ -187,13 +202,12 @@ NTSTATUS make_pdb_context_name(struct pdb_context **context, char *selected)
DEBUG(5,("Attempting to find an passdb backend to match %s\n", selected));
for (i = 0; builtin_pdb_init_functions[i].name; i++)
{
- if (strequal(builtin_pdb_init_functions[i].name, selected))
+ if (strequal(builtin_pdb_init_functions[i].name, module_name))
{
- DEBUG(5,("Found pdb backend %s (at pos %d)\n", selected, i));
+ DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_location, i));
if (NT_STATUS_IS_OK(nt_status
- = builtin_pdb_init_functions[i].init(*context, &(*context)->pdb_selected, NULL))) {
+ = builtin_pdb_init_functions[i].init(*context, &(*context)->pdb_selected, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n", selected));
- (*context)->pdb_selected->name = builtin_pdb_init_functions[i].name;
} else {
DEBUG(0,("pdb backend %s did not correctly init (error was %s)\n", selected, get_nt_error_msg(nt_status)));
(*context)->pdb_selected = NULL;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 3039e6681c..8199816234 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1576,6 +1576,8 @@ NTSTATUS pdb_init_smbpasswd(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
return nt_status;
}
+ (*pdb_method)->name = "smbpasswd";
+
(*pdb_method)->setsampwent = smbpasswd_setsampwent;
(*pdb_method)->endsampwent = smbpasswd_endsampwent;
(*pdb_method)->getsampwent = smbpasswd_getsampwent;
@@ -1609,7 +1611,6 @@ NTSTATUS pdb_init_smbpasswd(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
(*pdb_method)->private_data = privates;
-
(*pdb_method)->free_private_data = free_private_data;
return NT_STATUS_OK;
@@ -1624,6 +1625,8 @@ NTSTATUS pdb_init_smbpasswd_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_meth
return nt_status;
}
+ (*pdb_method)->name = "smbpasswd_nua";
+
privates = (*pdb_method)->private_data;
privates->permit_non_unix_accounts = True;
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index b1ba01fe98..5fdf348e15 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -131,8 +131,8 @@ static BOOL init_sam_from_buffer (struct tdbsam_privates *tdb_state,
}
if ((tdb_state->permit_non_unix_accounts)
- && (pdb_get_user_rid(sampass) >= tdb_state->low_nua_rid)
- && (pdb_get_user_rid(sampass) <= tdb_state->high_nua_rid)) {
+ && (user_rid >= tdb_state->low_nua_rid)
+ && (user_rid <= tdb_state->high_nua_rid)) {
} else {
struct passwd *pw;
@@ -142,7 +142,7 @@ static BOOL init_sam_from_buffer (struct tdbsam_privates *tdb_state,
* to try case permutations
*/
if (!username || !(pw=getpwnam_alloc(username))) {
- DEBUG(0,("tdb_sam: getpwnam_alloc(%s) return NULL. User does not exist!\n",
+ DEBUG(0,("tdbsam: getpwnam_alloc(%s) return NULL. User does not exist!\n",
username?username:"NULL"));
ret = False;
goto done;
@@ -842,6 +842,8 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
return nt_status;
}
+ (*pdb_method)->name = "tdbsam";
+
(*pdb_method)->setsampwent = tdbsam_setsampwent;
(*pdb_method)->endsampwent = tdbsam_endsampwent;
(*pdb_method)->getsampwent = tdbsam_getsampwent;
@@ -851,8 +853,6 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
(*pdb_method)->update_sam_account = tdbsam_update_sam_account;
(*pdb_method)->delete_sam_account = tdbsam_delete_sam_account;
- /* TODO: Setup private data and free */
-
tdb_state = talloc_zero(pdb_context->mem_ctx, sizeof(struct tdbsam_privates));
if (!tdb_state) {
@@ -886,6 +886,8 @@ NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
return nt_status;
}
+ (*pdb_method)->name = "tdbsam_nua";
+
tdb_state = (*pdb_method)->private_data;
tdb_state->permit_non_unix_accounts = True;