* Various Cyrus SASL related stuff.
*/
-#define SASL_MAX_BUFF_SIZE 65536
-#define SASL_MIN_BUFF_SIZE 4096
-
int ldap_int_sasl_init( void )
{
/* XXX not threadsafe */
tmp = *((long *)buf);
size = ntohl( tmp );
+ /* we really should check against actual buffer size set
+ * in the secopts.
+ */
if ( size > SASL_MAX_BUFF_SIZE ) {
/* somebody is trying to mess me up. */
ber_log_printf( LDAP_DEBUG_ANY, debuglevel,
"sb_sasl_pkt_length: received illegal packet length "
"of %lu bytes\n", (unsigned long)size );
size = 16; /* this should lead to an error. */
-}
+ }
return size + 4; /* include the size !!! */
}
return LDAP_NOT_SUPPORTED;
}
+ if( maxbufsize > SASL_MAX_BUFF_SIZE ) {
+ return LDAP_PARAM_ERROR;
+ }
+
} else {
return LDAP_NOT_SUPPORTED;
}
gopts->ldo_def_sasl_authcid = NULL;
gopts->ldo_def_sasl_authzid = NULL;
- memset( &gopts->ldo_sasl_secprops, '\0', sizeof(gopts->ldo_sasl_secprops) );
+ memset( &gopts->ldo_sasl_secprops,
+ '\0', sizeof(gopts->ldo_sasl_secprops) );
gopts->ldo_sasl_secprops.max_ssf = INT_MAX;
- gopts->ldo_sasl_secprops.maxbufsize = 65536;
- gopts->ldo_sasl_secprops.security_flags = SASL_SEC_NOPLAINTEXT|SASL_SEC_NOANONYMOUS;
+ gopts->ldo_sasl_secprops.maxbufsize = SASL_MAX_BUFF_SIZE;
+ gopts->ldo_sasl_secprops.security_flags =
+ SASL_SEC_NOPLAINTEXT | SASL_SEC_NOANONYMOUS;
#endif
#ifdef HAVE_TLS