Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2002 16:36:09 +0200 (CEST)
From:      Magnus B{ckstr|m <b@etek.chalmers.se>
To:        freebsd-fs@freebsd.org
Subject:   smbfs password capitalization
Message-ID:  <Pine.BSF.4.44.0208291614360.10757-100000@scrooge.etek.chalmers.se>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.44.0208291614360.10757-100000>