fix(soap/auth): preserve instance component of host/service principals - #105
Merged
Merged
Conversation
cryptomilk
force-pushed
the
asn-fix
branch
6 times, most recently
from
June 26, 2026 15:26
fa4d750 to
dbbdfd8
Compare
Add a __str__ method to Principal that produces the canonical string representation (primary/instance@realm, primary/instance/domain@realm, or primary@realm), so callers no longer need to reconstruct the string manually. Infer service_type from the parsed principal components : 2-component service principals (service/host@REALM) are typed as KRB5_NT_SRV_HST, 3-component domain-based principals (service/host/domain@REALM) as KRB5_NT_SRV_HST_DOMAIN (RFC 5179), and bare principals as KRB5_NT_ENTERPRISE_PRINCIPAL. An explicit service_type argument always takes precedence. The sname_to_principal path falls back to KRB5_NT_SRV_HST when no type is given. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the manual if/else reconstruction and the hardcoded KRB5_NT_ENTERPRISE_PRINCIPAL service_type with a simple str(principal) call. The Principal class now infers the correct type from its parsed components and knows how to render itself as a string. Fixes: openSUSE#103 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the manual if/else reconstruction and the hardcoded KRB5_NT_ENTERPRISE_PRINCIPAL service_type with a simple str(principal) call. The Principal class now infers the correct type from its parsed components and knows how to render itself as a string.
The old "%s@%s" % (primary, realm) reconstruction was also lossy for service principals (e.g. host/node@REALM would have been stored as node@REALM); str(principal) preserves all components correctly.
Fixes: #103