Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
0dcd3237
Commit
0dcd3237
authored
Apr 06, 2003
by
Kurt Zeilenga
Browse files
Mark translatable strings. Needs work.
parent
547a6809
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
clients/tools/common.c
View file @
0dcd3237
...
...
@@ -56,49 +56,57 @@ int version = 0;
/* 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
);
}
}
}
...
...
clients/tools/common.h
View file @
0dcd3237
...
...
@@ -52,6 +52,7 @@ void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
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
*
)
));
...
...
clients/tools/ldapcompare.c
View file @
0dcd3237
...
...
@@ -41,17 +41,15 @@ static int quiet = 0;
void
usage
(
void
)
{
fprintf
(
stderr
,
"usage: %s [options] DN <attr:value|attr::b64value>
\n
"
"where:
\n
"
" DN
\t
Distinguished Name
\n
"
" attr
\t
assertion attribute
\n
"
" value
\t
assertion value
\n
"
" b64value
\t
base64 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
\t
Distinguished Name
\n
"
));
fprintf
(
stderr
,
_
(
" attr
\t
assertion attribute
\n
"
));
fprintf
(
stderr
,
_
(
" value
\t
assertion value
\n
"
));
fprintf
(
stderr
,
_
(
" b64value
\t
base64 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
);
}
...
...
@@ -78,7 +76,7 @@ handle_private_option( int i )
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 );
}
...
...
@@ -98,7 +96,7 @@ handle_private_option( int i )
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
...
...
@@ -122,6 +120,7 @@ main( int argc, char **argv )
LDAP
*
ld
=
NULL
;
struct
berval
bvalue
=
{
0
,
NULL
};
tool_init
();
prog
=
lutil_progname
(
"ldapcompare"
,
argc
,
argv
);
tool_args
(
argc
,
argv
);
...
...
@@ -153,7 +152,7 @@ main( int argc, char **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
);
}
}
...
...
@@ -165,7 +164,7 @@ main( int argc, char **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
;
}
}
...
...
@@ -176,7 +175,7 @@ main( int argc, char **argv )
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
);
}
...
...
@@ -217,10 +216,10 @@ static int docompare(
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"
);
}
...
...
clients/tools/ldapdelete.c
View file @
0dcd3237
...
...
@@ -36,14 +36,12 @@ static int deletechildren LDAP_P((
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
);
}
...
...
@@ -61,7 +59,7 @@ handle_private_option( int i )
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 );
}
...
...
@@ -81,7 +79,7 @@ handle_private_option( int i )
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
...
...
@@ -115,6 +113,7 @@ main( int argc, char **argv )
fp
=
NULL
;
tool_init
();
prog
=
lutil_progname
(
"ldapdelete"
,
argc
,
argv
);
tool_args
(
argc
,
argv
);
...
...
@@ -137,7 +136,7 @@ main( int argc, char **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
;
}
}
...
...
@@ -187,7 +186,7 @@ static int dodelete(
LDAPMessage
*
res
;
if
(
verbose
)
{
printf
(
"%sdeleting entry
\"
%s
\"\n
"
,
printf
(
_
(
"%sdeleting entry
\"
%s
\"\n
"
)
,
(
not
?
"!"
:
""
),
dn
);
}
...
...
@@ -224,20 +223,20 @@ static int dodelete(
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
]
);
}
}
}
...
...
@@ -262,7 +261,7 @@ static int deletechildren(
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.
*/
...
...
@@ -299,7 +298,7 @@ static int deletechildren(
}
if
(
verbose
)
{
printf
(
"
\t
removing %s
\n
"
,
dn
);
printf
(
_
(
"
\t
removing %s
\n
"
)
,
dn
);
}
rc
=
ldap_delete_s
(
ld
,
dn
);
...
...
@@ -311,7 +310,7 @@ static int deletechildren(
}
if
(
verbose
)
{
printf
(
"
\t
%s removed
\n
"
,
dn
);
printf
(
_
(
"
\t
%s removed
\n
"
)
,
dn
);
}
ber_memfree
(
dn
);
...
...
clients/tools/ldapmodify.c
View file @
0dcd3237
...
...
@@ -89,17 +89,15 @@ static char *read_one_record LDAP_P(( FILE *fp ));
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
);
}
...
...
@@ -116,7 +114,7 @@ handle_private_option( int i )
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 );
}
...
...
@@ -136,7 +134,7 @@ handle_private_option( int i )
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
...
...
@@ -153,7 +151,7 @@ handle_private_option( int i )
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
);
...
...
@@ -175,6 +173,7 @@ main( int argc, char **argv )
int
rc
,
retval
;
int
count
,
len
;
tool_init
();
prog
=
lutil_progname
(
"ldapmodify"
,
argc
,
argv
);
/* 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
);
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
;
}
}
...
...
@@ -252,13 +251,13 @@ main( int argc, char **argv )
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
);
}
...
...
@@ -266,7 +265,7 @@ main( int argc, char **argv )
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
);
...
...
@@ -324,7 +323,7 @@ process_ldif_rec( char *rbuf, int count )
}
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
;
...
...
@@ -347,7 +346,7 @@ process_ldif_rec( char *rbuf, int count )
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
++
;
...
...
@@ -369,7 +368,7 @@ process_ldif_rec( char *rbuf, int count )
/* 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
;
...
...
@@ -377,9 +376,8 @@ process_ldif_rec( char *rbuf, int count )
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
);
...
...
@@ -398,7 +396,7 @@ process_ldif_rec( char *rbuf, int count )
}
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'
;
}
...
...
@@ -418,7 +416,7 @@ process_ldif_rec( char *rbuf, int count )
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
;
}
...
...
@@ -443,7 +441,7 @@ process_ldif_rec( char *rbuf, int count )
}
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'
;
}
...
...
@@ -476,7 +474,7 @@ process_ldif_rec( char *rbuf, int count )
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
;
}
...
...
@@ -487,7 +485,7 @@ process_ldif_rec( char *rbuf, int count )
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
;
}
...
...
@@ -499,13 +497,13 @@ process_ldif_rec( char *rbuf, int count )
}
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
{
...
...
@@ -811,7 +809,7 @@ domodify(
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
);
}
...
...
@@ -820,7 +818,7 @@ domodify(
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
;
}
...
...
@@ -830,8 +828,8 @@ domodify(
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
];
...
...
@@ -843,7 +841,7 @@ domodify(
}
}
if
(
notascii
)
{
printf
(
"
\t
NOT ASCII (%ld bytes)
\n
"
,
bvp
->
bv_len
);
printf
(
_
(
"
\t
NOT ASCII (%ld bytes)
\n
"
)
,
bvp
->
bv_len
);
}
else
{
printf
(
"
\t
%s
\n
"
,
bvp
->
bv_val
);
}
...
...
@@ -866,10 +864,10 @@ domodify(
}
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
;
...
...
@@ -888,13 +886,13 @@ dodelete(
{
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
;
...
...
@@ -917,18 +915,18 @@ dorename(
int
rc
;
printf
(
"%smodifying rdn of entry
\"
%s
\"\n
"
,
not
?
"!"
:
""
,
dn
);
printf
(
_
(
"%smodifying rdn of entry
\"
%s
\"\n
"
)
,
not
?
"!"
:
""
,
dn
);
if
(
verbose
)
{
printf
(
"
\t
new RDN:
\"
%s
\"
(%skeep existing values)
\n
"
,
newrdn
,
deleteoldrdn
?
"do not "
:
""
);
printf
(
_
(
"
\t
new 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
;
...
...
clients/tools/ldapmodrdn.c
View file @
0dcd3237
...
...
@@ -49,16 +49,14 @@ static int domodrdn(
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
);
}
...
...
@@ -76,7 +74,7 @@ handle_private_option( int i )
char *control, *cvalue;
case 'E': /* modrdn controls */
if( protocol == LDAP_VERSION2 ) {
fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",