summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/debug.c20
-rw-r--r--source3/lib/util.c22
-rw-r--r--source3/lib/util_hnd.c4
3 files changed, 40 insertions, 6 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 6b7b9341a3..619a917747 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -75,6 +75,7 @@
* debugf - Debug file name.
* append_log - If True, then the output file will be opened in append
* mode.
+ * timestamp_log -
* DEBUGLEVEL - System-wide debug message limit. Messages with message-
* levels higher than DEBUGLEVEL will not be processed.
*/
@@ -82,6 +83,7 @@
FILE *dbf = NULL;
pstring debugf = "";
BOOL append_log = False;
+BOOL timestamp_log = True;
int DEBUGLEVEL = 1;
@@ -119,7 +121,17 @@ static int format_pos = 0;
* Functions...
*/
-#if defined(SIGUSR2)
+/* ************************************************************************** **
+ * tells us if interactive logging was requested
+ * ************************************************************************** **
+ */
+
+BOOL dbg_interactive(void)
+{
+ return stdout_logging;
+}
+
+#if defined(SIGUSR2) && !defined(MEM_MAN)
/* ************************************************************************** **
* catch a sigusr2 - decrease the debug log level.
* ************************************************************************** **
@@ -140,7 +152,7 @@ void sig_usr2( int sig )
} /* sig_usr2 */
#endif /* SIGUSR2 */
-#if defined(SIGUSR1)
+#if defined(SIGUSR1) && !defined(MEM_MAN)
/* ************************************************************************** **
* catch a sigusr1 - increase the debug log level.
* ************************************************************************** **
@@ -429,7 +441,7 @@ static void bufr_print( void )
static void format_debug_text( char *msg )
{
int i;
- BOOL timestamp = (!stdout_logging && (lp_timestamp_logs() ||
+ BOOL timestamp = (timestamp_log && !stdout_logging && (lp_timestamp_logs() ||
!(lp_loaded())));
for( i = 0; msg[i]; i++ )
@@ -527,7 +539,7 @@ BOOL dbghdr( int level, char *file, char *func, int line )
/* Print the header if timestamps are turned on. If parameters are
* not yet loaded, then default to timestamps on.
*/
- if( lp_timestamp_logs() || !(lp_loaded()) )
+ if( timestamp_log && (lp_timestamp_logs() || !(lp_loaded()) ))
{
/* Print it all out at once to prevent split syslog output. */
(void)Debug1( "[%s, %d] %s:%s(%d)\n",
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1710205f3c..df3faa569a 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -143,6 +143,21 @@ BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups)
/****************************************************************************
+gets either a hex number (0xNNN) or decimal integer (NNN).
+****************************************************************************/
+int get_number(char *tmp)
+{
+ if (strnequal(tmp, "0x", 2))
+ {
+ return strtol(tmp, (char**)NULL, 16);
+ }
+ else
+ {
+ return strtol(tmp, (char**)NULL, 10);
+ }
+}
+
+/****************************************************************************
like atoi but gets the value up to the separater character
****************************************************************************/
char *Atoic(char *p, int *n, char *c)
@@ -153,7 +168,12 @@ char *Atoic(char *p, int *n, char *c)
return NULL;
}
- (*n) = atoi(p);
+ (*n) = get_number(p);
+
+ if (strnequal(p, "0x", 2))
+ {
+ p += 2;
+ }
while ((*p) && isdigit(*p))
{
diff --git a/source3/lib/util_hnd.c b/source3/lib/util_hnd.c
index b807c40604..dabc5520ff 100644
--- a/source3/lib/util_hnd.c
+++ b/source3/lib/util_hnd.c
@@ -290,7 +290,8 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd)
{
struct policy *p = find_lsa_policy(hnd);
- if (!p) {
+ if (!p)
+ {
DEBUG(3,("Error closing policy\n"));
return False;
}
@@ -302,6 +303,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd)
bitmap_clear(bmap, p->pnum);
ZERO_STRUCTP(p);
+ ZERO_STRUCTP(hnd);
free(p);