Skip to content
Snippets Groups Projects
Commit d8dc230a authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Fix a limit typo

Use 0 not maxint when 'none' is selected.
parent 763f8c76
No related branches found
No related tags found
No related merge requests found
......@@ -429,8 +429,7 @@ handle_private_option( int i )
break;
case 'l': /* time limit */
if ( strcasecmp( optarg, "none" ) == 0 ) {
/* maxInt as per RFC 4.1.1. Message Envelope */
sizelimit = 2147483647;
timelimit = 0;
} else {
timelimit = atoi( optarg );
}
......@@ -476,11 +475,15 @@ handle_private_option( int i )
break;
case 'z': /* size limit */
if ( strcasecmp( optarg, "none" ) == 0 ) {
/* maxInt as per RFC 4.1.1. Message Envelope */
sizelimit = 2147483647;
sizelimit = 0;
} else {
sizelimit = atoi( optarg );
}
if( sizelimit < 0 ) {
fprintf( stderr, _("%s: invalid sizelimit (%d) specified\n"),
prog, timelimit );
exit( EXIT_FAILURE );
}
break;
default:
return 0;
......@@ -499,7 +502,7 @@ private_conn_setup( LDAP *ld )
fprintf( stderr, _("Could not set LDAP_OPT_DEREF %d\n"), deref );
exit( EXIT_FAILURE );
}
if (timelimit != -1 &&
if (timelimit > 0 &&
ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit )
!= LDAP_OPT_SUCCESS )
{
......@@ -507,7 +510,7 @@ private_conn_setup( LDAP *ld )
_("Could not set LDAP_OPT_TIMELIMIT %d\n"), timelimit );
exit( EXIT_FAILURE );
}
if (sizelimit != -1 &&
if (sizelimit > 0 &&
ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit )
!= LDAP_OPT_SUCCESS )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment