password if the verbosity was set to a high debug level
such as 7 or higher. Normally this would only be used by
developers. Now, even at high debug levels, the password
will not be output.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3073
e7ae566f-a301-0410-adde-
c780ea21d3b5
while (e)
{
- msg (msglevel, "ENV [%d] '%s'", i, e->string);
+ if (env_safe_to_print (e->string))
+ msg (msglevel, "ENV [%d] '%s'", i, e->string);
++i;
e = e->next;
}
return string_mod_const (str, CC_PRINT, CC_CRLF, '.', gc);
}
+bool
+env_safe_to_print (const char *str)
+{
+#ifndef UNSAFE_DEBUG
+ if (strncmp (str, "password", 8) == 0)
+ return false;
+#endif
+ return true;
+}
+
/* Make arrays of strings */
const char **
*/
const char *safe_print (const char *str, struct gc_arena *gc);
+/* returns true if environmental variable safe to print to log */
+bool env_safe_to_print (const char *str);
+
/*
* A sleep function that services the management layer for n
* seconds rather than doing nothing.
{
int i;
for (i = 0; array[i]; ++i)
- msg (msglevel, "%s[%d] = '%s'", name, i, array[i]);
+ {
+ if (env_safe_to_print (array[i]))
+ msg (msglevel, "%s[%d] = '%s'", name, i, array[i]);
+ }
}
static void