소스 검색

Should not attempt to pop SASL IO layer if not using SASL IO
https://bugzilla.redhat.com/show_bug.cgi?id=519455
Resolves: bug 519455
Bug Description: Should not attempt to pop SASL IO layer if not using SASL IO
Reviewed by: nkinder (Thanks!)
Fix Description: Before attempting to pop the SASL IO layer from the prfd,
first make sure we are using sasl IO, the prfd is not NULL, and the prfd
has a SASL IO layer on it.
This also fixes a bug with setting nsslapd-localhost in the bootstrap code -
if you are using a system that does not have DNS configured correctly, you
may want to force the SASL code to use the nsslapd-localhost for the FQDN.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no

Rich Megginson 16 년 전
부모
커밋
7f9f261123
2개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      ldap/servers/slapd/config.c
  2. 12 2
      ldap/servers/slapd/sasl_io.c

+ 1 - 0
ldap/servers/slapd/config.c

@@ -592,6 +592,7 @@ slapd_bootstrap_config(const char *configdir)
 					      CONFIG_REWRITE_RFC1274_ATTRIBUTE, 
 					      errorbuf);
 				  }
+				  val[0] = 0;
 				}
 
 				/* what is our localhost name */

+ 12 - 2
ldap/servers/slapd/sasl_io.c

@@ -467,15 +467,25 @@ sasl_io_write(PRFileDesc *fd, const void *buf, PRInt32 amount)
 static PRStatus PR_CALLBACK
 sasl_pop_IO_layer(PRFileDesc* stack)
 {
-    PRFileDesc* layer = PR_PopIOLayer(stack, sasl_LayerID);
+    PRFileDesc* layer = NULL;
     sasl_io_private *sp = NULL;
 
+    /* see if stack has the sasl io layer */
+    if (!sasl_LayerID || !stack || !PR_GetIdentitiesLayer(stack, sasl_LayerID)) {
+        LDAPDebug0Args( LDAP_DEBUG_CONNS,
+                        "sasl_pop_IO_layer: no SASL IO layer\n" );
+        return PR_SUCCESS;
+    }
+
+    /* remove the layer from the stack */
+    layer = PR_PopIOLayer(stack, sasl_LayerID);
     if (!layer) {
         LDAPDebug0Args( LDAP_DEBUG_CONNS,
-                        "sasl_pop_IO_layer: error - no SASL IO layer\n" );
+                        "sasl_pop_IO_layer: error - could not pop SASL IO layer\n" );
         return PR_FAILURE;
     }
 
+    /* get our private data and clean it up */
     sp = sasl_get_io_private(layer);
 
     if (sp) {