From owner-freebsd-fs Thu Aug 29 7:36:15 2002 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B0B137B400 for ; Thu, 29 Aug 2002 07:36:12 -0700 (PDT) Received: from scrooge.etek.chalmers.se (scrooge.etek.chalmers.se [129.16.32.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 367E343E42 for ; Thu, 29 Aug 2002 07:36:11 -0700 (PDT) (envelope-from b@etek.chalmers.se) Received: from scrooge.etek.chalmers.se (b@localhost [127.0.0.1]) by scrooge.etek.chalmers.se (8.12.3/8.12.3) with ESMTP id g7TEaA9E012136 for ; Thu, 29 Aug 2002 16:36:10 +0200 (CEST) (envelope-from b@etek.chalmers.se) Received: from localhost (b@localhost) by scrooge.etek.chalmers.se (8.12.3/8.12.3/Submit) with ESMTP id g7TEa9UL012133 for ; Thu, 29 Aug 2002 16:36:10 +0200 (CEST) X-Authentication-Warning: scrooge.etek.chalmers.se: b owned process doing -bs Date: Thu, 29 Aug 2002 16:36:09 +0200 (CEST) From: Magnus B{ckstr|m To: freebsd-fs@freebsd.org Subject: smbfs password capitalization Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org smbfs(4) capitalizes the password before attempting to authenticate to an SMB server. This ceased being a good idea once even m$ admitted the benefits of mixed-case passwords; can/should we change it? I propose the below patch. Magnus diff -u src/sys/netsmb.ORIG/smb_conn.c src/sys/netsmb/smb_conn.c --- src/sys/netsmb.ORIG/smb_conn.c Wed Aug 7 12:53:52 2002 +++ src/sys/netsmb/smb_conn.c Thu Aug 29 17:29:43 2002 @@ -429,7 +429,6 @@ ierror((vcp->vc_username = smb_strdup(vcspec->username)) == NULL, ENOMEM); ithrow(iconv_open("tolower", vcspec->localcs, &vcp->vc_tolower)); - ithrow(iconv_open("toupper", vcspec->localcs, &vcp->vc_toupper)); if (vcspec->servercs[0]) { ithrow(iconv_open(vcspec->servercs, vcspec->localcs, &vcp->vc_toserver)); @@ -464,8 +463,6 @@ free(vcp->vc_laddr, M_SONAME); if (vcp->vc_tolower) iconv_close(vcp->vc_tolower); - if (vcp->vc_toupper) - iconv_close(vcp->vc_toupper); if (vcp->vc_tolocal) iconv_close(vcp->vc_tolocal); if (vcp->vc_toserver) diff -u src/sys/netsmb.ORIG/smb_conn.h src/sys/netsmb/smb_conn.h --- src/sys/netsmb.ORIG/smb_conn.h Thu Feb 21 17:13:19 2002 +++ src/sys/netsmb/smb_conn.h Thu Aug 29 17:29:14 2002 @@ -244,7 +244,6 @@ int vc_maxvcs; /* maximum number of VC per connection */ void * vc_tolower; /* local charset */ - void * vc_toupper; /* local charset */ void * vc_toserver; /* local charset to server one */ void * vc_tolocal; /* server charset to local one */ int vc_number; /* number of this VC from the client side */ diff -u src/sys/netsmb.ORIG/smb_smb.c src/sys/netsmb/smb_smb.c --- src/sys/netsmb.ORIG/smb_smb.c Thu Feb 21 17:18:39 2002 +++ src/sys/netsmb/smb_smb.c Thu Aug 29 17:06:04 2002 @@ -247,7 +247,7 @@ pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); encpass = malloc(24, M_SMBTEMP, M_WAITOK); if (vcp->vc_sopt.sv_sm & SMB_SM_USER) { - iconv_convstr(vcp->vc_toupper, pbuf, smb_vc_getpass(vcp)); + strncpy(pbuf, smb_vc_getpass(vcp), SMB_MAXPASSWORDLEN); iconv_convstr(vcp->vc_toserver, pbuf, pbuf); if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) { uniplen = plen = 24; @@ -415,7 +415,7 @@ } else { pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); encpass = malloc(24, M_SMBTEMP, M_WAITOK); - iconv_convstr(vcp->vc_toupper, pbuf, smb_share_getpass(ssp)); + strncpy(pbuf, smb_share_getpass(ssp), SMB_MAXPASSWORDLEN); iconv_convstr(vcp->vc_toserver, pbuf, pbuf); if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) { plen = 24; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message