From owner-freebsd-bugs@FreeBSD.ORG Wed Mar 4 09:10:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC8D41065672 for ; Wed, 4 Mar 2009 09:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 87AAD8FC19 for ; Wed, 4 Mar 2009 09:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n249A1tU007829 for ; Wed, 4 Mar 2009 09:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n249A1OR007828; Wed, 4 Mar 2009 09:10:01 GMT (envelope-from gnats) Resent-Date: Wed, 4 Mar 2009 09:10:01 GMT Resent-Message-Id: <200903040910.n249A1OR007828@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, David Horn Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E0741065673 for ; Wed, 4 Mar 2009 09:01:02 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 866988FC1B for ; Wed, 4 Mar 2009 09:01:02 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n24912CK069831 for ; Wed, 4 Mar 2009 09:01:02 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n24912ZS069830; Wed, 4 Mar 2009 09:01:02 GMT (envelope-from nobody) Message-Id: <200903040901.n24912ZS069830@www.freebsd.org> Date: Wed, 4 Mar 2009 09:01:02 GMT From: David Horn To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/132302: [patch] contrib/smbfs subr.c: saved passwords >18 char fail X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 09:10:02 -0000 >Number: 132302 >Category: bin >Synopsis: [patch] contrib/smbfs subr.c: saved passwords >18 char fail >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 04 09:10:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: David Horn >Release: -current as of 20090304 >Organization: >Environment: FreeBSD top-bsd 8.0-CURRENT FreeBSD 8.0-CURRENT #2: Thu Feb 26 03:23:18 EST 2009 dhorn@top-bsd:/usr/obj/usr/src/sys/DHORN i386 >Description: If a user has a saved password (encrypted using `smbutil crypt`)for smbfs that is longer than 18 characters, the smb_simplecrypt() and smb_simpledecrypt() functions will not work properly causing authentication failures. e.g. /etc/nsmb.conf [SERVER:USER] password=$$178465324253e0c07f5f6fcc8d0a3b3bc8d8d131212 /usr/src/contrib/smbfs/lib/smb/subr.c >How-To-Repeat: 1) Have a samba server 2) Have an account on samba server that has a long password (>18 characters) 3) Create your simple encrypted password using `smbutil crypt` for use in nsmb.conf 4) Save your password into ~/nsmb.conf or /etc/nsmb.conf under the appropriate [SERVER:USER] heading. >Fix: -Don't try to bitwise xor with >=255. This patch maintains backwards compatibility with people who already use nsmb.conf with shorter (<=17 char) passwords successfully. Unified diff patch attached. Patch attached with submission follows: --- subr.c~ 2001-12-20 11:16:25.000000000 -0500 +++ subr.c 2009-03-04 03:29:07.000000000 -0500 @@ -232,6 +232,7 @@ islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); ch ^= pos; pos += 13; + if (pos > 248) pos -= 220; sprintf(dst, "%02x", ch); dst += 2; } @@ -262,6 +263,7 @@ return EINVAL; ch ^= pos; pos += 13; + if (pos > 248) pos -= 220; if (isascii(ch)) ch = (isupper(ch) ? ('A' + (ch - 'A' + 13) % 26) : islower(ch) ? ('a' + (ch - 'a' + 13) % 26) : ch); >Release-Note: >Audit-Trail: >Unformatted: