break;
case SLAPDN:
- options = " DN [...]\n";
+ options = "\n\t[-N | -P] DN [...]\n";
break;
case SLAPINDEX:
break;
case SLAPDN:
- options = "d:f:F:v";
+ options = "d:f:F:NPv";
mode |= SLAP_TOOL_READMAIN | SLAP_TOOL_READONLY;
break;
ber_str2bv( optarg, 0, 0, &mech );
break;
+ case 'N':
+ if ( dn_mode && dn_mode != SLAP_TOOL_LDAPDN_NORMAL ) {
+ usage( tool, progname );
+ }
+ dn_mode = SLAP_TOOL_LDAPDN_NORMAL;
+ break;
+
case 'n': /* which config file db to index */
dbnum = atoi( optarg );
break;
}
break;
+ case 'P':
+ if ( dn_mode && dn_mode != SLAP_TOOL_LDAPDN_PRETTY ) {
+ usage( tool, progname );
+ }
+ dn_mode = SLAP_TOOL_LDAPDN_PRETTY;
+ break;
+
case 'q': /* turn on quick */
mode |= SLAP_TOOL_QUICK;
break;
slap_ssf_t tv_transport_ssf;
slap_ssf_t tv_tls_ssf;
slap_ssf_t tv_sasl_ssf;
+ unsigned tv_dn_mode;
} tool_vars;
extern tool_vars tool_globals;
#define transport_ssf tool_globals.tv_transport_ssf
#define tls_ssf tool_globals.tv_tls_ssf
#define sasl_ssf tool_globals.tv_sasl_ssf
+#define dn_mode tool_globals.tv_dn_mode
+#define SLAP_TOOL_LDAPDN_PRETTY SLAP_LDAPDN_PRETTY
+#define SLAP_TOOL_LDAPDN_NORMAL (SLAP_LDAPDN_PRETTY << 1)
void slap_tool_init LDAP_P((
const char* name,
}
} else {
- fprintf( stderr, "DN: <%s> check succeeded\n"
- "normalized: <%s>\n"
- "pretty: <%s>\n",
- dn.bv_val,
- ndn.bv_val, pdn.bv_val );
+ switch ( dn_mode ) {
+ case SLAP_TOOL_LDAPDN_PRETTY:
+ printf( "%s\n", pdn.bv_val );
+ break;
+
+ case SLAP_TOOL_LDAPDN_NORMAL:
+ printf( "%s\n", ndn.bv_val );
+ break;
+
+ default:
+ printf( "DN: <%s> check succeeded\n"
+ "normalized: <%s>\n"
+ "pretty: <%s>\n",
+ dn.bv_val,
+ ndn.bv_val, pdn.bv_val );
+ break;
+ }
+
ch_free( ndn.bv_val );
ch_free( pdn.bv_val );
}