Skip to content

Commit

Permalink
Adding flags for suppressing messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
syzdek committed Jul 7, 2012
1 parent 7e406b7 commit fc958e7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/sdk/openldap/ldappeerchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ typedef struct ldappeerchain_config LDAPConfig;
struct ldappeerchain_config
{
int verbose;
int quiet;
char ldap_url[1024];
int ldap_version;
struct timeval tcp_timeout;
Expand Down Expand Up @@ -182,6 +183,7 @@ void ldappeerchain_usage(void)
" -3 use protocol version 3\n"
" -H url LDAP URL\n"
" -h, --help print this help and exit\n"
" -q, --quiet suppresses informational messages\n"
" -T timeout TCP timeout\n"
"\n"
"LDAP URL: ldap://hostport/dn[?attrs[?scope[?filter[?exts]]]]\n"
Expand Down Expand Up @@ -260,7 +262,7 @@ int main(int argc, char * argv[])
// local variables for parsing cli arguments
int c;
int opt_index;
static char short_opt[] = "23H:hT:Vv";
static char short_opt[] = "23H:hT:qVv";
static struct option long_opt[] =
{
{"help", no_argument, 0, 'h'},
Expand Down Expand Up @@ -313,6 +315,10 @@ int main(int argc, char * argv[])
ldappeerchain_usage();
return(0);

case 'q':
config.quiet++;
break;

case 'T':
config.tcp_timeout.tv_sec = (int) strtol(optarg, NULL, 0);
break;
Expand Down Expand Up @@ -494,7 +500,8 @@ int main(int argc, char * argv[])
ldap_unbind_ext_s(ld, NULL, NULL);
return(1);
};
fprintf(stderr, "%i certificates in peer chain\n", sk_num(skx));
if (!(config.quiet))
fprintf(stderr, "%i certificates in peer chain\n", sk_num(skx));

// Creates new BIO
if (!(mem = BIO_new(BIO_s_mem())))
Expand Down

0 comments on commit fc958e7

Please sign in to comment.