/* Set in main() */
char *prog = NULL;
+void
+tool_init( void )
+{
+ setlocale(LC_MESSAGES,"");
+ bindtextdomain(OPENLDAP_PACKAGE, LDAP_LOCALEDIR);
+ textdomain(OPENLDAP_PACKAGE);
+}
+
void
tool_common_usage( void )
{
static const char *const descriptions[] = {
-" -c continuous operation mode (do not stop on errors)\n",
-" -C chase referrals\n",
-" -d level set LDAP debugging level to `level'\n",
-" -D binddn bind DN\n",
-" -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
-" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n"
-" [!]manageDSAit (alternate form, see -M)\n"
-" [!]noop\n",
-" -f file read operations from `file'\n",
-" -h host LDAP server\n",
-" -H URI LDAP Uniform Resource Indentifier(s)\n",
-" -I use SASL Interactive mode\n",
-" -k use Kerberos authentication\n",
-" -K like -k, but do only step 1 of the Kerberos bind\n",
-" -M enable Manage DSA IT control (-MM to make critical)\n",
-" -n show what would be done but don't actually do it\n",
-" -O props SASL security properties\n",
-" -p port port on LDAP server\n",
-" -P version procotol version (default: 3)\n",
-" -Q use SASL Quiet mode\n",
-" -R realm SASL realm\n",
-" -U authcid SASL authentication identity\n",
-" -v run in verbose mode (diagnostics to standard output)\n",
-" -V print version info (-VV only)\n",
-" -w passwd bind password (for simple authentication)\n",
-" -W prompt for bind password\n",
-" -x Simple authentication\n",
-" -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n",
-" -y file Read password from file\n",
-" -Y mech SASL mechanism\n",
-" -Z Start TLS request (-ZZ to require successful response)\n",
+N_(" -c continuous operation mode (do not stop on errors)\n"),
+N_(" -C chase referrals\n"),
+N_(" -d level set LDAP debugging level to `level'\n"),
+N_(" -D binddn bind DN\n"),
+N_(" -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n")
+N_(" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n")
+N_(" [!]manageDSAit (alternate form, see -M)\n")
+N_(" [!]noop\n"),
+N_(" -f file read operations from `file'\n"),
+N_(" -h host LDAP server\n"),
+N_(" -H URI LDAP Uniform Resource Indentifier(s)\n"),
+N_(" -I use SASL Interactive mode\n"),
+N_(" -k use Kerberos authentication\n"),
+N_(" -K like -k, but do only step 1 of the Kerberos bind\n"),
+N_(" -M enable Manage DSA IT control (-MM to make critical)\n"),
+N_(" -n show what would be done but don't actually do it\n"),
+N_(" -O props SASL security properties\n"),
+N_(" -p port port on LDAP server\n"),
+N_(" -P version procotol version (default: 3)\n"),
+N_(" -Q use SASL Quiet mode\n"),
+N_(" -R realm SASL realm\n"),
+N_(" -U authcid SASL authentication identity\n"),
+N_(" -v run in verbose mode (diagnostics to standard output)\n"),
+N_(" -V print version info (-VV only)\n"),
+N_(" -w passwd bind password (for simple authentication)\n"),
+N_(" -W prompt for bind password\n"),
+N_(" -x Simple authentication\n"),
+N_(" -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"),
+N_(" -y file Read password from file\n"),
+N_(" -Y mech SASL mechanism\n"),
+N_(" -Z Start TLS request (-ZZ to require successful response)\n"),
NULL
};
const char *const *cpp;
- fputs( "Common options:\n", stderr );
+ fputs( _("Common options:\n"), stderr );
for( cpp = descriptions; *cpp != NULL; cpp++ ) {
if( strchr( options, (*cpp)[3] ) ) {
- fputs( *cpp, stderr );
+ fputs( _(*cpp), stderr );
}
}
}
int handle_private_option LDAP_P(( int i ));
/* Defined in common.c */
+void tool_init LDAP_P(( void ));
void tool_common_usage LDAP_P(( void ));
void tool_args LDAP_P(( int, char ** ));
LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
void
usage( void )
{
- fprintf( stderr,
-"usage: %s [options] DN <attr:value|attr::b64value>\n"
-"where:\n"
-" DN\tDistinguished Name\n"
-" attr\tassertion attribute\n"
-" value\tassertion value\n"
-" b64value\tbase64 encoding of assertion value\n"
-
-"Compare options:\n"
-" -z Quiet mode, don't print anything, use return values\n"
- , prog );
+ fprintf( stderr, _("usage: %s [options] DN <attr:value|attr::b64value>\n"), prog);
+ fprintf( stderr, _("where:\n"));
+ fprintf( stderr, _(" DN\tDistinguished Name\n"));
+ fprintf( stderr, _(" attr\tassertion attribute\n"));
+ fprintf( stderr, _(" value\tassertion value\n"));
+ fprintf( stderr, _(" b64value\tbase64 encoding of assertion value\n"));
+
+ fprintf( stderr, _("Compare options:\n"));
+ fprintf( stderr, _(" -z Quiet mode, don't print anything, use return values\n"));
tool_common_usage();
exit( EXIT_FAILURE );
}
int crit;
case 'E': /* compare controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, "Invalid compare control name: %s\n", control );
+ fprintf( stderr, _("Invalid compare control name: %s\n"), control );
usage();
#endif
LDAP *ld = NULL;
struct berval bvalue = { 0, NULL };
+ tool_init();
prog = lutil_progname( "ldapcompare", argc, argv );
tool_args( argc, argv );
bvalue.bv_val, strlen( &sep[1] ));
if (bvalue.bv_len == (ber_len_t)-1) {
- fprintf(stderr, "base64 decode error\n");
+ fprintf(stderr, _("base64 decode error\n"));
exit(-1);
}
}
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
tool_server_controls( ld, NULL, 0 );
if ( verbose ) {
- fprintf( stderr, "DN:%s, attr:%s, value:%s\n",
+ fprintf( stderr, _("DN:%s, attr:%s, value:%s\n"),
compdn, attrs, sep );
}
if ( !quiet ) {
if ( rc == LDAP_COMPARE_TRUE ) {
rc = 0;
- printf("TRUE\n");
+ printf(_("TRUE\n"));
} else if ( rc == LDAP_COMPARE_FALSE ) {
rc = 0;
- printf("FALSE\n");
+ printf(_("FALSE\n"));
} else {
ldap_perror( ld, "ldap_compare" );
}
void
usage( void )
{
- fprintf( stderr,
-"Delete entries from an LDAP server\n\n"
-"usage: %s [options] [dn]...\n"
-" dn: list of DNs to delete. If not given, it will be readed from stdin\n"
-" or from the file specified with \"-f file\".\n"
-"Delete Options:\n"
-" -r delete recursively\n"
- , prog );
+ fprintf( stderr, _("Delete entries from an LDAP server\n\n"));
+ fprintf( stderr, _("usage: %s [options] [dn]...\n"), prog);
+ fprintf( stderr, _(" dn: list of DNs to delete. If not given, it will be readed from stdin\n"));
+ fprintf( stderr, _(" or from the file specified with \"-f file\".\n"));
+ fprintf( stderr, _("Delete Options:\n"));
+ fprintf( stderr, _(" -r delete recursively\n"));
tool_common_usage();
exit( EXIT_FAILURE );
}
char *control, *cvalue;
case 'E': /* delete controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, "Invalid delete control name: %s\n", control );
+ fprintf( stderr, _("Invalid delete control name: %s\n"), control );
usage();
#endif
fp = NULL;
+ tool_init();
prog = lutil_progname( "ldapdelete", argc, argv );
tool_args( argc, argv );
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
LDAPMessage *res;
if ( verbose ) {
- printf( "%sdeleting entry \"%s\"\n",
+ printf( _("%sdeleting entry \"%s\"\n"),
(not ? "!" : ""), dn );
}
if( verbose || code != LDAP_SUCCESS ||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
{
- printf( "Delete Result: %s (%d)\n", ldap_err2string( code ), code );
+ printf( _("Delete Result: %s (%d)\n"), ldap_err2string( code ), code );
if( text && *text ) {
- printf( "Additional info: %s\n", text );
+ printf( _("Additional info: %s\n"), text );
}
if( matcheddn && *matcheddn ) {
- printf( "Matched DN: %s\n", matcheddn );
+ printf( _("Matched DN: %s\n"), matcheddn );
}
if( refs ) {
int i;
for( i=0; refs[i]; i++ ) {
- printf("Referral: %s\n", refs[i] );
+ printf(_("Referral: %s\n"), refs[i] );
}
}
}
int rc;
static char *attrs[] = { "1.1", NULL };
- if ( verbose ) printf ( "deleting children of: %s\n", dn );
+ if ( verbose ) printf ( _("deleting children of: %s\n"), dn );
/*
* Do a one level search at dn for children. For each, delete its children.
*/
}
if ( verbose ) {
- printf( "\tremoving %s\n", dn );
+ printf( _("\tremoving %s\n"), dn );
}
rc = ldap_delete_s( ld, dn );
}
if ( verbose ) {
- printf( "\t%s removed\n", dn );
+ printf( _("\t%s removed\n"), dn );
}
ber_memfree( dn );
void
usage( void )
{
- fprintf( stderr,
-"Add or modify entries from an LDAP server\n\n"
-"usage: %s [options]\n"
-" The list of desired operations are read from stdin or from the file\n"
-" specified by \"-f file\".\n"
-"Add or modify options:\n"
-" -a add values (default%s)\n"
-" -F force all changes records to be used\n"
-" -S file write skipped modifications to `file'\n"
- , prog, (ldapadd ? "" : " is to replace") );
- tool_common_usage();
+ fprintf( stderr, _("Add or modify entries from an LDAP server\n\n"));
+ fprintf( stderr, _("usage: %s [options]\n"), prog);
+ fprintf( stderr, _(" The list of desired operations are read from stdin or from the file\n"));
+ fprintf( stderr, _(" specified by \"-f file\".\n"));
+ fprintf( stderr, _("Add or modify options:\n"));
+ fprintf( stderr, _(" -a add values (default%s)\n"), (ldapadd ? "" : _(" is to replace")));
+ fprintf( stderr, _(" -F force all changes records to be used\n"));
+ fprintf( stderr, _(" -S file write skipped modifications to `file'\n"));
+ tool_common_usage();
exit( EXIT_FAILURE );
}
int crit;
case 'E': /* modify controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, "Invalid modify control name: %s\n", control );
+ fprintf( stderr, _("Invalid modify control name: %s\n"), control );
usage();
#endif
case 'S': /* skipped modifications to file */
if( rejfile != NULL ) {
- fprintf( stderr, "%s: -S previously specified\n", prog );
+ fprintf( stderr, _("%s: -S previously specified\n"), prog );
exit( EXIT_FAILURE );
}
rejfile = ber_strdup( optarg );
int rc, retval;
int count, len;
+ tool_init();
prog = lutil_progname( "ldapmodify", argc, argv );
/* strncmp instead of strcmp since NT binaries carry .exe extension */
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
if ( rc )
retval = rc;
if ( rc && rejfp ) {
- fprintf(rejfp, "# Error: %s (%d)", ldap_err2string(rc), rc);
+ fprintf(rejfp, _("# Error: %s (%d)"), ldap_err2string(rc), rc);
matched_msg = NULL;
ldap_get_option(ld, LDAP_OPT_MATCHED_DN, &matched_msg);
if ( matched_msg != NULL ) {
if ( *matched_msg != '\0' )
- fprintf( rejfp, ", matched DN: %s", matched_msg );
+ fprintf( rejfp, _(", matched DN: %s"), matched_msg );
ldap_memfree( matched_msg );
}
ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg);
if ( error_msg != NULL ) {
if ( *error_msg != '\0' )
- fprintf( rejfp, ", additional info: %s", error_msg );
+ fprintf( rejfp, _(", additional info: %s"), error_msg );
ldap_memfree( error_msg );
}
fprintf( rejfp, "\n%s\n", rejbuf );
}
if ( ldif_parse_line( line, &type, &val.bv_val, &val.bv_len ) < 0 ) {
- fprintf( stderr, "%s: invalid format (line %d) entry: \"%s\"\n",
+ fprintf( stderr, _("%s: invalid format (line %d) entry: \"%s\"\n"),
prog, linenum, dn == NULL ? "" : dn );
rc = LDAP_PARAM_ERROR;
break;
strcasecmp( type, T_VERSION_STR ) == 0 )
{
if( val.bv_len == 0 || atoi(val.bv_val) != 1 ) {
- fprintf( stderr, "%s: invalid version %s, line %d (ignored)\n",
+ fprintf( stderr, _("%s: invalid version %s, line %d (ignored)\n"),
prog, val.bv_val, linenum );
}
version++;
/* Parse and add it to the list of controls */
rc = parse_ldif_control( line, &pctrls );
if (rc != 0) {
- fprintf( stderr, "%s: Error processing %s line, line %d: %s\n",
+ fprintf( stderr, _("%s: Error processing %s line, line %d: %s\n"),
prog, T_CONTROL_STR, linenum, ldap_err2string(rc) );
}
goto end_line;
expect_ct = 0;
if ( !use_record && saw_replica ) {
- printf( "%s: skipping change record for entry: %s\n"
- "\t(LDAP host/port does not match replica: lines)\n",
- prog, dn );
+ printf(_("%s: skipping change record for entry: %s\n"), prog, dn);
+ printf(_("\t(LDAP host/port does not match replica: lines)\n"));
free( dn );
ber_memfree( type );
ber_memfree( val.bv_val );
}
if ( ++icnt != val.bv_len ) {
- fprintf( stderr, "%s: illegal trailing space after \"%s: %s\" trimmed (line %d of entry \"%s\")\n",
+ fprintf( stderr, _("%s: illegal trailing space after \"%s: %s\" trimmed (line %d of entry \"%s\")\n"),
prog, T_CHANGETYPESTR, val.bv_val, linenum, dn );
val.bv_val[icnt] = '\0';
}
got_all = delete_entry = 1;
} else {
fprintf( stderr,
- "%s: unknown %s \"%s\" (line %d of entry \"%s\")\n",
+ _("%s: unknown %s \"%s\" (line %d of entry \"%s\")\n"),
prog, T_CHANGETYPESTR, val.bv_val, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
}
if ( ++icnt != val.bv_len ) {
- fprintf( stderr, "%s: illegal trailing space after \"%s: %s\" trimmed (line %d of entry \"%s\")\n",
+ fprintf( stderr, _("%s: illegal trailing space after \"%s: %s\" trimmed (line %d of entry \"%s\")\n"),
prog, type, val.bv_val, linenum, dn );
val.bv_val[icnt] = '\0';
}
expect_deleteoldrdn = 1;
expect_newrdn = 0;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
+ fprintf( stderr, _("%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n"),
prog, T_NEWRDNSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
expect_newsup = 1;
got_all = 1;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
+ fprintf( stderr, _("%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n"),
prog, T_DELETEOLDRDNSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
}
expect_newsup = 0;
} else {
- fprintf( stderr, "%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n",
+ fprintf( stderr, _("%s: expecting \"%s:\" but saw \"%s:\" (line %d of entry \"%s\")\n"),
prog, T_NEWSUPSTR, type, linenum, dn );
rc = LDAP_PARAM_ERROR;
}
} else if ( got_all ) {
fprintf( stderr,
- "%s: extra lines at end (line %d of entry \"%s\")\n",
+ _("%s: extra lines at end (line %d of entry \"%s\")\n"),
prog, linenum, dn );
rc = LDAP_PARAM_ERROR;
} else {
struct berval *bvp;
if ( pmods == NULL ) {
- fprintf( stderr, "%s: no attributes to change or add (entry=\"%s\")\n",
+ fprintf( stderr, _("%s: no attributes to change or add (entry=\"%s\")\n"),
prog, dn );
return( LDAP_PARAM_ERROR );
}
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
if( op == LDAP_MOD_ADD && ( pmods[i]->mod_bvalues == NULL )) {
fprintf( stderr,
- "%s: attribute \"%s\" has no values (entry=\"%s\")\n",
+ _("%s: attribute \"%s\" has no values (entry=\"%s\")\n"),
prog, pmods[i]->mod_type, dn );
return LDAP_PARAM_ERROR;
}
for ( i = 0; pmods[ i ] != NULL; ++i ) {
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
printf( "%s %s:\n", op == LDAP_MOD_REPLACE ?
- "replace" : op == LDAP_MOD_ADD ?
- "add" : "delete", pmods[ i ]->mod_type );
+ _("replace") : op == LDAP_MOD_ADD ?
+ _("add") : _("delete"), pmods[ i ]->mod_type );
if ( pmods[ i ]->mod_bvalues != NULL ) {
for ( j = 0; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) {
bvp = pmods[ i ]->mod_bvalues[ j ];
}
}
if ( notascii ) {
- printf( "\tNOT ASCII (%ld bytes)\n", bvp->bv_len );
+ printf( _("\tNOT ASCII (%ld bytes)\n"), bvp->bv_len );
} else {
printf( "\t%s\n", bvp->bv_val );
}
}
if ( i != LDAP_SUCCESS ) {
/* print error message about failed update including DN */
- fprintf( stderr, "%s: update failed: %s\n", prog, dn );
+ fprintf( stderr, _("%s: update failed: %s\n"), prog, dn );
ldap_perror( ld, newentry ? "ldap_add" : "ldap_modify" );
} else if ( verbose ) {
- printf( "modify complete\n" );
+ printf( _("modify complete\n") );
}
} else {
i = LDAP_SUCCESS;
{
int rc;
- printf( "%sdeleting entry \"%s\"\n", not ? "!" : "", dn );
+ printf( _("%sdeleting entry \"%s\"\n"), not ? "!" : "", dn );
if ( !not ) {
if (( rc = ldap_delete_ext_s( ld, dn, pctrls, NULL )) != LDAP_SUCCESS ) {
- fprintf( stderr, "%s: delete failed: %s\n", prog, dn );
+ fprintf( stderr, _("%s: delete failed: %s\n"), prog, dn );
ldap_perror( ld, "ldap_delete" );
} else if ( verbose ) {
- printf( "delete complete" );
+ printf( _("delete complete") );
}
} else {
rc = LDAP_SUCCESS;
int rc;
- printf( "%smodifying rdn of entry \"%s\"\n", not ? "!" : "", dn );
+ printf( _("%smodifying rdn of entry \"%s\"\n"), not ? "!" : "", dn );
if ( verbose ) {
- printf( "\tnew RDN: \"%s\" (%skeep existing values)\n",
- newrdn, deleteoldrdn ? "do not " : "" );
+ printf( _("\tnew RDN: \"%s\" (%skeep existing values)\n"),
+ newrdn, deleteoldrdn ? _("do not ") : "" );
}
if ( !not ) {
if (( rc = ldap_rename_s( ld, dn, newrdn, newsup, deleteoldrdn, pctrls, NULL ))
!= LDAP_SUCCESS ) {
- fprintf( stderr, "%s: rename failed: %s\n", prog, dn );
+ fprintf( stderr, _("%s: rename failed: %s\n"), prog, dn );
ldap_perror( ld, "ldap_modrdn" );
} else {
- printf( "modrdn completed\n" );
+ printf( _("modrdn completed\n") );
}
} else {
rc = LDAP_SUCCESS;
void
usage( void )
{
- fprintf( stderr,
-"Rename LDAP entries\n\n"
-"usage: %s [options] [dn rdn]\n"
-" dn rdn: If given, rdn will replace the RDN of the entry specified by DN\n"
-" If not given, the list of modifications is read from stdin or\n"
-" from the file specified by \"-f file\" (see man page).\n"
-"Rename options:\n"
-" -r remove old RDN\n"
-" -s newsup new superior entry\n"
- , prog );
+ fprintf( stderr, _("Rename LDAP entries\n\n"));
+ fprintf( stderr, _("usage: %s [options] [dn rdn]\n"), prog);
+ fprintf( stderr, _(" dn rdn: If given, rdn will replace the RDN of the entry specified by DN\n"));
+ fprintf( stderr, _(" If not given, the list of modifications is read from stdin or\n"));
+ fprintf( stderr, _(" from the file specified by \"-f file\" (see man page).\n"));
+ fprintf( stderr, _("Rename options:\n"));
+ fprintf( stderr, _(" -r remove old RDN\n"));
+ fprintf( stderr, _(" -s newsup new superior entry\n"));
tool_common_usage();
exit( EXIT_FAILURE );
}
char *control, *cvalue;
case 'E': /* modrdn controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, version );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, "Invalid modrdn control name: %s\n", control );
+ fprintf( stderr, _("Invalid modrdn control name: %s\n"), control );
usage();
#endif
case 's': /* newSuperior */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -X incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -X incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
LDAP *ld;
int rc, retval, havedn;
+ tool_init();
prog = lutil_progname( "ldapmodrdn", argc, argv );
tool_args( argc, argv );
}
++havedn;
} else if ( argc - optind != 0 ) {
- fprintf( stderr, "%s: invalid number of arguments (%d), "
- "only two allowed\n", prog, argc-optind );
+ fprintf( stderr, _("%s: invalid number of arguments (%d), only two allowed\n"), prog, argc-optind );
usage();
}
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
LDAPMessage *res;
if ( verbose ) {
- printf( "Renaming \"%s\"\n", dn );
- printf( "\tnew rdn=\"%s\" (%s old rdn)\n",
- rdn, remove ? "delete" : "keep" );
+ printf( _("Renaming \"%s\"\n"), dn );
+ printf( _("\tnew rdn=\"%s\" (%s old rdn)\n"),
+ rdn, remove ? _("delete") : _("keep") );
if( newSuperior != NULL ) {
- printf("\tnew parent=\"%s\"\n", newSuperior);
+ printf(_("\tnew parent=\"%s\"\n"), newSuperior);
}
}
if( verbose || code != LDAP_SUCCESS ||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
{
- printf( "Rename Result: %s (%d)\n",
+ printf( _("Rename Result: %s (%d)\n"),
ldap_err2string( code ), code );
if( text && *text ) {
- printf( "Additional info: %s\n", text );
+ printf( _("Additional info: %s\n"), text );
}
if( matcheddn && *matcheddn ) {
- printf( "Matched DN: %s\n", matcheddn );
+ printf( _("Matched DN: %s\n"), matcheddn );
}
if( refs ) {
int i;
for( i=0; refs[i]; i++ ) {
- printf("Referral: %s\n", refs[i] );
+ printf(_("Referral: %s\n"), refs[i] );
}
}
}
void
usage( void )
{
- fprintf(stderr,
-"Change password of an LDAP user\n\n"
-"usage: %s [options] [user]\n"
-" user: the autentication identity, commonly a DN\n"
-"Password change options:\n"
-" -a secret old password\n"
-" -A prompt for old password\n"
-" -t file read file for old password\n"
-" -s secret new password\n"
-" -S prompt for new password\n"
-" -T file read file for new password\n"
- , prog );
+ fprintf( stderr, _("Change password of an LDAP user\n\n"));
+ fprintf( stderr,_("usage: %s [options] [user]\n"), prog);
+ fprintf( stderr, _(" user: the autentication identity, commonly a DN\n"));
+ fprintf( stderr, _("Password change options:\n"));
+ fprintf( stderr, _(" -a secret old password\n"));
+ fprintf( stderr, _(" -A prompt for old password\n"));
+ fprintf( stderr, _(" -t file read file for old password\n"));
+ fprintf( stderr, _(" -s secret new password\n"));
+ fprintf( stderr, _(" -S prompt for new password\n"));
+ fprintf( stderr, _(" -T file read file for new password\n"));
tool_common_usage();
exit( EXIT_FAILURE );
}
int crit;
char *control, *cvalue;
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
-
- fprintf( stderr, "Invalid passwd control name: %s\n", control );
+ fprintf( stderr, _("Invalid passwd control name: %s\n"), control );
usage();
}
#endif
char *retoid = NULL;
struct berval *retdata = NULL;
+ tool_init();
prog = lutil_progname( "ldappasswd", argc, argv );
/* LDAPv3 only */
if( want_oldpw && oldpw.bv_val == NULL ) {
/* prompt for old password */
char *ckoldpw;
- oldpw.bv_val = strdup(getpassphrase("Old password: "));
- ckoldpw = getpassphrase("Re-enter old password: ");
+ oldpw.bv_val = strdup(getpassphrase(_("Old password: ")));
+ ckoldpw = getpassphrase(_("Re-enter old password: "));
if( oldpw.bv_val == NULL || ckoldpw == NULL ||
strcmp( oldpw.bv_val, ckoldpw ))
{
- fprintf( stderr, "passwords do not match\n" );
+ fprintf( stderr, _("passwords do not match\n") );
return EXIT_FAILURE;
}
if( want_newpw && newpw.bv_val == NULL ) {
/* prompt for new password */
char *cknewpw;
- newpw.bv_val = strdup(getpassphrase("New password: "));
- cknewpw = getpassphrase("Re-enter new password: ");
+ newpw.bv_val = strdup(getpassphrase(_("New password: ")));
+ cknewpw = getpassphrase(_("Re-enter new password: "));
if( newpw.bv_val == NULL || cknewpw == NULL ||
strcmp( newpw.bv_val, cknewpw ))
{
- fprintf( stderr, "passwords do not match\n" );
+ fprintf( stderr, _("passwords do not match\n") );
return EXIT_FAILURE;
}
if( want_bindpw && passwd.bv_val == NULL ) {
/* handle bind password */
- passwd.bv_val = strdup( getpassphrase("Enter bind password: "));
+ passwd.bv_val = strdup( getpassphrase(_("Enter bind password: ")));
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
if( tag == LBER_ERROR ) {
perror( "ber_scanf" );
} else {
- printf("New password: %s\n", s);
+ printf(_("New password: %s\n"), s);
free( s );
}
}
if( verbose || code != LDAP_SUCCESS || matcheddn || text || refs ) {
- printf( "Result: %s (%d)\n", ldap_err2string( code ), code );
+ printf( _("Result: %s (%d)\n"), ldap_err2string( code ), code );
if( text && *text ) {
- printf( "Additional info: %s\n", text );
+ printf( _("Additional info: %s\n"), text );
}
if( matcheddn && *matcheddn ) {
- printf( "Matched DN: %s\n", matcheddn );
+ printf( _("Matched DN: %s\n"), matcheddn );
}
if( refs ) {
int i;
for( i=0; refs[i]; i++ ) {
- printf("Referral: %s\n", refs[i] );
+ printf(_("Referral: %s\n"), refs[i] );
}
}
}
void
usage( void )
{
- fprintf( stderr,
-"usage: %s [options] [filter [attributes...]]\nwhere:\n"
-" filter\tRFC-2254 compliant LDAP search filter\n"
-" attributes\twhitespace-separated list of attribute descriptions\n"
-" which may include:\n"
-" 1.1 no attributes\n"
-" * all user attributes\n"
-" + all operational attributes\n"
-
-"Search options:\n"
-" -a deref one of never (default), always, search, or find\n"
-" -A retrieve attribute names only (no values)\n"
-" -b basedn base dn for search\n"
-" -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\n"
+ fprintf( stderr, _("usage: %s [options] [filter [attributes...]]\nwhere:\n"), prog);
+ fprintf( stderr, _(" filter\tRFC-2254 compliant LDAP search filter\n"));
+ fprintf( stderr, _(" attributes\twhitespace-separated list of attribute descriptions\n"));
+ fprintf( stderr, _(" which may include:\n"));
+ fprintf( stderr, _(" 1.1 no attributes\n"));
+ fprintf( stderr, _(" * all user attributes\n"));
+ fprintf( stderr, _(" + all operational attributes\n"));
+
+
+ fprintf( stderr, _("Search options:\n"));
+ fprintf( stderr, _(" -a deref one of never (default), always, search, or find\n"));
+ fprintf( stderr, _(" -A retrieve attribute names only (no values)\n"));
+ fprintf( stderr, _(" -b basedn base dn for search\n"));
+ fprintf( stderr, _(" -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\n"));
#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
-" [!]domainScope (domain scope)\n"
+ fprintf( stderr, _(" [!]domainScope (domain scope)\n"));
#endif
-" [!]mv=<filter> (matched values filter)\n"
+ fprintf( stderr, _(" [!]mv=<filter> (matched values filter)\n"));
#ifdef LDAP_CONTROL_PAGEDRESULTS
-" [!]pr=<size> (paged results)\n"
+ fprintf( stderr, _(" [!]pr=<size> (paged results)\n"));
#endif
#ifdef LDAP_CONTROL_SUBENTRIES
-" [!]subentries[=true|false] (subentries)\n"
+ fprintf( stderr, _(" [!]subentries[=true|false] (subentries)\n"));
#endif
#ifdef LDAP_CLIENT_UPDATE
-" [!]lcup=p/<cint>/<cookie>/<slimit> (LDAP client update)\n"
+ fprintf( stderr, _(" [!]lcup=p/<cint>/<cookie>/<slimit> (LDAP client update)\n"));
/*
* " s/<cint>/<cookie> (LDAP client update)\n"
* " sp/<cint>/<cookie>/<slimit>\n"
* */
#endif
#ifdef LDAP_SYNC
-" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"
-" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"
+ fprintf( stderr, _(" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"));
+ fprintf( stderr, _(" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"));
#endif
-" -F prefix URL prefix for files (default: %s)\n"
-" -l limit time limit (in seconds) for search\n"
-" -L print responses in LDIFv1 format\n"
-" -LL print responses in LDIF format without comments\n"
-" -LLL print responses in LDIF format without comments\n"
-" and version\n"
-" -s scope one of base, one, or sub (search scope)\n"
-" -S attr sort the results by attribute `attr'\n"
-" -t write binary values to files in temporary directory\n"
-" -tt write all values to files in temporary directory\n"
-" -T path write files to directory specified by path (default: %s)\n"
-" -u include User Friendly entry names in the output\n"
-" -z limit size limit (in entries) for search\n"
- , prog, def_urlpre, def_tmpdir );
+ fprintf( stderr, _(" -F prefix URL prefix for files (default: %s)\n"), def_urlpre);
+ fprintf( stderr, _(" -l limit time limit (in seconds) for search\n"));
+ fprintf( stderr, _(" -L print responses in LDIFv1 format\n"));
+ fprintf( stderr, _(" -LL print responses in LDIF format without comments\n"));
+ fprintf( stderr, _(" -LLL print responses in LDIF format without comments\n"));
+ fprintf( stderr, _(" and version\n"));
+ fprintf( stderr, _(" -s scope one of base, one, or sub (search scope)\n"));
+ fprintf( stderr, _(" -S attr sort the results by attribute `attr'\n"));
+ fprintf( stderr, _(" -t write binary values to files in temporary directory\n"));
+ fprintf( stderr, _(" -tt write all values to files in temporary directory\n"));
+ fprintf( stderr, _(" -T path write files to directory specified by path (default: %s)\n"), def_tmpdir);
+ fprintf( stderr, _(" -u include User Friendly entry names in the output\n"));
+ fprintf( stderr, _(" -z limit size limit (in entries) for search\n"));
tool_common_usage();
exit( EXIT_FAILURE );
}
} else if ( strcasecmp( optarg, "always" ) == 0 ) {
deref = LDAP_DEREF_ALWAYS;
} else {
- fprintf( stderr, "alias deref should be never, search, find, or always\n" );
+ fprintf( stderr, _("alias deref should be never, search, find, or always\n") );
usage();
}
break;
break;
case 'E': /* search controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( strcasecmp( control, "mv" ) == 0 ) {
/* ValuesReturnFilter control */
if( valuesReturnFilter ) {
- fprintf( stderr, "ValuesReturnFilter previously specified\n");
+ fprintf( stderr, _("ValuesReturnFilter previously specified\n"));
exit( EXIT_FAILURE );
}
valuesReturnFilter= 1 + crit;
if ( cvalue == NULL ) {
fprintf( stderr,
- "missing filter in ValuesReturnFilter control\n");
+ _("missing filter in ValuesReturnFilter control\n"));
exit( EXIT_FAILURE );
}
int num, tmp;
/* PagedResults control */
if ( pagedResults != 0 ) {
- fprintf( stderr, "PagedResultsControl previously specified\n" );
+ fprintf( stderr, _("PagedResultsControl previously specified\n") );
exit( EXIT_FAILURE );
}
num = sscanf( cvalue, "%d", &tmp );
if ( num != 1 ) {
- fprintf( stderr, "Invalid value for PagedResultsControl, %s.\n", cvalue);
+ fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), cvalue);
exit( EXIT_FAILURE );
}
} else if ( strcasecmp( control, "domainScope" ) == 0 ) {
if( domainScope ) {
fprintf( stderr,
- "domainScope control previously specified\n");
+ _("domainScope control previously specified\n"));
exit( EXIT_FAILURE );
}
if( cvalue != NULL ) {
fprintf( stderr,
- "domainScope: no control value expected\n" );
+ _("domainScope: no control value expected\n") );
usage();
}
#ifdef LDAP_CONTROL_SUBENTRIES
} else if ( strcasecmp( control, "subentries" ) == 0 ) {
if( subentries ) {
- fprintf( stderr, "subentries control previously specified\n");
+ fprintf( stderr, _("subentries control previously specified\n"));
exit( EXIT_FAILURE );
}
if( cvalue == NULL || strcasecmp( cvalue, "true") == 0 ) {
subentries = 1;
} else {
fprintf( stderr,
- "subentries control value \"%s\" invalid\n",
+ _("subentries control value \"%s\" invalid\n"),
cvalue );
exit( EXIT_FAILURE );
}
char *cookiep;
char *slimitp;
if ( lcup ) {
- fprintf( stderr, "client update control previously specified\n");
+ fprintf( stderr, _("client update control previously specified\n"));
exit( EXIT_FAILURE );
}
if ( ldapsync != -1 ) {
- fprintf( stderr, "ldap sync control previously specified\n");
+ fprintf( stderr, _("ldap sync control previously specified\n"));
exit( EXIT_FAILURE );
}
if ( cvalue == NULL ) {
fprintf( stderr,
- "missing specification of client update control\n");
+ _("missing specification of client update control\n"));
exit( EXIT_FAILURE );
}
if ( strncasecmp( cvalue, "p", 1 ) == 0 ) {
*/
} else {
fprintf( stderr,
- "client update control value \"%s\" invalid\n",
+ _("client update control value \"%s\" invalid\n"),
cvalue );
exit( EXIT_FAILURE );
}
char *cookiep;
char *slimitp;
if ( ldapsync ) {
- fprintf( stderr, "ldap sync control previously specified\n" );
+ fprintf( stderr, _("ldap sync control previously specified\n") );
exit( EXIT_FAILURE );
}
if ( lcup ) {
- fprintf( stderr, "client update control previously specified\n" );
+ fprintf( stderr, _("client update control previously specified\n") );
exit( EXIT_FAILURE );
}
if ( cvalue == NULL ) {
fprintf( stderr,
- "missing specification of ldap sync control\n");
+ _("missing specification of ldap sync control\n"));
exit( EXIT_FAILURE );
}
if ( strncasecmp( cvalue, "ro", 2 ) == 0 ) {
sync_slimit = atoi( slimitp );
} else {
fprintf( stderr,
- "ldap sync control value \"%s\" invalid\n",
+ _("ldap sync control value \"%s\" invalid\n"),
cvalue );
exit( EXIT_FAILURE );
}
#endif
} else {
- fprintf( stderr, "Invalid control name: %s\n", control );
+ fprintf( stderr, _("Invalid control name: %s\n"), control );
usage();
}
break;
case 'l': /* time limit */
timelimit = atoi( optarg );
if( timelimit < 0 ) {
- fprintf( stderr, "%s: invalid timelimit (%d) specified\n",
+ fprintf( stderr, _("%s: invalid timelimit (%d) specified\n"),
prog, timelimit );
exit( EXIT_FAILURE );
}
} else if ( strncasecmp( optarg, "sub", sizeof("sub")-1 ) == 0 ) {
scope = LDAP_SCOPE_SUBTREE;
} else {
- fprintf( stderr, "scope should be base, one, or sub\n" );
+ fprintf( stderr, _("scope should be base, one, or sub\n") );
usage();
}
break;
if (deref != -1 &&
ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) != LDAP_OPT_SUCCESS )
{
- fprintf( stderr, "Could not set LDAP_OPT_DEREF %d\n", deref );
+ fprintf( stderr, _("Could not set LDAP_OPT_DEREF %d\n"), deref );
exit( EXIT_FAILURE );
}
if (timelimit != -1 &&
ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) != LDAP_OPT_SUCCESS )
{
- fprintf( stderr, "Could not set LDAP_OPT_TIMELIMIT %d\n", timelimit );
+ fprintf( stderr, _("Could not set LDAP_OPT_TIMELIMIT %d\n"), timelimit );
exit( EXIT_FAILURE );
}
if (sizelimit != -1 &&
ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) != LDAP_OPT_SUCCESS )
{
- fprintf( stderr, "Could not set LDAP_OPT_SIZELIMIT %d\n", sizelimit );
+ fprintf( stderr, _("Could not set LDAP_OPT_SIZELIMIT %d\n"), sizelimit );
exit( EXIT_FAILURE );
}
}
struct berval *syncbvalp = NULL;
#endif
+ tool_init();
+
#ifdef LDAP_CONTROL_PAGEDRESULTS
npagedresponses = npagedentries = npagedreferences =
npagedextended = npagedpartial = 0;
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
err = ber_printf( seber, "{b}", abs(subentries) == 1 ? 0 : 1 );
if ( err == -1 ) {
ber_free( seber, 1 );
- fprintf( stderr, "Subentries control encoding error!\n" );
+ fprintf( stderr, _("Subentries control encoding error!\n") );
return EXIT_FAILURE;
}
if ( err == LBER_ERROR ) {
ber_free( cuber, 1 );
- fprintf( stderr, "client update control encoding error!\n" );
+ fprintf( stderr, _("client update control encoding error!\n") );
return EXIT_FAILURE;
}
if ( err == LBER_ERROR ) {
ber_free( syncber, 1 );
- fprintf( stderr, "ldap sync control encoding error!\n" );
+ fprintf( stderr, _("ldap sync control encoding error!\n") );
return EXIT_FAILURE;
}
if ( ( err = ldap_put_vrFilter( vrber, vrFilter ) ) == -1 ) {
ber_free( vrber, 1 );
- fprintf( stderr, "Bad ValuesReturnFilter: %s\n", vrFilter );
+ fprintf( stderr, _("Bad ValuesReturnFilter: %s\n"), vrFilter );
return EXIT_FAILURE;
}
}
if ( verbose ) {
- fprintf( stderr, "filter%s: %s\nrequesting: ",
- infile != NULL ? " pattern" : "",
+ fprintf( stderr, _("filter%s: %s\nrequesting: "),
+ infile != NULL ? _(" pattern") : "",
filtpattern );
if ( attrs == NULL ) {
- fprintf( stderr, "ALL" );
+ fprintf( stderr, _("ALL") );
} else {
for ( i = 0; attrs[ i ] != NULL; ++i ) {
fprintf( stderr, "%s ", attrs[ i ] );
}
if ( ldif == 0 ) {
- printf( "# extended LDIF\n" );
+ printf( _("# extended LDIF\n") );
} else if ( ldif < 3 ) {
- printf( "version: %d\n\n", 1 );
+ printf( _("version: %d\n\n"), 1 );
}
if (ldif < 2 ) {
- printf( "#\n"
- "# LDAPv%d\n"
- "# base <%s> with scope %s\n"
- "# filter%s: %s\n"
- "# requesting: ",
- protocol,
+ printf( "#\n" );
+ printf(_("# LDAPv%d\n"), protocol);
+ printf(_("# base <%s> with scope %s\n"),
base ? base : "", (scope == LDAP_SCOPE_BASE) ? "base"
- : ((scope == LDAP_SCOPE_ONELEVEL) ? "one" : "sub"),
- infile != NULL ? " pattern" : "",
- filtpattern );
+ : ((scope == LDAP_SCOPE_ONELEVEL) ? "one" : "sub"));
+ printf(_("# filter%s: %s\n"), infile != NULL ? _(" pattern") : "",
+ filtpattern);
+ printf(_("# requesting: "));
if ( attrs == NULL ) {
- printf( "ALL" );
+ printf( _("ALL") );
} else {
for ( i = 0; attrs[ i ] != NULL; ++i ) {
printf( "%s ", attrs[ i ] );
}
if ( manageDSAit ) {
- printf("\n# with manageDSAit %scontrol",
- manageDSAit > 1 ? "critical " : "" );
+ printf(_("\n# with manageDSAit %scontrol"),
+ manageDSAit > 1 ? _("critical ") : "" );
}
if ( noop ) {
- printf("\n# with noop %scontrol",
- noop > 1 ? "critical " : "" );
+ printf(_("\n# with noop %scontrol"),
+ noop > 1 ? _("critical ") : "" );
}
if ( subentries ) {
- printf("\n# with subentries %scontrol: %s",
- subentries < 0 ? "critical " : "",
+ printf(_("\n# with subentries %scontrol: %s"),
+ subentries < 0 ? _("critical ") : "",
abs(subentries) == 1 ? "false" : "true" );
}
if ( valuesReturnFilter ) {
- printf("\n# with valuesReturnFilter %scontrol: %s",
- valuesReturnFilter > 1 ? "critical " : "", vrFilter );
+ printf(_("\n# with valuesReturnFilter %scontrol: %s"),
+ valuesReturnFilter > 1 ? _("critical ") : "", vrFilter );
}
#ifdef LDAP_CONTROL_PAGEDRESULTS
if ( pageSize ) {
- printf("\n# with pagedResults %scontrol: size=%d",
- (pagedResults > 1) ? "critical " : "",
+ printf(_("\n# with pagedResults %scontrol: size=%d"),
+ (pagedResults > 1) ? _("critical ") : "",
pageSize );
}
#endif
- printf( "\n#\n\n" );
+ printf( _("\n#\n\n") );
}
if ( infile == NULL ) {
* enter is pressed on the terminal.
*/
if ( entriesLeft > 0 ) {
- printf( "Estimate entries: %d\n", entriesLeft );
+ printf( _("Estimate entries: %d\n"), entriesLeft );
}
- printf( "Press [size] Enter for the next {%d|size} entries.\n",
+ printf( _("Press [size] Enter for the next {%d|size} entries.\n"),
(int)pageSize );
i = 0;
moreEntries = getchar();
if ( i > 0 && isdigit( (unsigned char)buf[0] ) ) {
int num = sscanf( buf, "%d", &tmpSize );
if ( num != 1 ) {
- fprintf( stderr, "Invalid value for PagedResultsControl, %s.\n", buf);
+ fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), buf);
return EXIT_FAILURE;
}
sprintf( filter, filtpatt, value );
if ( verbose ) {
- fprintf( stderr, "filter: %s\n", filter );
+ fprintf( stderr, _("filter: %s\n"), filter );
}
if( ldif < 2 ) {
- printf( "#\n# filter: %s\n#\n", filter );
+ printf( _("#\n# filter: %s\n#\n"), filter );
}
} else {
}
if( rc != LDAP_SUCCESS ) {
- fprintf( stderr, "%s: ldap_search_ext: %s (%d)\n",
+ fprintf( stderr, _("%s: ldap_search_ext: %s (%d)\n"),
prog, ldap_err2string( rc ), rc );
return( rc );
}
#ifdef LDAP_SYNC
if ( cancel_msgid != -1 &&
cancel_msgid == ldap_msgid( msg ) ) {
- printf("Cancelled \n");
- printf("cancel_msgid = %d\n", cancel_msgid);
+ printf(_("Cancelled \n"));
+ printf(_("cancel_msgid = %d\n"), cancel_msgid);
goto done;
}
#endif
nresponses_psearch = 0;
if ( strcmp( retoid, LDAP_SYNC_INFO ) ) {
- printf("Unexpected Intermediate Response\n");
+ printf(_("Unexpected Intermediate Response\n"));
ldap_memfree( retoid );
ber_bvfree( retdata );
goto done;
} else {
- printf("SyncInfo Received\n");
+ printf(_("SyncInfo Received\n"));
ldap_memfree( retoid );
ber_bvfree( retdata );
break;
npagedextended = npagedextended + nextended;
npagedpartial = npagedpartial + npartial;
if ( ( morePagedResults == 0 ) && ( ldif < 2 ) ) {
- printf( "\n# numResponses: %d\n", npagedresponses );
- if( nentries ) printf( "# numEntries: %d\n", npagedentries );
- if( nextended ) printf( "# numExtended: %d\n", npagedextended );
- if( npartial ) printf( "# numPartial: %d\n", npagedpartial );
- if( nreferences ) printf( "# numReferences: %d\n", npagedreferences );
+ printf( _("\n# numResponses: %d\n"), npagedresponses );
+ if( nentries ) printf( _("# numEntries: %d\n"), npagedentries );
+ if( nextended ) printf( _("# numExtended: %d\n"), npagedextended );
+ if( npartial ) printf( _("# numPartial: %d\n"), npagedpartial );
+ if( nreferences ) printf( _("# numReferences: %d\n"), npagedreferences );
}
} else
#endif
if ( ldif < 2 ) {
- printf( "\n# numResponses: %d\n", nresponses );
- if( nentries ) printf( "# numEntries: %d\n", nentries );
- if( nextended ) printf( "# numExtended: %d\n", nextended );
- if( npartial ) printf( "# numPartial: %d\n", npartial );
- if( nreferences ) printf( "# numReferences: %d\n", nreferences );
+ printf( _("\n# numResponses: %d\n"), nresponses );
+ if( nentries ) printf( _("# numEntries: %d\n"), nentries );
+ if( nextended ) printf( _("# numExtended: %d\n"), nextended );
+ if( npartial ) printf( _("# numPartial: %d\n"), npartial );
+ if( nreferences ) printf( _("# numReferences: %d\n"), nreferences );
}
return( rc );
rc = ldap_get_entry_controls( ld, entry, &ctrls );
if( rc != LDAP_SUCCESS ) {
- fprintf(stderr, "print_entry: %d\n", rc );
+ fprintf(stderr, _("print_entry: %d\n"), rc );
ldap_perror( ld, "ldap_get_entry_controls" );
exit( EXIT_FAILURE );
}
rc = ldap_int_get_controls( ber, &ctrls );
if( rc != LDAP_SUCCESS ) {
- fprintf(stderr, "print_entry: %d\n", rc );
+ fprintf(stderr, _("print_entry: %d\n"), rc );
ldap_perror( ld, "ldap_get_entry_controls" );
exit( EXIT_FAILURE );
}
LDAPControl **ctrls;
if( ldif < 2 ) {
- printf("# search reference\n");
+ printf(_("# search reference\n"));
}
rc = ldap_parse_reference( ld, reference, &refs, &ctrls, 0 );
struct berval *retdata = NULL;
if( ldif < 2 ) {
- printf("# extended result response\n");
+ printf(_("# extended result response\n"));
}
rc = ldap_parse_extended_result( ld, extended,
LDAPControl **ctrls = NULL;
if( ldif < 2 ) {
- printf("# extended partial response\n");
+ printf(_("# extended partial response\n"));
}
rc = ldap_parse_extended_partial( ld, partial,
if( search ) {
if ( ldif < 2 ) {
- printf("# search result\n");
+ printf(_("# search result\n"));
}
if ( ldif < 1 ) {
- printf("%s: %d\n", "search", ldap_msgid(result) );
+ printf("%s: %d\n", _("search"), ldap_msgid(result) );
}
}
if( !ldif ) {
- printf( "result: %d %s\n", err, ldap_err2string(err) );
+ printf( _("result: %d %s\n"), err, ldap_err2string(err) );
} else if ( err != LDAP_SUCCESS ) {
fprintf( stderr, "%s (%d)\n", ldap_err2string(err), err );
write_ldif( LDIF_PUT_VALUE,
"matchedDN", matcheddn, strlen(matcheddn) );
} else {
- fprintf( stderr, "Matched DN: %s\n", matcheddn );
+ fprintf( stderr, _("Matched DN: %s\n"), matcheddn );
}
}
write_ldif( LDIF_PUT_TEXT, "text",
text, strlen(text) );
} else {
- fprintf( stderr, "Additional information: %s\n", text );
+ fprintf( stderr, _("Additional information: %s\n"), text );
}
}
if( !ldif ) {
write_ldif( LDIF_PUT_VALUE, "ref", refs[i], strlen(refs[i]) );
} else {
- fprintf( stderr, "Referral: %s\n", refs[i] );
+ fprintf( stderr, _("Referral: %s\n"), refs[i] );
}
}
ctrlp = *ctrl;
ber = ber_init( &ctrlp->ldctl_value );
if ( ber == NULL ) {
- fprintf( stderr, "Internal error.\n" );
+ fprintf( stderr, _("Internal error.\n") );
return EXIT_FAILURE;
}
if( tag == LBER_ERROR ) {
fprintf( stderr,
- "Paged results response control could not be decoded.\n" );
+ _("Paged results response control could not be decoded.\n") );
return EXIT_FAILURE;
}
if( entriesLeft < 0 ) {
fprintf( stderr,
- "Invalid entries estimate in paged results response.\n" );
+ _("Invalid entries estimate in paged results response.\n") );
return EXIT_FAILURE;
}
void
usage( void )
{
- fprintf(stderr,
-"Issue LDAP Who am I? operation to request user's authzid\n\n"
-"usage: %s [options]\n"
- , prog);
+ fprintf( stderr, _("Issue LDAP Who am I? operation to request user's authzid\n\n"));
+ fprintf( stderr, _("usage: %s [options]\n"), prog);
tool_common_usage();
exit( EXIT_FAILURE );
}
int crit;
case 'E': /* whoami controls */
if( protocol == LDAP_VERSION2 ) {
- fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+ fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
prog, protocol );
exit( EXIT_FAILURE );
}
if ( (cvalue = strchr( control, '=' )) != NULL ) {
*cvalue++ = '\0';
}
- fprintf( stderr, "Invalid whoami control name: %s\n", control );
+ fprintf( stderr, _("Invalid whoami control name: %s\n"), control );
usage();
#endif
char *retoid = NULL;
struct berval *retdata = NULL;
+ tool_init();
prog = lutil_progname( "ldapwhoami", argc, argv );
/* LDAPv3 only */
rc = lutil_get_filed_password( pw_file, &passwd );
if( rc ) return EXIT_FAILURE;
} else {
- passwd.bv_val = getpassphrase( "Enter LDAP Password: " );
+ passwd.bv_val = getpassphrase( _("Enter LDAP Password: ") );
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
}
}
if( retdata != NULL ) {
if( retdata->bv_len == 0 ) {
- printf("anonymous\n" );
+ printf(_("anonymous\n") );
} else {
printf("%s\n", retdata->bv_val );
}
}
if( verbose || ( rc != LDAP_SUCCESS ) || matcheddn || text || refs ) {
- printf( "Result: %s (%d)\n", ldap_err2string( rc ), rc );
+ printf( _("Result: %s (%d)\n"), ldap_err2string( rc ), rc );
if( text && *text ) {
- printf( "Additional info: %s\n", text );
+ printf( _("Additional info: %s\n"), text );
}
if( matcheddn && *matcheddn ) {
- printf( "Matched DN: %s\n", matcheddn );
+ printf( _("Matched DN: %s\n"), matcheddn );
}
if( refs ) {
int i;
for( i=0; refs[i]; i++ ) {
- printf("Referral: %s\n", refs[i] );
+ printf(_("Referral: %s\n"), refs[i] );
}
}
}