davideuler / pwm

Automatically exported from code.google.com/p/pwm
0 stars 0 forks source link

Creating a New User without supplying an optional field fails #555

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add an optional element on the newUser.FORM
2. Attempt to create a new user without supplying the optional element

What is the expected output? What do you see instead?

I would expect the user creation to succeed.  Instead, I get an error message 
"ERROR_NEW_USER_FAILURE (unexpected ldap error creating user entry: [LDAP: 
error code 21 - robotSerialNumber: value #0 invalid per syntax])".  (If I do 
supply the robotSerialNumber, than the user is successfully created).

I believe the issue has to do with something around this region:
http://code.google.com/p/pwm/source/browse/trunk/pwm/servlet/src/password/pwm/se
rvlet/NewUserServlet.java#369

It would appear that null elements from the optional value is being stuffed 
into createAttributes as a NULL value.

On UpdateProfile, the update uses Helper.writeFormValuesToLdap which does 
properly filter out NULL optional elements 
(http://code.google.com/p/pwm/source/browse/trunk/pwm/servlet/src/password/pwm/u
til/Helper.java#364).

Original issue reported on code.google.com by lo...@s1network.com on 16 Apr 2014 at 12:58

GoogleCodeExporter commented 9 years ago
I can confirm that the following code change seems to fix this problem:

        for (final FormConfiguration formItem : newUserForm) {
            final String attributeName = formItem.getName();
            if (formValues.get(attributeName).length() > 0) createAttributes.put(attributeName, formValues.get(attributeName));
        }

Note the line starting with 'if...'

Original comment by michaelc...@gmail.com on 25 Sep 2014 at 10:02

GoogleCodeExporter commented 9 years ago
This is in the newUserServlet.java file.

Original comment by michaelc...@gmail.com on 25 Sep 2014 at 10:02

GoogleCodeExporter commented 9 years ago

Original comment by menno.pi...@gmail.com on 25 Sep 2014 at 10:07