From patchwork Sun Jul 21 20:21:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Lovenberg X-Patchwork-Id: 2830938 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 609D19F243 for ; Sun, 21 Jul 2013 20:21:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65ADB20134 for ; Sun, 21 Jul 2013 20:21:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2765920131 for ; Sun, 21 Jul 2013 20:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756013Ab3GUUVe (ORCPT ); Sun, 21 Jul 2013 16:21:34 -0400 Received: from mail-qc0-f179.google.com ([209.85.216.179]:57391 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755822Ab3GUUVe (ORCPT ); Sun, 21 Jul 2013 16:21:34 -0400 Received: by mail-qc0-f179.google.com with SMTP id e11so3297822qcx.10 for ; Sun, 21 Jul 2013 13:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=agk9pT2DAzDyPDF3djWnGSl8XT4Q5kFBnNmoDM1AQZ0=; b=cQ4YZLiHLyBfkUWGcU81FvjGgiqNfKLaHp7yL95ge1injATproRs9Au5v699m0lFnI 7V4uizo4vRkH3GtdROb6XxHZE67qp6gFul6TpKOa010pNJelXIwqPY81GuDiK8jCnh80 nRNK0TkVJJCUyIhaBqfF9h4879Ov0mP9jMa+UofnRfy3Y9TsAjbfMpEhKCgL/KmekCFZ PPz1XhTPHLps6TnVz1b85doA2vGapHIpBfl5dLDq/NM2jAOgVDUQ3if78DPJ9MprApMJ wDqwJlt6fIg9pZE+ytokLe0+e65TS/6BCW6sJ3x2HZv4i8lBdPEA4L1QiiZaOcVZ+KYH VPaw== X-Received: by 10.224.96.138 with SMTP id h10mr30117595qan.8.1374438093254; Sun, 21 Jul 2013 13:21:33 -0700 (PDT) Received: from nix.cleftstone.net ([64.9.42.64]) by mx.google.com with ESMTPSA id y4sm37253003qai.5.2013.07.21.13.21.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 21 Jul 2013 13:21:32 -0700 (PDT) From: scott.lovenberg@gmail.com To: jlayton@redhat.com Cc: Scott Lovenberg , gang.chen@asianux.com, sfrench@samba.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH] cifs-utils: Correct max string lengths v2 Date: Sun, 21 Jul 2013 16:21:08 -0400 Message-Id: <1374438068-2868-1-git-send-email-scott.lovenberg@gmail.com> X-Mailer: git-send-email 1.8.1.4 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Scott Lovenberg The max size of the username, domain, and password strings are now consistent with the kernel and Microsoft's documentation. Signed-off-by: Scott Lovenberg --- AUTHORS | 2 ++ mount.cifs.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 2807079..2f6a14d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,5 +5,7 @@ Shirish Pargaonkar Suresh Jayaraman Pavel Shilovsky Igor Druzhinin +Scott Lovenberg + ...and others. diff --git a/mount.cifs.c b/mount.cifs.c index 3b2b89e..77ea0f8 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -84,21 +84,30 @@ #define MTAB_OPTIONS_LEN 220 /* - * Maximum length of "share" portion of a UNC. I have no idea if this is at - * all valid. According to MSDN, the typical max length of any component is - * 255, so use that here. + * Max share name, username, password and domain sizes match the kernel's + * allowances for these string sizes which in turn match Microsoft's + * documentation. */ + +/* Max length of the share name portion of a UNC. Share names over 80 + * characters cannot be accessed via commandline in Windows 2000/XP. */ #define MAX_SHARE_LEN 256 -/* max length of username (somewhat made up here) */ -#define MAX_USERNAME_SIZE 32 +/* Max user name length. */ +#define MAX_USERNAME_SIZE 256 + +/* Max domain size. */ +#define MAX_DOMAIN_SIZE 256 + +/* Max password size. */ +#define MOUNT_PASSWD_SIZE 512 + + #ifndef SAFE_FREE #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x = NULL; } } while (0) #endif -#define MOUNT_PASSWD_SIZE 128 -#define MAX_DOMAIN_SIZE 64 /* * mount.cifs has been the subject of many "security" bugs that have arisen