diff options
Diffstat (limited to 'usr/src/lib/libsmbfs/smb/negprot.c')
-rw-r--r-- | usr/src/lib/libsmbfs/smb/negprot.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/usr/src/lib/libsmbfs/smb/negprot.c b/usr/src/lib/libsmbfs/smb/negprot.c index 9345cd8c47..770b742c44 100644 --- a/usr/src/lib/libsmbfs/smb/negprot.c +++ b/usr/src/lib/libsmbfs/smb/negprot.c @@ -32,11 +32,11 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2013 Nexenta Systems, Inc. All rights reserved. */ /* * SMB Negotiate Protocol, and related. - * Copied from the driver: smb_smb.c */ #include <errno.h> @@ -66,6 +66,7 @@ #include <netsmb/smb_dev.h> #include "charsets.h" +#include "smb_crypt.h" #include "private.h" /* @@ -87,6 +88,13 @@ static struct smb_dialect smb_dialects[] = { #define SMB_DIALECT_MAX \ (sizeof (smb_dialects) / sizeof (struct smb_dialect) - 2) +static const uint32_t smb_clnt_caps_mask = + SMB_CAP_UNICODE | + SMB_CAP_LARGE_FILES | + SMB_CAP_NT_SMBS | + SMB_CAP_STATUS32 | + SMB_CAP_EXT_SECURITY; + /* * SMB Negotiate Protocol * Based on code from the driver: smb_smb.c @@ -118,9 +126,16 @@ smb_negprot(struct smb_ctx *ctx, struct mbdata *oblob) * if we find out it doesn't. Need to do this because * some servers reject all non-Unicode requests. */ - ctx->ct_hflags = SMB_FLAGS_CASELESS; - ctx->ct_hflags2 = SMB_FLAGS2_KNOWS_LONG_NAMES | - SMB_FLAGS2_ERR_STATUS | SMB_FLAGS2_UNICODE; + ctx->ct_hflags = + SMB_FLAGS_CASELESS | + SMB_FLAGS_CANONICAL_PATHNAMES; + ctx->ct_hflags2 = + SMB_FLAGS2_KNOWS_LONG_NAMES | + SMB_FLAGS2_KNOWS_EAS | + /* SMB_FLAGS2_IS_LONG_NAME |? */ + /* EXT_SEC (see below) */ + SMB_FLAGS2_ERR_STATUS | + SMB_FLAGS2_UNICODE; /* * Sould we offer extended security? @@ -362,7 +377,7 @@ smb_negprot(struct smb_ctx *ctx, struct mbdata *oblob) err = EBADRPC; goto errout; } - err = md_get_mem(mbp, ctx->ct_ntlm_chal, + err = md_get_mem(mbp, ctx->ct_srv_chal, NTLM_CHAL_SZ, MB_MSYSTEM); /* * Server domain follows (ignored) @@ -423,6 +438,15 @@ smb_negprot(struct smb_ctx *ctx, struct mbdata *oblob) is->is_rxmax = len; is->is_wxmax = len; + /* + * Most of the "capability" bits we offer in session setup + * are just copied from those offered by the server. + */ + ctx->ct_clnt_caps = sv->sv_caps & smb_clnt_caps_mask; + + /* Get the client nonce. */ + (void) smb_get_urandom(ctx->ct_clnonce, NTLM_CHAL_SZ); + return (0); errout: |