Browse Source

Ticket 47761 - Return all attributes in rootdse without explicit request

Bug Description:  a search for the rootdse: -s base -b ""
			only returns the user attributes not the
			operational attributes like "supportedControl"
		 This is correct inLDAPv3, and behaviour was introduced
			with fix for #47634, but for backward compatibility
			the old behaviour should be configurable

Fix Description:   Introduce a multivalued attribute to specify the
			attribites which should be returned without
			specific request

https://fedorahosted.org/389/ticket/47634

Reviewed by: richm, thanks
Ludwig Krispenz 11 years ago
parent
commit
c6167e7b68
3 changed files with 19 additions and 0 deletions
  1. 1 0
      ldap/schema/01core389.ldif
  2. 17 0
      ldap/servers/slapd/result.c
  3. 1 0
      ldap/servers/slapd/slap.h

+ 1 - 0
ldap/schema/01core389.ldif

@@ -297,6 +297,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.2302 NAME 'nsslapd-listen-backlog-size'
 attributeTypes: ( 2.16.840.1.113730.3.1.2303 NAME 'nsslapd-ignore-time-skew' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
 attributeTypes: ( 2.16.840.1.113730.3.1.2304 NAME 'nsslapd-dynamic-plugins' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
 attributeTypes: ( 2.16.840.1.113730.3.1.2305 NAME 'nsslapd-moddn-aci' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2306 NAME 'nsslapd-return-default-opattr' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
 #
 # objectclasses
 #

+ 17 - 0
ldap/servers/slapd/result.c

@@ -1157,6 +1157,8 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
 	char *current_type_name = NULL;
 	int rewrite_rfc1274 = 0;
 	int vattr_flags = 0;
+	char *dn = NULL;
+	char **default_attrs = NULL;
 
 	if(real_attrs_only == SLAPI_SEND_VATTR_FLAG_REALONLY)
 		vattr_flags = SLAPI_REALATTRS_ONLY;
@@ -1193,6 +1195,10 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
 
 	rewrite_rfc1274 = config_get_rewrite_rfc1274();
 
+	dn = slapi_entry_get_dn_const(e);
+	if (dn == NULL || *dn == '\0' ) {
+		default_attrs = slapi_entry_attr_get_charray(e, CONFIG_RETURN_DEFAULT_OPATTR);
+	}
 	/* Send the attrs back to the client */
 	for (current_type = vattr_typethang_first(typelist); current_type; current_type = vattr_typethang_next(current_type) ) {
 
@@ -1224,6 +1230,14 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
 						break;
 					}
 				}
+				if (!sendit && default_attrs) {
+					for ( i = 0; default_attrs != NULL && default_attrs[i] != NULL; i++ ) {
+						if ( slapi_attr_type_cmp( default_attrs[i], current_type_name, SLAPI_TYPE_CMP_SUBTYPE ) == 0 ) {
+							sendit = 1;
+							break;
+						}
+					}
+				}
 			}
 		/*
 		 * it's a user attribute. send it.
@@ -1324,6 +1338,9 @@ exit:
 	if (NULL != typelist) {
 		slapi_vattr_attrs_free(&typelist,typelist_flags);
 	}
+	if (NULL != default_attrs) {
+		slapi_ch_free((void**)&default_attrs);
+	}
 	return rc;
 }
 

+ 1 - 0
ldap/servers/slapd/slap.h

@@ -2150,6 +2150,7 @@ typedef struct _slapdEntryPoints {
 #define CONFIG_PLUGIN_LOGGING "nsslapd-plugin-logging"
 #define CONFIG_LISTEN_BACKLOG_SIZE	"nsslapd-listen-backlog-size"
 #define CONFIG_DYNAMIC_PLUGINS "nsslapd-dynamic-plugins"
+#define CONFIG_RETURN_DEFAULT_OPATTR "nsslapd-return-default-opattr"
 
 /* getenv alternative */
 #define CONFIG_MALLOC_MXFAST "nsslapd-malloc-mxfast"