Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-4512

username field in servers file is sometimes ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.x
    • ---
    • libsvn_subr
    • None

    Description

      Hi,
      
      The username field in the servers file is sometimes ignored:
      
      If I create ~/.subversion/servers with:
      
      [groups]
      irisys = server9
      
      [irisys]
      username = thomas.vajzovic
      
      and then run the command:
      
      svn co svn://server9:50000/trunk
      
      Then it prompts me "Password for tcv" (tcv is the username on my local Linux 
      machine).  The username it in the servers file is ignored.
      
      If I move the line username = thomas.vajzovic from the section [irisys] to the 
      section [global] it correctly prompts me for "Password for thomas.vajzovic".
      
      The cause of this bug appears to be in the function prompt_for_simple_creds() 
      in the section below the comment: /* Still no default username? Try 
      the 'servers' file */
      
      This code calls svn_hash_gets(...,SVN_AUTH_PARAM_SERVER_GROUP).  If the server 
      group has been hashed, it looks in the appropriate section for 
      SVN_CONFIG_OPTION_USERNAME.
      
      The problem is that nothing has ever hashed the server group name.
      
      If the string hasn't been hashed, then the function needs to look it up 
      itself.  The function to do that is svn_config_find_group().
      
      An alternative way to fix it would be to guarantee that some earlier code has 
      always looked up the group and hashed it.  I don't know where might be an 
      appropriate place to do that.  In my case the only place that already looks it 
      up is svn_ra_open4() in ra_loader.c.
      
      The way that I have found to work around this bug is to enter some incorrect 
      password so that it retries prompting me again.  The second time it prompts, it 
      asks for the username as well as the password.
      
      I hope you will agree that this is a defect, and that I have provided clear 
      steps to reproduce it, as well as finding where the code can be changed to fix 
      it.
      
      I have marked this as P2 because a workaround is available, however the 
      workaround is not immediately obvious to a new user and so it could be P1 as 
      it "gives a bad first impression".
      
      Many thanks,
      Tom
      

      Original issue reported by tcv

      Attachments

        Activity

          People

            Unassigned Unassigned
            subversion-importer Subversion Importer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: