]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
lber_debug/ldap_debug are always defined and provided by the implementation.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:05:01 +0000 (22:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:05:01 +0000 (22:05 +0000)
17 files changed:
clients/fax500/main.c
clients/fax500/rp500.c
clients/finger/main.c
clients/gopher/go500.c
clients/gopher/go500gw.c
clients/mail500/main.c
clients/rcpt500/main.c
clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldappasswd.c
clients/tools/ldapsearch.c
clients/ud/main.c
include/lber.h
include/ldap.h
libraries/liblber/decode.c
libraries/libldap/open.c

index 240f7372938a99d943874d988ea590462cbb4f5b..2c103c20a8596fefab2da2a534164e886a6506f3 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/ctype.h>
@@ -185,6 +186,10 @@ main ( int argc, char **argv )
                identity = MAIL500;
        }
 
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
 #ifdef LOG_MAIL
        openlog( myname, OPENLOG_OPTIONS, LOG_MAIL );
 #else
index bd6744ad98e18d713f27521de884206a98da3853..abf4daad898564eaf89bce8145e8eaa84a34bf59 100644 (file)
@@ -38,7 +38,7 @@
 #define DEFAULT_PORT           79
 #define DEFAULT_SIZELIMIT      50
 
-int            debug;
+int            debug = 0;
 char   *ldaphost = NULL;
 char   *base = NULL;
 int            deref;
@@ -81,7 +81,7 @@ main( int argc, char **argv )
                        break;
 
                case 'd':       /* turn on debugging */
-                       debug = atoi( optarg );
+                       debug |= atoi( optarg );
                        break;
 
                case 'f':       /* ldap filter file */
