[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
SLP registration bug (ITS#1087)
Full_Name: Monty Charlton
Version: CVS HEAD
OS: Linux (Caldera OpenLinux)
URL: http://fullmonty.org/dl/openldap-cvs-slp.patch
Submission from: (NULL) (216.250.131.92)
We have discovered a bug in the SLP functions.
When ldaps is enabled, an invalid SLP service is broadcast.
The following patch fixes this:
--- ldap/servers/slapd/daemon.c.orig Wed Mar 21 17:29:49 2001
+++ ldap/servers/slapd/daemon.c Thu Mar 22 10:23:37 2001
@@ -109,6 +109,7 @@
#define MAX_HOSTNAME_LEN 256
#define LDAP_SRVTYPE_PREFIX "service:ldap://"
+#define LDAPS_SRVTYPE_PREFIX "service:ldaps://"
static char** slapd_srvurls = 0;
static SLPHandle slapd_hslp = 0;
@@ -133,6 +134,19 @@
}
}
}
+ else if ( strcmp( slapd_srvurls[i],"ldaps:///" ) == 0) {
+ /* INADDR_ANY urls should be marked up with
host.domainname */
+ if( gethostname( hn,MAX_HOSTNAME_LEN ) == 0) {
+ he = gethostbyname( hn );
+ if( he ) {
+ slapd_srvurls[i] = (char*) realloc(
slapd_srvurls[i],
+ strlen( he->h_name ) +
+ strlen( LDAPS_SRVTYPE_PREFIX ) +
1);
+ strcpy( slapd_srvurls[i],
LDAPS_SRVTYPE_PREFIX );
+ strcat( slapd_srvurls[i], he->h_name );
+ }
+ }
+ }
}
/* open the SLP handle */
@@ -160,14 +174,17 @@
int i;
for( i=0; slapd_srvurls[i] != NULL; i++ ) {
- SLPReg( slapd_hslp,
- slapd_srvurls[i],
- SLP_LIFETIME_MAXIMUM,
- "ldap",
- "",
- 1,
- slapd_slp_regreport,
- NULL );
+ if( strncmp( slapd_srvurls[i], LDAP_SRVTYPE_PREFIX, strlen(
LDAP_SRVTYPE_PREFIX )) == 0 ||
+ strncmp( slapd_srvurls[i], LDAPS_SRVTYPE_PREFIX, strlen(
LDAPS_SRVTYPE_PREFIX )) == 0 ) {
+ SLPReg( slapd_hslp,
+ slapd_srvurls[i],
+ SLP_LIFETIME_MAXIMUM,
+ "ldap",
+ "",
+ 1,
+ slapd_slp_regreport,
+ NULL );
+ }
}
}
Copyright 2001, Monty Charlton, All rights reserved.
This software is not subject to any license of
Caldera Systems.
This is free software; you can redistribute and use it
under the same terms as OpenLDAP itself.