Skip to content

Commit 780cefd

Browse files
committed
Fix CI failures and simplify setup action to use SMB URL syntax
- Fix rustdoc: escape brackets in der_wrap doc comment - Fix integration test skip: check secret via env step, not secrets context - Simplify setup action: accept smb://user:pass@server/share URL instead of separate inputs for each field - smb-pass input overrides URL password (for secrets)
1 parent 1a196cf commit 780cefd

3 files changed

Lines changed: 47 additions & 24 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@ inputs:
66
description: Release tag to install (e.g. "v0.1.0"). Use "latest" for the most recent release.
77
required: false
88
default: latest
9-
smb-server:
10-
description: SMB server hostname or IP
11-
required: true
12-
smb-user:
13-
description: SMB username
9+
smb-url:
10+
description: >
11+
SMB connection URL: smb://user:pass@server/share or smb://user:pass@server:port/share.
12+
Password can also be provided separately via smb-pass.
1413
required: true
1514
smb-pass:
16-
description: SMB password
17-
required: true
18-
smb-share:
19-
description: SMB share name
20-
required: true
21-
smb-port:
22-
description: SMB port
23-
required: false
24-
default: "445"
25-
smb-domain:
26-
description: SMB domain
15+
description: SMB password (overrides password in smb-url if both provided)
2716
required: false
2817
default: ""
2918
bucket:
@@ -87,12 +76,8 @@ runs:
8776
id: start
8877
shell: bash
8978
env:
90-
SPICEIO_SMB_SERVER: ${{ inputs.smb-server }}
91-
SPICEIO_SMB_PORT: ${{ inputs.smb-port }}
92-
SPICEIO_SMB_USER: ${{ inputs.smb-user }}
93-
SPICEIO_SMB_PASS: ${{ inputs.smb-pass }}
94-
SPICEIO_SMB_DOMAIN: ${{ inputs.smb-domain }}
95-
SPICEIO_SMB_SHARE: ${{ inputs.smb-share }}
79+
SMB_URL: ${{ inputs.smb-url }}
80+
SMB_PASS_OVERRIDE: ${{ inputs.smb-pass }}
9681
SPICEIO_BUCKET: ${{ inputs.bucket }}
9782
SPICEIO_REGION: ${{ inputs.region }}
9883
SPICEIO_BIND: ${{ inputs.bind }}
@@ -111,6 +96,36 @@ runs:
11196
exit 0
11297
fi
11398
99+
# Parse smb://user:pass@server:port/share
100+
# Strips the smb:// prefix, then splits on :, @, /
101+
URL="${SMB_URL#smb://}"
102+
103+
USERINFO="${URL%%@*}"
104+
HOSTPATH="${URL#*@}"
105+
106+
SPICEIO_SMB_USER="${USERINFO%%:*}"
107+
URL_PASS="${USERINFO#*:}"
108+
# Use override password if provided, otherwise use URL password
109+
if [[ -n "$SMB_PASS_OVERRIDE" ]]; then
110+
SPICEIO_SMB_PASS="$SMB_PASS_OVERRIDE"
111+
else
112+
SPICEIO_SMB_PASS="$URL_PASS"
113+
fi
114+
115+
HOSTPORT="${HOSTPATH%%/*}"
116+
SPICEIO_SMB_SHARE="${HOSTPATH#*/}"
117+
118+
if [[ "$HOSTPORT" == *:* ]]; then
119+
SPICEIO_SMB_SERVER="${HOSTPORT%%:*}"
120+
SPICEIO_SMB_PORT="${HOSTPORT#*:}"
121+
else
122+
SPICEIO_SMB_SERVER="$HOSTPORT"
123+
SPICEIO_SMB_PORT="445"
124+
fi
125+
126+
export SPICEIO_SMB_SERVER SPICEIO_SMB_PORT SPICEIO_SMB_USER SPICEIO_SMB_PASS SPICEIO_SMB_SHARE
127+
export SPICEIO_BUCKET SPICEIO_REGION SPICEIO_BIND
128+
114129
spiceio &
115130
PID=$!
116131
echo "$PID" > "$PID_FILE"

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@ jobs:
5353
- name: Run unit tests
5454
run: cargo test --locked
5555

56+
- name: Check SMB credentials
57+
run: |
58+
if [[ -n "$SPICEIO_SMB_PASS" ]]; then
59+
echo "HAS_SMB_PASS=true" >> "$GITHUB_ENV"
60+
fi
61+
env:
62+
SPICEIO_SMB_PASS: ${{ secrets.UNAS_SMB_PASS }}
63+
5664
- name: Run sccache integration test
5765
# Skipped when UNAS_SMB_PASS secret is not configured (e.g. fork PRs)
58-
if: env.SPICEIO_SMB_PASS != ''
66+
if: ${{ env.HAS_SMB_PASS == 'true' }}
5967
env:
6068
SPICEIO_SMB_SERVER: ${{ vars.SPICEIO_SMB_SERVER || '192.168.3.148' }}
6169
SPICEIO_SMB_USER: ${{ vars.SPICEIO_SMB_USER || 'runner' }}

src/smb/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ pub fn wrap_spnego_auth(ntlmssp: &[u8]) -> Vec<u8> {
346346
der_wrap(0xa1, &seq)
347347
}
348348

349-
/// Wrap data in a DER TLV: [tag][length][data].
349+
/// Wrap data in a DER TLV: `[tag][length][data]`.
350350
fn der_wrap(tag: u8, data: &[u8]) -> Vec<u8> {
351351
let mut buf = Vec::with_capacity(1 + 4 + data.len());
352352
buf.push(tag);

0 commit comments

Comments
 (0)