mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 15:49:34 -05:00
Mark translatable strings. Needs work.
This commit is contained in:
parent
547a68096c
commit
0dcd32372c
9 changed files with 300 additions and 301 deletions
|
|
@ -56,49 +56,57 @@ int version = 0;
|
||||||
/* Set in main() */
|
/* Set in main() */
|
||||||
char *prog = NULL;
|
char *prog = NULL;
|
||||||
|
|
||||||
|
void
|
||||||
|
tool_init( void )
|
||||||
|
{
|
||||||
|
setlocale(LC_MESSAGES,"");
|
||||||
|
bindtextdomain(OPENLDAP_PACKAGE, LDAP_LOCALEDIR);
|
||||||
|
textdomain(OPENLDAP_PACKAGE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tool_common_usage( void )
|
tool_common_usage( void )
|
||||||
{
|
{
|
||||||
static const char *const descriptions[] = {
|
static const char *const descriptions[] = {
|
||||||
" -c continuous operation mode (do not stop on errors)\n",
|
N_(" -c continuous operation mode (do not stop on errors)\n"),
|
||||||
" -C chase referrals\n",
|
N_(" -C chase referrals\n"),
|
||||||
" -d level set LDAP debugging level to `level'\n",
|
N_(" -d level set LDAP debugging level to `level'\n"),
|
||||||
" -D binddn bind DN\n",
|
N_(" -D binddn bind DN\n"),
|
||||||
" -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
|
N_(" -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n")
|
||||||
" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n"
|
N_(" [!]authzid=<authzid> (\"dn:<dn>\" or \"u:<user>\")\n")
|
||||||
" [!]manageDSAit (alternate form, see -M)\n"
|
N_(" [!]manageDSAit (alternate form, see -M)\n")
|
||||||
" [!]noop\n",
|
N_(" [!]noop\n"),
|
||||||
" -f file read operations from `file'\n",
|
N_(" -f file read operations from `file'\n"),
|
||||||
" -h host LDAP server\n",
|
N_(" -h host LDAP server\n"),
|
||||||
" -H URI LDAP Uniform Resource Indentifier(s)\n",
|
N_(" -H URI LDAP Uniform Resource Indentifier(s)\n"),
|
||||||
" -I use SASL Interactive mode\n",
|
N_(" -I use SASL Interactive mode\n"),
|
||||||
" -k use Kerberos authentication\n",
|
N_(" -k use Kerberos authentication\n"),
|
||||||
" -K like -k, but do only step 1 of the Kerberos bind\n",
|
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_(" -M enable Manage DSA IT control (-MM to make critical)\n"),
|
||||||
" -n show what would be done but don't actually do it\n",
|
N_(" -n show what would be done but don't actually do it\n"),
|
||||||
" -O props SASL security properties\n",
|
N_(" -O props SASL security properties\n"),
|
||||||
" -p port port on LDAP server\n",
|
N_(" -p port port on LDAP server\n"),
|
||||||
" -P version procotol version (default: 3)\n",
|
N_(" -P version procotol version (default: 3)\n"),
|
||||||
" -Q use SASL Quiet mode\n",
|
N_(" -Q use SASL Quiet mode\n"),
|
||||||
" -R realm SASL realm\n",
|
N_(" -R realm SASL realm\n"),
|
||||||
" -U authcid SASL authentication identity\n",
|
N_(" -U authcid SASL authentication identity\n"),
|
||||||
" -v run in verbose mode (diagnostics to standard output)\n",
|
N_(" -v run in verbose mode (diagnostics to standard output)\n"),
|
||||||
" -V print version info (-VV only)\n",
|
N_(" -V print version info (-VV only)\n"),
|
||||||
" -w passwd bind password (for simple authentication)\n",
|
N_(" -w passwd bind password (for simple authentication)\n"),
|
||||||
" -W prompt for bind password\n",
|
N_(" -W prompt for bind password\n"),
|
||||||
" -x Simple authentication\n",
|
N_(" -x Simple authentication\n"),
|
||||||
" -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n",
|
N_(" -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"),
|
||||||
" -y file Read password from file\n",
|
N_(" -y file Read password from file\n"),
|
||||||
" -Y mech SASL mechanism\n",
|
N_(" -Y mech SASL mechanism\n"),
|
||||||
" -Z Start TLS request (-ZZ to require successful response)\n",
|
N_(" -Z Start TLS request (-ZZ to require successful response)\n"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const char *const *cpp;
|
const char *const *cpp;
|
||||||
|
|
||||||
fputs( "Common options:\n", stderr );
|
fputs( _("Common options:\n"), stderr );
|
||||||
for( cpp = descriptions; *cpp != NULL; cpp++ ) {
|
for( cpp = descriptions; *cpp != NULL; cpp++ ) {
|
||||||
if( strchr( options, (*cpp)[3] ) ) {
|
if( strchr( options, (*cpp)[3] ) ) {
|
||||||
fputs( *cpp, stderr );
|
fputs( _(*cpp), stderr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
|
||||||
int handle_private_option LDAP_P(( int i ));
|
int handle_private_option LDAP_P(( int i ));
|
||||||
|
|
||||||
/* Defined in common.c */
|
/* Defined in common.c */
|
||||||
|
void tool_init LDAP_P(( void ));
|
||||||
void tool_common_usage LDAP_P(( void ));
|
void tool_common_usage LDAP_P(( void ));
|
||||||
void tool_args LDAP_P(( int, char ** ));
|
void tool_args LDAP_P(( int, char ** ));
|
||||||
LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
|
LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,15 @@ static int quiet = 0;
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr, _("usage: %s [options] DN <attr:value|attr::b64value>\n"), prog);
|
||||||
"usage: %s [options] DN <attr:value|attr::b64value>\n"
|
fprintf( stderr, _("where:\n"));
|
||||||
"where:\n"
|
fprintf( stderr, _(" DN\tDistinguished Name\n"));
|
||||||
" DN\tDistinguished Name\n"
|
fprintf( stderr, _(" attr\tassertion attribute\n"));
|
||||||
" attr\tassertion attribute\n"
|
fprintf( stderr, _(" value\tassertion value\n"));
|
||||||
" value\tassertion value\n"
|
fprintf( stderr, _(" b64value\tbase64 encoding of assertion value\n"));
|
||||||
" b64value\tbase64 encoding of assertion value\n"
|
|
||||||
|
|
||||||
"Compare options:\n"
|
fprintf( stderr, _("Compare options:\n"));
|
||||||
" -z Quiet mode, don't print anything, use return values\n"
|
fprintf( stderr, _(" -z Quiet mode, don't print anything, use return values\n"));
|
||||||
, prog );
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +76,7 @@ handle_private_option( int i )
|
||||||
int crit;
|
int crit;
|
||||||
case 'E': /* compare controls */
|
case 'E': /* compare controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +96,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
fprintf( stderr, "Invalid compare control name: %s\n", control );
|
fprintf( stderr, _("Invalid compare control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -122,6 +120,7 @@ main( int argc, char **argv )
|
||||||
LDAP *ld = NULL;
|
LDAP *ld = NULL;
|
||||||
struct berval bvalue = { 0, NULL };
|
struct berval bvalue = { 0, NULL };
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldapcompare", argc, argv );
|
prog = lutil_progname( "ldapcompare", argc, argv );
|
||||||
|
|
||||||
tool_args( argc, argv );
|
tool_args( argc, argv );
|
||||||
|
|
@ -153,7 +152,7 @@ main( int argc, char **argv )
|
||||||
bvalue.bv_val, strlen( &sep[1] ));
|
bvalue.bv_val, strlen( &sep[1] ));
|
||||||
|
|
||||||
if (bvalue.bv_len == (ber_len_t)-1) {
|
if (bvalue.bv_len == (ber_len_t)-1) {
|
||||||
fprintf(stderr, "base64 decode error\n");
|
fprintf(stderr, _("base64 decode error\n"));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +164,7 @@ main( int argc, char **argv )
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +175,7 @@ main( int argc, char **argv )
|
||||||
tool_server_controls( ld, NULL, 0 );
|
tool_server_controls( ld, NULL, 0 );
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
fprintf( stderr, "DN:%s, attr:%s, value:%s\n",
|
fprintf( stderr, _("DN:%s, attr:%s, value:%s\n"),
|
||||||
compdn, attrs, sep );
|
compdn, attrs, sep );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,10 +216,10 @@ static int docompare(
|
||||||
if ( !quiet ) {
|
if ( !quiet ) {
|
||||||
if ( rc == LDAP_COMPARE_TRUE ) {
|
if ( rc == LDAP_COMPARE_TRUE ) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
printf("TRUE\n");
|
printf(_("TRUE\n"));
|
||||||
} else if ( rc == LDAP_COMPARE_FALSE ) {
|
} else if ( rc == LDAP_COMPARE_FALSE ) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
printf("FALSE\n");
|
printf(_("FALSE\n"));
|
||||||
} else {
|
} else {
|
||||||
ldap_perror( ld, "ldap_compare" );
|
ldap_perror( ld, "ldap_compare" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,12 @@ static int deletechildren LDAP_P((
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr, _("Delete entries from an LDAP server\n\n"));
|
||||||
"Delete entries from an LDAP server\n\n"
|
fprintf( stderr, _("usage: %s [options] [dn]...\n"), prog);
|
||||||
"usage: %s [options] [dn]...\n"
|
fprintf( stderr, _(" dn: list of DNs to delete. If not given, it will be readed from stdin\n"));
|
||||||
" 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"));
|
||||||
" or from the file specified with \"-f file\".\n"
|
fprintf( stderr, _("Delete Options:\n"));
|
||||||
"Delete Options:\n"
|
fprintf( stderr, _(" -r delete recursively\n"));
|
||||||
" -r delete recursively\n"
|
|
||||||
, prog );
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +59,7 @@ handle_private_option( int i )
|
||||||
char *control, *cvalue;
|
char *control, *cvalue;
|
||||||
case 'E': /* delete controls */
|
case 'E': /* delete controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +79,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
fprintf( stderr, "Invalid delete control name: %s\n", control );
|
fprintf( stderr, _("Invalid delete control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -115,6 +113,7 @@ main( int argc, char **argv )
|
||||||
|
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldapdelete", argc, argv );
|
prog = lutil_progname( "ldapdelete", argc, argv );
|
||||||
|
|
||||||
tool_args( argc, argv );
|
tool_args( argc, argv );
|
||||||
|
|
@ -137,7 +136,7 @@ main( int argc, char **argv )
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,7 +186,7 @@ static int dodelete(
|
||||||
LDAPMessage *res;
|
LDAPMessage *res;
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "%sdeleting entry \"%s\"\n",
|
printf( _("%sdeleting entry \"%s\"\n"),
|
||||||
(not ? "!" : ""), dn );
|
(not ? "!" : ""), dn );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,20 +223,20 @@ static int dodelete(
|
||||||
if( verbose || code != LDAP_SUCCESS ||
|
if( verbose || code != LDAP_SUCCESS ||
|
||||||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
|
(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 ) {
|
if( text && *text ) {
|
||||||
printf( "Additional info: %s\n", text );
|
printf( _("Additional info: %s\n"), text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( matcheddn && *matcheddn ) {
|
if( matcheddn && *matcheddn ) {
|
||||||
printf( "Matched DN: %s\n", matcheddn );
|
printf( _("Matched DN: %s\n"), matcheddn );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refs ) {
|
if( refs ) {
|
||||||
int i;
|
int i;
|
||||||
for( i=0; refs[i]; i++ ) {
|
for( i=0; refs[i]; i++ ) {
|
||||||
printf("Referral: %s\n", refs[i] );
|
printf(_("Referral: %s\n"), refs[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -262,7 +261,7 @@ static int deletechildren(
|
||||||
int rc;
|
int rc;
|
||||||
static char *attrs[] = { "1.1", NULL };
|
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.
|
* Do a one level search at dn for children. For each, delete its children.
|
||||||
*/
|
*/
|
||||||
|
|
@ -299,7 +298,7 @@ static int deletechildren(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "\tremoving %s\n", dn );
|
printf( _("\tremoving %s\n"), dn );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ldap_delete_s( ld, dn );
|
rc = ldap_delete_s( ld, dn );
|
||||||
|
|
@ -311,7 +310,7 @@ static int deletechildren(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "\t%s removed\n", dn );
|
printf( _("\t%s removed\n"), dn );
|
||||||
}
|
}
|
||||||
|
|
||||||
ber_memfree( dn );
|
ber_memfree( dn );
|
||||||
|
|
|
||||||
|
|
@ -89,17 +89,15 @@ static char *read_one_record LDAP_P(( FILE *fp ));
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr, _("Add or modify entries from an LDAP server\n\n"));
|
||||||
"Add or modify entries from an LDAP server\n\n"
|
fprintf( stderr, _("usage: %s [options]\n"), prog);
|
||||||
"usage: %s [options]\n"
|
fprintf( stderr, _(" The list of desired operations are read from stdin or from the file\n"));
|
||||||
" The list of desired operations are read from stdin or from the file\n"
|
fprintf( stderr, _(" specified by \"-f file\".\n"));
|
||||||
" specified by \"-f file\".\n"
|
fprintf( stderr, _("Add or modify options:\n"));
|
||||||
"Add or modify options:\n"
|
fprintf( stderr, _(" -a add values (default%s)\n"), (ldapadd ? "" : _(" is to replace")));
|
||||||
" -a add values (default%s)\n"
|
fprintf( stderr, _(" -F force all changes records to be used\n"));
|
||||||
" -F force all changes records to be used\n"
|
fprintf( stderr, _(" -S file write skipped modifications to `file'\n"));
|
||||||
" -S file write skipped modifications to `file'\n"
|
tool_common_usage();
|
||||||
, prog, (ldapadd ? "" : " is to replace") );
|
|
||||||
tool_common_usage();
|
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,7 +114,7 @@ handle_private_option( int i )
|
||||||
int crit;
|
int crit;
|
||||||
case 'E': /* modify controls */
|
case 'E': /* modify controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +134,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
fprintf( stderr, "Invalid modify control name: %s\n", control );
|
fprintf( stderr, _("Invalid modify control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -153,7 +151,7 @@ handle_private_option( int i )
|
||||||
|
|
||||||
case 'S': /* skipped modifications to file */
|
case 'S': /* skipped modifications to file */
|
||||||
if( rejfile != NULL ) {
|
if( rejfile != NULL ) {
|
||||||
fprintf( stderr, "%s: -S previously specified\n", prog );
|
fprintf( stderr, _("%s: -S previously specified\n"), prog );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
rejfile = ber_strdup( optarg );
|
rejfile = ber_strdup( optarg );
|
||||||
|
|
@ -175,6 +173,7 @@ main( int argc, char **argv )
|
||||||
int rc, retval;
|
int rc, retval;
|
||||||
int count, len;
|
int count, len;
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldapmodify", argc, argv );
|
prog = lutil_progname( "ldapmodify", argc, argv );
|
||||||
|
|
||||||
/* strncmp instead of strcmp since NT binaries carry .exe extension */
|
/* strncmp instead of strcmp since NT binaries carry .exe extension */
|
||||||
|
|
@ -217,7 +216,7 @@ main( int argc, char **argv )
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -252,13 +251,13 @@ main( int argc, char **argv )
|
||||||
if ( rc )
|
if ( rc )
|
||||||
retval = rc;
|
retval = rc;
|
||||||
if ( rc && rejfp ) {
|
if ( rc && rejfp ) {
|
||||||
fprintf(rejfp, "# Error: %s (%d)", ldap_err2string(rc), rc);
|
fprintf(rejfp, _("# Error: %s (%d)"), ldap_err2string(rc), rc);
|
||||||
|
|
||||||
matched_msg = NULL;
|
matched_msg = NULL;
|
||||||
ldap_get_option(ld, LDAP_OPT_MATCHED_DN, &matched_msg);
|
ldap_get_option(ld, LDAP_OPT_MATCHED_DN, &matched_msg);
|
||||||
if ( matched_msg != NULL ) {
|
if ( matched_msg != NULL ) {
|
||||||
if ( *matched_msg != '\0' )
|
if ( *matched_msg != '\0' )
|
||||||
fprintf( rejfp, ", matched DN: %s", matched_msg );
|
fprintf( rejfp, _(", matched DN: %s"), matched_msg );
|
||||||
ldap_memfree( matched_msg );
|
ldap_memfree( matched_msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,7 +265,7 @@ main( int argc, char **argv )
|
||||||
ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg);
|
ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &error_msg);
|
||||||
if ( error_msg != NULL ) {
|
if ( error_msg != NULL ) {
|
||||||
if ( *error_msg != '\0' )
|
if ( *error_msg != '\0' )
|
||||||
fprintf( rejfp, ", additional info: %s", error_msg );
|
fprintf( rejfp, _(", additional info: %s"), error_msg );
|
||||||
ldap_memfree( error_msg );
|
ldap_memfree( error_msg );
|
||||||
}
|
}
|
||||||
fprintf( rejfp, "\n%s\n", rejbuf );
|
fprintf( rejfp, "\n%s\n", rejbuf );
|
||||||
|
|
@ -324,7 +323,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ldif_parse_line( line, &type, &val.bv_val, &val.bv_len ) < 0 ) {
|
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 );
|
prog, linenum, dn == NULL ? "" : dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
break;
|
break;
|
||||||
|
|
@ -347,7 +346,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
strcasecmp( type, T_VERSION_STR ) == 0 )
|
strcasecmp( type, T_VERSION_STR ) == 0 )
|
||||||
{
|
{
|
||||||
if( val.bv_len == 0 || atoi(val.bv_val) != 1 ) {
|
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 );
|
prog, val.bv_val, linenum );
|
||||||
}
|
}
|
||||||
version++;
|
version++;
|
||||||
|
|
@ -369,7 +368,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
/* Parse and add it to the list of controls */
|
/* Parse and add it to the list of controls */
|
||||||
rc = parse_ldif_control( line, &pctrls );
|
rc = parse_ldif_control( line, &pctrls );
|
||||||
if (rc != 0) {
|
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) );
|
prog, T_CONTROL_STR, linenum, ldap_err2string(rc) );
|
||||||
}
|
}
|
||||||
goto end_line;
|
goto end_line;
|
||||||
|
|
@ -377,9 +376,8 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
|
|
||||||
expect_ct = 0;
|
expect_ct = 0;
|
||||||
if ( !use_record && saw_replica ) {
|
if ( !use_record && saw_replica ) {
|
||||||
printf( "%s: skipping change record for entry: %s\n"
|
printf(_("%s: skipping change record for entry: %s\n"), prog, dn);
|
||||||
"\t(LDAP host/port does not match replica: lines)\n",
|
printf(_("\t(LDAP host/port does not match replica: lines)\n"));
|
||||||
prog, dn );
|
|
||||||
free( dn );
|
free( dn );
|
||||||
ber_memfree( type );
|
ber_memfree( type );
|
||||||
ber_memfree( val.bv_val );
|
ber_memfree( val.bv_val );
|
||||||
|
|
@ -398,7 +396,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ++icnt != val.bv_len ) {
|
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 );
|
prog, T_CHANGETYPESTR, val.bv_val, linenum, dn );
|
||||||
val.bv_val[icnt] = '\0';
|
val.bv_val[icnt] = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -418,7 +416,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
got_all = delete_entry = 1;
|
got_all = delete_entry = 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr,
|
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 );
|
prog, T_CHANGETYPESTR, val.bv_val, linenum, dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +441,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ++icnt != val.bv_len ) {
|
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 );
|
prog, type, val.bv_val, linenum, dn );
|
||||||
val.bv_val[icnt] = '\0';
|
val.bv_val[icnt] = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -476,7 +474,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
expect_deleteoldrdn = 1;
|
expect_deleteoldrdn = 1;
|
||||||
expect_newrdn = 0;
|
expect_newrdn = 0;
|
||||||
} else {
|
} 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 );
|
prog, T_NEWRDNSTR, type, linenum, dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -487,7 +485,7 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
expect_newsup = 1;
|
expect_newsup = 1;
|
||||||
got_all = 1;
|
got_all = 1;
|
||||||
} else {
|
} 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 );
|
prog, T_DELETEOLDRDNSTR, type, linenum, dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -499,13 +497,13 @@ process_ldif_rec( char *rbuf, int count )
|
||||||
}
|
}
|
||||||
expect_newsup = 0;
|
expect_newsup = 0;
|
||||||
} else {
|
} 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 );
|
prog, T_NEWSUPSTR, type, linenum, dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
} else if ( got_all ) {
|
} else if ( got_all ) {
|
||||||
fprintf( stderr,
|
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 );
|
prog, linenum, dn );
|
||||||
rc = LDAP_PARAM_ERROR;
|
rc = LDAP_PARAM_ERROR;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -811,7 +809,7 @@ domodify(
|
||||||
struct berval *bvp;
|
struct berval *bvp;
|
||||||
|
|
||||||
if ( pmods == NULL ) {
|
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 );
|
prog, dn );
|
||||||
return( LDAP_PARAM_ERROR );
|
return( LDAP_PARAM_ERROR );
|
||||||
}
|
}
|
||||||
|
|
@ -820,7 +818,7 @@ domodify(
|
||||||
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
|
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
|
||||||
if( op == LDAP_MOD_ADD && ( pmods[i]->mod_bvalues == NULL )) {
|
if( op == LDAP_MOD_ADD && ( pmods[i]->mod_bvalues == NULL )) {
|
||||||
fprintf( stderr,
|
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 );
|
prog, pmods[i]->mod_type, dn );
|
||||||
return LDAP_PARAM_ERROR;
|
return LDAP_PARAM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -830,8 +828,8 @@ domodify(
|
||||||
for ( i = 0; pmods[ i ] != NULL; ++i ) {
|
for ( i = 0; pmods[ i ] != NULL; ++i ) {
|
||||||
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
|
op = pmods[ i ]->mod_op & ~LDAP_MOD_BVALUES;
|
||||||
printf( "%s %s:\n", op == LDAP_MOD_REPLACE ?
|
printf( "%s %s:\n", op == LDAP_MOD_REPLACE ?
|
||||||
"replace" : op == LDAP_MOD_ADD ?
|
_("replace") : op == LDAP_MOD_ADD ?
|
||||||
"add" : "delete", pmods[ i ]->mod_type );
|
_("add") : _("delete"), pmods[ i ]->mod_type );
|
||||||
if ( pmods[ i ]->mod_bvalues != NULL ) {
|
if ( pmods[ i ]->mod_bvalues != NULL ) {
|
||||||
for ( j = 0; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) {
|
for ( j = 0; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) {
|
||||||
bvp = pmods[ i ]->mod_bvalues[ j ];
|
bvp = pmods[ i ]->mod_bvalues[ j ];
|
||||||
|
|
@ -843,7 +841,7 @@ domodify(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( notascii ) {
|
if ( notascii ) {
|
||||||
printf( "\tNOT ASCII (%ld bytes)\n", bvp->bv_len );
|
printf( _("\tNOT ASCII (%ld bytes)\n"), bvp->bv_len );
|
||||||
} else {
|
} else {
|
||||||
printf( "\t%s\n", bvp->bv_val );
|
printf( "\t%s\n", bvp->bv_val );
|
||||||
}
|
}
|
||||||
|
|
@ -866,10 +864,10 @@ domodify(
|
||||||
}
|
}
|
||||||
if ( i != LDAP_SUCCESS ) {
|
if ( i != LDAP_SUCCESS ) {
|
||||||
/* print error message about failed update including DN */
|
/* 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" );
|
ldap_perror( ld, newentry ? "ldap_add" : "ldap_modify" );
|
||||||
} else if ( verbose ) {
|
} else if ( verbose ) {
|
||||||
printf( "modify complete\n" );
|
printf( _("modify complete\n") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
i = LDAP_SUCCESS;
|
i = LDAP_SUCCESS;
|
||||||
|
|
@ -888,13 +886,13 @@ dodelete(
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
printf( "%sdeleting entry \"%s\"\n", not ? "!" : "", dn );
|
printf( _("%sdeleting entry \"%s\"\n"), not ? "!" : "", dn );
|
||||||
if ( !not ) {
|
if ( !not ) {
|
||||||
if (( rc = ldap_delete_ext_s( ld, dn, pctrls, NULL )) != LDAP_SUCCESS ) {
|
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" );
|
ldap_perror( ld, "ldap_delete" );
|
||||||
} else if ( verbose ) {
|
} else if ( verbose ) {
|
||||||
printf( "delete complete" );
|
printf( _("delete complete") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = LDAP_SUCCESS;
|
rc = LDAP_SUCCESS;
|
||||||
|
|
@ -917,18 +915,18 @@ dorename(
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
printf( "%smodifying rdn of entry \"%s\"\n", not ? "!" : "", dn );
|
printf( _("%smodifying rdn of entry \"%s\"\n"), not ? "!" : "", dn );
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "\tnew RDN: \"%s\" (%skeep existing values)\n",
|
printf( _("\tnew RDN: \"%s\" (%skeep existing values)\n"),
|
||||||
newrdn, deleteoldrdn ? "do not " : "" );
|
newrdn, deleteoldrdn ? _("do not ") : "" );
|
||||||
}
|
}
|
||||||
if ( !not ) {
|
if ( !not ) {
|
||||||
if (( rc = ldap_rename_s( ld, dn, newrdn, newsup, deleteoldrdn, pctrls, NULL ))
|
if (( rc = ldap_rename_s( ld, dn, newrdn, newsup, deleteoldrdn, pctrls, NULL ))
|
||||||
!= LDAP_SUCCESS ) {
|
!= 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" );
|
ldap_perror( ld, "ldap_modrdn" );
|
||||||
} else {
|
} else {
|
||||||
printf( "modrdn completed\n" );
|
printf( _("modrdn completed\n") );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = LDAP_SUCCESS;
|
rc = LDAP_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,14 @@ static int domodrdn(
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr, _("Rename LDAP entries\n\n"));
|
||||||
"Rename LDAP entries\n\n"
|
fprintf( stderr, _("usage: %s [options] [dn rdn]\n"), prog);
|
||||||
"usage: %s [options] [dn rdn]\n"
|
fprintf( stderr, _(" dn rdn: If given, rdn will replace the RDN of the entry specified by DN\n"));
|
||||||
" 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"));
|
||||||
" 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"));
|
||||||
" from the file specified by \"-f file\" (see man page).\n"
|
fprintf( stderr, _("Rename options:\n"));
|
||||||
"Rename options:\n"
|
fprintf( stderr, _(" -r remove old RDN\n"));
|
||||||
" -r remove old RDN\n"
|
fprintf( stderr, _(" -s newsup new superior entry\n"));
|
||||||
" -s newsup new superior entry\n"
|
|
||||||
, prog );
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +74,7 @@ handle_private_option( int i )
|
||||||
char *control, *cvalue;
|
char *control, *cvalue;
|
||||||
case 'E': /* modrdn controls */
|
case 'E': /* modrdn controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, version );
|
prog, version );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +94,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
fprintf( stderr, "Invalid modrdn control name: %s\n", control );
|
fprintf( stderr, _("Invalid modrdn control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -106,7 +104,7 @@ handle_private_option( int i )
|
||||||
|
|
||||||
case 's': /* newSuperior */
|
case 's': /* newSuperior */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -X incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -X incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -129,6 +127,7 @@ main(int argc, char **argv)
|
||||||
LDAP *ld;
|
LDAP *ld;
|
||||||
int rc, retval, havedn;
|
int rc, retval, havedn;
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldapmodrdn", argc, argv );
|
prog = lutil_progname( "ldapmodrdn", argc, argv );
|
||||||
|
|
||||||
tool_args( argc, argv );
|
tool_args( argc, argv );
|
||||||
|
|
@ -145,8 +144,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
++havedn;
|
++havedn;
|
||||||
} else if ( argc - optind != 0 ) {
|
} else if ( argc - optind != 0 ) {
|
||||||
fprintf( stderr, "%s: invalid number of arguments (%d), "
|
fprintf( stderr, _("%s: invalid number of arguments (%d), only two allowed\n"), prog, argc-optind );
|
||||||
"only two allowed\n", prog, argc-optind );
|
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +164,7 @@ main(int argc, char **argv)
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,11 +217,11 @@ static int domodrdn(
|
||||||
LDAPMessage *res;
|
LDAPMessage *res;
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf( "Renaming \"%s\"\n", dn );
|
printf( _("Renaming \"%s\"\n"), dn );
|
||||||
printf( "\tnew rdn=\"%s\" (%s old rdn)\n",
|
printf( _("\tnew rdn=\"%s\" (%s old rdn)\n"),
|
||||||
rdn, remove ? "delete" : "keep" );
|
rdn, remove ? _("delete") : _("keep") );
|
||||||
if( newSuperior != NULL ) {
|
if( newSuperior != NULL ) {
|
||||||
printf("\tnew parent=\"%s\"\n", newSuperior);
|
printf(_("\tnew parent=\"%s\"\n"), newSuperior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,21 +253,21 @@ static int domodrdn(
|
||||||
if( verbose || code != LDAP_SUCCESS ||
|
if( verbose || code != LDAP_SUCCESS ||
|
||||||
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
|
(matcheddn && *matcheddn) || (text && *text) || (refs && *refs) )
|
||||||
{
|
{
|
||||||
printf( "Rename Result: %s (%d)\n",
|
printf( _("Rename Result: %s (%d)\n"),
|
||||||
ldap_err2string( code ), code );
|
ldap_err2string( code ), code );
|
||||||
|
|
||||||
if( text && *text ) {
|
if( text && *text ) {
|
||||||
printf( "Additional info: %s\n", text );
|
printf( _("Additional info: %s\n"), text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( matcheddn && *matcheddn ) {
|
if( matcheddn && *matcheddn ) {
|
||||||
printf( "Matched DN: %s\n", matcheddn );
|
printf( _("Matched DN: %s\n"), matcheddn );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refs ) {
|
if( refs ) {
|
||||||
int i;
|
int i;
|
||||||
for( i=0; refs[i]; i++ ) {
|
for( i=0; refs[i]; i++ ) {
|
||||||
printf("Referral: %s\n", refs[i] );
|
printf(_("Referral: %s\n"), refs[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,18 +36,16 @@ static char *newpwfile = NULL;
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf( stderr, _("Change password of an LDAP user\n\n"));
|
||||||
"Change password of an LDAP user\n\n"
|
fprintf( stderr,_("usage: %s [options] [user]\n"), prog);
|
||||||
"usage: %s [options] [user]\n"
|
fprintf( stderr, _(" user: the autentication identity, commonly a DN\n"));
|
||||||
" user: the autentication identity, commonly a DN\n"
|
fprintf( stderr, _("Password change options:\n"));
|
||||||
"Password change options:\n"
|
fprintf( stderr, _(" -a secret old password\n"));
|
||||||
" -a secret old password\n"
|
fprintf( stderr, _(" -A prompt for old password\n"));
|
||||||
" -A prompt for old password\n"
|
fprintf( stderr, _(" -t file read file for old password\n"));
|
||||||
" -t file read file for old password\n"
|
fprintf( stderr, _(" -s secret new password\n"));
|
||||||
" -s secret new password\n"
|
fprintf( stderr, _(" -S prompt for new password\n"));
|
||||||
" -S prompt for new password\n"
|
fprintf( stderr, _(" -T file read file for new password\n"));
|
||||||
" -T file read file for new password\n"
|
|
||||||
, prog );
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +63,7 @@ handle_private_option( int i )
|
||||||
int crit;
|
int crit;
|
||||||
char *control, *cvalue;
|
char *control, *cvalue;
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -85,8 +83,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
|
fprintf( stderr, _("Invalid passwd control name: %s\n"), control );
|
||||||
fprintf( stderr, "Invalid passwd control name: %s\n", control );
|
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -152,6 +149,7 @@ main( int argc, char *argv[] )
|
||||||
char *retoid = NULL;
|
char *retoid = NULL;
|
||||||
struct berval *retdata = NULL;
|
struct berval *retdata = NULL;
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldappasswd", argc, argv );
|
prog = lutil_progname( "ldappasswd", argc, argv );
|
||||||
|
|
||||||
/* LDAPv3 only */
|
/* LDAPv3 only */
|
||||||
|
|
@ -175,13 +173,13 @@ main( int argc, char *argv[] )
|
||||||
if( want_oldpw && oldpw.bv_val == NULL ) {
|
if( want_oldpw && oldpw.bv_val == NULL ) {
|
||||||
/* prompt for old password */
|
/* prompt for old password */
|
||||||
char *ckoldpw;
|
char *ckoldpw;
|
||||||
oldpw.bv_val = strdup(getpassphrase("Old password: "));
|
oldpw.bv_val = strdup(getpassphrase(_("Old password: ")));
|
||||||
ckoldpw = getpassphrase("Re-enter old password: ");
|
ckoldpw = getpassphrase(_("Re-enter old password: "));
|
||||||
|
|
||||||
if( oldpw.bv_val == NULL || ckoldpw == NULL ||
|
if( oldpw.bv_val == NULL || ckoldpw == NULL ||
|
||||||
strcmp( oldpw.bv_val, ckoldpw ))
|
strcmp( oldpw.bv_val, ckoldpw ))
|
||||||
{
|
{
|
||||||
fprintf( stderr, "passwords do not match\n" );
|
fprintf( stderr, _("passwords do not match\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,13 +194,13 @@ main( int argc, char *argv[] )
|
||||||
if( want_newpw && newpw.bv_val == NULL ) {
|
if( want_newpw && newpw.bv_val == NULL ) {
|
||||||
/* prompt for new password */
|
/* prompt for new password */
|
||||||
char *cknewpw;
|
char *cknewpw;
|
||||||
newpw.bv_val = strdup(getpassphrase("New password: "));
|
newpw.bv_val = strdup(getpassphrase(_("New password: ")));
|
||||||
cknewpw = getpassphrase("Re-enter new password: ");
|
cknewpw = getpassphrase(_("Re-enter new password: "));
|
||||||
|
|
||||||
if( newpw.bv_val == NULL || cknewpw == NULL ||
|
if( newpw.bv_val == NULL || cknewpw == NULL ||
|
||||||
strcmp( newpw.bv_val, cknewpw ))
|
strcmp( newpw.bv_val, cknewpw ))
|
||||||
{
|
{
|
||||||
fprintf( stderr, "passwords do not match\n" );
|
fprintf( stderr, _("passwords do not match\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +209,7 @@ main( int argc, char *argv[] )
|
||||||
|
|
||||||
if( want_bindpw && passwd.bv_val == NULL ) {
|
if( want_bindpw && passwd.bv_val == NULL ) {
|
||||||
/* handle bind password */
|
/* 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,7 +316,7 @@ main( int argc, char *argv[] )
|
||||||
if( tag == LBER_ERROR ) {
|
if( tag == LBER_ERROR ) {
|
||||||
perror( "ber_scanf" );
|
perror( "ber_scanf" );
|
||||||
} else {
|
} else {
|
||||||
printf("New password: %s\n", s);
|
printf(_("New password: %s\n"), s);
|
||||||
free( s );
|
free( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,20 +324,20 @@ main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( verbose || code != LDAP_SUCCESS || matcheddn || text || refs ) {
|
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 ) {
|
if( text && *text ) {
|
||||||
printf( "Additional info: %s\n", text );
|
printf( _("Additional info: %s\n"), text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( matcheddn && *matcheddn ) {
|
if( matcheddn && *matcheddn ) {
|
||||||
printf( "Matched DN: %s\n", matcheddn );
|
printf( _("Matched DN: %s\n"), matcheddn );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refs ) {
|
if( refs ) {
|
||||||
int i;
|
int i;
|
||||||
for( i=0; refs[i]; i++ ) {
|
for( i=0; refs[i]; i++ ) {
|
||||||
printf("Referral: %s\n", refs[i] );
|
printf(_("Referral: %s\n"), refs[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,55 +50,54 @@ static char *def_urlpre;
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf( stderr,
|
fprintf( stderr, _("usage: %s [options] [filter [attributes...]]\nwhere:\n"), prog);
|
||||||
"usage: %s [options] [filter [attributes...]]\nwhere:\n"
|
fprintf( stderr, _(" filter\tRFC-2254 compliant LDAP search filter\n"));
|
||||||
" filter\tRFC-2254 compliant LDAP search filter\n"
|
fprintf( stderr, _(" attributes\twhitespace-separated list of attribute descriptions\n"));
|
||||||
" attributes\twhitespace-separated list of attribute descriptions\n"
|
fprintf( stderr, _(" which may include:\n"));
|
||||||
" which may include:\n"
|
fprintf( stderr, _(" 1.1 no attributes\n"));
|
||||||
" 1.1 no attributes\n"
|
fprintf( stderr, _(" * all user attributes\n"));
|
||||||
" * all user attributes\n"
|
fprintf( stderr, _(" + all operational attributes\n"));
|
||||||
" + all operational attributes\n"
|
|
||||||
|
|
||||||
"Search options:\n"
|
|
||||||
" -a deref one of never (default), always, search, or find\n"
|
fprintf( stderr, _("Search options:\n"));
|
||||||
" -A retrieve attribute names only (no values)\n"
|
fprintf( stderr, _(" -a deref one of never (default), always, search, or find\n"));
|
||||||
" -b basedn base dn for search\n"
|
fprintf( stderr, _(" -A retrieve attribute names only (no values)\n"));
|
||||||
" -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\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
|
#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
|
||||||
" [!]domainScope (domain scope)\n"
|
fprintf( stderr, _(" [!]domainScope (domain scope)\n"));
|
||||||
#endif
|
#endif
|
||||||
" [!]mv=<filter> (matched values filter)\n"
|
fprintf( stderr, _(" [!]mv=<filter> (matched values filter)\n"));
|
||||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||||
" [!]pr=<size> (paged results)\n"
|
fprintf( stderr, _(" [!]pr=<size> (paged results)\n"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef LDAP_CONTROL_SUBENTRIES
|
#ifdef LDAP_CONTROL_SUBENTRIES
|
||||||
" [!]subentries[=true|false] (subentries)\n"
|
fprintf( stderr, _(" [!]subentries[=true|false] (subentries)\n"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef LDAP_CLIENT_UPDATE
|
#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"
|
* " s/<cint>/<cookie> (LDAP client update)\n"
|
||||||
* " sp/<cint>/<cookie>/<slimit>\n"
|
* " sp/<cint>/<cookie>/<slimit>\n"
|
||||||
* */
|
* */
|
||||||
#endif
|
#endif
|
||||||
#ifdef LDAP_SYNC
|
#ifdef LDAP_SYNC
|
||||||
" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"
|
fprintf( stderr, _(" [!]sync=ro[/<cookie>] (LDAP Sync refreshOnly)\n"));
|
||||||
" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"
|
fprintf( stderr, _(" rp[/<cookie>][/<slimit>] (LDAP Sync refreshAndPersist)\n"));
|
||||||
#endif
|
#endif
|
||||||
" -F prefix URL prefix for files (default: %s)\n"
|
fprintf( stderr, _(" -F prefix URL prefix for files (default: %s)\n"), def_urlpre);
|
||||||
" -l limit time limit (in seconds) for search\n"
|
fprintf( stderr, _(" -l limit time limit (in seconds) for search\n"));
|
||||||
" -L print responses in LDIFv1 format\n"
|
fprintf( stderr, _(" -L print responses in LDIFv1 format\n"));
|
||||||
" -LL print responses in LDIF format without comments\n"
|
fprintf( stderr, _(" -LL print responses in LDIF format without comments\n"));
|
||||||
" -LLL print responses in LDIF format without comments\n"
|
fprintf( stderr, _(" -LLL print responses in LDIF format without comments\n"));
|
||||||
" and version\n"
|
fprintf( stderr, _(" and version\n"));
|
||||||
" -s scope one of base, one, or sub (search scope)\n"
|
fprintf( stderr, _(" -s scope one of base, one, or sub (search scope)\n"));
|
||||||
" -S attr sort the results by attribute `attr'\n"
|
fprintf( stderr, _(" -S attr sort the results by attribute `attr'\n"));
|
||||||
" -t write binary values to files in temporary directory\n"
|
fprintf( stderr, _(" -t write binary values to files in temporary directory\n"));
|
||||||
" -tt write all values to files in temporary directory\n"
|
fprintf( stderr, _(" -tt write all values to files in temporary directory\n"));
|
||||||
" -T path write files to directory specified by path (default: %s)\n"
|
fprintf( stderr, _(" -T path write files to directory specified by path (default: %s)\n"), def_tmpdir);
|
||||||
" -u include User Friendly entry names in the output\n"
|
fprintf( stderr, _(" -u include User Friendly entry names in the output\n"));
|
||||||
" -z limit size limit (in entries) for search\n"
|
fprintf( stderr, _(" -z limit size limit (in entries) for search\n"));
|
||||||
, prog, def_urlpre, def_tmpdir );
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +226,7 @@ handle_private_option( int i )
|
||||||
} else if ( strcasecmp( optarg, "always" ) == 0 ) {
|
} else if ( strcasecmp( optarg, "always" ) == 0 ) {
|
||||||
deref = LDAP_DEREF_ALWAYS;
|
deref = LDAP_DEREF_ALWAYS;
|
||||||
} else {
|
} 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();
|
usage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -239,7 +238,7 @@ handle_private_option( int i )
|
||||||
break;
|
break;
|
||||||
case 'E': /* search controls */
|
case 'E': /* search controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -263,14 +262,14 @@ handle_private_option( int i )
|
||||||
if ( strcasecmp( control, "mv" ) == 0 ) {
|
if ( strcasecmp( control, "mv" ) == 0 ) {
|
||||||
/* ValuesReturnFilter control */
|
/* ValuesReturnFilter control */
|
||||||
if( valuesReturnFilter ) {
|
if( valuesReturnFilter ) {
|
||||||
fprintf( stderr, "ValuesReturnFilter previously specified\n");
|
fprintf( stderr, _("ValuesReturnFilter previously specified\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
valuesReturnFilter= 1 + crit;
|
valuesReturnFilter= 1 + crit;
|
||||||
|
|
||||||
if ( cvalue == NULL ) {
|
if ( cvalue == NULL ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"missing filter in ValuesReturnFilter control\n");
|
_("missing filter in ValuesReturnFilter control\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,13 +281,13 @@ handle_private_option( int i )
|
||||||
int num, tmp;
|
int num, tmp;
|
||||||
/* PagedResults control */
|
/* PagedResults control */
|
||||||
if ( pagedResults != 0 ) {
|
if ( pagedResults != 0 ) {
|
||||||
fprintf( stderr, "PagedResultsControl previously specified\n" );
|
fprintf( stderr, _("PagedResultsControl previously specified\n") );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
num = sscanf( cvalue, "%d", &tmp );
|
num = sscanf( cvalue, "%d", &tmp );
|
||||||
if ( num != 1 ) {
|
if ( num != 1 ) {
|
||||||
fprintf( stderr, "Invalid value for PagedResultsControl, %s.\n", cvalue);
|
fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), cvalue);
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -300,12 +299,12 @@ handle_private_option( int i )
|
||||||
} else if ( strcasecmp( control, "domainScope" ) == 0 ) {
|
} else if ( strcasecmp( control, "domainScope" ) == 0 ) {
|
||||||
if( domainScope ) {
|
if( domainScope ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"domainScope control previously specified\n");
|
_("domainScope control previously specified\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if( cvalue != NULL ) {
|
if( cvalue != NULL ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"domainScope: no control value expected\n" );
|
_("domainScope: no control value expected\n") );
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,7 +313,7 @@ handle_private_option( int i )
|
||||||
#ifdef LDAP_CONTROL_SUBENTRIES
|
#ifdef LDAP_CONTROL_SUBENTRIES
|
||||||
} else if ( strcasecmp( control, "subentries" ) == 0 ) {
|
} else if ( strcasecmp( control, "subentries" ) == 0 ) {
|
||||||
if( subentries ) {
|
if( subentries ) {
|
||||||
fprintf( stderr, "subentries control previously specified\n");
|
fprintf( stderr, _("subentries control previously specified\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if( cvalue == NULL || strcasecmp( cvalue, "true") == 0 ) {
|
if( cvalue == NULL || strcasecmp( cvalue, "true") == 0 ) {
|
||||||
|
|
@ -323,7 +322,7 @@ handle_private_option( int i )
|
||||||
subentries = 1;
|
subentries = 1;
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"subentries control value \"%s\" invalid\n",
|
_("subentries control value \"%s\" invalid\n"),
|
||||||
cvalue );
|
cvalue );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -335,16 +334,16 @@ handle_private_option( int i )
|
||||||
char *cookiep;
|
char *cookiep;
|
||||||
char *slimitp;
|
char *slimitp;
|
||||||
if ( lcup ) {
|
if ( lcup ) {
|
||||||
fprintf( stderr, "client update control previously specified\n");
|
fprintf( stderr, _("client update control previously specified\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( ldapsync != -1 ) {
|
if ( ldapsync != -1 ) {
|
||||||
fprintf( stderr, "ldap sync control previously specified\n");
|
fprintf( stderr, _("ldap sync control previously specified\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( cvalue == NULL ) {
|
if ( cvalue == NULL ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"missing specification of client update control\n");
|
_("missing specification of client update control\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( strncasecmp( cvalue, "p", 1 ) == 0 ) {
|
if ( strncasecmp( cvalue, "p", 1 ) == 0 ) {
|
||||||
|
|
@ -382,7 +381,7 @@ handle_private_option( int i )
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"client update control value \"%s\" invalid\n",
|
_("client update control value \"%s\" invalid\n"),
|
||||||
cvalue );
|
cvalue );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -394,16 +393,16 @@ handle_private_option( int i )
|
||||||
char *cookiep;
|
char *cookiep;
|
||||||
char *slimitp;
|
char *slimitp;
|
||||||
if ( ldapsync ) {
|
if ( ldapsync ) {
|
||||||
fprintf( stderr, "ldap sync control previously specified\n" );
|
fprintf( stderr, _("ldap sync control previously specified\n") );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( lcup ) {
|
if ( lcup ) {
|
||||||
fprintf( stderr, "client update control previously specified\n" );
|
fprintf( stderr, _("client update control previously specified\n") );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( cvalue == NULL ) {
|
if ( cvalue == NULL ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"missing specification of ldap sync control\n");
|
_("missing specification of ldap sync control\n"));
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if ( strncasecmp( cvalue, "ro", 2 ) == 0 ) {
|
if ( strncasecmp( cvalue, "ro", 2 ) == 0 ) {
|
||||||
|
|
@ -432,7 +431,7 @@ handle_private_option( int i )
|
||||||
sync_slimit = atoi( slimitp );
|
sync_slimit = atoi( slimitp );
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"ldap sync control value \"%s\" invalid\n",
|
_("ldap sync control value \"%s\" invalid\n"),
|
||||||
cvalue );
|
cvalue );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -440,7 +439,7 @@ handle_private_option( int i )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "Invalid control name: %s\n", control );
|
fprintf( stderr, _("Invalid control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -451,7 +450,7 @@ handle_private_option( int i )
|
||||||
case 'l': /* time limit */
|
case 'l': /* time limit */
|
||||||
timelimit = atoi( optarg );
|
timelimit = atoi( optarg );
|
||||||
if( timelimit < 0 ) {
|
if( timelimit < 0 ) {
|
||||||
fprintf( stderr, "%s: invalid timelimit (%d) specified\n",
|
fprintf( stderr, _("%s: invalid timelimit (%d) specified\n"),
|
||||||
prog, timelimit );
|
prog, timelimit );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -467,7 +466,7 @@ handle_private_option( int i )
|
||||||
} else if ( strncasecmp( optarg, "sub", sizeof("sub")-1 ) == 0 ) {
|
} else if ( strncasecmp( optarg, "sub", sizeof("sub")-1 ) == 0 ) {
|
||||||
scope = LDAP_SCOPE_SUBTREE;
|
scope = LDAP_SCOPE_SUBTREE;
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "scope should be base, one, or sub\n" );
|
fprintf( stderr, _("scope should be base, one, or sub\n") );
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -500,19 +499,19 @@ private_conn_setup( LDAP *ld )
|
||||||
if (deref != -1 &&
|
if (deref != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_DEREF, (void *) &deref ) != LDAP_OPT_SUCCESS )
|
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 );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if (timelimit != -1 &&
|
if (timelimit != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) != LDAP_OPT_SUCCESS )
|
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 );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
if (sizelimit != -1 &&
|
if (sizelimit != -1 &&
|
||||||
ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) != LDAP_OPT_SUCCESS )
|
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 );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -536,6 +535,8 @@ main( int argc, char **argv )
|
||||||
struct berval *syncbvalp = NULL;
|
struct berval *syncbvalp = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tool_init();
|
||||||
|
|
||||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||||
npagedresponses = npagedentries = npagedreferences =
|
npagedresponses = npagedentries = npagedreferences =
|
||||||
npagedextended = npagedpartial = 0;
|
npagedextended = npagedpartial = 0;
|
||||||
|
|
@ -622,7 +623,7 @@ main( int argc, char **argv )
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -667,7 +668,7 @@ getNextPage:
|
||||||
err = ber_printf( seber, "{b}", abs(subentries) == 1 ? 0 : 1 );
|
err = ber_printf( seber, "{b}", abs(subentries) == 1 ? 0 : 1 );
|
||||||
if ( err == -1 ) {
|
if ( err == -1 ) {
|
||||||
ber_free( seber, 1 );
|
ber_free( seber, 1 );
|
||||||
fprintf( stderr, "Subentries control encoding error!\n" );
|
fprintf( stderr, _("Subentries control encoding error!\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -696,7 +697,7 @@ getNextPage:
|
||||||
|
|
||||||
if ( err == LBER_ERROR ) {
|
if ( err == LBER_ERROR ) {
|
||||||
ber_free( cuber, 1 );
|
ber_free( cuber, 1 );
|
||||||
fprintf( stderr, "client update control encoding error!\n" );
|
fprintf( stderr, _("client update control encoding error!\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -726,7 +727,7 @@ getNextPage:
|
||||||
|
|
||||||
if ( err == LBER_ERROR ) {
|
if ( err == LBER_ERROR ) {
|
||||||
ber_free( syncber, 1 );
|
ber_free( syncber, 1 );
|
||||||
fprintf( stderr, "ldap sync control encoding error!\n" );
|
fprintf( stderr, _("ldap sync control encoding error!\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,7 +749,7 @@ getNextPage:
|
||||||
|
|
||||||
if ( ( err = ldap_put_vrFilter( vrber, vrFilter ) ) == -1 ) {
|
if ( ( err = ldap_put_vrFilter( vrber, vrFilter ) ) == -1 ) {
|
||||||
ber_free( vrber, 1 );
|
ber_free( vrber, 1 );
|
||||||
fprintf( stderr, "Bad ValuesReturnFilter: %s\n", vrFilter );
|
fprintf( stderr, _("Bad ValuesReturnFilter: %s\n"), vrFilter );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -786,12 +787,12 @@ getNextPage:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
fprintf( stderr, "filter%s: %s\nrequesting: ",
|
fprintf( stderr, _("filter%s: %s\nrequesting: "),
|
||||||
infile != NULL ? " pattern" : "",
|
infile != NULL ? _(" pattern") : "",
|
||||||
filtpattern );
|
filtpattern );
|
||||||
|
|
||||||
if ( attrs == NULL ) {
|
if ( attrs == NULL ) {
|
||||||
fprintf( stderr, "ALL" );
|
fprintf( stderr, _("ALL") );
|
||||||
} else {
|
} else {
|
||||||
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
||||||
fprintf( stderr, "%s ", attrs[ i ] );
|
fprintf( stderr, "%s ", attrs[ i ] );
|
||||||
|
|
@ -801,25 +802,23 @@ getNextPage:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ldif == 0 ) {
|
if ( ldif == 0 ) {
|
||||||
printf( "# extended LDIF\n" );
|
printf( _("# extended LDIF\n") );
|
||||||
} else if ( ldif < 3 ) {
|
} else if ( ldif < 3 ) {
|
||||||
printf( "version: %d\n\n", 1 );
|
printf( _("version: %d\n\n"), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ldif < 2 ) {
|
if (ldif < 2 ) {
|
||||||
printf( "#\n"
|
printf( "#\n" );
|
||||||
"# LDAPv%d\n"
|
printf(_("# LDAPv%d\n"), protocol);
|
||||||
"# base <%s> with scope %s\n"
|
printf(_("# base <%s> with scope %s\n"),
|
||||||
"# filter%s: %s\n"
|
|
||||||
"# requesting: ",
|
|
||||||
protocol,
|
|
||||||
base ? base : "", (scope == LDAP_SCOPE_BASE) ? "base"
|
base ? base : "", (scope == LDAP_SCOPE_BASE) ? "base"
|
||||||
: ((scope == LDAP_SCOPE_ONELEVEL) ? "one" : "sub"),
|
: ((scope == LDAP_SCOPE_ONELEVEL) ? "one" : "sub"));
|
||||||
infile != NULL ? " pattern" : "",
|
printf(_("# filter%s: %s\n"), infile != NULL ? _(" pattern") : "",
|
||||||
filtpattern );
|
filtpattern);
|
||||||
|
printf(_("# requesting: "));
|
||||||
|
|
||||||
if ( attrs == NULL ) {
|
if ( attrs == NULL ) {
|
||||||
printf( "ALL" );
|
printf( _("ALL") );
|
||||||
} else {
|
} else {
|
||||||
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
for ( i = 0; attrs[ i ] != NULL; ++i ) {
|
||||||
printf( "%s ", attrs[ i ] );
|
printf( "%s ", attrs[ i ] );
|
||||||
|
|
@ -827,31 +826,31 @@ getNextPage:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( manageDSAit ) {
|
if ( manageDSAit ) {
|
||||||
printf("\n# with manageDSAit %scontrol",
|
printf(_("\n# with manageDSAit %scontrol"),
|
||||||
manageDSAit > 1 ? "critical " : "" );
|
manageDSAit > 1 ? _("critical ") : "" );
|
||||||
}
|
}
|
||||||
if ( noop ) {
|
if ( noop ) {
|
||||||
printf("\n# with noop %scontrol",
|
printf(_("\n# with noop %scontrol"),
|
||||||
noop > 1 ? "critical " : "" );
|
noop > 1 ? _("critical ") : "" );
|
||||||
}
|
}
|
||||||
if ( subentries ) {
|
if ( subentries ) {
|
||||||
printf("\n# with subentries %scontrol: %s",
|
printf(_("\n# with subentries %scontrol: %s"),
|
||||||
subentries < 0 ? "critical " : "",
|
subentries < 0 ? _("critical ") : "",
|
||||||
abs(subentries) == 1 ? "false" : "true" );
|
abs(subentries) == 1 ? "false" : "true" );
|
||||||
}
|
}
|
||||||
if ( valuesReturnFilter ) {
|
if ( valuesReturnFilter ) {
|
||||||
printf("\n# with valuesReturnFilter %scontrol: %s",
|
printf(_("\n# with valuesReturnFilter %scontrol: %s"),
|
||||||
valuesReturnFilter > 1 ? "critical " : "", vrFilter );
|
valuesReturnFilter > 1 ? _("critical ") : "", vrFilter );
|
||||||
}
|
}
|
||||||
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
#ifdef LDAP_CONTROL_PAGEDRESULTS
|
||||||
if ( pageSize ) {
|
if ( pageSize ) {
|
||||||
printf("\n# with pagedResults %scontrol: size=%d",
|
printf(_("\n# with pagedResults %scontrol: size=%d"),
|
||||||
(pagedResults > 1) ? "critical " : "",
|
(pagedResults > 1) ? _("critical ") : "",
|
||||||
pageSize );
|
pageSize );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf( "\n#\n\n" );
|
printf( _("\n#\n\n") );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( infile == NULL ) {
|
if ( infile == NULL ) {
|
||||||
|
|
@ -885,9 +884,9 @@ getNextPage:
|
||||||
* enter is pressed on the terminal.
|
* enter is pressed on the terminal.
|
||||||
*/
|
*/
|
||||||
if ( entriesLeft > 0 ) {
|
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 );
|
(int)pageSize );
|
||||||
i = 0;
|
i = 0;
|
||||||
moreEntries = getchar();
|
moreEntries = getchar();
|
||||||
|
|
@ -903,7 +902,7 @@ getNextPage:
|
||||||
if ( i > 0 && isdigit( (unsigned char)buf[0] ) ) {
|
if ( i > 0 && isdigit( (unsigned char)buf[0] ) ) {
|
||||||
int num = sscanf( buf, "%d", &tmpSize );
|
int num = sscanf( buf, "%d", &tmpSize );
|
||||||
if ( num != 1 ) {
|
if ( num != 1 ) {
|
||||||
fprintf( stderr, "Invalid value for PagedResultsControl, %s.\n", buf);
|
fprintf( stderr, _("Invalid value for PagedResultsControl, %s.\n"), buf);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -960,11 +959,11 @@ static int dosearch(
|
||||||
sprintf( filter, filtpatt, value );
|
sprintf( filter, filtpatt, value );
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
fprintf( stderr, "filter: %s\n", filter );
|
fprintf( stderr, _("filter: %s\n"), filter );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ldif < 2 ) {
|
if( ldif < 2 ) {
|
||||||
printf( "#\n# filter: %s\n#\n", filter );
|
printf( _("#\n# filter: %s\n#\n"), filter );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -983,7 +982,7 @@ static int dosearch(
|
||||||
}
|
}
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
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 );
|
prog, ldap_err2string( rc ), rc );
|
||||||
return( rc );
|
return( rc );
|
||||||
}
|
}
|
||||||
|
|
@ -1034,8 +1033,8 @@ static int dosearch(
|
||||||
#ifdef LDAP_SYNC
|
#ifdef LDAP_SYNC
|
||||||
if ( cancel_msgid != -1 &&
|
if ( cancel_msgid != -1 &&
|
||||||
cancel_msgid == ldap_msgid( msg ) ) {
|
cancel_msgid == ldap_msgid( msg ) ) {
|
||||||
printf("Cancelled \n");
|
printf(_("Cancelled \n"));
|
||||||
printf("cancel_msgid = %d\n", cancel_msgid);
|
printf(_("cancel_msgid = %d\n"), cancel_msgid);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1078,12 +1077,12 @@ static int dosearch(
|
||||||
nresponses_psearch = 0;
|
nresponses_psearch = 0;
|
||||||
|
|
||||||
if ( strcmp( retoid, LDAP_SYNC_INFO ) ) {
|
if ( strcmp( retoid, LDAP_SYNC_INFO ) ) {
|
||||||
printf("Unexpected Intermediate Response\n");
|
printf(_("Unexpected Intermediate Response\n"));
|
||||||
ldap_memfree( retoid );
|
ldap_memfree( retoid );
|
||||||
ber_bvfree( retdata );
|
ber_bvfree( retdata );
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
printf("SyncInfo Received\n");
|
printf(_("SyncInfo Received\n"));
|
||||||
ldap_memfree( retoid );
|
ldap_memfree( retoid );
|
||||||
ber_bvfree( retdata );
|
ber_bvfree( retdata );
|
||||||
break;
|
break;
|
||||||
|
|
@ -1131,20 +1130,20 @@ done:
|
||||||
npagedextended = npagedextended + nextended;
|
npagedextended = npagedextended + nextended;
|
||||||
npagedpartial = npagedpartial + npartial;
|
npagedpartial = npagedpartial + npartial;
|
||||||
if ( ( morePagedResults == 0 ) && ( ldif < 2 ) ) {
|
if ( ( morePagedResults == 0 ) && ( ldif < 2 ) ) {
|
||||||
printf( "\n# numResponses: %d\n", npagedresponses );
|
printf( _("\n# numResponses: %d\n"), npagedresponses );
|
||||||
if( nentries ) printf( "# numEntries: %d\n", npagedentries );
|
if( nentries ) printf( _("# numEntries: %d\n"), npagedentries );
|
||||||
if( nextended ) printf( "# numExtended: %d\n", npagedextended );
|
if( nextended ) printf( _("# numExtended: %d\n"), npagedextended );
|
||||||
if( npartial ) printf( "# numPartial: %d\n", npagedpartial );
|
if( npartial ) printf( _("# numPartial: %d\n"), npagedpartial );
|
||||||
if( nreferences ) printf( "# numReferences: %d\n", npagedreferences );
|
if( nreferences ) printf( _("# numReferences: %d\n"), npagedreferences );
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if ( ldif < 2 ) {
|
if ( ldif < 2 ) {
|
||||||
printf( "\n# numResponses: %d\n", nresponses );
|
printf( _("\n# numResponses: %d\n"), nresponses );
|
||||||
if( nentries ) printf( "# numEntries: %d\n", nentries );
|
if( nentries ) printf( _("# numEntries: %d\n"), nentries );
|
||||||
if( nextended ) printf( "# numExtended: %d\n", nextended );
|
if( nextended ) printf( _("# numExtended: %d\n"), nextended );
|
||||||
if( npartial ) printf( "# numPartial: %d\n", npartial );
|
if( npartial ) printf( _("# numPartial: %d\n"), npartial );
|
||||||
if( nreferences ) printf( "# numReferences: %d\n", nreferences );
|
if( nreferences ) printf( _("# numReferences: %d\n"), nreferences );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( rc );
|
return( rc );
|
||||||
|
|
@ -1179,7 +1178,7 @@ print_entry(
|
||||||
rc = ldap_get_entry_controls( ld, entry, &ctrls );
|
rc = ldap_get_entry_controls( ld, entry, &ctrls );
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
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" );
|
ldap_perror( ld, "ldap_get_entry_controls" );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -1289,7 +1288,7 @@ print_entry(
|
||||||
rc = ldap_int_get_controls( ber, &ctrls );
|
rc = ldap_int_get_controls( ber, &ctrls );
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
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" );
|
ldap_perror( ld, "ldap_get_entry_controls" );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -1383,7 +1382,7 @@ static void print_reference(
|
||||||
LDAPControl **ctrls;
|
LDAPControl **ctrls;
|
||||||
|
|
||||||
if( ldif < 2 ) {
|
if( ldif < 2 ) {
|
||||||
printf("# search reference\n");
|
printf(_("# search reference\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ldap_parse_reference( ld, reference, &refs, &ctrls, 0 );
|
rc = ldap_parse_reference( ld, reference, &refs, &ctrls, 0 );
|
||||||
|
|
@ -1417,7 +1416,7 @@ static void print_extended(
|
||||||
struct berval *retdata = NULL;
|
struct berval *retdata = NULL;
|
||||||
|
|
||||||
if( ldif < 2 ) {
|
if( ldif < 2 ) {
|
||||||
printf("# extended result response\n");
|
printf(_("# extended result response\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ldap_parse_extended_result( ld, extended,
|
rc = ldap_parse_extended_result( ld, extended,
|
||||||
|
|
@ -1455,7 +1454,7 @@ static void print_partial(
|
||||||
LDAPControl **ctrls = NULL;
|
LDAPControl **ctrls = NULL;
|
||||||
|
|
||||||
if( ldif < 2 ) {
|
if( ldif < 2 ) {
|
||||||
printf("# extended partial response\n");
|
printf(_("# extended partial response\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ldap_parse_extended_partial( ld, partial,
|
rc = ldap_parse_extended_partial( ld, partial,
|
||||||
|
|
@ -1501,10 +1500,10 @@ static int print_result(
|
||||||
|
|
||||||
if( search ) {
|
if( search ) {
|
||||||
if ( ldif < 2 ) {
|
if ( ldif < 2 ) {
|
||||||
printf("# search result\n");
|
printf(_("# search result\n"));
|
||||||
}
|
}
|
||||||
if ( ldif < 1 ) {
|
if ( ldif < 1 ) {
|
||||||
printf("%s: %d\n", "search", ldap_msgid(result) );
|
printf("%s: %d\n", _("search"), ldap_msgid(result) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1518,7 +1517,7 @@ static int print_result(
|
||||||
|
|
||||||
|
|
||||||
if( !ldif ) {
|
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 ) {
|
} else if ( err != LDAP_SUCCESS ) {
|
||||||
fprintf( stderr, "%s (%d)\n", ldap_err2string(err), err );
|
fprintf( stderr, "%s (%d)\n", ldap_err2string(err), err );
|
||||||
|
|
@ -1530,7 +1529,7 @@ static int print_result(
|
||||||
write_ldif( LDIF_PUT_VALUE,
|
write_ldif( LDIF_PUT_VALUE,
|
||||||
"matchedDN", matcheddn, strlen(matcheddn) );
|
"matchedDN", matcheddn, strlen(matcheddn) );
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "Matched DN: %s\n", matcheddn );
|
fprintf( stderr, _("Matched DN: %s\n"), matcheddn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1543,7 +1542,7 @@ static int print_result(
|
||||||
write_ldif( LDIF_PUT_TEXT, "text",
|
write_ldif( LDIF_PUT_TEXT, "text",
|
||||||
text, strlen(text) );
|
text, strlen(text) );
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "Additional information: %s\n", text );
|
fprintf( stderr, _("Additional information: %s\n"), text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1556,7 +1555,7 @@ static int print_result(
|
||||||
if( !ldif ) {
|
if( !ldif ) {
|
||||||
write_ldif( LDIF_PUT_VALUE, "ref", refs[i], strlen(refs[i]) );
|
write_ldif( LDIF_PUT_VALUE, "ref", refs[i], strlen(refs[i]) );
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "Referral: %s\n", refs[i] );
|
fprintf( stderr, _("Referral: %s\n"), refs[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1684,7 +1683,7 @@ parse_page_control(
|
||||||
ctrlp = *ctrl;
|
ctrlp = *ctrl;
|
||||||
ber = ber_init( &ctrlp->ldctl_value );
|
ber = ber_init( &ctrlp->ldctl_value );
|
||||||
if ( ber == NULL ) {
|
if ( ber == NULL ) {
|
||||||
fprintf( stderr, "Internal error.\n" );
|
fprintf( stderr, _("Internal error.\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1694,13 +1693,13 @@ parse_page_control(
|
||||||
|
|
||||||
if( tag == LBER_ERROR ) {
|
if( tag == LBER_ERROR ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"Paged results response control could not be decoded.\n" );
|
_("Paged results response control could not be decoded.\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( entriesLeft < 0 ) {
|
if( entriesLeft < 0 ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"Invalid entries estimate in paged results response.\n" );
|
_("Invalid entries estimate in paged results response.\n") );
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,8 @@
|
||||||
void
|
void
|
||||||
usage( void )
|
usage( void )
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf( stderr, _("Issue LDAP Who am I? operation to request user's authzid\n\n"));
|
||||||
"Issue LDAP Who am I? operation to request user's authzid\n\n"
|
fprintf( stderr, _("usage: %s [options]\n"), prog);
|
||||||
"usage: %s [options]\n"
|
|
||||||
, prog);
|
|
||||||
tool_common_usage();
|
tool_common_usage();
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +46,7 @@ handle_private_option( int i )
|
||||||
int crit;
|
int crit;
|
||||||
case 'E': /* whoami controls */
|
case 'E': /* whoami controls */
|
||||||
if( protocol == LDAP_VERSION2 ) {
|
if( protocol == LDAP_VERSION2 ) {
|
||||||
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
|
fprintf( stderr, _("%s: -E incompatible with LDAPv%d\n"),
|
||||||
prog, protocol );
|
prog, protocol );
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +66,7 @@ handle_private_option( int i )
|
||||||
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
if ( (cvalue = strchr( control, '=' )) != NULL ) {
|
||||||
*cvalue++ = '\0';
|
*cvalue++ = '\0';
|
||||||
}
|
}
|
||||||
fprintf( stderr, "Invalid whoami control name: %s\n", control );
|
fprintf( stderr, _("Invalid whoami control name: %s\n"), control );
|
||||||
usage();
|
usage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -91,6 +89,7 @@ main( int argc, char *argv[] )
|
||||||
char *retoid = NULL;
|
char *retoid = NULL;
|
||||||
struct berval *retdata = NULL;
|
struct berval *retdata = NULL;
|
||||||
|
|
||||||
|
tool_init();
|
||||||
prog = lutil_progname( "ldapwhoami", argc, argv );
|
prog = lutil_progname( "ldapwhoami", argc, argv );
|
||||||
|
|
||||||
/* LDAPv3 only */
|
/* LDAPv3 only */
|
||||||
|
|
@ -111,7 +110,7 @@ main( int argc, char *argv[] )
|
||||||
rc = lutil_get_filed_password( pw_file, &passwd );
|
rc = lutil_get_filed_password( pw_file, &passwd );
|
||||||
if( rc ) return EXIT_FAILURE;
|
if( rc ) return EXIT_FAILURE;
|
||||||
} else {
|
} 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;
|
passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -132,27 +131,27 @@ main( int argc, char *argv[] )
|
||||||
|
|
||||||
if( retdata != NULL ) {
|
if( retdata != NULL ) {
|
||||||
if( retdata->bv_len == 0 ) {
|
if( retdata->bv_len == 0 ) {
|
||||||
printf("anonymous\n" );
|
printf(_("anonymous\n") );
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", retdata->bv_val );
|
printf("%s\n", retdata->bv_val );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( verbose || ( rc != LDAP_SUCCESS ) || matcheddn || text || refs ) {
|
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 ) {
|
if( text && *text ) {
|
||||||
printf( "Additional info: %s\n", text );
|
printf( _("Additional info: %s\n"), text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( matcheddn && *matcheddn ) {
|
if( matcheddn && *matcheddn ) {
|
||||||
printf( "Matched DN: %s\n", matcheddn );
|
printf( _("Matched DN: %s\n"), matcheddn );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refs ) {
|
if( refs ) {
|
||||||
int i;
|
int i;
|
||||||
for( i=0; refs[i]; i++ ) {
|
for( i=0; refs[i]; i++ ) {
|
||||||
printf("Referral: %s\n", refs[i] );
|
printf(_("Referral: %s\n"), refs[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue