[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Fwd: How to turn on logging for ldap library - VERY WEIRD ... update



If I make the first change, and just do a vprintf, i get all debug
printfs as expected, with the actual host being printed instead of
"null". and my program never crashes and works perfectly.

But if I let vsnprintf printf to the buf, and then try to just printf
the buf, it doesn't print my host correctly (prints "null"), and later
on my program will crash.

very weird.

    44 int ldap_log_printf( LDAP *ld, int loglvl, const char *fmt, ... )
    45 {
    46         char buf[ 1024 ];
    47         va_list ap;
    48         if ( !ldap_log_check( ld, loglvl )) {
    49                 return 0;
    50         }
    51
    52         va_start( ap, fmt );
    53 /*
    54 printf( "J:>>> " ); fflush( stdout );
    55 vprintf( fmt, ap ); fflush( stdout );
    56 va_end(ap);
    57 return 1;
    58 */
    59         buf[sizeof(buf) - 1] = '\0';
    60         vsnprintf( buf, sizeof(buf)-1, fmt, ap );
    61
    62 printf( "%s", buf ); fflush( stdout );
    63 va_end(ap);
    64 return 1;
    65
    66         va_end(ap);
    67
    68         (*ber_pvt_log_print)( buf );
    69         return 1;
    70 }

On 5/11/06, Jeremiah Martell <inlovewithgod@gmail.com> wrote:
No, I'm trying to connect to a valid ldap server address.
"directory.example.com". And I'm using port 389. I'm not sure why
ldap's debugging says "(null):7".

Has anybody seen this before?

  Thanks,
 - Jeremiah

On 5/10/06, Aaron Richton <richton@nbcs.rutgers.edu> wrote:
> > It works fine without debugging though, no crash. Any ideas?
>
> Don't turn on debugging and you won't crash! Of course...
>
> > ldap_connect_to_host: TCP (null):7
>
> is a bit bothersome. Are you really trying to connect to NULL? Even worse,
> are you trying to printf() the NULL, perhaps when debugging? This is well
> known to have Bad Effects.
>
> If it's as simple as starting your program and watching it die, standard
> debugging tools (gdb, dbx, valgrind, libumem, librtc) should be able to
> pinpoint this fairly concretely.
>


-- - Jeremiah inlovewithGod@gmail.com



--
- Jeremiah
inlovewithGod@gmail.com