libsmbclient: Fix 32-bit problems
[Samba.git] / examples / pdb / test.c
blob6d68d87a929ce433bd6e15b0da919009c7877e1f
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"
21 #include "passdb.h"
23 static int testsam_debug_level = DBGC_ALL;
25 #undef DBGC_CLASS
26 #define DBGC_CLASS testsam_debug_level
28 /******************************************************************
29 Lookup a name in the SAM database
30 ******************************************************************/
32 static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname)
34 DEBUG(10, ("testsam_getsampwnam called\n"));
35 return NT_STATUS_NOT_IMPLEMENTED;
38 /***************************************************************************
39 Search by sid
40 **************************************************************************/
42 static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid)
44 DEBUG(10, ("testsam_getsampwsid called\n"));
45 return NT_STATUS_NOT_IMPLEMENTED;
48 /***************************************************************************
49 Delete a struct samu
50 ****************************************************************************/
52 static NTSTATUS testsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass)
54 DEBUG(10, ("testsam_delete_sam_account called\n"));
55 return NT_STATUS_NOT_IMPLEMENTED;
58 /***************************************************************************
59 Modifies an existing struct samu
60 ****************************************************************************/
62 static NTSTATUS testsam_update_sam_account (struct pdb_methods *methods, struct samu *newpwd)
64 DEBUG(10, ("testsam_update_sam_account called\n"));
65 return NT_STATUS_NOT_IMPLEMENTED;
68 /***************************************************************************
69 Adds an existing struct samu
70 ****************************************************************************/
72 static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, struct samu *newpwd)
74 DEBUG(10, ("testsam_add_sam_account called\n"));
75 return NT_STATUS_NOT_IMPLEMENTED;
78 static NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *location)
80 NTSTATUS nt_status;
82 if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) {
83 return nt_status;
86 (*pdb_method)->name = "testsam";
88 /* Functions your pdb module doesn't provide should not be
89 set, make_pdb_methods() already provide suitable defaults for missing functions */
91 (*pdb_method)->getsampwnam = testsam_getsampwnam;
92 (*pdb_method)->getsampwsid = testsam_getsampwsid;
93 (*pdb_method)->add_sam_account = testsam_add_sam_account;
94 (*pdb_method)->update_sam_account = testsam_update_sam_account;
95 (*pdb_method)->delete_sam_account = testsam_delete_sam_account;
97 testsam_debug_level = debug_add_class("testsam");
98 if (testsam_debug_level == -1) {
99 testsam_debug_level = DBGC_ALL;
100 DEBUG(0, ("testsam: Couldn't register custom debugging class!\n"));
101 } else DEBUG(0, ("testsam: Debug class number of 'testsam': %d\n", testsam_debug_level));
103 DEBUG(0, ("Initializing testsam\n"));
104 if (location)
105 DEBUG(10, ("Location: %s\n", location));
107 return NT_STATUS_OK;
110 static_decl_pdb;
111 NTSTATUS pdb_test_init(void)
113 return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam",
114 testsam_init);