packaging(RHEL): use ccache if available
[Samba.git] / examples / pdb / test.c
blobb5ddefc480a1d56074f7eb22ac65e9201635b904
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 3 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, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
22 static int testsam_debug_level = DBGC_ALL;
24 #undef DBGC_CLASS
25 #define DBGC_CLASS testsam_debug_level
27 /***************************************************************
28 Start enumeration of the passwd list.
29 ****************************************************************/
31 static NTSTATUS testsam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask)
33 DEBUG(10, ("testsam_setsampwent called\n"));
34 return NT_STATUS_NOT_IMPLEMENTED;
37 /***************************************************************
38 End enumeration of the passwd list.
39 ****************************************************************/
41 static void testsam_endsampwent(struct pdb_methods *methods)
43 DEBUG(10, ("testsam_endsampwent called\n"));
46 /*****************************************************************
47 Get one struct samu from the list (next in line)
48 *****************************************************************/
50 static NTSTATUS testsam_getsampwent(struct pdb_methods *methods, struct samu *user)
52 DEBUG(10, ("testsam_getsampwent called\n"));
53 return NT_STATUS_NOT_IMPLEMENTED;
56 /******************************************************************
57 Lookup a name in the SAM database
58 ******************************************************************/
60 static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname)
62 DEBUG(10, ("testsam_getsampwnam called\n"));
63 return NT_STATUS_NOT_IMPLEMENTED;
66 /***************************************************************************
67 Search by sid
68 **************************************************************************/
70 static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
72 DEBUG(10, ("testsam_getsampwsid called\n"));
73 return NT_STATUS_NOT_IMPLEMENTED;
76 /***************************************************************************
77 Delete a struct samu
78 ****************************************************************************/
80 static NTSTATUS testsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass)
82 DEBUG(10, ("testsam_delete_sam_account called\n"));
83 return NT_STATUS_NOT_IMPLEMENTED;
86 /***************************************************************************
87 Modifies an existing struct samu
88 ****************************************************************************/
90 static NTSTATUS testsam_update_sam_account (struct pdb_methods *methods, struct samu *newpwd)
92 DEBUG(10, ("testsam_update_sam_account called\n"));
93 return NT_STATUS_NOT_IMPLEMENTED;
96 /***************************************************************************
97 Adds an existing struct samu
98 ****************************************************************************/
100 static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, struct samu *newpwd)
102 DEBUG(10, ("testsam_add_sam_account called\n"));
103 return NT_STATUS_NOT_IMPLEMENTED;
106 NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *location)
108 NTSTATUS nt_status;
110 if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) {
111 return nt_status;
114 (*pdb_method)->name = "testsam";
116 /* Functions your pdb module doesn't provide should not be
117 set, make_pdb_methods() already provide suitable defaults for missing functions */
119 (*pdb_method)->setsampwent = testsam_setsampwent;
120 (*pdb_method)->endsampwent = testsam_endsampwent;
121 (*pdb_method)->getsampwent = testsam_getsampwent;
122 (*pdb_method)->getsampwnam = testsam_getsampwnam;
123 (*pdb_method)->getsampwsid = testsam_getsampwsid;
124 (*pdb_method)->add_sam_account = testsam_add_sam_account;
125 (*pdb_method)->update_sam_account = testsam_update_sam_account;
126 (*pdb_method)->delete_sam_account = testsam_delete_sam_account;
128 testsam_debug_level = debug_add_class("testsam");
129 if (testsam_debug_level == -1) {
130 testsam_debug_level = DBGC_ALL;
131 DEBUG(0, ("testsam: Couldn't register custom debugging class!\n"));
132 } else DEBUG(0, ("testsam: Debug class number of 'testsam': %d\n", testsam_debug_level));
134 DEBUG(0, ("Initializing testsam\n"));
135 if (location)
136 DEBUG(10, ("Location: %s\n", location));
138 return NT_STATUS_OK;
141 NTSTATUS init_module(void) {
142 return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam",
143 testsam_init);