浏览代码

Bug 553455 - fix segfault when changing a password

If a local password policy is set that does not have a storage
scheme specified, the server can crash since it tries to dereference
a NULL pointer to access the hashing function.  This fix simply
checks if the storage scheme is set before trying to access the
hashing function.
Nathan Kinder 16 年之前
父节点
当前提交
786c740c39
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      ldap/servers/slapd/pw.c

+ 6 - 2
ldap/servers/slapd/pw.c

@@ -350,8 +350,12 @@ pw_encodevals_ext( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals )
  
 	/* new_passwdPolicy gives us a local policy if sdn and pb are set and
 	   can be used to find a local policy, else we get the global policy */
-   	pwpolicy = new_passwdPolicy(pb, sdn ? (char*)slapi_sdn_get_ndn(sdn) : NULL );
-	pws_enc = pwpolicy->pw_storagescheme->pws_enc;
+	pwpolicy = new_passwdPolicy(pb, sdn ? (char*)slapi_sdn_get_ndn(sdn) : NULL );
+
+	if (pwpolicy->pw_storagescheme) {
+		pws_enc = pwpolicy->pw_storagescheme->pws_enc;
+	}
+
 	delete_passwdPolicy(&pwpolicy);
 
 	/* Password scheme encryption function was not found */