r18193: Not quite to autogenerated NDR but closer thanks to Jelmer's
[Samba/bb.git] / examples / pdb / test.c
blobc553f72f0bb23c42df805b1f7ef88f507a98ad87
1 /*
2 * Test password backend for samba
3 * Copyright (C) Jelmer Vernooij 2002
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 675
17 * Mass Ave, Cambridge, MA 02139, USA.
21 #include "includes.h"
23 static int testsam_debug_level = DBGC_ALL;
25 #undef DBGC_CLASS
26 #define DBGC_CLASS testsam_debug_level
28 /***************************************************************
29 Start enumeration of the passwd list.
30 ****************************************************************/
32 static NTSTATUS testsam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask)
34 DEBUG(10, ("testsam_setsampwent called\n"));
35 return NT_STATUS_NOT_IMPLEMENTED;
38 /***************************************************************
39 End enumeration of the passwd list.
40 ****************************************************************/
42 static void testsam_endsampwent(struct pdb_methods *methods)
44 DEBUG(10, ("testsam_endsampwent called\n"));
47 /*****************************************************************
48 Get one struct samu from the list (next in line)
49 *****************************************************************/
51 static NTSTATUS testsam_getsampwent(struct pdb_methods *methods, struct samu *user)
53 DEBUG(10, ("testsam_getsampwent called\n"));
54 return NT_STATUS_NOT_IMPLEMENTED;
57 /******************************************************************
58 Lookup a name in the SAM database
59 ******************************************************************/
61 static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname)
63 DEBUG(10, ("testsam_getsampwnam called\n"));
64 return NT_STATUS_NOT_IMPLEMENTED;
67 /***************************************************************************
68 Search by sid
69 **************************************************************************/
71 static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
73 DEBUG(10, ("testsam_getsampwsid called\n"));
74 return NT_STATUS_NOT_IMPLEMENTED;
77 /***************************************************************************
78 Delete a struct samu
79 ****************************************************************************/
81 static NTSTATUS testsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass)
83 DEBUG(10, ("testsam_delete_sam_account called\n"));
84 return NT_STATUS_NOT_IMPLEMENTED;
87 /***************************************************************************
88 Modifies an existing struct samu
89 ****************************************************************************/
91 static NTSTATUS testsam_update_sam_account (struct pdb_methods *methods, struct samu *newpwd)
93 DEBUG(10, ("testsam_update_sam_account called\n"));
94 return NT_STATUS_NOT_IMPLEMENTED;
97 /***************************************************************************
98 Adds an existing struct samu
99 ****************************************************************************/
101 static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, struct samu *newpwd)
103 DEBUG(10, ("testsam_add_sam_account called\n"));
104 return NT_STATUS_NOT_IMPLEMENTED;
107 NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *location)
109 NTSTATUS nt_status;
111 if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) {
112 return nt_status;
115 (*pdb_method)->name = "testsam";
117 /* Functions your pdb module doesn't provide should not be
118 set, make_pdb_methods() already provide suitable defaults for missing functions */
120 (*pdb_method)->setsampwent = testsam_setsampwent;
121 (*pdb_method)->endsampwent = testsam_endsampwent;
122 (*pdb_method)->getsampwent = testsam_getsampwent;
123 (*pdb_method)->getsampwnam = testsam_getsampwnam;
124 (*pdb_method)->getsampwsid = testsam_getsampwsid;
125 (*pdb_method)->add_sam_account = testsam_add_sam_account;
126 (*pdb_method)->update_sam_account = testsam_update_sam_account;
127 (*pdb_method)->delete_sam_account = testsam_delete_sam_account;
129 testsam_debug_level = debug_add_class("testsam");
130 if (testsam_debug_level == -1) {
131 testsam_debug_level = DBGC_ALL;
132 DEBUG(0, ("testsam: Couldn't register custom debugging class!\n"));
133 } else DEBUG(0, ("testsam: Debug class number of 'testsam': %d\n", testsam_debug_level));
135 DEBUG(0, ("Initializing testsam\n"));
136 if (location)
137 DEBUG(10, ("Location: %s\n", location));
139 return NT_STATUS_OK;
142 NTSTATUS init_module(void) {
143 return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam",
144 testsam_init);