From 98d5699d28c687f8af5671c9a29aa55dd5a01bfd Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 24 May 2002 09:57:48 +0000 Subject: Some of the updates from ctrlsoft's 'Various' patch: - convert net to popt - convert status to popt - adapt examples/pdb/ to multiple passdb system - add dynamic debug class example to examples/pdb/ and some reformatting to better match the samba coding style. Andrew Bartlett (This used to be commit 2498bc69d4e5c38ec385f640489daa94c508c726) --- examples/pdb/pdb_test.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'examples') diff --git a/examples/pdb/pdb_test.c b/examples/pdb/pdb_test.c index 4b4189e9d5..983a995d85 100644 --- a/examples/pdb/pdb_test.c +++ b/examples/pdb/pdb_test.c @@ -17,11 +17,15 @@ * Mass Ave, Cambridge, MA 02139, USA. */ + #include "includes.h" +static int testsam_debug_level = DBGC_ALL; +#undef DBGC_CLASS +#define DBGC_CLASS testsam_debug_level -static BOOL testsam_setsampwent(struct pdb_context *context, BOOL update) +static BOOL testsam_setsampwent(struct pdb_methods *methods, BOOL update) { - DEBUG(0, ("testsam_setsampwent called\n")); + DEBUG(10, ("testsam_setsampwent called\n")); return True; } @@ -29,18 +33,18 @@ static BOOL testsam_setsampwent(struct pdb_context *context, BOOL update) End enumeration of the passwd list. ****************************************************************/ -static void testsam_endsampwent(struct pdb_context *context) +static void testsam_endsampwent(struct pdb_methods *methods) { - DEBUG(0, ("testsam_endsampwent called\n")); + DEBUG(10, ("testsam_endsampwent called\n")); } /***************************************************************** Get one SAM_ACCOUNT from the list (next in line) *****************************************************************/ -static BOOL testsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user) +static BOOL testsam_getsampwent(struct pdb_methods *methods, SAM_ACCOUNT *user) { - DEBUG(0, ("testsam_getsampwent called\n")); + DEBUG(10, ("testsam_getsampwent called\n")); return False; } @@ -48,9 +52,9 @@ static BOOL testsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user) Lookup a name in the SAM database ******************************************************************/ -static BOOL testsam_getsampwnam (struct pdb_context *context, SAM_ACCOUNT *user, const char *sname) +static BOOL testsam_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user, const char *sname) { - DEBUG(0, ("testsam_getsampwnam called\n")); + DEBUG(10, ("testsam_getsampwnam called\n")); return False; } @@ -58,9 +62,9 @@ static BOOL testsam_getsampwnam (struct pdb_context *context, SAM_ACCOUNT *user, Search by rid **************************************************************************/ -static BOOL testsam_getsampwrid (struct pdb_context *context, SAM_ACCOUNT *user, uint32 rid) +static BOOL testsam_getsampwrid (struct pdb_methods *methods, SAM_ACCOUNT *user, uint32 rid) { - DEBUG(0, ("testsam_getsampwrid called\n")); + DEBUG(10, ("testsam_getsampwrid called\n")); return False; } @@ -68,9 +72,9 @@ static BOOL testsam_getsampwrid (struct pdb_context *context, SAM_ACCOUNT *user, Delete a SAM_ACCOUNT ****************************************************************************/ -static BOOL testsam_delete_sam_account(struct pdb_context *context, const SAM_ACCOUNT *sam_pass) +static BOOL testsam_delete_sam_account(struct pdb_methods *methods, const SAM_ACCOUNT *sam_pass) { - DEBUG(0, ("testsam_delete_sam_account called\n")); + DEBUG(10, ("testsam_delete_sam_account called\n")); return False; } @@ -78,9 +82,9 @@ static BOOL testsam_delete_sam_account(struct pdb_context *context, const SAM_AC Modifies an existing SAM_ACCOUNT ****************************************************************************/ -static BOOL testsam_update_sam_account (struct pdb_context *context, const SAM_ACCOUNT *newpwd) +static BOOL testsam_update_sam_account (struct pdb_methods *methods, const SAM_ACCOUNT *newpwd) { - DEBUG(0, ("testsam_update_sam_account called\n")); + DEBUG(10, ("testsam_update_sam_account called\n")); return False; } @@ -88,9 +92,9 @@ static BOOL testsam_update_sam_account (struct pdb_context *context, const SAM_A Adds an existing SAM_ACCOUNT ****************************************************************************/ -static BOOL testsam_add_sam_account (struct pdb_context *context, const SAM_ACCOUNT *newpwd) +static BOOL testsam_add_sam_account (struct pdb_methods *methods, const SAM_ACCOUNT *newpwd) { - DEBUG(0, ("testsam_add_sam_account called\n")); + DEBUG(10, ("testsam_add_sam_account called\n")); return False; } @@ -112,10 +116,16 @@ NTSTATUS pdb_init(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char (*pdb_method)->add_sam_account = testsam_add_sam_account; (*pdb_method)->update_sam_account = testsam_update_sam_account; (*pdb_method)->delete_sam_account = testsam_delete_sam_account; + + testsam_debug_level = debug_add_class("testsam"); + if (testsam_debug_level == -1) { + testsam_debug_level = DBGC_ALL; + DEBUG(0, ("testsam: Couldn't register custom debugging class!\n")); + } else DEBUG(0, ("testsam: Debug class number of 'testsam': %d\n", testsam_debug_level)); DEBUG(0, ("Initializing testsam\n")); if (location) - DEBUG(0, ("Location: %s\n", location)); + DEBUG(10, ("Location: %s\n", location)); return NT_STATUS_OK; } -- cgit