diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d7a5967 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: kishikawakatsumi diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..40ed59a --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,9 @@ +{ + "extends": ["config:base"], + "packageRules": [ + { + "matchUpdateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true + } + ] +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a620251 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test +on: + pull_request: + branches: [main] + +jobs: + test: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + - name: Test + run: | + set -ex + + brew install docker docker-compose + brew install colima + colima start --mount-type 9p + + mkdir -p shares/alice + chmod 777 shares/alice + + docker compose up --detach + swift test diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..76b0484 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +# Security Policy + +For security related problems, please don't use the public issue tracker, but email [@kishikawakatsumi](https://github.com/kishikawakatsumi). diff --git a/Tests/SMBClientTests/ClientTests.swift b/Tests/SMBClientTests/ClientTests.swift new file mode 100644 index 0000000..ebfe9e8 --- /dev/null +++ b/Tests/SMBClientTests/ClientTests.swift @@ -0,0 +1,10 @@ +import XCTest +@testable import SMBClient + +final class ClientTests: XCTestCase { + func testLoginSucceeded() async throws { + let client = SMBClient(host: "localhost", port: 4445) + try await client.login(username: "alice", password: "alipass") + try await client.logoff() + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..36331f8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +version: "3" + +services: + samba: + build: . + image: ghcr.io/servercontainers/samba + ports: + - "139:139" + - "4445:445" + environment: + SAMBA_CONF_LOG_LEVEL: 3 + AVAHI_DISABLE: 1 + + GROUP_family: 1500 + + ACCOUNT_alice: alipass + UID_alice: 1000 + GROUPS_alice: family + + ACCOUNT_bob: bobpass + UID_bob: 1001 + GROUPS_bob: family + + SAMBA_VOLUME_CONFIG_shared_home: "[Home]; path=/shares/homes/%U; valid users = alice, bob; guest ok = no; read only = no; browseable = yes" + + SAMBA_VOLUME_CONFIG_aliceonly: "[Alice Share]; path=/shares/alice; valid users = alice; guest ok = no; read only = no; browseable = yes" + SAMBA_VOLUME_CONFIG_alicehidden: "[Alice Hidden Share]; path=/shares/alice-hidden; valid users = alice; guest ok = no; read only = no; browseable = no" + + SAMBA_VOLUME_CONFIG_bobonly: "[Bob Share]; path=/shares/bob; valid users = bob; guest ok = no; read only = no; browseable = yes" + + SAMBA_VOLUME_CONFIG_public: "[Public]; path=/shares/public; valid users = alice, bob, foo; guest ok = no; read only = no; browseable = yes; force group = family" + SAMBA_VOLUME_CONFIG_public_ro: "[Public ReadOnly]; path=/shares/public; guest ok = yes; read only = yes; browseable = yes; force group = family" + + SAMBA_VOLUME_CONFIG_guestmultilineexample: | + [Guest Share] + path = /shares/guest + guest ok = yes + browseable = yes + + volumes: + - ./shares/alice:/shares/alice