@@ -111,6 +111,14 @@ main( int argc, char **argv )
                exit( -1 );
        }
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
        if ( (ld = ldap_open( ldaphost, 0 )) == NULL ) {
                perror( "ldap_open" );
                exit( -1 );
index b359bee984db6c2ce5bf38ba58cbc51d57fa3023..0b3f6b2d8487c116d1ea4444700649afafab0967 100644 (file)
@@ -122,6 +122,10 @@ main( int argc, char **argv )
        else
                myname = strdup( myname + 1 );
 
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
        if ( dosyslog ) {
 #ifdef LOG_LOCAL4
                openlog( myname, OPENLOG_OPTIONS, LOG_LOCAL4 );
index 05d56b2136aa612709b339ae8c12311f37d46384..13b450c4593383452f229445c5eb2702953125a0 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "disptmpl.h"
 
-int    debug;
+int    debug = 0;
 int    dosyslog;
 int    inetd;
 int    dtblsize;
@@ -95,7 +95,7 @@ main( int argc, char **argv )
                        break;
 
                case 'd':       /* debug level */
-                       debug = atoi( optarg );
+                       debug |= atoi( optarg );
                        break;
 
                case 'f':       /* ldap filter file */
@@ -165,6 +165,14 @@ main( int argc, char **argv )
        else
                myname = strdup( myname + 1 );
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
        if ( dosyslog ) {
 #ifdef LOG_LOCAL3
                openlog( myname, OPENLOG_OPTIONS, LOG_LOCAL3 );
index 2c6142507b2c15bd7768f53e5657a7da15615ce8..4cd87ce55b74bf5a7e2376b3e4a2a6ed062d2bba 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "ldapconfig.h"
 
-int    debug;
+int    debug = 0;
 int    dosyslog;
 int    inetd;
 int    dtblsize;
@@ -109,10 +109,8 @@ main (int  argc, char **argv )
                        break;
 
                case 'd':       /* debugging level */
-                       debug = atoi( optarg );
-#ifdef LDAP_DEBUG
-                       ldap_debug = debug;
-#else
+                       debug |= atoi( optarg );
+#ifndef LDAP_DEBUG
                        fprintf( stderr, "warning: ldap debugging requires LDAP_DEBUG\n" );
 #endif
                        break;
@@ -193,6 +191,14 @@ main (int  argc, char **argv )
        else
                myname = strdup( myname + 1 );
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+       
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
        if ( dosyslog ) {
 #ifdef LOG_LOCAL3
                openlog( myname, OPENLOG_OPTIONS, LOG_LOCAL3 );
index d826499e0feb610ef4af1593701e3e157346cbe3..aedd5594d3809ac8be122fbad255df48b0f0e4be 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 
 #include <ac/ctype.h>
+#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/syslog.h>
 #include <ac/time.h>
@@ -63,7 +64,7 @@ char  *mailfrom = NULL;
 char   *host = NULL;
 char   *ldaphost = NULL;
 int    hostlen = 0;
-int    debug;
+int    debug = 0;
 
 typedef struct errs {
        int             e_code;
@@ -165,6 +166,10 @@ main ( int argc, char **argv )
        else
                myname = strdup( myname + 1 );
 
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
 #ifdef LOG_MAIL
        openlog( myname, OPENLOG_OPTIONS, LOG_MAIL );
 #else
@@ -174,7 +179,7 @@ main ( int argc, char **argv )
        while ( (i = getopt( argc, argv, "d:f:h:l:m:v:" )) != EOF ) {
                switch( i ) {
                case 'd':       /* turn on debugging */
-                       debug = atoi( optarg );
+                       debug |= atoi( optarg );
                        break;
 
                case 'f':       /* who it's from & where errors should go */
index 346c5fc10d3e4e22a8ddd5885d92c93cf9564de3..2ea4d740f28604ebe8824dee664e4825ce5ddc61 100644 (file)
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 
 #include <ac/ctype.h>
+#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/syslog.h>
 #include <ac/unistd.h>
@@ -114,6 +115,10 @@ main( int argc, char **argv )
        exit( 1 );
     }
 
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
     if ( dosyslog ) {
        /*
         * if syslogging requested, initialize
index a9ca7f6b0ce061bb89346243250cae29823770a9..244db3b191ac03ebf68aba2b908e14ff1e3a02d6 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 
+#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/unistd.h>
@@ -36,9 +37,9 @@ main( int argc, char **argv )
     char               *usage = "usage: %s [-n] [-v] [-k] [-W] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
     char               buf[ 4096 ];
     FILE               *fp;
-    int                        i, rc, authmethod, want_bindpw;
+    int                        i, rc, authmethod, want_bindpw, debug;
 
-    not = verbose = contoper = want_bindpw = 0;
+    not = verbose = contoper = want_bindpw = debug = 0;
     fp = NULL;
     authmethod = LDAP_AUTH_SIMPLE;
 
@@ -78,7 +79,7 @@ main( int argc, char **argv )
            break;
        case 'd':
 #ifdef LDAP_DEBUG
-           ldap_debug = lber_debug = atoi( optarg );   /* */
+           debug |= atoi( optarg );    /* */
 #else /* LDAP_DEBUG */
            fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
 #endif /* LDAP_DEBUG */
@@ -107,6 +108,14 @@ main( int argc, char **argv )
        }
     }
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug; 
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
     if (( ld = ldap_open( ldaphost, ldapport )) == NULL ) {
        perror( "ldap_open" );
        exit( 1 );
index 02280642a6f8098ae577db32bdc1418eebb6eed2..0545070459e165b699cc05ecbb4fde4c609cab6c 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 
 #include <ac/ctype.h>
+#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/socket.h>
 #include <ac/unistd.h>
@@ -71,7 +72,7 @@ main( int argc, char **argv )
 {
     char               *infile, *rbuf, *start, *p, *q;
     FILE               *fp;
-    int                        rc, i, use_ldif, authmethod, want_bindpw;
+    int                        rc, i, use_ldif, authmethod, want_bindpw, debug;
     char               *usage = "usage: %s [-abcknrvWF] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n";
 
     if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) {
@@ -82,7 +83,7 @@ main( int argc, char **argv )
     new = ( strcmp( prog, "ldapadd" ) == 0 );
 
     infile = NULL;
-    not = verbose = valsfromfiles = want_bindpw = 0;
+    not = verbose = valsfromfiles = want_bindpw = debug = 0;
     authmethod = LDAP_AUTH_SIMPLE;
 
     while (( i = getopt( argc, argv, "WFabckKnrtvh:p:D:w:d:f:" )) != EOF ) {
@@ -127,7 +128,7 @@ main( int argc, char **argv )
            break;
        case 'd':
 #ifdef LDAP_DEBUG
-           ldap_debug = lber_debug = atoi( optarg );   /* */
+           debug |= atoi( optarg );
 #else /* LDAP_DEBUG */
            fprintf( stderr, "%s: compile with -DLDAP_DEBUG for debugging\n",
                    prog );
@@ -168,6 +169,13 @@ main( int argc, char **argv )
        fp = stdin;
     }
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
 
     if ( !not ) {
        if (( ld = ldap_open( ldaphost, ldapport )) == NULL ) {
index d3fa7db56442cf18e1dcc42c203a47887b334289..5bff7c0cd86825bbfe51c224457e173d9e749e57 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 
 #include <ac/ctype.h>
+#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/time.h>
 #include <ac/unistd.h>
@@ -38,10 +39,10 @@ main(int argc, char **argv)
     char               *usage = "usage: %s [-nvkWc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
     char               *myname,*infile, *entrydn, *rdn, buf[ 4096 ];
     FILE               *fp;
-    int                        rc, i, remove, havedn, authmethod, want_bindpw;
+    int                        rc, i, remove, havedn, authmethod, want_bindpw, debug;
 
     infile = NULL;
-    not = contoper = verbose = remove = want_bindpw = 0;
+    not = contoper = verbose = remove = want_bindpw = debug = 0;
     authmethod = LDAP_AUTH_SIMPLE;
 
     myname = (myname = strrchr(argv[0], '/')) == NULL ? argv[0] : ++myname;
@@ -76,7 +77,7 @@ main(int argc, char **argv)
            break;
        case 'd':
 #ifdef LDAP_DEBUG
-           ldap_debug = lber_debug = atoi( optarg );   /* */
+           debug |= atoi( optarg );
 #else /* LDAP_DEBUG */
            fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
 #endif /* LDAP_DEBUG */
@@ -131,6 +132,14 @@ main(int argc, char **argv)
        fp = stdin;
     }
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
     if (( ld = ldap_open( ldaphost, ldapport )) == NULL ) {
        perror( "ldap_open" );
        exit( 1 );
index 02cd291e08b0ec1289e9c976fade1b825ddb43ad..e2848a82bdbaab80dc5de0af95359014b915440d 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <sys/time.h>
 
+#include <ac/signal.h>
 #include <ac/string.h>
 #include <ac/unistd.h>
 
@@ -561,6 +562,10 @@ main (int argc, char *argv[])
                lber_debug = ldap_debug = debug;
        }
 
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
        /* connect to server */
        if ((ld = ldap_open (ldaphost, ldapport)) == NULL)
        {
index 79e63c33baaa6e749b887ff17b7b4add8141e3ba..b9cdb8f76084182871c40f08b8f564890e1e45cf 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 
 #include <ac/ctype.h>
+#include <ac/signal.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -90,13 +91,13 @@ char        **argv;
 {
     char               *infile, *filtpattern, **attrs, line[ BUFSIZ ];
     FILE               *fp;
-    int                        rc, i, first, scope, kerberos, deref, attrsonly;
+    int                        rc, i, first, scope, kerberos, deref, attrsonly, debug;
     int                        ldap_options, timelimit, sizelimit, authmethod;
     LDAP               *ld;
 
     infile = NULL;
     deref = verbose = allow_binary = not = kerberos = vals2tmp =
-           attrsonly = ldif = 0;
+           attrsonly = ldif = debug = 0;
 
 #ifdef LDAP_REFERRALS
     ldap_options = LDAP_OPT_REFERRALS;
@@ -125,7 +126,7 @@ char        **argv;
            break;
        case 'd':
 #ifdef LDAP_DEBUG
-           ldap_debug = lber_debug = atoi( optarg );   /* */
+           debug |= atoi( optarg );
 #else /* LDAP_DEBUG */
            fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
 #endif /* LDAP_DEBUG */
@@ -260,6 +261,14 @@ char       **argv;
        printf( "ldap_open( %s, %d )\n", ldaphost, ldapport );
     }
 
+       if ( debug ) {
+               lber_debug = ldap_debug = debug;
+       }
+
+#ifdef SIGPIPE
+       (void) SIGNAL( SIGPIPE, SIG_IGN );
+#endif
+
     if (( ld = ldap_open( ldaphost, ldapport )) == NULL ) {
        perror( ldaphost );
        exit( 1 );
index 673b1e040dbc94125ac0e33f385a76f4930b52e4..0a22e14b03c64c9526d060c4c168e0eb24054bac 100644 (file)
@@ -95,8 +95,8 @@ main( int argc, char **argv )
                switch (c) {
                case 'l' :
 #ifdef LDAP_DEBUG
-                       ldap_debug = (int) strtol(optarg, (char **) NULL, 0);
-                       lber_debug = ldap_debug;
+                       ldap_debug |= (int) strtol(optarg, (char **) NULL, 0);
+                       lber_debug |= ldap_debug;
 #endif
                        break;
                case 'd' :
@@ -151,6 +151,10 @@ main( int argc, char **argv )
        printf(Version);
        fflush( stdout );
 
+#ifdef SIGPIPE
+       (void) SIGNAL (SIGPIPE, SIG_IGN);
+#endif
+
        initialize_client();
        initialize_attribute_strings();
 
index b2e690681f76000542c73d2a92ebf0e5d4fc294e..f4816426f0b96be80f33eb9fba0437651ded55b0 100644 (file)
@@ -125,9 +125,7 @@ struct berval {
        char            *bv_val;
 };
 
-#ifdef LDAP_DEBUG
 extern int lber_debug;
-#endif
 
 /*
  * in bprint.c:
index 8b93f57c32d8cdba6da048b08746838e4027e91d..18f710dff8fa20f9e1fd3609575c94b0c78c6a96 100644 (file)
@@ -41,8 +41,10 @@ LDAP_BEGIN_DECL
 #define LDAP_MAX_ATTR_LEN      100
 
 /* debugging stuff */
+extern int     ldap_debug;     /* always available */
+
 #ifdef LDAP_DEBUG
-extern int     ldap_debug;
+
 #ifdef LDAP_SYSLOG
 extern int     ldap_syslog;
 extern int     ldap_syslog_level;
index 0a60d5ad85a81a0b94d48fe2238c0847fd5d8942..90d5f333547cc23798cf8379eabc1461848d05f8 100644 (file)
@@ -27,9 +27,7 @@
 
 #include "lber.h"
 
-#ifdef LDAP_DEBUG
 int    lber_debug;
-#endif
 
 static int ber_getnint LDAP_P(( BerElement *ber, long *num, int len ));
 
index ef64cf3ed3841627fcab0ad0a0b0461ef5fd2878..7f3c44fc9b3bd7fc2e3df0da5c69aabbdb43c26c 100644 (file)
@@ -26,9 +26,7 @@
 #include "ldap.h"
 #include "ldap-int.h"
 
-#ifdef LDAP_DEBUG
 int    ldap_debug;
-#endif
 
 
 /*