Bug 453156 - NTML broken by embedding patch in bug 422772, r/sr=bsmedberg
authorBrian Crowder <crowder@fiverocks.com>
Fri, 05 Sep 2008 12:09:06 -0700
changeset 18860 d78fa9eb3c9fa0db992e125c63ed34d81fbb3f75
parent 18859 f38f4832f9bb86b7ecc86e2ce448f91374bce190
child 18861 87335513ef3e76bcfcd4513aa3b2835e1f2a3360
push idunknown
push userunknown
push dateunknown
bugs453156, 422772
milestone1.9.1b1pre
Bug 453156 - NTML broken by embedding patch in bug 422772, r/sr=bsmedberg
extensions/auth/nsAuthSSPI.cpp
--- a/extensions/auth/nsAuthSSPI.cpp
+++ b/extensions/auth/nsAuthSSPI.cpp
@@ -65,20 +65,20 @@
 #endif
 
 #ifndef SECBUFFER_STREAM
 #define SECBUFFER_STREAM 10
 #endif
 
 //-----------------------------------------------------------------------------
 
-static const char *const pTypeName [] = {
-    "Kerberos",
-    "Negotiate",
-    "NTLM"
+static const PRUnichar *const pTypeName [] = {
+    L"Kerberos",
+    L"Negotiate",
+    L"NTLM"
 };
 
 #ifdef DEBUG
 #define CASE_(_x) case _x: return # _x;
 static const char *MapErrorCode(int rc)
 {
     switch (rc) {
     CASE_(SEC_E_OK)
@@ -264,24 +264,24 @@ nsAuthSSPI::Init(const char *serviceName
         return NS_ERROR_UNEXPECTED;
     }
     mMaxTokenLen = pinfo->cbMaxToken;
     (sspi->FreeContextBuffer)(pinfo);
 
     TimeStamp useBefore;
 
     rc = (sspi->AcquireCredentialsHandleW)(NULL,
-                                          package,
-                                          SECPKG_CRED_OUTBOUND,
-                                          NULL,
-                                          NULL,
-                                          NULL,
-                                          NULL,
-                                          &mCred,
-                                          &useBefore);
+                                           package,
+                                           SECPKG_CRED_OUTBOUND,
+                                           NULL,
+                                           NULL,
+                                           NULL,
+                                           NULL,
+                                           &mCred,
+                                           &useBefore);
     if (rc != SEC_E_OK)
         return NS_ERROR_UNEXPECTED;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAuthSSPI::GetNextToken(const void *inToken,
@@ -331,34 +331,36 @@ nsAuthSSPI::GetNextToken(const void *inT
     obd.cBuffers = 1;
     obd.pBuffers = &ob;
     ob.BufferType = SECBUFFER_TOKEN;
     ob.cbBuffer = mMaxTokenLen;
     ob.pvBuffer = nsMemory::Alloc(ob.cbBuffer);
     if (!ob.pvBuffer)
         return NS_ERROR_OUT_OF_MEMORY;
     memset(ob.pvBuffer, 0, ob.cbBuffer);
+
+    NS_ConvertUTF8toUTF16 wSN(mServiceName);
     SEC_WCHAR *sn;
     if (mPackage == PACKAGE_TYPE_NTLM)
         sn = NULL;
     else
-        sn = (SEC_WCHAR *) mServiceName.get();
+        sn = (SEC_WCHAR *) wSN.get();
 
     rc = (sspi->InitializeSecurityContextW)(&mCred,
-                                           ctxIn,
-                                           sn,
-                                           ctxReq,
-                                           0,
-                                           SECURITY_NATIVE_DREP,
-                                           inToken ? &ibd : NULL,
-                                           0,
-                                           &mCtxt,
-                                           &obd,
-                                           &ctxAttr,
-                                           &ignored);
+                                            ctxIn,
+                                            sn,
+                                            ctxReq,
+                                            0,
+                                            SECURITY_NATIVE_DREP,
+                                            inToken ? &ibd : NULL,
+                                            0,
+                                            &mCtxt,
+                                            &obd,
+                                            &ctxAttr,
+                                            &ignored);
     if (rc == SEC_I_CONTINUE_NEEDED || rc == SEC_E_OK) {
         if (!ob.cbBuffer) {
             nsMemory::Free(ob.pvBuffer);
             ob.pvBuffer = NULL;
         }
         *outToken = ob.pvBuffer;
         *outTokenLen = ob.cbBuffer;