You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by j d <do...@gmail.com> on 2010/03/11 15:09:14 UTC

CouchDB 0.11.0b921503 user signup errors

Attempting to signup a user named "joe" with password "joe" returns
the following server error:

{"error":"{bad_return_value,{os_process_error,{exit_status,127}}}","reason":"{gen_server,call,\n
           [couch_query_servers,\n
{get_proc,{doc,<<\"_design/_auth\">>,\n
{1,\n
[<<4,216,98,51,179,37,75,181,165,61,207,113,3,\n
         249,127,194>>]},\n
{[{<<\"language\">>,<<\"javascript\">>},\n
 {<<\"validate_doc_update\">>,\n
<<\"function(newDoc, oldDoc, userCtx) {\\n                if ((oldDoc
|| newDoc).type != 'user') {\\n                    throw({forbidden :
'doc.type must be user'});\\n                } // we only validate
user docs for now\\n                if (newDoc._deleted === true) {\\n
                   // allow deletes by admins and matching users \\n
                 // without checking the other fields\\n
     if ((userCtx.roles.indexOf('_admin') != -1) || (userCtx.name ==
oldDoc.name)) {\\n                        return;\\n
 } else {\\n                        throw({forbidden : 'Only admins
may delete other user docs.'});\\n                    }\\n
   }\\n                if (!newDoc.name) {\\n
throw({forbidden : 'doc.name is required'});\\n                }\\n
            if (!(newDoc.roles && (typeof newDoc.roles.length !=
'undefined') )) {\\n                    throw({forbidden : 'doc.roles
must be an array'});\\n                }\\n                if
(newDoc._id != 'org.couchdb.user:'+newDoc.name) {\\n
 throw({forbidden : 'Docid must be of the form
org.couchdb.user:name'});\\n                }\\n                if
(oldDoc) { // validate all updates\\n                    if
(oldDoc.name != newDoc.name) {\\n
throw({forbidden : 'Usernames may not be changed.'});\\n
     }\\n                }\\n                if (newDoc.password_sha
&& !newDoc.salt) {\\n                    throw({forbidden : 'Users
with password_sha must have a salt. See /_utils/script/couch.js for
example code.'});\\n                }\\n                if
(userCtx.roles.indexOf('_admin') == -1) { // not an admin\\n
         if (oldDoc) { // validate non-admin updates\\n
        if (userCtx.name != newDoc.name) {\\n
throw({forbidden : 'You may only update your own user document.'});\\n
                       }\\n                        // validate role
updates\\n                        var oldRoles =
oldDoc.roles.sort();\\n                        var newRoles =
newDoc.roles.sort();\\n                        if (oldRoles.length !=
newRoles.length) {\\n                            throw({forbidden :
'Only _admin may edit roles'});\\n                        }\\n
               for (var i=0; i < oldRoles.length; i++) {\\n
                if (oldRoles[i] != newRoles[i]) {\\n
             throw({forbidden : 'Only _admin may edit roles'});\\n
                       }\\n                        };\\n
     } else if (newDoc.roles.length > 0) {\\n
throw({forbidden : 'Only _admin may set roles'});\\n
 }\\n                }\\n                // no system roles in users
db\\n                for (var i=0; i < newDoc.roles.length; i++) {\\n
                  if (newDoc.roles[i][0] == '_') {\\n
      throw({forbidden : 'No system roles (starting with underscore)
in users db.'});\\n                    }\\n                };\\n
         // no system names as names\\n                if
(newDoc.name[0] == '_') {\\n                    throw({forbidden :
'Username may not start with underscore.'});\\n                }\\n
        }\">>}]},\n                            [],false,[]},\n
              {<<\"_design/_auth\">>,\n
<<\"1-04d86233b3254bb5a53dcf7103f97fc2\">>}}]}"}


This JSON is difficult to parse and is puked to the screen in a red
font onto the signup dialog.  This dump comes from firebug.

Note that creating an admin account "works" in that I can login/out
but there are no documents in the _users database other then the
default design document (is this normal?).  It could be that I
modified the local.ini file to uncomment out the admin section and
added an admin user, then ran couchdb, then stopped couchdb and
commented the admin section out again, then re-ran couchdb and tried
to create the admin from the UI.