apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r125406 - /apr/apr/trunk/threadproc/win32/proc.c
Date Mon, 17 Jan 2005 10:39:21 GMT
Author: mturk
Date: Mon Jan 17 02:39:21 2005
New Revision: 125406

URL: http://svn.apache.org/viewcvs?view=rev&rev=125406
Log:
Use zero length password if supplied password is NULL.
Modified:
   apr/apr/trunk/threadproc/win32/proc.c

Modified: apr/apr/trunk/threadproc/win32/proc.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/threadproc/win32/proc.c?view=diff&rev=125406&p1=apr/apr/trunk/threadproc/win32/proc.c&r1=125405&p2=apr/apr/trunk/threadproc/win32/proc.c&r2=125406
==============================================================================
--- apr/apr/trunk/threadproc/win32/proc.c	(original)
+++ apr/apr/trunk/threadproc/win32/proc.c	Mon Jan 17 02:39:21 2005
@@ -247,29 +247,32 @@
             }
             return rv;
         }
-        len = strlen(password) + 1;
-        wlen = len;
-        wpassword = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t));
-        if ((rv = apr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen))
-                   != APR_SUCCESS) {
-            if (attr->errfn) {
-                attr->errfn(attr->pool, rv, 
-                            apr_pstrcat(attr->pool, 
+        if (password) {
+            len = strlen(password) + 1;
+            wlen = len;
+            wpassword = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t));
+            if ((rv = apr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen))
+                       != APR_SUCCESS) {
+                if (attr->errfn) {
+                    attr->errfn(attr->pool, rv, 
+                                apr_pstrcat(attr->pool, 
                                         "utf8 to ucs2 conversion failed" 
                                          " on password: ", password, NULL));
+                }
+                return rv;
             }
-            return rv;
         }
         if (!LogonUserW(wusername, 
                         NULL, 
-                        wpassword, 
+                        wpassword ? wpassword : L"",
                         LOGON32_LOGON_NETWORK,
                         LOGON32_PROVIDER_DEFAULT,
                         &user)) {
             /* Logon Failed */            
             return apr_get_os_error();
-        } 
-        memset(wpassword, 0, wlen * sizeof(apr_wchar_t));
+        }
+        if (wpassword)
+            memset(wpassword, 0, wlen * sizeof(apr_wchar_t));
         /* Get the primary token for user */
         if (!DuplicateTokenEx(user, 
                               TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, 

Mime
View raw message