source: branches/samba-3.0/examples/pdb/test.c

Last change on this file was 1, checked in by Paul Smedley, 18 years ago

Initial code import

File size: 5.0 KB
Line 
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.
14 *
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.
18 */
19
20
21#include "includes.h"
22
23static int testsam_debug_level = DBGC_ALL;
24
25#undef DBGC_CLASS
26#define DBGC_CLASS testsam_debug_level
27
28/***************************************************************
29 Start enumeration of the passwd list.
30****************************************************************/
31
32static NTSTATUS testsam_setsampwent(struct pdb_methods *methods, BOOL update, uint32 acb_mask)
33{
34 DEBUG(10, ("testsam_setsampwent called\n"));
35 return NT_STATUS_NOT_IMPLEMENTED;
36}
37
38/***************************************************************
39 End enumeration of the passwd list.
40****************************************************************/
41
42static void testsam_endsampwent(struct pdb_methods *methods)
43{
44 DEBUG(10, ("testsam_endsampwent called\n"));
45}
46
47/*****************************************************************
48 Get one struct samu from the list (next in line)
49*****************************************************************/
50
51static NTSTATUS testsam_getsampwent(struct pdb_methods *methods, struct samu *user)
52{
53 DEBUG(10, ("testsam_getsampwent called\n"));
54 return NT_STATUS_NOT_IMPLEMENTED;
55}
56
57/******************************************************************
58 Lookup a name in the SAM database
59******************************************************************/
60
61static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname)
62{
63 DEBUG(10, ("testsam_getsampwnam called\n"));
64 return NT_STATUS_NOT_IMPLEMENTED;
65}
66
67/***************************************************************************
68 Search by sid
69 **************************************************************************/
70
71static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
72{
73 DEBUG(10, ("testsam_getsampwsid called\n"));
74 return NT_STATUS_NOT_IMPLEMENTED;
75}
76
77/***************************************************************************
78 Delete a struct samu
79****************************************************************************/
80
81static NTSTATUS testsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass)
82{
83 DEBUG(10, ("testsam_delete_sam_account called\n"));
84 return NT_STATUS_NOT_IMPLEMENTED;
85}
86
87/***************************************************************************
88 Modifies an existing struct samu
89****************************************************************************/
90
91static NTSTATUS testsam_update_sam_account (struct pdb_methods *methods, struct samu *newpwd)
92{
93 DEBUG(10, ("testsam_update_sam_account called\n"));
94 return NT_STATUS_NOT_IMPLEMENTED;
95}
96
97/***************************************************************************
98 Adds an existing struct samu
99****************************************************************************/
100
101static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, struct samu *newpwd)
102{
103 DEBUG(10, ("testsam_add_sam_account called\n"));
104 return NT_STATUS_NOT_IMPLEMENTED;
105}
106
107NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *location)
108{
109 NTSTATUS nt_status;
110
111 if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) {
112 return nt_status;
113 }
114
115 (*pdb_method)->name = "testsam";
116
117 /* Functions your pdb module doesn't provide should not be
118 set, make_pdb_methods() already provide suitable defaults for missing functions */
119
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;
128
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));
134
135 DEBUG(0, ("Initializing testsam\n"));
136 if (location)
137 DEBUG(10, ("Location: %s\n", location));
138
139 return NT_STATUS_OK;
140}
141
142NTSTATUS init_module(void) {
143 return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam",
144 testsam_init);
145}
Note: See TracBrowser for help on using the repository browser.