summaryrefslogtreecommitdiff
path: root/usr/src/lib/libsmbfs
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libsmbfs')
-rw-r--r--usr/src/lib/libsmbfs/smb/ctx.c3
-rw-r--r--usr/src/lib/libsmbfs/smb/getaddr.c27
-rw-r--r--usr/src/lib/libsmbfs/smb/negprot.c24
3 files changed, 17 insertions, 37 deletions
diff --git a/usr/src/lib/libsmbfs/smb/ctx.c b/usr/src/lib/libsmbfs/smb/ctx.c
index be97571321..a4620bc457 100644
--- a/usr/src/lib/libsmbfs/smb/ctx.c
+++ b/usr/src/lib/libsmbfs/smb/ctx.c
@@ -1101,7 +1101,8 @@ smb_ctx_resolve(struct smb_ctx *ctx)
if (error) {
const char *ais = gai_strerror(error);
smb_error(dgettext(TEXT_DOMAIN,
- "can't get server address, %s"), 0, ais);
+ "can't resolve name\"%s\", %s"),
+ 0, ctx->ct_fullserver, ais);
return (ENODATA);
}
assert(ctx->ct_addrinfo != NULL);
diff --git a/usr/src/lib/libsmbfs/smb/getaddr.c b/usr/src/lib/libsmbfs/smb/getaddr.c
index 2847d858cb..67e61567a1 100644
--- a/usr/src/lib/libsmbfs/smb/getaddr.c
+++ b/usr/src/lib/libsmbfs/smb/getaddr.c
@@ -20,8 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -142,8 +141,6 @@ smb_ctx_getaddr(struct smb_ctx *ctx)
/*
* Default the server name we'll use in the
* protocol (i.e. NTLM, tree connect).
- * If we get a canonical name, we'll
- * overwrite this below.
*/
strlcpy(ctx->ct_srvname, ctx->ct_fullserver,
sizeof (ctx->ct_srvname));
@@ -159,25 +156,6 @@ smb_ctx_getaddr(struct smb_ctx *ctx)
hints.ai_socktype = SOCK_STREAM;
gaierr = getaddrinfo(srvaddr_str, NULL, &hints, &res);
if (gaierr == 0) {
-#if 1
- /*
- * XXX Temporarily work-around CR 6831339:
- * getaddrinfo() sets ai_canonname incorrectly
- */
- char tmphost[256];
- gaierr2 = getnameinfo(res->ai_addr, res->ai_addrlen,
- tmphost, sizeof (tmphost),
- NULL, 0, NI_NAMEREQD);
- if (gaierr2 == 0) {
- DPRINT("cname: %s", tmphost);
- strlcpy(ctx->ct_srvname, tmphost,
- sizeof (ctx->ct_srvname));
- }
-#else
- if (res->ai_canonname)
- strlcpy(ctx->ct_srvname, res->ai_canonname,
- sizeof (ctx->ct_srvname));
-#endif
ctx->ct_addrinfo = res;
return (0);
}
@@ -186,9 +164,6 @@ smb_ctx_getaddr(struct smb_ctx *ctx)
* If regular IP name lookup failed, try NetBIOS,
* but only if given a valid NetBIOS name and if
* NetBIOS name lookup is enabled.
- *
- * Note: we only have ssn_srvname if the full name
- * was also a valid NetBIOS name.
*/
if (nbc->nb_flags & NBCF_NS_ENABLE) {
gaierr2 = nbns_getaddrinfo(ctx->ct_fullserver, nbc, &res);
diff --git a/usr/src/lib/libsmbfs/smb/negprot.c b/usr/src/lib/libsmbfs/smb/negprot.c
index cd6e2866df..9345cd8c47 100644
--- a/usr/src/lib/libsmbfs/smb/negprot.c
+++ b/usr/src/lib/libsmbfs/smb/negprot.c
@@ -31,8 +31,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -111,13 +110,17 @@ smb_negprot(struct smb_ctx *ctx, struct mbdata *oblob)
/*
* Initialize: vc_hflags and vc_hflags2.
* Note: ctx->ct_hflags* are copied into the
- * (per request) rqp->rq_hflags* by smb_rq_init,
- * so changing them after that call will not
- * affect THIS request.
+ * (per request) rqp->rq_hflags* by smb_rq_init.
+ *
+ * Like Windows, set FLAGS2_UNICODE in our first request,
+ * even though technically we don't yet know whether the
+ * server supports Unicode. Will clear this flag below
+ * 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_ERR_STATUS |
- SMB_FLAGS2_KNOWS_LONG_NAMES);
+ ctx->ct_hflags2 = SMB_FLAGS2_KNOWS_LONG_NAMES |
+ SMB_FLAGS2_ERR_STATUS | SMB_FLAGS2_UNICODE;
/*
* Sould we offer extended security?
@@ -276,11 +279,12 @@ smb_negprot(struct smb_ctx *ctx, struct mbdata *oblob)
}
DPRINT("Security signatures: %d", will_sign);
- if (sv->sv_caps & SMB_CAP_UNICODE) {
+ /* See comment above re. FLAGS2_UNICODE */
+ if (sv->sv_caps & SMB_CAP_UNICODE)
ctx->ct_vcflags |= SMBV_UNICODE;
- ctx->ct_hflags2 |= SMB_FLAGS2_UNICODE;
+ else
+ ctx->ct_hflags2 &= ~SMB_FLAGS2_UNICODE;
- }
if ((sv->sv_caps & SMB_CAP_STATUS32) == 0) {
/*
* They don't do NT error codes.