From commits-return-6455-apmail-apr-commits-archive=apr.apache.org@apr.apache.org Mon Jan 17 10:39:24 2005 Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 27547 invoked from network); 17 Jan 2005 10:39:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 Jan 2005 10:39:24 -0000 Received: (qmail 7340 invoked by uid 500); 17 Jan 2005 10:39:23 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 7297 invoked by uid 500); 17 Jan 2005 10:39:23 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list commits@apr.apache.org Received: (qmail 7282 invoked by uid 99); 17 Jan 2005 10:39:23 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 17 Jan 2005 02:39:22 -0800 Received: (qmail 27520 invoked by uid 65534); 17 Jan 2005 10:39:21 -0000 Date: 17 Jan 2005 10:39:21 -0000 Message-ID: <20050117103921.27518.qmail@minotaur.apache.org> From: mturk@apache.org To: commits@apr.apache.org Subject: svn commit: r125406 - /apr/apr/trunk/threadproc/win32/proc.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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,