summaryrefslogtreecommitdiff
path: root/source3/passdb/pdb_unix.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2002-09-26 09:50:53 +0000
committerSimo Sorce <idra@samba.org>2002-09-26 09:50:53 +0000
commit9e70b39ab29b877906ca3e20bc25700c2e05ae1b (patch)
tree1c709fecafd012a49fd14b66b448397a3702077e /source3/passdb/pdb_unix.c
parent2c33710351e2bf5b2c13060a87a5c7d917ab8116 (diff)
downloadsamba-9e70b39ab29b877906ca3e20bc25700c2e05ae1b.tar.gz
samba-9e70b39ab29b877906ca3e20bc25700c2e05ae1b.tar.bz2
samba-9e70b39ab29b877906ca3e20bc25700c2e05ae1b.zip
move all the passdb internal interface to NTSTATUS
only the interface has been fully moved to NTSTATUS not all the plugins make full use of it, but have been all converted. My testings passed completely, however a bit of more testing is welcome Simo. (This used to be commit 102a26e06591928a03b49cd312a65811ed46314f)
Diffstat (limited to 'source3/passdb/pdb_unix.c')
-rw-r--r--source3/passdb/pdb_unix.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/source3/passdb/pdb_unix.c b/source3/passdb/pdb_unix.c
index 06f12164eb..ba5ed0abdf 100644
--- a/source3/passdb/pdb_unix.c
+++ b/source3/passdb/pdb_unix.c
@@ -23,20 +23,20 @@
Lookup a name in the SAM database
******************************************************************/
-static BOOL unixsam_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user, const char *sname)
+static NTSTATUS unixsam_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user, const char *sname)
{
struct passwd *pass;
if (!methods) {
DEBUG(0,("invalid methods\n"));
- return False;
+ return NT_STATUS_UNSUCCESSFUL;
}
if (!sname) {
DEBUG(0,("invalid name specified"));
- return False;
+ return NT_STATUS_UNSUCCESSFUL;
}
pass = Get_Pwnam(sname);
- return NT_STATUS_IS_OK(pdb_fill_sam_pw(user, pass));
+ return pdb_fill_sam_pw(user, pass);
}
@@ -44,45 +44,45 @@ static BOOL unixsam_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user,
Search by rid
**************************************************************************/
-static BOOL unixsam_getsampwrid (struct pdb_methods *methods,
+static NTSTATUS unixsam_getsampwrid (struct pdb_methods *methods,
SAM_ACCOUNT *user, uint32 rid)
{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
struct passwd *pass;
- BOOL ret = False;
const char *guest_account = lp_guestaccount();
if (!(guest_account && *guest_account)) {
DEBUG(1, ("NULL guest account!?!?\n"));
- return False;
+ return nt_status;
}
if (!methods) {
DEBUG(0,("invalid methods\n"));
- return False;
+ return nt_status;
}
if (rid == DOMAIN_USER_RID_GUEST) {
pass = getpwnam_alloc(guest_account);
if (!pass) {
DEBUG(1, ("guest account %s does not seem to exist...\n", guest_account));
- return False;
+ return nt_status;
}
} else if (pdb_rid_is_user(rid)) {
pass = getpwuid_alloc(fallback_pdb_user_rid_to_uid (rid));
} else {
- return False;
+ return nt_status;
}
- ret = NT_STATUS_IS_OK(pdb_fill_sam_pw(user, pass));
+ nt_status = pdb_fill_sam_pw(user, pass);
passwd_free(&pass);
- return ret;
+ return nt_status;
}
-static BOOL unixsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
+static NTSTATUS unixsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
{
uint32 rid;
if (!sid_peek_check_rid(get_global_sam_sid(), sid, &rid))
- return False;
+ return NT_STATUS_UNSUCCESSFUL;
return unixsam_getsampwrid(my_methods, user, rid);
}
@@ -90,10 +90,10 @@ static BOOL unixsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * us
Adds an existing SAM_ACCOUNT
****************************************************************************/
-static BOOL unixsam_add_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS unixsam_add_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
{
DEBUG(0,("pdb_unix should not be listed as the first passdb backend! You can't add users to it.\n"));
- return False;
+ return NT_STATUS_NOT_IMPLEMENTED;
}
/***************************************************************************
@@ -106,11 +106,31 @@ static BOOL unixsam_add_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *n
as if the pdb_unix version was modified, but its actually stored somehwere.
****************************************************************************/
-static BOOL unixsam_update_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS unixsam_update_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
{
return methods->parent->pdb_add_sam_account(methods->parent, newpwd);
}
+static NTSTATUS unixsam_delete_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *pwd)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS unixsam_setsampwent(struct pdb_methods *methods, BOOL update)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS unixsam_getsampwent(struct pdb_methods *methods, SAM_ACCOUNT *user)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static void unixsam_endsampwent(struct pdb_methods *methods)
+{
+ return; /* NT_STATUS_NOT_IMPLEMENTED; */
+}
+
NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
@@ -126,14 +146,14 @@ NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
(*pdb_method)->name = "unixsam";
- (*pdb_method)->setsampwent = NULL;
- (*pdb_method)->endsampwent = NULL;
- (*pdb_method)->getsampwent = NULL;
+ (*pdb_method)->setsampwent = unixsam_setsampwent;
+ (*pdb_method)->endsampwent = unixsam_endsampwent;
+ (*pdb_method)->getsampwent = unixsam_getsampwent;
(*pdb_method)->getsampwnam = unixsam_getsampwnam;
(*pdb_method)->getsampwsid = unixsam_getsampwsid;
(*pdb_method)->add_sam_account = unixsam_add_sam_account;
(*pdb_method)->update_sam_account = unixsam_update_sam_account;
- (*pdb_method)->delete_sam_account = NULL;
+ (*pdb_method)->delete_sam_account = unixsam_delete_sam_account;
/* There's not very much to initialise here */
return NT_STATUS_OK;