Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11626

db.auth() shouldn't mutate its argument

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.5
    • 2.4.8, 2.5.3
    • Security, Shell
    • None
    • Minor Change
    • ALL

    Description

      Calling db.auth() with a document as the arg mutates the document by adding a "mechanism" and a "userSource" or "db" field to the doc. This prevents the same doc from being used for a future auth call.

      > var authDoc = {user:'spencer', pwd:'pwd'}
      > db.auth(authDoc)
      1
      > authDoc
      {
              "user": "spencer",
              "pwd": "pwd",
              "mechanism": "MONGODB-CR",
              "db": "test"
      }

      Attachments

        Activity

          People

            schwerin@mongodb.com Andy Schwerin
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: