Add a global variable controlling the output of debugging messages.
This allows modules etc. to emit PAM_LOG_DEBUG messages independently of whether libpam was compiled with -DDEBUG. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@209 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
a57c4713cf
commit
8dcae81fe3
|
@ -31,7 +31,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $P4: //depot/projects/openpam/lib/openpam_impl.h#20 $
|
* $P4: //depot/projects/openpam/lib/openpam_impl.h#21 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _OPENPAM_IMPL_H_INCLUDED
|
#ifndef _OPENPAM_IMPL_H_INCLUDED
|
||||||
|
@ -44,6 +44,8 @@ extern const char *_pam_sm_func_name[PAM_NUM_PRIMITIVES];
|
||||||
extern const char *_pam_err_name[PAM_NUM_ERRORS];
|
extern const char *_pam_err_name[PAM_NUM_ERRORS];
|
||||||
extern const char *_pam_item_name[PAM_NUM_ITEMS];
|
extern const char *_pam_item_name[PAM_NUM_ITEMS];
|
||||||
|
|
||||||
|
extern int _openpam_debug;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Control flags
|
* Control flags
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $P4: //depot/projects/openpam/lib/openpam_log.c#17 $
|
* $P4: //depot/projects/openpam/lib/openpam_log.c#18 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -45,6 +45,8 @@
|
||||||
|
|
||||||
#include "openpam_impl.h"
|
#include "openpam_impl.h"
|
||||||
|
|
||||||
|
int _openpam_debug = 0;
|
||||||
|
|
||||||
#if defined(openpam_log)
|
#if defined(openpam_log)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -62,12 +64,10 @@ _openpam_log(int level, const char *func, const char *fmt, ...)
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case PAM_LOG_DEBUG:
|
case PAM_LOG_DEBUG:
|
||||||
#ifndef DEBUG
|
if (!_openpam_debug)
|
||||||
return;
|
return;
|
||||||
#else
|
|
||||||
priority = LOG_DEBUG;
|
priority = LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PAM_LOG_VERBOSE:
|
case PAM_LOG_VERBOSE:
|
||||||
priority = LOG_INFO;
|
priority = LOG_INFO;
|
||||||
break;
|
break;
|
||||||
|
@ -108,12 +108,10 @@ openpam_log(int level, const char *fmt, ...)
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case PAM_LOG_DEBUG:
|
case PAM_LOG_DEBUG:
|
||||||
#ifndef DEBUG
|
if (!_openpam_debug)
|
||||||
return;
|
return;
|
||||||
#else
|
|
||||||
priority = LOG_DEBUG;
|
priority = LOG_DEBUG;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PAM_LOG_VERBOSE:
|
case PAM_LOG_VERBOSE:
|
||||||
priority = LOG_INFO;
|
priority = LOG_INFO;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue