summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-07-27 11:41:38 +0000
committertjr <tjr@FreeBSD.org>2003-07-27 11:41:38 +0000
commit84b3f90e1da5caa26a5cef8dc5bdee4f23476337 (patch)
tree46a679f46a7e7213e6c11117bb876d2e073d8d40
parente8459951b2a704b7f18d6d9db9404746885fc410 (diff)
downloadFreeBSD-src-84b3f90e1da5caa26a5cef8dc5bdee4f23476337.zip
FreeBSD-src-84b3f90e1da5caa26a5cef8dc5bdee4f23476337.tar.gz
Fix some off-by-one errors dealing with limits of server names,
usernames, workgroup names and passwords. We can now connect to servers with 15-character NetBIOS names. (Some versions of Windows use semi-random 15-char names by default.) PR: 46902
-rw-r--r--contrib/smbfs/lib/smb/ctx.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/smbfs/lib/smb/ctx.c b/contrib/smbfs/lib/smb/ctx.c
index 4036016..7a8d858 100644
--- a/contrib/smbfs/lib/smb/ctx.c
+++ b/contrib/smbfs/lib/smb/ctx.c
@@ -275,7 +275,7 @@ smb_ctx_setcharset(struct smb_ctx *ctx, const char *arg)
int
smb_ctx_setserver(struct smb_ctx *ctx, const char *name)
{
- if (strlen(name) >= SMB_MAXSRVNAMELEN) {
+ if (strlen(name) > SMB_MAXSRVNAMELEN) {
smb_error("server name '%s' too long", 0, name);
return ENAMETOOLONG;
}
@@ -286,7 +286,7 @@ smb_ctx_setserver(struct smb_ctx *ctx, const char *name)
int
smb_ctx_setuser(struct smb_ctx *ctx, const char *name)
{
- if (strlen(name) >= SMB_MAXUSERNAMELEN) {
+ if (strlen(name) > SMB_MAXUSERNAMELEN) {
smb_error("user name '%s' too long", 0, name);
return ENAMETOOLONG;
}
@@ -297,7 +297,7 @@ smb_ctx_setuser(struct smb_ctx *ctx, const char *name)
int
smb_ctx_setworkgroup(struct smb_ctx *ctx, const char *name)
{
- if (strlen(name) >= SMB_MAXUSERNAMELEN) {
+ if (strlen(name) > SMB_MAXUSERNAMELEN) {
smb_error("workgroup name '%s' too long", 0, name);
return ENAMETOOLONG;
}
@@ -310,7 +310,7 @@ smb_ctx_setpassword(struct smb_ctx *ctx, const char *passwd)
{
if (passwd == NULL)
return EINVAL;
- if (strlen(passwd) >= SMB_MAXPASSWORDLEN) {
+ if (strlen(passwd) > SMB_MAXPASSWORDLEN) {
smb_error("password too long", 0);
return ENAMETOOLONG;
}
@@ -325,7 +325,7 @@ smb_ctx_setpassword(struct smb_ctx *ctx, const char *passwd)
int
smb_ctx_setshare(struct smb_ctx *ctx, const char *share, int stype)
{
- if (strlen(share) >= SMB_MAXSHARENAMELEN) {
+ if (strlen(share) > SMB_MAXSHARENAMELEN) {
smb_error("share name '%s' too long", 0, share);
return ENAMETOOLONG;
}
OpenPOWER on IntegriCloud