mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 08:39:37 -05:00
improve previous commit
This commit is contained in:
parent
764aa5d938
commit
5ddbd69451
1 changed files with 6 additions and 39 deletions
|
|
@ -119,10 +119,8 @@ static int cnvt_str2int( char *, STRDISP_P, int );
|
|||
#endif /* LOG_LOCAL4 */
|
||||
|
||||
#define CHECK_NONE 0x00
|
||||
#define CHECK_CONFIG 0x01
|
||||
#define CHECK_DN 0x02
|
||||
#define CHECK_CONFIG 0x01
|
||||
static int check = CHECK_NONE;
|
||||
static struct berval check_dn = BER_BVC("");
|
||||
static int version = 0;
|
||||
|
||||
static void
|
||||
|
|
@ -133,7 +131,7 @@ usage( char *name )
|
|||
fprintf( stderr,
|
||||
"\t-4\t\tIPv4 only\n"
|
||||
"\t-6\t\tIPv6 only\n"
|
||||
"\t-T (a|c|i|p)\tRun in Tool mode\n"
|
||||
"\t-T {acdipt}\tRun in Tool mode\n"
|
||||
"\t-c cookie\tSync cookie of consumer\n"
|
||||
"\t-d level\tDebug level" "\n"
|
||||
"\t-f filename\tConfiguration file\n"
|
||||
|
|
@ -149,8 +147,6 @@ usage( char *name )
|
|||
"\t-r directory\tSandbox directory to chroot to\n"
|
||||
#endif
|
||||
"\t-s level\tSyslog level\n"
|
||||
"\t-t\t\tCheck configuration file and exit\n"
|
||||
"\t-D dn\tCheck dn and exit\n"
|
||||
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
||||
"\t-u user\t\tUser (id or name) to run as\n"
|
||||
"\t-V\t\tprint version info (-VV only)\n"
|
||||
|
|
@ -273,7 +269,7 @@ int main( int argc, char **argv )
|
|||
#endif
|
||||
|
||||
while ( (i = getopt( argc, argv,
|
||||
"c:d:D:f:h:s:n:tT:V"
|
||||
"c:d:f:h:s:n:tT:V"
|
||||
#if LDAP_PF_INET6
|
||||
"46"
|
||||
#endif
|
||||
|
|
@ -377,15 +373,12 @@ int main( int argc, char **argv )
|
|||
break;
|
||||
|
||||
case 't':
|
||||
/* deprecated; use slaptest instead */
|
||||
fprintf( stderr, "option -t deprecated; "
|
||||
"use slaptest command instead\n" );
|
||||
check |= CHECK_CONFIG;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
check |= CHECK_DN;
|
||||
check_dn.bv_val = optarg;
|
||||
check_dn.bv_len = strlen( optarg );
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
version++;
|
||||
break;
|
||||
|
|
@ -586,32 +579,6 @@ int main( int argc, char **argv )
|
|||
goto destroy;
|
||||
}
|
||||
|
||||
if ( check & CHECK_DN ) {
|
||||
struct berval pdn, ndn;
|
||||
|
||||
rc = dnPrettyNormal( NULL, &check_dn,
|
||||
&pdn, &ndn, NULL );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
fprintf( stderr, "DN: <%s> check failed %d (%s)\n",
|
||||
check_dn.bv_val, rc,
|
||||
ldap_err2string( rc ) );
|
||||
rc = 1;
|
||||
|
||||
} else {
|
||||
fprintf( stderr, "DN: <%s> check succeeded\n"
|
||||
"normalized: <%s>\n"
|
||||
"pretty: <%s>\n",
|
||||
check_dn.bv_val,
|
||||
ndn.bv_val, pdn.bv_val );
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
check &= ~CHECK_DN;
|
||||
if ( check == CHECK_NONE ) {
|
||||
goto destroy;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_TLS
|
||||
rc = ldap_pvt_tls_init();
|
||||
if( rc != 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue