mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-18 15:20:35 +08:00
Add LDAP_MAXINT macro
Add additional error checks Fix a few typos and cleanup
This commit is contained in:
parent
671e3c7651
commit
0b3f8c2303
@ -438,20 +438,18 @@ handle_private_option( int i )
|
||||
timelimit = 0;
|
||||
|
||||
} else if ( strcasecmp( optarg, "max" ) == 0 ) {
|
||||
/* RFC 2251:
|
||||
maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
|
||||
*/
|
||||
timelimit = 2147483647;
|
||||
timelimit = LDAP_MAXINT;
|
||||
|
||||
} else {
|
||||
ival = strtol( optarg, &next, 10 );
|
||||
if ( next == NULL || next[0] != '\0' ) {
|
||||
fprintf( stderr, _("Unable to parse time limit \"%s\"\n"), optarg );
|
||||
fprintf( stderr,
|
||||
_("Unable to parse time limit \"%s\"\n"), optarg );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
timelimit = ival;
|
||||
}
|
||||
if( timelimit < 0 ) {
|
||||
if( timelimit < 0 || timelimit > LDAP_MAXINT ) {
|
||||
fprintf( stderr, _("%s: invalid timelimit (%d) specified\n"),
|
||||
prog, timelimit );
|
||||
exit( EXIT_FAILURE );
|
||||
@ -496,22 +494,20 @@ handle_private_option( int i )
|
||||
sizelimit = 0;
|
||||
|
||||
} else if ( strcasecmp( optarg, "max" ) == 0 ) {
|
||||
/* RFC 2251:
|
||||
maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
|
||||
*/
|
||||
sizelimit = 2147483647;
|
||||
sizelimit = LDAP_MAXINT;
|
||||
|
||||
} else {
|
||||
ival = strtol( optarg, &next, 10 );
|
||||
if ( next == NULL || next[0] != '\0' ) {
|
||||
fprintf( stderr, _("Unable to parse size limit \"%s\"\n"), optarg );
|
||||
fprintf( stderr,
|
||||
_("Unable to parse size limit \"%s\"\n"), optarg );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
sizelimit = ival;
|
||||
}
|
||||
if( sizelimit < 0 ) {
|
||||
if( sizelimit < 0 || sizelimit > LDAP_MAXINT ) {
|
||||
fprintf( stderr, _("%s: invalid sizelimit (%d) specified\n"),
|
||||
prog, timelimit );
|
||||
prog, sizelimit );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
break;
|
||||
|
@ -76,6 +76,9 @@ LDAP_BEGIN_DECL
|
||||
#define LDAP_ALL_USER_ATTRIBUTES "*"
|
||||
#define LDAP_ALL_OPERATIONAL_ATTRIBUTES "+" /* RFC 3673 */
|
||||
|
||||
/* RFC 2251: maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */
|
||||
#define LDAP_MAXINT (2147483647)
|
||||
|
||||
/*
|
||||
* LDAP_OPTions
|
||||
* 0x0000 - 0x0fff reserved for api options
|
||||
|
Loading…
x
Reference in New Issue
Block a user