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