nextcloud / nextcloud/desktop

nextcloudcmd doesn't fully respect the netrc specs

Closed
#5,957 1 comment 2 reactions 0 assignees View on GitHub
1. to develop confirmed feature: :white_square_button: nextcloudcmd good first issue help wanted Prio: normal
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 21h
Merged PRs (30d)
127

Description

### ⚠️ Before submitting, please verify the following: ⚠️

- [X] This is a **bug**, not a question or a configuration issue.
- [X] This issue is **not** already reported on Github (I've searched it).
- [X] Nextcloud Server and Desktop Client are **up to date**. See [Server Maintenance and Release Schedule](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) and [Desktop Releases](https://nextcloud.com/install/#install-clients) for supported versions.
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/)

### Bug description

nextcloudcmd doesn't fully respect the netrc specs:

1. it only knows about the `default` entry and ignores entries with the name of the server (neither `https://nextcloud.example.com` nor `nextcloud.example.com` do work).
2. the environment variable `NETRC` is being ignored

This makes it very difficult to synchronize more than one nextcloud server on the same machine, or to use the default ~/.netrc for anything else than nextcloud.

### Steps to reproduce

Create the file `~/.netrc` as:

```
default
login mylogin
password mypassword
```

Call `nextcloudcmd -n --trust --non-interactive --path /Documents ~/Documents/ https://nextcloud.example.com` and the synchronization succeeds.

Either:

1. replace `default` in the file with `nextcloud.example.com`
2. _or_ `mv .netrc mynetrc` and `export NETRC=~/mynetrc`

and exactly the same command fails with an `Host requires authentication` error. Revert the change, and the command works again.

### Expected behavior

The netrc specs should be fully supported and both modifications should lead to successful sync.

### Which files are affected by this bug

nextcloudcmd

### Operating system

Linux

### Which version of the operating system you are running.

Fedora 38

### Package

Distro package manager

### Nextcloud Server version

24.0.6.1

### Nextcloud Desktop Client version

3.9.0git

### Is this bug present after an update or on a fresh install?

Fresh desktop client install

### Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

### Are you using an external user-backend?

- [X] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other

### Nextcloud Server logs

```shell
This is rather irrelevant to the issue, isn't it?
```

### Additional info

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.