Преглед на файлове

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 */