Sha256: 321ff204a3abdb31801f662ce3229d940af1af017563cdbe2d345bd8fae967ff

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

commit cdf93abe5492ec706bca0db762be41526f343e92
Author: Frediano Ziglio <freddy77@gmail.com>
Date:   Sun Nov 4 10:17:34 2012 +0000

    Fix sspi if Kerberos is used
    
    Authentication require more roud trips for Kerberos.

diff --git a/src/tds/sspi.c b/src/tds/sspi.c
index 680717a..077d58b 100644
--- a/src/tds/sspi.c
+++ b/src/tds/sspi.c
@@ -172,8 +172,19 @@ tds_sspi_handle_next(TDSSOCKET * tds, struct tds_authentication * tds_auth, size
 
 	free(auth_buf);
 
-	if (status != SEC_E_OK)
+	switch (status) {
+	case SEC_I_COMPLETE_AND_CONTINUE:
+		sec_fn->CompleteAuthToken(&auth->cred_ctx, &out_desc);
+		break;
+
+	case SEC_I_CONTINUE_NEEDED:
+	case SEC_E_OK:
+		break;
+
+	default:
 		return TDS_FAIL;
+	}
+
 	if (out_buf.cbBuffer == 0)
 		return TDS_SUCCEED;
 
@@ -275,9 +286,16 @@ tds_sspi_get_auth(TDSSOCKET * tds)
 		&auth->cred_ctx, &desc,
 		&attrs, &ts);
 
-	if (status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) {
+	switch (status) {
+	case SEC_I_COMPLETE_AND_CONTINUE:
 		sec_fn->CompleteAuthToken(&auth->cred_ctx, &desc);
-	} else if(status != SEC_E_OK) {
+		break;
+
+	case SEC_I_CONTINUE_NEEDED:
+	case SEC_E_OK:
+		break;
+
+	default:
 		free(auth->sname);
 		free(auth->tds_auth.packet);
 		sec_fn->FreeCredentialsHandle(&auth->cred);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tiny_tds-0.5.2.rc2-x86-mingw32 ext/patch/sspi_w_kerberos.diff
tiny_tds-0.5.2.rc2 ext/patch/sspi_w_kerberos.diff