소스 검색

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