Bug #1857

cp2foss rejects user

Added by Bob Gobeille about 1 year ago. Updated about 1 year ago.

Status:Closed Start date:04/30/2012
Priority:High Due date:
Assignee:larry shi % Done:

0%

Category:CLI
Target version:2.0.0
Rank: Tester:

Description

cp2foss rejects valid user/password

$ cp2foss --user fossy --password fossypassword -f bob.gobeille ossdiscovery-olex-linux-2.3.3.tar.gz
User name or password is invalid.

History

Updated by Bob Gobeille about 1 year ago

  • Category set to CLI
  • Target version set to 2.0.0

Updated by Bob Gobeille about 1 year ago

From Iver Dihle Skjervum:

I have just downloaded 2.0 rc1, and would like to share my latest experiences.

It works to upload file now, but only as long as the unix-username is registered as a user in fossology since '--user' and '--passwd' doesn't work. An entry is created in the upload-table, but archives are not unpacked using a simple command like 'cp2foss archive.tar'. However, using '-q all' it unpacks the file, and runs at least the agent_nomos (I have not understood which agents that are involved in cp2foss yet).

Using -f doesn't seem to have any affect on the upload, besides that the folder is created, but the upload is placed in Software Repository anyway.

Updated by Bob Gobeille about 1 year ago

  • Priority changed from Normal to High

Updated by larry shi about 1 year ago

  • Status changed from New to In Progress
  • Assignee set to larry shi

Updated by larry shi about 1 year ago

fixed in svn 5838.

also please refer to #777.

Updated by larry shi about 1 year ago

  • Status changed from In Progress to Resolved

Updated by larry shi about 1 year ago

so sorry, you have to add .fossology.rc in your home dir,or when you run cp2foss, add --user user-name before the file name, for example:
cp2foss --user USER --password PASSWORD -f Folder1 -d 'the first file' /tmp/file1

Updated by Bob Gobeille about 1 year ago

  • Status changed from Resolved to In Progress

cp2foss now reads ~/.fossology.rc for the user/password however, command line arguments always have the highest priority. So

cp2foss -Q --user me --password bad

should fail but it doesn't because it is reading .fossology.rc.

Also, it would be better if the contents of .fossology.rc were keyword/value pairs:

user=bob
password=mypass

This can be easily read/parsed with parse_ini_file(). By including keywords we leave our options open for using this file to set other user variables in the future.

Updated by larry shi about 1 year ago

a new fix in svn 5844.

Updated by Bob Gobeille about 1 year ago

tested on 5844
cp2foss -Q --user bobg --password badpass
still succeeds when it should fail (note that ~/.bobg/.fossology.rc) does contain the correct user/pass.

Updated by larry shi about 1 year ago

  • Status changed from In Progress to Resolved

fixed in svn 5851.

Updated by Bob Gobeille about 1 year ago

  • Status changed from Resolved to In Progress

tested with svn 5851
cp2foss fails to recognize ~/.fossology.rc

$ cp2foss -a
The user is: bobg, please enter the password:

Updated by larry shi about 1 year ago

Bob Gobeille wrote:

tested with svn 5851
cp2foss fails to recognize ~/.fossology.rc

$ cp2foss -a
The user is: bobg, please enter the password:

I do not very capture you test case.
for cp2foss and fossjobs, if there are no ~/.fossology.rc and you do not add the --user USER argument, will add the current user as the default, then let you enter the password.
so I think for your test case, there is no ~/.fossology.rc, the current user is bobg,right?

Updated by Bob Gobeille about 1 year ago

My test case is:
1) create ~/.fossology.rc
with two lines. Line 1 is the username, line 2 is my password. For example,
cat /home/bobg/.fossology.rc
myusername
mypassword

2) then run cp2foss -a
The user and password should be picked up from ~/.fossology.rc

3) run cp2foss -a --user myusername --password badpassword
This should give an error because the bad password on the command line overrides the password in ~/.fossology.rc

Also, I don't know why you default the user name to the system username. System usernames have nothing to do with fossology usernames.

Updated by Dong Ma about 1 year ago

Have test with new check in, works fine, my test case is:
1) create ~/.fossology.rc
with two lines. Line 1 is the user=username, line 2 is my password=password. For example,
cat /home/madong/.fossology.rc
user=myusername
password=mypassword

2) then run cp2foss -Q
The user and password picked up from ~/.fossology.rc and run cp2foss -Q

3) run cp2foss -Q --user myusername --password badpassword
User name or password is invalid.

4) run cp2foss -Q without setup ~/.fossology.rc
FATAL: You should add '--user USERNAME' when running OR add 'user=USERNAME' in ~/.fossology.rc before running.

Updated by larry shi about 1 year ago

  • Status changed from In Progress to Resolved

fixed in svn 5862.

Updated by Bob Gobeille about 1 year ago

  • Status changed from Resolved to Closed

Tested and verified on 5863. However, all the auth code is duplicated here and in fossjobs. That duplication is a bad practice. I'm going to file a new defect on that for 2.0.1.

Also available in: Atom PDF