denisenkom / pytds

Python DBAPI driver for MSSQL using pure Python TDS (Tabular Data Stream) protocol implementation
MIT License
190 stars 52 forks source link

Fix SSO with instance name instead of port #129

Open Ununnilium opened 2 years ago

Ununnilium commented 2 years ago

When a named instance instead of a port is used, Kerberos logins failed because the spn string was "MSSQLSvc@SERVER_NAME:None" instead of "MSSQLSvc@SERVER_NAME:INSTANCE_NAME". When "port" is None (parsed_servers[0][1]), "instance" (parsed_servers[0][2]) should be used.

codecov[bot] commented 2 years ago

Codecov Report

Merging #129 (53424af) into master (7c73812) will decrease coverage by 1.79%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
- Coverage   93.58%   91.79%   -1.80%     
==========================================
  Files          28       27       -1     
  Lines        7947     7736     -211     
==========================================
- Hits         7437     7101     -336     
- Misses        510      635     +125     
Impacted Files Coverage Δ
src/pytds/__init__.py 91.49% <100.00%> (-0.94%) :arrow_down:
src/pytds/tls.py 18.64% <0.00%> (-74.58%) :arrow_down:
tests/fixtures.py 93.33% <0.00%> (-6.67%) :arrow_down:
tests/unit_test.py 94.10% <0.00%> (-4.98%) :arrow_down:
tests/utils.py 81.13% <0.00%> (-1.89%) :arrow_down:
src/pytds/tds_base.py 93.65% <0.00%> (-1.47%) :arrow_down:
src/pytds/tds.py 95.90% <0.00%> (-0.63%) :arrow_down:
tests/connected_test.py 97.53% <0.00%> (-0.62%) :arrow_down:
tests/all_test.py 94.92% <0.00%> (-0.14%) :arrow_down:
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7c73812...53424af. Read the comment docs.

denisenkom commented 9 months ago

Why do you need to use socket.getfqdn, you did not explain that in the description