Line data Source code
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 : #include "passdb.h" 22 : 23 : static int testsam_debug_level = DBGC_ALL; 24 : 25 : #undef DBGC_CLASS 26 : #define DBGC_CLASS testsam_debug_level 27 : 28 : /****************************************************************** 29 : Lookup a name in the SAM database 30 : ******************************************************************/ 31 : 32 0 : static NTSTATUS testsam_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname) 33 : { 34 0 : DEBUG(10, ("testsam_getsampwnam called\n")); 35 0 : return NT_STATUS_NOT_IMPLEMENTED; 36 : } 37 : 38 : /*************************************************************************** 39 : Search by sid 40 : **************************************************************************/ 41 : 42 0 : static NTSTATUS testsam_getsampwsid (struct pdb_methods *methods, struct samu *user, const struct dom_sid *sid) 43 : { 44 0 : DEBUG(10, ("testsam_getsampwsid called\n")); 45 0 : return NT_STATUS_NOT_IMPLEMENTED; 46 : } 47 : 48 : /*************************************************************************** 49 : Delete a struct samu 50 : ****************************************************************************/ 51 : 52 0 : static NTSTATUS testsam_delete_sam_account(struct pdb_methods *methods, struct samu *sam_pass) 53 : { 54 0 : DEBUG(10, ("testsam_delete_sam_account called\n")); 55 0 : return NT_STATUS_NOT_IMPLEMENTED; 56 : } 57 : 58 : /*************************************************************************** 59 : Modifies an existing struct samu 60 : ****************************************************************************/ 61 : 62 0 : static NTSTATUS testsam_update_sam_account (struct pdb_methods *methods, struct samu *newpwd) 63 : { 64 0 : DEBUG(10, ("testsam_update_sam_account called\n")); 65 0 : return NT_STATUS_NOT_IMPLEMENTED; 66 : } 67 : 68 : /*************************************************************************** 69 : Adds an existing struct samu 70 : ****************************************************************************/ 71 : 72 0 : static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, struct samu *newpwd) 73 : { 74 0 : DEBUG(10, ("testsam_add_sam_account called\n")); 75 0 : return NT_STATUS_NOT_IMPLEMENTED; 76 : } 77 : 78 0 : static NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *location) 79 : { 80 : NTSTATUS nt_status; 81 : 82 0 : if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) { 83 0 : return nt_status; 84 : } 85 : 86 0 : (*pdb_method)->name = "testsam"; 87 : 88 : /* Functions your pdb module doesn't provide should not be 89 : set, make_pdb_methods() already provide suitable defaults for missing functions */ 90 : 91 0 : (*pdb_method)->getsampwnam = testsam_getsampwnam; 92 0 : (*pdb_method)->getsampwsid = testsam_getsampwsid; 93 0 : (*pdb_method)->add_sam_account = testsam_add_sam_account; 94 0 : (*pdb_method)->update_sam_account = testsam_update_sam_account; 95 0 : (*pdb_method)->delete_sam_account = testsam_delete_sam_account; 96 : 97 0 : testsam_debug_level = debug_add_class("testsam"); 98 0 : if (testsam_debug_level == -1) { 99 0 : testsam_debug_level = DBGC_ALL; 100 0 : DEBUG(0, ("testsam: Couldn't register custom debugging class!\n")); 101 0 : } else DEBUG(0, ("testsam: Debug class number of 'testsam': %d\n", testsam_debug_level)); 102 : 103 0 : DEBUG(0, ("Initializing testsam\n")); 104 0 : if (location) 105 0 : DEBUG(10, ("Location: %s\n", location)); 106 : 107 0 : return NT_STATUS_OK; 108 : } 109 : 110 : static_decl_pdb; 111 19 : NTSTATUS pdb_test_init(TALLOC_CTX *ctx) 112 : { 113 19 : return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam", 114 : testsam_init); 115 : }