summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2010-01-08 16:09:11 -0800
committerNathan Kinder <nkinder@redhat.com>2010-01-08 16:09:11 -0800
commit786c740c39136b5eb3e18fd5a00edfca6a94b8fe (patch)
tree36c995bfbee8506ff614302edb64a8c4ce176f2f
parenta7ac03c3ce25e431f520046418f5f3d196ac32b6 (diff)
downloadds-786c740c39136b5eb3e18fd5a00edfca6a94b8fe.tar.gz
ds-786c740c39136b5eb3e18fd5a00edfca6a94b8fe.tar.xz
ds-786c740c39136b5eb3e18fd5a00edfca6a94b8fe.zip
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.
-rw-r--r--ldap/servers/slapd/pw.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 50136b10..8f27aa6c 100644
--- a/ldap/servers/slapd/pw.c
+++ b/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 */