From 2a02a76913a91c9882868b73c72ba2e8d2be764d Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 18 May 2002 15:09:21 +0000 Subject: so here it is the code to introduce seriously debugggging classes. this is a first step only passdb stuff has beein "classized". - so what can you do? set debug level to: 1 poasdb:10 that will make all the code run at debug level 1 except the code in passdb/* files that will run at level 10 TODO: fix the man page - also smbcontrol has this nice feature so smbcontrol smbd debug 3 passdb:5 will set every smbd to have a default log level of 3 while passdb stuff will be at level 5 and so no.. minor cosmetic fix to pdbedit is there too (This used to be commit be5c3b3f5781ddc002ffcc98df04ab024dcef4ca) --- source3/utils/pdbedit.c | 3 ++- source3/utils/smbcontrol.c | 46 +++++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 16 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 6b4cd606d0..9a84af027d 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -76,7 +76,8 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst if (!sam_pwent) return -1; if (verbosity) { - printf ("Unix/NT username: %s/%s\n", pdb_get_username(sam_pwent),pdb_get_nt_username(sam_pwent)); + printf ("Unix username: %s\n", pdb_get_username(sam_pwent)); + printf ("NT username: %s\n", pdb_get_nt_username(sam_pwent)); if (IS_SAM_UNIX_USER(sam_pwent)) { uid = pdb_get_uid(sam_pwent); gid = pdb_get_gid(sam_pwent); diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index d680fa4489..5cb4e4febb 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -3,6 +3,7 @@ program to send control messages to Samba processes Copyright (C) Andrew Tridgell 1994-1998 Copyright (C) 2001, 2002 by Martin Pool + Copyright (C) Simo Sorce 2002 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,16 +107,14 @@ Prints out the current Debug level returned by MSG_DEBUGLEVEL void debuglevel_function(int msg_type, pid_t src, void *buf, size_t len) { int i; - int debuglevel_class[DBGC_LAST]; - - memcpy(debuglevel_class, buf, len); - - printf("Current debug level of PID %u is %d ",(unsigned int)src, debuglevel_class[0]); - for (i=1;i:level\n"); + /* first pass retrieve total lenght */ + for (p = params; p && *p ; p++) + dim += (strnlen(*p, 1024) +1); /* lenght + space */ + b = buf = malloc(dim); + if (!buf) { + fprintf(stderr, "Out of memory!"); return(False); - } else - send_message(dest, MSG_DEBUG, &dm, sizeof(dm), False); + } + /* now build a single string with all parameters */ + for(p = params; p && *p; p++) { + int l = strnlen(*p, 1024); + strncpy(b, *p, l); + b[l] = ' '; + b = b + l + 1; + } + b[-1] = '\0'; + + send_message(dest, MSG_DEBUG, buf, dim, False); + + free(buf); + break; } -- cgit