diff options
author | Jordan Brown <Jordan.Brown@Sun.COM> | 2009-11-05 14:34:36 -0800 |
---|---|---|
committer | Jordan Brown <Jordan.Brown@Sun.COM> | 2009-11-05 14:34:36 -0800 |
commit | bbf6f00c25b6a2bed23c35eac6d62998ecdb338c (patch) | |
tree | 8cf72fd47362b5b0da2ffe9be7fe7726a3d24426 | |
parent | d95ac3ffcdcc13296bb4c53f621f72c0535f32c3 (diff) | |
download | illumos-gate-bbf6f00c25b6a2bed23c35eac6d62998ecdb338c.tar.gz |
6747532 ns_lookup_bypid spams syslog with too many messages
6888836 Not listing all files in a directory of a CIFS share in Windows XP
6812570 Trans2 is missing pass-through levels: FILE_RENAME_INFORMATION (and others)
6888827 Add Unicode codepage support
6865488 libadutils: leak in ldap_lookup_domains_in_forest()
6888708 idmapd crashing periodically. Need cores analyzed.
6891342 invalid, redundant SQL in rule WHERE expressions
6891767 minor cleanups in idmap
6892544 Panic occurred at smb_node_ref+0x7f(ffffffd612297310)
--HG--
rename : usr/src/uts/common/smbsrv/cifs.h => usr/src/uts/common/smbsrv/smb.h
157 files changed, 3242 insertions, 6478 deletions
diff --git a/usr/src/cmd/idmap/idmapd/dbutils.c b/usr/src/cmd/idmap/idmapd/dbutils.c index aed92d22ed..b927461d6d 100644 --- a/usr/src/cmd/idmap/idmapd/dbutils.c +++ b/usr/src/cmd/idmap/idmapd/dbutils.c @@ -602,6 +602,7 @@ gen_sql_expr_from_rule(idmap_namerule *rule, char **out) { char *s_windomain = NULL, *s_winname = NULL; char *s_unixname = NULL; + char *dir; char *lower_winname; int retcode = IDMAP_SUCCESS; @@ -642,10 +643,28 @@ gen_sql_expr_from_rule(idmap_namerule *rule, char **out) } } - *out = sqlite_mprintf("%s %s %s", + switch (rule->direction) { + case IDMAP_DIRECTION_BI: + dir = "AND w2u_order > 0 AND u2w_order > 0"; + break; + case IDMAP_DIRECTION_W2U: + dir = "AND w2u_order > 0" + " AND (u2w_order = 0 OR u2w_order ISNULL)"; + break; + case IDMAP_DIRECTION_U2W: + dir = "AND u2w_order > 0" + " AND (w2u_order = 0 OR w2u_order ISNULL)"; + break; + default: + dir = ""; + break; + } + + *out = sqlite_mprintf("%s %s %s %s", s_windomain ? s_windomain : "", s_winname ? s_winname : "", - s_unixname ? s_unixname : ""); + s_unixname ? s_unixname : "", + dir); if (*out == NULL) { retcode = IDMAP_ERR_MEMORY; @@ -945,31 +964,17 @@ rm_namerule(sqlite *db, idmap_namerule *rule) { char *sql = NULL; idmap_stat retcode; - char buf[80]; char *expr = NULL; if (rule->direction < 0 && EMPTY_STRING(rule->windomain) && EMPTY_STRING(rule->winname) && EMPTY_STRING(rule->unixname)) return (IDMAP_SUCCESS); - buf[0] = 0; - - if (rule->direction == IDMAP_DIRECTION_BI) - (void) snprintf(buf, sizeof (buf), "AND w2u_order > 0" - " AND u2w_order > 0"); - else if (rule->direction == IDMAP_DIRECTION_W2U) - (void) snprintf(buf, sizeof (buf), "AND w2u_order > 0" - " AND (u2w_order = 0 OR u2w_order ISNULL)"); - else if (rule->direction == IDMAP_DIRECTION_U2W) - (void) snprintf(buf, sizeof (buf), "AND u2w_order > 0" - " AND (w2u_order = 0 OR w2u_order ISNULL)"); - retcode = gen_sql_expr_from_rule(rule, &expr); if (retcode != IDMAP_SUCCESS) goto out; - sql = sqlite_mprintf("DELETE FROM namerules WHERE 1 %s %s;", expr, - buf); + sql = sqlite_mprintf("DELETE FROM namerules WHERE 1 %s;", expr); if (sql == NULL) { retcode = IDMAP_ERR_INTERNAL; @@ -2683,8 +2688,6 @@ ns_lookup_byname(const char *name, const char *lower_name, idmap_id *id) struct passwd pwd, *pwdp; struct group grp, *grpp; char *buf; - int errnum; - const char *me = "ns_lookup_byname"; static size_t pwdbufsiz = 0; static size_t grpbufsiz = 0; @@ -2698,11 +2701,7 @@ ns_lookup_byname(const char *name, const char *lower_name, idmap_id *id) name != lower_name && strcmp(name, lower_name) != 0) pwdp = getpwnam_r(lower_name, &pwd, buf, pwdbufsiz); if (pwdp == NULL) { - errnum = errno; - idmapdlog(LOG_WARNING, - "%s: getpwnam_r(%s) failed (%s).", - me, name, errnum ? strerror(errnum) : "not found"); - if (errnum == 0) + if (errno == 0) return (IDMAP_ERR_NOTFOUND); else return (IDMAP_ERR_INTERNAL); @@ -2718,11 +2717,7 @@ ns_lookup_byname(const char *name, const char *lower_name, idmap_id *id) name != lower_name && strcmp(name, lower_name) != 0) grpp = getgrnam_r(lower_name, &grp, buf, grpbufsiz); if (grpp == NULL) { - errnum = errno; - idmapdlog(LOG_WARNING, - "%s: getgrnam_r(%s) failed (%s).", - me, name, errnum ? strerror(errnum) : "not found"); - if (errnum == 0) + if (errno == 0) return (IDMAP_ERR_NOTFOUND); else return (IDMAP_ERR_INTERNAL); @@ -2746,8 +2741,6 @@ ns_lookup_bypid(uid_t pid, int is_user, char **unixname) struct passwd pwd; struct group grp; char *buf; - int errnum; - const char *me = "ns_lookup_bypid"; static size_t pwdbufsiz = 0; static size_t grpbufsiz = 0; @@ -2757,11 +2750,7 @@ ns_lookup_bypid(uid_t pid, int is_user, char **unixname) buf = alloca(pwdbufsiz); errno = 0; if (getpwuid_r(pid, &pwd, buf, pwdbufsiz) == NULL) { - errnum = errno; - idmapdlog(LOG_WARNING, - "%s: getpwuid_r(%u) failed (%s).", - me, pid, errnum ? strerror(errnum) : "not found"); - if (errnum == 0) + if (errno == 0) return (IDMAP_ERR_NOTFOUND); else return (IDMAP_ERR_INTERNAL); @@ -2773,11 +2762,7 @@ ns_lookup_bypid(uid_t pid, int is_user, char **unixname) buf = alloca(grpbufsiz); errno = 0; if (getgrgid_r(pid, &grp, buf, grpbufsiz) == NULL) { - errnum = errno; - idmapdlog(LOG_WARNING, - "%s: getgrgid_r(%u) failed (%s).", - me, pid, errnum ? strerror(errnum) : "not found"); - if (errnum == 0) + if (errno == 0) return (IDMAP_ERR_NOTFOUND); else return (IDMAP_ERR_INTERNAL); diff --git a/usr/src/cmd/idmap/idmapd/idmapd.c b/usr/src/cmd/idmap/idmapd/idmapd.c index 0fb05067b9..aea2fcc634 100644 --- a/usr/src/cmd/idmap/idmapd/idmapd.c +++ b/usr/src/cmd/idmap/idmapd/idmapd.c @@ -282,9 +282,9 @@ main(int argc, char **argv) _idmapdstate.daemon_mode = FALSE; break; default: - fprintf(stderr, "Usage: /usr/lib/idmapd"); + (void) fprintf(stderr, + "Usage: /usr/lib/idmapd [-d]\n"); return (SMF_EXIT_ERR_CONFIG); - break; } } diff --git a/usr/src/cmd/idmap/idmapd/server.c b/usr/src/cmd/idmap/idmapd/server.c index 8c26069a9f..59d53a2a98 100644 --- a/usr/src/cmd/idmap/idmapd/server.c +++ b/usr/src/cmd/idmap/idmapd/server.c @@ -560,7 +560,6 @@ idmap_list_mappings_1_svc(int64_t lastrowid, uint64_t limit, int32_t flag, time_t curtime; (void) memset(result, 0, sizeof (*result)); - lbuf[0] = rbuf[0] = 0; /* Current time */ errno = 0; @@ -588,6 +587,8 @@ idmap_list_mappings_1_svc(int64_t lastrowid, uint64_t limit, int32_t flag, if (limit > 0) (void) snprintf(lbuf, sizeof (lbuf), "LIMIT %" PRIu64, limit + 1ULL); + else + lbuf[0] = '\0'; (void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid); @@ -704,7 +705,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid, { sqlite *db = NULL; - char w2ubuf[15], u2wbuf[15]; char lbuf[30], rbuf[30]; char *sql = NULL; char *expr = NULL; @@ -712,7 +712,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid, idmap_retcode retcode; (void) memset(result, 0, sizeof (*result)); - lbuf[0] = rbuf[0] = 0; result->retcode = validate_rule(&rule); if (result->retcode != IDMAP_SUCCESS) @@ -727,22 +726,6 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid, if (result->retcode != IDMAP_SUCCESS) goto out; - result->retcode = IDMAP_ERR_INTERNAL; - - w2ubuf[0] = u2wbuf[0] = 0; - if (rule.direction == IDMAP_DIRECTION_BI) { - (void) snprintf(w2ubuf, sizeof (w2ubuf), "AND w2u_order > 0"); - (void) snprintf(u2wbuf, sizeof (u2wbuf), "AND u2w_order > 0"); - } else if (rule.direction == IDMAP_DIRECTION_W2U) { - (void) snprintf(w2ubuf, sizeof (w2ubuf), "AND w2u_order > 0"); - (void) snprintf(u2wbuf, sizeof (u2wbuf), - "AND (u2w_order = 0 OR u2w_order ISNULL)"); - } else if (rule.direction == IDMAP_DIRECTION_U2W) { - (void) snprintf(w2ubuf, sizeof (w2ubuf), - "AND (w2u_order = 0 OR w2u_order ISNULL)"); - (void) snprintf(u2wbuf, sizeof (u2wbuf), "AND u2w_order > 0"); - } - result->retcode = gen_sql_expr_from_rule(&rule, &expr); if (result->retcode != IDMAP_SUCCESS) goto out; @@ -753,6 +736,8 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid, if (limit > 0) (void) snprintf(lbuf, sizeof (lbuf), "LIMIT %" PRIu64, limit + 1ULL); + else + lbuf[0] = '\0'; (void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid); @@ -763,8 +748,8 @@ idmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid, sql = sqlite_mprintf("SELECT rowid, is_user, is_wuser, windomain, " "winname_display, is_nt4, unixname, w2u_order, u2w_order " "FROM namerules WHERE " - " %s %s %s %s %s;", - rbuf, expr, w2ubuf, u2wbuf, lbuf); + " %s %s %s;", + rbuf, expr, lbuf); if (sql == NULL) { result->retcode = IDMAP_ERR_MEMORY; diff --git a/usr/src/cmd/smbsrv/smbadm/smbadm.c b/usr/src/cmd/smbsrv/smbadm/smbadm.c index c0def01d2d..0d23caf6fb 100644 --- a/usr/src/cmd/smbsrv/smbadm/smbadm.c +++ b/usr/src/cmd/smbsrv/smbadm/smbadm.c @@ -754,7 +754,7 @@ smbadm_valid_workgroup(const char *workgroup) return (B_FALSE); if (smb_getnetbiosname(netbiosname, NETBIOS_NAME_SZ) == 0) { - if (utf8_strcasecmp(workgroup, netbiosname) == 0) + if (smb_strcasecmp(workgroup, netbiosname, 0) == 0) return (B_FALSE); } diff --git a/usr/src/cmd/smbsrv/smbd/smbd_join.c b/usr/src/cmd/smbsrv/smbd/smbd_join.c index 8c05c10f0e..a4b57bbeb5 100644 --- a/usr/src/cmd/smbsrv/smbd/smbd_join.c +++ b/usr/src/cmd/smbsrv/smbd/smbd_join.c @@ -122,7 +122,7 @@ smbd_set_netlogon_cred(void) */ (void) smb_getsamaccount(sam_acct, sizeof (sam_acct)); smb_ipc_get_user(ipc_usr, SMB_USERNAME_MAXLEN); - if (utf8_strcasecmp(ipc_usr, sam_acct)) + if (smb_strcasecmp(ipc_usr, sam_acct, 0)) return (B_FALSE); di = &dxi.d_primary; @@ -133,7 +133,7 @@ smbd_set_netlogon_cred(void) sizeof (kpasswd_domain)); if (*kpasswd_domain != '\0' && - utf8_strcasecmp(kpasswd_domain, di->di_fqname)) { + smb_strcasecmp(kpasswd_domain, di->di_fqname, 0)) { dom = kpasswd_domain; new_domain = B_TRUE; } else { @@ -145,7 +145,7 @@ smbd_set_netlogon_cred(void) * currently cached or the SMB daemon has previously discovered a DC * that is different than the kpasswd server. */ - if (new_domain || utf8_strcasecmp(dxi.d_dc, kpasswd_srv) != 0) { + if (new_domain || smb_strcasecmp(dxi.d_dc, kpasswd_srv, 0) != 0) { if (*dxi.d_dc != '\0') mlsvc_disconnect(dxi.d_dc); @@ -217,7 +217,7 @@ smbd_locate_dc_thread(void *arg) } else { if (smb_getfqdomainname(domain, MAXHOSTNAMELEN) != 0) { (void) smb_getdomainname(domain, MAXHOSTNAMELEN); - (void) utf8_strupr(domain); + (void) smb_strupr(domain); } if (smb_locate_dc(domain, "", &new_domain)) { diff --git a/usr/src/cmd/smbsrv/smbd/smbd_main.c b/usr/src/cmd/smbsrv/smbd/smbd_main.c index 022d34cf2b..c1d1f9427a 100644 --- a/usr/src/cmd/smbsrv/smbd/smbd_main.c +++ b/usr/src/cmd/smbsrv/smbd/smbd_main.c @@ -52,6 +52,7 @@ #include <smbsrv/smb_door_svc.h> #include <smbsrv/smb_ioctl.h> +#include <smbsrv/string.h> #include <smbsrv/libsmb.h> #include <smbsrv/libsmbns.h> #include <smbsrv/libmlsvc.h> @@ -433,8 +434,7 @@ smbd_service_init(void) return (1); } - - (void) oem_language_set("english"); + smb_codepage_init(); if (!smb_wka_init()) { smbd_report("out of memory"); diff --git a/usr/src/common/smbsrv/smb_match.c b/usr/src/common/smbsrv/smb_match.c index 0d612b3daf..88758926fe 100644 --- a/usr/src/common/smbsrv/smb_match.c +++ b/usr/src/common/smbsrv/smb_match.c @@ -30,7 +30,8 @@ #include <sys/types.h> #include <sys/sunddi.h> #endif -#include <smbsrv/ctype.h> +#include <smbsrv/string.h> +#include <smbsrv/smb.h> /* * Maximum recursion depth for the wildcard match functions. @@ -80,8 +81,8 @@ smb_match_private(const char *patn, const char *str, int *depth) for (;;) { switch (*patn) { - case 0: - return (*str == 0); + case '\0': + return (*str == '\0'); case '?': if (*str != 0) { @@ -95,7 +96,7 @@ smb_match_private(const char *patn, const char *str, int *depth) case '*': patn += strspn(patn, "*"); - if (*patn == 0) + if (*patn == '\0') return (1); if ((*depth)++ >= SMB_MATCH_DEPTH_MAX) @@ -128,7 +129,8 @@ smb_match83(char *patn, char *str83) char name83[14]; ptr = name83; - for (avail = 8; (avail > 0) && (*patn != '.') && (*patn != 0); + for (avail = SMB_NAME83_BASELEN; + (avail > 0) && (*patn != '.') && (*patn != 0); avail--) { *(ptr++) = *(patn++); } @@ -141,7 +143,7 @@ smb_match83(char *patn, char *str83) else if (*patn != 0) return (0); - for (avail = 3; (avail > 0) && (*patn != 0); avail--) { + for (avail = SMB_NAME83_EXTLEN; (avail > 0) && (*patn != 0); avail--) { *(ptr++) = *(patn++); } if (*patn != 0) @@ -187,8 +189,10 @@ smb_match_ci(char *patn, char *str) static int smb_match_ci_private(const char *patn, const char *str, int *depth) { - const char *p; - int rc; + const char *p; + smb_wchar_t wc1, wc2; + int nbytes1, nbytes2; + int rc; /* * "<" is a special pattern that matches only those names that do @@ -204,8 +208,8 @@ smb_match_ci_private(const char *patn, const char *str, int *depth) for (;;) { switch (*patn) { - case 0: - return (*str == 0); + case '\0': + return (*str == '\0'); case '?': if (*str != 0) { @@ -221,7 +225,7 @@ smb_match_ci_private(const char *patn, const char *str, int *depth) case '*': patn += strspn(patn, "*"); - if (*patn == 0) + if (*patn == '\0') return (1); if ((*depth)++ >= SMB_MATCH_DEPTH_MAX) @@ -236,17 +240,20 @@ smb_match_ci_private(const char *patn, const char *str, int *depth) return (0); default: - if (*str != *patn) { - int c1 = *str; - int c2 = *patn; + nbytes1 = smb_mbtowc(&wc1, patn, MTS_MB_CHAR_MAX); + nbytes2 = smb_mbtowc(&wc2, str, MTS_MB_CHAR_MAX); + if ((nbytes1 == -1) || (nbytes2 == -1)) + return (-1); - c1 = mts_tolower(c1); - c2 = mts_tolower(c2); - if (c1 != c2) + if (wc1 != wc2) { + wc1 = smb_tolower(wc1); + wc2 = smb_tolower(wc2); + if (wc1 != wc2) return (0); } - str++; - patn++; + + patn += nbytes1; + str += nbytes2; continue; } } diff --git a/usr/src/common/smbsrv/smb_msgbuf.c b/usr/src/common/smbsrv/smb_msgbuf.c index d456dac683..2530a4f5ef 100644 --- a/usr/src/common/smbsrv/smb_msgbuf.c +++ b/usr/src/common/smbsrv/smb_msgbuf.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Msgbuf buffer management implementation. The smb_msgbuf interface is * typically used to encode or decode SMB data using sprintf/scanf @@ -52,7 +50,7 @@ static int buf_decode(smb_msgbuf_t *, char *, va_list ap); static int buf_encode(smb_msgbuf_t *, char *, va_list ap); static void *smb_msgbuf_malloc(smb_msgbuf_t *, size_t); static int smb_msgbuf_chkerc(char *text, int erc); -static void buf_decode_wcs(mts_wchar_t *, mts_wchar_t *, int wcstrlen); +static void buf_decode_wcs(smb_wchar_t *, smb_wchar_t *, int wcstrlen); /* * Returns the offset or number of bytes used within the buffer. @@ -221,7 +219,7 @@ buf_decode(smb_msgbuf_t *mb, char *fmt, va_list ap) uint16_t *wvalp; uint32_t *lvalp; uint64_t *llvalp; - mts_wchar_t *wcs; + smb_wchar_t *wcs; int repc; int rc; @@ -328,7 +326,7 @@ buf_decode(smb_msgbuf_t *mb, char *fmt, va_list ap) if ((cvalp = smb_msgbuf_malloc(mb, ival * 2)) == 0) return (SMB_MSGBUF_UNDERFLOW); - if ((ival = mts_stombs((char *)cvalp, + if ((ival = smb_stombs((char *)cvalp, (char *)mb->scan, ival * 2)) == (uint32_t)-1) { return (SMB_MSGBUF_DATA_ERROR); @@ -349,12 +347,12 @@ unicode_translation: */ smb_msgbuf_word_align(mb); /*LINTED E_BAD_PTR_CAST_ALIGN*/ - wcs = (mts_wchar_t *)mb->scan; + wcs = (smb_wchar_t *)mb->scan; /* count the null wchar */ - repc = sizeof (mts_wchar_t); + repc = sizeof (smb_wchar_t); while (*wcs++) - repc += sizeof (mts_wchar_t); + repc += sizeof (smb_wchar_t); if (smb_msgbuf_has_space(mb, repc) == 0) return (SMB_MSGBUF_UNDERFLOW); @@ -364,15 +362,15 @@ unicode_translation: return (SMB_MSGBUF_UNDERFLOW); /*LINTED E_BAD_PTR_CAST_ALIGN*/ - buf_decode_wcs(wcs, (mts_wchar_t *)mb->scan, - repc / sizeof (mts_wchar_t)); + buf_decode_wcs(wcs, (smb_wchar_t *)mb->scan, + repc / sizeof (smb_wchar_t)); /* Get space for translated string */ if ((cvalp = smb_msgbuf_malloc(mb, repc * 2)) == 0) return (SMB_MSGBUF_UNDERFLOW); /* Translate string */ - (void) mts_wcstombs((char *)cvalp, wcs, repc * 2); + (void) smb_wcstombs((char *)cvalp, wcs, repc * 2); cvalpp = va_arg(ap, uint8_t **); *cvalpp = cvalp; @@ -450,7 +448,7 @@ buf_encode(smb_msgbuf_t *mb, char *fmt, va_list ap) uint32_t ival; uint8_t *cvalp; uint8_t c; - mts_wchar_t wcval; + smb_wchar_t wcval; int count; int repc = 1; int rc; @@ -559,7 +557,7 @@ buf_encode(smb_msgbuf_t *mb, char *fmt, va_list ap) return (SMB_MSGBUF_OVERFLOW); ival = - mts_mbstos((char *)mb->scan, (const char *)cvalp); + smb_mbstos((char *)mb->scan, (const char *)cvalp); mb->scan += ival + 1; break; @@ -573,11 +571,11 @@ unicode_translation: for (;;) { rc = smb_msgbuf_has_space(mb, - sizeof (mts_wchar_t)); + sizeof (smb_wchar_t)); if (rc == 0) return (SMB_MSGBUF_OVERFLOW); - count = mts_mbtowc(&wcval, (const char *)cvalp, + count = smb_mbtowc(&wcval, (const char *)cvalp, MTS_MB_CHAR_MAX); if (count < 0) { @@ -605,11 +603,11 @@ unicode_translation: if ((mb->flags & SMB_MSGBUF_NOTERM) == 0) mb->scan += - sizeof (mts_wchar_t); + sizeof (smb_wchar_t); break; } - mb->scan += sizeof (mts_wchar_t); + mb->scan += sizeof (smb_wchar_t); cvalp += count; } break; @@ -697,7 +695,7 @@ smb_msgbuf_chkerc(char *text, int erc) } static void -buf_decode_wcs(mts_wchar_t *dst_wcstr, mts_wchar_t *src_wcstr, int wcstrlen) +buf_decode_wcs(smb_wchar_t *dst_wcstr, smb_wchar_t *src_wcstr, int wcstrlen) { int i; diff --git a/usr/src/common/smbsrv/smb_native.c b/usr/src/common/smbsrv/smb_native.c index cc1837809e..8dc67d42f1 100644 --- a/usr/src/common/smbsrv/smb_native.c +++ b/usr/src/common/smbsrv/smb_native.c @@ -105,7 +105,7 @@ smbnative_os_value(const char *native_os) name = os_table[i].sn_name; len = strlen(name); - if (utf8_strncasecmp(name, native_os, len) == 0) + if (smb_strcasecmp(name, native_os, len) == 0) return (os_table[i].sn_value); } @@ -159,8 +159,8 @@ smbnative_lm_value(const char *native_lm) name = lm_table[i].sn_name; len = strlen(name); - if ((utf8_strncasecmp(name, native_lm, len) == 0) || - (utf8_strncasecmp(&name[1], native_lm, len - 1) == 0)) { + if ((smb_strcasecmp(name, native_lm, len) == 0) || + (smb_strcasecmp(&name[1], native_lm, len - 1) == 0)) { return (lm_table[i].sn_value); } } @@ -209,8 +209,8 @@ smbnative_pdc_value(const char *native_lm) name = pdc_table[i].sn_name; len = strlen(name); - if ((utf8_strncasecmp(name, native_lm, len) == 0) || - (utf8_strncasecmp(&name[1], native_lm, len - 1) == 0)) { + if ((smb_strcasecmp(name, native_lm, len) == 0) || + (smb_strcasecmp(&name[1], native_lm, len - 1) == 0)) { return (pdc_table[i].sn_value); } } diff --git a/usr/src/common/smbsrv/smb_netbios_util.c b/usr/src/common/smbsrv/smb_netbios_util.c index 1bd47f80bc..a0e0f480f1 100644 --- a/usr/src/common/smbsrv/smb_netbios_util.c +++ b/usr/src/common/smbsrv/smb_netbios_util.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef _KERNEL #include <sys/types.h> #include <sys/sunddi.h> @@ -32,7 +30,6 @@ #include <string.h> #endif #include <smbsrv/string.h> -#include <smbsrv/ctype.h> #include <smbsrv/netbios.h> static int domainname_is_valid(char *domain_name); @@ -286,7 +283,7 @@ netbios_first_level_name_decode(char *in, char *name, char *scope) * to Appendix 1 - Domain Name Syntax Specification in RFC883. */ if (domainname_is_valid(scope)) { - (void) utf8_strupr(scope); + (void) smb_strupr(scope); /*LINTED E_PTRDIFF_OVERFLOW*/ return (cp - in); } @@ -377,14 +374,14 @@ domainname_is_valid(char *domain_name) } if (first_char) { - if (mts_isalpha_ascii(*name) == 0) + if (smb_isalpha_ascii(*name) == 0) return (0); first_char = 0; continue; } - if (mts_isalnum_ascii(*name) || dns_is_allowed(*name)) + if (smb_isalnum_ascii(*name) || dns_is_allowed(*name)) continue; return (0); diff --git a/usr/src/common/smbsrv/smb_oem.c b/usr/src/common/smbsrv/smb_oem.c index 4dca80402b..92d6aec029 100644 --- a/usr/src/common/smbsrv/smb_oem.c +++ b/usr/src/common/smbsrv/smb_oem.c @@ -19,108 +19,83 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Support for oem <-> unicode translations. */ #ifndef _KERNEL -#include <stdio.h> #include <stdlib.h> #include <thread.h> #include <synch.h> #include <string.h> +#else +#include <sys/ksynch.h> #endif /* _KERNEL */ + +#include <sys/byteorder.h> #include <smbsrv/alloc.h> #include <smbsrv/string.h> -#include <smbsrv/oem.h> -#include <sys/byteorder.h> + /* - * name: Name used to show on the telnet/GUI. - * filename: The actual filename contains the codepage. - * doublebytes: The codepage is double or single byte. - * oempage: The oempage is used to convert Unicode to OEM chars. - * Memory needs to be allocated for value field of oempage - * to store the entire table. - * unipage: The unipage is used to convert OEM to Unicode chars. - * Memory needs to be allocated for value field of unipage - * to store the entire table. - * valid: This field indicates if the page is valid or not. - * ref: This ref count is used to keep track of the usage of BOTH - * oempage and unipage. - * Note: If the cpid of the table is changed, please change the - * codepage_id in oem.h as well. + * cpid The oemcpg_table index for this oempage. + * value The conversion values. + */ +typedef struct oempage { + uint32_t cpid; + smb_wchar_t *value; +} oempage_t; + +/* + * filename The actual filename contains the codepage. + * bytesperchar The codepage uses double or single bytes per char. + * oempage The oempage is used to convert Unicode characters to + * OEM characters. Memory needs to be allocated for + * the value field of oempage to store the table. + * ucspage The unicode page is used to convert OEM characters + * to Unicode characters. Memory needs to be allocated + * for the value field of ucspage to store the table. + * valid True if the codepage has been initialized. */ typedef struct oem_codepage { - char *filename; - unsigned int bytesperchar; - oempage_t oempage; - oempage_t unicodepage; - unsigned int valid; - unsigned int ref; + char *filename; + uint32_t bytesperchar; + oempage_t oempage; + oempage_t ucspage; + boolean_t valid; } oem_codepage_t; -static oem_codepage_t oemcp_table[] = { - {"850.cpg", 1, {0, 0}, {0, 0}, 0, 0}, /* Multilingual Latin1 */ - {"950.cpg", 2, {1, 0}, {1, 0}, 0, 0}, /* Chinese Traditional */ - {"1252.cpg", 1, {2, 0}, {2, 0}, 0, 0}, /* MS Latin1 */ - {"949.cpg", 2, {3, 0}, {3, 0}, 0, 0}, /* Korean */ - {"936.cpg", 2, {4, 0}, {4, 0}, 0, 0}, /* Chinese Simplified */ - {"932.cpg", 2, {5, 0}, {5, 0}, 0, 0}, /* Japanese */ - {"852.cpg", 1, {6, 0}, {6, 0}, 0, 0}, /* Multilingual Latin2 */ - {"1250.cpg", 1, {7, 0}, {7, 0}, 0, 0}, /* MS Latin2 */ - {"1253.cpg", 1, {8, 0}, {8, 0}, 0, 0}, /* MS Greek */ - {"737.cpg", 1, {9, 0}, {9, 0}, 0, 0}, /* Greek */ - {"1254.cpg", 1, {10, 0}, {10, 0}, 0, 0}, /* MS Turkish */ - {"857.cpg", 1, {11, 0}, {11, 0}, 0, 0}, /* Multilingual Latin5 */ - {"1251.cpg", 1, {12, 0}, {12, 0}, 0, 0}, /* MS Cyrillic */ - {"866.cpg", 1, {13, 0}, {13, 0}, 0, 0}, /* Cyrillic II */ - {"1255.cpg", 1, {14, 0}, {14, 0}, 0, 0}, /* MS Hebrew */ - {"862.cpg", 1, {15, 0}, {15, 0}, 0, 0}, /* Hebrew */ - {"1256.cpg", 1, {16, 0}, {16, 0}, 0, 0}, /* MS Arabic */ - {"720.cpg", 1, {17, 0}, {17, 0}, 0, 0} /* Arabic */ -}; - -static language lang_table[] = { - {"Arabic", OEM_CP_IND_720, OEM_CP_IND_1256}, - {"Brazilian", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Chinese Traditional", OEM_CP_IND_950, OEM_CP_IND_950}, - {"Chinese Simplified", OEM_CP_IND_936, OEM_CP_IND_936}, - {"Czech", OEM_CP_IND_852, OEM_CP_IND_1250}, - {"Danish", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Dutch", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"English", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Finnish", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"French", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"German", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Greek", OEM_CP_IND_737, OEM_CP_IND_1253}, - {"Hebrew", OEM_CP_IND_862, OEM_CP_IND_1255}, - {"Hungarian", OEM_CP_IND_852, OEM_CP_IND_1250}, - {"Italian", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Japanese", OEM_CP_IND_932, OEM_CP_IND_932}, - {"Korean", OEM_CP_IND_949, OEM_CP_IND_949}, - {"Norwegian", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Polish", OEM_CP_IND_852, OEM_CP_IND_1250}, - {"Russian", OEM_CP_IND_866, OEM_CP_IND_1251}, - {"Slovak", OEM_CP_IND_852, OEM_CP_IND_1250}, - {"Slovenian", OEM_CP_IND_852, OEM_CP_IND_1250}, - {"Spanish", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Swedish", OEM_CP_IND_850, OEM_CP_IND_1252}, - {"Turkish", OEM_CP_IND_857, OEM_CP_IND_1254} +static oem_codepage_t oemcpg_table[] = { + {"850.cpg", 1, {0, 0}, {0, 0}, 0}, /* Multilingual Latin1 */ + {"950.cpg", 2, {1, 0}, {1, 0}, 0}, /* Chinese Traditional */ + {"1252.cpg", 1, {2, 0}, {2, 0}, 0}, /* MS Latin1 */ + {"949.cpg", 2, {3, 0}, {3, 0}, 0}, /* Korean */ + {"936.cpg", 2, {4, 0}, {4, 0}, 0}, /* Chinese Simplified */ + {"932.cpg", 2, {5, 0}, {5, 0}, 0}, /* Japanese */ + {"852.cpg", 1, {6, 0}, {6, 0}, 0}, /* Multilingual Latin2 */ + {"1250.cpg", 1, {7, 0}, {7, 0}, 0}, /* MS Latin2 */ + {"1253.cpg", 1, {8, 0}, {8, 0}, 0}, /* MS Greek */ + {"737.cpg", 1, {9, 0}, {9, 0}, 0}, /* Greek */ + {"1254.cpg", 1, {10, 0}, {10, 0}, 0}, /* MS Turkish */ + {"857.cpg", 1, {11, 0}, {11, 0}, 0}, /* Multilingual Latin5 */ + {"1251.cpg", 1, {12, 0}, {12, 0}, 0}, /* MS Cyrillic */ + {"866.cpg", 1, {13, 0}, {13, 0}, 0}, /* Cyrillic II */ + {"1255.cpg", 1, {14, 0}, {14, 0}, 0}, /* MS Hebrew */ + {"862.cpg", 1, {15, 0}, {15, 0}, 0}, /* Hebrew */ + {"1256.cpg", 1, {16, 0}, {16, 0}, 0}, /* MS Arabic */ + {"720.cpg", 1, {17, 0}, {17, 0}, 0} /* Arabic */ }; - +#define MAX_OEMPAGES (sizeof (oemcpg_table) / sizeof (oemcpg_table[0])) +#define MAX_UNICODE_IDX 65536 /* - * The oem_default_smb_cp is the default smb codepage for English. - * It is actually codepage 850. + * The default SMB OEM codepage for English is codepage 850. */ -mts_wchar_t oem_default_smb_cp[256] = { +smb_wchar_t oem_codepage_850[256] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, @@ -155,13 +130,10 @@ mts_wchar_t oem_default_smb_cp[256] = { 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0 }; - - /* - * The oem_default_telnet_cp is the default telnet codepage for English. - * It is actually codepage 1252. + * The default telnet OEM codepage for English is codepage 1252. */ -mts_wchar_t oem_default_telnet_cp[256] = { +smb_wchar_t oem_codepage_1252[256] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, @@ -196,567 +168,206 @@ mts_wchar_t oem_default_telnet_cp[256] = { 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF }; - -#define MAX_OEMPAGES (sizeof (oemcp_table) / sizeof (oemcp_table[0])) -#define MAX_UNI_IDX 65536 - - - -/* - * oem_codepage_bytesperchar - * - * This function returns the max bytes per oem char for the specified - * oem table. This basically shows if the oem codepage is single or - * double bytes. - */ -static unsigned int -oem_codepage_bytesperchar(unsigned int cpid) -{ - if (cpid >= MAX_OEMPAGES) - return (0); - else - return (oemcp_table[cpid].bytesperchar); -} - - +static oempage_t *oem_get_oempage(uint32_t); +static oempage_t *oem_get_ucspage(uint32_t); +static void oem_codepage_init(uint32_t); +static void oem_codepage_setup(uint32_t); /* - * oem_get_codepage_path + * Convert a unicode string to an oem string. * - * This function will get the codepage path. - */ -const char * -oem_get_codepage_path(void) -{ -#ifdef PBSHORTCUT /* */ - const char *path = getenv("codepage.oem.directory"); - if (path == 0) - return ("/"); - else - return (path); -#else /* PBSHORTCUT */ - return ("/"); -#endif /* PBSHORTCUT */ -} - -/* - * oem_codepage_init + * The conversion will stop at the end of the unicode string + * or when (nbytes - 1) oem characters have been stored. * - * This function will init oem page via the cpid of the oem table. - * The function oem_codepage_free must be called when the oempage is - * no longer needed to free up the allocated memory. If the codepage is - * successfully initialized, zero will be the return value; otherwise - * -1 will be the return value. - */ -int -oem_codepage_init(unsigned int cpid) -{ -#ifndef _KERNEL - FILE *fp; - static mutex_t mutex; - char buf[32]; - char filePath[100]; -#endif /* _KERNEL */ - unsigned int max_oem_index; - const char *codepagePath = oem_get_codepage_path(); - mts_wchar_t *default_oem_cp = 0; - oem_codepage_t *oemcp; - - /* - * The OEM codepages 850 and 1252 are stored in kernel; therefore, - * no need for codepagePath to be defined to work. - */ - if (cpid >= MAX_OEMPAGES || - (codepagePath == 0 && - cpid != oem_default_smb_cpid && cpid != oem_default_telnet_cpid)) - return (-1); - - max_oem_index = 1 << oem_codepage_bytesperchar(cpid) * 8; - /* - * Use mutex so no two same index can be initialize - * at the same time. - */ -#ifndef _KERNEL - (void) mutex_lock(&mutex); -#endif /* _KERNEL */ - - oemcp = &oemcp_table[cpid]; - if (oemcp->valid) { - oemcp->valid++; -#ifndef _KERNEL - (void) mutex_unlock(&mutex); -#endif /* _KERNEL */ - return (0); - } - - oemcp->oempage.value = - MEM_ZALLOC("oem", max_oem_index * sizeof (mts_wchar_t)); - if (oemcp->oempage.value == 0) { -#ifndef _KERNEL - (void) mutex_unlock(&mutex); -#endif /* _KERNEL */ - return (-1); - } - - oemcp->unicodepage.value = - MEM_ZALLOC("oem", MAX_UNI_IDX * sizeof (mts_wchar_t)); - if (oemcp->unicodepage.value == 0) { - MEM_FREE("oem", oemcp->oempage.value); - oemcp->oempage.value = 0; -#ifndef _KERNEL - (void) mutex_unlock(&mutex); -#endif /* _KERNEL */ - return (-1); - } - - /* - * The default English page is stored in kernel. - * Therefore, no need to go to codepage files. - */ -#ifndef _KERNEL - if (cpid == oem_default_smb_cpid) - default_oem_cp = oem_default_smb_cp; - else if (cpid == oem_default_telnet_cpid) - default_oem_cp = oem_default_telnet_cp; - else - default_oem_cp = 0; -#else /* _KERNEL */ - default_oem_cp = oem_default_smb_cp; -#endif /* _KERNEL */ - - if (default_oem_cp) { - int i; - - for (i = 0; i < max_oem_index; i++) { - oemcp->oempage.value[i] = default_oem_cp[i]; - oemcp->unicodepage.value[default_oem_cp[i]] = - (mts_wchar_t)i; - } -#ifdef _KERNEL - } - /* - * XXX This doesn't seem right. How do we handle the situation - * where default_oem_cp == 0 in the kernel? - * Is this a PBSHORTCUT? - */ -#else - } else { - - /* - * The codepage is not one of the default that stores - * in the include - * file; therefore, we need to read from the file. - */ - (void) snprintf(filePath, sizeof (filePath), - "%s/%s", codepagePath, oemcp->filename); - fp = fopen(filePath, "r"); - - if (fp == 0) { - MEM_FREE("oem", oemcp->oempage.value); - MEM_FREE("oem", oemcp->unicodepage.value); -#ifndef _KERNEL - (void) mutex_unlock(&mutex); -#endif /* _KERNEL */ - return (-1); - } - - while (fgets(buf, 32, fp) != 0) { - char *endptr; - unsigned int oemval, unival; - - endptr = (char *)strchr(buf, ' '); - if (endptr == 0) { - continue; - } - - oemval = strtol(buf, &endptr, 0); - unival = strtol(endptr+1, 0, 0); - - if (oemval >= max_oem_index || unival >= MAX_UNI_IDX) { - continue; - } - - oemcp->oempage.value[oemval] = unival; - oemcp->unicodepage.value[unival] = oemval; - } - (void) fclose(fp); - } -#endif /* _KERNEL */ - - oemcp->valid = 1; -#ifndef _KERNEL - (void) mutex_unlock(&mutex); -#endif /* _KERNEL */ - return (0); -} - - - - -/* - * oem_codepage_free - * - * This function will clear the valid bit and free the memory - * allocated to the oem/unipage by oem_codepage_init if the ref count - * is zero. - */ -void -oem_codepage_free(unsigned int cpid) -{ - oem_codepage_t *oemcp; - - if (cpid >= MAX_OEMPAGES || !oemcp_table[cpid].valid) - return; - - oemcp = &oemcp_table[cpid]; - oemcp->valid--; - - if (oemcp->ref != 0 || oemcp->valid != 0) - return; - - if (oemcp->oempage.value != 0) { - MEM_FREE("oem", oemcp->oempage.value); - oemcp->oempage.value = 0; - } - - if (oemcp->unicodepage.value != 0) { - MEM_FREE("oem", oemcp->unicodepage.value); - oemcp->unicodepage.value = 0; - } -} - - - -/* - * oem_get_oempage - * - * This function will return the current oempage and increment - * the ref count. The function oem_release_page should always - * be called when finish using the oempage to decrement the - * ref count. - */ -static oempage_t * -oem_get_oempage(unsigned int cpid) -{ - if (cpid >= MAX_OEMPAGES) - return (0); - - if (oemcp_table[cpid].valid) { - oemcp_table[cpid].ref++; - return (&oemcp_table[cpid].oempage); - } - return (0); -} - - - -/* - * oem_get_unipage - * - * This function will return the current unipage and increment - * the ref count. The function oem_release_page should always - * be called when finish using the unipage to decrement the - * ref count. - */ -static oempage_t * -oem_get_unipage(unsigned int cpid) -{ - if (cpid >= MAX_OEMPAGES) - return (0); - - if (oemcp_table[cpid].valid) { - oemcp_table[cpid].ref++; - return (&oemcp_table[cpid].unicodepage); - } - return (0); -} - - - -/* - * oem_release_page - * - * This function will decrement the ref count and check the valid - * bit. It will free the memory allocated for the pages - * if the - * valid bit is not set, ref count is zero and the page is not - * already freed. - */ -static void -oem_release_page(oempage_t *page) -{ - oem_codepage_t *oemcp = &oemcp_table[page->cpid]; - - page = 0; - - if (oemcp->ref > 0) - oemcp->ref--; - - if (oemcp->ref != 0 || oemcp->valid) - return; - - if (oemcp->oempage.value != 0) { - MEM_FREE("oem", oemcp->oempage.value); - oemcp->oempage.value = 0; - } - - if (oemcp->unicodepage.value != 0) { - MEM_FREE("oem", oemcp->unicodepage.value); - oemcp->unicodepage.value = 0; - } -} - - - -/* - * unicodestooems - * - * Convert unicode string to oem string. The function will stop - * converting the unicode string when size nbytes - 1 is reached - * or when there is not enough room to store another unicode. - * If the function is called when the codepage is not initialized - * or when the codepage initialize failed, it will return 0. - * Otherwise, the total # of the converted unicode is returned. + * The number of converted unicode characters is returned, + * or 0 on error. */ size_t -unicodestooems( - char *oemstring, - const mts_wchar_t *unicodestring, - size_t nbytes, - unsigned int cpid) +ucstooem(char *oem, const smb_wchar_t *ucs, size_t nbytes, uint32_t cpid) { - oempage_t *unipage; - unsigned int count = 0; - mts_wchar_t oemchar; - - if (cpid >= MAX_OEMPAGES) - return (0); + oempage_t *ucspage; + uint32_t count = 0; + smb_wchar_t oemchar; - if (unicodestring == 0 || oemstring == 0) + if (ucs == NULL || oem == NULL) return (0); - if ((unipage = oem_get_unipage(cpid)) == 0) + if ((ucspage = oem_get_ucspage(cpid)) == NULL) return (0); - while ((oemchar = unipage->value[*unicodestring]) != 0) { + while (nbytes != 0 && (oemchar = ucspage->value[*ucs]) != 0) { if (oemchar & 0xff00 && nbytes >= MTS_MB_CHAR_MAX) { - *oemstring++ = oemchar >> 8; - *oemstring++ = (char)oemchar; + *oem++ = oemchar >> 8; + *oem++ = (char)oemchar; nbytes -= 2; } else if (nbytes > 1) { - *oemstring++ = (char)oemchar; + *oem++ = (char)oemchar; nbytes--; - } else + } else { break; + } count++; - unicodestring++; + ucs++; } - *oemstring = 0; - - oem_release_page(unipage); - + *oem = '\0'; return (count); } - - /* - * oemstounicodes + * Convert an oem string to a unicode string. * - * Convert oem string to unicode string. The function will stop - * converting the oem string when unicodestring len reaches nwchars - 1. - * or when there is not enough room to store another oem char. - * If the function is called when the codepage is not initialized - * or when the codepage initialize failed, it will return 0. - * Otherwise, the total # of the converted oem chars is returned. - * The oem char can be either 1 or 2 bytes. + * The conversion will stop at the end of the oem string or + * when nwchars - 1 have been converted. + * + * The number of converted oem chars is returned, or 0 on error. + * An oem char may be either 1 or 2 bytes. */ size_t -oemstounicodes( - mts_wchar_t *unicodestring, - const char *oemstring, - size_t nwchars, - unsigned int cpid) +oemtoucs(smb_wchar_t *ucs, const char *oem, size_t nwchars, uint32_t cpid) { - oempage_t *oempage; - size_t count = nwchars; - mts_wchar_t oemchar; + oempage_t *oempage; + size_t count = nwchars; + smb_wchar_t oemchar; - if (cpid >= MAX_OEMPAGES) + if (ucs == NULL || oem == NULL) return (0); - if (unicodestring == 0 || oemstring == 0) + if ((oempage = oem_get_oempage(cpid)) == NULL) return (0); - if ((oempage = oem_get_oempage(cpid)) == 0) - return (0); - - while ((oemchar = (mts_wchar_t)*oemstring++ & 0xff) != 0) { + while ((oemchar = (smb_wchar_t)*oem++ & 0xff) != 0) { /* - * Cannot find one byte oemchar in table. Must be - * a lead byte. Try two bytes. + * Cannot find one byte oemchar in table. + * Must be a lead byte. Try two bytes. */ - if ((oempage->value[oemchar] == 0) && (oemchar != 0)) { - oemchar = oemchar << 8 | (*oemstring++ & 0xff); + oemchar = oemchar << 8 | (*oem++ & 0xff); if (oempage->value[oemchar] == 0) { - *unicodestring = 0; + *ucs = 0; break; } } #ifdef _BIG_ENDIAN - *unicodestring = LE_IN16(&oempage->value[oemchar]); + *ucs = LE_IN16(&oempage->value[oemchar]); #else - *unicodestring = oempage->value[oemchar]; + *ucs = oempage->value[oemchar]; #endif count--; - unicodestring++; + ucs++; } - *unicodestring = 0; - - oem_release_page(oempage); - + *ucs = 0; return (nwchars - count); } /* - * oem_get_lang_table - * - * This function returns a pointer to the language table. + * Get a pointer to the oem page for the specific codepage id. */ -language * -oem_get_lang_table(void) +static oempage_t * +oem_get_oempage(uint32_t cpid) { - return (lang_table); + if (cpid >= MAX_OEMPAGES) + return (NULL); + + if (!oemcpg_table[cpid].valid) { + oem_codepage_init(cpid); + + if (!oemcpg_table[cpid].valid) + return (NULL); + } + + return (&oemcpg_table[cpid].oempage); } /* - * oem_no_of_languages - * - * This function returns total languages support in the system. + * Get a pointer to the ucs page for the specific codepage id. */ -int -oem_no_of_languages(void) +static oempage_t * +oem_get_ucspage(uint32_t cpid) { - return (sizeof (lang_table)/sizeof (lang_table[0])); -} + if (cpid >= MAX_OEMPAGES) + return (NULL); + if (!oemcpg_table[cpid].valid) { + oem_codepage_init(cpid); + + if (!oemcpg_table[cpid].valid) + return (NULL); + } + + return (&oemcpg_table[cpid].ucspage); +} -#ifndef _KERNEL -#if 1 /* - * TESTING Functions + * Initialize the oem page in the oem table. */ -void -oemcp_print(unsigned int cpid) +static void +oem_codepage_init(uint32_t cpid) { - unsigned int bytesperchar, max_index, i; - oempage_t *oempage, *unipage; - unsigned int counter = 0; +#ifndef _KERNEL + static mutex_t mutex; - if (cpid >= MAX_OEMPAGES) { - (void) printf("oemcp cpid %d is invalid\n", cpid); - return; - } + (void) mutex_lock(&mutex); + oem_codepage_setup(cpid); + (void) mutex_unlock(&mutex); +#else + static kmutex_t mutex; - if ((oempage = oem_get_oempage(cpid)) == 0) { - (void) printf("oemcp of cpid %d is invalid\n", cpid); - return; - } + mutex_enter(&mutex); + oem_codepage_setup(cpid); + mutex_exit(&mutex); +#endif /* _KERNEL */ +} - if ((unipage = oem_get_unipage(cpid)) == 0) { - (void) printf("unicp of cpid %d is invalid\n", cpid); +static void +oem_codepage_setup(uint32_t cpid) +{ + smb_wchar_t *default_oem_cp; + oem_codepage_t *oemcpg; + uint32_t bytesperchar; + uint32_t max_oem_index; + int i; + + switch (cpid) { + case OEM_CPG_850: + default_oem_cp = oem_codepage_850; + break; + case OEM_CPG_1252: + default_oem_cp = oem_codepage_1252; + default: return; } - if ((bytesperchar = oem_codepage_bytesperchar(cpid)) == 0) { - (void) printf("bytesperchar of cpid %d is not correct\n", cpid); + oemcpg = &oemcpg_table[cpid]; + if (oemcpg->valid) return; - } - - max_index = 1 << bytesperchar * 8; - - (void) printf("OEMPAGE:\n"); - for (i = 0; i < max_index; i++) { - if ((counter + 1) % 4 == 0 && - (oempage->value[i] != 0 || i == 0)) { - (void) printf("%x %x\n", i, oempage->value[i]); - counter++; - } else if (oempage->value[i] != 0 || i == 0) { - (void) printf("%x %x, ", i, oempage->value[i]); - counter++; - } - } - counter = 0; - (void) printf("\n\nUNIPAGE:\n"); - for (i = 0; i < 65536; i++) { - if ((counter + 1) % 8 == 0 && - (unipage->value[i] != 0 || i == 0)) { - (void) printf("%x %x\n", i, unipage->value[i]); - counter++; - } else if (unipage->value[i] != 0 || i == 0) { - (void) printf("%x %x, ", i, unipage->value[i]); - counter++; - } - } - (void) printf("\n"); - oem_release_page(oempage); - oem_release_page(unipage); -} - - - -void -oemstringtest(unsigned int cpid) -{ - unsigned char *c, *cbuf; - unsigned char cbuf1[100] = {0xfe, 0xfd, 0xf2, 0xe9, - 0x63, 0xce, 0xdb, 0x8c, 0x9c, 0x21, 0}; - unsigned char cbuf2[100] = {0xfe, 0xfc, 0x63, 0x81, 0x42, - 0x91, 0x40, 0x24, 0xff, 0x49}; - mts_wchar_t buf[100], *wc; - - if (cpid == 1) - cbuf = cbuf1; - else if (cpid == 2) - cbuf = cbuf2; /* - * Before oem->uni conversion. + * max_oem_index will be 256 or 65536 dependent + * on the OEM codepage. */ - (void) printf("Before oem->uni conversion: "); - for (c = cbuf; *c != 0; c++) - (void) printf("%x ", *c); - (void) printf("\n"); + bytesperchar = oemcpg_table[cpid].bytesperchar; + max_oem_index = 1 << (bytesperchar * 8); - /* - * oem->uni conversion - */ - (void) oemstounicodes(buf, (const char *)cbuf, 100, cpid); + oemcpg->oempage.value = + MEM_ZALLOC("oem", max_oem_index * sizeof (smb_wchar_t)); + if (oemcpg->oempage.value == NULL) + return; - /* - * After oem->uni conversion. - */ - (void) printf("After oem->uni conversion: "); - for (wc = buf; *wc != 0; wc++) - (void) printf("%x ", *wc); - (void) printf("\n"); + oemcpg->ucspage.value = + MEM_ZALLOC("oem", MAX_UNICODE_IDX * sizeof (smb_wchar_t)); + if (oemcpg->ucspage.value == NULL) { + MEM_FREE("oem", oemcpg->oempage.value); + oemcpg->oempage.value = NULL; + return; + } - /* - * uni->oem conversion - */ - (void) unicodestooems((char *)cbuf, buf, 100, cpid); + for (i = 0; i < max_oem_index; i++) { + oemcpg->oempage.value[i] = default_oem_cp[i]; + oemcpg->ucspage.value[default_oem_cp[i]] = (smb_wchar_t)i; + } - /* - * After uni->oem conversion. - */ - (void) printf("After uni->oem conversion: "); - for (c = cbuf; *c != 0; c++) - (void) printf("%x ", *c); - (void) printf("\n"); + oemcpg->valid = B_TRUE; } -#endif -#endif /* _KERNEL */ diff --git a/usr/src/common/smbsrv/smb_opmlang.c b/usr/src/common/smbsrv/smb_opmlang.c deleted file mode 100644 index af7ee73cb1..0000000000 --- a/usr/src/common/smbsrv/smb_opmlang.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/string.h> -#include <smbsrv/codepage.h> -#include <smbsrv/oem.h> - -static unsigned int smb_cpid = NO_OF_OEM_CP_INDS; -static unsigned int telnet_cpid = NO_OF_OEM_CP_INDS; - -/* - * oem_get_smb_cpid - * - * This function returns the cpid for current smb codepage. - */ -unsigned int -oem_get_smb_cpid(void) -{ - return (smb_cpid); -} - -/* - * oem_get_telnet_cpid - * - * This function returns the cpid for current telnet codepage. - */ -unsigned int -oem_get_telnet_cpid(void) -{ - return (telnet_cpid); -} - -/* - * oem_current_language - * - * This function will return the current language setting. - * The current language is stored in env "codepage.oem.language". - * If the env does not exist, "None Selected" will be returned. - */ -char * -oem_current_language() -{ -#ifdef PBSHORTCUT - char *p = getenv("codepage.oem.language"); - - if (p) - return (p); -#endif - return ("None Selected"); -} - - -/* - * oem_language_set - * - * This function will set the oem language and correct - * env variables. - */ -int -oem_language_set(char *lang_name) -{ - int i; - language *lang_table = oem_get_lang_table(); - - for (i = 0; i < NO_OF_LANGUAGES; i++) { - if (utf8_strcasecmp(lang_name, lang_table[i].language) == 0) { - unsigned int oldSmbIndex = smb_cpid; - unsigned int oldTelnetIndex = telnet_cpid; - if (oem_codepage_init(lang_table[i].smbIndex) < 0 || - oem_codepage_init(lang_table[i].telnetIndex) < 0) { - oem_codepage_free(lang_table[i].smbIndex); - oem_codepage_free(lang_table[i].telnetIndex); - (void) oem_codepage_init(oem_default_smb_cpid); - (void) oem_codepage_init( - oem_default_telnet_cpid); - smb_cpid = oem_default_smb_cpid; - telnet_cpid = oem_default_telnet_cpid; -#ifdef PBSHORTCUT - setenv("codepage.oem.language", - oem_default_language); -#endif - } else { - smb_cpid = lang_table[i].smbIndex; - telnet_cpid = lang_table[i].telnetIndex; -#ifdef PBSHORTCUT - setenv("codepage.oem.language", - lang_table[i].language); -#endif - } -#ifdef PBSHORTCUT - saveenv(); -#endif - - if (oldSmbIndex < NO_OF_OEM_CP_INDS) - oem_codepage_free(oldSmbIndex); - if (oldTelnetIndex < NO_OF_OEM_CP_INDS) - oem_codepage_free(oldTelnetIndex); - return (0); - } - } - - return (-1); -} diff --git a/usr/src/common/smbsrv/smb_strcase.c b/usr/src/common/smbsrv/smb_strcase.c deleted file mode 100644 index e1de2cdd32..0000000000 --- a/usr/src/common/smbsrv/smb_strcase.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Case conversion functions for strings. Originally this module only - * dealt with ASCII strings. It has been updated to support European - * character set characters. The current implementation is based on - * code page table lookup rather than simple character range checks. - */ - -#ifdef _KERNEL -#include <sys/types.h> -#include <sys/sunddi.h> -#else -#include <stdio.h> -#include <string.h> -#endif -#include <smbsrv/ctype.h> -#include <smbsrv/codepage.h> -#include <smbsrv/cp_cyrillic.h> -#include <smbsrv/cp_latin1.h> -#include <smbsrv/cp_latin2.h> -#include <smbsrv/cp_latin3.h> -#include <smbsrv/cp_latin4.h> -#include <smbsrv/cp_latin5.h> -#include <smbsrv/cp_latin6.h> -#include <smbsrv/cp_usascii.h> - -/* - * Global pointer to the current code page. This is - * defaulted to a standard ASCII table. - */ -static codepage_t *current_codepage = usascii_codepage; - -/* - * A flag indicating whether the codepage being used is ASCII - * When this flag is set, string opeartions can go faster. - */ -static int is_unicode = 0; - -/* - * codepage_isupper - * - * Determine whether or not a character is an uppercase character. - * This function operates on the current codepage table. Returns - * non-zero if the character is uppercase. Otherwise returns zero. - */ -int -codepage_isupper(int c) -{ - unsigned short mask = is_unicode ? 0xffff : 0xff; - - return (current_codepage[c & mask].ctype & CODEPAGE_ISUPPER); -} - - -/* - * codepage_islower - * - * Determine whether or not a character is an lowercase character. - * This function operates on the current codepage table. Returns - * non-zero if the character is lowercase. Otherwise returns zero. - */ -int -codepage_islower(int c) -{ - unsigned short mask = is_unicode ? 0xffff : 0xff; - - return (current_codepage[c & mask].ctype & CODEPAGE_ISLOWER); -} - - -/* - * codepage_toupper - * - * Convert individual characters to their uppercase equivalent value. - * If the specified character is lowercase, the uppercase value will - * be returned. Otherwise the original value will be returned. - */ -int -codepage_toupper(int c) -{ - unsigned short mask = is_unicode ? 0xffff : 0xff; - - return (current_codepage[c & mask].upper); -} - - -/* - * codepage_tolower - * - * Convert individual characters to their lowercase equivalent value. - * If the specified character is uppercase, the lowercase value will - * be returned. Otherwise the original value will be returned. - */ -int -codepage_tolower(int c) -{ - unsigned short mask = is_unicode ? 0xffff : 0xff; - - return (current_codepage[c & mask].lower); -} - - -/* - * strupr - * - * Convert a string to uppercase using the appropriate codepage. The - * string is converted in place. A pointer to the string is returned. - * There is an assumption here that uppercase and lowercase values - * always result encode to the same length. - */ -char * -utf8_strupr(char *s) -{ - mts_wchar_t c; - char *p = s; - - while (*p) { - if (mts_isascii(*p)) { - *p = codepage_toupper(*p); - p++; - } else { - if (mts_mbtowc(&c, p, MTS_MB_CHAR_MAX) < 0) - return (0); - - if (c == 0) - break; - - c = codepage_toupper(c); - p += mts_wctomb(p, c); - } - } - - return (s); -} - - -/* - * strlwr - * - * Convert a string to lowercase using the appropriate codepage. The - * string is converted in place. A pointer to the string is returned. - * There is an assumption here that uppercase and lowercase values - * always result encode to the same length. - */ -char * -utf8_strlwr(char *s) -{ - mts_wchar_t c; - char *p = s; - - while (*p) { - if (mts_isascii(*p)) { - *p = codepage_tolower(*p); - p++; - } else { - if (mts_mbtowc(&c, p, MTS_MB_CHAR_MAX) < 0) - return (0); - - if (c == 0) - break; - - c = codepage_tolower(c); - p += mts_wctomb(p, c); - } - } - - return (s); -} - - -/* - * isstrlwr - * - * Returns 1 if string contains NO uppercase chars 0 otherwise. However, - * -1 is returned if "s" is not a valid multi-byte string. - */ -int -utf8_isstrlwr(const char *s) -{ - mts_wchar_t c; - int n; - const char *p = s; - - while (*p) { - if (mts_isascii(*p) && codepage_isupper(*p)) - return (0); - else { - if ((n = mts_mbtowc(&c, p, MTS_MB_CHAR_MAX)) < 0) - return (-1); - - if (c == 0) - break; - - if (codepage_isupper(c)) - return (0); - - p += n; - } - } - - return (1); -} - - -/* - * isstrupr - * - * Returns 1 if string contains NO lowercase chars 0 otherwise. However, - * -1 is returned if "s" is not a valid multi-byte string. - */ -int -utf8_isstrupr(const char *s) -{ - mts_wchar_t c; - int n; - const char *p = s; - - while (*p) { - if (mts_isascii(*p) && codepage_islower(*p)) - return (0); - else { - if ((n = mts_mbtowc(&c, p, MTS_MB_CHAR_MAX)) < 0) - return (-1); - - if (c == 0) - break; - - if (codepage_islower(c)) - return (0); - - p += n; - } - } - - return (1); -} - - -/* - * strcasecmp - * - * Compare the null-terminated strings s1 and s2 and return an integer - * greater than, equal to, or less than 0, according as s1 is lexico - * graphically greater than, equal to, or less than s2 after translation - * of each corresponding character to lowercase. The strings themselves - * are not modified. - * - * Out: 0 if strings are equal - * < 0 if first string < second string - * > 0 if first string > second string - */ -int -utf8_strcasecmp(const char *s1, const char *s2) -{ - mts_wchar_t c1, c2; - int n1, n2; - const char *p1 = s1; - const char *p2 = s2; - - for (;;) { - if (mts_isascii(*p1)) - c1 = *p1++; - else { - if ((n1 = mts_mbtowc(&c1, p1, MTS_MB_CHAR_MAX)) < 0) - return (-1); - p1 += n1; - } - - if (mts_isascii(*p2)) - c2 = *p2++; - else { - if ((n2 = mts_mbtowc(&c2, p2, MTS_MB_CHAR_MAX)) < 0) - return (1); - p2 += n2; - } - - if (c1 == 0 || c2 == 0) - break; - - if (c1 == c2) - continue; - - c1 = codepage_tolower(c1); - c2 = codepage_tolower(c2); - - if (c1 != c2) - break; - } - - return ((int)c1 - (int)c2); -} - - -/* - * strncasecmp - * - * Compare two null-terminated strings, s1 and s2, of at most len - * characters and return an int greater than, equal to, or less than 0, - * dependent on whether s1 is lexicographically greater than, equal to, - * or less than s2 after translation of each corresponding character to - * lowercase. The original strings are not modified. - * - * Out: 0 if strings are equal - * < 0 if first string < second string - * > 0 if first string > second string - */ -int -utf8_strncasecmp(const char *s1, const char *s2, int len) -{ - mts_wchar_t c1, c2; - int n1, n2; - const char *p1 = s1; - const char *p2 = s2; - - if (len <= 0) - return (0); - - while (len--) { - if (mts_isascii(*p1)) - c1 = *p1++; - else { - if ((n1 = mts_mbtowc(&c1, p1, MTS_MB_CHAR_MAX)) < 0) - return (-1); - p1 += n1; - } - - if (mts_isascii(*p2)) - c2 = *p2++; - else { - if ((n2 = mts_mbtowc(&c2, p2, MTS_MB_CHAR_MAX)) < 0) - return (1); - p2 += n2; - } - - if (c1 == 0 || c2 == 0) - break; - - if (c1 == c2) - continue; - - c1 = codepage_tolower(c1); - c2 = codepage_tolower(c2); - - if (c1 != c2) - break; - } - - return ((int)c1 - (int)c2); -} - - - -int -utf8_isstrascii(const char *s) -{ - while (*s) { - if (mts_isascii(*s) == 0) - return (0); - s++; - } - return (1); -} diff --git a/usr/src/common/smbsrv/smb_string.c b/usr/src/common/smbsrv/smb_string.c index 8133f72ceb..292f58d4fa 100644 --- a/usr/src/common/smbsrv/smb_string.c +++ b/usr/src/common/smbsrv/smb_string.c @@ -19,27 +19,35 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* - * Implementation of some of the string functions. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef _KERNEL #include <sys/types.h> #include <sys/sunddi.h> #else +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #endif +#include <sys/u8_textprep.h> +#include <smbsrv/alloc.h> #include <smbsrv/string.h> -#include <smbsrv/ctype.h> +#include <smbsrv/cp_usascii.h> +#include <smbsrv/cp_unicode.h> + +#define UNICODE_N_ENTRIES (sizeof (a_unicode) / sizeof (a_unicode[0])) + +/* + * Global pointer to the current codepage: defaults to ASCII, + * and a flag indicating whether the codepage is Unicode or ASCII. + */ +static smb_codepage_t *current_codepage = usascii_codepage; +static boolean_t is_unicode = B_FALSE; +static smb_codepage_t *smb_unicode_init(void); /* * strsubst @@ -100,3 +108,305 @@ strcanon(char *buf, const char *class) *q = '\0'; return (buf); } + +void +smb_codepage_init(void) +{ + smb_codepage_t *cp; + + if (is_unicode) + return; + + if ((cp = smb_unicode_init()) != NULL) { + current_codepage = cp; + is_unicode = B_TRUE; + } else { + current_codepage = usascii_codepage; + is_unicode = B_FALSE; + } +} + +/* + * Determine whether or not a character is an uppercase character. + * This function operates on the current codepage table. Returns + * non-zero if the character is uppercase. Otherwise returns zero. + */ +int +smb_isupper(int c) +{ + uint16_t mask = is_unicode ? 0xffff : 0xff; + + return (current_codepage[c & mask].ctype & CODEPAGE_ISUPPER); +} + +/* + * Determine whether or not a character is an lowercase character. + * This function operates on the current codepage table. Returns + * non-zero if the character is lowercase. Otherwise returns zero. + */ +int +smb_islower(int c) +{ + uint16_t mask = is_unicode ? 0xffff : 0xff; + + return (current_codepage[c & mask].ctype & CODEPAGE_ISLOWER); +} + +/* + * Convert individual characters to their uppercase equivalent value. + * If the specified character is lowercase, the uppercase value will + * be returned. Otherwise the original value will be returned. + */ +int +smb_toupper(int c) +{ + uint16_t mask = is_unicode ? 0xffff : 0xff; + + return (current_codepage[c & mask].upper); +} + +/* + * Convert individual characters to their lowercase equivalent value. + * If the specified character is uppercase, the lowercase value will + * be returned. Otherwise the original value will be returned. + */ +int +smb_tolower(int c) +{ + uint16_t mask = is_unicode ? 0xffff : 0xff; + + return (current_codepage[c & mask].lower); +} + +/* + * Convert a string to uppercase using the appropriate codepage. The + * string is converted in place. A pointer to the string is returned. + * There is an assumption here that uppercase and lowercase values + * always result encode to the same length. + */ +char * +smb_strupr(char *s) +{ + smb_wchar_t c; + char *p = s; + + while (*p) { + if (smb_isascii(*p)) { + *p = smb_toupper(*p); + p++; + } else { + if (smb_mbtowc(&c, p, MTS_MB_CHAR_MAX) < 0) + return (0); + + if (c == 0) + break; + + c = smb_toupper(c); + p += smb_wctomb(p, c); + } + } + + return (s); +} + +/* + * Convert a string to lowercase using the appropriate codepage. The + * string is converted in place. A pointer to the string is returned. + * There is an assumption here that uppercase and lowercase values + * always result encode to the same length. + */ +char * +smb_strlwr(char *s) +{ + smb_wchar_t c; + char *p = s; + + while (*p) { + if (smb_isascii(*p)) { + *p = smb_tolower(*p); + p++; + } else { + if (smb_mbtowc(&c, p, MTS_MB_CHAR_MAX) < 0) + return (0); + + if (c == 0) + break; + + c = smb_tolower(c); + p += smb_wctomb(p, c); + } + } + + return (s); +} + +/* + * Returns 1 if string contains NO uppercase chars 0 otherwise. However, + * -1 is returned if "s" is not a valid multi-byte string. + */ +int +smb_isstrlwr(const char *s) +{ + smb_wchar_t c; + int n; + const char *p = s; + + while (*p) { + if (smb_isascii(*p) && smb_isupper(*p)) + return (0); + else { + if ((n = smb_mbtowc(&c, p, MTS_MB_CHAR_MAX)) < 0) + return (-1); + + if (c == 0) + break; + + if (smb_isupper(c)) + return (0); + + p += n; + } + } + + return (1); +} + +/* + * Returns 1 if string contains NO lowercase chars 0 otherwise. However, + * -1 is returned if "s" is not a valid multi-byte string. + */ +int +smb_isstrupr(const char *s) +{ + smb_wchar_t c; + int n; + const char *p = s; + + while (*p) { + if (smb_isascii(*p) && smb_islower(*p)) + return (0); + else { + if ((n = smb_mbtowc(&c, p, MTS_MB_CHAR_MAX)) < 0) + return (-1); + + if (c == 0) + break; + + if (smb_islower(c)) + return (0); + + p += n; + } + } + + return (1); +} + +/* + * Compare the null-terminated strings s1 and s2 and return an integer + * greater than, equal to or less than 0 dependent on whether s1 is + * lexicographically greater than, equal to or less than s2 after + * translation of each character to lowercase. The original strings + * are not modified. + * + * If n is non-zero, at most n bytes are compared. Otherwise, the strings + * are compared until a null terminator is encountered. + * + * Out: 0 if strings are equal + * < 0 if first string < second string + * > 0 if first string > second string + */ +int +smb_strcasecmp(const char *s1, const char *s2, size_t n) +{ + int err = 0; + int rc; + + rc = u8_strcmp(s1, s2, n, U8_STRCMP_CI_LOWER, U8_UNICODE_LATEST, &err); + if (err != 0) + return (-1); + return (rc); +} + +/* + * First build a codepage based on cp_unicode.h. Then build the unicode + * codepage from this interim codepage by copying the entries over while + * fixing them and filling in the gaps. + */ +static smb_codepage_t * +smb_unicode_init(void) +{ + smb_codepage_t *unicode; + uint32_t a = 0; + uint32_t b = 0; + + unicode = MEM_ZALLOC("unicode", sizeof (smb_codepage_t) << 16); + if (unicode == NULL) + return (NULL); + + while (b != 0xffff) { + /* + * If there is a gap in the standard, + * fill in the gap with no-case entries. + */ + if (UNICODE_N_ENTRIES <= a || a_unicode[a].val > b) { + unicode[b].ctype = CODEPAGE_ISNONE; + unicode[b].upper = (smb_wchar_t)b; + unicode[b].lower = (smb_wchar_t)b; + b++; + continue; + } + + /* + * Copy the entry and fixup as required. + */ + switch (a_unicode[a].ctype) { + case CODEPAGE_ISNONE: + /* + * Replace 0xffff in upper/lower fields with its val. + */ + unicode[b].ctype = CODEPAGE_ISNONE; + unicode[b].upper = (smb_wchar_t)b; + unicode[b].lower = (smb_wchar_t)b; + break; + case CODEPAGE_ISUPPER: + /* + * Some characters may have case yet not have + * case conversion. Treat them as no-case. + */ + if (a_unicode[a].lower == 0xffff) { + unicode[b].ctype = CODEPAGE_ISNONE; + unicode[b].upper = (smb_wchar_t)b; + unicode[b].lower = (smb_wchar_t)b; + } else { + unicode[b].ctype = CODEPAGE_ISUPPER; + unicode[b].upper = (smb_wchar_t)b; + unicode[b].lower = a_unicode[a].lower; + } + break; + case CODEPAGE_ISLOWER: + /* + * Some characters may have case yet not have + * case conversion. Treat them as no-case. + */ + if (a_unicode[a].upper == 0xffff) { + unicode[b].ctype = CODEPAGE_ISNONE; + unicode[b].upper = (smb_wchar_t)b; + unicode[b].lower = (smb_wchar_t)b; + } else { + unicode[b].ctype = CODEPAGE_ISLOWER; + unicode[b].upper = a_unicode[a].upper; + unicode[b].lower = (smb_wchar_t)b; + } + break; + default: + MEM_FREE("unicode", unicode); + return (NULL); + } + + a++; + b++; + }; + + return (unicode); +} diff --git a/usr/src/common/smbsrv/smb_utf8.c b/usr/src/common/smbsrv/smb_utf8.c index 4cdc44bee1..a328e32f7b 100644 --- a/usr/src/common/smbsrv/smb_utf8.c +++ b/usr/src/common/smbsrv/smb_utf8.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -48,8 +48,6 @@ * October 1996 */ -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef _KERNEL #include <sys/types.h> #include <sys/sunddi.h> @@ -59,7 +57,6 @@ #include <assert.h> #include <strings.h> #endif -#include <smbsrv/smb_i18n.h> #include <smbsrv/string.h> @@ -76,13 +73,13 @@ * multibyte character is encountered. */ size_t -mts_mbstowcs(mts_wchar_t *wcstring, const char *mbstring, size_t nwchars) +smb_mbstowcs(smb_wchar_t *wcstring, const char *mbstring, size_t nwchars) { int len; - mts_wchar_t *start = wcstring; + smb_wchar_t *start = wcstring; while (nwchars--) { - len = mts_mbtowc(wcstring, mbstring, MTS_MB_CHAR_MAX); + len = smb_mbtowc(wcstring, mbstring, MTS_MB_CHAR_MAX); if (len < 0) { *wcstring = 0; return ((size_t)-1); @@ -117,10 +114,10 @@ mts_mbstowcs(mts_wchar_t *wcstring, const char *mbstring, size_t nwchars) * mbchar. If mbchar is invalid, returns -1. */ int /*ARGSUSED*/ -mts_mbtowc(mts_wchar_t *wcharp, const char *mbchar, size_t nbytes) +smb_mbtowc(smb_wchar_t *wcharp, const char *mbchar, size_t nbytes) { unsigned char mbyte; - mts_wchar_t wide_char; + smb_wchar_t wide_char; int count; int bytes_left; @@ -130,7 +127,7 @@ mts_mbtowc(mts_wchar_t *wcharp, const char *mbchar, size_t nbytes) /* 0xxxxxxx -> 1 byte ASCII encoding */ if (((mbyte = *mbchar++) & 0x80) == 0) { if (wcharp) - *wcharp = (mts_wchar_t)mbyte; + *wcharp = (smb_wchar_t)mbyte; return (mbyte ? 1 : 0); } @@ -176,7 +173,7 @@ mts_mbtowc(mts_wchar_t *wcharp, const char *mbchar, size_t nbytes) * Returns the numberof bytes written to mbchar. */ int -mts_wctomb(char *mbchar, mts_wchar_t wchar) +smb_wctomb(char *mbchar, smb_wchar_t wchar) { if ((wchar & ~0x7f) == 0) { *mbchar = (char)wchar; @@ -209,11 +206,11 @@ mts_wctomb(char *mbchar, mts_wchar_t wchar) * null byte. */ size_t -mts_wcstombs(char *mbstring, const mts_wchar_t *wcstring, size_t nbytes) +smb_wcstombs(char *mbstring, const smb_wchar_t *wcstring, size_t nbytes) { char *start = mbstring; - const mts_wchar_t *wcp = wcstring; - mts_wchar_t wide_char; + const smb_wchar_t *wcp = wcstring; + smb_wchar_t wide_char; char buf[4]; size_t len; @@ -222,7 +219,7 @@ mts_wcstombs(char *mbstring, const mts_wchar_t *wcstring, size_t nbytes) while (nbytes > MTS_MB_CHAR_MAX) { wide_char = *wcp++; - len = mts_wctomb(mbstring, wide_char); + len = smb_wctomb(mbstring, wide_char); if (wide_char == 0) /*LINTED E_PTRDIFF_OVERFLOW*/ @@ -234,7 +231,7 @@ mts_wcstombs(char *mbstring, const mts_wchar_t *wcstring, size_t nbytes) while (wide_char && nbytes) { wide_char = *wcp++; - if ((len = mts_wctomb(buf, wide_char)) > nbytes) { + if ((len = smb_wctomb(buf, wide_char)) > nbytes) { *mbstring = 0; break; } @@ -255,18 +252,18 @@ mts_wcstombs(char *mbstring, const mts_wchar_t *wcstring, size_t nbytes) * counting the terminating null wide character. */ size_t -mts_wcequiv_strlen(const char *mbs) +smb_wcequiv_strlen(const char *mbs) { - mts_wchar_t wide_char; + smb_wchar_t wide_char; size_t bytes; size_t len = 0; while (*mbs) { - bytes = mts_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); + bytes = smb_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); if (bytes == ((size_t)-1)) return ((size_t)-1); - len += sizeof (mts_wchar_t); + len += sizeof (smb_wchar_t); mbs += bytes; } @@ -280,19 +277,19 @@ mts_wcequiv_strlen(const char *mbs) * not counting the terminating null character. */ size_t -mts_sbequiv_strlen(const char *mbs) +smb_sbequiv_strlen(const char *mbs) { - mts_wchar_t wide_char; + smb_wchar_t wide_char; size_t nbytes; size_t len = 0; while (*mbs) { - nbytes = mts_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); + nbytes = smb_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); if (nbytes == ((size_t)-1)) return ((size_t)-1); if (wide_char & 0xFF00) - len += sizeof (mts_wchar_t); + len += sizeof (smb_wchar_t); else ++len; @@ -319,13 +316,13 @@ mts_sbequiv_strlen(const char *mbs) * If either mbstring or string is a null pointer, -1 is returned. */ int -mts_stombs(char *mbstring, char *string, int max_mblen) +smb_stombs(char *mbstring, char *string, int max_mblen) { char *start = mbstring; unsigned char *p = (unsigned char *)string; int space_left = max_mblen; int len; - mts_wchar_t wide_char; + smb_wchar_t wide_char; char buf[4]; if (!mbstring || !string) @@ -333,14 +330,14 @@ mts_stombs(char *mbstring, char *string, int max_mblen) while (*p && space_left > 2) { wide_char = *p++; - len = mts_wctomb(mbstring, wide_char); + len = smb_wctomb(mbstring, wide_char); mbstring += len; space_left -= len; } if (*p) { wide_char = *p; - if ((len = mts_wctomb(buf, wide_char)) < 2) { + if ((len = smb_wctomb(buf, wide_char)) < 2) { *mbstring = *buf; mbstring += len; space_left -= len; @@ -371,9 +368,9 @@ mts_stombs(char *mbstring, char *string, int max_mblen) * If either mbstring or string is a null pointer, -1 is returned. */ int -mts_mbstos(char *string, const char *mbstring) +smb_mbstos(char *string, const char *mbstring) { - mts_wchar_t wc; + smb_wchar_t wc; unsigned char *start = (unsigned char *)string; int len; @@ -381,15 +378,15 @@ mts_mbstos(char *string, const char *mbstring) return (-1); while (*mbstring) { - if ((len = mts_mbtowc(&wc, mbstring, MTS_MB_CHAR_MAX)) < 0) { + if ((len = smb_mbtowc(&wc, mbstring, MTS_MB_CHAR_MAX)) < 0) { *string = 0; return (-1); } if (wc & 0xFF00) { /*LINTED E_BAD_PTR_CAST_ALIGN*/ - *((mts_wchar_t *)string) = wc; - string += sizeof (mts_wchar_t); + *((smb_wchar_t *)string) = wc; + string += sizeof (smb_wchar_t); } else { diff --git a/usr/src/lib/libadutils/common/addisc.c b/usr/src/lib/libadutils/common/addisc.c index 7a9805bc68..b32f9d7694 100644 --- a/usr/src/lib/libadutils/common/addisc.c +++ b/usr/src/lib/libadutils/common/addisc.c @@ -672,7 +672,7 @@ srv_query(res_state state, const char *svc_name, const char *dname, char **rrname, uint32_t *ttl) { idmap_ad_disc_ds_t *srv; - idmap_ad_disc_ds_t *srv_res; + idmap_ad_disc_ds_t *srv_res = NULL; union { HEADER hdr; uchar_t buf[NS_MAXMSG]; @@ -748,6 +748,11 @@ srv_query(res_state state, const char *svc_name, const char *dname, /* 3. walk through the answer section */ srv_res = calloc(ancount + 1, sizeof (idmap_ad_disc_ds_t)); + if (srv_res == NULL) { + logger(LOG_ERR, "Out of memory"); + return (NULL); + } + *ttl = (uint32_t)-1; for (srv = srv_res, cnt = ancount; @@ -757,10 +762,15 @@ srv_query(res_state state, const char *svc_name, const char *dname, sizeof (namebuf)); if (len < 0) { logger(LOG_ERR, "DNS query invalid message format"); - return (NULL); + goto err; } - if (rrname != NULL && *rrname == NULL) + if (rrname != NULL && *rrname == NULL) { *rrname = strdup(namebuf); + if (*rrname == NULL) { + logger(LOG_ERR, "Out of memory"); + goto err; + } + } ptr += len; NS_GET16(type, ptr); NS_GET16(class, ptr); @@ -768,7 +778,7 @@ srv_query(res_state state, const char *svc_name, const char *dname, NS_GET16(size, ptr); if ((end = ptr + size) > eom) { logger(LOG_ERR, "DNS query invalid message format"); - return (NULL); + goto err; } if (type != T_SRV) { @@ -783,7 +793,7 @@ srv_query(res_state state, const char *svc_name, const char *dname, sizeof (srv->host)); if (len < 0) { logger(LOG_ERR, "DNS query invalid SRV record"); - return (NULL); + goto err; } if (rttl < *ttl) @@ -803,6 +813,14 @@ srv_query(res_state state, const char *svc_name, const char *dname, (int (*)(const void *, const void *))srvcmp); return (srv_res); + +err: + free(srv_res); + if (rrname != NULL) { + free(*rrname); + *rrname = NULL; + } + return (NULL); } @@ -1045,6 +1063,7 @@ ldap_lookup_domains_in_forest(LDAP **ld, idmap_ad_disc_ds_t *globalCatalogs) adutils_sid_t sid; char *sid_str; char *name; + char *dn; sid_ber = ldap_get_values_len(*ld, entry, "objectSid"); @@ -1062,7 +1081,9 @@ ldap_lookup_domains_in_forest(LDAP **ld, idmap_ad_disc_ds_t *globalCatalogs) strcpy(domains[ndomains].sid, sid_str); free(sid_str); - name = DN_to_DNS(ldap_get_dn(*ld, entry)); + dn = ldap_get_dn(*ld, entry); + name = DN_to_DNS(dn); + free(dn); if (name == NULL) goto err; diff --git a/usr/src/lib/libidmap/common/idmap_api.c b/usr/src/lib/libidmap/common/idmap_api.c index a6d773e195..b9c46ca2a8 100644 --- a/usr/src/lib/libidmap/common/idmap_api.c +++ b/usr/src/lib/libidmap/common/idmap_api.c @@ -2306,7 +2306,7 @@ idmap_info_cpy(idmap_info *to, idmap_info *from) /* * This routine is similar to idmap_info_cpy, but the strings * are moved from the "from" info to the "to" info. - * This routine is equivelent of: + * This routine is equivalent to: * * idmap_info_cpy(to,from); * idmap_info_free(from); diff --git a/usr/src/lib/libshare/smb/smb_share_doorclnt.c b/usr/src/lib/libshare/smb/smb_share_doorclnt.c index e7a93507fa..af9f3efa6d 100644 --- a/usr/src/lib/libshare/smb/smb_share_doorclnt.c +++ b/usr/src/lib/libshare/smb/smb_share_doorclnt.c @@ -42,7 +42,7 @@ #include <smbsrv/libsmb.h> #include <smbsrv/smb_share.h> #include <smbsrv/lmerr.h> -#include <smbsrv/cifs.h> +#include <smbsrv/smb.h> #define SMB_SHARE_DOOR_CALL_RETRIES 3 diff --git a/usr/src/lib/smbsrv/libmlrpc/common/ndr_heap.c b/usr/src/lib/smbsrv/libmlrpc/common/ndr_heap.c index d1decb44bf..73a453b00e 100644 --- a/usr/src/lib/smbsrv/libmlrpc/common/ndr_heap.c +++ b/usr/src/lib/smbsrv/libmlrpc/common/ndr_heap.c @@ -186,8 +186,8 @@ ndr_heap_mstring(ndr_heap_t *heap, const char *s, ndr_mstring_t *out) if (s == NULL || out == NULL) return (-1); - out->length = mts_wcequiv_strlen(s); - out->allosize = out->length + sizeof (mts_wchar_t); + out->length = smb_wcequiv_strlen(s); + out->allosize = out->length + sizeof (smb_wchar_t); if ((out->str = ndr_heap_strdup(heap, s)) == NULL) return (-1); @@ -209,17 +209,17 @@ ndr_heap_mkvcs(ndr_heap_t *heap, char *s, ndr_vcstr_t *vc) { int mlen; - vc->wclen = mts_wcequiv_strlen(s); + vc->wclen = smb_wcequiv_strlen(s); vc->wcsize = vc->wclen; - mlen = sizeof (ndr_vcs_t) + vc->wcsize + sizeof (mts_wchar_t); + mlen = sizeof (ndr_vcs_t) + vc->wcsize + sizeof (smb_wchar_t); vc->vcs = ndr_heap_malloc(heap, mlen); if (vc->vcs) { vc->vcs->vc_first_is = 0; - vc->vcs->vc_length_is = vc->wclen / sizeof (mts_wchar_t); - (void) mts_mbstowcs((mts_wchar_t *)vc->vcs->buffer, s, + vc->vcs->vc_length_is = vc->wclen / sizeof (smb_wchar_t); + (void) smb_mbstowcs((smb_wchar_t *)vc->vcs->buffer, s, vc->vcs->vc_length_is); } } diff --git a/usr/src/lib/smbsrv/libmlrpc/common/ndr_process.c b/usr/src/lib/smbsrv/libmlrpc/common/ndr_process.c index 6147d684ab..af76a0a08c 100644 --- a/usr/src/lib/smbsrv/libmlrpc/common/ndr_process.c +++ b/usr/src/lib/smbsrv/libmlrpc/common/ndr_process.c @@ -1189,8 +1189,8 @@ ndr_outer_string(ndr_ref_t *outer_ref) * size_is is the number of characters in the * (multibyte) string, including the null. */ - size_is = (mts_wcequiv_strlen(valp) / - sizeof (mts_wchar_t)) + 1; + size_is = (smb_wcequiv_strlen(valp) / + sizeof (smb_wchar_t)) + 1; if (size_is > NDR_STRING_MAX) { NDR_SET_ERROR(outer_ref, NDR_ERR_STRLEN); @@ -1919,7 +1919,7 @@ ndr_s_wchar(ndr_ref_t *encl_ref) (void) sprintf(name, "[%lu]", i); if (nds->m_op == NDR_M_OP_MARSHALL) { - count = mts_mbtowc((mts_wchar_t *)&wide_char, valp, + count = smb_mbtowc((smb_wchar_t *)&wide_char, valp, MTS_MB_CHAR_MAX); if (count < 0) { return (0); @@ -1941,7 +1941,7 @@ ndr_s_wchar(ndr_ref_t *encl_ref) return (0); if (nds->m_op == NDR_M_OP_UNMARSHALL) { - count = mts_wctomb(valp, wide_char); + count = smb_wctomb(valp, wide_char); if ((++char_count) == encl_ref->strlen_is) { valp += count; @@ -1970,10 +1970,10 @@ ndr_s_wchar(ndr_ref_t *encl_ref) * multibyte character is encountered. */ size_t -ndr_mbstowcs(ndr_stream_t *nds, mts_wchar_t *wcs, const char *mbs, +ndr_mbstowcs(ndr_stream_t *nds, smb_wchar_t *wcs, const char *mbs, size_t nwchars) { - mts_wchar_t *start = wcs; + smb_wchar_t *start = wcs; int nbytes; while (nwchars--) { @@ -1998,16 +1998,16 @@ ndr_mbstowcs(ndr_stream_t *nds, mts_wchar_t *wcs, const char *mbs, * is stored in wcharp. Up to nbytes bytes are examined. * * If mbchar is valid, returns the number of bytes processed in mbchar. - * If mbchar is invalid, returns -1. See also mts_mbtowc(). + * If mbchar is invalid, returns -1. See also smb_mbtowc(). */ /*ARGSUSED*/ int -ndr_mbtowc(ndr_stream_t *nds, mts_wchar_t *wcharp, const char *mbchar, +ndr_mbtowc(ndr_stream_t *nds, smb_wchar_t *wcharp, const char *mbchar, size_t nbytes) { int rc; - if ((rc = mts_mbtowc(wcharp, mbchar, nbytes)) < 0) + if ((rc = smb_mbtowc(wcharp, mbchar, nbytes)) < 0) return (rc); #ifdef _BIG_ENDIAN diff --git a/usr/src/lib/smbsrv/libmlsvc/common/dssetup_svc.c b/usr/src/lib/smbsrv/libmlsvc/common/dssetup_svc.c index 2175553bfa..501c74c391 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/dssetup_svc.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/dssetup_svc.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -184,7 +184,7 @@ dssetup_member_server(ds_primary_domain_info_t *info, ndr_xa_t *mxa) return (NT_STATUS_CANT_ACCESS_DOMAIN_INFO); } - (void) utf8_strlwr(dns_domain); + (void) smb_strlwr(dns_domain); info->flags = 0; info->nt_domain = NDR_STRDUP(mxa, nt_domain); diff --git a/usr/src/lib/smbsrv/libmlsvc/common/eventlog_svc.c b/usr/src/lib/smbsrv/libmlsvc/common/eventlog_svc.c index 645f8c44a7..3a47a3041d 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/eventlog_svc.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/eventlog_svc.c @@ -43,7 +43,7 @@ #define LOGR_RECORD_SIGNATURE 0x654C664C #define LOGR_PRI(p) ((p) & LOG_PRIMASK) -#define LOGR_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (mts_wchar_t)) +#define LOGR_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (smb_wchar_t)) #define LOGR_MSG_DWORD_OFFSET 12 #define LOGR_MSG_WORD_OFFSET 4 @@ -437,15 +437,15 @@ logr_set_logrecord(char *src_name, logr_entry_t *le, { int srcname_len = 0, hostname_len = 0, len; int str_offs, sh_len; - mts_wchar_t wcs_hostname[MAXHOSTNAMELEN]; - mts_wchar_t wcs_srcname[SYS_NMLN * 2]; + smb_wchar_t wcs_hostname[MAXHOSTNAMELEN]; + smb_wchar_t wcs_srcname[SYS_NMLN * 2]; - (void) mts_mbstowcs(wcs_srcname, src_name, + (void) smb_mbstowcs(wcs_srcname, src_name, strlen(src_name) + 1); srcname_len = LOGR_WNSTRLEN(src_name); /* Because, Solaris allows remote logging, need to get hostname here */ - (void) mts_mbstowcs(wcs_hostname, le->le_hostname, + (void) smb_mbstowcs(wcs_hostname, le->le_hostname, strlen(le->le_hostname) + 1); hostname_len = LOGR_WNSTRLEN(le->le_hostname); @@ -476,7 +476,7 @@ logr_set_logrecord(char *src_name, logr_entry_t *le, len = strlen(le->le_msg) + 1; if (len > 0) /*LINTED E_BAD_PTR_CAST_ALIGN*/ - (void) mts_mbstowcs((mts_wchar_t *)(rec->info + sh_len), + (void) smb_mbstowcs((smb_wchar_t *)(rec->info + sh_len), le->le_msg, len); rec->Length2 = sizeof (logr_record_t); diff --git a/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h b/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h index f0491e4c17..99f10fc368 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h +++ b/usr/src/lib/smbsrv/libmlsvc/common/libmlsvc.h @@ -175,7 +175,7 @@ void ndr_rpc_status(mlsvc_handle_t *, int, uint32_t); * Calculate the wide-char equivalent string length required to * store a string - including the terminating null wide-char. */ -#define SVCCTL_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (mts_wchar_t)) +#define SVCCTL_WNSTRLEN(S) ((strlen((S)) + 1) * sizeof (smb_wchar_t)) /* An AVL-storable node representing each service in the SCM database. */ typedef struct svcctl_svc_node { diff --git a/usr/src/lib/smbsrv/libmlsvc/common/lsalib.c b/usr/src/lib/smbsrv/libmlsvc/common/lsalib.c index c58b5d36f3..c091d63f9b 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/lsalib.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/lsalib.c @@ -316,7 +316,7 @@ lsa_lookup_name_builtin(char *domain, char *name, smb_account_t *info) if ((wkadom = smb_wka_get_domain(wka->wka_domidx)) == NULL) return (NT_STATUS_INTERNAL_ERROR); - if ((domain != NULL) && (utf8_strcasecmp(domain, wkadom) != 0)) + if ((domain != NULL) && (smb_strcasecmp(domain, wkadom, 0) != 0)) return (NT_STATUS_NONE_MAPPED); info->a_name = strdup(name); diff --git a/usr/src/lib/smbsrv/libmlsvc/common/lsar_lookup.c b/usr/src/lib/smbsrv/libmlsvc/common/lsar_lookup.c index 127f2b4cbe..1121d67d6f 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/lsar_lookup.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/lsar_lookup.c @@ -239,10 +239,10 @@ lsar_lookup_names(mlsvc_handle_t *lsa_handle, char *name, smb_account_t *info) name = p; } - length = mts_wcequiv_strlen(name) + sizeof (mts_wchar_t); + length = smb_wcequiv_strlen(name) + sizeof (smb_wchar_t); arg.lookup_level = MSLSA_LOOKUP_LEVEL_1; } else { - length = mts_wcequiv_strlen(name); + length = smb_wcequiv_strlen(name); arg.lookup_level = MSLSA_LOOKUP_LEVEL_1; } @@ -594,9 +594,9 @@ lsar_lookup_priv_value(mlsvc_handle_t *lsa_handle, char *name, bzero(&arg, sizeof (struct mslsa_LookupPrivValue)); (void) memcpy(&arg.handle, lsa_handle, sizeof (mslsa_handle_t)); - length = mts_wcequiv_strlen(name); + length = smb_wcequiv_strlen(name); if (ndr_rpc_server_os(lsa_handle) == NATIVE_OS_WIN2000) - length += sizeof (mts_wchar_t); + length += sizeof (smb_wchar_t); arg.name.length = length; arg.name.allosize = length; @@ -682,7 +682,7 @@ lsar_lookup_priv_display_name(mlsvc_handle_t *lsa_handle, char *name, bzero(&arg, sizeof (struct mslsa_LookupPrivDisplayName)); (void) memcpy(&arg.handle, lsa_handle, sizeof (mslsa_handle_t)); - length = mts_wcequiv_strlen(name); + length = smb_wcequiv_strlen(name); arg.name.length = length; arg.name.allosize = length; arg.name.str = (unsigned char *)name; @@ -827,7 +827,7 @@ lsar_lookup_names2(mlsvc_handle_t *lsa_handle, char *name, smb_account_t *info) arg.name_table = (struct mslsa_lup_name_table *)&name_table; name_table.n_entry = 1; - length = mts_wcequiv_strlen(name) + sizeof (mts_wchar_t); + length = smb_wcequiv_strlen(name) + sizeof (smb_wchar_t); name_table.name[0].length = length; name_table.name[0].allosize = length; name_table.name[0].str = (unsigned char *)name; diff --git a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c index 11569ef97b..9194ec7871 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_client.c @@ -580,8 +580,8 @@ static boolean_t ndr_svinfo_match(const char *server, const char *domain, const ndr_svinfo_t *svi) { - if ((utf8_strcasecmp(server, svi->svi_server) == 0) && - (utf8_strcasecmp(domain, svi->svi_domain) == 0)) { + if ((smb_strcasecmp(server, svi->svi_server, 0) == 0) && + (smb_strcasecmp(domain, svi->svi_domain, 0) == 0)) { return (B_TRUE); } diff --git a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_domain.c b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_domain.c index a18e07fefa..a0ee06feec 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_domain.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_domain.c @@ -287,7 +287,7 @@ smb_ddiscover_nbt(char *domain, char *server, smb_domainex_t *dxi) return (B_FALSE); if ((*dnsdomain != '\0') && - utf8_strcasecmp(domain, dxi->d_primary.di_nbname)) + smb_strcasecmp(domain, dxi->d_primary.di_nbname, 0)) return (B_FALSE); /* @@ -335,7 +335,7 @@ smb_ddiscover_domain_match(char *nb_domain, char *buf, uint32_t len) first_label[15] = '\0'; } - if (utf8_strcasecmp(nb_domain, first_label) == 0) { + if (smb_strcasecmp(nb_domain, first_label, 0) == 0) { found = B_TRUE; (void) strlcpy(buf, entry, len); break; @@ -418,9 +418,9 @@ smb_ddiscover_use_config(char *domain, smb_domainex_t *dxi) NULL, NULL, NULL); if (SMB_IS_FQDN(domain)) - use = (utf8_strcasecmp(dinfo->di_fqname, domain) == 0); + use = (smb_strcasecmp(dinfo->di_fqname, domain, 0) == 0); else - use = (utf8_strcasecmp(dinfo->di_nbname, domain) == 0); + use = (smb_strcasecmp(dinfo->di_nbname, domain, 0) == 0); if (use) smb_config_getdomaininfo(NULL, NULL, dinfo->di_sid, diff --git a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_util.c b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_util.c index dd4a064e3a..ac4cda132f 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_util.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_util.c @@ -172,7 +172,7 @@ mlsvc_join(smb_domainex_t *dxi, char *user, char *plain_text) if (status == NT_STATUS_SUCCESS) { (void) smb_getnetbiosname(machine_passwd, sizeof (machine_passwd)); - (void) utf8_strlwr(machine_passwd); + (void) smb_strlwr(machine_passwd); } } diff --git a/usr/src/lib/smbsrv/libmlsvc/common/samlib.c b/usr/src/lib/smbsrv/libmlsvc/common/samlib.c index 0383bdc8cb..254102b85d 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/samlib.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/samlib.c @@ -382,7 +382,7 @@ int sam_oem_password(oem_password_t *oem_password, unsigned char *new_password, unsigned char *old_password) { - mts_wchar_t *unicode_password; + smb_wchar_t *unicode_password; int length; #ifdef PBSHORTCUT @@ -390,7 +390,7 @@ sam_oem_password(oem_password_t *oem_password, unsigned char *new_password, #endif /* PBSHORTCUT */ length = strlen((char const *)new_password); - unicode_password = alloca((length + 1) * sizeof (mts_wchar_t)); + unicode_password = alloca((length + 1) * sizeof (smb_wchar_t)); length = smb_auth_qnd_unicode((unsigned short *)unicode_password, (char *)new_password, length); diff --git a/usr/src/lib/smbsrv/libmlsvc/common/samr_lookup.c b/usr/src/lib/smbsrv/libmlsvc/common/samr_lookup.c index 6d858ab02d..477a5a1e62 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/samr_lookup.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/samr_lookup.c @@ -71,9 +71,9 @@ samr_lookup_domain(mlsvc_handle_t *samr_handle, char *domain_name) (void) memcpy(&arg.handle, &samr_handle->handle, sizeof (samr_handle_t)); - length = mts_wcequiv_strlen(domain_name); + length = smb_wcequiv_strlen(domain_name); if (ndr_rpc_server_os(samr_handle) == NATIVE_OS_WIN2000) - length += sizeof (mts_wchar_t); + length += sizeof (smb_wchar_t); arg.domain_name.length = length; arg.domain_name.allosize = length; @@ -161,9 +161,9 @@ samr_lookup_domain_names(mlsvc_handle_t *domain_handle, char *name, arg.index = 0; arg.total = 1; - length = mts_wcequiv_strlen(name); + length = smb_wcequiv_strlen(name); if (ndr_rpc_server_os(domain_handle) == NATIVE_OS_WIN2000) - length += sizeof (mts_wchar_t); + length += sizeof (smb_wchar_t); arg.name.length = length; arg.name.allosize = length; @@ -511,7 +511,7 @@ samr_set_user_password(unsigned char *nt_key, BYTE *oem_password) if (smb_getnetbiosname(hostname, sizeof (hostname)) != 0) return (-1); - (void) utf8_strlwr(hostname); + (void) smb_strlwr(hostname); /* * Generate the OEM password from the hostname and the user session diff --git a/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c b/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c index 3a13d331d0..5b78165a68 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/smb_logon.c @@ -502,7 +502,7 @@ smb_logon_local(netr_client_t *clnt, smb_token_t *token) } smb_guest_account(guest, SMB_USERNAME_MAXLEN); - isguest = (utf8_strcasecmp(guest, clnt->e_username) == 0); + isguest = (smb_strcasecmp(guest, clnt->e_username, 0) == 0); status = smb_token_auth_local(clnt, token, &smbpw); if (status == NT_STATUS_SUCCESS) { diff --git a/usr/src/lib/smbsrv/libmlsvc/common/smb_share.c b/usr/src/lib/smbsrv/libmlsvc/common/smb_share.c index d099db11b5..d42622dfca 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/smb_share.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/smb_share.c @@ -47,11 +47,8 @@ #include <smbsrv/libsmb.h> #include <smbsrv/libsmbns.h> #include <smbsrv/libmlsvc.h> - -#include <smbsrv/lm.h> #include <smbsrv/smb_share.h> -#include <smbsrv/cifs.h> -#include <smbsrv/nterror.h> +#include <smbsrv/smb.h> #include <mlsvc.h> #define SMB_SHR_ERROR_THRESHOLD 3 @@ -800,7 +797,7 @@ smb_shr_is_restricted(char *sharename) return (B_FALSE); for (i = 0; i < sizeof (restricted)/sizeof (restricted[0]); i++) { - if (utf8_strcasecmp(restricted[i], sharename) == 0) + if (smb_strcasecmp(restricted[i], sharename, 0) == 0) return (B_TRUE); } @@ -825,7 +822,7 @@ smb_shr_is_admin(char *sharename) return (B_FALSE); if (strlen(sharename) == 2 && - mts_isalpha(sharename[0]) && sharename[1] == '$') { + smb_isalpha(sharename[0]) && sharename[1] == '$') { return (B_TRUE); } @@ -1122,24 +1119,23 @@ smb_shr_addipc(void) static void smb_shr_set_oemname(smb_share_t *si) { - unsigned int cpid = oem_get_smb_cpid(); - mts_wchar_t *unibuf; + smb_wchar_t *unibuf; char *oem_name; int length; length = strlen(si->shr_name) + 1; oem_name = malloc(length); - unibuf = malloc(length * sizeof (mts_wchar_t)); + unibuf = malloc(length * sizeof (smb_wchar_t)); if ((oem_name == NULL) || (unibuf == NULL)) { free(oem_name); free(unibuf); return; } - (void) mts_mbstowcs(unibuf, si->shr_name, length); + (void) smb_mbstowcs(unibuf, si->shr_name, length); - if (unicodestooems(oem_name, unibuf, length, cpid) == 0) + if (ucstooem(oem_name, unibuf, length, OEM_CPG_850) == 0) (void) strcpy(oem_name, si->shr_name); free(unibuf); @@ -1284,7 +1280,7 @@ smb_shr_cache_findent(char *sharename) { HT_ITEM *item; - (void) utf8_strlwr(sharename); + (void) smb_strlwr(sharename); item = ht_find_item(smb_shr_cache.sc_cache, sharename); if (item && item->hi_data) return ((smb_share_t *)item->hi_data); @@ -1333,7 +1329,7 @@ smb_shr_cache_addent(smb_share_t *si) bcopy(si, cache_ent, sizeof (smb_share_t)); - (void) utf8_strlwr(cache_ent->shr_name); + (void) smb_strlwr(cache_ent->shr_name); smb_shr_set_oemname(cache_ent); if ((si->shr_type & STYPE_IPC) == 0) @@ -1363,7 +1359,7 @@ smb_shr_cache_addent(smb_share_t *si) static void smb_shr_cache_delent(char *sharename) { - (void) utf8_strlwr(sharename); + (void) smb_strlwr(sharename); (void) ht_remove_item(smb_shr_cache.sc_cache, sharename); } @@ -2192,8 +2188,7 @@ smb_shr_expand_subs(char **cmd_toks, smb_share_t *si, smb_execsub_info_t *subs) char hostname[MAXHOSTNAMELEN]; char ip_str[INET6_ADDRSTRLEN]; char name[SMB_PI_MAX_HOST]; - mts_wchar_t wbuf[SMB_PI_MAX_HOST]; - unsigned int cpid = oem_get_smb_cpid(); + smb_wchar_t wbuf[SMB_PI_MAX_HOST]; int i; if (cmd_toks == NULL || *cmd_toks == NULL) @@ -2236,12 +2231,12 @@ smb_shr_expand_subs(char **cmd_toks, smb_share_t *si, smb_execsub_info_t *subs) if (*subs->e_cli_netbiosname == '\0') unknown = B_TRUE; else { - (void) mts_mbstowcs(wbuf, + (void) smb_mbstowcs(wbuf, subs->e_cli_netbiosname, SMB_PI_MAX_HOST - 1); - if (unicodestooems(name, wbuf, - SMB_PI_MAX_HOST, cpid) == 0) + if (ucstooem(name, wbuf, + SMB_PI_MAX_HOST, OEM_CPG_850) == 0) (void) strlcpy(name, subs->e_cli_netbiosname, SMB_PI_MAX_HOST); diff --git a/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_svc.c b/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_svc.c index 616701292f..08eeca4462 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_svc.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/srvsvc_svc.c @@ -32,6 +32,7 @@ */ #include <sys/errno.h> +#include <sys/tzfile.h> #include <unistd.h> #include <netdb.h> #include <strings.h> @@ -49,9 +50,8 @@ #include <smbsrv/libsmb.h> #include <smbsrv/libmlsvc.h> #include <smbsrv/lmerr.h> -#include <smbsrv/nterror.h> #include <smbsrv/nmpipes.h> -#include <smbsrv/cifs.h> +#include <smbsrv/smb.h> #include <smbsrv/netrauth.h> #include <smbsrv/ndl/srvsvc.ndl> #include <smbsrv/smb_common_door.h> @@ -1196,7 +1196,7 @@ srvsvc_modify_transient_share(smb_share_t *si, srvsvc_netshare_setinfo_t *info) uint32_t nerr; if (info->nss_netname != NULL && info->nss_netname[0] != '\0' && - utf8_strcasecmp(info->nss_netname, si->shr_name) != 0) { + smb_strcasecmp(info->nss_netname, si->shr_name, 0) != 0) { nerr = smb_shr_rename(si->shr_name, info->nss_netname); if (nerr != NERR_Success) return (nerr); @@ -1790,6 +1790,9 @@ netservergetinfo_no_memory: * positive; for time zones east of Greenwich, the value is negative. * A value of -1 indicates that the time zone is undefined. * + * Determine offset from GMT. If daylight saving time use altzone, + * otherwise use timezone. + * * The clock tick value represents a resolution of one ten-thousandth * (0.0001) second. */ @@ -1800,6 +1803,8 @@ srvsvc_s_NetRemoteTOD(void *arg, ndr_xa_t *mxa) struct mslm_TIME_OF_DAY_INFO *tod; struct timeval time_val; struct tm tm; + time_t gmtoff; + (void) gettimeofday(&time_val, 0); (void) gmtime_r(&time_val.tv_sec, &tm); @@ -1810,6 +1815,8 @@ srvsvc_s_NetRemoteTOD(void *arg, ndr_xa_t *mxa) return (ERROR_NOT_ENOUGH_MEMORY); } + bzero(tod, sizeof (struct mslm_TIME_OF_DAY_INFO)); + tod->tod_elapsedt = time_val.tv_sec; tod->tod_msecs = time_val.tv_usec; tod->tod_hours = tm.tm_hour; @@ -1823,6 +1830,8 @@ srvsvc_s_NetRemoteTOD(void *arg, ndr_xa_t *mxa) tod->tod_weekday = tm.tm_wday; (void) localtime_r(&time_val.tv_sec, &tm); + gmtoff = (tm.tm_isdst) ? altzone : timezone; + tod->tod_timezone = gmtoff / SECSPERMIN; param->bufptr = tod; param->status = ERROR_SUCCESS; @@ -2703,7 +2712,7 @@ srvsvc_s_NetShareCheck(void *arg, ndr_xa_t *mxa) while ((si = smb_shr_iterate(&iterator)) != NULL) { path = srvsvc_share_mkpath(mxa, si->shr_path); - if (utf8_strcasecmp(path, (char *)param->path) == 0) { + if (smb_strcasecmp(path, (char *)param->path, 0) == 0) { param->stype = (si->shr_type & STYPE_MASK); param->status = NERR_Success; return (NDR_DRC_OK); @@ -2908,7 +2917,7 @@ srvsvc_sa_modify(smb_share_t *si, srvsvc_netshare_setinfo_t *info) } if (info->nss_netname != NULL && info->nss_netname[0] != '\0' && - utf8_strcasecmp(info->nss_netname, si->shr_name) != 0) { + smb_strcasecmp(info->nss_netname, si->shr_name, 0) != 0) { (void) sa_set_resource_attr(resource, SHOPT_NAME, info->nss_netname); renamed = B_TRUE; diff --git a/usr/src/lib/smbsrv/libmlsvc/common/svcctl_scm.c b/usr/src/lib/smbsrv/libmlsvc/common/svcctl_scm.c index 977b3874c9..5587c66131 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/svcctl_scm.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/svcctl_scm.c @@ -551,7 +551,7 @@ svcctl_scm_enum_services(svcctl_manager_context_t *mgr_ctx, uint8_t *buf, { svcctl_svc_node_t *node; int base_offset, offset; - mts_wchar_t *w_name; + smb_wchar_t *w_name; char *a_name; char *node_name; size_t namelen; @@ -590,8 +590,8 @@ svcctl_scm_enum_services(svcctl_manager_context_t *mgr_ctx, uint8_t *buf, if (use_wchar) { offset -= SVCCTL_WNSTRLEN(node_name); /*LINTED E_BAD_PTR_CAST_ALIGN*/ - w_name = (mts_wchar_t *)&buf[offset]; - (void) mts_mbstowcs(w_name, node_name, namelen); + w_name = (smb_wchar_t *)&buf[offset]; + (void) smb_mbstowcs(w_name, node_name, namelen); } else { offset -= namelen; a_name = (char *)&buf[offset]; @@ -607,8 +607,8 @@ svcctl_scm_enum_services(svcctl_manager_context_t *mgr_ctx, uint8_t *buf, if (use_wchar) { offset -= SVCCTL_WNSTRLEN(node_name); /*LINTED E_BAD_PTR_CAST_ALIGN*/ - w_name = (mts_wchar_t *)&buf[offset]; - (void) mts_mbstowcs(w_name, node_name, namelen); + w_name = (smb_wchar_t *)&buf[offset]; + (void) smb_mbstowcs(w_name, node_name, namelen); } else { offset -= namelen; a_name = (char *)&buf[offset]; @@ -654,8 +654,8 @@ svcctl_scm_cb_bytes_needed(void *svc_node, void *byte_cnt) svcctl_svc_node_t *node = svc_node; int *cnt = byte_cnt; - *cnt += (strlen(node->sn_fmri) + 1) * sizeof (mts_wchar_t); - *cnt += (strlen(node->sn_name) + 1) * sizeof (mts_wchar_t); + *cnt += (strlen(node->sn_fmri) + 1) * sizeof (smb_wchar_t); + *cnt += (strlen(node->sn_name) + 1) * sizeof (smb_wchar_t); return (UU_WALK_NEXT); } diff --git a/usr/src/lib/smbsrv/libmlsvc/common/svcctl_svc.c b/usr/src/lib/smbsrv/libmlsvc/common/svcctl_svc.c index 23964f7d9a..1cc2c17cc2 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/svcctl_svc.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/svcctl_svc.c @@ -1194,7 +1194,7 @@ svcctl_s_QueryServiceConfig2W(void *arg, ndr_xa_t *mxa) svcctl_svc_node_t *svc; svc_config_rsp_t svc_rsp; int offset, input_bufsize, bytes_needed = 0; - mts_wchar_t *wide_desc; + smb_wchar_t *wide_desc; char *desc; DWORD status; @@ -1245,8 +1245,8 @@ svcctl_s_QueryServiceConfig2W(void *arg, ndr_xa_t *mxa) offset = sizeof (svc_description_t); svc_rsp.svc_desc->desc = offset; /*LINTED E_BAD_PTR_CAST_ALIGN*/ - wide_desc = (mts_wchar_t *)¶m->buffer[offset]; - (void) mts_mbstowcs(wide_desc, desc, (strlen(desc) + 1)); + wide_desc = (smb_wchar_t *)¶m->buffer[offset]; + (void) smb_mbstowcs(wide_desc, desc, (strlen(desc) + 1)); offset += SVCCTL_WNSTRLEN(desc); param->bytes_needed = offset; diff --git a/usr/src/lib/smbsrv/libmlsvc/common/winreg_svc.c b/usr/src/lib/smbsrv/libmlsvc/common/winreg_svc.c index 212c4933b2..72905f709a 100644 --- a/usr/src/lib/smbsrv/libmlsvc/common/winreg_svc.c +++ b/usr/src/lib/smbsrv/libmlsvc/common/winreg_svc.c @@ -780,7 +780,7 @@ winreg_s_QueryValue(void *arg, ndr_xa_t *mxa) return (NDR_DRC_OK); } - slen = mts_wcequiv_strlen(value) + sizeof (mts_wchar_t); + slen = smb_wcequiv_strlen(value) + sizeof (smb_wchar_t); msize = sizeof (struct winreg_value) + slen; param->value = (struct winreg_value *)NDR_MALLOC(mxa, msize); @@ -799,7 +799,7 @@ winreg_s_QueryValue(void *arg, ndr_xa_t *mxa) pv->vc_first_is = 0; pv->vc_length_is = slen; /*LINTED E_BAD_PTR_CAST_ALIGN*/ - (void) ndr_mbstowcs(NULL, (mts_wchar_t *)pv->value, value, slen); + (void) ndr_mbstowcs(NULL, (smb_wchar_t *)pv->value, value, slen); *param->type = 1; *param->value_size = slen; diff --git a/usr/src/lib/smbsrv/libsmb/Makefile.com b/usr/src/lib/smbsrv/libsmb/Makefile.com index 1cb861d8ba..13795457a1 100644 --- a/usr/src/lib/smbsrv/libsmb/Makefile.com +++ b/usr/src/lib/smbsrv/libsmb/Makefile.com @@ -33,11 +33,9 @@ OBJS_SHARED = \ smb_msgbuf.o \ smb_native.o \ smb_oem.o \ - smb_opmlang.o \ smb_share_door_decode.o \ smb_sid.o \ smb_status_xlat.o \ - smb_strcase.o \ smb_string.o \ smb_token.o \ smb_token_xdr.o \ diff --git a/usr/src/lib/smbsrv/libsmb/common/libsmb.h b/usr/src/lib/smbsrv/libsmb/common/libsmb.h index 029294f3a7..189bce0021 100644 --- a/usr/src/lib/smbsrv/libsmb/common/libsmb.h +++ b/usr/src/lib/smbsrv/libsmb/common/libsmb.h @@ -50,12 +50,8 @@ extern "C" { #include <smbsrv/ntstatus.h> #include <smbsrv/smb_door_svc.h> #include <smbsrv/alloc.h> -#include <smbsrv/codepage.h> -#include <smbsrv/ctype.h> #include <smbsrv/hash_table.h> #include <smbsrv/msgbuf.h> -#include <smbsrv/oem.h> -#include <smbsrv/smb_i18n.h> #include <smbsrv/wintypes.h> #include <smbsrv/smb_xdr.h> #include <smbsrv/smbinfo.h> @@ -324,7 +320,7 @@ void smb_tracef(const char *fmt, ...); typedef struct smb_auth_name_entry { unsigned short nne_type; unsigned short nne_len; - mts_wchar_t nne_name[SMB_PI_MAX_DOMAIN * 2]; + smb_wchar_t nne_name[SMB_PI_MAX_DOMAIN * 2]; } smb_auth_name_entry_t; /* @@ -449,7 +445,7 @@ extern int smb_pwd_iteropen(smb_pwditer_t *); extern smb_luser_t *smb_pwd_iterate(smb_pwditer_t *); extern void smb_pwd_iterclose(smb_pwditer_t *); -extern int smb_auth_qnd_unicode(mts_wchar_t *, const char *, int); +extern int smb_auth_qnd_unicode(smb_wchar_t *, const char *, int); extern int smb_auth_hmac_md5(unsigned char *, int, unsigned char *, int, unsigned char *); diff --git a/usr/src/lib/smbsrv/libsmb/common/mapfile-vers b/usr/src/lib/smbsrv/libsmb/common/mapfile-vers index 0f895b0654..4191970939 100644 --- a/usr/src/lib/smbsrv/libsmb/common/mapfile-vers +++ b/usr/src/lib/smbsrv/libsmb/common/mapfile-vers @@ -39,10 +39,6 @@ SUNWprivate { global: bintohex; - codepage_islower; - codepage_isupper; - codepage_tolower; - codepage_toupper; hexdump; hextobin; ht_add_item; @@ -74,20 +70,9 @@ SUNWprivate { list_prev; list_remove; list_tail; - mts_mbstos; - mts_mbstowcs; - mts_mbtowc; - mts_sbequiv_strlen; - mts_stombs; - mts_wcequiv_strlen; - mts_wcstombs; - mts_wctomb; netr_client_mkabsolute; netr_client_xfree; - oem_get_smb_cpid; - oem_get_telnet_cpid; - oem_language_set; - oemstounicodes; + oemtoucs; rand_hash; randomize; smb_account_free; @@ -109,6 +94,7 @@ SUNWprivate { smb_auth_validate_lm; smb_auth_validate_nt; smb_chk_hostaccess; + smb_codepage_init; smb_config_get; smb_config_get_fg_flag; smb_config_get_localsid; @@ -226,6 +212,10 @@ SUNWprivate { smb_ipc_rollback; smb_ipc_get_user; smb_ipc_get_passwd; + smb_islower; + smb_isupper; + smb_isstrlwr; + smb_isstrupr; smb_kmod_bind; smb_kmod_enum; smb_kmod_enum_init; @@ -275,6 +265,9 @@ SUNWprivate { smb_match; smb_match_ci; smb_match_netlogon_seqnum; + smb_mbstos; + smb_mbstowcs; + smb_mbtowc; smb_msgbuf_base; smb_msgbuf_decode; smb_msgbuf_dword_align; @@ -335,6 +328,7 @@ SUNWprivate { smb_sam_grp_cnt; smb_sam_usr_cnt; smb_sam_usr_groups; + smb_sbequiv_strlen; smb_sd_get_secinfo; smb_sd_init; smb_sd_len; @@ -358,12 +352,21 @@ SUNWprivate { smb_sid_type2str; smb_smf_maintenance_mode; smb_smf_restart_service; + smb_stombs; + smb_strcasecmp; + smb_strlwr; + smb_strupr; + smb_tolower; + smb_toupper; smb_token_mkselfrel; smb_token_query_privilege; smb_tonetbiosname; smb_trace; smb_tracef; smb_update_netlogon_seqnum; + smb_wcequiv_strlen; + smb_wcstombs; + smb_wctomb; smb_wka_fini; smb_wka_get_domain; smb_wka_get_sid; @@ -379,14 +382,7 @@ SUNWprivate { strsubst; strtrim; trim_whitespace; - unicodestooems; - utf8_isstrascii; - utf8_isstrlwr; - utf8_isstrupr; - utf8_strcasecmp; - utf8_strlwr; - utf8_strncasecmp; - utf8_strupr; + ucstooem; xdr_smb_dr_bytes_t; xdr_smb_dr_joininfo_t; xdr_smb_dr_string_t; diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_acl.c b/usr/src/lib/smbsrv/libsmb/common/smb_acl.c index 81b544dcd0..9d981ceeb4 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_acl.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_acl.c @@ -27,11 +27,9 @@ #include <strings.h> #include <assert.h> -#include <smbsrv/ntifs.h> +#include <smbsrv/smb.h> #include <smbsrv/smb_sid.h> #include <smbsrv/smb_idmap.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/ntaccess.h> #define ACE_ALL_TYPES 0x001F diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_auth.c b/usr/src/lib/smbsrv/libsmb/common/smb_auth.c index 161fcd4d27..b53d109ed7 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_auth.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_auth.c @@ -25,9 +25,7 @@ #include <strings.h> #include <stdlib.h> -#include <smbsrv/codepage.h> -#include <smbsrv/oem.h> -#include <smbsrv/ctype.h> +#include <smbsrv/string.h> #include <smbsrv/libsmb.h> extern void randomize(char *data, unsigned len); @@ -40,24 +38,22 @@ static uint64_t unix_micro_to_nt_time(struct timeval *unix_time); * Returns the length of dst in bytes. */ int -smb_auth_qnd_unicode(mts_wchar_t *dst, const char *src, int length) +smb_auth_qnd_unicode(smb_wchar_t *dst, const char *src, int length) { int i; - - unsigned int cpid = oem_get_telnet_cpid(); unsigned int count; - mts_wchar_t new_char; + smb_wchar_t new_char; - if ((count = oemstounicodes(dst, src, length, cpid)) == 0) { + if ((count = oemtoucs(dst, src, length, OEM_CPG_1252)) == 0) { for (i = 0; i < length; ++i) { - new_char = (mts_wchar_t)src[i] & 0xff; + new_char = (smb_wchar_t)src[i] & 0xff; dst[i] = LE_IN16(&new_char); } dst[i] = 0; count = length; } - return (count * sizeof (mts_wchar_t)); + return (count * sizeof (smb_wchar_t)); } /* @@ -75,8 +71,8 @@ smb_auth_lmupr(unsigned char *lm_pwd) int i; for (i = 0; (*p) && (i < SMBAUTH_LM_PWD_SZ); i++) { - if (mts_isascii(*p)) { - *p = codepage_toupper(*p); + if (smb_isascii(*p)) { + *p = smb_toupper(*p); p++; } } @@ -148,7 +144,7 @@ smb_auth_lm_response(unsigned char *hash, int smb_auth_ntlm_hash(const char *password, unsigned char *hash) { - mts_wchar_t *unicode_password; + smb_wchar_t *unicode_password; int length; int rc; @@ -156,8 +152,8 @@ smb_auth_ntlm_hash(const char *password, unsigned char *hash) return (SMBAUTH_FAILURE); length = strlen(password); - unicode_password = (mts_wchar_t *) - malloc((length + 1) * sizeof (mts_wchar_t)); + unicode_password = (smb_wchar_t *) + malloc((length + 1) * sizeof (smb_wchar_t)); if (unicode_password == NULL) return (SMBAUTH_FAILURE); @@ -290,7 +286,7 @@ smb_auth_ntlmv2_hash(unsigned char *ntlm_hash, char *ntdomain, unsigned char *ntlmv2_hash) { - mts_wchar_t *data; + smb_wchar_t *data; int data_len; unsigned char *buf; int rc; @@ -298,7 +294,7 @@ smb_auth_ntlmv2_hash(unsigned char *ntlm_hash, if (username == NULL || ntdomain == NULL) return (SMBAUTH_FAILURE); - (void) utf8_strupr(username); + (void) smb_strupr(username); data_len = strlen(username) + strlen(ntdomain); buf = (unsigned char *)malloc((data_len + 1) * sizeof (char)); @@ -306,7 +302,7 @@ smb_auth_ntlmv2_hash(unsigned char *ntlm_hash, return (SMBAUTH_FAILURE); (void) snprintf((char *)buf, data_len + 1, "%s%s", username, ntdomain); - data = (mts_wchar_t *)malloc((data_len + 1) * sizeof (mts_wchar_t)); + data = (smb_wchar_t *)malloc((data_len + 1) * sizeof (smb_wchar_t)); if (data == NULL) { free(buf); return (SMBAUTH_FAILURE); @@ -423,7 +419,7 @@ smb_auth_set_info(char *username, if ((uppercase_dom = strdup(domain)) == NULL) return (-1); - (void) utf8_strupr(uppercase_dom); + (void) smb_strupr(uppercase_dom); if (smb_auth_ntlmv2_hash(auth->hash, username, uppercase_dom, auth->hash_v2) != SMBAUTH_SUCCESS) { @@ -570,7 +566,7 @@ smb_ntlmv2_password_ok( dest[0] = domain; if ((dest[1] = strdup(domain)) == NULL) return (B_FALSE); - (void) utf8_strupr(dest[1]); + (void) smb_strupr(dest[1]); dest[2] = ""; /* @@ -642,7 +638,7 @@ smb_lmv2_password_ok( dest[0] = domain; if ((dest[1] = strdup(domain)) == NULL) return (B_FALSE); - (void) utf8_strupr(dest[1]); + (void) smb_strupr(dest[1]); dest[2] = ""; /* diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_domain.c b/usr/src/lib/smbsrv/libsmb/common/smb_domain.c index 42ff0657ac..e4660ef447 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_domain.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_domain.c @@ -176,8 +176,8 @@ smb_domain_lookup_name(char *name, smb_domain_t *di) dcnode = list_head(&smb_dcache.dc_cache); while (dcnode) { - found = (utf8_strcasecmp(dcnode->di_nbname, name) == 0) || - (utf8_strcasecmp(dcnode->di_fqname, name) == 0); + found = (smb_strcasecmp(dcnode->di_nbname, name, 0) == 0) || + (smb_strcasecmp(dcnode->di_fqname, name, 0) == 0); if (found) { if (di) @@ -187,7 +187,8 @@ smb_domain_lookup_name(char *name, smb_domain_t *di) if ((p = strchr(dcnode->di_fqname, '.')) != NULL) { *p = '\0'; - found = (utf8_strcasecmp(dcnode->di_fqname, name) == 0); + found = (smb_strcasecmp(dcnode->di_fqname, name, + 0) == 0); *p = '.'; if (found) { if (di) @@ -458,7 +459,7 @@ smb_domain_set_basic_info(char *sid, char *nb_domain, char *fq_domain, (void) strlcpy(di->di_sid, sid, SMB_SID_STRSZ); (void) strlcpy(di->di_nbname, nb_domain, NETBIOS_NAME_SZ); - (void) utf8_strupr(di->di_nbname); + (void) smb_strupr(di->di_nbname); (void) strlcpy(di->di_fqname, fq_domain, MAXHOSTNAMELEN); di->di_binsid = NULL; } diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_info.c b/usr/src/lib/smbsrv/libsmb/common/smb_info.c index 691d2e99ed..4bc31864d8 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_info.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_info.c @@ -166,7 +166,7 @@ smb_gethostname(char *buf, size_t buflen, int upcase) *p = '\0'; if (upcase) - (void) utf8_strupr(buf); + (void) smb_strupr(buf); return (0); } @@ -517,25 +517,24 @@ void smb_tonetbiosname(char *name, char *nb_name, char suffix) { char tmp_name[NETBIOS_NAME_SZ]; - mts_wchar_t wtmp_name[NETBIOS_NAME_SZ]; - unsigned int cpid; + smb_wchar_t wtmp_name[NETBIOS_NAME_SZ]; int len; size_t rc; len = 0; - rc = mts_mbstowcs(wtmp_name, (const char *)name, NETBIOS_NAME_SZ); + rc = smb_mbstowcs(wtmp_name, (const char *)name, NETBIOS_NAME_SZ); if (rc != (size_t)-1) { wtmp_name[NETBIOS_NAME_SZ - 1] = 0; - cpid = oem_get_smb_cpid(); - rc = unicodestooems(tmp_name, wtmp_name, NETBIOS_NAME_SZ, cpid); + rc = ucstooem(tmp_name, wtmp_name, NETBIOS_NAME_SZ, + OEM_CPG_850); if (rc > 0) len = strlen(tmp_name); } (void) memset(nb_name, ' ', NETBIOS_NAME_SZ - 1); if (len) { - (void) utf8_strupr(tmp_name); + (void) smb_strupr(tmp_name); (void) memcpy(nb_name, tmp_name, len); } nb_name[NETBIOS_NAME_SZ - 1] = suffix; diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c b/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c index 85ad5209de..d8bc1d69fe 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c @@ -214,7 +214,7 @@ smb_lgrp_add(char *gname, char *cmnt) return (SMB_LGRP_INVALID_ARG); bzero(&grp, sizeof (grp)); - grp.sg_name = utf8_strlwr(gname); + grp.sg_name = smb_strlwr(gname); grp.sg_cmnt = cmnt; wka = smb_wka_lookup_name(gname); @@ -286,7 +286,7 @@ smb_lgrp_rename(char *gname, char *new_gname) if (!smb_lgrp_chkname(gname)) return (SMB_LGRP_INVALID_NAME); - if (utf8_strcasecmp(gname, new_gname) == 0) + if (smb_strcasecmp(gname, new_gname, 0) == 0) return (SMB_LGRP_SUCCESS); /* Cannot rename well-known groups */ @@ -2161,7 +2161,7 @@ smb_lgrp_chkname(char *name) if (strchr(invalid_chars, name[i])) return (B_FALSE); - (void) utf8_strlwr(name); + (void) smb_strlwr(name); return (B_TRUE); } @@ -2173,12 +2173,12 @@ smb_lgrp_chkname(char *name) static void smb_lgrp_set_default_privs(smb_group_t *grp) { - if (utf8_strcasecmp(grp->sg_name, "Administrators") == 0) { + if (smb_strcasecmp(grp->sg_name, "Administrators", 0) == 0) { smb_privset_enable(grp->sg_privs, SE_TAKE_OWNERSHIP_LUID); return; } - if (utf8_strcasecmp(grp->sg_name, "Backup Operators") == 0) { + if (smb_strcasecmp(grp->sg_name, "Backup Operators", 0) == 0) { smb_privset_enable(grp->sg_privs, SE_BACKUP_LUID); smb_privset_enable(grp->sg_privs, SE_RESTORE_LUID); return; diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_privilege.c b/usr/src/lib/smbsrv/libsmb/common/smb_privilege.c index be8853f4bc..2b60a8d549 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_privilege.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_privilege.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This module provides the interface to the built-in privilege names * and id's. NT privileges are known on the network using strings. Each @@ -157,7 +155,7 @@ smb_priv_getbyname(char *name) for (i = SE_MIN_LUID; i <= SE_MAX_LUID; ++i) { entry = &priv_table[i]; - if (utf8_strcasecmp(name, entry->name) == 0) + if (smb_strcasecmp(name, entry->name, 0) == 0) return (entry); } diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_sam.c b/usr/src/lib/smbsrv/libsmb/common/smb_sam.c index 9c92ad6a60..82cf1efc26 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_sam.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_sam.c @@ -109,14 +109,14 @@ smb_sam_lookup_name(char *domain, char *name, uint16_t type, return (NT_STATUS_NOT_FOUND); /* Only Netbios hostname is accepted */ - if (utf8_strcasecmp(domain, di.di_nbname) != 0) + if (smb_strcasecmp(domain, di.di_nbname, 0) != 0) return (NT_STATUS_NONE_MAPPED); } else { if (!smb_domain_lookup_type(SMB_DOMAIN_LOCAL, &di)) return (NT_STATUS_CANT_ACCESS_DOMAIN_INFO); } - if (utf8_strcasecmp(name, di.di_nbname) == 0) { + if (smb_strcasecmp(name, di.di_nbname, 0) == 0) { /* This is the local domain name */ account->a_type = SidTypeDomain; account->a_name = strdup(""); @@ -474,7 +474,7 @@ smb_lwka_lookup_name(char *name) int i; for (i = 0; i < SMB_LWKA_NUM; i++) { - if (utf8_strcasecmp(name, lwka_tbl[i].lwka_name) == 0) + if (smb_strcasecmp(name, lwka_tbl[i].lwka_name, 0) == 0) return (&lwka_tbl[i]); } diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_wksids.c b/usr/src/lib/smbsrv/libsmb/common/smb_wksids.c index 7bca2438d8..ef9400b785 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_wksids.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_wksids.c @@ -186,7 +186,7 @@ smb_wka_lookup_name(char *name) (void) rw_rdlock(&wk_rwlock); for (i = 0; i < SMB_WKA_NUM; ++i) { entry = &wka_tbl[i]; - if (!utf8_strcasecmp(name, entry->wka_name)) { + if (!smb_strcasecmp(name, entry->wka_name, 0)) { (void) rw_unlock(&wk_rwlock); return (entry); } diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c index 13005345fb..5ec6bb0915 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c @@ -241,7 +241,7 @@ smb_ads_refresh(void) (void) smb_config_getstr(SMB_CI_ADS_SITE, new_site, SMB_ADS_SITE_MAX); (void) smb_config_getip(SMB_CI_DOMAIN_SRV, &new_pdc); (void) mutex_lock(&smb_ads_cfg.c_mtx); - if (utf8_strcasecmp(smb_ads_cfg.c_site, new_site)) { + if (smb_strcasecmp(smb_ads_cfg.c_site, new_site, 0)) { (void) strlcpy(smb_ads_cfg.c_site, new_site, SMB_ADS_SITE_MAX); purge = B_TRUE; } @@ -380,7 +380,7 @@ smb_ads_is_sought_host(smb_ads_host_info_t *host, char *sought_host_name) if ((host == NULL) || (sought_host_name == NULL)) return (B_FALSE); - if (utf8_strcasecmp(host->name, sought_host_name)) + if (smb_strcasecmp(host->name, sought_host_name, 0)) return (B_FALSE); return (B_TRUE); @@ -405,7 +405,7 @@ smb_ads_is_same_domain(char *cached_host_name, char *current_domain) return (B_FALSE); ++cached_host_domain; - if (utf8_strcasecmp(cached_host_domain, current_domain)) + if (smb_strcasecmp(cached_host_domain, current_domain, 0)) return (B_FALSE); return (B_TRUE); @@ -559,7 +559,7 @@ smb_ads_decode_host_ip(int addit_cnt, int ans_cnt, uchar_t **ptr, for (j = 0; j < ans_cnt; j++) { if ((name = ads_host_list[j].name) == NULL) continue; - if (utf8_strcasecmp(name, hostname) == 0) { + if (smb_strcasecmp(name, hostname, 0) == 0) { ads_host_list[j].ipaddr = ipaddr; } } diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_browser.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_browser.c index c98aa6d661..ba79bdc787 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_browser.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_browser.c @@ -39,7 +39,7 @@ #include <smbsrv/libsmb.h> #include <smbsrv/libsmbns.h> -#include <smbsrv/cifs.h> +#include <smbsrv/smb.h> #include <smbsrv/mailslot.h> #include <smbns_browser.h> #include <smbns_netbios.h> @@ -780,7 +780,7 @@ smb_browser_send_HostAnnouncement(smb_hostinfo_t *hinfo, if (smb_getdomainname(resource_domain, SMB_PI_MAX_DOMAIN) != 0) return; - (void) utf8_strupr(resource_domain); + (void) smb_strupr(resource_domain); if (addr == NULL) { /* Local master Browser */ @@ -1058,7 +1058,7 @@ smb_browser_config(void) if (smb_getdomainname(resource_domain, SMB_PI_MAX_DOMAIN) != 0) return; - (void) utf8_strupr(resource_domain); + (void) smb_strupr(resource_domain); /* domain<00> */ smb_init_name_struct((unsigned char *)resource_domain, NBT_WKSTA, @@ -1156,7 +1156,7 @@ smb_browser_init(void) /* This is the name used for HostAnnouncement */ (void) strlcpy(hinfo->hi_nbname, hinfo->hi_nic.nic_host, NETBIOS_NAME_SZ); - (void) utf8_strupr(hinfo->hi_nbname); + (void) smb_strupr(hinfo->hi_nbname); /* 0x20: file server service */ smb_init_name_struct((unsigned char *)hinfo->hi_nbname, NBT_SERVER, 0, hinfo->hi_nic.nic_ip.a_ipv4, @@ -1193,7 +1193,7 @@ smb_browser_non_master_duties(smb_hostinfo_t *hinfo, boolean_t remove) if (smb_getdomainname(resource_domain, SMB_PI_MAX_DOMAIN) != 0) return; - (void) utf8_strupr(resource_domain); + (void) smb_strupr(resource_domain); smb_init_name_struct((unsigned char *)resource_domain, NBT_MB, 0, 0, 0, 0, 0, &name); diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_ksetpwd.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_ksetpwd.c index 6321254c29..304b1292ee 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_ksetpwd.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_ksetpwd.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -98,7 +98,7 @@ smb_krb5_get_upn(char *spn, char *domain) if (!realm) return (NULL); - (void) utf8_strupr(realm); + (void) smb_strupr(realm); len = strlen(spn) + 1 + strlen(realm) + 1; upn = (char *)malloc(len); @@ -133,7 +133,7 @@ smb_krb5_get_host_upn(const char *fqhn) if ((realm = strdup(++dom)) == NULL) return (NULL); - (void) utf8_strupr(realm); + (void) smb_strupr(realm); len = strlen(spn_prefix[SMBKRB5_SPN_IDX_HOST]) + strlen(fqhn) + + 1 + strlen(realm) + 1; diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios.c index 2b6117edc5..d5f029c455 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_netbios.c @@ -214,7 +214,7 @@ smb_encode_netbios_name(unsigned char *name, char suffix, unsigned char *scope, sizeof (dest->scope)); } - (void) utf8_strupr((char *)dest->scope); + (void) smb_strupr((char *)dest->scope); } void diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_netlogon.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_netlogon.c index e34270ce87..d0ebbfbe38 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_netlogon.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_netlogon.c @@ -92,7 +92,7 @@ smb_netlogon_request(struct name_entry *server, char *domain) (void) mutex_unlock(&ntdomain_mtx); smb_config_getdomaininfo(di.di_nbname, NULL, di.di_sid, NULL, NULL); - if (utf8_strcasecmp(di.di_nbname, domain) == 0) { + if (smb_strcasecmp(di.di_nbname, domain, 0) == 0) { if ((sid = smb_sid_fromstr(di.di_sid)) != NULL) protocol = NETLOGON_PROTO_SAMLOGON; } @@ -132,8 +132,7 @@ smb_netlogon_receive(struct datagram *datagram, smb_msgbuf_t mb; unsigned short opcode; char src_name[SMB_PI_MAX_HOST]; - mts_wchar_t unicode_src_name[SMB_PI_MAX_HOST]; - unsigned int cpid = oem_get_smb_cpid(); + smb_wchar_t unicode_src_name[SMB_PI_MAX_HOST]; uint32_t src_ipaddr; char *junk; char *primary; @@ -149,9 +148,9 @@ smb_netlogon_receive(struct datagram *datagram, * Therefore, we need to convert it to unicode and * store it in multi-bytes format. */ - (void) oemstounicodes(unicode_src_name, (char *)datagram->src.name, - SMB_PI_MAX_HOST, cpid); - (void) mts_wcstombs(src_name, unicode_src_name, SMB_PI_MAX_HOST); + (void) oemtoucs(unicode_src_name, (char *)datagram->src.name, + SMB_PI_MAX_HOST, OEM_CPG_850); + (void) smb_wcstombs(src_name, unicode_src_name, SMB_PI_MAX_HOST); (void) trim_whitespace(src_name); @@ -288,7 +287,7 @@ smb_netlogon_query(struct name_entry *server, * zero bytes that terminate the wchar string. */ data_length = sizeof (short) + name_lengths + (name_lengths & 1) + - mts_wcequiv_strlen(hostname) + 2 + sizeof (long) + sizeof (short) + + smb_wcequiv_strlen(hostname) + 2 + sizeof (long) + sizeof (short) + sizeof (short); offset = smb_browser_load_transact_header(buffer, @@ -381,8 +380,8 @@ smb_netlogon_samlogon(struct name_entry *server, data_length = sizeof (short) + sizeof (short) - + mts_wcequiv_strlen(hostname) + 2 - + mts_wcequiv_strlen(username) + 2 + + smb_wcequiv_strlen(hostname) + 2 + + smb_wcequiv_strlen(username) + 2 + name_length + sizeof (long) + sizeof (long) diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr.h b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr.h index aa21a4a41f..385c20455f 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr.h +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr.h @@ -34,8 +34,7 @@ #include <smbsrv/libsmb.h> #include <smbsrv/libsmbrdr.h> - -#include <smbsrv/cifs.h> +#include <smbsrv/smb.h> #include <smbsrv/smbinfo.h> #include <smbsrv/smb.h> #include <smbsrv/wintypes.h> @@ -186,6 +185,77 @@ typedef struct smbrdr_handle { struct sdb_netuse *srh_tree; } smbrdr_handle_t; +typedef struct smb_nt_negotiate_rsp { + uint8_t word_count; + uint16_t dialect_index; + uint8_t security_mode; + uint16_t max_mpx; + uint16_t max_vc; + uint32_t max_buffer_size; + uint32_t max_raw_size; + uint32_t session_key; + uint32_t capabilities; + uint32_t time_low; + uint32_t time_high; + uint16_t server_tz; + uint8_t security_len; + uint16_t byte_count; + uint8_t *guid; + uint8_t *challenge; + uint8_t *oem_domain; +} smb_nt_negotiate_rsp_t; + +/* + * SMB_COM_TRANSACTION + */ +typedef struct smb_transact_rsp { + uint8_t WordCount; /* Count of data bytes */ + /* value = 10 + SetupCount */ + uint16_t TotalParamCount; /* Total parameter bytes being sent */ + uint16_t TotalDataCount; /* Total data bytes being sent */ + uint16_t Reserved; + uint16_t ParamCount; /* Parameter bytes sent this buffer */ + uint16_t ParamOffset; /* Offset (from hdr start) to params */ + uint16_t ParamDisplacement; /* Displacement of these param bytes */ + uint16_t DataCount; /* Data bytes sent this buffer */ + uint16_t DataOffset; /* Offset (from hdr start) to data */ + uint16_t DataDisplacement; /* Displacement of these data bytes */ + uint8_t SetupCount; /* Count of setup words */ + uint16_t BCC; +#if 0 + uint8_t Reserved2; /* Reserved (pad above to word) */ + uint8_t Buffer[1]; /* Buffer containing: */ + uint16_t Setup[]; /* Setup words (# = SetupWordCount) */ + uint16_t ByteCount; /* Count of data bytes */ + uint8_t Pad[]; /* Pad to SHORT or LONG */ + uint8_t Params[]; /* Param. bytes (# = ParamCount) */ + uint8_t Pad1[]; /* Pad to SHORT or LONG */ + uint8_t Data[]; /* Data bytes (# = DataCount) */ +#endif +} smb_transact_rsp_t; + +/* + * SMBreadX + */ +typedef struct smb_read_andx_rsp { + uint8_t WordCount; + uint8_t AndXCmd; + uint8_t AndXReserved; + uint16_t AndXOffset; + uint16_t Remaining; + uint16_t DataCompactionMode; + uint16_t Reserved; + uint16_t DataLength; + uint16_t DataOffset; + uint32_t DataLengthHigh; + uint16_t Reserved2[3]; + uint16_t ByteCount; +#if 0 + uint8_t Pad[]; + uint8_t Data[]; +#endif +} smb_read_andx_rsp_t; + /* * smbrdr_netbios.c */ diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_logon.c b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_logon.c index 8689ba446c..3594508279 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_logon.c +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_logon.c @@ -189,7 +189,7 @@ smbrdr_authenticate(char *domain_controller, char *primary_domain, /* * Ensure that the domain name is uppercase. */ - (void) utf8_strupr(primary_domain); + (void) smb_strupr(primary_domain); return (smbrdr_logon_user(domain_controller, account_name, pwd)); } @@ -302,8 +302,8 @@ smbrdr_session_setupx(struct sdb_logon *logon) return (-1); if (session->remote_caps & CAP_UNICODE) { - strlen_fn = mts_wcequiv_strlen; - null_size = sizeof (mts_wchar_t); + strlen_fn = smb_wcequiv_strlen; + null_size = sizeof (smb_wchar_t); session->smb_flags2 |= SMB_FLAGS2_UNICODE; } else { strlen_fn = strlen; diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netbios.c b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netbios.c index 675f00e5ae..5f327205e4 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netbios.c +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netbios.c @@ -47,7 +47,7 @@ #include <stdio.h> #include <pthread.h> -#include <smbsrv/cifs.h> +#include <smbsrv/smb.h> #define MAX_NETBIOS_NAME_SIZE 16 diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netuse.c b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netuse.c index 00c3d6b0ea..d93d1ef798 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netuse.c +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_netuse.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "@(#)smbrdr_netuse.c 1.4 08/07/16 SMI" - /* * Tree connect and disconnect functions to support SMB shares. * These functions are described in the CIFS draft 1.0 Protocol @@ -124,7 +122,7 @@ smbrdr_tree_connect(char *hostname, char *username, char *sharename, bzero(path, path_len); (void) snprintf(path, path_len, "\\\\%s\\%s", hostname, sharename); if (session->remote_caps & CAP_UNICODE) - path_len = mts_wcequiv_strlen(path); + path_len = smb_wcequiv_strlen(path); else path_len = strlen(path); diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_rpcpipe.c b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_rpcpipe.c index 123dde8fe7..74c88ffd6d 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_rpcpipe.c +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_rpcpipe.c @@ -454,8 +454,8 @@ smbrdr_ntcreatex(struct sdb_ofile *ofile) (void) strcpy(path, ofile->path); if (sess->remote_caps & CAP_UNICODE) { - path_len = mts_wcequiv_strlen(path); - null_size = sizeof (mts_wchar_t); + path_len = smb_wcequiv_strlen(path); + null_size = sizeof (smb_wchar_t); } else { path_len = strlen(path); null_size = sizeof (char); diff --git a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_session.c b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_session.c index 1796230614..bd35017635 100644 --- a/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_session.c +++ b/usr/src/lib/smbsrv/libsmbrdr/common/smbrdr_session.c @@ -44,8 +44,6 @@ #include <smbsrv/libsmbrdr.h> #include <smbsrv/netbios.h> -#include <smbsrv/cifs.h> -#include <smbsrv/ntstatus.h> #include <smbrdr.h> #define SMBRDR_DOMAIN_MAX 32 @@ -219,9 +217,8 @@ smbrdr_trnsprt_connect(struct sdb_session *sess, uint16_t port) struct sockaddr_in sin; struct sockaddr_in6 sin6; int sock, rc; - mts_wchar_t unicode_server_name[SMB_PI_MAX_DOMAIN]; + smb_wchar_t unicode_server_name[SMB_PI_MAX_DOMAIN]; char server_name[SMB_PI_MAX_DOMAIN]; - unsigned int cpid = oem_get_smb_cpid(); char ipstr[INET6_ADDRSTRLEN]; if ((sock = socket(sess->srv_ipaddr.a_family, SOCK_STREAM, 0)) <= 0) { @@ -253,10 +250,10 @@ smbrdr_trnsprt_connect(struct sdb_session *sess, uint16_t port) return (-1); } - (void) mts_mbstowcs(unicode_server_name, sess->srv_name, + (void) smb_mbstowcs(unicode_server_name, sess->srv_name, SMB_PI_MAX_DOMAIN); - rc = unicodestooems(server_name, unicode_server_name, - SMB_PI_MAX_DOMAIN, cpid); + rc = ucstooem(server_name, unicode_server_name, SMB_PI_MAX_DOMAIN, + OEM_CPG_850); if (rc == 0) { syslog(LOG_DEBUG, "smbrdr: unicode conversion failed"); if (sock != 0) @@ -417,11 +414,11 @@ smbrdr_session_init(char *domain_controller, char *domain) smbrdr_session_clear(session); (void) strlcpy(session->srv_name, domain_controller, MAXHOSTNAMELEN); - (void) utf8_strupr(session->srv_name); + (void) smb_strupr(session->srv_name); session->srv_ipaddr = ipaddr; (void) strlcpy(session->domain, domain, MAXHOSTNAMELEN); - (void) utf8_strupr(session->domain); + (void) smb_strupr(session->domain); (void) smb_config_getstr(SMB_CI_NBSCOPE, session->scope, sizeof (session->scope)); diff --git a/usr/src/pkgdefs/etc/exception_list_i386 b/usr/src/pkgdefs/etc/exception_list_i386 index 8d4600f06b..09514a0ecc 100644 --- a/usr/src/pkgdefs/etc/exception_list_i386 +++ b/usr/src/pkgdefs/etc/exception_list_i386 @@ -987,18 +987,8 @@ usr/include/sys/srn.h i386 # usr/include/smbsrv i386 usr/include/smbsrv/alloc.h i386 -usr/include/smbsrv/cifs.h i386 -usr/include/smbsrv/codepage.h i386 -usr/include/smbsrv/cp_cyrillic.h i386 -usr/include/smbsrv/cp_latin1.h i386 -usr/include/smbsrv/cp_latin2.h i386 -usr/include/smbsrv/cp_latin3.h i386 -usr/include/smbsrv/cp_latin4.h i386 -usr/include/smbsrv/cp_latin5.h i386 -usr/include/smbsrv/cp_latin6.h i386 usr/include/smbsrv/cp_unicode.h i386 usr/include/smbsrv/cp_usascii.h i386 -usr/include/smbsrv/ctype.h i386 usr/include/smbsrv/doserror.h i386 usr/include/smbsrv/hash_table.h i386 usr/include/smbsrv/libmlrpc.h i386 @@ -1006,7 +996,6 @@ usr/include/smbsrv/libmlsvc.h i386 usr/include/smbsrv/libsmb.h i386 usr/include/smbsrv/libsmbns.h i386 usr/include/smbsrv/libsmbrdr.h i386 -usr/include/smbsrv/lm.h i386 usr/include/smbsrv/lmdfs.h i386 usr/include/smbsrv/lmerr.h i386 usr/include/smbsrv/mac_cifs.h i386 @@ -1022,14 +1011,11 @@ usr/include/smbsrv/nterror.h i386 usr/include/smbsrv/ntifs.h i386 usr/include/smbsrv/ntlocale.h i386 usr/include/smbsrv/ntstatus.h i386 -usr/include/smbsrv/oem.h i386 usr/include/smbsrv/smb.h i386 usr/include/smbsrv/smb_common_door.h i386 usr/include/smbsrv/smb_door_svc.h i386 usr/include/smbsrv/smb_fsops.h i386 -usr/include/smbsrv/smb_i18n.h i386 usr/include/smbsrv/smb_idmap.h i386 -usr/include/smbsrv/smb_incl.h i386 usr/include/smbsrv/smb_inet.h i386 usr/include/smbsrv/smb_ioctl.h i386 usr/include/smbsrv/smb_kproto.h i386 @@ -1041,7 +1027,6 @@ usr/include/smbsrv/smb_sid.h i386 usr/include/smbsrv/smb_token.h i386 usr/include/smbsrv/smb_vops.h i386 usr/include/smbsrv/smb_xdr.h i386 -usr/include/smbsrv/smbfmt.h i386 usr/include/smbsrv/smbinfo.h i386 usr/include/smbsrv/string.h i386 usr/include/smbsrv/svrapi.h i386 diff --git a/usr/src/pkgdefs/etc/exception_list_sparc b/usr/src/pkgdefs/etc/exception_list_sparc index 12a2a0df8f..5a32c55a05 100644 --- a/usr/src/pkgdefs/etc/exception_list_sparc +++ b/usr/src/pkgdefs/etc/exception_list_sparc @@ -1061,18 +1061,8 @@ usr/include/sys/srn.h sparc # usr/include/smbsrv sparc usr/include/smbsrv/alloc.h sparc -usr/include/smbsrv/cifs.h sparc -usr/include/smbsrv/codepage.h sparc -usr/include/smbsrv/cp_cyrillic.h sparc -usr/include/smbsrv/cp_latin1.h sparc -usr/include/smbsrv/cp_latin2.h sparc -usr/include/smbsrv/cp_latin3.h sparc -usr/include/smbsrv/cp_latin4.h sparc -usr/include/smbsrv/cp_latin5.h sparc -usr/include/smbsrv/cp_latin6.h sparc usr/include/smbsrv/cp_unicode.h sparc usr/include/smbsrv/cp_usascii.h sparc -usr/include/smbsrv/ctype.h sparc usr/include/smbsrv/doserror.h sparc usr/include/smbsrv/hash_table.h sparc usr/include/smbsrv/libmlrpc.h sparc @@ -1080,7 +1070,6 @@ usr/include/smbsrv/libmlsvc.h sparc usr/include/smbsrv/libsmb.h sparc usr/include/smbsrv/libsmbns.h sparc usr/include/smbsrv/libsmbrdr.h sparc -usr/include/smbsrv/lm.h sparc usr/include/smbsrv/lmdfs.h sparc usr/include/smbsrv/lmerr.h sparc usr/include/smbsrv/mac_cifs.h sparc @@ -1096,14 +1085,11 @@ usr/include/smbsrv/nterror.h sparc usr/include/smbsrv/ntifs.h sparc usr/include/smbsrv/ntlocale.h sparc usr/include/smbsrv/ntstatus.h sparc -usr/include/smbsrv/oem.h sparc usr/include/smbsrv/smb.h sparc usr/include/smbsrv/smb_common_door.h sparc usr/include/smbsrv/smb_door_svc.h sparc usr/include/smbsrv/smb_fsops.h sparc -usr/include/smbsrv/smb_i18n.h sparc usr/include/smbsrv/smb_idmap.h sparc -usr/include/smbsrv/smb_incl.h sparc usr/include/smbsrv/smb_inet.h sparc usr/include/smbsrv/smb_ioctl.h sparc usr/include/smbsrv/smb_kproto.h sparc @@ -1115,7 +1101,6 @@ usr/include/smbsrv/smb_sid.h sparc usr/include/smbsrv/smb_token.h sparc usr/include/smbsrv/smb_vops.h sparc usr/include/smbsrv/smb_xdr.h sparc -usr/include/smbsrv/smbfmt.h sparc usr/include/smbsrv/smbinfo.h sparc usr/include/smbsrv/string.h sparc usr/include/smbsrv/svrapi.h sparc diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index ded59fafd2..4a55f0eae9 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -1137,8 +1137,6 @@ SMBSRV_SHARED_OBJS += \ smb_match.o \ smb_msgbuf.o \ smb_oem.o \ - smb_opmlang.o \ - smb_strcase.o \ smb_string.o \ smb_utf8.o \ smb_common_door_decode.o \ @@ -1176,7 +1174,6 @@ SMBSRV_OBJS += $(SMBSRV_SHARED_OBJS) \ smb_logoff_andx.o \ smb_mangle_name.o \ smb_mbuf_marshaling.o \ - smb_memory_manager.o \ smb_mbuf_util.o \ smb_negotiate.o \ smb_net.o \ diff --git a/usr/src/uts/common/fs/smbsrv/smb_acl.c b/usr/src/uts/common/fs/smbsrv/smb_acl.c index 8577663acf..75e579a636 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_acl.c +++ b/usr/src/uts/common/fs/smbsrv/smb_acl.c @@ -19,20 +19,16 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "@(#)smb_acl.c 1.5 08/07/28 SMI" - #include <sys/acl.h> #include <acl/acl_common.h> #include <smbsrv/smb_sid.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_idmap.h> #include <smbsrv/smb_kproto.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/ntaccess.h> #define ACE_FD_INHERIT_ACE (ACE_FILE_INHERIT_ACE | ACE_DIRECTORY_INHERIT_ACE) diff --git a/usr/src/uts/common/fs/smbsrv/smb_alloc.c b/usr/src/uts/common/fs/smbsrv/smb_alloc.c index dccb93d10e..fc3a3c0b5f 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_alloc.c +++ b/usr/src/uts/common/fs/smbsrv/smb_alloc.c @@ -27,53 +27,43 @@ #include <sys/sunddi.h> #include <sys/kmem.h> #include <sys/sysmacros.h> -#include <sys/types.h> - +#include <smbsrv/smb_kproto.h> #include <smbsrv/alloc.h> #define MEM_HDR_SIZE 8 -static uint32_t mem_get_size(void *ptr); +static uint32_t smb_memsize(void *); void * -mem_malloc(uint32_t size) +smb_malloc(uint32_t size) { - uint8_t *p; + uint32_t *hdr; + uint8_t *p; size += MEM_HDR_SIZE; - p = kmem_alloc(size, KM_SLEEP); - /*LINTED E_BAD_PTR_CAST_ALIGN*/ - *(uint32_t *)p = size; - p += MEM_HDR_SIZE; - - return (p); -} - -void * -mem_zalloc(uint32_t size) -{ - uint8_t *p; + hdr = kmem_zalloc(size, KM_SLEEP); + *hdr = size; - p = mem_malloc(size); - (void) memset(p, 0, size); + p = (uint8_t *)hdr; + p += MEM_HDR_SIZE; return (p); } char * -mem_strdup(const char *ptr) +smb_strdup(const char *ptr) { - char *p; - size_t size; + char *p; + size_t size; size = strlen(ptr) + 1; - p = mem_malloc(size); + p = smb_malloc(size); (void) memcpy(p, ptr, size); return (p); } static uint32_t -mem_get_size(void *ptr) +smb_memsize(void *ptr) { - uint32_t *p; + uint32_t *p; /*LINTED E_BAD_PTR_CAST_ALIGN*/ p = (uint32_t *)((uint8_t *)ptr - MEM_HDR_SIZE); @@ -82,40 +72,120 @@ mem_get_size(void *ptr) } void * -mem_realloc(void *ptr, uint32_t size) +smb_realloc(void *ptr, uint32_t size) { - void *new_ptr; - uint32_t current_size; + void *new_ptr; + uint32_t current_size; if (ptr == NULL) - return (mem_malloc(size)); + return (smb_malloc(size)); if (size == 0) { - smb_mem_free(ptr); + smb_mfree(ptr); return (NULL); } - current_size = mem_get_size(ptr) - MEM_HDR_SIZE; + current_size = smb_memsize(ptr) - MEM_HDR_SIZE; if (size <= current_size) return (ptr); - new_ptr = mem_malloc(size); + new_ptr = smb_malloc(size); (void) memcpy(new_ptr, ptr, current_size); - smb_mem_free(ptr); + smb_mfree(ptr); return (new_ptr); } void -smb_mem_free(void *ptr) +smb_mfree(void *ptr) { - uint8_t *p; + uint8_t *p; - if (ptr == 0) + if (ptr == NULL) return; p = (uint8_t *)ptr - MEM_HDR_SIZE; /*LINTED E_BAD_PTR_CAST_ALIGN*/ kmem_free(p, *(uint32_t *)p); } + +/* + * Initialize the list for request-specific temporary storage. + */ +void +smb_srm_init(smb_request_t *sr) +{ + list_create(&sr->sr_storage, sizeof (smb_srm_t), + offsetof(smb_srm_t, srm_lnd)); +} + +/* + * Free everything on the request-specific temporary storage list + * and destroy the list. + */ +void +smb_srm_fini(smb_request_t *sr) +{ + smb_srm_t *srm; + + while ((srm = list_head(&sr->sr_storage)) != NULL) { + list_remove(&sr->sr_storage, srm); + smb_mfree(srm); + } + + list_destroy(&sr->sr_storage); +} + +/* + * Allocate memory and associate it with the specified request. + * Memory allocated here can only be used for the duration of + * this request; it will be freed automatically on completion + * of the request + */ +void * +smb_srm_alloc(smb_request_t *sr, size_t size) +{ + smb_srm_t *srm; + + size += sizeof (smb_srm_t); + srm = smb_malloc(size); + srm->srm_size = size; + srm->srm_sr = sr; + list_insert_tail(&sr->sr_storage, srm); + + /* + * The memory allocated for use be the caller is + * immediately after our storage context area. + */ + return (void *)(srm + 1); +} + +/* + * Allocate or resize memory previously allocated for the specified + * request. + */ +void * +smb_srm_realloc(smb_request_t *sr, void *p, size_t size) +{ + smb_srm_t *old_srm = (smb_srm_t *)p; + smb_srm_t *new_srm; + + if (old_srm == NULL) + return (smb_srm_alloc(sr, size)); + + old_srm--; + list_remove(&sr->sr_storage, old_srm); + + size += sizeof (smb_srm_t); + new_srm = smb_realloc(old_srm, size); + new_srm->srm_size = smb_memsize(new_srm); + new_srm->srm_sr = sr; + list_insert_tail(&sr->sr_storage, new_srm); + + /* + * The memory allocated for use be the caller is + * immediately after our storage context area. + */ + return (void *)(new_srm + 1); +} diff --git a/usr/src/uts/common/fs/smbsrv/smb_close.c b/usr/src/uts/common/fs/smbsrv/smb_close.c index d64c01586f..282411a6a3 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_close.c +++ b/usr/src/uts/common/fs/smbsrv/smb_close.c @@ -23,8 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> - +#include <smbsrv/smb_kproto.h> /* * Close a file by fid. All locks or other resources held by the diff --git a/usr/src/uts/common/fs/smbsrv/smb_common_open.c b/usr/src/uts/common/fs/smbsrv/smb_common_open.c index 74049d0c60..e63a7dca32 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_common_open.c +++ b/usr/src/uts/common/fs/smbsrv/smb_common_open.c @@ -28,13 +28,14 @@ * open and create SMB interface functions. */ -#include <smbsrv/smb_incl.h> -#include <smbsrv/smb_fsops.h> -#include <smbsrv/nterror.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/smbinfo.h> +#include <sys/types.h> +#include <sys/cmn_err.h> #include <sys/fcntl.h> #include <sys/nbmlock.h> +#include <smbsrv/string.h> +#include <smbsrv/smb_kproto.h> +#include <smbsrv/smb_fsops.h> +#include <smbsrv/smbinfo.h> volatile uint32_t smb_fids = 0; @@ -44,7 +45,7 @@ static void smb_delete_new_object(smb_request_t *); static int smb_set_open_timestamps(smb_request_t *, smb_ofile_t *, boolean_t); static char *smb_pathname_strdup(smb_request_t *, const char *); -static char *smb_pathname_strcat(char *, const char *); +static char *smb_pathname_strcat(smb_request_t *, char *, const char *); /* * smb_access_generic_to_file @@ -177,16 +178,22 @@ smb_ofun_to_crdisposition(uint16_t ofun) uint32_t smb_common_open(smb_request_t *sr) { - uint32_t status = NT_STATUS_SUCCESS; - int count; + open_param_t *parg; + uint32_t status = NT_STATUS_SUCCESS; + int count; + + parg = kmem_alloc(sizeof (*parg), KM_SLEEP); + bcopy(&sr->arg.open, parg, sizeof (*parg)); for (count = 0; count <= 4; count++) { - if (count) + if (count != 0) delay(MSEC_TO_TICK(400)); status = smb_open_subr(sr); if (status != NT_STATUS_SHARING_VIOLATION) break; + + bcopy(parg, &sr->arg.open, sizeof (*parg)); } if (status == NT_STATUS_SHARING_VIOLATION) { @@ -199,6 +206,8 @@ smb_common_open(smb_request_t *sr) ERRDOS, ERROR_FILE_NOT_FOUND); } + kmem_free(parg, sizeof (*parg)); + return (status); } @@ -951,7 +960,7 @@ smb_validate_object_name(smb_pathname_t *pn) { if (pn->pn_fname && strlen(pn->pn_fname) == 5 && - mts_isdigit(pn->pn_fname[3]) && + smb_isdigit(pn->pn_fname[3]) && pn->pn_fname[4] == ':') { return (NT_STATUS_OBJECT_NAME_INVALID); } @@ -991,8 +1000,8 @@ smb_delete_new_object(smb_request_t *sr) * smb_pathname_setup * Parse path: pname/fname:sname:stype * - * Elements of the smb_pathname_t structure are allocated using - * smbsr_malloc and will thus be free'd when the sr is destroyed. + * Elements of the smb_pathname_t structure are allocated using request + * specific storage and will be free'd when the sr is destroyed. * * Eliminate duplicate slashes in pn->pn_path. * Populate pn structure elements with the individual elements @@ -1048,10 +1057,10 @@ smb_pathname_setup(smb_request_t *sr, smb_pathname_t *pn) pn->pn_sname = smb_pathname_strdup(sr, sname); pn->pn_stype = strchr(pn->pn_sname + 1, ':'); if (pn->pn_stype) { - (void) utf8_strupr(pn->pn_stype); + (void) smb_strupr(pn->pn_stype); } else { len = strlen(pn->pn_sname); - pn->pn_sname = smb_pathname_strcat(pn->pn_sname, ":$DATA"); + pn->pn_sname = smb_pathname_strcat(sr, pn->pn_sname, ":$DATA"); pn->pn_stype = pn->pn_sname + len; } ++pn->pn_stype; @@ -1061,8 +1070,9 @@ smb_pathname_setup(smb_request_t *sr, smb_pathname_t *pn) * smb_pathname_strdup * * Duplicate NULL terminated string s. - * The new string buffer is allocated using smbsr_malloc and - * will thus be free'd when the sr is destroyed. + * + * The new string is allocated using request specific storage and will + * be free'd when the sr is destroyed. */ static char * smb_pathname_strdup(smb_request_t *sr, const char *s) @@ -1071,7 +1081,7 @@ smb_pathname_strdup(smb_request_t *sr, const char *s) size_t n; n = strlen(s) + 1; - s2 = (char *)smbsr_malloc(&sr->request_storage, n); + s2 = smb_srm_alloc(sr, n); (void) strlcpy(s2, s, n); return (s2); } @@ -1083,16 +1093,16 @@ smb_pathname_strdup(smb_request_t *sr, const char *s) * concatenating NULL terminated string s2. * Append s2 and return resulting NULL terminated string. * - * The string buffer is reallocated using smbsr_realloc - * and will thus be free'd when the sr is destroyed. + * The string buffer is reallocated using request specific + * storage and will be free'd when the sr is destroyed. */ static char * -smb_pathname_strcat(char *s1, const char *s2) +smb_pathname_strcat(smb_request_t *sr, char *s1, const char *s2) { size_t n; n = strlen(s1) + strlen(s2) + 1; - s1 = smbsr_realloc(s1, n); + s1 = smb_srm_realloc(sr, s1, n); (void) strlcat(s1, s2, n); return (s1); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_common_transact.c b/usr/src/uts/common/fs/smbsrv/smb_common_transact.c index 75358d2bc8..5b76e0397c 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_common_transact.c +++ b/usr/src/uts/common/fs/smbsrv/smb_common_transact.c @@ -23,14 +23,13 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_share.h> -#include <smbsrv/oem.h> +#include <smbsrv/string.h> #include <smbsrv/nmpipes.h> #include <smbsrv/mailslot.h> #include <smbsrv/lmerr.h> -#include <smbsrv/nterror.h> #define SMB_QUOTA_UNLIMITED 0xFFFFFFFFFFFFFFFF; @@ -105,8 +104,8 @@ smb_com_transaction(smb_request_t *sr) smb_xa_rele(sr->session, xa); return (SDRC_ERROR); } - xa->xa_smb_trans_name = MEM_STRDUP("smb", stn); + xa->xa_pipe_name = smb_strdup(stn); xa->smb_flags = flags; xa->smb_timeout = timeo; xa->req_disp_param = pscnt; @@ -460,6 +459,10 @@ smb_nt_trans_dispatch(struct smb_request *sr, struct smb_xa *xa) smbsr_error(sr, 0, ERRSRV, ERRaccess); return (SDRC_ERROR); + case NT_TRANSACT_RENAME: + rc = smb_nt_transact_rename(sr, xa); + break; + default: smbsr_error(sr, 0, ERRSRV, ERRsmbcmd); return (SDRC_ERROR); @@ -1014,7 +1017,7 @@ smb_trans_net_share_getinfo(smb_request_t *sr, struct smb_xa *xa) &share, &level, &max_bytes) != 0) return (SDRC_NOT_IMPLEMENTED); - (void) utf8_strlwr(share); + (void) smb_strlwr(share); rc = smb_kshare_getinfo(sr->sr_server->sv_lmshrd, share, &si, NULL); if ((rc != NERR_Success) || (si.shr_flags & SMB_SHRF_LONGNAME)) { (void) smb_mbc_encodef(&xa->rep_param_mb, "www", @@ -1377,7 +1380,7 @@ smb_trans_net_server_enum2(struct smb_request *sr, struct smb_xa *xa) si = sr->sr_cfg; - if (utf8_strcasecmp(si->skc_nbdomain, (char *)domain) != 0) { + if (smb_strcasecmp(si->skc_nbdomain, (char *)domain, 0) != 0) { (void) smb_mbc_encodef(&xa->rep_param_mb, "wwww", 0, 0, 0, 0); return (SDRC_SUCCESS); } @@ -1405,19 +1408,36 @@ smb_trans_net_server_enum2(struct smb_request *sr, struct smb_xa *xa) return (SDRC_SUCCESS); } +static boolean_t +is_supported_mailslot(const char *mailslot) +{ + static char *mailslots[] = { + PIPE_LANMAN, + MAILSLOT_LANMAN, + MAILSLOT_BROWSE, + MAILSLOT_MSBROWSE + }; + + int i; + + for (i = 0; i < sizeof (mailslots)/sizeof (mailslots[0]); ++i) + if (smb_strcasecmp(mailslot, mailslots[i], 0) == 0) + return (B_TRUE); + + return (B_FALSE); +} + /* - * is_supported_pipe - * - * Currently, just return 0 if the pipe is \\PIPE\repl otherwise - * return 1. + * Currently, just return false if the pipe is \\PIPE\repl. + * Otherwise, return true. */ -int -is_supported_pipe(char *pname) +static boolean_t +is_supported_pipe(const char *pname) { - if (utf8_strcasecmp(pname, PIPE_REPL) == 0) - return (0); + if (smb_strcasecmp(pname, PIPE_REPL, 0) == 0) + return (B_FALSE); - return (1); + return (B_TRUE); } static smb_sdrc_t @@ -1476,7 +1496,7 @@ smb_trans_dispatch(struct smb_request *sr, struct smb_xa *xa) break; case TRANS_WAIT_NMPIPE: - if (is_supported_pipe(xa->xa_smb_trans_name) == 0) { + if (!is_supported_pipe(xa->xa_pipe_name)) { smbsr_error(sr, 0, ERRDOS, ERRbadfile); return (SDRC_ERROR); } @@ -1487,14 +1507,7 @@ smb_trans_dispatch(struct smb_request *sr, struct smb_xa *xa) goto trans_err_not_supported; } } else { - if ((utf8_strcasecmp(xa->xa_smb_trans_name, - PIPE_LANMAN) != 0) && - (utf8_strcasecmp( - xa->xa_smb_trans_name, MAILSLOT_LANMAN) != 0) && - (utf8_strcasecmp( - xa->xa_smb_trans_name, MAILSLOT_BROWSE) != 0) && - (utf8_strcasecmp( - xa->xa_smb_trans_name, MAILSLOT_MSBROWSE) != 0)) + if (!is_supported_mailslot(xa->xa_pipe_name)) goto trans_err_not_supported; if ((rc = smb_mbc_decodef(&xa->req_param_mb, "%wss", sr, @@ -1839,7 +1852,7 @@ smb_xa_create( smb_xa_t *xa, *nxa; smb_llist_t *xlist; - xa = MEM_ZALLOC("xa", sizeof (smb_xa_t)); + xa = kmem_zalloc(sizeof (smb_xa_t), KM_SLEEP); xa->xa_refcnt = 1; xa->smb_com = sr->smb_com; xa->smb_flg = sr->smb_flg; @@ -1872,7 +1885,7 @@ smb_xa_create( !SMB_XA_CLOSED(nxa) && !(nxa->xa_flags & SMB_XA_FLAG_COMPLETE)) { smb_llist_exit(xlist); - MEM_FREE("xa", xa); + kmem_free(xa, sizeof (smb_xa_t)); return (NULL); } nxa = smb_llist_next(xlist, nxa); @@ -1888,8 +1901,8 @@ smb_xa_delete(smb_xa_t *xa) ASSERT(xa->xa_refcnt == 0); ASSERT(SMB_XA_CLOSED(xa)); - if (xa->xa_smb_trans_name) - MEM_FREE("smb", xa->xa_smb_trans_name); + if (xa->xa_pipe_name) + smb_mfree(xa->xa_pipe_name); if (xa->rep_setup_mb.chain != NULL) m_freem(xa->rep_setup_mb.chain); @@ -1899,7 +1912,7 @@ smb_xa_delete(smb_xa_t *xa) m_freem(xa->rep_data_mb.chain); xa->xa_magic = (uint32_t)~SMB_XA_MAGIC; - MEM_FREE("xa", xa); + kmem_free(xa, sizeof (smb_xa_t)); } smb_xa_t * diff --git a/usr/src/uts/common/fs/smbsrv/smb_create.c b/usr/src/uts/common/fs/smbsrv/smb_create.c index ddc8408248..066b66bb85 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_create.c +++ b/usr/src/uts/common/fs/smbsrv/smb_create.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #define SMB_CREATE_NAMEBUF_SZ 16 @@ -159,7 +159,7 @@ smb_com_create_temporary(smb_request_t *sr) bcc = 1; /* null terminator */ bcc += snprintf(name, SMB_CREATE_NAMEBUF_SZ, "tt%05d.tmp", tmp_id); - buf = smbsr_malloc(&sr->request_storage, MAXPATHLEN); + buf = smb_srm_alloc(sr, MAXPATHLEN); (void) snprintf(buf, MAXPATHLEN, "%s\\%s", op->fqi.fq_path.pn_path, name); op->fqi.fq_path.pn_path = buf; diff --git a/usr/src/uts/common/fs/smbsrv/smb_delete.c b/usr/src/uts/common/fs/smbsrv/smb_delete.c index 7c1481bfae..e6d357c378 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_delete.c +++ b/usr/src/uts/common/fs/smbsrv/smb_delete.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smbinfo.h> #include <sys/nbmlock.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_directory.c b/usr/src/uts/common/fs/smbsrv/smb_directory.c index 60d95d0198..e21742220a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_directory.c +++ b/usr/src/uts/common/fs/smbsrv/smb_directory.c @@ -23,10 +23,8 @@ * Use is subject to license terms. */ -#include <smbsrv/nterror.h> -#include <smbsrv/ntstatus.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smbinfo.h> -#include <smbsrv/smb_incl.h> #include <smbsrv/smb_fsops.h> typedef struct smb_dirpath { @@ -259,13 +257,12 @@ smb_dirpath_new(smb_request_t *sr) char *xpath; smb_dirpath_t *spp; - /* Malloc from the request storage area. This is freed automatically */ - /* so we don't need to worry about freeing it later */ - spp = smbsr_malloc(&sr->request_storage, sizeof (smb_dirpath_t)); + /* Allocate using request specific memory. */ + spp = smb_srm_alloc(sr, sizeof (smb_dirpath_t)); spp->sp_path = sr->arg.dirop.fqi.fq_path.pn_path; pathLen = strlen(spp->sp_path); spp->sp_curp = spp->sp_path; - xpath = smbsr_malloc(&sr->request_storage, pathLen + 1); + xpath = smb_srm_alloc(sr, pathLen + 1); sr->arg.dirop.fqi.fq_path.pn_path = xpath; spp->sp_sr = sr; @@ -589,7 +586,7 @@ smb_dirpath_isvalid(const char *path) if (*path == '\0') return (B_TRUE); - cp = smb_kstrdup(path, MAXPATHLEN); + cp = smb_strdup(path); p = strcanon(cp, "\\"); p += strspn(p, "\\"); @@ -597,11 +594,11 @@ smb_dirpath_isvalid(const char *path) bad = &bad_paths[i]; if (strncmp(p, bad->name, bad->len) == 0) { - kmem_free(cp, MAXPATHLEN); + smb_mfree(cp); return (B_FALSE); } } - kmem_free(cp, MAXPATHLEN); + smb_mfree(cp); return (B_TRUE); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_dispatch.c b/usr/src/uts/common/fs/smbsrv/smb_dispatch.c index 75b42e37bb..296ef8f2c2 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_dispatch.c +++ b/usr/src/uts/common/fs/smbsrv/smb_dispatch.c @@ -135,7 +135,7 @@ * empty if an error. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_kstat.h> #include <sys/sdt.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_echo.c b/usr/src/uts/common/fs/smbsrv/smb_echo.c index d934ccafd4..d7c8c7c859 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_echo.c +++ b/usr/src/uts/common/fs/smbsrv/smb_echo.c @@ -19,13 +19,11 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* * The echo request is used to test the connection to the server, @@ -62,7 +60,7 @@ smb_com_echo(struct smb_request *sr) return (SDRC_ERROR); nbytes = sr->smb_bcc; - data = smbsr_malloc(&sr->request_storage, nbytes); + data = smb_srm_alloc(sr, nbytes); if (smb_mbc_decodef(&sr->smb_data, "#c", nbytes, data)) return (SDRC_ERROR); diff --git a/usr/src/uts/common/fs/smbsrv/smb_fem.c b/usr/src/uts/common/fs/smbsrv/smb_fem.c index 3582ce4986..ee3a38851f 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_fem.c +++ b/usr/src/uts/common/fs/smbsrv/smb_fem.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <sys/sdt.h> #include <sys/fcntl.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_find.c b/usr/src/uts/common/fs/smbsrv/smb_find.c index ec55d1e6ba..f556f683ac 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_find.c +++ b/usr/src/uts/common/fs/smbsrv/smb_find.c @@ -23,6 +23,7 @@ * Use is subject to license terms. */ +#include <smbsrv/smb_kproto.h> /* * smb_com_search @@ -194,8 +195,6 @@ * circuit to the consumer. */ -#include <smbsrv/smb_incl.h> - /* *** smb_com_search *** */ smb_sdrc_t @@ -329,7 +328,7 @@ smb_com_search(smb_request_t *sr) (void) strlcpy(name, fileinfo.fi_name, SMB_SHORTNAMELEN - 1); if (to_upper) - (void) utf8_strupr(name); + (void) smb_strupr(name); } else { (void) strlcpy(name, fileinfo.fi_shortname, SMB_SHORTNAMELEN - 1); diff --git a/usr/src/uts/common/fs/smbsrv/smb_flush.c b/usr/src/uts/common/fs/smbsrv/smb_flush.c index 5f86e42dee..5de347b6b5 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_flush.c +++ b/usr/src/uts/common/fs/smbsrv/smb_flush.c @@ -36,7 +36,7 @@ * draft-heizer-cifs-v1-spec-00.txt */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_fsops.c b/usr/src/uts/common/fs/smbsrv/smb_fsops.c index c427df5632..e78a5c1a8a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_fsops.c +++ b/usr/src/uts/common/fs/smbsrv/smb_fsops.c @@ -27,9 +27,6 @@ #include <sys/nbmlock.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_kproto.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/ntaccess.h> -#include <smbsrv/smb_incl.h> #include <acl/acl_common.h> #include <sys/fcntl.h> #include <sys/flock.h> @@ -972,8 +969,8 @@ smb_fsop_getattr(smb_request_t *sr, cred_t *cr, smb_node_t *snode, * into this routine. */ int -smb_fsop_link(smb_request_t *sr, cred_t *cr, smb_node_t *to_dnode, - smb_node_t *from_fnode, char *to_name) +smb_fsop_link(smb_request_t *sr, cred_t *cr, smb_node_t *from_fnode, + smb_node_t *to_dnode, char *to_name) { char *longname = NULL; int flags = 0; @@ -1102,6 +1099,28 @@ smb_fsop_rename( (ACE_DELETE | ACE_ADD_FILE))) return (EACCES); + /* + * SMB checks access on open and retains an access granted + * mask for use while the file is open. ACL changes should + * not affect access to an open file. + * + * If the rename is being performed on an ofile: + * - Check the ofile's access granted mask to see if the + * rename is permitted - requires DELETE access. + * - If the file system does access checking, set the + * ATTR_NOACLCHECK flag to ensure that the file system + * does not check permissions on subsequent calls. + */ + if (sr && sr->fid_ofile) { + rc = smb_ofile_access(sr->fid_ofile, cr, DELETE); + if (rc != NT_STATUS_SUCCESS) + return (EACCES); + + if (smb_tree_has_feature(sr->tid_tree, + SMB_TREE_ACEMASKONACCESS)) + flags = ATTR_NOACLCHECK; + } + rc = smb_vop_rename(from_dnode->vp, from_name, to_dnode->vp, to_name, flags, cr); @@ -1648,6 +1667,13 @@ smb_fsop_lookup_name( * * Other smb_fsop_* routines will call SMB_TREE_CONTAINS_NODE() to prevent * operations on files not in the parent mount. + * + * Case sensitivity flags (SMB_IGNORE_CASE, SMB_CASE_SENSITIVE): + * if SMB_CASE_SENSITIVE is set, the SMB_IGNORE_CASE flag will NOT be set + * based on the tree's case sensitivity. However, if the SMB_IGNORE_CASE + * flag is set in the flags value passed as a parameter, a case insensitive + * lookup WILL be done (regardless of whether SMB_CASE_SENSITIVE is set + * or not). */ int smb_fsop_lookup( @@ -1678,8 +1704,10 @@ smb_fsop_lookup( if (SMB_TREE_CONTAINS_NODE(sr, dnode) == 0) return (EACCES); - if (SMB_TREE_IS_CASEINSENSITIVE(sr)) - flags |= SMB_IGNORE_CASE; + if (!(flags & SMB_CASE_SENSITIVE)) { + if (SMB_TREE_IS_CASEINSENSITIVE(sr)) + flags |= SMB_IGNORE_CASE; + } if (SMB_TREE_SUPPORTS_CATIA(sr)) flags |= SMB_CATIA; if (SMB_TREE_SUPPORTS_ABE(sr)) diff --git a/usr/src/uts/common/fs/smbsrv/smb_init.c b/usr/src/uts/common/fs/smbsrv/smb_init.c index 2059dd572b..a974bdbd30 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_init.c +++ b/usr/src/uts/common/fs/smbsrv/smb_init.c @@ -30,10 +30,9 @@ #include <sys/ioccom.h> #include <sys/policy.h> #include <sys/cmn_err.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_door_svc.h> #include <smbsrv/smb_ioctl.h> -#include <smbsrv/smb_kproto.h> static int smb_drv_open(dev_t *, int, int, cred_t *); static int smb_drv_close(dev_t, int, int, cred_t *); diff --git a/usr/src/uts/common/fs/smbsrv/smb_lock.c b/usr/src/uts/common/fs/smbsrv/smb_lock.c index c7901ca7f2..d74aa0be32 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_lock.c +++ b/usr/src/uts/common/fs/smbsrv/smb_lock.c @@ -31,7 +31,7 @@ * error code. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <sys/nbmlock.h> #include <sys/param.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_lock_byte_range.c b/usr/src/uts/common/fs/smbsrv/smb_lock_byte_range.c index bf74578aba..02ade5c43d 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_lock_byte_range.c +++ b/usr/src/uts/common/fs/smbsrv/smb_lock_byte_range.c @@ -57,7 +57,7 @@ * should return failure to the client */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_lock_byte_range(smb_request_t *sr) diff --git a/usr/src/uts/common/fs/smbsrv/smb_locking_andx.c b/usr/src/uts/common/fs/smbsrv/smb_locking_andx.c index dd765c0979..98906e97e2 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_locking_andx.c +++ b/usr/src/uts/common/fs/smbsrv/smb_locking_andx.c @@ -208,7 +208,7 @@ * ERRSRV/ERRbaduid */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_locking_andx(smb_request_t *sr) diff --git a/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c b/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c index 6eedfe3d19..6e9a00d975 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c +++ b/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c @@ -19,13 +19,11 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_mangle_name.c b/usr/src/uts/common/fs/smbsrv/smb_mangle_name.c index 2d73bb38ac..860e82cc5a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_mangle_name.c +++ b/usr/src/uts/common/fs/smbsrv/smb_mangle_name.c @@ -28,15 +28,10 @@ #include <sys/sunddi.h> #include <sys/errno.h> #include <smbsrv/string.h> -#include <smbsrv/ctype.h> -#include <smbsrv/smb_i18n.h> #include <smbsrv/smb_vops.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> -#define SMB_NAME83_BASELEN 8 -#define SMB_NAME83_LEN 12 - /* * Characters we don't allow in DOS file names. * If a filename contains any of these chars, it should get mangled. @@ -138,7 +133,7 @@ smb_match_unknown(char *name, char *pattern) char *np, *pp; rc = 0; - if (utf8_isstrupr(pattern) <= 0) + if (smb_isstrupr(pattern) <= 0) return (rc); np = name; @@ -149,7 +144,7 @@ smb_match_unknown(char *name, char *pattern) if (nc == ' ') continue; - nc = mts_toupper(nc); + nc = smb_toupper(nc); if ((pc = *pp++) != nc) break; } @@ -157,7 +152,7 @@ smb_match_unknown(char *name, char *pattern) if ((pc == '~') && (pp != (pattern + 1)) && ((pc = *pp++) != 0)) { - while (mts_isdigit(pc)) + while (smb_isdigit(pc)) pc = *pp++; if (pc == '.') { @@ -167,7 +162,7 @@ smb_match_unknown(char *name, char *pattern) } while ((nc = *np++) != 0) { - nc = mts_toupper(nc); + nc = smb_toupper(nc); if ((pc = *pp++) != nc) break; } @@ -222,7 +217,7 @@ smb_is_reserved_dos_name(const char *name) int len; int i; - ch = mts_toupper(*name); + ch = smb_toupper(*name); switch (ch) { case 'A': @@ -246,7 +241,7 @@ smb_is_reserved_dos_name(const char *name) for (i = 0; i < n_reserved; ++i) { len = strlen(reserved[i]); - if (utf8_strncasecmp(reserved[i], name, len) == 0) { + if (smb_strcasecmp(reserved[i], name, len) == 0) { ch = *(name + len); if ((ch == '\0') || (ch == '.')) return (B_TRUE); @@ -329,7 +324,7 @@ smb_needs_mangle(char *name, char **dot_pos) } for (namep = name; *namep; namep++) { - if (!mts_isascii(*namep) || + if (!smb_isascii(*namep) || strchr(special_chars, *namep) || strchr(invalid_dos_chars, *namep)) return (1); @@ -391,7 +386,7 @@ smb_needs_shortname(char *name) if (len) { (void) snprintf(buf, len + 1, "%s", name); /* if the name contains both lower and upper cases */ - if (utf8_isstrupr(buf) == 0 && utf8_isstrlwr(buf) == 0) { + if (smb_isstrupr(buf) == 0 && smb_isstrlwr(buf) == 0) { /* create shortname */ create = 1; } else if (dot_pos) { @@ -401,7 +396,7 @@ smb_needs_shortname(char *name) * if the extension contains both lower and upper * cases */ - if (utf8_isstrupr(buf) == 0 && utf8_isstrlwr(buf) == 0) + if (smb_isstrupr(buf) == 0 && smb_isstrlwr(buf) == 0) /* create shortname */ create = 1; } @@ -430,7 +425,7 @@ smb_mangle_char(unsigned char ch) if (strchr(special_chars, ch)) return ('_'); - return (mts_toupper(ch)); + return (smb_toupper(ch)); } /* @@ -565,21 +560,21 @@ int smb_mangle_name( if (smb_needs_shortname(name)) { namep = (unsigned char *)name; while (*namep) - *out_short++ = mts_toupper(*namep++); + *out_short++ = smb_toupper(*namep++); *out_short = '\0'; } out_83 = (unsigned char *)name83; (void) strcpy((char *)out_83, " . "); while (*name && *name != '.') - *out_83++ = mts_toupper(*name++); + *out_83++ = smb_toupper(*name++); if (*name == '.') { /* copy extension */ name++; out_83 = (unsigned char *)name83 + 9; while (*name) - *out_83++ = mts_toupper(*name++); + *out_83++ = smb_toupper(*name++); } return (1); } @@ -723,10 +718,15 @@ smb_unmangle_name(smb_node_t *dnode, char *name, char *namebuf, namep = dp->d_name; } + /* skip non utf8 filename */ + if (u8_validate(namep, strlen(namep), NULL, + U8_VALIDATE_ENTIRE, &err) < 0) + continue; + (void) smb_mangle_name(ino, namep, shortname, name83, 1); - if (utf8_strcasecmp(name, shortname) == 0) { + if (smb_strcasecmp(name, shortname, 0) == 0) { (void) strlcpy(namebuf, namep, buflen); kmem_free(buf, SMB_UNMANGLE_BUFSIZE); return (0); diff --git a/usr/src/uts/common/fs/smbsrv/smb_mbuf_marshaling.c b/usr/src/uts/common/fs/smbsrv/smb_mbuf_marshaling.c index 3eb054e383..3d60f5fd77 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_mbuf_marshaling.c +++ b/usr/src/uts/common/fs/smbsrv/smb_mbuf_marshaling.c @@ -27,9 +27,7 @@ * SMB mbuf marshaling encode/decode. */ -#include <smbsrv/smb_incl.h> - -#include <sys/sunddi.h> +#include <smbsrv/smb_kproto.h> #define MALLOC_QUANTUM 80 @@ -58,10 +56,10 @@ static int mbc_marshal_get_long(mbuf_chain_t *mbc, uint32_t *data); static uint64_t qswap(uint64_t ll); static int mbc_marshal_get_odd_long_long(mbuf_chain_t *mbc, uint64_t *data); static int mbc_marshal_get_long_long(mbuf_chain_t *mbc, uint64_t *data); -static int mbc_marshal_get_ascii_string(struct smb_malloc_list *, - mbuf_chain_t *, uint8_t **ascii, int); -static int mbc_marshal_get_unicode_string(struct smb_malloc_list *, - mbuf_chain_t *, uint8_t **, int); +static int mbc_marshal_get_ascii_string(smb_request_t *, mbuf_chain_t *, + uint8_t **ascii, int); +static int mbc_marshal_get_unicode_string(smb_request_t *, mbuf_chain_t *, + uint8_t **, int); static int mbc_marshal_get_mbufs(mbuf_chain_t *, int32_t, mbuf_t **); static int mbc_marshal_get_mbuf_chain(mbuf_chain_t *, int32_t, mbuf_chain_t *); static int mbc_marshal_get_uio(mbuf_chain_t *, struct uio *); @@ -298,7 +296,7 @@ ascii_conversion: cvalpp = va_arg(ap, uint8_t **); if (repc <= 1) repc = 0; - if (mbc_marshal_get_ascii_string(&sr->request_storage, + if (mbc_marshal_get_ascii_string(sr, mbc, cvalpp, repc) != 0) return (-1); break; @@ -311,7 +309,7 @@ unicode_translation: repc = 0; if (mbc->chain_offset & 1) mbc->chain_offset++; - if (mbc_marshal_get_unicode_string(&sr->request_storage, + if (mbc_marshal_get_unicode_string(sr, mbc, cvalpp, repc) != 0) return (-1); break; @@ -909,11 +907,11 @@ mbc_marshal_put_long_long(mbuf_chain_t *mbc, uint64_t data) static int mbc_marshal_put_ascii_string(mbuf_chain_t *mbc, char *mbs, int repc) { - mts_wchar_t wide_char; + smb_wchar_t wide_char; int nbytes; int length; - if ((length = mts_sbequiv_strlen(mbs)) == -1) + if ((length = smb_sbequiv_strlen(mbs)) == -1) return (DECODE_NO_MORE_DATA); length += sizeof (char); @@ -927,7 +925,7 @@ mbc_marshal_put_ascii_string(mbuf_chain_t *mbc, char *mbs, int repc) /* * We should restore oem chars here. */ - nbytes = mts_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); + nbytes = smb_mbtowc(&wide_char, mbs, MTS_MB_CHAR_MAX); if (nbytes == -1) return (DECODE_NO_MORE_DATA); @@ -946,14 +944,14 @@ mbc_marshal_put_ascii_string(mbuf_chain_t *mbc, char *mbs, int repc) static int mbc_marshal_put_unicode_string(mbuf_chain_t *mbc, char *ascii, int repc) { - mts_wchar_t wchar; + smb_wchar_t wchar; int consumed; int length; - if ((length = mts_wcequiv_strlen(ascii)) == -1) + if ((length = smb_wcequiv_strlen(ascii)) == -1) return (DECODE_NO_MORE_DATA); - length += sizeof (mts_wchar_t); + length += sizeof (smb_wchar_t); if ((repc > 1) && (repc < length)) length = repc; @@ -961,7 +959,7 @@ mbc_marshal_put_unicode_string(mbuf_chain_t *mbc, char *ascii, int repc) if (mbc_marshal_make_room(mbc, length)) return (DECODE_NO_MORE_DATA); while (length > 0) { - consumed = mts_mbtowc(&wchar, ascii, MTS_MB_CHAR_MAX); + consumed = smb_mbtowc(&wchar, ascii, MTS_MB_CHAR_MAX); if (consumed == -1) break; /* Invalid sequence */ /* @@ -973,7 +971,7 @@ mbc_marshal_put_unicode_string(mbuf_chain_t *mbc, char *ascii, int repc) ascii += consumed; mbc_marshal_store_byte(mbc, wchar); mbc_marshal_store_byte(mbc, wchar >> 8); - length -= sizeof (mts_wchar_t); + length -= sizeof (smb_wchar_t); } return (0); } @@ -1215,10 +1213,10 @@ mbc_marshal_get_long_long(mbuf_chain_t *mbc, uint64_t *data) */ static int mbc_marshal_get_ascii_string( - struct smb_malloc_list *ml, - mbuf_chain_t *mbc, + smb_request_t *sr, + mbuf_chain_t *mbc, uint8_t **ascii, - int max_ascii) + int max_ascii) { char *rcvbuf; char *ch; @@ -1226,7 +1224,7 @@ mbc_marshal_get_ascii_string( int length = 0; max = MALLOC_QUANTUM; - rcvbuf = smbsr_malloc(ml, max); + rcvbuf = smb_srm_alloc(sr, max); if (max_ascii == 0) max_ascii = 0xffff; @@ -1247,7 +1245,7 @@ mbc_marshal_get_ascii_string( length++; } max += MALLOC_QUANTUM; - rcvbuf = smbsr_realloc(rcvbuf, max); + rcvbuf = smb_srm_realloc(sr, rcvbuf, max); ch = rcvbuf + length; } @@ -1256,13 +1254,13 @@ multibyte_encode: * UTF-8 encode the string for internal system use. */ length = strlen(rcvbuf) + 1; - *ascii = smbsr_malloc(ml, length * MTS_MB_CHAR_MAX); + *ascii = smb_srm_alloc(sr, length * MTS_MB_CHAR_MAX); return (mbc_marshal_cstou8("CP850", (char *)*ascii, (size_t)length * MTS_MB_CHAR_MAX, rcvbuf, (size_t)length)); } static int -mbc_marshal_get_unicode_string(struct smb_malloc_list *ml, +mbc_marshal_get_unicode_string(smb_request_t *sr, mbuf_chain_t *mbc, uint8_t **ascii, int max_unicode) { int max; @@ -1275,7 +1273,7 @@ mbc_marshal_get_unicode_string(struct smb_malloc_list *ml, max_unicode = 0xffff; max = MALLOC_QUANTUM; - *ascii = smbsr_malloc(ml, max); + *ascii = smb_srm_alloc(sr, max); ch = (char *)*ascii; for (;;) { @@ -1289,12 +1287,12 @@ mbc_marshal_get_unicode_string(struct smb_malloc_list *ml, if (wchar == 0) goto done; - emitted = mts_wctomb(ch, wchar); + emitted = smb_wctomb(ch, wchar); length += emitted; ch += emitted; } max += MALLOC_QUANTUM; - *ascii = smbsr_realloc(*ascii, max); + *ascii = smb_srm_realloc(sr, *ascii, max); ch = (char *)*ascii + length; } done: *ch = 0; diff --git a/usr/src/uts/common/fs/smbsrv/smb_mbuf_util.c b/usr/src/uts/common/fs/smbsrv/smb_mbuf_util.c index 8dcba3b111..76d468eebe 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_mbuf_util.c +++ b/usr/src/uts/common/fs/smbsrv/smb_mbuf_util.c @@ -57,8 +57,7 @@ * */ -#include <smbsrv/smb_incl.h> -#include <smbsrv/mbuf.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_kstat.h> static kmem_cache_t *smb_mbc_cache = NULL; diff --git a/usr/src/uts/common/fs/smbsrv/smb_memory_manager.c b/usr/src/uts/common/fs/smbsrv/smb_memory_manager.c deleted file mode 100644 index 61e1066388..0000000000 --- a/usr/src/uts/common/fs/smbsrv/smb_memory_manager.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Memory management functions. - */ - -#include <smbsrv/smb_incl.h> - -/* - * smbsr_malloc - * - * allocate a block of memory with the given size and - * add it to the given linked list. This function is - * used to allocate temporary memories which are needed - * during processing of a SMB request. These memories - * get freed when request processing is finished. - */ -void * -smbsr_malloc(smb_malloc_list *list, size_t size) -{ - smb_malloc_list *element; - - size += sizeof (smb_malloc_list); - element = MEM_MALLOC("smb", size); - element->forw = list->forw; - element->back = list; - list->forw->back = element; - list->forw = element; - return (void *)(element + 1); /* return address of data */ -} - -/* - * smbsr_realloc - * - * This function is used in conjunction with smbsr_malloc to - * resize an already allocated entity. - */ -void * -smbsr_realloc(void *mem, size_t size) -{ - smb_malloc_list *element = (smb_malloc_list *)mem; - smb_malloc_list *new_entry; - smb_malloc_list *list; - - element--; - list = element->back; - QUEUE_CLIP(element); - size += sizeof (smb_malloc_list); - - new_entry = MEM_REALLOC("smb", element, size); - new_entry->forw = list->forw; - new_entry->back = list; - list->forw->back = new_entry; - list->forw = new_entry; - return (void *)(new_entry + 1); /* return address of new data */ -} - -/* - * smbsr_free_malloc_list - * - * Frees all memory block in the given linked list. - */ -void -smbsr_free_malloc_list(smb_malloc_list *root) -{ - smb_malloc_list *element; - - /* - * we initialize smb_request structure in smb_nt_notify_change - * function, so we should check root->forw to make sure it's - * not NULL. - */ - while (root->forw && root->forw != root) { - element = root->forw; - - element->forw->back = element->back; - element->back->forw = element->forw; - - /* and release it... */ - MEM_FREE("smb", element); - } -} diff --git a/usr/src/uts/common/fs/smbsrv/smb_negotiate.c b/usr/src/uts/common/fs/smbsrv/smb_negotiate.c index acca9991c9..17975468cc 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_negotiate.c +++ b/usr/src/uts/common/fs/smbsrv/smb_negotiate.c @@ -175,7 +175,7 @@ * Connectionless clients must set Sid to 0 in the SMB request header. * * Capabilities allows the server to tell the client what it supports. - * The bit definitions defined in cifs.h. Bit 0x2000 used to be set in + * The bit definitions defined in smb.h. Bit 0x2000 used to be set in * the negotiate response capabilities but it caused problems with * Windows 2000. It is probably not valid, it doesn't appear in the * CIFS spec. @@ -191,9 +191,8 @@ #include <sys/socket.h> #include <sys/random.h> #include <netinet/in.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smbinfo.h> -#include <smbsrv/smb_i18n.h> /* * Maximum buffer size for DOS: chosen to be the same as NT. @@ -400,8 +399,8 @@ smb_com_negotiate(smb_request_t *sr) * skc_nbdomain is not expected to be aligned. * Use temporary buffer to avoid alignment padding */ - buflen = mts_wcequiv_strlen(sr->sr_cfg->skc_nbdomain) + - sizeof (mts_wchar_t); + buflen = smb_wcequiv_strlen(sr->sr_cfg->skc_nbdomain) + + sizeof (smb_wchar_t); tmpbuf = kmem_zalloc(buflen, KM_SLEEP); smb_msgbuf_init(&mb, (uint8_t *)tmpbuf, buflen, SMB_MSGBUF_UNICODE); diff --git a/usr/src/uts/common/fs/smbsrv/smb_node.c b/usr/src/uts/common/fs/smbsrv/smb_node.c index bd97813765..ae578f0899 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_node.c +++ b/usr/src/uts/common/fs/smbsrv/smb_node.c @@ -128,7 +128,7 @@ * course the state of the node should be tested/updated under the * protection of the mutex). */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_kstat.h> #include <sys/pathname.h> @@ -1283,6 +1283,7 @@ smb_node_getattr(smb_request_t *sr, smb_node_t *node, smb_attr_t *attr) if (node->vp->v_type == VDIR) { attr->sa_vattr.va_size = 0; attr->sa_allocsz = 0; + attr->sa_vattr.va_nlink = 1; } if (node->readonly_creator) diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_cancel.c b/usr/src/uts/common/fs/smbsrv/smb_nt_cancel.c index b49705efb8..1e4d9df892 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_cancel.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_cancel.c @@ -41,7 +41,7 @@ * the original request. No other response is generated for this SMB. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_nt_cancel(smb_request_t *sr) diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_create_andx.c b/usr/src/uts/common/fs/smbsrv/smb_nt_create_andx.c index aa12b2c96b..c5222de5ab 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_create_andx.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_create_andx.c @@ -28,7 +28,7 @@ */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_vops.h> @@ -220,6 +220,11 @@ void smb_post_nt_create_andx(smb_request_t *sr) { DTRACE_SMB_1(op__NtCreateX__done, smb_request_t *, sr); + + if (sr->arg.open.dir != NULL) { + smb_ofile_release(sr->arg.open.dir); + sr->arg.open.dir = NULL; + } } smb_sdrc_t @@ -260,16 +265,14 @@ smb_com_nt_create_andx(struct smb_request *sr) if (op->rootdirfid == 0) { op->fqi.fq_dnode = sr->tid_tree->t_snode; } else { - sr->smb_fid = (ushort_t)op->rootdirfid; - smbsr_lookup_file(sr); - if (sr->fid_ofile == NULL) { + op->dir = smb_ofile_lookup_by_fid(sr->tid_tree, + (uint16_t)op->rootdirfid); + if (op->dir == NULL) { smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid); return (SDRC_ERROR); } - - op->fqi.fq_dnode = sr->fid_ofile->f_node; - smbsr_release_file(sr); + op->fqi.fq_dnode = op->dir->f_node; } if (smb_common_open(sr) != NT_STATUS_SUCCESS) diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_create.c b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_create.c index 80f2319a96..22786fe92d 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_create.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_create.c @@ -35,11 +35,6 @@ #include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/ntaccess.h> -#include <smbsrv/nterror.h> -#include <smbsrv/cifs.h> -#include <smbsrv/doserror.h> /* * smb_nt_transact_create @@ -136,6 +131,9 @@ smb_post_nt_transact_create(smb_request_t *sr, smb_xa_t *xa) smb_sd_term(sd); kmem_free(sd, sizeof (smb_sd_t)); } + + if (sr->arg.open.dir != NULL) + smb_ofile_release(sr->arg.open.dir); } smb_sdrc_t @@ -176,16 +174,14 @@ smb_nt_transact_create(smb_request_t *sr, smb_xa_t *xa) if (op->rootdirfid == 0) { op->fqi.fq_dnode = sr->tid_tree->t_snode; } else { - sr->smb_fid = (ushort_t)op->rootdirfid; - smbsr_lookup_file(sr); - if (sr->fid_ofile == NULL) { + op->dir = smb_ofile_lookup_by_fid(sr->tid_tree, + (uint16_t)op->rootdirfid); + if (op->dir == NULL) { smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid); return (SDRC_ERROR); } - - op->fqi.fq_dnode = sr->fid_ofile->f_node; - smbsr_release_file(sr); + op->fqi.fq_dnode = op->dir->f_node; } status = smb_common_open(sr); diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_ioctl.c b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_ioctl.c index d1290e5889..ac52576534 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_ioctl.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_ioctl.c @@ -23,9 +23,8 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/winioctl.h> -#include <smbsrv/ntstatus.h> static uint32_t smb_nt_trans_ioctl_noop(smb_request_t *, smb_xa_t *); diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_notify_change.c b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_notify_change.c index cfb82e5419..e806482f3a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_notify_change.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_notify_change.c @@ -109,7 +109,7 @@ * FILE_ACTION_MODIFIED_STREAM 0x00000008 */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <sys/sdt.h> static void smb_notify_change_daemon(smb_thread_t *, void *); diff --git a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_security.c b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_security.c index de6b9b385f..e2ceeb9de5 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_nt_transact_security.c +++ b/usr/src/uts/common/fs/smbsrv/smb_nt_transact_security.c @@ -24,10 +24,6 @@ */ #include <smbsrv/smb_kproto.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/nterror.h> -#include <smbsrv/doserror.h> -#include <smbsrv/cifs.h> static void smb_encode_sd(struct smb_xa *, smb_sd_t *, uint32_t); static void smb_encode_sacl(struct smb_xa *, smb_acl_t *); diff --git a/usr/src/uts/common/fs/smbsrv/smb_odir.c b/usr/src/uts/common/fs/smbsrv/smb_odir.c index c953aa05a5..c89bee8e98 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_odir.c +++ b/usr/src/uts/common/fs/smbsrv/smb_odir.c @@ -243,7 +243,6 @@ * See smb_search, smb_find, smb_find_unique, and smb_trans2_find for details */ -#include <smbsrv/smb_incl.h> #include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_share.h> @@ -573,7 +572,7 @@ int smb_odir_read_fileinfo(smb_request_t *sr, smb_odir_t *od, smb_fileinfo_t *fileinfo, boolean_t *eof) { - int rc; + int rc, errnum; smb_odirent_t *odirent; boolean_t ignore_case; @@ -612,6 +611,12 @@ smb_odir_read_fileinfo(smb_request_t *sr, smb_odir_t *od, if ((rc = smb_odir_next_odirent(od, odirent)) != 0) break; + /* skip non utf8 filename */ + if (u8_validate(odirent->od_name, + strlen(odirent->od_name), NULL, + U8_VALIDATE_ENTIRE, &errnum) < 0) + continue; + if (!smb_match_name(odirent->od_ino, odirent->od_name, od->d_pattern, ignore_case)) continue; diff --git a/usr/src/uts/common/fs/smbsrv/smb_ofile.c b/usr/src/uts/common/fs/smbsrv/smb_ofile.c index 8d7ec2f06d..fa0904040f 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_ofile.c +++ b/usr/src/uts/common/fs/smbsrv/smb_ofile.c @@ -160,7 +160,6 @@ * being queued in that list is NOT registered by incrementing the * reference count. */ -#include <smbsrv/smb_incl.h> #include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> @@ -616,7 +615,7 @@ smb_ofile_disallow_fclose(smb_ofile_t *of) case SMB_FTYPE_MESG_PIPE: ASSERT(of->f_pipe); - if (utf8_strcasecmp(of->f_pipe->p_name, "SRVSVC") == 0) + if (smb_strcasecmp(of->f_pipe->p_name, "SRVSVC", 0) == 0) return (B_TRUE); break; default: @@ -1282,7 +1281,7 @@ smb_ofile_netinfo_init(smb_ofile_t *of, smb_netfileinfo_t *fi) fi->fi_fid = of->f_fid; fi->fi_uniqid = of->f_uniqid; fi->fi_pathlen = strlen(buf) + 1; - fi->fi_path = smb_kstrdup(buf, fi->fi_pathlen); + fi->fi_path = smb_strdup(buf); kmem_free(buf, MAXPATHLEN); fi->fi_namelen = user->u_domain_len + user->u_name_len + 2; @@ -1299,7 +1298,7 @@ smb_ofile_netinfo_fini(smb_netfileinfo_t *fi) return; if (fi->fi_path) - kmem_free(fi->fi_path, fi->fi_pathlen); + smb_mfree(fi->fi_path); if (fi->fi_username) kmem_free(fi->fi_username, fi->fi_namelen); diff --git a/usr/src/uts/common/fs/smbsrv/smb_open_andx.c b/usr/src/uts/common/fs/smbsrv/smb_open_andx.c index f701f35c7b..ee67413338 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_open_andx.c +++ b/usr/src/uts/common/fs/smbsrv/smb_open_andx.c @@ -23,8 +23,8 @@ * Use is subject to license terms. */ +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_vops.h> -#include <smbsrv/smb_incl.h> int smb_open_dsize_check = 0; diff --git a/usr/src/uts/common/fs/smbsrv/smb_opipe.c b/usr/src/uts/common/fs/smbsrv/smb_opipe.c index a2917039c9..3048e034e7 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_opipe.c +++ b/usr/src/uts/common/fs/smbsrv/smb_opipe.c @@ -32,7 +32,7 @@ #include <sys/door_data.h> #include <sys/uio.h> #include <sys/ksynch.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_xdr.h> #define SMB_OPIPE_ISOPEN(OPIPE) \ @@ -170,13 +170,13 @@ smb_opipe_lookup(const char *path) name = path; name += strspn(name, "\\"); - if (utf8_strncasecmp(name, "PIPE", 4) == 0) { + if (smb_strcasecmp(name, "PIPE", 4) == 0) { path += 4; name += strspn(name, "\\"); } for (i = 0; i < sizeof (named_pipes) / sizeof (named_pipes[0]); ++i) { - if (utf8_strcasecmp(name, named_pipes[i]) == 0) + if (smb_strcasecmp(name, named_pipes[i], 0) == 0) return (named_pipes[i]); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_oplock.c b/usr/src/uts/common/fs/smbsrv/smb_oplock.c index 20fdfd10dc..53685acdb0 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_oplock.c +++ b/usr/src/uts/common/fs/smbsrv/smb_oplock.c @@ -37,7 +37,7 @@ * that is not the case anymore. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <inet/tcp.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_path_name_reduction.c b/usr/src/uts/common/fs/smbsrv/smb_path_name_reduction.c index cfc1956044..6537da627e 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_path_name_reduction.c +++ b/usr/src/uts/common/fs/smbsrv/smb_path_name_reduction.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <sys/pathname.h> #include <sys/sdt.h> @@ -41,7 +41,7 @@ smb_is_executable(char *path) if ((len >= 4) && (path[len - 4] == '.')) { (void) strcpy(extension, &path[len - 3]); - (void) utf8_strupr(extension); + (void) smb_strupr(extension); if (strcmp(extension, "EXE") == 0) return (NODE_FLAGS_EXECUTABLE); diff --git a/usr/src/uts/common/fs/smbsrv/smb_print.c b/usr/src/uts/common/fs/smbsrv/smb_print.c index fb45b80339..4e21dfdd2b 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_print.c +++ b/usr/src/uts/common/fs/smbsrv/smb_print.c @@ -19,17 +19,15 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * SMB print interface. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_process_exit.c b/usr/src/uts/common/fs/smbsrv/smb_process_exit.c index 83c626bab8..f39b376ee1 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_process_exit.c +++ b/usr/src/uts/common/fs/smbsrv/smb_process_exit.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,7 +51,7 @@ * send this message at all. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_process_exit(smb_request_t *sr) diff --git a/usr/src/uts/common/fs/smbsrv/smb_query_fileinfo.c b/usr/src/uts/common/fs/smbsrv/smb_query_fileinfo.c index 377baec57e..d87e3994b9 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_query_fileinfo.c +++ b/usr/src/uts/common/fs/smbsrv/smb_query_fileinfo.c @@ -23,8 +23,8 @@ * Use is subject to license terms. */ +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_vops.h> -#include <smbsrv/smb_incl.h> #include <smbsrv/smb_fsops.h> /* @@ -91,7 +91,8 @@ static int smb_query_encode_response(smb_request_t *, smb_xa_t *, uint16_t, smb_queryinfo_t *); static void smb_encode_stream_info(smb_request_t *, smb_xa_t *, smb_queryinfo_t *); -static int smb_all_info_filename(smb_tree_t *, smb_node_t *, char *, size_t); +static int smb_query_pathname(smb_tree_t *, smb_node_t *, boolean_t, + char *, size_t); uint32_t smb_pad_align(uint32_t offset, uint32_t align); @@ -500,7 +501,7 @@ smb_query_encode_response(smb_request_t *sr, smb_xa_t *xa, case SMB_FILE_ALT_NAME_INFORMATION: (void) smb_mbc_encodef(&xa->rep_param_mb, "w", 0); (void) smb_mbc_encodef(&xa->rep_data_mb, "%lU", sr, - mts_wcequiv_strlen(qinfo->qi_shortname), + smb_wcequiv_strlen(qinfo->qi_shortname), qinfo->qi_shortname); break; @@ -688,19 +689,22 @@ smb_pad_align(uint32_t offset, uint32_t align) } /* - * smb_all_info_filename - * - * This format of filename is only used by the ALL_INFO levels. + * smb_query_pathname * * Determine the absolute pathname of 'node' within the share. + * For some levels (e.g. ALL_INFO) the pathname should include the + * sharename for others (e.g. NAME_INFO) the pathname should be + * relative to the share. * For example if the node represents file "test1.txt" in directory - * "dir1" on share "share1", the path would be: \share1\dir1\test1.txt + * "dir1" on share "share1" + * - if include_share is TRUE the pathname would be: \share1\dir1\test1.txt + * - if include_share is FALSE the pathname would be: \dir1\test1.txt * * If node represents a named stream, construct the pathname for the * associated unnamed stream then append the stream name. */ static int -smb_all_info_filename(smb_tree_t *tree, smb_node_t *node, +smb_query_pathname(smb_tree_t *tree, smb_node_t *node, boolean_t include_share, char *buf, size_t buflen) { char *sharename = tree->t_sharename; @@ -708,12 +712,14 @@ smb_all_info_filename(smb_tree_t *tree, smb_node_t *node, size_t len; vnode_t *vp; - len = snprintf(buf, buflen, "\\%s", sharename); - if (len == (buflen - 1)) - return (ENAMETOOLONG); + if (include_share) { + len = snprintf(buf, buflen, "\\%s", sharename); + if (len == (buflen - 1)) + return (ENAMETOOLONG); - buf += len; - buflen -= len; + buf += len; + buflen -= len; + } if (SMB_IS_STREAM(node)) vp = node->n_unode->vp; @@ -741,8 +747,8 @@ int smb_query_fileinfo(smb_request_t *sr, smb_node_t *node, uint16_t infolev, smb_queryinfo_t *qinfo) { - char *namep = node->od_name; int rc; + boolean_t include_sharename = B_FALSE; (void) bzero(qinfo, sizeof (smb_queryinfo_t)); @@ -768,31 +774,18 @@ smb_query_fileinfo(smb_request_t *sr, smb_node_t *node, uint16_t infolev, /* populate name, namelen and shortname */ - /* ALL_INFO levels are a special case for name field */ + /* ALL_INFO levels include the sharename in the name field */ if ((infolev == SMB_QUERY_FILE_ALL_INFO) || (infolev == SMB_FILE_ALL_INFORMATION)) { - rc = smb_all_info_filename(sr->tid_tree, node, - qinfo->qi_name, MAXPATHLEN); - if (rc != 0) { - smbsr_errno(sr, rc); - return (-1); - } - qinfo->qi_namelen = - smb_ascii_or_unicode_strlen(sr, qinfo->qi_name); - return (0); + include_sharename = B_TRUE; } - /* - * It looks like NT doesn't know what to do with the name "." - * so we convert it to "\\" to indicate the root directory. - * If the leading \ is missing, add it. - */ - if (strcmp(namep, ".") == 0) - (void) strlcpy(qinfo->qi_name, "\\", MAXNAMELEN); - else if (*namep != '\\') - (void) snprintf(qinfo->qi_name, MAXNAMELEN, "\\%s", namep); - else - (void) strlcpy(qinfo->qi_name, namep, MAXNAMELEN); + rc = smb_query_pathname(sr->tid_tree, node, include_sharename, + qinfo->qi_name, MAXPATHLEN); + if (rc != 0) { + smbsr_errno(sr, rc); + return (-1); + } qinfo->qi_namelen = smb_ascii_or_unicode_strlen(sr, qinfo->qi_name); @@ -809,14 +802,15 @@ smb_query_fileinfo(smb_request_t *sr, smb_node_t *node, uint16_t infolev, /* * If the shortname is generated by smb_mangle_name() * it will be returned as the alternative name. - * Otherwise, convert the original name to upper-case + * Otherwise, convert the original name to upper-case * and return it as the alternative name. */ (void) smb_mangle_name(qinfo->qi_attr.sa_vattr.va_nodeid, - namep, qinfo->qi_shortname, qinfo->qi_name83, 0); + node->od_name, qinfo->qi_shortname, qinfo->qi_name83, 0); if (*qinfo->qi_shortname == 0) { - (void) strlcpy(qinfo->qi_shortname, namep, SMB_SHORTNAMELEN); - (void) utf8_strupr(qinfo->qi_shortname); + (void) strlcpy(qinfo->qi_shortname, node->od_name, + SMB_SHORTNAMELEN); + (void) smb_strupr(qinfo->qi_shortname); } return (0); diff --git a/usr/src/uts/common/fs/smbsrv/smb_query_information_disk.c b/usr/src/uts/common/fs/smbsrv/smb_query_information_disk.c index 42831bb821..3053fa3a67 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_query_information_disk.c +++ b/usr/src/uts/common/fs/smbsrv/smb_query_information_disk.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * SMB: query_information_disk * @@ -64,7 +62,7 @@ * TotalUnit or FreeUnits (i.e. 0xFFFF) should be returned. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> smb_sdrc_t diff --git a/usr/src/uts/common/fs/smbsrv/smb_read.c b/usr/src/uts/common/fs/smbsrv/smb_read.c index 9593b18beb..e79a595b15 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_read.c +++ b/usr/src/uts/common/fs/smbsrv/smb_read.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_rename.c b/usr/src/uts/common/fs/smbsrv/smb_rename.c index 6da6809374..1a88f12700 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_rename.c +++ b/usr/src/uts/common/fs/smbsrv/smb_rename.c @@ -23,9 +23,8 @@ * Use is subject to license terms. */ -#include <smbsrv/nterror.h> #include <sys/synch.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <sys/nbmlock.h> @@ -42,11 +41,20 @@ #define SMB_NT_RENAME_RENAME_FILE 0x0104 #define SMB_NT_RENAME_MOVE_FILE 0x0105 -static int smb_do_rename(smb_request_t *, smb_fqi_t *, smb_fqi_t *); +/* + * SMB_TRANS2_SET_FILE/PATH_INFO (RENAME_INFORMATION level) flag + */ +#define SMB_RENAME_FLAG_OVERWRITE 0x001 + +static int smb_common_rename(smb_request_t *, smb_fqi_t *, smb_fqi_t *); static int smb_make_link(smb_request_t *, smb_fqi_t *, smb_fqi_t *); +static int smb_rename_check_stream(smb_fqi_t *, smb_fqi_t *); static int smb_rename_check_attr(smb_request_t *, smb_node_t *, uint16_t); static void smb_rename_set_error(smb_request_t *, int); +static int smb_rename_lookup_src(smb_request_t *); +static void smb_rename_release_src(smb_request_t *); + /* * smb_com_rename * @@ -62,8 +70,7 @@ static void smb_rename_set_error(smb_request_t *, int); * have. If SearchAttributes is zero then only normal files are renamed. * If the system file or hidden attributes are specified then the rename * is inclusive - both the specified type(s) of files and normal files are - * renamed. The encoding of SearchAttributes is described in section 3.10 - * - File Attribute Encoding. + * renamed. */ smb_sdrc_t smb_pre_rename(smb_request_t *sr) @@ -104,7 +111,7 @@ smb_com_rename(smb_request_t *sr) return (SDRC_ERROR); } - rc = smb_do_rename(sr, src_fqi, dst_fqi); + rc = smb_common_rename(sr, src_fqi, dst_fqi); if (rc != 0) { smb_rename_set_error(sr, rc); @@ -116,208 +123,17 @@ smb_com_rename(smb_request_t *sr) } /* - * smb_do_rename - * - * Common code for renaming a file. - * - * If the source and destination are identical, we go through all - * the checks but we don't actually do the rename. If the source - * and destination files differ only in case, we do a case-sensitive - * rename. Otherwise, we do a full case-insensitive rename. - * - * Returns errno values. - */ -static int -smb_do_rename(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) -{ - smb_node_t *src_node, *tnode; - char *dstname; - DWORD status; - int rc; - int count; - char *path; - - tnode = sr->tid_tree->t_snode; - - /* Lookup the source node. It MUST exist. */ - path = src_fqi->fq_path.pn_path; - rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, - &src_fqi->fq_dnode, src_fqi->fq_last_comp); - if (rc != 0) - return (rc); - - rc = smb_fsop_lookup(sr, sr->user_cr, SMB_FOLLOW_LINKS, tnode, - src_fqi->fq_dnode, src_fqi->fq_last_comp, &src_fqi->fq_fnode); - if (rc != 0) { - smb_node_release(src_fqi->fq_dnode); - return (rc); - } - - src_node = src_fqi->fq_fnode; - rc = smb_rename_check_attr(sr, src_node, src_fqi->fq_sattr); - if (rc != 0) { - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (rc); - } - - /* - * Break the oplock before access checks. If a client - * has a file open, this will force a flush or close, - * which may affect the outcome of any share checking. - */ - (void) smb_oplock_break(src_node, sr->session, B_FALSE); - - for (count = 0; count <= 3; count++) { - if (count) { - smb_node_end_crit(src_node); - delay(MSEC_TO_TICK(400)); - } - - smb_node_start_crit(src_node, RW_READER); - - status = smb_node_rename_check(src_node); - - if (status != NT_STATUS_SHARING_VIOLATION) - break; - } - - if (status == NT_STATUS_SHARING_VIOLATION) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (EPIPE); /* = ERRbadshare */ - } - - status = smb_range_check(sr, src_node, 0, UINT64_MAX, B_TRUE); - - if (status != NT_STATUS_SUCCESS) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (EACCES); - } - - /* Lookup destination node. */ - path = dst_fqi->fq_path.pn_path; - rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, - &dst_fqi->fq_dnode, dst_fqi->fq_last_comp); - if (rc != 0) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (rc); - } - - rc = smb_fsop_lookup(sr, sr->user_cr, SMB_FOLLOW_LINKS, tnode, - dst_fqi->fq_dnode, dst_fqi->fq_last_comp, &dst_fqi->fq_fnode); - if ((rc != 0) && (rc != ENOENT)) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (rc); - } - - if (utf8_strcasecmp(src_fqi->fq_path.pn_path, - dst_fqi->fq_path.pn_path) == 0) { - - if (dst_fqi->fq_fnode) - smb_node_release(dst_fqi->fq_fnode); - - rc = strcmp(src_fqi->fq_fnode->od_name, dst_fqi->fq_last_comp); - if (rc == 0) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (0); - } - - rc = smb_fsop_rename(sr, sr->user_cr, - src_fqi->fq_dnode, src_fqi->fq_fnode->od_name, - dst_fqi->fq_dnode, dst_fqi->fq_last_comp); - - smb_node_end_crit(src_node); - if (rc == 0) - smb_node_notify_change(dst_fqi->fq_dnode); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (rc); - } - - /* dst node must not exist */ - if (dst_fqi->fq_fnode) { - smb_node_end_crit(src_node); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_fnode); - smb_node_release(dst_fqi->fq_dnode); - return (EEXIST); - } - - /* - * If the source name is mangled but the source and destination - * on-disk names are identical, we'll use the on-disk name. - */ - if ((smb_maybe_mangled_name(src_fqi->fq_last_comp)) && - (strcmp(src_fqi->fq_last_comp, dst_fqi->fq_last_comp) == 0)) { - dstname = src_fqi->fq_fnode->od_name; - } else { - dstname = dst_fqi->fq_last_comp; - } - - rc = smb_fsop_rename(sr, sr->user_cr, - src_fqi->fq_dnode, src_fqi->fq_fnode->od_name, - dst_fqi->fq_dnode, dstname); - - smb_node_end_crit(src_node); - if (rc == 0) - smb_node_notify_change(dst_fqi->fq_dnode); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (rc); -} - -/* * smb_com_nt_rename * * Rename a file. Files OldFileName must exist and NewFileName must not. * Both pathnames must be relative to the Tid specified in the request. * Open files may be renamed. * - * Multiple files may be renamed in response to a single request as Rename - * File supports wildcards in the file name (last component of the path). - * NOTE: we don't support rename with wildcards. - * * SearchAttributes indicates the attributes that the target file(s) must * have. If SearchAttributes is zero then only normal files are renamed. * If the system file or hidden attributes are specified then the rename * is inclusive - both the specified type(s) of files and normal files are - * renamed. The encoding of SearchAttributes is described in section 3.10 - * - File Attribute Encoding. - * - * Client Request Description - * ================================= ================================== - * UCHAR WordCount; Count of parameter words = 4 - * USHORT SearchAttributes; - * USHORT InformationLevel; 0x0103 Create a hard link - * 0x0104 In-place rename - * 0x0105 Move (rename) a file - * ULONG ClusterCount Servers should ignore this value - * USHORT ByteCount; Count of data bytes; min = 4 - * UCHAR Buffer[]; Buffer containing: - * UCHAR BufferFormat1 0x04 - * UCHAR OldFileName[] OldFileName - * UCHAR BufferFormat1 0x04 - * UCHAR OldFileName[] NewFileName - * - * Server Response Description - * ================================= ================================== - * UCHAR WordCount; Count of parameter words = 0 - * UCHAR ByteCount; Count of data bytes = 0 + * renamed. */ smb_sdrc_t smb_pre_nt_rename(smb_request_t *sr) @@ -373,7 +189,7 @@ smb_com_nt_rename(smb_request_t *sr) break; case SMB_NT_RENAME_RENAME_FILE: case SMB_NT_RENAME_MOVE_FILE: - rc = smb_do_rename(sr, src_fqi, dst_fqi); + rc = smb_common_rename(sr, src_fqi, dst_fqi); break; case SMB_NT_RENAME_MOVE_CLUSTER_INFO: rc = EINVAL; @@ -393,43 +209,423 @@ smb_com_nt_rename(smb_request_t *sr) } /* + * smb_nt_transact_rename + * + * Windows servers return SUCCESS without renaming file. + * The only check required is to check that the handle (fid) is valid. + */ +smb_sdrc_t +smb_nt_transact_rename(smb_request_t *sr, smb_xa_t *xa) +{ + if (smb_mbc_decodef(&xa->req_param_mb, "w", &sr->smb_fid) != 0) + return (SDRC_ERROR); + + smbsr_lookup_file(sr); + if (sr->fid_ofile == NULL) { + smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid); + return (SDRC_ERROR); + } + smbsr_release_file(sr); + + return (SDRC_SUCCESS); +} + +/* + * smb_trans2_rename + * + * Implements SMB_FILE_RENAME_INFORMATION level of Trans2_Set_FileInfo + * and Trans2_Set_PathInfo. + * If the new filename (dst_fqi) already exists it may be overwritten + * if flags == 1. + */ +int +smb_trans2_rename(smb_request_t *sr, smb_node_t *node, char *fname, int flags) +{ + int rc; + smb_fqi_t *src_fqi = &sr->arg.dirop.fqi; + smb_fqi_t *dst_fqi = &sr->arg.dirop.dst_fqi; + + sr->arg.dirop.flags = flags ? SMB_RENAME_FLAG_OVERWRITE : 0; + sr->arg.dirop.info_level = SMB_NT_RENAME_RENAME_FILE; + + src_fqi->fq_sattr = SMB_SEARCH_ATTRIBUTES; + src_fqi->fq_fnode = node; + src_fqi->fq_dnode = node->n_dnode; + + dst_fqi->fq_path.pn_path = fname; + dst_fqi->fq_dnode = node->n_dnode; + (void) strlcpy(dst_fqi->fq_last_comp, fname, MAXNAMELEN); + + rc = smb_common_rename(sr, src_fqi, dst_fqi); + if (rc != 0) { + smb_rename_set_error(sr, rc); + return (-1); + } + + return (0); +} + +/* + * smb_common_rename + * + * Common code for renaming a file. + * + * If the source and destination are identical, we go through all + * the checks but we don't actually do the rename. If the source + * and destination files differ only in case, we do a case-sensitive + * rename. Otherwise, we do a full case-insensitive rename. + * + * Returns errno values. + */ +static int +smb_common_rename(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) +{ + smb_node_t *src_fnode, *src_dnode, *dst_fnode, *dst_dnode; + smb_node_t *tnode; + int rc, count; + DWORD status; + char *new_name, *path; + + path = dst_fqi->fq_path.pn_path; + + /* Check if attempting to rename a stream - not yet supported */ + rc = smb_rename_check_stream(src_fqi, dst_fqi); + if (rc != 0) + return (rc); + + /* The source node may already have been provided */ + if (src_fqi->fq_fnode) { + smb_node_start_crit(src_fqi->fq_fnode, RW_READER); + smb_node_ref(src_fqi->fq_fnode); + smb_node_ref(src_fqi->fq_dnode); + } else { + /* lookup and validate src node */ + rc = smb_rename_lookup_src(sr); + if (rc != 0) + return (rc); + } + + src_fnode = src_fqi->fq_fnode; + src_dnode = src_fqi->fq_dnode; + + /* Find destination dnode and last_comp */ + if (dst_fqi->fq_dnode) { + smb_node_ref(dst_fqi->fq_dnode); + } else { + tnode = sr->tid_tree->t_snode; + rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, + &dst_fqi->fq_dnode, dst_fqi->fq_last_comp); + if (rc != 0) { + smb_rename_release_src(sr); + return (rc); + } + } + + dst_dnode = dst_fqi->fq_dnode; + new_name = dst_fqi->fq_last_comp; + + /* If exact name match in same directory, we're done */ + if ((src_dnode == dst_dnode) && + (strcmp(src_fnode->od_name, new_name) == 0)) { + smb_rename_release_src(sr); + smb_node_release(dst_dnode); + return (0); + } + + /* Lookup destination node */ + rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode, + dst_dnode, new_name, &dst_fqi->fq_fnode); + + /* + * Handle case where changing case of the same directory entry. + * + * If we found the dst node in the same directory as the src node, + * and their names differ only in case: + * + * If the tree is case sensitive (or mixed): + * Do case sensitive lookup to see if exact match exists. + * If the exact match is the same node as src_node we're done. + * + * If the tree is case insensitive: + * There is currently no way to tell if the case is different + * or not, so do the rename (unless the specified new name was + * mangled). + */ + if ((rc == 0) && + (src_dnode == dst_dnode) && + (smb_strcasecmp(src_fnode->od_name, + dst_fqi->fq_fnode->od_name, 0) == 0)) { + smb_node_release(dst_fqi->fq_fnode); + dst_fqi->fq_fnode = NULL; + + if (smb_tree_has_feature(sr->tid_tree, + SMB_TREE_NO_CASESENSITIVE)) { + if (smb_strcasecmp(src_fnode->od_name, + dst_fqi->fq_last_comp, 0) != 0) { + smb_rename_release_src(sr); + smb_node_release(dst_dnode); + return (0); + } + } else { + rc = smb_fsop_lookup(sr, sr->user_cr, + SMB_CASE_SENSITIVE, tnode, dst_dnode, new_name, + &dst_fqi->fq_fnode); + + if ((rc == 0) && + (dst_fqi->fq_fnode == src_fnode)) { + smb_rename_release_src(sr); + smb_node_release(dst_fqi->fq_fnode); + smb_node_release(dst_dnode); + return (0); + } + } + } + + if ((rc != 0) && (rc != ENOENT)) { + smb_rename_release_src(sr); + smb_node_release(dst_fqi->fq_dnode); + return (rc); + } + + if (dst_fqi->fq_fnode) { + dst_fnode = dst_fqi->fq_fnode; + + if (!(sr->arg.dirop.flags && SMB_RENAME_FLAG_OVERWRITE)) { + smb_rename_release_src(sr); + smb_node_release(dst_fnode); + smb_node_release(dst_dnode); + return (EEXIST); + } + + (void) smb_oplock_break(dst_fnode, sr->session, B_FALSE); + + for (count = 0; count <= 3; count++) { + if (count) { + smb_node_end_crit(dst_fnode); + delay(MSEC_TO_TICK(400)); + } + + smb_node_start_crit(dst_fnode, RW_READER); + status = smb_node_delete_check(dst_fnode); + + if (status != NT_STATUS_SHARING_VIOLATION) + break; + } + + if (status != NT_STATUS_SHARING_VIOLATION) + status = smb_range_check(sr, dst_fnode, + 0, UINT64_MAX, B_TRUE); + + if (status != NT_STATUS_SUCCESS) { + smb_rename_release_src(sr); + smb_node_end_crit(dst_fnode); + smb_node_release(dst_fnode); + smb_node_release(dst_dnode); + return (EACCES); + } + + if (smb_maybe_mangled_name(new_name)) { + (void) strlcpy(new_name, dst_fnode->od_name, + MAXNAMELEN); + } + } + + rc = smb_fsop_rename(sr, sr->user_cr, + src_dnode, src_fnode->od_name, + dst_dnode, new_name); + + smb_rename_release_src(sr); + + if (rc == 0) + smb_node_notify_change(dst_dnode); + + if (dst_fqi->fq_fnode) { + smb_node_end_crit(dst_fnode); + smb_node_release(dst_fnode); + } + smb_node_release(dst_dnode); + + return (rc); +} + +/* + * smb_rename_check_stream + * + * For a stream rename the dst path must begin with ':', or "\\:". + * We don't yet support stream rename, Return EACCES. + * + * If not a stream rename, in accordance with the above rule, + * it is not valid for either the src or dst to be a stream. + * Return EINVAL. + */ +static int +smb_rename_check_stream(smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) +{ + smb_node_t *src_fnode = src_fqi->fq_fnode; + char *src_path = src_fqi->fq_path.pn_path; + char *dst_path = dst_fqi->fq_path.pn_path; + + /* We do not yet support named stream rename - ACCESS DENIED */ + if ((dst_path[0] == ':') || + ((dst_path[0] == '\\') && (dst_path[1] == ':'))) { + return (EACCES); + } + + /* + * If not stream rename (above) neither src or dst can be + * a named stream. + */ + + if (smb_is_stream_name(dst_path)) + return (EINVAL); + + if (src_fqi->fq_fnode) { + if (SMB_IS_STREAM(src_fnode)) + return (EINVAL); + } else { + if (smb_is_stream_name(src_path)) + return (EINVAL); + } + + return (0); +} + + +/* * smb_make_link * - * Common code for creating a hard link (adding an additional name - * for a file. + * Creating a hard link (adding an additional name) for a file. * * If the source and destination are identical, we go through all * the checks but we don't create a link. * + * If the file is a symlink we create the hardlink on the target + * of the symlink (i.e. use SMB_FOLLOW_LINKS when looking up src). + * If the target of the symlink does not exist we fail with ENOENT. + * * Returns errno values. */ static int smb_make_link(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) { - smb_node_t *src_fnode, *tnode; + smb_node_t *tnode; + char *path; + int rc; + + /* Cannnot create link on named stream */ + if (smb_is_stream_name(src_fqi->fq_path.pn_path) || + smb_is_stream_name(dst_fqi->fq_path.pn_path)) { + return (EINVAL); + } + + /* lookup and validate src node */ + rc = smb_rename_lookup_src(sr); + if (rc != 0) + return (rc); + + /* if src and dest paths match we're done */ + if (smb_strcasecmp(src_fqi->fq_path.pn_path, + dst_fqi->fq_path.pn_path, 0) == 0) { + smb_rename_release_src(sr); + return (0); + } + + /* find the destination dnode and last_comp */ + tnode = sr->tid_tree->t_snode; + path = dst_fqi->fq_path.pn_path; + rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, + &dst_fqi->fq_dnode, dst_fqi->fq_last_comp); + if (rc != 0) { + smb_rename_release_src(sr); + return (rc); + } + + /* If name match in same directory, we're done */ + if ((src_fqi->fq_dnode == dst_fqi->fq_dnode) && + (smb_strcasecmp(src_fqi->fq_fnode->od_name, + dst_fqi->fq_last_comp, 0) == 0)) { + smb_rename_release_src(sr); + smb_node_release(dst_fqi->fq_dnode); + return (0); + } + + /* Lookup the destination node. It MUST NOT exist. */ + rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode, + dst_fqi->fq_dnode, dst_fqi->fq_last_comp, &dst_fqi->fq_fnode); + if (rc == 0) { + smb_node_release(dst_fqi->fq_fnode); + rc = EEXIST; + } + if (rc != ENOENT) { + smb_rename_release_src(sr); + smb_node_release(dst_fqi->fq_dnode); + return (rc); + } + + rc = smb_fsop_link(sr, sr->user_cr, src_fqi->fq_fnode, + dst_fqi->fq_dnode, dst_fqi->fq_last_comp); + + smb_rename_release_src(sr); + if (rc == 0) + smb_node_notify_change(dst_fqi->fq_dnode); + smb_node_release(dst_fqi->fq_dnode); + return (rc); +} + +/* + * smb_rename_lookup_src + * + * Lookup the src node, checking for sharing violations and + * breaking any existing oplock. + * Populate sr->arg.dirop.fqi + * + * Upon success, the dnode and fnode will have holds and the + * fnode will be in a critical section. These should be + * released using smb_rename_release_src(). + * + * Returns errno values. + */ +static int +smb_rename_lookup_src(smb_request_t *sr) +{ + smb_node_t *src_node, *tnode; DWORD status; int rc; int count; char *path; - tnode = sr->tid_tree->t_snode; + struct dirop *dirop = &sr->arg.dirop; + smb_fqi_t *src_fqi = &sr->arg.dirop.fqi; + + if (smb_is_stream_name(src_fqi->fq_path.pn_path)) + return (EINVAL); - /* Lookup the source node. It MUST exist. */ + /* Lookup the source node */ + tnode = sr->tid_tree->t_snode; path = src_fqi->fq_path.pn_path; rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, &src_fqi->fq_dnode, src_fqi->fq_last_comp); if (rc != 0) return (rc); - rc = smb_fsop_lookup(sr, sr->user_cr, SMB_FOLLOW_LINKS, tnode, + rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode, src_fqi->fq_dnode, src_fqi->fq_last_comp, &src_fqi->fq_fnode); if (rc != 0) { smb_node_release(src_fqi->fq_dnode); return (rc); } - src_fnode = src_fqi->fq_fnode; - rc = smb_rename_check_attr(sr, src_fnode, src_fqi->fq_sattr); + /* Not valid to create hardlink for directory */ + if ((dirop->info_level == SMB_NT_RENAME_SET_LINK_INFO) && + (smb_node_is_dir(src_fqi->fq_fnode))) { + smb_node_release(src_fqi->fq_fnode); + smb_node_release(src_fqi->fq_dnode); + return (EISDIR); + } + + src_node = src_fqi->fq_fnode; + + rc = smb_rename_check_attr(sr, src_node, src_fqi->fq_sattr); if (rc != 0) { smb_node_release(src_fqi->fq_fnode); smb_node_release(src_fqi->fq_dnode); @@ -441,81 +637,53 @@ smb_make_link(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) * has a file open, this will force a flush or close, * which may affect the outcome of any share checking. */ - (void) smb_oplock_break(src_fnode, sr->session, B_FALSE); + (void) smb_oplock_break(src_node, sr->session, B_FALSE); for (count = 0; count <= 3; count++) { if (count) { - smb_node_end_crit(src_fnode); + smb_node_end_crit(src_node); delay(MSEC_TO_TICK(400)); } - smb_node_start_crit(src_fnode, RW_READER); - status = smb_node_rename_check(src_fnode); + smb_node_start_crit(src_node, RW_READER); + status = smb_node_rename_check(src_node); if (status != NT_STATUS_SHARING_VIOLATION) break; } if (status == NT_STATUS_SHARING_VIOLATION) { - smb_node_end_crit(src_fnode); + smb_node_end_crit(src_node); smb_node_release(src_fqi->fq_fnode); smb_node_release(src_fqi->fq_dnode); return (EPIPE); /* = ERRbadshare */ } - status = smb_range_check(sr, src_fnode, 0, UINT64_MAX, B_TRUE); + status = smb_range_check(sr, src_node, 0, UINT64_MAX, B_TRUE); if (status != NT_STATUS_SUCCESS) { - smb_node_end_crit(src_fnode); + smb_node_end_crit(src_node); smb_node_release(src_fqi->fq_fnode); smb_node_release(src_fqi->fq_dnode); return (EACCES); } - if (utf8_strcasecmp(src_fqi->fq_path.pn_path, - dst_fqi->fq_path.pn_path) == 0) { - smb_node_end_crit(src_fnode); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (0); - } - - /* Lookup the destination node. It MUST NOT exist. */ - path = dst_fqi->fq_path.pn_path; - rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode, - &dst_fqi->fq_dnode, dst_fqi->fq_last_comp); - if (rc != 0) { - smb_node_end_crit(src_fnode); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - return (rc); - } - - rc = smb_fsop_lookup(sr, sr->user_cr, SMB_FOLLOW_LINKS, tnode, - dst_fqi->fq_dnode, dst_fqi->fq_last_comp, &dst_fqi->fq_fnode); - if (rc == 0) { - smb_node_release(dst_fqi->fq_fnode); - rc = EEXIST; - } - if (rc != ENOENT) { - smb_node_end_crit(src_fnode); - smb_node_release(src_fqi->fq_fnode); - smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (rc); - } + return (0); +} - rc = smb_fsop_link(sr, sr->user_cr, dst_fqi->fq_dnode, src_fnode, - dst_fqi->fq_last_comp); +/* + * smb_rename_release_src + */ +static void +smb_rename_release_src(smb_request_t *sr) +{ + smb_fqi_t *src_fqi = &sr->arg.dirop.fqi; - smb_node_end_crit(src_fnode); - if (rc == 0) - smb_node_notify_change(dst_fqi->fq_dnode); + smb_node_end_crit(src_fqi->fq_fnode); smb_node_release(src_fqi->fq_fnode); smb_node_release(src_fqi->fq_dnode); - smb_node_release(dst_fqi->fq_dnode); - return (rc); } + static int smb_rename_check_attr(smb_request_t *sr, smb_node_t *node, uint16_t sattr) { @@ -558,6 +726,7 @@ smb_rename_set_error(smb_request_t *sr, int errnum) { ESRCH, ERROR_FILE_NOT_FOUND, NT_STATUS_NO_SUCH_FILE }, { EINVAL, ERROR_INVALID_PARAMETER, NT_STATUS_INVALID_PARAMETER }, { EACCES, ERROR_ACCESS_DENIED, NT_STATUS_ACCESS_DENIED }, + { EISDIR, ERROR_ACCESS_DENIED, NT_STATUS_FILE_IS_A_DIRECTORY }, { EIO, ERROR_INTERNAL_ERROR, NT_STATUS_INTERNAL_ERROR } }; diff --git a/usr/src/uts/common/fs/smbsrv/smb_sd.c b/usr/src/uts/common/fs/smbsrv/smb_sd.c index 6a9bc70418..b8d7fd3b7a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_sd.c +++ b/usr/src/uts/common/fs/smbsrv/smb_sd.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,7 +30,6 @@ #include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_idmap.h> -#include <smbsrv/ntstatus.h> static void smb_sd_set_sacl(smb_sd_t *, smb_acl_t *, boolean_t, int); static void smb_sd_set_dacl(smb_sd_t *, smb_acl_t *, boolean_t, int); diff --git a/usr/src/uts/common/fs/smbsrv/smb_seek.c b/usr/src/uts/common/fs/smbsrv/smb_seek.c index d60a44d9e1..4e734063d9 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_seek.c +++ b/usr/src/uts/common/fs/smbsrv/smb_seek.c @@ -41,7 +41,7 @@ * file offset is beyond the 32-bit limit. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c index 98c7c17bbd..8da1310dc8 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_server.c +++ b/usr/src/uts/common/fs/smbsrv/smb_server.c @@ -215,10 +215,15 @@ #include <sys/priv.h> #include <sys/socketvar.h> #include <sys/zone.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> +#include <netinet/ip.h> +#include <netinet/ip_icmp.h> +#include <netinet/ip_var.h> +#include <netinet/tcp.h> #include <smbsrv/smb_kproto.h> +#include <smbsrv/string.h> #include <smbsrv/netbios.h> -#include <smbsrv/smb_incl.h> -#include <smbsrv/cifs.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_share.h> #include <smbsrv/smb_door_svc.h> @@ -559,6 +564,7 @@ smb_server_start(smb_ioc_start_t *ioc) mutex_enter(&sv->sv_mutex); switch (sv->sv_state) { case SMB_SERVER_STATE_CONFIGURED: + smb_codepage_init(); sv->sv_thread_pool = taskq_create("smb_workers", sv->sv_cfg.skc_maxworkers, SMB_WORKER_PRIORITY, @@ -589,8 +595,6 @@ smb_server_start(smb_ioc_start_t *ioc) break; } - (void) oem_language_set("english"); - sv->sv_state = SMB_SERVER_STATE_RUNNING; mutex_exit(&sv->sv_mutex); smb_server_release(sv); diff --git a/usr/src/uts/common/fs/smbsrv/smb_session.c b/usr/src/uts/common/fs/smbsrv/smb_session.c index 68a597eeed..14971d067e 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_session.c +++ b/usr/src/uts/common/fs/smbsrv/smb_session.c @@ -30,8 +30,8 @@ #include <sys/socketvar.h> #include <sys/sdt.h> #include <smbsrv/netbios.h> -#include <smbsrv/smb_incl.h> -#include <smbsrv/smb_i18n.h> +#include <smbsrv/smb_kproto.h> +#include <smbsrv/string.h> #include <inet/tcp.h> static volatile uint64_t smb_kids; @@ -219,10 +219,9 @@ smb_session_request(struct smb_session *session) char client_name[NETBIOS_NAME_SZ]; struct mbuf_chain mbc; char *names = NULL; - mts_wchar_t *wbuf = NULL; + smb_wchar_t *wbuf = NULL; smb_xprt_t hdr; char *p; - unsigned int cpid = oem_get_smb_cpid(); int rc1, rc2; session->keep_alive = smb_keep_alive; @@ -283,10 +282,10 @@ smb_session_request(struct smb_session *session) * multi-byte format. We also need to strip off any * spaces added as part of the NetBIOS name encoding. */ - wbuf = kmem_alloc((SMB_PI_MAX_HOST * sizeof (mts_wchar_t)), KM_SLEEP); - (void) oemstounicodes(wbuf, client_name, SMB_PI_MAX_HOST, cpid); - (void) mts_wcstombs(session->workstation, wbuf, SMB_PI_MAX_HOST); - kmem_free(wbuf, (SMB_PI_MAX_HOST * sizeof (mts_wchar_t))); + wbuf = kmem_alloc((SMB_PI_MAX_HOST * sizeof (smb_wchar_t)), KM_SLEEP); + (void) oemtoucs(wbuf, client_name, SMB_PI_MAX_HOST, OEM_CPG_850); + (void) smb_wcstombs(session->workstation, wbuf, SMB_PI_MAX_HOST); + kmem_free(wbuf, (SMB_PI_MAX_HOST * sizeof (smb_wchar_t))); if ((p = strchr(session->workstation, ' ')) != 0) *p = '\0'; @@ -1039,8 +1038,8 @@ smb_session_lookup_user(smb_session_t *session, char *domain, char *name) user = smb_llist_head(ulist); while (user) { ASSERT(user->u_magic == SMB_USER_MAGIC); - if (!utf8_strcasecmp(user->u_name, name) && - !utf8_strcasecmp(user->u_domain, domain)) { + if (!smb_strcasecmp(user->u_name, name, 0) && + !smb_strcasecmp(user->u_domain, domain, 0)) { if (smb_user_hold(user)) break; } @@ -1123,14 +1122,14 @@ smb_session_isclient(smb_session_t *sn, const char *client) client += strspn(client, "\\"); - if (utf8_strcasecmp(client, sn->workstation) == 0) + if (smb_strcasecmp(client, sn->workstation, 0) == 0) return (B_TRUE); ipaddr = &sn->ipaddr; if (smb_inet_ntop(ipaddr, buf, SMB_IPSTRLEN(ipaddr->a_family)) == NULL) return (B_FALSE); - if (utf8_strcasecmp(client, buf) == 0) + if (smb_strcasecmp(client, buf, 0) == 0) return (B_TRUE); return (B_FALSE); @@ -1161,13 +1160,12 @@ smb_request_alloc(smb_session_t *session, int req_length) bzero(sr, sizeof (smb_request_t)); mutex_init(&sr->sr_mutex, NULL, MUTEX_DEFAULT, NULL); + smb_srm_init(sr); sr->session = session; sr->sr_server = session->s_server; sr->sr_gmtoff = session->s_server->si_gmtoff; sr->sr_cache = session->s_server->si_cache_request; sr->sr_cfg = &session->s_cfg; - sr->request_storage.forw = &sr->request_storage; - sr->request_storage.back = &sr->request_storage; sr->command.max_bytes = req_length; sr->reply.max_bytes = smb_maxbufsize; sr->sr_req_length = req_length; @@ -1204,8 +1202,7 @@ smb_request_free(smb_request_t *sr) sr->session = NULL; - /* Release any temp storage */ - smbsr_free_malloc_list(&sr->request_storage); + smb_srm_fini(sr); if (sr->sr_request_buf) kmem_free(sr->sr_request_buf, sr->sr_req_length); diff --git a/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c b/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c index 761706078f..7f2d86a1f9 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c +++ b/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c @@ -222,7 +222,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_token.h> #include <smbsrv/smb_door_svc.h> @@ -477,8 +477,7 @@ smb_authenticate(smb_request_t *sr, smb_sessionsetup_info_t *sinfo, boolean_t need_lookup = B_FALSE; uint32_t privileges; cred_t *cr; - char *buf; - size_t buflen = 0; + char *buf = NULL; char *p; bzero(&clnt_info, sizeof (netr_client_t)); @@ -500,8 +499,7 @@ smb_authenticate(smb_request_t *sr, smb_sessionsetup_info_t *sinfo, * for some forms of authentication. */ if (*sinfo->ssi_domain == '\0') { - buflen = strlen(sinfo->ssi_user) + 1; - buf = smb_kstrdup(sinfo->ssi_user, buflen); + buf = smb_strdup(sinfo->ssi_user); if ((p = strchr(buf, '@')) != NULL) { *p = '\0'; clnt_info.e_username = buf; @@ -531,8 +529,7 @@ smb_authenticate(smb_request_t *sr, smb_sessionsetup_info_t *sinfo, sr->smb_uid = user->u_uid; sr->uid_user = user; - if (buflen != 0) - kmem_free(buf, buflen); + smb_mfree(buf); return ((user->u_flags & SMB_USER_FLAG_GUEST) ? SMB_AUTH_GUEST : SMB_AUTH_USER); @@ -561,8 +558,7 @@ smb_authenticate(smb_request_t *sr, smb_sessionsetup_info_t *sinfo, usr_token = smb_get_token(&clnt_info); - if (buflen != 0) - kmem_free(buf, buflen); + smb_mfree(buf); if (usr_token == NULL) { smbsr_error(sr, 0, ERRSRV, ERRbadpw); diff --git a/usr/src/uts/common/fs/smbsrv/smb_set_fileinfo.c b/usr/src/uts/common/fs/smbsrv/smb_set_fileinfo.c index 2f9111516d..2c98d81c5e 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_set_fileinfo.c +++ b/usr/src/uts/common/fs/smbsrv/smb_set_fileinfo.c @@ -33,8 +33,10 @@ * SMB_SET_FILE_END_OF_FILE_INFO * SMB_SET_FILE_ALLOCATION_INFO * - * Supported Passthrough levels: + * Handled Passthrough levels: * SMB_FILE_BASIC_INFORMATION + * SMB_FILE_RENAME_INFORMATION + * SMB_FILE_LINK_INFORMATION * SMB_FILE_DISPOSITION_INFORMATION * SMB_FILE_END_OF_FILE_INFORMATION * SMB_FILE_ALLOCATION_INFORMATION @@ -61,7 +63,7 @@ * attributes. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> typedef struct smb_setinfo { @@ -84,6 +86,7 @@ static int smb_set_basic_info(smb_request_t *, smb_setinfo_t *); static int smb_set_disposition_info(smb_request_t *, smb_setinfo_t *); static int smb_set_eof_info(smb_request_t *sr, smb_setinfo_t *); static int smb_set_alloc_info(smb_request_t *sr, smb_setinfo_t *); +static int smb_set_rename_info(smb_request_t *sr, smb_setinfo_t *); /* * smb_com_trans2_set_file_information @@ -285,7 +288,12 @@ smb_set_by_path(smb_request_t *sr, smb_xa_t *xa, kmem_free(name, MAXNAMELEN); if (rc != 0) { - smbsr_errno(sr, rc); + if (rc == ENOENT) { + smbsr_error(sr, NT_STATUS_OBJECT_NAME_NOT_FOUND, + ERRDOS, ERROR_FILE_NOT_FOUND); + } else { + smbsr_errno(sr, rc); + } return (-1); } @@ -305,6 +313,9 @@ smb_set_by_path(smb_request_t *sr, smb_xa_t *xa, /* * smb_set_fileinfo + * + * For compatibility with windows servers, SMB_FILE_LINK_INFORMATION + * is handled by returning NT_STATUS_NOT_SUPPORTED. */ static int smb_set_fileinfo(smb_request_t *sr, smb_setinfo_t *sinfo) @@ -339,6 +350,13 @@ smb_set_fileinfo(smb_request_t *sr, smb_setinfo_t *sinfo) case SMB_FILE_ALLOCATION_INFORMATION: return (smb_set_alloc_info(sr, sinfo)); + case SMB_FILE_RENAME_INFORMATION: + return (smb_set_rename_info(sr, sinfo)); + + case SMB_FILE_LINK_INFORMATION: + smbsr_error(sr, NT_STATUS_NOT_SUPPORTED, + ERRDOS, ERROR_NOT_SUPPORTED); + return (-1); default: break; } @@ -681,3 +699,44 @@ smb_set_disposition_info(smb_request_t *sr, smb_setinfo_t *sinfo) } return (0); } + +/* + * smb_set_rename_info + * + * Explicity specified parameter validation rules: + * - If rootdir is not NULL respond with NT_STATUS_INVALID_PARAMETER. + * - If the filename contains a separator character respond with + * NT_STATUS_INVALID_PARAMETER. + */ +static int +smb_set_rename_info(smb_request_t *sr, smb_setinfo_t *sinfo) +{ + int rc; + uint32_t flags, rootdir, namelen; + char *fname; + + rc = smb_mbc_decodef(&sinfo->si_xa->req_data_mb, "lll", + &flags, &rootdir, &namelen); + if (rc == 0) { + rc = smb_mbc_decodef(&sinfo->si_xa->req_data_mb, "%#U", + sr, namelen, &fname); + } + if (rc != 0) + return (-1); + + if ((rootdir != 0) || (namelen == 0) || (namelen >= MAXNAMELEN)) { + smbsr_error(sr, NT_STATUS_INVALID_PARAMETER, + ERRDOS, ERROR_INVALID_PARAMETER); + return (-1); + } + + if (strchr(fname, '\\') != NULL) { + smbsr_error(sr, NT_STATUS_NOT_SUPPORTED, + ERRDOS, ERROR_NOT_SUPPORTED); + return (-1); + } + + rc = smb_trans2_rename(sr, sinfo->si_node, fname, flags); + + return ((rc == 0) ? 0 : -1); +} diff --git a/usr/src/uts/common/fs/smbsrv/smb_signing.c b/usr/src/uts/common/fs/smbsrv/smb_signing.c index d587c21850..55c7e45b0b 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_signing.c +++ b/usr/src/uts/common/fs/smbsrv/smb_signing.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "@(#)smb_signing.c 1.4 08/07/08 SMI" - /* * These routines provide the SMB MAC signing for the SMB server. * The routines calculate the signature of a SMB message in an mbuf chain. @@ -42,10 +40,9 @@ */ #include <sys/uio.h> -#include <smbsrv/mbuf.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/msgbuf.h> #include <sys/crypto/api.h> -#include <smbsrv/smb_incl.h> #define SMBAUTH_SESSION_KEY_SZ 16 #define SMB_SIG_SIZE 8 diff --git a/usr/src/uts/common/fs/smbsrv/smb_trans2_create_directory.c b/usr/src/uts/common/fs/smbsrv/smb_trans2_create_directory.c index e6a6ed1360..8f22111344 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_trans2_create_directory.c +++ b/usr/src/uts/common/fs/smbsrv/smb_trans2_create_directory.c @@ -51,9 +51,7 @@ * occurred while setting EAs */ -#include <smbsrv/nterror.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_trans2_dfs.c b/usr/src/uts/common/fs/smbsrv/smb_trans2_dfs.c index 67073b5871..166fc20179 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_trans2_dfs.c +++ b/usr/src/uts/common/fs/smbsrv/smb_trans2_dfs.c @@ -19,13 +19,11 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c b/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c index f3aef8da99..11158d9d5c 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c +++ b/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c @@ -202,7 +202,7 @@ * STRING FileName; Files full length name */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/msgbuf.h> #include <smbsrv/smb_fsops.h> @@ -686,7 +686,7 @@ smb_trans2_find_mbc_encode(smb_request_t *sr, smb_xa_t *xa, * Regardless of whether unicode or ascii, a single * termination byte is used. */ - buflen = namelen + sizeof (mts_wchar_t); + buflen = namelen + sizeof (smb_wchar_t); tmpbuf = kmem_zalloc(buflen, KM_SLEEP); smb_msgbuf_init(&mb, (uint8_t *)tmpbuf, buflen, mb_flags); if (smb_msgbuf_encode(&mb, "u", fileinfo->fi_name) < 0) { @@ -768,7 +768,7 @@ smb_trans2_find_mbc_encode(smb_request_t *sr, smb_xa_t *xa, smb_msgbuf_term(&mb); return (-1); } - shortlen = mts_wcequiv_strlen(fileinfo->fi_shortname); + shortlen = smb_wcequiv_strlen(fileinfo->fi_shortname); (void) smb_mbc_encodef(&xa->rep_data_mb, "%llTTTTqqlllb.24cu", sr, diff --git a/usr/src/uts/common/fs/smbsrv/smb_trans2_query_fs_information.c b/usr/src/uts/common/fs/smbsrv/smb_trans2_query_fs_information.c index 1d87b3dc6b..4d95fb3154 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_trans2_query_fs_information.c +++ b/usr/src/uts/common/fs/smbsrv/smb_trans2_query_fs_information.c @@ -230,7 +230,7 @@ * ERRSRV/ERRinvdevice - resource identified by TID is not a file system */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smbinfo.h> @@ -315,7 +315,7 @@ smb_com_trans2_query_fs_information(struct smb_request *sr, struct smb_xa *xa) case SMB_QUERY_FS_VOLUME_INFO: if ((sr->smb_flg2 & SMB_FLAGS2_UNICODE) || (sr->session->native_os == NATIVE_OS_WIN95)) { - length = mts_wcequiv_strlen(tree->t_volume); + length = smb_wcequiv_strlen(tree->t_volume); encode_str = "%qllb.U"; } else { length = strlen(tree->t_volume); @@ -364,7 +364,7 @@ smb_com_trans2_query_fs_information(struct smb_request *sr, struct smb_xa *xa) (sr->session->native_os == NATIVE_OS_WIN2000) || (sr->session->native_os == NATIVE_OS_WIN95) || (sr->session->native_os == NATIVE_OS_MACOS)) { - length = mts_wcequiv_strlen(fsname); + length = smb_wcequiv_strlen(fsname); encode_str = "%lllU"; sr->smb_flg2 |= SMB_FLAGS2_UNICODE; } else { diff --git a/usr/src/uts/common/fs/smbsrv/smb_tree.c b/usr/src/uts/common/fs/smbsrv/smb_tree.c index ebe14f4cae..48e412345e 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_tree.c +++ b/usr/src/uts/common/fs/smbsrv/smb_tree.c @@ -170,7 +170,7 @@ #include <sys/stat.h> #include <sys/varargs.h> #include <sys/cred_impl.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/lmerr.h> #include <smbsrv/smb_fsops.h> #include <smbsrv/smb_door_svc.h> @@ -215,7 +215,7 @@ smb_tree_connect(smb_request_t *sr) const char *name; int32_t stype; - (void) utf8_strlwr(unc_path); + (void) smb_strlwr(unc_path); if ((name = smb_tree_get_sharename(unc_path)) == NULL) { smbsr_error(sr, 0, ERRSRV, ERRinvnetname); @@ -1048,7 +1048,7 @@ smb_tree_get_flags(const smb_share_t *si, vfs_t *vfsp, smb_tree_t *tree) } (void) strlcpy(tree->t_typename, name, SMB_TYPENAMELEN); - (void) utf8_strupr((char *)tree->t_typename); + (void) smb_strupr((char *)tree->t_typename); if (vfs_has_feature(vfsp, VFSFT_XVATTR)) flags |= SMB_TREE_XVATTR; @@ -1339,7 +1339,7 @@ smb_tree_netinfo_init(smb_tree_t *tree, smb_netconnectinfo_t *info) info->ci_time = gethrestime_sec() - tree->t_connect_time; info->ci_sharelen = strlen(tree->t_sharename) + 1; - info->ci_share = smb_kstrdup(tree->t_sharename, info->ci_sharelen); + info->ci_share = smb_strdup(tree->t_sharename); user = tree->t_user; ASSERT(user); @@ -1359,7 +1359,7 @@ smb_tree_netinfo_fini(smb_netconnectinfo_t *info) if (info->ci_username) kmem_free(info->ci_username, info->ci_namelen); if (info->ci_share) - kmem_free(info->ci_share, info->ci_sharelen); + smb_mfree(info->ci_share); bzero(info, sizeof (smb_netconnectinfo_t)); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_tree_connect.c b/usr/src/uts/common/fs/smbsrv/smb_tree_connect.c index 5f3f4279b2..07ba7a7776 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_tree_connect.c +++ b/usr/src/uts/common/fs/smbsrv/smb_tree_connect.c @@ -23,7 +23,7 @@ * Use is subject to license terms. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> /* @@ -251,8 +251,7 @@ smb_pre_tree_connect_andx(smb_request_t *sr) &sr->arg.tcon.flags, &pwlen); if (rc == 0) { if (pwlen != 0) { - pwbuf = (uint8_t *)smbsr_malloc(&sr->request_storage, - pwlen); + pwbuf = smb_srm_alloc(sr, pwlen); bzero(pwbuf, pwlen); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_unlock_byte_range.c b/usr/src/uts/common/fs/smbsrv/smb_unlock_byte_range.c index aab82acfff..5fc5654f4a 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_unlock_byte_range.c +++ b/usr/src/uts/common/fs/smbsrv/smb_unlock_byte_range.c @@ -51,7 +51,7 @@ * USHORT ByteCount; Count of data bytes = 0 */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> smb_sdrc_t smb_pre_unlock_byte_range(smb_request_t *sr) diff --git a/usr/src/uts/common/fs/smbsrv/smb_user.c b/usr/src/uts/common/fs/smbsrv/smb_user.c index 0b92d8993e..3cd07490b9 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_user.c +++ b/usr/src/uts/common/fs/smbsrv/smb_user.c @@ -163,7 +163,7 @@ * being queued in that list is NOT registered by incrementing the * reference count. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_door_svc.h> @@ -230,8 +230,8 @@ smb_user_login( user->u_privileges = privileges; user->u_name_len = strlen(account_name) + 1; user->u_domain_len = strlen(domain_name) + 1; - user->u_name = smb_kstrdup(account_name, user->u_name_len); - user->u_domain = smb_kstrdup(domain_name, user->u_domain_len); + user->u_name = smb_strdup(account_name); + user->u_domain = smb_strdup(domain_name); user->u_cred = cr; user->u_privcred = smb_cred_create_privs(cr, privileges); user->u_audit_sid = audit_sid; @@ -254,8 +254,8 @@ smb_user_login( } smb_idpool_free(&session->s_uid_pool, user->u_uid); } - kmem_free(user->u_name, (size_t)user->u_name_len); - kmem_free(user->u_domain, (size_t)user->u_domain_len); + smb_mfree(user->u_name); + smb_mfree(user->u_domain); kmem_cache_free(session->s_server->si_cache_user, user); return (NULL); } @@ -582,7 +582,7 @@ smb_user_lookup_share( while (tree) { ASSERT(tree->t_magic == SMB_TREE_MAGIC); ASSERT(tree->t_user == user); - if (utf8_strcasecmp(tree->t_sharename, sharename) == 0) { + if (smb_strcasecmp(tree->t_sharename, sharename, 0) == 0) { if (smb_tree_hold(tree)) { smb_llist_exit(&user->u_tree_list); return (tree); @@ -625,7 +625,7 @@ smb_user_lookup_volume( ASSERT(tree->t_magic == SMB_TREE_MAGIC); ASSERT(tree->t_user == user); - if (utf8_strcasecmp(tree->t_volume, name) == 0) { + if (smb_strcasecmp(tree->t_volume, name, 0) == 0) { if (smb_tree_hold(tree)) { smb_llist_exit(&user->u_tree_list); return (tree); @@ -776,7 +776,7 @@ smb_user_namecmp(smb_user_t *user, const char *name) char *fq_name; boolean_t match; - if (utf8_strcasecmp(name, user->u_name) == 0) + if (smb_strcasecmp(name, user->u_name, 0) == 0) return (B_TRUE); fq_name = kmem_alloc(MAXNAMELEN, KM_SLEEP); @@ -784,12 +784,12 @@ smb_user_namecmp(smb_user_t *user, const char *name) (void) snprintf(fq_name, MAXNAMELEN, "%s\\%s", user->u_domain, user->u_name); - match = (utf8_strcasecmp(name, fq_name) == 0); + match = (smb_strcasecmp(name, fq_name, 0) == 0); if (!match) { (void) snprintf(fq_name, MAXNAMELEN, "%s@%s", user->u_name, user->u_domain); - match = (utf8_strcasecmp(name, fq_name) == 0); + match = (smb_strcasecmp(name, fq_name, 0) == 0); } kmem_free(fq_name, MAXNAMELEN); @@ -891,8 +891,8 @@ smb_user_delete( crfree(user->u_cred); if (user->u_privcred) crfree(user->u_privcred); - kmem_free(user->u_name, (size_t)user->u_name_len); - kmem_free(user->u_domain, (size_t)user->u_domain_len); + smb_mfree(user->u_name); + smb_mfree(user->u_domain); kmem_cache_free(user->u_server->si_cache_user, user); } @@ -1018,15 +1018,15 @@ smb_user_netinfo_init(smb_user_t *user, smb_netuserinfo_t *info) info->ui_flags = user->u_flags; info->ui_domain_len = user->u_domain_len; - info->ui_domain = smb_kstrdup(user->u_domain, info->ui_domain_len); + info->ui_domain = smb_strdup(user->u_domain); info->ui_account_len = user->u_name_len; - info->ui_account = smb_kstrdup(user->u_name, info->ui_account_len); + info->ui_account = smb_strdup(user->u_name); buf = kmem_alloc(MAXNAMELEN, KM_SLEEP); smb_session_getclient(session, buf, MAXNAMELEN); info->ui_workstation_len = strlen(buf) + 1; - info->ui_workstation = smb_kstrdup(buf, info->ui_workstation_len); + info->ui_workstation = smb_strdup(buf); kmem_free(buf, MAXNAMELEN); } @@ -1037,11 +1037,11 @@ smb_user_netinfo_fini(smb_netuserinfo_t *info) return; if (info->ui_domain) - kmem_free(info->ui_domain, info->ui_domain_len); + smb_mfree(info->ui_domain); if (info->ui_account) - kmem_free(info->ui_account, info->ui_account_len); + smb_mfree(info->ui_account); if (info->ui_workstation) - kmem_free(info->ui_workstation, info->ui_workstation_len); + smb_mfree(info->ui_workstation); bzero(info, sizeof (smb_netuserinfo_t)); } diff --git a/usr/src/uts/common/fs/smbsrv/smb_util.c b/usr/src/uts/common/fs/smbsrv/smb_util.c index 870c68ae51..cfc1264fb4 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_util.c +++ b/usr/src/uts/common/fs/smbsrv/smb_util.c @@ -29,10 +29,9 @@ #include <sys/atomic.h> #include <sys/kidmap.h> #include <sys/time.h> -#include <smbsrv/smb_incl.h> +#include <sys/cpuvar.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> -#include <smbsrv/string.h> -#include <smbsrv/mbuf.h> #include <smbsrv/smbinfo.h> #include <smbsrv/smb_xdr.h> #include <smbsrv/smb_vops.h> @@ -41,9 +40,6 @@ #include <sys/sid.h> #include <sys/priv_names.h> -#define SMB_NAME83_BASELEN 8 -#define SMB_NAME83_EXTLEN 3 - static void smb_replace_wildcards(char *); static boolean_t @@ -77,7 +73,7 @@ int smb_ascii_or_unicode_strlen(struct smb_request *sr, char *str) { if (sr->smb_flg2 & SMB_FLAGS2_UNICODE) - return (mts_wcequiv_strlen(str)); + return (smb_wcequiv_strlen(str)); return (strlen(str)); } @@ -85,7 +81,7 @@ int smb_ascii_or_unicode_strlen_null(struct smb_request *sr, char *str) { if (sr->smb_flg2 & SMB_FLAGS2_UNICODE) - return (mts_wcequiv_strlen(str) + 2); + return (smb_wcequiv_strlen(str) + 2); return (strlen(str) + 1); } @@ -310,7 +306,7 @@ smb_stream_parse_name(char *path, char *filename, char *stream) if (stype == NULL) (void) strlcat(stream, ":$DATA", MAXNAMELEN); else - (void) utf8_strupr(stype); + (void) smb_strupr(stype); } /* @@ -1440,7 +1436,7 @@ smb_idmap_batch_destroy(smb_idmap_batch_t *sib) for (i = 0; i < sib->sib_nmap; i++) { domsid = sib->sib_maps[i].sim_domsid; if (domsid) - kmem_free(domsid, strlen(domsid) + 1); + smb_mfree(domsid); } } @@ -1474,7 +1470,7 @@ smb_idmap_batch_getid(idmap_get_handle_t *idmaph, smb_idmap_t *sim, smb_sid_tostr(sid, strsid); if (smb_sid_splitstr(strsid, &sim->sim_rid) != 0) return (IDMAP_ERR_SID); - sim->sim_domsid = smb_kstrdup(strsid, strlen(strsid) + 1); + sim->sim_domsid = smb_strdup(strsid); switch (idtype) { case SMB_IDMAP_USER: @@ -2036,23 +2032,6 @@ smb_cred_is_member(cred_t *cr, smb_sid_t *sid) } /* - * smb_kstrdup - * - * Duplicate the given string s. - */ -char * -smb_kstrdup(const char *s, size_t n) -{ - char *s2; - - ASSERT(s); - ASSERT(n); - s2 = kmem_alloc(n, KM_SLEEP); - (void) strlcpy(s2, s, n); - return (s2); -} - -/* * smb_cred_create_privs * * Creates a duplicate credential that contains system privileges for diff --git a/usr/src/uts/common/fs/smbsrv/smb_vfs.c b/usr/src/uts/common/fs/smbsrv/smb_vfs.c index 40d0497096..cbbd77c8a5 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_vfs.c +++ b/usr/src/uts/common/fs/smbsrv/smb_vfs.c @@ -19,19 +19,16 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "@(#)smb_vfs.c 1.3 08/08/07 SMI" - #include <sys/types.h> #include <sys/fsid.h> #include <sys/vfs.h> #include <sys/stat.h> #include <smbsrv/smb_ktypes.h> #include <smbsrv/smb_kproto.h> -#include <smbsrv/string.h> static smb_vfs_t *smb_vfs_lookup(smb_server_t *, vnode_t *); diff --git a/usr/src/uts/common/fs/smbsrv/smb_vops.c b/usr/src/uts/common/fs/smbsrv/smb_vops.c index 386e02af4b..93782f0b6d 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_vops.c +++ b/usr/src/uts/common/fs/smbsrv/smb_vops.c @@ -37,12 +37,10 @@ #include <sys/fcntl.h> #include <nfs/lm.h> -#include <smbsrv/smb_vops.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/string.h> - +#include <smbsrv/smb_vops.h> #include <smbsrv/smb_fsops.h> -#include <smbsrv/smb_kproto.h> -#include <smbsrv/smb_incl.h> /* * CATIA support @@ -110,7 +108,7 @@ typedef struct smb_catia_map { unsigned char unixchar; /* v4 */ - mts_wchar_t winchar; /* v5 */ + smb_wchar_t winchar; /* v5 */ } smb_catia_map_t; smb_catia_map_t catia_maps[SMB_CATIA_NUM_MAPS] = @@ -126,8 +124,8 @@ smb_catia_map_t catia_maps[SMB_CATIA_NUM_MAPS] = {'|', SMB_CATIA_WIN_BROKEN_BAR} }; -static mts_wchar_t smb_catia_v5_lookup[SMB_CATIA_V5_LOOKUP_MAX]; -static mts_wchar_t smb_catia_v4_lookup[SMB_CATIA_V4_LOOKUP_MAX]; +static smb_wchar_t smb_catia_v5_lookup[SMB_CATIA_V5_LOOKUP_MAX]; +static smb_wchar_t smb_catia_v4_lookup[SMB_CATIA_V4_LOOKUP_MAX]; static void smb_vop_setup_xvattr(smb_attr_t *smb_attr, xvattr_t *xvattr); static void smb_sa_to_va_mask(uint_t sa_mask, uint_t *va_maskp); @@ -1400,11 +1398,11 @@ smb_vop_catia_init_v4_lookup() int i, idx, offset = SMB_CATIA_V4_LOOKUP_LOW; for (i = 0; i < SMB_CATIA_V4_LOOKUP_MAX; i++) - smb_catia_v4_lookup[i] = (mts_wchar_t)(i + offset); + smb_catia_v4_lookup[i] = (smb_wchar_t)(i + offset); for (i = 0; i < SMB_CATIA_NUM_MAPS; i++) { idx = (int)catia_maps[i].winchar - offset; - smb_catia_v4_lookup[idx] = (mts_wchar_t)catia_maps[i].unixchar; + smb_catia_v4_lookup[idx] = (smb_wchar_t)catia_maps[i].unixchar; } } @@ -1420,7 +1418,7 @@ smb_vop_catia_init_v5_lookup() int i, idx; for (i = 0; i < SMB_CATIA_V5_LOOKUP_MAX; i++) - smb_catia_v5_lookup[i] = (mts_wchar_t)i; + smb_catia_v5_lookup[i] = (smb_wchar_t)i; for (i = 0; i < SMB_CATIA_NUM_MAPS; i++) { idx = (int)catia_maps[i].unixchar; @@ -1452,7 +1450,7 @@ smb_vop_catia_v5tov4(char *name, char *buf, int buflen) { int v4_idx, numbytes, inc; int space_left = buflen - 1; /* one byte reserved for null */ - mts_wchar_t wc; + smb_wchar_t wc; char mbstring[MTS_MB_CHAR_MAX]; char *p, *src = name, *dst = buf; @@ -1465,7 +1463,7 @@ smb_vop_catia_v5tov4(char *name, char *buf, int buflen) bzero(buf, buflen); while (*src) { - if ((numbytes = mts_mbtowc(&wc, src, MTS_MB_CHAR_MAX)) < 0) + if ((numbytes = smb_mbtowc(&wc, src, MTS_MB_CHAR_MAX)) < 0) return (name); if (wc < SMB_CATIA_V4_LOOKUP_LOW || @@ -1475,7 +1473,7 @@ smb_vop_catia_v5tov4(char *name, char *buf, int buflen) } else { /* Lookup required. */ v4_idx = (int)wc - SMB_CATIA_V4_LOOKUP_LOW; - inc = mts_wctomb(mbstring, smb_catia_v4_lookup[v4_idx]); + inc = smb_wctomb(mbstring, smb_catia_v4_lookup[v4_idx]); p = mbstring; } @@ -1509,7 +1507,7 @@ smb_vop_catia_v4tov5(char *name, char *buf, int buflen) { int v5_idx, numbytes; int space_left = buflen - 1; /* one byte reserved for null */ - mts_wchar_t wc; + smb_wchar_t wc; char mbstring[MTS_MB_CHAR_MAX]; char *src = name, *dst = buf; @@ -1521,16 +1519,16 @@ smb_vop_catia_v4tov5(char *name, char *buf, int buflen) (void) bzero(buf, buflen); while (*src) { - if (mts_isascii(*src)) { + if (smb_isascii(*src)) { /* Lookup required */ v5_idx = (int)*src++; - numbytes = mts_wctomb(mbstring, + numbytes = smb_wctomb(mbstring, smb_catia_v5_lookup[v5_idx]); if (space_left < numbytes) break; (void) strncpy(dst, mbstring, numbytes); } else { - if ((numbytes = mts_mbtowc(&wc, src, + if ((numbytes = smb_mbtowc(&wc, src, MTS_MB_CHAR_MAX)) < 0) break; if (space_left < numbytes) diff --git a/usr/src/uts/common/fs/smbsrv/smb_vss.c b/usr/src/uts/common/fs/smbsrv/smb_vss.c index 78300cf788..e70c292b38 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_vss.c +++ b/usr/src/uts/common/fs/smbsrv/smb_vss.c @@ -39,9 +39,9 @@ * in the snapshot. */ -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> +#include <smbsrv/string.h> #include <smbsrv/winioctl.h> -#include <smbsrv/ntstatus.h> #include <smbsrv/smb_door_svc.h> /* Size of the token on the wire due to encoding */ @@ -249,7 +249,7 @@ smb_vss_is_gmttoken(const char *s) while (*template) { if (*template == 'N') { - if (!mts_isdigit(*str)) + if (!smb_isdigit(*str)) return (B_FALSE); } else if (*template != *str) { return (B_FALSE); diff --git a/usr/src/uts/common/fs/smbsrv/smb_write.c b/usr/src/uts/common/fs/smbsrv/smb_write.c index c913770205..a07e555494 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_write.c +++ b/usr/src/uts/common/fs/smbsrv/smb_write.c @@ -24,9 +24,8 @@ */ #include <sys/sdt.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> -#include <smbsrv/mbuf.h> #include <smbsrv/netbios.h> diff --git a/usr/src/uts/common/fs/smbsrv/smb_write_raw.c b/usr/src/uts/common/fs/smbsrv/smb_write_raw.c index a1d7948412..446b25bb23 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_write_raw.c +++ b/usr/src/uts/common/fs/smbsrv/smb_write_raw.c @@ -182,9 +182,8 @@ */ #include <sys/sdt.h> -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> #include <smbsrv/smb_fsops.h> -#include <smbsrv/mbuf.h> #include <smbsrv/netbios.h> extern uint32_t smb_keep_alive; diff --git a/usr/src/uts/common/fs/smbsrv/smb_xlate.c b/usr/src/uts/common/fs/smbsrv/smb_xlate.c index ffe1aa199d..c0f4f66391 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_xlate.c +++ b/usr/src/uts/common/fs/smbsrv/smb_xlate.c @@ -19,13 +19,11 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_incl.h> +#include <smbsrv/smb_kproto.h> struct xlate_table { int code; diff --git a/usr/src/uts/common/smbsrv/Makefile b/usr/src/uts/common/smbsrv/Makefile index 07e63dfa7e..d9ed78c1b7 100644 --- a/usr/src/uts/common/smbsrv/Makefile +++ b/usr/src/uts/common/smbsrv/Makefile @@ -25,21 +25,10 @@ include ../../../Makefile.master HDRS= alloc.h \ - cifs.h \ - codepage.h \ - cp_cyrillic.h \ - cp_latin1.h \ - cp_latin2.h \ - cp_latin3.h \ - cp_latin4.h \ - cp_latin5.h \ - cp_latin6.h \ cp_unicode.h \ cp_usascii.h \ - ctype.h \ doserror.h \ hash_table.h \ - lm.h \ lmdfs.h \ lmerr.h \ mac_cifs.h \ @@ -56,14 +45,11 @@ HDRS= alloc.h \ ntlocale.h \ smb_sid.h \ ntstatus.h \ - oem.h \ smb.h \ smb_common_door.h \ smb_door_svc.h \ smb_fsops.h \ - smb_i18n.h \ smb_idmap.h \ - smb_incl.h \ smb_inet.h \ smb_ioctl.h \ smb_kproto.h \ @@ -74,7 +60,6 @@ HDRS= alloc.h \ smb_token.h \ smb_vops.h \ smb_xdr.h \ - smbfmt.h \ smbinfo.h \ string.h \ svrapi.h \ diff --git a/usr/src/uts/common/smbsrv/alloc.h b/usr/src/uts/common/smbsrv/alloc.h index 8d49256863..28d80342c4 100644 --- a/usr/src/uts/common/smbsrv/alloc.h +++ b/usr/src/uts/common/smbsrv/alloc.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_ALLOC_H #define _SMBSRV_ALLOC_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -68,17 +66,16 @@ extern "C" { #else /* _KERNEL */ -void *mem_malloc(uint32_t size); -void *mem_zalloc(uint32_t size); -char *mem_strdup(const char *ptr); -void *mem_realloc(void *ptr, uint32_t size); -void smb_mem_free(void *ptr); +void *smb_malloc(uint32_t); +char *smb_strdup(const char *); +void *smb_realloc(void *, uint32_t); +void smb_mfree(void *); -#define MEM_MALLOC(AREA, SIZE) mem_malloc(SIZE) -#define MEM_ZALLOC(AREA, SIZE) mem_zalloc(SIZE) -#define MEM_STRDUP(AREA, PTR) mem_strdup(PTR) -#define MEM_REALLOC(AREA, PTR, SIZE) mem_realloc((PTR), (SIZE)) -#define MEM_FREE(AREA, PTR) smb_mem_free(PTR) +#define MEM_MALLOC(AREA, SIZE) smb_malloc(SIZE) +#define MEM_ZALLOC(AREA, SIZE) smb_malloc(SIZE) +#define MEM_STRDUP(AREA, PTR) smb_strdup(PTR) +#define MEM_REALLOC(AREA, PTR, SIZE) smb_realloc((PTR), (SIZE)) +#define MEM_FREE(AREA, PTR) smb_mfree(PTR) #endif /* _KERNEL */ diff --git a/usr/src/uts/common/smbsrv/cifs.h b/usr/src/uts/common/smbsrv/cifs.h deleted file mode 100644 index 2f6339c04d..0000000000 --- a/usr/src/uts/common/smbsrv/cifs.h +++ /dev/null @@ -1,1217 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CIFS_H -#define _SMBSRV_CIFS_H - - -/* - * This file provides definitions for the CIFS interface. The Macintosh - * Extensions for CIFS are defined in mac_cifs.h. - */ - -/* - * Macintosh Extensions for CIFS - */ -#include <smbsrv/mac_cifs.h> - -/* - * NT Installable File System (IFS) interface. - */ -#include <smbsrv/ntifs.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Share types */ -#ifndef _SHARE_TYPES_DEFINED_ -#define _SHARE_TYPES_DEFINED_ -#define STYPE_DISKTREE 0x00000000 -#define STYPE_PRINTQ 0x00000001 -#define STYPE_DEVICE 0x00000002 -#define STYPE_IPC 0x00000003 -#define STYPE_MASK 0x0000000F -#define STYPE_DFS 0x00000064 -#define STYPE_HIDDEN 0x80000000 -#define STYPE_SPECIAL 0x80000000 -#endif /* _SHARE_TYPES_DEFINED_ */ - -#define STYPE_ISDSK(S) (((S) & STYPE_MASK) == STYPE_DISKTREE) -#define STYPE_ISPRN(S) (((S) & STYPE_MASK) == STYPE_PRINTQ) -#define STYPE_ISDEV(S) (((S) & STYPE_MASK) == STYPE_DEVICE) -#define STYPE_ISIPC(S) (((S) & STYPE_MASK) == STYPE_IPC) - -/* - * NtCreateAndX and NtTransactCreate creation flags: defined in CIFS - * section 4.2.2 - * - * Creation Flag Name Value Description - * ========================== ====== ================================== - * NT_CREATE_REQUEST_OPLOCK 0x02 Level I oplock requested - * NT_CREATE_REQUEST_OPBATCH 0x04 Batch oplock requested - * NT_CREATE_OPEN_TARGET_DIR 0x08 Target for open is a directory - */ -#define NT_CREATE_FLAG_REQUEST_OPLOCK 0x02 -#define NT_CREATE_FLAG_REQUEST_OPBATCH 0x04 -#define NT_CREATE_FLAG_OPEN_TARGET_DIR 0x08 - - -/* - * Define the filter flags for NtNotifyChangeDirectoryFile - */ -#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 -#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 -#define FILE_NOTIFY_CHANGE_NAME 0x00000003 -#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 -#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 -#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 -#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 -#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 -#define FILE_NOTIFY_CHANGE_EA 0x00000080 -#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 -#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 -#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 -#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 -#define FILE_NOTIFY_VALID_MASK 0x00000fff - - -/* - * Define the file action type codes for NtNotifyChangeDirectoryFile - */ -#define FILE_ACTION_ADDED 0x00000001 -#define FILE_ACTION_REMOVED 0x00000002 -#define FILE_ACTION_MODIFIED 0x00000003 -#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 -#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 -#define FILE_ACTION_ADDED_STREAM 0x00000006 -#define FILE_ACTION_REMOVED_STREAM 0x00000007 -#define FILE_ACTION_MODIFIED_STREAM 0x00000008 - - -/* Lock type flags */ -#define LOCKING_ANDX_NORMAL_LOCK 0x00 -#define LOCKING_ANDX_SHARED_LOCK 0x01 -#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 -#define LOCKING_ANDX_CHANGE_LOCK_TYPE 0x04 -#define LOCKING_ANDX_CANCEL_LOCK 0x08 -#define LOCKING_ANDX_LARGE_FILES 0x10 - -#define SMB_COM_CREATE_DIRECTORY 0x00 -#define SMB_COM_DELETE_DIRECTORY 0x01 -#define SMB_COM_OPEN 0x02 -#define SMB_COM_CREATE 0x03 -#define SMB_COM_CLOSE 0x04 -#define SMB_COM_FLUSH 0x05 -#define SMB_COM_DELETE 0x06 -#define SMB_COM_RENAME 0x07 -#define SMB_COM_QUERY_INFORMATION 0x08 -#define SMB_COM_SET_INFORMATION 0x09 -#define SMB_COM_READ 0x0A -#define SMB_COM_WRITE 0x0B -#define SMB_COM_LOCK_BYTE_RANGE 0x0C -#define SMB_COM_UNLOCK_BYTE_RANGE 0x0D -#define SMB_COM_CREATE_TEMPORARY 0x0E -#define SMB_COM_CREATE_NEW 0x0F -#define SMB_COM_CHECK_DIRECTORY 0x10 -#define SMB_COM_PROCESS_EXIT 0x11 -#define SMB_COM_SEEK 0x12 -#define SMB_COM_LOCK_AND_READ 0x13 -#define SMB_COM_WRITE_AND_UNLOCK 0x14 - -#define SMB_COM_READ_RAW 0x1A -#define SMB_COM_READ_MPX 0x1B -#define SMB_COM_READ_MPX_SECONDARY 0x1C -#define SMB_COM_WRITE_RAW 0x1D -#define SMB_COM_WRITE_MPX 0x1E -#define SMB_COM_WRITE_MPX_SECONDARY 0x1F -#define SMB_COM_WRITE_COMPLETE 0x20 - -#define SMB_COM_SET_INFORMATION2 0x22 -#define SMB_COM_QUERY_INFORMATION2 0x23 -#define SMB_COM_LOCKING_ANDX 0x24 -#define SMB_COM_TRANSACTION 0x25 -#define SMB_COM_TRANSACTION_SECONDARY 0x26 -#define SMB_COM_IOCTL 0x27 -#define SMB_COM_IOCTL_SECONDARY 0x28 -#define SMB_COM_COPY 0x29 -#define SMB_COM_MOVE 0x2A -#define SMB_COM_ECHO 0x2B -#define SMB_COM_WRITE_AND_CLOSE 0x2C -#define SMB_COM_OPEN_ANDX 0x2D -#define SMB_COM_READ_ANDX 0x2E -#define SMB_COM_WRITE_ANDX 0x2F - -#define SMB_COM_CLOSE_AND_TREE_DISC 0x31 -#define SMB_COM_TRANSACTION2 0x32 -#define SMB_COM_TRANSACTION2_SECONDARY 0x33 -#define SMB_COM_FIND_CLOSE2 0x34 -#define SMB_COM_FIND_NOTIFY_CLOSE 0x35 - -#define SMB_COM_TREE_CONNECT 0x70 -#define SMB_COM_TREE_DISCONNECT 0x71 -#define SMB_COM_NEGOTIATE 0x72 -#define SMB_COM_SESSION_SETUP_ANDX 0x73 -#define SMB_COM_LOGOFF_ANDX 0x74 -#define SMB_COM_TREE_CONNECT_ANDX 0x75 - -#define SMB_COM_QUERY_INFORMATION_DISK 0x80 -#define SMB_COM_SEARCH 0x81 -#define SMB_COM_FIND 0x82 -#define SMB_COM_FIND_UNIQUE 0x83 -#define SMB_COM_FIND_CLOSE 0x84 - -#define SMB_COM_NT_TRANSACT 0xA0 -#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 -#define SMB_COM_NT_CREATE_ANDX 0xA2 -#define SMB_COM_NT_CANCEL 0xA4 - -#define SMB_COM_OPEN_PRINT_FILE 0xC0 -#define SMB_COM_WRITE_PRINT_FILE 0xC1 -#define SMB_COM_CLOSE_PRINT_FILE 0xC2 -#define SMB_COM_GET_PRINT_QUEUE 0xC3 - - -/* - * Flags field of the SMB header. The names in parenthesis represent - * alternative names for the flags. - * - * SMB_FLAGS_LOCK_AND_READ_OK If the server supports LockAndRead and - * (SMB_FLAGS_LOCKS_SUBDIALECT) WriteAndUnlock, it sets this bit in the - * Negotiate response. - * - * SMB_FLAGS_SEND_NO_ACK When on, the client guarantees that there - * (SMB_FLAGS_RCV_BUF_POSTED) is a receive buffer posted such that a - * "Send-No-Ack" can be used by the server - * to respond to the client's request. - * - * SMB_FLAGS_CASE_INSENSITIVE This is part of the Flags field of every - * SMB header. If this bit is set, then all - * pathnames in the SMB should be treated as - * case-insensitive. Otherwise pathnames are - * case-sensitive. - * - * SMB_FLAGS_CANONICALIZED_PATHS When on in SessionSetupX, this indicates - * that all paths sent to the server are - * already in OS/2 canonicalized format. - * - * OS/2 canonical format means that file/directory names are in upper case, - * are valid characters, . and .. have been removed and single backslashes - * are used as separators. - * - * SMB_FLAGS_OPLOCK When set in an open file request SMBs - * (Open, Create, OpenX, etc.) this bit - * indicates a request for an oplock on the - * file. When set in the response, this bit - * indicates that the oplock was granted. - * - * SMB_FLAGS_OPLOCK_NOTIFY_ANY When on, this bit indicates that the server - * should notify the client on any request - * that could cause the file to be changed. - * If not set, the server only notifies the - * client on other open requests on the file. - * This bit is only relevant when - * SMB_FLAGS_OPLOCK is set. - * - * SMB_FLAGS_SERVER_TO_REDIR This bit indicates that the SMB is being - * (SMB_FLAGS_REPLY) sent from server to (client) redirector. - */ -#define SMB_FLAGS_LOCK_AND_READ_OK 0x01 -#define SMB_FLAGS_SEND_NO_ACK 0x02 -#define SMB_FLAGS_RESERVED 0x04 -#define SMB_FLAGS_CASE_INSENSITIVE 0x08 -#define SMB_FLAGS_CANONICALIZED_PATHS 0x10 -#define SMB_FLAGS_OPLOCK 0x20 -#define SMB_FLAGS_OPLOCK_NOTIFY_ANY 0x40 -#define SMB_FLAGS_REPLY 0x80 - - -/* - * Flags2 field of the SMB header. - */ -#define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001 -#define SMB_FLAGS2_KNOWS_EAS 0x0002 -#define SMB_FLAGS2_SMB_SECURITY_SIGNATURE 0x0004 -#define SMB_FLAGS2_IS_LONG_NAME 0x0040 -#define SMB_FLAGS2_REPARSE_PATH 0x0400 -#define SMB_FLAGS2_EXT_SEC 0x0800 -#define SMB_FLAGS2_DFS 0x1000 -#define SMB_FLAGS2_PAGING_IO 0x2000 -#define SMB_FLAGS2_NT_STATUS 0x4000 -#define SMB_FLAGS2_UNICODE 0x8000 - -#define DIALECT_UNKNOWN 0 -#define PC_NETWORK_PROGRAM_1_0 1 /* The original MSNET SMB protocol */ -#define PCLAN1_0 2 /* Some versions of the original MSNET */ -#define MICROSOFT_NETWORKS_1_03 3 /* This is used for the MS-NET 1.03 */ -#define MICROSOFT_NETWORKS_3_0 4 /* This is the DOS LANMAN 1.0 specific */ -#define LANMAN1_0 5 /* This is the first version of the full */ -#define LM1_2X002 6 /* This is the first version of the full */ -#define DOS_LM1_2X002 7 /* This is the dos equivalent of the */ -#define DOS_LANMAN2_1 8 /* DOS LANMAN2.1 */ -#define LANMAN2_1 9 /* OS/2 LANMAN2.1 */ -#define Windows_for_Workgroups_3_1a 10 /* Windows for Workgroups Version 1.0 */ -#define NT_LM_0_12 11 /* The SMB protocol designed for NT */ - -/* - * SMB_TREE_CONNECT_ANDX OptionalSupport flags - * - * SMB_SUPPORT_SEARCH_BITS The server supports SearchAttributes. - * SMB_SHARE_IS_IN_DFS The share is managed by DFS. - * SMB_CSC_MASK Offline-caching mask - see CSC values. - * SMB_UNIQUE_FILE_NAME The server uses long names and does not support - * short names. This indicates to clients that - * they may perform directory name-space caching. - * SMB_EXTENDED_SIGNATURES The server will use signing key protection. - * - * SMB_CSC_CACHE_MANUAL_REINT Clients are allowed to cache files for offline - * use as requested by users but automatic - * file-by-file reintegration is not allowed. - * SMB_CSC_CACHE_AUTO_REINT Clients are allowed to automatically cache - * files for offline use and file-by-file - * reintegration is allowed. - * SMB_CSC_CACHE_VDO Clients are allowed to automatically cache files - * for offline use, file-by-file reintegration is - * allowed and clients are permitted to work from - * their local cache even while offline. - * SMB_CSC_CACHE_NONE Client-side caching is disabled for this share. - * - * SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM - * The server will filter directory entries based - * on the access permissions of the client. - */ -#define SMB_SUPPORT_SEARCH_BITS 0x0001 -#define SMB_SHARE_IS_IN_DFS 0x0002 -#define SMB_CSC_MASK 0x000C -#define SMB_UNIQUE_FILE_NAME 0x0010 -#define SMB_EXTENDED_SIGNATURES 0x0020 - -#define SMB_CSC_CACHE_MANUAL_REINT 0x0000 -#define SMB_CSC_CACHE_AUTO_REINT 0x0004 -#define SMB_CSC_CACHE_VDO 0x0008 -#define SMB_CSC_CACHE_NONE 0x000C - -#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x0800 - -/* - * The subcommand codes, placed in SETUP[0], for named pipe operations are: - * SubCommand Code Value Description - * =================== ===== ========================================= - */ - -#define CallNamedPipe 0x54 /* open/write/read/close pipe */ -#define WaitNamedPipe 0x53 /* wait for pipe to be nonbusy */ -#define PeekNmPipe 0x23 /* read but don't remove data */ -#define QNmPHandState 0x21 /* query pipe handle modes */ -#define SetNmPHandState 0x01 /* set pipe handle modes */ -#define QNmPipeInfo 0x22 /* query pipe attributes */ -#define TransactNmPipe 0x26 /* write/read operation on pipe */ -#define RawReadNmPipe 0x11 /* read pipe in "raw" (non message mode) */ -#define RawWriteNmPipe 0x31 /* write pipe "raw" (non message mode) */ - - - -/* - * Setup[0] Transaction2 Value Description - * Subcommand Code - * ========================== ===== ============================= - */ - -#define TRANS2_OPEN2 0x00 /* Create file, extended attributes */ -#define TRANS2_FIND_FIRST2 0x01 /* Begin search for files */ -#define TRANS2_FIND_NEXT2 0x02 /* Resume search for files */ -#define TRANS2_QUERY_FS_INFORMATION 0x03 /* Get file system information */ -#define _TRANS2_RESV_0x04 0x04 /* Reserved */ -#define TRANS2_QUERY_PATH_INFORMATION 0x05 /* Get info, named file or dir */ -#define TRANS2_SET_PATH_INFORMATION 0x06 /* Set info, named file or dir */ -#define TRANS2_QUERY_FILE_INFORMATION 0x07 /* Get info, handle */ -#define TRANS2_SET_FILE_INFORMATION 0x08 /* Set info, handle */ -#define TRANS2_FSCTL 0x09 /* Not implemented by NT server */ -#define TRANS2_IOCTL2 0x0A /* Not implemented by NT server */ -#define TRANS2_FIND_NOTIFY_FIRST 0x0B /* Not implemented by NT server */ -#define TRANS2_FIND_NOTIFY_NEXT 0x0C /* Not implemented by NT server */ -#define TRANS2_CREATE_DIRECTORY 0x0D /* Create dir, extended attributes */ -#define TRANS2_SESSION_SETUP 0x0E /* Session setup, extended security */ -#define TRANS2_GET_DFS_REFERRAL 0x10 /* Get a Dfs referral */ -#define TRANS2_REPORT_DFS_INCONSISTENCY 0x11 /* Report a Dfs inconsistency */ - -/* - * Access Mode Encoding (CIFS/1.0 1996 Section 3.8). - * - * The desired access mode passed in SmbOpen and SmbOpenAndX has the following - * mapping: - * - * 1111 11 - * 5432 1098 7654 3210 - * rWrC rLLL rSSS rAAA - * - * where: - * - * W - Write through mode. No read ahead or write behind allowed on - * this file or device. When protocol is returned, data is expected - * to be on the disk or device. - * - * S - Sharing mode: - * 0 - Compatibility mode (as in core open) - * 1 - Deny read/write/execute (exclusive) - * 2 - Deny write - * 3 - Deny read/execute - * 4 - Deny none - * - * A - Access mode - * 0 - Open for reading - * 1 - Open for writing - * 2 - Open for reading and writing - * 3 - Open for execute - * - * rSSSrAAA = 11111111 (hex FF) indicates FCB open (as in core protocol) - * - * C - Cache mode - * 0 - Normal file - * 1 - Do not cache this file - * - * L - Locality of reference - * 0 - Locality of reference is unknown - * 1 - Mainly sequential access - * 2 - Mainly random access - * 3 - Random access with some locality - * 4 to 7 - Currently undefined - */ - - -#define SMB_DA_SHARE_MASK 0x70 -#define SMB_DA_ACCESS_MASK 0x07 -#define SMB_DA_FCB_MASK (UCHAR)0xFF - -#define SMB_DA_ACCESS_READ 0x00 -#define SMB_DA_ACCESS_WRITE 0x01 -#define SMB_DA_ACCESS_READ_WRITE 0x02 -#define SMB_DA_ACCESS_EXECUTE 0x03 - -#define SMB_DA_SHARE_COMPATIBILITY 0x00 -#define SMB_DA_SHARE_EXCLUSIVE 0x10 -#define SMB_DA_SHARE_DENY_WRITE 0x20 -#define SMB_DA_SHARE_DENY_READ 0x30 -#define SMB_DA_SHARE_DENY_NONE 0x40 - -#define SMB_DA_FCB (UCHAR)0xFF - -#define SMB_CACHE_NORMAL 0x0000 -#define SMB_DO_NOT_CACHE 0x1000 - -#define SMB_LR_UNKNOWN 0x0000 -#define SMB_LR_SEQUENTIAL 0x0100 -#define SMB_LR_RANDOM 0x0200 -#define SMB_LR_RANDOM_WITH_LOCALITY 0x0300 -#define SMB_LR_MASK 0x0F00 - -#define SMB_DA_WRITE_THROUGH 0x4000 - -/* - * Macros used for share reservation rule checking - */ - -#define SMB_DENY_READ(share_access) ((share_access & FILE_SHARE_READ) == 0) - -#define SMB_DENY_WRITE(share_access) ((share_access & FILE_SHARE_WRITE) == 0) - -#define SMB_DENY_DELETE(share_access) ((share_access & FILE_SHARE_DELETE) == 0) - -#define SMB_DENY_RW(share_access) \ - ((share_access & (FILE_SHARE_READ | FILE_SHARE_WRITE)) == 0) - -#define SMB_DENY_ALL(share_access) (share_access == 0) - -#define SMB_DENY_NONE(share_access) (share_access == FILE_SHARE_ALL) - -/* - * The SMB open function determines what action should be taken depending - * on the existence or lack thereof of files used in the operation. It - * has the following mapping: - * - * 1111 1 - * 5432 1098 7654 3210 - * rrrr rrrr rrrC rrOO - * - * where: - * - * O - Open (action to be taken if the target file exists) - * 0 - Fail - * 1 - Open or Append file - * 2 - Truncate file - * - * C - Create (action to be taken if the target file does not exist) - * 0 - Fail - * 1 - Create file - */ - -#define SMB_OFUN_OPEN_MASK 0x3 -#define SMB_OFUN_CREATE_MASK 0x10 - -#define SMB_OFUN_OPEN_FAIL 0 -#define SMB_OFUN_OPEN_APPEND 1 -#define SMB_OFUN_OPEN_OPEN 1 -#define SMB_OFUN_OPEN_TRUNCATE 2 - -#define SMB_OFUN_CREATE_FAIL 0x00 -#define SMB_OFUN_CREATE_CREATE 0x10 - -/* - * The Action field of OpenAndX has the following format: - * - * 1111 11 - * 5432 1098 7654 3210 - * Lrrr rrrr rrrr rrOO - * - * where: - * - * L - Opportunistic lock. 1 if lock granted, else 0. - * - * O - Open action: - * 1 - The file existed and was opened - * 2 - The file did not exist but was created - * 3 - The file existed and was truncated - */ - -#define SMB_OACT_LOCK 0x8000 -#define SMB_OACT_OPENED 0x01 -#define SMB_OACT_CREATED 0x02 -#define SMB_OACT_TRUNCATED 0x03 - -#define SMB_OACT_OPLOCK 0x8000 - -#define SMB_FTYPE_DISK 0 -#define SMB_FTYPE_BYTE_PIPE 1 -#define SMB_FTYPE_MESG_PIPE 2 -#define SMB_FTYPE_PRINTER 3 -#define SMB_FTYPE_UNKNOWN 0xFFFF - -#define SMB_DEVST_BLOCKING 0x8000 -#define SMB_DEVST_ENDPOINT 0x4000 -#define SMB_DEVST_TYPE_MASK 0x0C00 -#define SMB_DEVST_TYPE_BYTE_PIPE 0x0000 -#define SMB_DEVST_TYPE_MESG_PIPE 0x0400 -#define SMB_DEVST_RMODE_MASK 0x0300 -#define SMB_DEVST_RMODE_BYTES 0x0000 -#define SMB_DEVST_RMODE_MESGS 0x0100 -#define SMB_DEVST_ICOUNT_MASK 0x00FF /* not used */ - -#define SMB_FTYPE_IS_DISK(F) ((F) == SMB_FTYPE_DISK) -#define SMB_FTYPE_IS_PIPE(F) \ - (((F) == SMB_FTYPE_BYTE_PIPE) || ((F) == SMB_FTYPE_MESG_PIPE)) -#define SMB_FTYPE_IS_PRINTER(F) ((F) == SMB_FTYPE_PRINTER) - -/* - * TRANS2_FIND - */ -#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 -#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 -#define SMB_FIND_FILE_NAMES_INFO 0x103 -#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 -#define SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO 0x105 -#define SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO 0x106 -#define SMB_MAC_FIND_BOTH_HFS_INFO MAC_FIND_BOTH_HFS_INFO - - -/* - * Flags for TRANS2_FIND_FIRST2 and TRANS2_FIND_NEXT2 - * (NTDDK cifs.h). - * - * If SMB_FIND_RETURN_RESUME_KEYS was set in the request parameters, - * each entry is preceded by a four-byte resume key. - */ -#define SMB_FIND_CLOSE_AFTER_REQUEST 0x01 -#define SMB_FIND_CLOSE_AT_EOS 0x02 -#define SMB_FIND_RETURN_RESUME_KEYS 0x04 -#define SMB_FIND_CONTINUE_FROM_LAST 0x08 -#define SMB_FIND_WITH_BACKUP_INTENT 0x10 - - -/* - * TRANS2_QUERY_FS_INFORMATION - */ -#define SMB_INFO_ALLOCATION 1 -#define SMB_INFO_VOLUME 2 -#define SMB_QUERY_FS_LABEL_INFO 0x101 -#define SMB_QUERY_FS_VOLUME_INFO 0x102 -#define SMB_QUERY_FS_SIZE_INFO 0x103 -#define SMB_QUERY_FS_DEVICE_INFO 0x104 -#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 -#define SMB_QUERY_FS_QUOTA_INFO 0x106 /* unused? */ -#define SMB_QUERY_FS_CONTROL_INFO 0x107 -#define SMB_MAC_QUERY_FS_INFO MAC_QUERY_FS_INFO - - -/* - * Internal use only. - * Define information levels to represent the following requests: - * smb_query_information - * smb_query_information2 - * smb_set_information - * smb_set_information2 - */ -#define SMB_QUERY_INFORMATION 0x3001 -#define SMB_QUERY_INFORMATION2 0x3002 -#define SMB_SET_INFORMATION 0x3001 -#define SMB_SET_INFORMATION2 0x3002 - -/* TRANS2_QUERY_{PATH,FILE}_INFORMATION */ -#define SMB_INFO_STANDARD 1 /* query, set */ -#define SMB_INFO_QUERY_EA_SIZE 2 /* query */ -#define SMB_INFO_SET_EAS 2 /* set */ -#define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* query */ -#define SMB_INFO_QUERY_ALL_EAS 4 /* query */ -#define SMB_INFO_QUERY_FULL_NAME 5 /* unused */ -#define SMB_INFO_IS_NAME_VALID 6 /* query */ - -#define SMB_QUERY_FILE_BASIC_INFO 0x101 -#define SMB_QUERY_FILE_STANDARD_INFO 0x102 -#define SMB_QUERY_FILE_EA_INFO 0x103 -#define SMB_QUERY_FILE_NAME_INFO 0x104 -#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 /* unused */ -#define SMB_QUERY_FILE_END_OF_FILE_INFO 0x106 /* unused */ -#define SMB_QUERY_FILE_ALL_INFO 0x107 -#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 -#define SMB_QUERY_FILE_STREAM_INFO 0x109 -#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B - -#define SMB_MAC_SET_FINDER_INFO MAC_SET_FINDER_INFO -#define SMB_MAC_DT_ADD_APPL MAC_DT_ADD_APPL -#define SMB_MAC_DT_REMOVE_APPL MAC_DT_REMOVE_APPL -#define SMB_MAC_DT_GET_APPL MAC_DT_GET_APPL -#define SMB_MAC_DT_GET_ICON MAC_DT_GET_ICON -#define SMB_MAC_DT_GET_ICON_INFO MAC_DT_GET_ICON_INFO -#define SMB_MAC_DT_ADD_ICON MAC_DT_ADD_ICON - -#define SMB_SET_FILE_BASIC_INFO 0x101 -#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 - - -/* NT passthrough levels - see ntifs.h FILE_INFORMATION_CLASS */ -#define SMB_FILE_BASIC_INFORMATION 1004 -#define SMB_FILE_STANDARD_INFORMATION 1005 -#define SMB_FILE_INTERNAL_INFORMATION 1006 -#define SMB_FILE_EA_INFORMATION 1007 -#define SMB_FILE_ACCESS_INFORMATION 1008 -#define SMB_FILE_NAME_INFORMATION 1009 -#define SMB_FILE_DISPOSITION_INFORMATION 1013 -#define SMB_FILE_ALL_INFORMATION 1018 -#define SMB_FILE_ALLOCATION_INFORMATION 1019 -#define SMB_FILE_END_OF_FILE_INFORMATION 1020 -#define SMB_FILE_ALT_NAME_INFORMATION 1021 -#define SMB_FILE_STREAM_INFORMATION 1022 -#define SMB_FILE_COMPRESSION_INFORMATION 1028 -#define SMB_FILE_ATTR_TAG_INFORMATION 1035 - -/* - * The following bits may be set in the SecurityMode field of the - * SMB_COM_NEGOTIATE response. - * - * Notes: - * NEGOTIATE_SECURITY_SHARE_LEVEL is a montana2 invention. - * - * The NTDDK cifs.h definitions are: - * #define NEGOTIATE_USER_SECURITY 0x01 - * #define NEGOTIATE_ENCRYPT_PASSWORDS 0x02 - * #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 - * #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 - */ -#define NEGOTIATE_SECURITY_SHARE_LEVEL 0x00 -#define NEGOTIATE_SECURITY_USER_LEVEL 0x01 -#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02 -#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 -#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 - - -/* - * Negotiated Capabilities (CIFS/1.0 section 4.1.1) - * - * Capabilities allow the server to tell the client what it supports. - * Undefined bits MUST be set to zero by servers, and MUST be ignored - * by clients. The bit definitions are: - * - * Capability Name Encoding Meaning - * ==================== ======== ================================== - * CAP_RAW_MODE 0x0001 The server supports SMB_COM_READ_RAW and - * SMB_COM_WRITE_RAW (obsolescent) - * CAP_MPX_MODE 0x0002 The server supports SMB_COM_READ_MPX and - * SMB_COM_WRITE_MPX (obsolescent) - * CAP_UNICODE 0x0004 The server supports Unicode strings - * CAP_LARGE_FILES 0x0008 The server supports large files with 64 - * bit offsets - * CAP_NT_SMBS 0x0010 The server supports the SMBs particular - * to the NT LM 0.12 dialect. - * Implies CAP_NT_FIND. - * CAP_RPC_REMOTE_APIS 0x0020 The server supports remote admin API - * requests via DCE RPC - * CAP_STATUS32 0x0040 The server can respond with 32 bit - * status codes in Status.Status - * CAP_LEVEL_II_OPLOCKS 0x0080 The server supports level 2 oplocks - * CAP_LOCK_AND_READ 0x0100 The server supports the - * SMB_COM_LOCK_AND_READ SMB - * CAP_NT_FIND 0x0200 - * CAP_BULK_TRANSFER 0x0400 - * CAP_COMPRESSED_BULK 0x0800 - * CAP_DFS 0x1000 The server is DFS aware - * CAP_LARGE_READX 0x4000 The server supports large - * SMB_COM_READ_ANDX - * CAP_LARGE_WRITEX 0x8000 The server supports large - * SMB_COM_WRITE_ANDX - * CAP_RESERVED 0x02000000 Reserved for future use. - * CAP_EXTENDED_SECURITY 0x80000000 The server supports extended security - * exchanges. - * - * Extended security exchanges provides a means of supporting arbitrary - * authentication protocols within CIFS. Security blobs are opaque to the - * CIFS protocol; they are messages in some authentication protocol that - * has been agreed upon by client and server by some out of band mechanism, - * for which CIFS merely functions as a transport. When - * CAP_EXTENDED_SECURITY is negotiated, the server includes a first - * security blob in its response; subsequent security blobs are exchanged - * in SMB_COM_SESSION_SETUP_ANDX requests and responses until the - * authentication protocol terminates. - */ -#define CAP_RAW_MODE 0x0001 -#define CAP_MPX_MODE 0x0002 -#define CAP_UNICODE 0x0004 -#define CAP_LARGE_FILES 0x0008 -#define CAP_NT_SMBS 0x0010 -#define CAP_RPC_REMOTE_APIS 0x0020 -#define CAP_STATUS32 0x0040 -#define CAP_LEVEL_II_OPLOCKS 0x0080 -#define CAP_LOCK_AND_READ 0x0100 -#define CAP_NT_FIND 0x0200 -#define CAP_BULK_TRANSFER 0x0400 -#define CAP_COMPRESSED_BULK 0x0800 -#define CAP_DFS 0x1000 -#define CAP_LARGE_READX 0x4000 -#define CAP_LARGE_WRITEX 0x8000 -#define CAP_RESERVED 0x02000000 -#define CAP_EXTENDED_SECURITY 0x80000000 - - -/* - * Different device types according to NT - */ -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c - -/* - * Some of these device types are not currently accessible over the network - * and may never be accessible over the network. Some may change to be - * - * accessible over the network. The values for device types that may never - * be accessible over the network may be redefined to be just reserved at - * some date in the future. - * - * Characteristics is the sum of any of the following: - */ - -#define FILE_REMOVABLE_MEDIA 0x00000001 -#define FILE_READ_ONLY_DEVICE 0x00000002 -#define FILE_FLOPPY_DISKETTE 0x00000004 -#define FILE_WRITE_ONE_MEDIA 0x00000008 -#define FILE_REMOTE_DEVICE 0x00000010 -#define FILE_DEVICE_IS_MOUNTED 0x00000020 -#define FILE_VIRTUAL_VOLUME 0x00000040 - -/* - * CREATE_ANDX ShareAccess Flags - */ - -#define FILE_SHARE_NONE 0x00000000 -#define FILE_SHARE_READ 0x00000001 -#define FILE_SHARE_WRITE 0x00000002 -#define FILE_SHARE_DELETE 0x00000004 -#define FILE_SHARE_ALL 0x00000007 -#define FILE_SHARE_VALID_FLAGS 0x00000007 - - -/* - * CREATE_ANDX CreateDisposition flags - * - * FILE_SUPERSEDE If the file already exists it should be superseded - * by the specified file. If the file does not already - * exist then it should be created. - * - * FILE_CREATE If the file already exists the operation should fail. - * If the file does not already exist then it should be - * created. (aka CREATE_NEW) - * - * FILE_OPEN If the file already exists then it should be opened. - * If the file does not already exist then the operation - * should fail. (aka OPEN_EXISTING) - * - * FILE_OPEN_IF If the file already exists then it should be opened. - * If the file does not already exist then it should be - * created. (aka OPEN_ALWAYS) - * - * FILE_OVERWRITE If the file already exists, it should be opened and - * overwritten. If the file does not already exist then - * the operation should fail. (aka TRUNCATE_EXISTING) - * - * FILE_OVERWRITE_IF If the file already exists, it should be opened and - * overwritten. If the file does not already exist then - * it should be created. (aka CREATE_ALWAYS) - */ -#define FILE_SUPERSEDE 0x00000000 -#define FILE_OPEN 0x00000001 -#define FILE_CREATE 0x00000002 -#define FILE_OPEN_IF 0x00000003 -#define FILE_OVERWRITE 0x00000004 -#define FILE_OVERWRITE_IF 0x00000005 -#define FILE_MAXIMUM_DISPOSITION 0x00000005 - -/* - * CREATE_ANDX Impersonation levels - */ - -#define SECURITY_ANONYMOUS 0x00000001 -#define SECURITY_IDENTIFICATION 0x00000002 -#define SECURITY_IMPERSONATION 0x00000003 -#define SECURITY_DELEGATION 0x00000004 - -/* - * CREATE_ANDX SecurityFlags - */ - -#define SECURITY_CONTEXT_TRACKING 0x00000001 -#define SECURITY_EFFECTIVE_ONLY 0x00000002 - -/* - * Server types - */ -#define SV_WORKSTATION 0x00000001 /* All workstations */ -#define SV_SERVER 0x00000002 /* All servers */ -#define SV_SQLSERVER 0x00000004 /* running with SQL server */ -#define SV_DOMAIN_CTRL 0x00000008 /* Primary domain controller */ -#define SV_DOMAIN_BAKCTRL 0x00000010 /* Backup domain controller */ -#define SV_TIME_SOURCE 0x00000020 /* running timesource service */ -#define SV_AFP 0x00000040 /* Apple File Protocol */ -#define SV_NOVELL 0x00000080 /* Novell servers */ -#define SV_DOMAIN_MEMBER 0x00000100 /* Domain Member */ -#define SV_PRINTQ_SERVER 0x00000200 /* Server sharing print queue */ -#define SV_DIALIN_SERVER 0x00000400 /* Server running dialin */ -#define SV_XENIX_SERVER 0x00000800 /* Xenix server */ -#define SV_NT 0x00001000 /* NT server */ -#define SV_WFW 0x00002000 /* Server running Windows for */ -#define SV_SERVER_NT 0x00008000 /* Windows NT non DC server */ -#define SV_POTENTIAL_BROWSER 0x00010000 /* can run browser service */ -#define SV_BACKUP_BROWSER 0x00020000 /* Backup browser server */ -#define SV_MASTER_BROWSER 0x00040000 /* Master browser server */ -#define SV_DOMAIN_MASTER 0x00080000 /* Domain Master Browser */ -#define SV_OSF 0x00100000 /* OSF operating system */ -#define SV_VMS 0x00200000 /* VMS operating system */ -#define SV_WINDOWS_95_PLUS 0x00400000 /* Windows 95 or better */ - -#define SV_LOCAL_LIST_ONLY 0x40000000 /* Enumerate only "local" */ -#define SV_TYPE_DOMAIN_ENUM 0x80000000 /* Enumerate Domains */ - -#define MY_SERVER_TYPE (SV_SERVER | SV_NT | SV_SERVER_NT) - - -#define PRQ_ACTIVE 0 /* Active */ -#define PRQ_PAUSE 1 /* Paused */ -#define PRQ_ERROR 2 /* Error Occurred */ -#define PRQ_PENDING 3 /* Deletion pending */ - -#define PRJ_QS_QUEUED 0 /* Active */ -#define PRJ_QS_PAUSED 1 /* Paused */ -#define PRJ_QS_SPOOLING 2 /* Paused */ -#define PRJ_QS_PRINTING 3 /* Paused */ - - -#define SHARE_ACCESS_READ 0x01 /* read & execute from resource */ -#define SHARE_ACCESS_WRITE 0x02 /* write data to resource */ -#define SHARE_ACCESS_CREATE 0x04 /* create an instance of */ -#define SHARE_ACCESS_EXEC 0x08 /* execute from resource */ -#define SHARE_ACCESS_DELETE 0x10 /* Permission to delete the resource */ -#define SHARE_ACCESS_ATTRIB 0x20 /* Permission to modify the resource */ -#define SHARE_ACCESS_PERM 0x40 /* Permission to change permissions */ -#define SHARE_ACCESS_ALL 0x7F /* All of the above permissions */ - - -/* - * SMB_COM_NT_TRANSACTION sub-command codes (CIFS/1.0 section 5.3) - * - * SubCommand Code Value Description - * =============================== ===== ================================= - * NT_TRANSACT_CREATE 1 File open/create - * NT_TRANSACT_IOCTL 2 Device IOCTL - * NT_TRANSACT_SET_SECURITY_DESC 3 Set security descriptor - * NT_TRANSACT_NOTIFY_CHANGE 4 Start directory watch - * NT_TRANSACT_RENAME 5 Reserved (handle-based rename) - * NT_TRANSACT_QUERY_SECURITY_DESC 6 Retrieve security descriptor - * NT_TRANSACT_QUERY_QUOTA 7 Retrieve quota information - * NT_TRANSACT_SET_QUOTA 8 Set quota information - */ -#define NT_TRANSACT_MIN_FUNCTION 1 - -#define NT_TRANSACT_CREATE 1 -#define NT_TRANSACT_IOCTL 2 -#define NT_TRANSACT_SET_SECURITY_DESC 3 -#define NT_TRANSACT_NOTIFY_CHANGE 4 -#define NT_TRANSACT_RENAME 5 -#define NT_TRANSACT_QUERY_SECURITY_DESC 6 -#define NT_TRANSACT_QUERY_QUOTA 7 -#define NT_TRANSACT_SET_QUOTA 8 - -#define NT_TRANSACT_MAX_FUNCTION 8 - - -/* - * Pipe states - */ -#define SMB_PIPE_READMODE_BYTE 0x0000 -#define SMB_PIPE_READMODE_MESSAGE 0x0100 -#define SMB_PIPE_TYPE_BYTE 0x0000 -#define SMB_PIPE_TYPE_MESSAGE 0x0400 -#define SMB_PIPE_END_CLIENT 0x0000 -#define SMB_PIPE_END_SERVER 0x4000 -#define SMB_PIPE_WAIT 0x0000 -#define SMB_PIPE_NOWAIT 0x8000 -#define SMB_PIPE_UNLIMITED_INSTANCES 0x00FF - -/* - * smb_com_seek request - */ -#define SMB_SEEK_SET 0 /* set file offset to specified offset */ -#define SMB_SEEK_CUR 1 /* set file offset to current plus specified offset */ -#define SMB_SEEK_END 2 /* set file offset to EOF plus specified offset */ - -/* - * API Numbers for Transact based RAP (Remote Administration Protocol) calls - */ -#define API_WshareEnum 0 -#define API_WshareGetInfo 1 -#define API_WshareSetInfo 2 -#define API_WshareAdd 3 -#define API_WshareDel 4 -#define API_NetShareCheck 5 -#define API_WsessionEnum 6 -#define API_WsessionGetInfo 7 -#define API_WsessionDel 8 -#define API_WconnectionEnum 9 -#define API_WfileEnum 10 -#define API_WfileGetInfo 11 -#define API_WfileClose 12 -#define API_WserverGetInfo 13 -#define API_WserverSetInfo 14 -#define API_WserverDiskEnum 15 -#define API_WserverAdminCommand 16 -#define API_NetAuditOpen 17 -#define API_WauditClear 18 -#define API_NetErrorLogOpen 19 -#define API_WerrorLogClear 20 -#define API_NetCharDevEnum 21 -#define API_NetCharDevGetInfo 22 -#define API_WCharDevControl 23 -#define API_NetCharDevQEnum 24 -#define API_NetCharDevQGetInfo 25 -#define API_WCharDevQSetInfo 26 -#define API_WCharDevQPurge 27 -#define API_WCharDevQPurgeSelf 28 -#define API_WMessageNameEnum 29 -#define API_WMessageNameGetInfo 30 -#define API_WMessageNameAdd 31 -#define API_WMessageNameDel 32 -#define API_WMessageNameFwd 33 -#define API_WMessageNameUnFwd 34 -#define API_WMessageBufferSend 35 -#define API_WMessageFileSend 36 -#define API_WMessageLogFileSet 37 -#define API_WMessageLogFileGet 38 -#define API_WServiceEnum 39 -#define API_WServiceInstall 40 -#define API_WServiceControl 41 -#define API_WAccessEnum 42 -#define API_WAccessGetInfo 43 -#define API_WAccessSetInfo 44 -#define API_WAccessAdd 45 -#define API_WAccessDel 46 -#define API_WGroupEnum 47 -#define API_WGroupAdd 48 -#define API_WGroupDel 49 -#define API_WGroupAddUser 50 -#define API_WGroupDelUser 51 -#define API_WGroupGetUsers 52 -#define API_WUserEnum 53 -#define API_WUserAdd 54 -#define API_WUserDel 55 -#define API_WUserGetInfo 56 -#define API_WUserSetInfo 57 -#define API_WUserPasswordSet 58 -#define API_WUserGetGroups 59 -#define API_DeadTableEntry 60 -#define API_WWkstaSetUID 62 -#define API_WWkstaGetInfo 63 -#define API_WWkstaSetInfo 64 -#define API_WUseEnum 65 -#define API_WUseAdd 66 -#define API_WUseDel 67 -#define API_WUseGetInfo 68 -#define API_WPrintQEnum 69 -#define API_WPrintQGetInfo 70 -#define API_WPrintQSetInfo 71 -#define API_WPrintQAdd 72 -#define API_WPrintQDel 73 -#define API_WPrintQPause 74 -#define API_WPrintQContinue 75 -#define API_WPrintJobEnum 76 -#define API_WPrintJobGetInfo 77 -#define API_WPrintJobSetInfo_OLD 78 -#define API_WPrintJobDel 81 -#define API_WPrintJobPause 82 -#define API_WPrintJobContinue 83 -#define API_WPrintDestEnum 84 -#define API_WPrintDestGetInfo 85 -#define API_WPrintDestControl 86 -#define API_WProfileSave 87 -#define API_WProfileLoad 88 -#define API_WStatisticsGet 89 -#define API_WStatisticsClear 90 -#define API_NetRemoteTOD 91 -#define API_WNetBiosEnum 92 -#define API_WNetBiosGetInfo 93 -#define API_NetServerEnum 94 -#define API_I_NetServerEnum 95 -#define API_WServiceGetInfo 96 -#define API_WPrintQPurge 103 -#define API_NetServerEnum2 104 -#define API_WAccessGetUserPerms 105 -#define API_WGroupGetInfo 106 -#define API_WGroupSetInfo 107 -#define API_WGroupSetUsers 108 -#define API_WUserSetGroups 109 -#define API_WUserModalsGet 110 -#define API_WUserModalsSet 111 -#define API_WFileEnum2 112 -#define API_WUserAdd2 113 -#define API_WUserSetInfo2 114 -#define API_WUserPasswordSet2 115 -#define API_I_NetServerEnum2 116 -#define API_WConfigGet2 117 -#define API_WConfigGetAll2 118 -#define API_WGetDCName 119 -#define API_NetHandleGetInfo 120 -#define API_NetHandleSetInfo 121 -#define API_WStatisticsGet2 122 -#define API_WBuildGetInfo 123 -#define API_WFileGetInfo2 124 -#define API_WFileClose2 125 -#define API_WNetServerReqChallenge 126 -#define API_WNetServerAuthenticate 127 -#define API_WNetServerPasswordSet 128 -#define API_WNetAccountDeltas 129 -#define API_WNetAccountSync 130 -#define API_WUserEnum2 131 -#define API_WWkstaUserLogon 132 -#define API_WWkstaUserLogoff 133 -#define API_WLogonEnum 134 -#define API_WErrorLogRead 135 -#define API_WI_NetPathType 136 -#define API_WI_NetPathCanonicalize 137 -#define API_WI_NetPathCompare 138 -#define API_WI_NetNameValidate 139 -#define API_WI_NetNameCanonicalize 140 -#define API_WI_NetNameCompare 141 -#define API_WAuditRead 142 -#define API_WPrintDestAdd 143 -#define API_WPrintDestSetInfo 144 -#define API_WPrintDestDel 145 -#define API_WUserValidate2 146 -#define API_WPrintJobSetInfo 147 -#define API_TI_NetServerDiskEnum 148 -#define API_TI_NetServerDiskGetInfo 149 -#define API_TI_FTVerifyMirror 150 -#define API_TI_FTAbortVerify 151 -#define API_TI_FTGetInfo 152 -#define API_TI_FTSetInfo 153 -#define API_TI_FTLockDisk 154 -#define API_TI_FTFixError 155 -#define API_TI_FTAbortFix 156 -#define API_TI_FTDiagnoseError 157 -#define API_TI_FTGetDriveStats 158 -#define API_TI_FTErrorGetInfo 160 -#define API_NetAccessCheck 163 -#define API_NetAlertRaise 164 -#define API_NetAlertStart 165 -#define API_NetAlertStop 166 -#define API_NetAuditWrite 167 -#define API_NetIRemoteAPI 168 -#define API_NetServiceStatus 169 -#define API_I_NetServerRegister 170 -#define API_I_NetServerDeregister 171 -#define API_I_NetSessionEntryMake 172 -#define API_I_NetSessionEntryClear 173 -#define API_I_NetSessionEntryGetInfo 174 -#define API_I_NetSessionEntrySetInfo 175 -#define API_I_NetConnectionEntryMake 176 -#define API_I_NetConnectionEntryClear 177 -#define API_I_NetConnectionEntrySetInfo 178 -#define API_I_NetConnectionEntryGetInfo 179 -#define API_I_NetFileEntryMake 180 -#define API_I_NetFileEntryClear 181 -#define API_I_NetFileEntrySetInfo 182 -#define API_I_NetFileEntryGetInfo 183 -#define API_AltSrvMessageBufferSend 184 -#define API_AltSrvMessageFileSend 185 -#define API_wI_NetRplWkstaEnum 186 -#define API_wI_NetRplWkstaGetInfo 187 -#define API_wI_NetRplWkstaSetInfo 188 -#define API_wI_NetRplWkstaAdd 189 -#define API_wI_NetRplWkstaDel 190 -#define API_wI_NetRplProfileEnum 191 -#define API_wI_NetRplProfileGetInfo 192 -#define API_wI_NetRplProfileSetInfo 193 -#define API_wI_NetRplProfileAdd 194 -#define API_wI_NetRplProfileDel 195 -#define API_wI_NetRplProfileClone 196 -#define API_wI_NetRplBaseProfileEnum 197 -#define API_WIServerSetInfo 201 -#define API_WPrintDriverEnum 205 -#define API_WPrintQProcessorEnum 206 -#define API_WPrintPortEnum 207 -#define API_WNetWriteUpdateLog 208 -#define API_WNetAccountUpdate 209 -#define API_WNetAccountConfirmUpdate 210 -#define API_WConfigSet 211 -#define API_WAccountsReplicate 212 -#define API_SamOEMChgPasswordUser2_P 214 -#define API_NetServerEnum3 215 -#define API_WprintDriverGetInfo 250 -#define API_WprintDriverSetInfo 251 -#define API_WaliasAdd 252 -#define API_WaliasDel 253 -#define API_WaliasGetInfo 254 -#define API_WaliasSetInfo 255 -#define API_WaliasEnum 256 -#define API_WuserGetLogonAsn 257 -#define API_WuserSetLogonAsn 258 -#define API_WuserGetAppSel 259 -#define API_WuserSetAppSel 260 -#define API_WappAdd 261 -#define API_WappDel 262 -#define API_WappGetInfo 263 -#define API_WappSetInfo 264 -#define API_WappEnum 265 -#define API_WUserDCDBInit 266 -#define API_WDASDAdd 267 -#define API_WDASDDel 268 -#define API_WDASDGetInfo 269 -#define API_WDASDSetInfo 270 -#define API_WDASDEnum 271 -#define API_WDASDCheck 272 -#define API_WDASDCtl 273 -#define API_WuserRemoteLogonCheck 274 -#define API_WUserPasswordSet3 275 -#define API_WCreateRIPLMachine 276 -#define API_WDeleteRIPLMachine 277 -#define API_WGetRIPLMachineInfo 278 -#define API_WSetRIPLMachineInfo 279 -#define API_WEnumRIPLMachine 280 -#define API_WI_ShareAdd 281 -#define API_WI_AliasEnum 282 -#define API_WaccessApply 283 -#define API_WPrt16Query 284 -#define API_WPrt16Set 285 -#define API_WUserDel100 286 -#define API_WUserRemoteLogonCheck2 287 -#define API_WRemoteTODSet 294 -#define API_WprintJobMoveAll 295 -#define API_W16AppParmAdd 296 -#define API_W16AppParmDel 297 -#define API_W16AppParmGet 298 -#define API_W16AppParmSet 299 -#define API_W16RIPLMachineCreate 300 -#define API_W16RIPLMachineGetInfo 301 -#define API_W16RIPLMachineSetInfo 302 -#define API_W16RIPLMachineEnum 303 -#define API_W16RIPLMachineListParmEnum 304 -#define API_W16RIPLMachClassGetInfo 305 -#define API_W16RIPLMachClassEnum 306 -#define API_W16RIPLMachClassCreate 307 -#define API_W16RIPLMachClassSetInfo 308 -#define API_W16RIPLMachClassDelete 309 -#define API_W16RIPLMachClassLPEnum 310 -#define API_W16RIPLMachineDelete 311 -#define API_W16WSLevelGetInfo 312 -#define API_WserverNameAdd 313 -#define API_WserverNameDel 314 -#define API_WserverNameEnum 315 -#define API_I_WDASDEnum 316 -#define API_I_WDASDEnumTerminate 317 -#define API_I_WDASDSetInfo2 318 -#define MAX_RAP_API 318 - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CIFS_H */ diff --git a/usr/src/uts/common/smbsrv/codepage.h b/usr/src/uts/common/smbsrv/codepage.h deleted file mode 100644 index baefb9de22..0000000000 --- a/usr/src/uts/common/smbsrv/codepage.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CODEPAGE_H -#define _SMBSRV_CODEPAGE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/string.h> -#include <smbsrv/smb_i18n.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Labels to define whether a code page table entry is an uppercase - * character, a lowercase character or neither. One of these values - * should appear in the ctype field of the code page tables. - */ -#define CODEPAGE_ISNONE 0x00 -#define CODEPAGE_ISUPPER 0x01 -#define CODEPAGE_ISLOWER 0x02 - -/* - * The structure of a code page entry. Each code page table will - * consist of an array of 256 codepage entries. - * - * ctype indicates case of the value. - * upper indicates the uppercase equivalent value. - * lower indicates the lowercase equivalent value. - */ -typedef struct codepage { - unsigned char ctype; - mts_wchar_t upper; - mts_wchar_t lower; -} codepage_t; - -/* - * Global pointer to the current code page. This is - * defaulted to a standard ASCII table. - */ -extern codepage_t usascii_codepage[]; - -/* - * This buffer is used to store the language string for display. - */ -#define CODEPAGE_BUFSIZ 48 - -extern int oem_language_set(char *language); -extern unsigned int oem_get_smb_cpid(void); -extern unsigned int oem_get_telnet_cpid(void); - -extern int codepage_isupper(int c); -extern int codepage_islower(int c); -extern int codepage_toupper(int c); -extern int codepage_tolower(int c); - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CODEPAGE_H */ diff --git a/usr/src/uts/common/smbsrv/cp_cyrillic.h b/usr/src/uts/common/smbsrv/cp_cyrillic.h deleted file mode 100644 index d3b2a27596..0000000000 --- a/usr/src/uts/common/smbsrv/cp_cyrillic.h +++ /dev/null @@ -1,312 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_CYRILLIC_H -#define _SMBSRV_CP_CYRILLIC_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for Cyrillic Character Set - * This codepage defines values for the special - * characters needed for the written alphabets of the - * following languages: Bulgarian, Byelorussian, - * Macedonian, Russian, Serbian, and pre-1990 Ukrainian - * The cyrillic character set is also known as iso-8859-5 - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t cyrillic_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISUPPER, 0x00a1, 0x00f1 }, /* 0x00a1 */ - { CODEPAGE_ISUPPER, 0x00a2, 0x00f2 }, /* 0x00a2 */ - { CODEPAGE_ISUPPER, 0x00a3, 0x00f3 }, /* 0x00a3 */ - { CODEPAGE_ISUPPER, 0x00a4, 0x00f4 }, /* 0x00a4 */ - { CODEPAGE_ISUPPER, 0x00a5, 0x00f5 }, /* 0x00a5 */ - { CODEPAGE_ISUPPER, 0x00a6, 0x00f6 }, /* 0x00a6 */ - { CODEPAGE_ISUPPER, 0x00a7, 0x00f7 }, /* 0x00a7 */ - { CODEPAGE_ISUPPER, 0x00a8, 0x00f8 }, /* 0x00a8 */ - { CODEPAGE_ISUPPER, 0x00a9, 0x00f9 }, /* 0x00a9 */ - { CODEPAGE_ISUPPER, 0x00aa, 0x00fa }, /* 0x00aa */ - { CODEPAGE_ISUPPER, 0x00ab, 0x00fb }, /* 0x00ab */ - { CODEPAGE_ISUPPER, 0x00ac, 0x00fc }, /* 0x00ac */ - { CODEPAGE_ISUPPER, 0x00ad, 0x00fd }, /* 0x00ad */ - { CODEPAGE_ISUPPER, 0x00ae, 0x00fe }, /* 0x00ae */ - { CODEPAGE_ISUPPER, 0x00af, 0x00ff }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISNONE, 0x00b1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISNONE, 0x00b3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISNONE, 0x00b5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISNONE, 0x00b6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISNONE, 0x00b9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISNONE, 0x00ba, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISNONE, 0x00bb, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISNONE, 0x00bc, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISNONE, 0x00be, 0x00be }, /* 0x00be */ - { CODEPAGE_ISNONE, 0x00bf, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISNONE, 0x00d0, 0x00d0 }, /* 0x00d0 */ - { CODEPAGE_ISNONE, 0x00d1, 0x00d1 }, /* 0x00d1 */ - { CODEPAGE_ISNONE, 0x00d2, 0x00d2 }, /* 0x00d2 */ - { CODEPAGE_ISNONE, 0x00d3, 0x00d3 }, /* 0x00d3 */ - { CODEPAGE_ISNONE, 0x00d4, 0x00d4 }, /* 0x00d4 */ - { CODEPAGE_ISNONE, 0x00d5, 0x00d5 }, /* 0x00d5 */ - { CODEPAGE_ISNONE, 0x00d6, 0x00d6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISNONE, 0x00d8, 0x00d8 }, /* 0x00d8 */ - { CODEPAGE_ISNONE, 0x00d9, 0x00d9 }, /* 0x00d9 */ - { CODEPAGE_ISNONE, 0x00da, 0x00da }, /* 0x00da */ - { CODEPAGE_ISNONE, 0x00db, 0x00db }, /* 0x00db */ - { CODEPAGE_ISNONE, 0x00dc, 0x00dc }, /* 0x00dc */ - { CODEPAGE_ISNONE, 0x00dd, 0x00dd }, /* 0x00dd */ - { CODEPAGE_ISNONE, 0x00de, 0x00de }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISNONE, 0x00f0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00a1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00a2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00a3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00a4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00a5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00a6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISLOWER, 0x00a7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00a8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00a9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00aa, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00ab, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00ac, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00ad, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00ae, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISLOWER, 0x00af, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_CYRILLIC_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin1.h b/usr/src/uts/common/smbsrv/cp_latin1.h deleted file mode 100644 index 728b28e05b..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin1.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN1_H -#define _SMBSRV_CP_LATIN1_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for the Latin-1 Character Set - * (Western Europe). This codepage defines values for - * the special characters needed for the written alphabets - * of the following Languages: French, Spanish, Catalan, - * Basque, Portuguese, Italian, Albanian, Rhaeto-Romanic, - * Dutch, German, Danish, Swedish, Norwegian, Finnish, - * Faroese, Icelandic, Irish, Scottish, English, Afrikaans - * and Swahili. - * This codepage is also used in North & South America, - * Canada, Australia, and much of Africa - * The Latin-1 character set is also Known as iso-8859-1. - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin1_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISNONE, 0x00a1, 0x00a1 }, /* 0x00a1 */ - { CODEPAGE_ISNONE, 0x00a2, 0x00a2 }, /* 0x00a2 */ - { CODEPAGE_ISNONE, 0x00a3, 0x00a3 }, /* 0x00a3 */ - { CODEPAGE_ISNONE, 0x00a4, 0x00a4 }, /* 0x00a4 */ - { CODEPAGE_ISNONE, 0x00a5, 0x00a5 }, /* 0x00a5 */ - { CODEPAGE_ISNONE, 0x00a6, 0x00a6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISNONE, 0x00a8, 0x00a8 }, /* 0x00a8 */ - { CODEPAGE_ISNONE, 0x00a9, 0x00a9 }, /* 0x00a9 */ - { CODEPAGE_ISNONE, 0x00aa, 0x00aa }, /* 0x00aa */ - { CODEPAGE_ISNONE, 0x00ab, 0x00ab }, /* 0x00ab */ - { CODEPAGE_ISNONE, 0x00ac, 0x00ac }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISNONE, 0x00ae, 0x00ae }, /* 0x00ae */ - { CODEPAGE_ISNONE, 0x00af, 0x00af }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISNONE, 0x00b1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISNONE, 0x00b3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISNONE, 0x00b5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISNONE, 0x00b6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISNONE, 0x00b9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISNONE, 0x00ba, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISNONE, 0x00bb, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISNONE, 0x00bc, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISNONE, 0x00be, 0x00be }, /* 0x00be */ - { CODEPAGE_ISNONE, 0x00bf, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISUPPER, 0x00d0, 0x00f0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISLOWER, 0x00d0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISNONE, 0x00f7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN1_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin2.h b/usr/src/uts/common/smbsrv/cp_latin2.h deleted file mode 100644 index 77f2e5a2a4..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin2.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN2_H -#define _SMBSRV_CP_LATIN2_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for the Latin-2 Character Set - * (Central & Eastern Europe). This codepage defines - * values for the special characters needed - * for the written alphabets of the following languages: Czech, - * Hungarian, Polish, Romanian, Croatian, Slovak, - * Slovenian, and Sorbian - * The Latin-2 character set is also known as iso-8859-2 - * - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin2_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISUPPER, 0x00a1, 0x00b1 }, /* 0x00a1 */ - { CODEPAGE_ISNONE, 0x00a2, 0x00a2 }, /* 0x00a2 */ - { CODEPAGE_ISUPPER, 0x00a3, 0x00b3 }, /* 0x00a3 */ - { CODEPAGE_ISNONE, 0x00a4, 0x00a4 }, /* 0x00a4 */ - { CODEPAGE_ISUPPER, 0x00a5, 0x00b5 }, /* 0x00a5 */ - { CODEPAGE_ISUPPER, 0x00a6, 0x00b6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISNONE, 0x00a8, 0x00a8 }, /* 0x00a8 */ - { CODEPAGE_ISUPPER, 0x00a9, 0x00b9 }, /* 0x00a9 */ - { CODEPAGE_ISUPPER, 0x00aa, 0x00ba }, /* 0x00aa */ - { CODEPAGE_ISUPPER, 0x00ab, 0x00bb }, /* 0x00ab */ - { CODEPAGE_ISUPPER, 0x00ac, 0x00bc }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISUPPER, 0x00ae, 0x00be }, /* 0x00ae */ - { CODEPAGE_ISUPPER, 0x00af, 0x00bf }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISLOWER, 0x00a1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISLOWER, 0x00a3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISLOWER, 0x00a5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISLOWER, 0x00a6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISLOWER, 0x00a9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISLOWER, 0x00aa, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISLOWER, 0x00ab, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISLOWER, 0x00ac, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISLOWER, 0x00ae, 0x00be }, /* 0x00be */ - { CODEPAGE_ISLOWER, 0x00af, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISUPPER, 0x00d0, 0x00f0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISLOWER, 0x00d0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISNONE, 0x00f7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN2_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin3.h b/usr/src/uts/common/smbsrv/cp_latin3.h deleted file mode 100644 index afc7ae4355..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin3.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN3_H -#define _SMBSRV_CP_LATIN3_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for Latin-3 Character Set - * This codepage defines values for the special characters - * needed for the written alphabets of the following - * languages: Esperanto and Maltese. - * The Latin-3 character set is also known as iso-8859-3 - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin3_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISUPPER, 0x00a1, 0x00b1 }, /* 0x00a1 */ - { CODEPAGE_ISNONE, 0x00a2, 0x00a2 }, /* 0x00a2 */ - { CODEPAGE_ISNONE, 0x00a3, 0x00a3 }, /* 0x00a3 */ - { CODEPAGE_ISNONE, 0x00a4, 0x00a4 }, /* 0x00a4 */ - { CODEPAGE_ISNONE, 0x00a5, 0x00a5 }, /* 0x00a5 */ - { CODEPAGE_ISUPPER, 0x00a6, 0x00b6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISNONE, 0x00a8, 0x00a8 }, /* 0x00a8 */ - { CODEPAGE_ISUPPER, 0x00a9, 0x00b9 }, /* 0x00a9 */ - { CODEPAGE_ISUPPER, 0x00aa, 0x00ba }, /* 0x00aa */ - { CODEPAGE_ISUPPER, 0x00ab, 0x00bb }, /* 0x00ab */ - { CODEPAGE_ISUPPER, 0x00ac, 0x00bc }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISNONE, 0x00ae, 0x00ae }, /* 0x00ae */ - { CODEPAGE_ISUPPER, 0x00af, 0x00bf }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISLOWER, 0x00a1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISNONE, 0x00b3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISNONE, 0x00b5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISLOWER, 0x00a6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISLOWER, 0x00a9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISLOWER, 0x00aa, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISLOWER, 0x00ab, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISLOWER, 0x00ac, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISNONE, 0x00be, 0x00be }, /* 0x00be */ - { CODEPAGE_ISLOWER, 0x00af, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISNONE, 0x00c3, 0x00c3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISNONE, 0x00d0, 0x00d0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISNONE, 0x00e3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISNONE, 0x00f0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISNONE, 0x00f7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN3_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin4.h b/usr/src/uts/common/smbsrv/cp_latin4.h deleted file mode 100644 index 87e8282510..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin4.h +++ /dev/null @@ -1,312 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN4_H -#define _SMBSRV_CP_LATIN4_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for Latin-4 Character Set. - * This codepage defines values for the special - * characters needed for the written alphabets of the - * following languages: Estonian, Baltic [Latvian & - * Lithuanian], Greenlandic, and Lappish - * The Latin-4 character set is also known as iso-8859-4 - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin4_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISUPPER, 0x00a1, 0x00b1 }, /* 0x00a1 */ - { CODEPAGE_ISNONE, 0x00a2, 0x00a2 }, /* 0x00a2 */ - { CODEPAGE_ISUPPER, 0x00a3, 0x00b3 }, /* 0x00a3 */ - { CODEPAGE_ISNONE, 0x00a4, 0x00a4 }, /* 0x00a4 */ - { CODEPAGE_ISUPPER, 0x00a5, 0x00b5 }, /* 0x00a5 */ - { CODEPAGE_ISUPPER, 0x00a6, 0x00b6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISNONE, 0x00a8, 0x00a8 }, /* 0x00a8 */ - { CODEPAGE_ISUPPER, 0x00a9, 0x00b9 }, /* 0x00a9 */ - { CODEPAGE_ISUPPER, 0x00aa, 0x00ba }, /* 0x00aa */ - { CODEPAGE_ISUPPER, 0x00ab, 0x00bb }, /* 0x00ab */ - { CODEPAGE_ISUPPER, 0x00ac, 0x00bc }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISUPPER, 0x00ae, 0x00be }, /* 0x00ae */ - { CODEPAGE_ISNONE, 0x00af, 0x00af }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISLOWER, 0x00a1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISLOWER, 0x00a3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISLOWER, 0x00a5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISLOWER, 0x00a6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISLOWER, 0x00a9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISLOWER, 0x00aa, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISLOWER, 0x00ab, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISLOWER, 0x00ac, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISLOWER, 0x00ae, 0x00be }, /* 0x00be */ - { CODEPAGE_ISNONE, 0x00bf, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISUPPER, 0x00d0, 0x00f0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISLOWER, 0x00d0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISNONE, 0x00f7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN4_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin5.h b/usr/src/uts/common/smbsrv/cp_latin5.h deleted file mode 100644 index 87ad426348..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin5.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN5_H -#define _SMBSRV_CP_LATIN5_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for the Latin-5 Character Set - * This codepage defines values for the special characters - * needed for the written alphabet of the following - * language: Turkish * The Latin-5 character set is also known as iso-8859-9. - * - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin5_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISNONE, 0x00a1, 0x00a1 }, /* 0x00a1 */ - { CODEPAGE_ISNONE, 0x00a2, 0x00a2 }, /* 0x00a2 */ - { CODEPAGE_ISNONE, 0x00a3, 0x00a3 }, /* 0x00a3 */ - { CODEPAGE_ISNONE, 0x00a4, 0x00a4 }, /* 0x00a4 */ - { CODEPAGE_ISNONE, 0x00a5, 0x00a5 }, /* 0x00a5 */ - { CODEPAGE_ISNONE, 0x00a6, 0x00a6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISNONE, 0x00a8, 0x00a8 }, /* 0x00a8 */ - { CODEPAGE_ISNONE, 0x00a9, 0x00a9 }, /* 0x00a9 */ - { CODEPAGE_ISNONE, 0x00aa, 0x00aa }, /* 0x00aa */ - { CODEPAGE_ISNONE, 0x00ab, 0x00ab }, /* 0x00ab */ - { CODEPAGE_ISNONE, 0x00ac, 0x00ac }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISNONE, 0x00ae, 0x00ae }, /* 0x00ae */ - { CODEPAGE_ISNONE, 0x00af, 0x00af }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISNONE, 0x00b1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISNONE, 0x00b2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISNONE, 0x00b3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISNONE, 0x00b4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISNONE, 0x00b5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISNONE, 0x00b6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISNONE, 0x00b8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISNONE, 0x00b9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISNONE, 0x00ba, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISNONE, 0x00bb, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISNONE, 0x00bc, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISNONE, 0x00be, 0x00be }, /* 0x00be */ - { CODEPAGE_ISNONE, 0x00bf, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISUPPER, 0x00d0, 0x00f0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISNONE, 0x00d7, 0x00d7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISLOWER, 0x00d0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISNONE, 0x00f7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN5_H */ diff --git a/usr/src/uts/common/smbsrv/cp_latin6.h b/usr/src/uts/common/smbsrv/cp_latin6.h deleted file mode 100644 index fd86d276c4..0000000000 --- a/usr/src/uts/common/smbsrv/cp_latin6.h +++ /dev/null @@ -1,309 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CP_LATIN6_H -#define _SMBSRV_CP_LATIN6_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This is the codepage for the Latin-6 Character Set. - * This codepage defines values for the special characters - * needed for the written alphabets of the following - * Nordic Languages: Greenlandic, Eskimo, Lappish, - * and Icelandic - * The Latin-6 character set is also known as iso-8859-10 - */ - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -codepage_t Latin6_codepage[256] = { - { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ - { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ - { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ - { CODEPAGE_ISNONE, 0x0003, 0x0003 }, /* 0x0003 */ - { CODEPAGE_ISNONE, 0x0004, 0x0004 }, /* 0x0004 */ - { CODEPAGE_ISNONE, 0x0005, 0x0005 }, /* 0x0005 */ - { CODEPAGE_ISNONE, 0x0006, 0x0006 }, /* 0x0006 */ - { CODEPAGE_ISNONE, 0x0007, 0x0007 }, /* 0x0007 */ - { CODEPAGE_ISNONE, 0x0008, 0x0008 }, /* 0x0008 */ - { CODEPAGE_ISNONE, 0x0009, 0x0009 }, /* 0x0009 */ - { CODEPAGE_ISNONE, 0x000a, 0x000a }, /* 0x000a */ - { CODEPAGE_ISNONE, 0x000b, 0x000b }, /* 0x000b */ - { CODEPAGE_ISNONE, 0x000c, 0x000c }, /* 0x000c */ - { CODEPAGE_ISNONE, 0x000d, 0x000d }, /* 0x000d */ - { CODEPAGE_ISNONE, 0x000e, 0x000e }, /* 0x000e */ - { CODEPAGE_ISNONE, 0x000f, 0x000f }, /* 0x000f */ - { CODEPAGE_ISNONE, 0x0010, 0x0010 }, /* 0x0010 */ - { CODEPAGE_ISNONE, 0x0011, 0x0011 }, /* 0x0011 */ - { CODEPAGE_ISNONE, 0x0012, 0x0012 }, /* 0x0012 */ - { CODEPAGE_ISNONE, 0x0013, 0x0013 }, /* 0x0013 */ - { CODEPAGE_ISNONE, 0x0014, 0x0014 }, /* 0x0014 */ - { CODEPAGE_ISNONE, 0x0015, 0x0015 }, /* 0x0015 */ - { CODEPAGE_ISNONE, 0x0016, 0x0016 }, /* 0x0016 */ - { CODEPAGE_ISNONE, 0x0017, 0x0017 }, /* 0x0017 */ - { CODEPAGE_ISNONE, 0x0018, 0x0018 }, /* 0x0018 */ - { CODEPAGE_ISNONE, 0x0019, 0x0019 }, /* 0x0019 */ - { CODEPAGE_ISNONE, 0x001a, 0x001a }, /* 0x001a */ - { CODEPAGE_ISNONE, 0x001b, 0x001b }, /* 0x001b */ - { CODEPAGE_ISNONE, 0x001c, 0x001c }, /* 0x001c */ - { CODEPAGE_ISNONE, 0x001d, 0x001d }, /* 0x001d */ - { CODEPAGE_ISNONE, 0x001e, 0x001e }, /* 0x001e */ - { CODEPAGE_ISNONE, 0x001f, 0x001f }, /* 0x001f */ - { CODEPAGE_ISNONE, 0x0020, 0x0020 }, /* 0x0020 */ - { CODEPAGE_ISNONE, 0x0021, 0x0021 }, /* 0x0021 */ - { CODEPAGE_ISNONE, 0x0022, 0x0022 }, /* 0x0022 */ - { CODEPAGE_ISNONE, 0x0023, 0x0023 }, /* 0x0023 */ - { CODEPAGE_ISNONE, 0x0024, 0x0024 }, /* 0x0024 */ - { CODEPAGE_ISNONE, 0x0025, 0x0025 }, /* 0x0025 */ - { CODEPAGE_ISNONE, 0x0026, 0x0026 }, /* 0x0026 */ - { CODEPAGE_ISNONE, 0x0027, 0x0027 }, /* 0x0027 */ - { CODEPAGE_ISNONE, 0x0028, 0x0028 }, /* 0x0028 */ - { CODEPAGE_ISNONE, 0x0029, 0x0029 }, /* 0x0029 */ - { CODEPAGE_ISNONE, 0x002a, 0x002a }, /* 0x002a */ - { CODEPAGE_ISNONE, 0x002b, 0x002b }, /* 0x002b */ - { CODEPAGE_ISNONE, 0x002c, 0x002c }, /* 0x002c */ - { CODEPAGE_ISNONE, 0x002d, 0x002d }, /* 0x002d */ - { CODEPAGE_ISNONE, 0x002e, 0x002e }, /* 0x002e */ - { CODEPAGE_ISNONE, 0x002f, 0x002f }, /* 0x002f */ - { CODEPAGE_ISNONE, 0x0030, 0x0030 }, /* 0x0030 */ - { CODEPAGE_ISNONE, 0x0031, 0x0031 }, /* 0x0031 */ - { CODEPAGE_ISNONE, 0x0032, 0x0032 }, /* 0x0032 */ - { CODEPAGE_ISNONE, 0x0033, 0x0033 }, /* 0x0033 */ - { CODEPAGE_ISNONE, 0x0034, 0x0034 }, /* 0x0034 */ - { CODEPAGE_ISNONE, 0x0035, 0x0035 }, /* 0x0035 */ - { CODEPAGE_ISNONE, 0x0036, 0x0036 }, /* 0x0036 */ - { CODEPAGE_ISNONE, 0x0037, 0x0037 }, /* 0x0037 */ - { CODEPAGE_ISNONE, 0x0038, 0x0038 }, /* 0x0038 */ - { CODEPAGE_ISNONE, 0x0039, 0x0039 }, /* 0x0039 */ - { CODEPAGE_ISNONE, 0x003a, 0x003a }, /* 0x003a */ - { CODEPAGE_ISNONE, 0x003b, 0x003b }, /* 0x003b */ - { CODEPAGE_ISNONE, 0x003c, 0x003c }, /* 0x003c */ - { CODEPAGE_ISNONE, 0x003d, 0x003d }, /* 0x003d */ - { CODEPAGE_ISNONE, 0x003e, 0x003e }, /* 0x003e */ - { CODEPAGE_ISNONE, 0x003f, 0x003f }, /* 0x003f */ - { CODEPAGE_ISNONE, 0x0040, 0x0040 }, /* 0x0040 */ - { CODEPAGE_ISUPPER, 0x0041, 0x0061 }, /* 0x0041 */ - { CODEPAGE_ISUPPER, 0x0042, 0x0062 }, /* 0x0042 */ - { CODEPAGE_ISUPPER, 0x0043, 0x0063 }, /* 0x0043 */ - { CODEPAGE_ISUPPER, 0x0044, 0x0064 }, /* 0x0044 */ - { CODEPAGE_ISUPPER, 0x0045, 0x0065 }, /* 0x0045 */ - { CODEPAGE_ISUPPER, 0x0046, 0x0066 }, /* 0x0046 */ - { CODEPAGE_ISUPPER, 0x0047, 0x0067 }, /* 0x0047 */ - { CODEPAGE_ISUPPER, 0x0048, 0x0068 }, /* 0x0048 */ - { CODEPAGE_ISUPPER, 0x0049, 0x0069 }, /* 0x0049 */ - { CODEPAGE_ISUPPER, 0x004a, 0x006a }, /* 0x004a */ - { CODEPAGE_ISUPPER, 0x004b, 0x006b }, /* 0x004b */ - { CODEPAGE_ISUPPER, 0x004c, 0x006c }, /* 0x004c */ - { CODEPAGE_ISUPPER, 0x004d, 0x006d }, /* 0x004d */ - { CODEPAGE_ISUPPER, 0x004e, 0x006e }, /* 0x004e */ - { CODEPAGE_ISUPPER, 0x004f, 0x006f }, /* 0x004f */ - { CODEPAGE_ISUPPER, 0x0050, 0x0070 }, /* 0x0050 */ - { CODEPAGE_ISUPPER, 0x0051, 0x0071 }, /* 0x0051 */ - { CODEPAGE_ISUPPER, 0x0052, 0x0072 }, /* 0x0052 */ - { CODEPAGE_ISUPPER, 0x0053, 0x0073 }, /* 0x0053 */ - { CODEPAGE_ISUPPER, 0x0054, 0x0074 }, /* 0x0054 */ - { CODEPAGE_ISUPPER, 0x0055, 0x0075 }, /* 0x0055 */ - { CODEPAGE_ISUPPER, 0x0056, 0x0076 }, /* 0x0056 */ - { CODEPAGE_ISUPPER, 0x0057, 0x0077 }, /* 0x0057 */ - { CODEPAGE_ISUPPER, 0x0058, 0x0078 }, /* 0x0058 */ - { CODEPAGE_ISUPPER, 0x0059, 0x0079 }, /* 0x0059 */ - { CODEPAGE_ISUPPER, 0x005a, 0x007a }, /* 0x005a */ - { CODEPAGE_ISNONE, 0x005b, 0x005b }, /* 0x005b */ - { CODEPAGE_ISNONE, 0x005c, 0x005c }, /* 0x005c */ - { CODEPAGE_ISNONE, 0x005d, 0x005d }, /* 0x005d */ - { CODEPAGE_ISNONE, 0x005e, 0x005e }, /* 0x005e */ - { CODEPAGE_ISNONE, 0x005f, 0x005f }, /* 0x005f */ - { CODEPAGE_ISNONE, 0x0060, 0x0060 }, /* 0x0060 */ - { CODEPAGE_ISLOWER, 0x0041, 0x0061 }, /* 0x0061 */ - { CODEPAGE_ISLOWER, 0x0042, 0x0062 }, /* 0x0062 */ - { CODEPAGE_ISLOWER, 0x0043, 0x0063 }, /* 0x0063 */ - { CODEPAGE_ISLOWER, 0x0044, 0x0064 }, /* 0x0064 */ - { CODEPAGE_ISLOWER, 0x0045, 0x0065 }, /* 0x0065 */ - { CODEPAGE_ISLOWER, 0x0046, 0x0066 }, /* 0x0066 */ - { CODEPAGE_ISLOWER, 0x0047, 0x0067 }, /* 0x0067 */ - { CODEPAGE_ISLOWER, 0x0048, 0x0068 }, /* 0x0068 */ - { CODEPAGE_ISLOWER, 0x0049, 0x0069 }, /* 0x0069 */ - { CODEPAGE_ISLOWER, 0x004a, 0x006a }, /* 0x006a */ - { CODEPAGE_ISLOWER, 0x004b, 0x006b }, /* 0x006b */ - { CODEPAGE_ISLOWER, 0x004c, 0x006c }, /* 0x006c */ - { CODEPAGE_ISLOWER, 0x004d, 0x006d }, /* 0x006d */ - { CODEPAGE_ISLOWER, 0x004e, 0x006e }, /* 0x006e */ - { CODEPAGE_ISLOWER, 0x004f, 0x006f }, /* 0x006f */ - { CODEPAGE_ISLOWER, 0x0050, 0x0070 }, /* 0x0070 */ - { CODEPAGE_ISLOWER, 0x0051, 0x0071 }, /* 0x0071 */ - { CODEPAGE_ISLOWER, 0x0052, 0x0072 }, /* 0x0072 */ - { CODEPAGE_ISLOWER, 0x0053, 0x0073 }, /* 0x0073 */ - { CODEPAGE_ISLOWER, 0x0054, 0x0074 }, /* 0x0074 */ - { CODEPAGE_ISLOWER, 0x0055, 0x0075 }, /* 0x0075 */ - { CODEPAGE_ISLOWER, 0x0056, 0x0076 }, /* 0x0076 */ - { CODEPAGE_ISLOWER, 0x0057, 0x0077 }, /* 0x0077 */ - { CODEPAGE_ISLOWER, 0x0058, 0x0078 }, /* 0x0078 */ - { CODEPAGE_ISLOWER, 0x0059, 0x0079 }, /* 0x0079 */ - { CODEPAGE_ISLOWER, 0x005a, 0x007a }, /* 0x007a */ - { CODEPAGE_ISNONE, 0x007b, 0x007b }, /* 0x007b */ - { CODEPAGE_ISNONE, 0x007c, 0x007c }, /* 0x007c */ - { CODEPAGE_ISNONE, 0x007d, 0x007d }, /* 0x007d */ - { CODEPAGE_ISNONE, 0x007e, 0x007e }, /* 0x007e */ - { CODEPAGE_ISNONE, 0x007f, 0x007f }, /* 0x007f */ - { CODEPAGE_ISNONE, 0x0080, 0x0080 }, /* 0x0080 */ - { CODEPAGE_ISNONE, 0x0081, 0x0081 }, /* 0x0081 */ - { CODEPAGE_ISNONE, 0x0082, 0x0082 }, /* 0x0082 */ - { CODEPAGE_ISNONE, 0x0083, 0x0083 }, /* 0x0083 */ - { CODEPAGE_ISNONE, 0x0084, 0x0084 }, /* 0x0084 */ - { CODEPAGE_ISNONE, 0x0085, 0x0085 }, /* 0x0085 */ - { CODEPAGE_ISNONE, 0x0086, 0x0086 }, /* 0x0086 */ - { CODEPAGE_ISNONE, 0x0087, 0x0087 }, /* 0x0087 */ - { CODEPAGE_ISNONE, 0x0088, 0x0088 }, /* 0x0088 */ - { CODEPAGE_ISNONE, 0x0089, 0x0089 }, /* 0x0089 */ - { CODEPAGE_ISNONE, 0x008a, 0x008a }, /* 0x008a */ - { CODEPAGE_ISNONE, 0x008b, 0x008b }, /* 0x008b */ - { CODEPAGE_ISNONE, 0x008c, 0x008c }, /* 0x008c */ - { CODEPAGE_ISNONE, 0x008d, 0x008d }, /* 0x008d */ - { CODEPAGE_ISNONE, 0x008e, 0x008e }, /* 0x008e */ - { CODEPAGE_ISNONE, 0x008f, 0x008f }, /* 0x008f */ - { CODEPAGE_ISNONE, 0x0090, 0x0090 }, /* 0x0090 */ - { CODEPAGE_ISNONE, 0x0091, 0x0091 }, /* 0x0091 */ - { CODEPAGE_ISNONE, 0x0092, 0x0092 }, /* 0x0092 */ - { CODEPAGE_ISNONE, 0x0093, 0x0093 }, /* 0x0093 */ - { CODEPAGE_ISNONE, 0x0094, 0x0094 }, /* 0x0094 */ - { CODEPAGE_ISNONE, 0x0095, 0x0095 }, /* 0x0095 */ - { CODEPAGE_ISNONE, 0x0096, 0x0096 }, /* 0x0096 */ - { CODEPAGE_ISNONE, 0x0097, 0x0097 }, /* 0x0097 */ - { CODEPAGE_ISNONE, 0x0098, 0x0098 }, /* 0x0098 */ - { CODEPAGE_ISNONE, 0x0099, 0x0099 }, /* 0x0099 */ - { CODEPAGE_ISNONE, 0x009a, 0x009a }, /* 0x009a */ - { CODEPAGE_ISNONE, 0x009b, 0x009b }, /* 0x009b */ - { CODEPAGE_ISNONE, 0x009c, 0x009c }, /* 0x009c */ - { CODEPAGE_ISNONE, 0x009d, 0x009d }, /* 0x009d */ - { CODEPAGE_ISNONE, 0x009e, 0x009e }, /* 0x009e */ - { CODEPAGE_ISNONE, 0x009f, 0x009f }, /* 0x009f */ - { CODEPAGE_ISNONE, 0x00a0, 0x00a0 }, /* 0x00a0 */ - { CODEPAGE_ISUPPER, 0x00a1, 0x00b1 }, /* 0x00a1 */ - { CODEPAGE_ISUPPER, 0x00a2, 0x00b2 }, /* 0x00a2 */ - { CODEPAGE_ISUPPER, 0x00a3, 0x00b3 }, /* 0x00a3 */ - { CODEPAGE_ISUPPER, 0x00a4, 0x00b4 }, /* 0x00a4 */ - { CODEPAGE_ISUPPER, 0x00a5, 0x00b5 }, /* 0x00a5 */ - { CODEPAGE_ISUPPER, 0x00a6, 0x00b6 }, /* 0x00a6 */ - { CODEPAGE_ISNONE, 0x00a7, 0x00a7 }, /* 0x00a7 */ - { CODEPAGE_ISUPPER, 0x00a8, 0x00b8 }, /* 0x00a8 */ - { CODEPAGE_ISUPPER, 0x00a9, 0x00b9 }, /* 0x00a9 */ - { CODEPAGE_ISUPPER, 0x00aa, 0x00ba }, /* 0x00aa */ - { CODEPAGE_ISUPPER, 0x00ab, 0x00bb }, /* 0x00ab */ - { CODEPAGE_ISUPPER, 0x00ac, 0x00bc }, /* 0x00ac */ - { CODEPAGE_ISNONE, 0x00ad, 0x00ad }, /* 0x00ad */ - { CODEPAGE_ISUPPER, 0x00ae, 0x00be }, /* 0x00ae */ - { CODEPAGE_ISUPPER, 0x00af, 0x00bf }, /* 0x00af */ - { CODEPAGE_ISNONE, 0x00b0, 0x00b0 }, /* 0x00b0 */ - { CODEPAGE_ISLOWER, 0x00a1, 0x00b1 }, /* 0x00b1 */ - { CODEPAGE_ISLOWER, 0x00a2, 0x00b2 }, /* 0x00b2 */ - { CODEPAGE_ISLOWER, 0x00a3, 0x00b3 }, /* 0x00b3 */ - { CODEPAGE_ISLOWER, 0x00a4, 0x00b4 }, /* 0x00b4 */ - { CODEPAGE_ISLOWER, 0x00a5, 0x00b5 }, /* 0x00b5 */ - { CODEPAGE_ISLOWER, 0x00a6, 0x00b6 }, /* 0x00b6 */ - { CODEPAGE_ISNONE, 0x00b7, 0x00b7 }, /* 0x00b7 */ - { CODEPAGE_ISLOWER, 0x00a8, 0x00b8 }, /* 0x00b8 */ - { CODEPAGE_ISLOWER, 0x00a9, 0x00b9 }, /* 0x00b9 */ - { CODEPAGE_ISLOWER, 0x00aa, 0x00ba }, /* 0x00ba */ - { CODEPAGE_ISLOWER, 0x00ab, 0x00bb }, /* 0x00bb */ - { CODEPAGE_ISLOWER, 0x00ac, 0x00bc }, /* 0x00bc */ - { CODEPAGE_ISNONE, 0x00bd, 0x00bd }, /* 0x00bd */ - { CODEPAGE_ISLOWER, 0x00ae, 0x00be }, /* 0x00be */ - { CODEPAGE_ISLOWER, 0x00af, 0x00bf }, /* 0x00bf */ - { CODEPAGE_ISUPPER, 0x00c0, 0x00e0 }, /* 0x00c0 */ - { CODEPAGE_ISUPPER, 0x00c1, 0x00e1 }, /* 0x00c1 */ - { CODEPAGE_ISUPPER, 0x00c2, 0x00e2 }, /* 0x00c2 */ - { CODEPAGE_ISUPPER, 0x00c3, 0x00e3 }, /* 0x00c3 */ - { CODEPAGE_ISUPPER, 0x00c4, 0x00e4 }, /* 0x00c4 */ - { CODEPAGE_ISUPPER, 0x00c5, 0x00e5 }, /* 0x00c5 */ - { CODEPAGE_ISUPPER, 0x00c6, 0x00e6 }, /* 0x00c6 */ - { CODEPAGE_ISUPPER, 0x00c7, 0x00e7 }, /* 0x00c7 */ - { CODEPAGE_ISUPPER, 0x00c8, 0x00e8 }, /* 0x00c8 */ - { CODEPAGE_ISUPPER, 0x00c9, 0x00e9 }, /* 0x00c9 */ - { CODEPAGE_ISUPPER, 0x00ca, 0x00ea }, /* 0x00ca */ - { CODEPAGE_ISUPPER, 0x00cb, 0x00eb }, /* 0x00cb */ - { CODEPAGE_ISUPPER, 0x00cc, 0x00ec }, /* 0x00cc */ - { CODEPAGE_ISUPPER, 0x00cd, 0x00ed }, /* 0x00cd */ - { CODEPAGE_ISUPPER, 0x00ce, 0x00ee }, /* 0x00ce */ - { CODEPAGE_ISUPPER, 0x00cf, 0x00ef }, /* 0x00cf */ - { CODEPAGE_ISNONE, 0x00d0, 0x00d0 }, /* 0x00d0 */ - { CODEPAGE_ISUPPER, 0x00d1, 0x00f1 }, /* 0x00d1 */ - { CODEPAGE_ISUPPER, 0x00d2, 0x00f2 }, /* 0x00d2 */ - { CODEPAGE_ISUPPER, 0x00d3, 0x00f3 }, /* 0x00d3 */ - { CODEPAGE_ISUPPER, 0x00d4, 0x00f4 }, /* 0x00d4 */ - { CODEPAGE_ISUPPER, 0x00d5, 0x00f5 }, /* 0x00d5 */ - { CODEPAGE_ISUPPER, 0x00d6, 0x00f6 }, /* 0x00d6 */ - { CODEPAGE_ISUPPER, 0x00d7, 0x00f7 }, /* 0x00d7 */ - { CODEPAGE_ISUPPER, 0x00d8, 0x00f8 }, /* 0x00d8 */ - { CODEPAGE_ISUPPER, 0x00d9, 0x00f9 }, /* 0x00d9 */ - { CODEPAGE_ISUPPER, 0x00da, 0x00fa }, /* 0x00da */ - { CODEPAGE_ISUPPER, 0x00db, 0x00fb }, /* 0x00db */ - { CODEPAGE_ISUPPER, 0x00dc, 0x00fc }, /* 0x00dc */ - { CODEPAGE_ISUPPER, 0x00dd, 0x00fd }, /* 0x00dd */ - { CODEPAGE_ISUPPER, 0x00de, 0x00fe }, /* 0x00de */ - { CODEPAGE_ISNONE, 0x00df, 0x00df }, /* 0x00df */ - { CODEPAGE_ISLOWER, 0x00c0, 0x00e0 }, /* 0x00e0 */ - { CODEPAGE_ISLOWER, 0x00c1, 0x00e1 }, /* 0x00e1 */ - { CODEPAGE_ISLOWER, 0x00c2, 0x00e2 }, /* 0x00e2 */ - { CODEPAGE_ISLOWER, 0x00c3, 0x00e3 }, /* 0x00e3 */ - { CODEPAGE_ISLOWER, 0x00c4, 0x00e4 }, /* 0x00e4 */ - { CODEPAGE_ISLOWER, 0x00c5, 0x00e5 }, /* 0x00e5 */ - { CODEPAGE_ISLOWER, 0x00c6, 0x00e6 }, /* 0x00e6 */ - { CODEPAGE_ISLOWER, 0x00c7, 0x00e7 }, /* 0x00e7 */ - { CODEPAGE_ISLOWER, 0x00c8, 0x00e8 }, /* 0x00e8 */ - { CODEPAGE_ISLOWER, 0x00c9, 0x00e9 }, /* 0x00e9 */ - { CODEPAGE_ISLOWER, 0x00ca, 0x00ea }, /* 0x00ea */ - { CODEPAGE_ISLOWER, 0x00cb, 0x00eb }, /* 0x00eb */ - { CODEPAGE_ISLOWER, 0x00cc, 0x00ec }, /* 0x00ec */ - { CODEPAGE_ISLOWER, 0x00cd, 0x00ed }, /* 0x00ed */ - { CODEPAGE_ISLOWER, 0x00ce, 0x00ee }, /* 0x00ee */ - { CODEPAGE_ISLOWER, 0x00cf, 0x00ef }, /* 0x00ef */ - { CODEPAGE_ISNONE, 0x00f0, 0x00f0 }, /* 0x00f0 */ - { CODEPAGE_ISLOWER, 0x00d1, 0x00f1 }, /* 0x00f1 */ - { CODEPAGE_ISLOWER, 0x00d2, 0x00f2 }, /* 0x00f2 */ - { CODEPAGE_ISLOWER, 0x00d3, 0x00f3 }, /* 0x00f3 */ - { CODEPAGE_ISLOWER, 0x00d4, 0x00f4 }, /* 0x00f4 */ - { CODEPAGE_ISLOWER, 0x00d5, 0x00f5 }, /* 0x00f5 */ - { CODEPAGE_ISLOWER, 0x00d6, 0x00f6 }, /* 0x00f6 */ - { CODEPAGE_ISLOWER, 0x00d7, 0x00f7 }, /* 0x00f7 */ - { CODEPAGE_ISLOWER, 0x00d8, 0x00f8 }, /* 0x00f8 */ - { CODEPAGE_ISLOWER, 0x00d9, 0x00f9 }, /* 0x00f9 */ - { CODEPAGE_ISLOWER, 0x00da, 0x00fa }, /* 0x00fa */ - { CODEPAGE_ISLOWER, 0x00db, 0x00fb }, /* 0x00fb */ - { CODEPAGE_ISLOWER, 0x00dc, 0x00fc }, /* 0x00fc */ - { CODEPAGE_ISLOWER, 0x00dd, 0x00fd }, /* 0x00fd */ - { CODEPAGE_ISLOWER, 0x00de, 0x00fe }, /* 0x00fe */ - { CODEPAGE_ISNONE, 0x00ff, 0x00ff } /* 0x00ff */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CP_LATIN6_H */ diff --git a/usr/src/uts/common/smbsrv/cp_unicode.h b/usr/src/uts/common/smbsrv/cp_unicode.h index e2f1eb83f9..187aadd34e 100644 --- a/usr/src/uts/common/smbsrv/cp_unicode.h +++ b/usr/src/uts/common/smbsrv/cp_unicode.h @@ -19,26 +19,24 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_CP_UNICODE_H #define _SMBSRV_CP_UNICODE_H -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #ifdef __cplusplus extern "C" { #endif struct unicode_cp { - mts_wchar_t val; - mts_wchar_t ctype; - mts_wchar_t lower; - mts_wchar_t upper; + smb_wchar_t val; + smb_wchar_t ctype; + smb_wchar_t lower; + smb_wchar_t upper; }; struct unicode_cp a_unicode[] = { diff --git a/usr/src/uts/common/smbsrv/cp_usascii.h b/usr/src/uts/common/smbsrv/cp_usascii.h index d72c28bb88..63e830ca03 100644 --- a/usr/src/uts/common/smbsrv/cp_usascii.h +++ b/usr/src/uts/common/smbsrv/cp_usascii.h @@ -19,33 +19,25 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_CP_USASCII_H #define _SMBSRV_CP_USASCII_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* - * This file specifies a codepage mapping for a given character set as - * specified below: - * - * This is the codepage for the US-ASCII Character Set - * This codepage defines values for the characters of the - * written alphabet of the English language. The US-ASCII - * character set is used in the USA. It is a proper - * subset of the Latin-1 character set. + * This file specifies the codepage mapping the US-ASCII Character Set, + * which is a subset of the Latin-1 character set. */ -#include <smbsrv/codepage.h> +#include <smbsrv/string.h> #ifdef __cplusplus extern "C" { #endif -codepage_t usascii_codepage[256] = { +smb_codepage_t usascii_codepage[256] = { { CODEPAGE_ISNONE, 0x0000, 0x0000 }, /* 0x0000 */ { CODEPAGE_ISNONE, 0x0001, 0x0001 }, /* 0x0001 */ { CODEPAGE_ISNONE, 0x0002, 0x0002 }, /* 0x0002 */ diff --git a/usr/src/uts/common/smbsrv/ctype.h b/usr/src/uts/common/smbsrv/ctype.h deleted file mode 100644 index 284db64419..0000000000 --- a/usr/src/uts/common/smbsrv/ctype.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_CTYPE_H -#define _SMBSRV_CTYPE_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/codepage.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define _mts_between(l, c, u) ((l) <= (c) && (c) <= (u)) - -/* - * These macros take non-ascii characters into account. - * Their behavior depends on the codepage that is used. - */ -#define mts_islower(c) codepage_islower((c)) -#define mts_isupper(c) codepage_isupper((c)) -#define mts_tolower(c) codepage_tolower((c)) -#define mts_toupper(c) codepage_toupper((c)) - -#define mts_isalpha(c) (mts_islower(c) || mts_isupper(c)) -#define mts_isdigit(c) _mts_between('0', (c), '9') -#define mts_isalnum(c) (mts_isalpha(c) || mts_isdigit(c)) -#define mts_isxdigit(c) (mts_isdigit(c) || \ - _mts_between('a', (c), 'f') || \ - _mts_between('A', (c), 'F')) -#define mts_isblank(c) ((c) == ' ' || (c) == '\t') -#define mts_isspace(c) ((c) == ' ' || \ - (c) == '\t' || \ - (c) == '\n' || \ - (c) == '\r' || \ - (c) == '\f') -#define mts_isascii(c) (!((c) &~ 0x7F)) - -/* These macros only apply to ASCII */ -#define mts_isalpha_ascii(c) \ - (_mts_between('a', (c), 'z') || _mts_between('A', (c), 'Z')) -#define mts_isalnum_ascii(c) (mts_isalpha_ascii(c) || mts_isdigit(c)) - -/* should it include non-ascii characters ? */ -#define mts_isprint(c) _mts_between('!', (c), '~') -#define mts_iscntrl(c) (((c) >= 0) && ((c) <= 0x1f)) || ((c) == 0x7f)) -#define mts_ispunct(c) (mts_isprint(c) && !mts_isxdigit(c) && !mts_isspace(c)) - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_CTYPE_H */ diff --git a/usr/src/uts/common/smbsrv/lm.h b/usr/src/uts/common/smbsrv/lm.h deleted file mode 100644 index e1cc28c220..0000000000 --- a/usr/src/uts/common/smbsrv/lm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - -#ifndef _SMBSRV_LM_H -#define _SMBSRV_LM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file provides global Lan Manager definitions. - */ - -#include <smbsrv/wintypes.h> -#include <syslog.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_LM_H */ diff --git a/usr/src/uts/common/smbsrv/mac_cifs.h b/usr/src/uts/common/smbsrv/mac_cifs.h index 26f0451958..767cf50cd8 100644 --- a/usr/src/uts/common/smbsrv/mac_cifs.h +++ b/usr/src/uts/common/smbsrv/mac_cifs.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_MAC_CIFS_H #define _SMBSRV_MAC_CIFS_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file provides definitions for the Macintosh Extensions for CIFS * interface (see http://www.thursby.com/cifs). @@ -42,7 +40,7 @@ extern "C" { * Macintosh information level extensions. The entire list is presented * here for convenience but for consistency with the existing CIFS * information levels don't use these values directly. Use the SMB_MAC_ - * definitions in cifs.h. + * definitions in smb.h. * * SmbTrans2QueryFsInformation: MAC_QUERY_FS_INFO * SmbTrans2Find{First|Next}2: MAC_FIND_BOTH_HFS_INFO diff --git a/usr/src/uts/common/smbsrv/mbuf.h b/usr/src/uts/common/smbsrv/mbuf.h index 562ef5168f..8f16d6f4ef 100644 --- a/usr/src/uts/common/smbsrv/mbuf.h +++ b/usr/src/uts/common/smbsrv/mbuf.h @@ -67,7 +67,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/list.h> -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #include <smbsrv/alloc.h> #ifdef __cplusplus diff --git a/usr/src/uts/common/smbsrv/msgbuf.h b/usr/src/uts/common/smbsrv/msgbuf.h index 465ba476de..66d03680f1 100644 --- a/usr/src/uts/common/smbsrv/msgbuf.h +++ b/usr/src/uts/common/smbsrv/msgbuf.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_MSGBUF_H #define _SMBSRV_MSGBUF_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Definition and interface for smb_msgbuf buffer management. The * smb_msgbuf interface is typically used to encode or decode SMB @@ -36,7 +34,7 @@ */ #include <sys/types.h> -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #ifdef __cplusplus extern "C" { diff --git a/usr/src/uts/common/smbsrv/ndl/srvsvc.ndl b/usr/src/uts/common/smbsrv/ndl/srvsvc.ndl index 5ce47c7609..f0fa0740c5 100644 --- a/usr/src/uts/common/smbsrv/ndl/srvsvc.ndl +++ b/usr/src/uts/common/smbsrv/ndl/srvsvc.ndl @@ -1299,7 +1299,7 @@ struct mslm_NetNameValidate { */ /* - * Share types for shiX_type fields - duplicated from cifs.h + * Share types for shiX_type fields - duplicated from smb.h */ #ifndef _SHARE_TYPES_DEFINED_ #define _SHARE_TYPES_DEFINED_ diff --git a/usr/src/uts/common/smbsrv/ndr.h b/usr/src/uts/common/smbsrv/ndr.h index 22d33f763f..034d877b19 100644 --- a/usr/src/uts/common/smbsrv/ndr.h +++ b/usr/src/uts/common/smbsrv/ndr.h @@ -46,7 +46,7 @@ #include <string.h> #include <smbsrv/wintypes.h> #include <smbsrv/ndl/rpcpdu.ndl> -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #endif #ifdef __cplusplus @@ -465,8 +465,8 @@ int ndr_inner_pointer(ndr_ref_t *); int ndr_inner_reference(ndr_ref_t *); int ndr_inner_array(ndr_ref_t *); -size_t ndr_mbstowcs(struct ndr_stream *, mts_wchar_t *, const char *, size_t); -int ndr_mbtowc(struct ndr_stream *, mts_wchar_t *, const char *, size_t); +size_t ndr_mbstowcs(struct ndr_stream *, smb_wchar_t *, const char *, size_t); +int ndr_mbtowc(struct ndr_stream *, smb_wchar_t *, const char *, size_t); void nds_bswap(void *src, void *dst, size_t len); diff --git a/usr/src/uts/common/smbsrv/nmpipes.h b/usr/src/uts/common/smbsrv/nmpipes.h index f0cd81cc3a..6a75fdd0f8 100644 --- a/usr/src/uts/common/smbsrv/nmpipes.h +++ b/usr/src/uts/common/smbsrv/nmpipes.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_NMPIPES_H #define _SMBSRV_NMPIPES_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file defines pre-defined and system common named pipes. * @@ -111,7 +109,7 @@ extern "C" { #define PIPE_REPL "\\PIPE\\repl" /* - * Named pipe function codes (NTDDK cifs.h). + * Named pipe function codes (NTDDK). */ #define TRANS_SET_NMPIPE_STATE 0x01 #define TRANS_RAW_READ_NMPIPE 0x11 diff --git a/usr/src/uts/common/smbsrv/oem.h b/usr/src/uts/common/smbsrv/oem.h deleted file mode 100644 index af30711dac..0000000000 --- a/usr/src/uts/common/smbsrv/oem.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* - * Support for oem <-> unicode translations. - */ - -#ifndef _SMBSRV_OEM_H -#define _SMBSRV_OEM_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <smbsrv/smb_i18n.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#define oem_default_smb_cpid OEM_CP_IND_850 -#define oem_default_telnet_cpid OEM_CP_IND_1252 -#define oem_default_language "english" - -/* - * The id should corresponds to oemcp_table in os/library/oem.c. - */ -typedef enum codepage_id { - OEM_CP_IND_850 = 0, - OEM_CP_IND_950, - OEM_CP_IND_1252, - OEM_CP_IND_949, - OEM_CP_IND_936, - OEM_CP_IND_932, - OEM_CP_IND_852, - OEM_CP_IND_1250, - OEM_CP_IND_1253, - OEM_CP_IND_737, - OEM_CP_IND_1254, - OEM_CP_IND_857, - OEM_CP_IND_1251, - OEM_CP_IND_866, - OEM_CP_IND_1255, - OEM_CP_IND_862, - OEM_CP_IND_1256, - OEM_CP_IND_720, - NO_OF_OEM_CP_INDS -} codepage_id_t; - - -typedef struct language { - char *language; - unsigned int smbIndex; - unsigned int telnetIndex; -} language; - - -/* - * cpid = the cpid of the oemcp_table that oempage_t belong to. - * value = the conversion values - */ -typedef struct oempage_t { - unsigned int cpid; - mts_wchar_t *value; -} oempage_t; - -/* - * Private functions for opmlang.c - */ -extern int oem_codepage_init(unsigned int); -extern void oem_codepage_free(unsigned int); -extern language *oem_get_lang_table(void); -extern int oem_no_of_languages(void); -#define NO_OF_LANGUAGES oem_no_of_languages() - -/* - * Public functions - */ -extern size_t unicodestooems(char *, const mts_wchar_t *, size_t, unsigned int); -extern size_t oemstounicodes(mts_wchar_t *, const char *, size_t, unsigned int); - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_OEM_H */ diff --git a/usr/src/uts/common/smbsrv/smb.h b/usr/src/uts/common/smbsrv/smb.h index 1214f041d7..af502643e6 100644 --- a/usr/src/uts/common/smbsrv/smb.h +++ b/usr/src/uts/common/smbsrv/smb.h @@ -19,43 +19,41 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_SMB_H #define _SMBSRV_SMB_H -/* - * SMB definitions and interfaces, mostly defined in the CIFS spec. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* - * SMB definitions and interfaces, mostly defined in the CIFS spec. + * SMB definitions and interfaces, mostly defined in the SMB and CIFS specs. */ - #ifdef _KERNEL #include <sys/types.h> #endif -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #include <smbsrv/msgbuf.h> +#include <smbsrv/ntstatus.h> +#include <smbsrv/nterror.h> +#include <smbsrv/doserror.h> +#include <smbsrv/ntaccess.h> -#ifdef __cplusplus -extern "C" { -#endif - +/* + * Macintosh Extensions for CIFS + */ +#include <smbsrv/mac_cifs.h> /* - * Typedefs from CIFS section 3.2 + * NT Installable File System (IFS) interface. */ -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef uint32_t ULONG; -typedef int32_t LONG; +#include <smbsrv/ntifs.h> +#ifdef __cplusplus +extern "C" { +#endif /* * The msgbuf format and length of an SMB header. @@ -65,6 +63,18 @@ typedef int32_t LONG; #define SMB_HEADER_LEN 32 #define SMB_SIG_SIZE 8 /* SMB signature size */ +#define SMB_HEADER_ED_FMT "Mbbbwbww8c2.wwww" +#define SMB_HEADER_ED_LEN (4+1+1+1+2+1+2+12+2+2+2+2) +#define SMB_TRANSHDR_ED_FMT "wwwwb.wl2.wwwwb." +#define SMB_TRANSHDR_ED_LEN (2+2+2+2+1+1+2+4+2+2+2+2+2+1+1) +#define SMB_TRANSSHDR_ED_FMT "wwwwwwwww" +#define SMB_TRANSSHDR_ED_LEN (2+2+2+2+2+2+2+2) +#define SMB_TRANS2SHDR_ED_FMT "wwwwwwwww" +#define SMB_TRANS2SHDR_ED_LEN (2+2+2+2+2+2+2+2+2) +/* There is something wrong with this. Should be 38 bytes. It is 37 bytes */ +#define SMB_NT_TRANSHDR_ED_FMT "b2.llllllllbw" +#define SMB_NT_TRANSHDR_ED_LEN (1+2+4+4+4+4+4+4+4+4+1+2) + /* * CIFS definition for the SMB header (CIFS Section 3.2). Note that the * pid_high field is not documented in the 1997 CIFS specificaction. This @@ -73,75 +83,43 @@ typedef int32_t LONG; * ready structure. */ typedef struct smb_hdr { - UCHAR protocol[4]; - UCHAR command; + uint8_t protocol[4]; + uint8_t command; union { struct { - UCHAR error_class; - UCHAR reserved; - USHORT error; + uint8_t error_class; + uint8_t reserved; + uint16_t error; } dos_error; - ULONG ntstatus; - }status; + uint32_t ntstatus; + } status; - UCHAR flags; - USHORT flags2; - USHORT pid_high; + uint8_t flags; + uint16_t flags2; + uint16_t pid_high; union { - USHORT pad[5]; + uint16_t pad[5]; struct { - USHORT reserved; - UCHAR security_sig[SMB_SIG_SIZE]; + uint16_t reserved; + uint8_t security_sig[SMB_SIG_SIZE]; } extra; } extra; - USHORT tid; - USHORT pid; - USHORT uid; - USHORT mid; + uint16_t tid; + uint16_t pid; + uint16_t uid; + uint16_t mid; } smb_hdr_t; - /* * Encoded or packed SMB header in network ready format. */ typedef struct smb_hdrbuf { - unsigned char hdr[SMB_HEADER_LEN]; + uint8_t hdr[SMB_HEADER_LEN]; } smb_hdrbuf_t; -typedef struct smb_nethdr { - uint8_t sh_protocol[4]; - uint8_t sh_command; - - union { - struct { - uint8_t sh_error_class; - uint8_t sh_reserved; - uint8_t sh_error[2]; - } dos_error; - uint8_t sh_ntstatus[4]; - } status; - - uint8_t sh_flags; - uint8_t sh_flags2[2]; - uint8_t sh_pid_high[2]; - - union { - uint8_t sh_pad[10]; - struct { - uint8_t sh_reserved[2]; - uint8_t sh_security_sig[SMB_SIG_SIZE]; - } extra; - } extra; - - uint8_t sh_tid[2]; - uint8_t sh_pid[2]; - uint8_t sh_uid[2]; - uint8_t sh_mid[2]; -} smb_nethdr_t; - /* * Protocol magic value as a 32-bit. This will be 0xff 0x53 0x4d 0x42 on * the wire. @@ -155,118 +133,1210 @@ typedef struct smb_nethdr { * month range is 1-12, and the day range is 1-31. */ typedef struct smb_date { - USHORT day : 5; - USHORT month : 4; - USHORT year : 7; + uint16_t day : 5; + uint16_t month : 4; + uint16_t year : 7; } smb_date_t; - /* * The hours range is 0-23, the minutes range is 0-59 and the two_sec * range is 0-29. */ typedef struct smb_time { - USHORT two_sec : 5; - USHORT minutes : 6; - USHORT hours : 5; + uint16_t two_sec : 5; + uint16_t minutes : 6; + uint16_t hours : 5; } smb_time_t; - /* * This is a 64-bit signed absolute time representing 100ns increments. * A positive value represents the absolute time since 1601AD. A * negative value represents a context specific relative time. */ typedef struct smb_time2 { - ULONG low_time; - LONG high_time; + uint32_t low_time; + int32_t high_time; } smb_time2_t; - /* * The number of seconds since Jan 1, 1970, 00:00:00.0. */ typedef uint32_t smb_utime_t; - #define SMB_LM_NEGOTIATE_WORDCNT 13 #define SMB_NT_NEGOTIATE_WORDCNT 17 +#define SMB_NAME83_EXTLEN 3 +#define SMB_NAME83_BASELEN 8 +#define SMB_NAME83_LEN 12 -typedef struct smb_nt_negotiate_rsp { - UCHAR word_count; - USHORT dialect_index; - UCHAR security_mode; - USHORT max_mpx; - USHORT max_vc; - ULONG max_buffer_size; - ULONG max_raw_size; - ULONG session_key; - ULONG capabilities; - ULONG time_low; - ULONG time_high; - USHORT server_tz; - UCHAR security_len; - USHORT byte_count; - UCHAR *guid; - UCHAR *challenge; - UCHAR *oem_domain; -} smb_nt_negotiate_rsp_t; - -/* - * SMB_COM_TRANSACTION - */ -typedef struct smb_transact_rsp { - UCHAR WordCount; /* Count of data bytes */ - /* value = 10 + SetupCount */ - USHORT TotalParamCount; /* Total parameter bytes being sent */ - USHORT TotalDataCount; /* Total data bytes being sent */ - USHORT Reserved; - USHORT ParamCount; /* Parameter bytes sent this buffer */ - USHORT ParamOffset; /* Offset (from hdr start) to params */ - USHORT ParamDisplacement; /* Displacement of these param bytes */ - USHORT DataCount; /* Data bytes sent this buffer */ - USHORT DataOffset; /* Offset (from hdr start) to data */ - USHORT DataDisplacement; /* Displacement of these data bytes */ - UCHAR SetupCount; /* Count of setup words */ - USHORT BCC; -#if 0 - UCHAR Reserved2; /* Reserved (pad above to word) */ - UCHAR Buffer[1]; /* Buffer containing: */ - USHORT Setup[]; /* Setup words (# = SetupWordCount) */ - USHORT ByteCount; /* Count of data bytes */ - UCHAR Pad[]; /* Pad to SHORT or LONG */ - UCHAR Params[]; /* Param. bytes (# = ParamCount) */ - UCHAR Pad1[]; /* Pad to SHORT or LONG */ - UCHAR Data[]; /* Data bytes (# = DataCount) */ -#endif -} smb_transact_rsp_t; - -/* - * SMBreadX - */ -typedef struct smb_read_andx_rsp { - UCHAR WordCount; - UCHAR AndXCmd; - UCHAR AndXReserved; - USHORT AndXOffset; - USHORT Remaining; - USHORT DataCompactionMode; - USHORT Reserved; - USHORT DataLength; - USHORT DataOffset; - ULONG DataLengthHigh; - USHORT Reserved2[3]; - USHORT ByteCount; -#if 0 - UCHAR Pad[]; - UCHAR Data[]; -#endif -} smb_read_andx_rsp_t; +/* Share types */ +#ifndef _SHARE_TYPES_DEFINED_ +#define _SHARE_TYPES_DEFINED_ +#define STYPE_DISKTREE 0x00000000 +#define STYPE_PRINTQ 0x00000001 +#define STYPE_DEVICE 0x00000002 +#define STYPE_IPC 0x00000003 +#define STYPE_MASK 0x0000000F +#define STYPE_DFS 0x00000064 +#define STYPE_HIDDEN 0x80000000 +#define STYPE_SPECIAL 0x80000000 +#endif /* _SHARE_TYPES_DEFINED_ */ + +#define STYPE_ISDSK(S) (((S) & STYPE_MASK) == STYPE_DISKTREE) +#define STYPE_ISPRN(S) (((S) & STYPE_MASK) == STYPE_PRINTQ) +#define STYPE_ISDEV(S) (((S) & STYPE_MASK) == STYPE_DEVICE) +#define STYPE_ISIPC(S) (((S) & STYPE_MASK) == STYPE_IPC) + +/* + * NtCreateAndX and NtTransactCreate creation flags: defined in CIFS + * section 4.2.2 + * + * Creation Flag Name Value Description + * ========================== ====== ================================== + * NT_CREATE_REQUEST_OPLOCK 0x02 Level I oplock requested + * NT_CREATE_REQUEST_OPBATCH 0x04 Batch oplock requested + * NT_CREATE_OPEN_TARGET_DIR 0x08 Target for open is a directory + */ +#define NT_CREATE_FLAG_REQUEST_OPLOCK 0x02 +#define NT_CREATE_FLAG_REQUEST_OPBATCH 0x04 +#define NT_CREATE_FLAG_OPEN_TARGET_DIR 0x08 + + +/* + * Define the filter flags for NtNotifyChangeDirectoryFile + */ +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 +#define FILE_NOTIFY_CHANGE_NAME 0x00000003 +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 +#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 +#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 +#define FILE_NOTIFY_CHANGE_EA 0x00000080 +#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 +#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 +#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 +#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 +#define FILE_NOTIFY_VALID_MASK 0x00000fff + + +/* + * Define the file action type codes for NtNotifyChangeDirectoryFile + */ +#define FILE_ACTION_ADDED 0x00000001 +#define FILE_ACTION_REMOVED 0x00000002 +#define FILE_ACTION_MODIFIED 0x00000003 +#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 +#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 +#define FILE_ACTION_ADDED_STREAM 0x00000006 +#define FILE_ACTION_REMOVED_STREAM 0x00000007 +#define FILE_ACTION_MODIFIED_STREAM 0x00000008 + + +/* Lock type flags */ +#define LOCKING_ANDX_NORMAL_LOCK 0x00 +#define LOCKING_ANDX_SHARED_LOCK 0x01 +#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 +#define LOCKING_ANDX_CHANGE_LOCK_TYPE 0x04 +#define LOCKING_ANDX_CANCEL_LOCK 0x08 +#define LOCKING_ANDX_LARGE_FILES 0x10 + +#define SMB_COM_CREATE_DIRECTORY 0x00 +#define SMB_COM_DELETE_DIRECTORY 0x01 +#define SMB_COM_OPEN 0x02 +#define SMB_COM_CREATE 0x03 +#define SMB_COM_CLOSE 0x04 +#define SMB_COM_FLUSH 0x05 +#define SMB_COM_DELETE 0x06 +#define SMB_COM_RENAME 0x07 +#define SMB_COM_QUERY_INFORMATION 0x08 +#define SMB_COM_SET_INFORMATION 0x09 +#define SMB_COM_READ 0x0A +#define SMB_COM_WRITE 0x0B +#define SMB_COM_LOCK_BYTE_RANGE 0x0C +#define SMB_COM_UNLOCK_BYTE_RANGE 0x0D +#define SMB_COM_CREATE_TEMPORARY 0x0E +#define SMB_COM_CREATE_NEW 0x0F +#define SMB_COM_CHECK_DIRECTORY 0x10 +#define SMB_COM_PROCESS_EXIT 0x11 +#define SMB_COM_SEEK 0x12 +#define SMB_COM_LOCK_AND_READ 0x13 +#define SMB_COM_WRITE_AND_UNLOCK 0x14 + +#define SMB_COM_READ_RAW 0x1A +#define SMB_COM_READ_MPX 0x1B +#define SMB_COM_READ_MPX_SECONDARY 0x1C +#define SMB_COM_WRITE_RAW 0x1D +#define SMB_COM_WRITE_MPX 0x1E +#define SMB_COM_WRITE_MPX_SECONDARY 0x1F +#define SMB_COM_WRITE_COMPLETE 0x20 + +#define SMB_COM_SET_INFORMATION2 0x22 +#define SMB_COM_QUERY_INFORMATION2 0x23 +#define SMB_COM_LOCKING_ANDX 0x24 +#define SMB_COM_TRANSACTION 0x25 +#define SMB_COM_TRANSACTION_SECONDARY 0x26 +#define SMB_COM_IOCTL 0x27 +#define SMB_COM_IOCTL_SECONDARY 0x28 +#define SMB_COM_COPY 0x29 +#define SMB_COM_MOVE 0x2A +#define SMB_COM_ECHO 0x2B +#define SMB_COM_WRITE_AND_CLOSE 0x2C +#define SMB_COM_OPEN_ANDX 0x2D +#define SMB_COM_READ_ANDX 0x2E +#define SMB_COM_WRITE_ANDX 0x2F + +#define SMB_COM_CLOSE_AND_TREE_DISC 0x31 +#define SMB_COM_TRANSACTION2 0x32 +#define SMB_COM_TRANSACTION2_SECONDARY 0x33 +#define SMB_COM_FIND_CLOSE2 0x34 +#define SMB_COM_FIND_NOTIFY_CLOSE 0x35 + +#define SMB_COM_TREE_CONNECT 0x70 +#define SMB_COM_TREE_DISCONNECT 0x71 +#define SMB_COM_NEGOTIATE 0x72 +#define SMB_COM_SESSION_SETUP_ANDX 0x73 +#define SMB_COM_LOGOFF_ANDX 0x74 +#define SMB_COM_TREE_CONNECT_ANDX 0x75 + +#define SMB_COM_QUERY_INFORMATION_DISK 0x80 +#define SMB_COM_SEARCH 0x81 +#define SMB_COM_FIND 0x82 +#define SMB_COM_FIND_UNIQUE 0x83 +#define SMB_COM_FIND_CLOSE 0x84 + +#define SMB_COM_NT_TRANSACT 0xA0 +#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 +#define SMB_COM_NT_CREATE_ANDX 0xA2 +#define SMB_COM_NT_CANCEL 0xA4 + +#define SMB_COM_OPEN_PRINT_FILE 0xC0 +#define SMB_COM_WRITE_PRINT_FILE 0xC1 +#define SMB_COM_CLOSE_PRINT_FILE 0xC2 +#define SMB_COM_GET_PRINT_QUEUE 0xC3 + + +/* + * Flags field of the SMB header. The names in parenthesis represent + * alternative names for the flags. + * + * SMB_FLAGS_LOCK_AND_READ_OK If the server supports LockAndRead and + * (SMB_FLAGS_LOCKS_SUBDIALECT) WriteAndUnlock, it sets this bit in the + * Negotiate response. + * + * SMB_FLAGS_SEND_NO_ACK When on, the client guarantees that there + * (SMB_FLAGS_RCV_BUF_POSTED) is a receive buffer posted such that a + * "Send-No-Ack" can be used by the server + * to respond to the client's request. + * + * SMB_FLAGS_CASE_INSENSITIVE This is part of the Flags field of every + * SMB header. If this bit is set, then all + * pathnames in the SMB should be treated as + * case-insensitive. Otherwise pathnames are + * case-sensitive. + * + * SMB_FLAGS_CANONICALIZED_PATHS When on in SessionSetupX, this indicates + * that all paths sent to the server are + * already in OS/2 canonicalized format. + * + * OS/2 canonical format means that file/directory names are in upper case, + * are valid characters, . and .. have been removed and single backslashes + * are used as separators. + * + * SMB_FLAGS_OPLOCK When set in an open file request SMBs + * (Open, Create, OpenX, etc.) this bit + * indicates a request for an oplock on the + * file. When set in the response, this bit + * indicates that the oplock was granted. + * + * SMB_FLAGS_OPLOCK_NOTIFY_ANY When on, this bit indicates that the server + * should notify the client on any request + * that could cause the file to be changed. + * If not set, the server only notifies the + * client on other open requests on the file. + * This bit is only relevant when + * SMB_FLAGS_OPLOCK is set. + * + * SMB_FLAGS_SERVER_TO_REDIR This bit indicates that the SMB is being + * (SMB_FLAGS_REPLY) sent from server to (client) redirector. + */ +#define SMB_FLAGS_LOCK_AND_READ_OK 0x01 +#define SMB_FLAGS_SEND_NO_ACK 0x02 +#define SMB_FLAGS_RESERVED 0x04 +#define SMB_FLAGS_CASE_INSENSITIVE 0x08 +#define SMB_FLAGS_CANONICALIZED_PATHS 0x10 +#define SMB_FLAGS_OPLOCK 0x20 +#define SMB_FLAGS_OPLOCK_NOTIFY_ANY 0x40 +#define SMB_FLAGS_REPLY 0x80 + + +/* + * Flags2 field of the SMB header. + */ +#define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001 +#define SMB_FLAGS2_KNOWS_EAS 0x0002 +#define SMB_FLAGS2_SMB_SECURITY_SIGNATURE 0x0004 +#define SMB_FLAGS2_IS_LONG_NAME 0x0040 +#define SMB_FLAGS2_REPARSE_PATH 0x0400 +#define SMB_FLAGS2_EXT_SEC 0x0800 +#define SMB_FLAGS2_DFS 0x1000 +#define SMB_FLAGS2_PAGING_IO 0x2000 +#define SMB_FLAGS2_NT_STATUS 0x4000 +#define SMB_FLAGS2_UNICODE 0x8000 + +#define DIALECT_UNKNOWN 0 +#define PC_NETWORK_PROGRAM_1_0 1 /* The original MSNET SMB protocol */ +#define PCLAN1_0 2 /* Some versions of the original MSNET */ +#define MICROSOFT_NETWORKS_1_03 3 /* This is used for the MS-NET 1.03 */ +#define MICROSOFT_NETWORKS_3_0 4 /* This is the DOS LANMAN 1.0 specific */ +#define LANMAN1_0 5 /* This is the first version of the full */ +#define LM1_2X002 6 /* This is the first version of the full */ +#define DOS_LM1_2X002 7 /* This is the dos equivalent of the */ +#define DOS_LANMAN2_1 8 /* DOS LANMAN2.1 */ +#define LANMAN2_1 9 /* OS/2 LANMAN2.1 */ +#define Windows_for_Workgroups_3_1a 10 /* Windows for Workgroups Version 1.0 */ +#define NT_LM_0_12 11 /* The SMB protocol designed for NT */ + +/* + * SMB_TREE_CONNECT_ANDX OptionalSupport flags + * + * SMB_SUPPORT_SEARCH_BITS The server supports SearchAttributes. + * SMB_SHARE_IS_IN_DFS The share is managed by DFS. + * SMB_CSC_MASK Offline-caching mask - see CSC values. + * SMB_UNIQUE_FILE_NAME The server uses long names and does not support + * short names. This indicates to clients that + * they may perform directory name-space caching. + * SMB_EXTENDED_SIGNATURES The server will use signing key protection. + * + * SMB_CSC_CACHE_MANUAL_REINT Clients are allowed to cache files for offline + * use as requested by users but automatic + * file-by-file reintegration is not allowed. + * SMB_CSC_CACHE_AUTO_REINT Clients are allowed to automatically cache + * files for offline use and file-by-file + * reintegration is allowed. + * SMB_CSC_CACHE_VDO Clients are allowed to automatically cache files + * for offline use, file-by-file reintegration is + * allowed and clients are permitted to work from + * their local cache even while offline. + * SMB_CSC_CACHE_NONE Client-side caching is disabled for this share. + * + * SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM + * The server will filter directory entries based + * on the access permissions of the client. + */ +#define SMB_SUPPORT_SEARCH_BITS 0x0001 +#define SMB_SHARE_IS_IN_DFS 0x0002 +#define SMB_CSC_MASK 0x000C +#define SMB_UNIQUE_FILE_NAME 0x0010 +#define SMB_EXTENDED_SIGNATURES 0x0020 + +#define SMB_CSC_CACHE_MANUAL_REINT 0x0000 +#define SMB_CSC_CACHE_AUTO_REINT 0x0004 +#define SMB_CSC_CACHE_VDO 0x0008 +#define SMB_CSC_CACHE_NONE 0x000C + +#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x0800 + +/* + * The subcommand codes, placed in SETUP[0], for named pipe operations are: + * SubCommand Code Value Description + * =================== ===== ========================================= + */ + +#define CallNamedPipe 0x54 /* open/write/read/close pipe */ +#define WaitNamedPipe 0x53 /* wait for pipe to be nonbusy */ +#define PeekNmPipe 0x23 /* read but don't remove data */ +#define QNmPHandState 0x21 /* query pipe handle modes */ +#define SetNmPHandState 0x01 /* set pipe handle modes */ +#define QNmPipeInfo 0x22 /* query pipe attributes */ +#define TransactNmPipe 0x26 /* write/read operation on pipe */ +#define RawReadNmPipe 0x11 /* read pipe in "raw" (non message mode) */ +#define RawWriteNmPipe 0x31 /* write pipe "raw" (non message mode) */ + + + +/* + * Setup[0] Transaction2 Value Description + * Subcommand Code + * ========================== ===== ============================= + */ + +#define TRANS2_OPEN2 0x00 /* Create file, extended attributes */ +#define TRANS2_FIND_FIRST2 0x01 /* Begin search for files */ +#define TRANS2_FIND_NEXT2 0x02 /* Resume search for files */ +#define TRANS2_QUERY_FS_INFORMATION 0x03 /* Get file system information */ +#define _TRANS2_RESV_0x04 0x04 /* Reserved */ +#define TRANS2_QUERY_PATH_INFORMATION 0x05 /* Get info, named file or dir */ +#define TRANS2_SET_PATH_INFORMATION 0x06 /* Set info, named file or dir */ +#define TRANS2_QUERY_FILE_INFORMATION 0x07 /* Get info, handle */ +#define TRANS2_SET_FILE_INFORMATION 0x08 /* Set info, handle */ +#define TRANS2_FSCTL 0x09 /* Not implemented by NT server */ +#define TRANS2_IOCTL2 0x0A /* Not implemented by NT server */ +#define TRANS2_FIND_NOTIFY_FIRST 0x0B /* Not implemented by NT server */ +#define TRANS2_FIND_NOTIFY_NEXT 0x0C /* Not implemented by NT server */ +#define TRANS2_CREATE_DIRECTORY 0x0D /* Create dir, extended attributes */ +#define TRANS2_SESSION_SETUP 0x0E /* Session setup, extended security */ +#define TRANS2_GET_DFS_REFERRAL 0x10 /* Get a Dfs referral */ +#define TRANS2_REPORT_DFS_INCONSISTENCY 0x11 /* Report a Dfs inconsistency */ + +/* + * Access Mode Encoding (CIFS/1.0 1996 Section 3.8). + * + * The desired access mode passed in SmbOpen and SmbOpenAndX has the following + * mapping: + * + * 1111 11 + * 5432 1098 7654 3210 + * rWrC rLLL rSSS rAAA + * + * where: + * + * W - Write through mode. No read ahead or write behind allowed on + * this file or device. When protocol is returned, data is expected + * to be on the disk or device. + * + * S - Sharing mode: + * 0 - Compatibility mode (as in core open) + * 1 - Deny read/write/execute (exclusive) + * 2 - Deny write + * 3 - Deny read/execute + * 4 - Deny none + * + * A - Access mode + * 0 - Open for reading + * 1 - Open for writing + * 2 - Open for reading and writing + * 3 - Open for execute + * + * rSSSrAAA = 11111111 (hex FF) indicates FCB open (as in core protocol) + * + * C - Cache mode + * 0 - Normal file + * 1 - Do not cache this file + * + * L - Locality of reference + * 0 - Locality of reference is unknown + * 1 - Mainly sequential access + * 2 - Mainly random access + * 3 - Random access with some locality + * 4 to 7 - Currently undefined + */ + + +#define SMB_DA_SHARE_MASK 0x70 +#define SMB_DA_ACCESS_MASK 0x07 +#define SMB_DA_FCB_MASK (UCHAR)0xFF + +#define SMB_DA_ACCESS_READ 0x00 +#define SMB_DA_ACCESS_WRITE 0x01 +#define SMB_DA_ACCESS_READ_WRITE 0x02 +#define SMB_DA_ACCESS_EXECUTE 0x03 + +#define SMB_DA_SHARE_COMPATIBILITY 0x00 +#define SMB_DA_SHARE_EXCLUSIVE 0x10 +#define SMB_DA_SHARE_DENY_WRITE 0x20 +#define SMB_DA_SHARE_DENY_READ 0x30 +#define SMB_DA_SHARE_DENY_NONE 0x40 + +#define SMB_DA_FCB (UCHAR)0xFF + +#define SMB_CACHE_NORMAL 0x0000 +#define SMB_DO_NOT_CACHE 0x1000 + +#define SMB_LR_UNKNOWN 0x0000 +#define SMB_LR_SEQUENTIAL 0x0100 +#define SMB_LR_RANDOM 0x0200 +#define SMB_LR_RANDOM_WITH_LOCALITY 0x0300 +#define SMB_LR_MASK 0x0F00 + +#define SMB_DA_WRITE_THROUGH 0x4000 + +/* + * Macros used for share reservation rule checking + */ + +#define SMB_DENY_READ(share_access) ((share_access & FILE_SHARE_READ) == 0) + +#define SMB_DENY_WRITE(share_access) ((share_access & FILE_SHARE_WRITE) == 0) + +#define SMB_DENY_DELETE(share_access) ((share_access & FILE_SHARE_DELETE) == 0) + +#define SMB_DENY_RW(share_access) \ + ((share_access & (FILE_SHARE_READ | FILE_SHARE_WRITE)) == 0) + +#define SMB_DENY_ALL(share_access) (share_access == 0) + +#define SMB_DENY_NONE(share_access) (share_access == FILE_SHARE_ALL) + +/* + * The SMB open function determines what action should be taken depending + * on the existence or lack thereof of files used in the operation. It + * has the following mapping: + * + * 1111 1 + * 5432 1098 7654 3210 + * rrrr rrrr rrrC rrOO + * + * where: + * + * O - Open (action to be taken if the target file exists) + * 0 - Fail + * 1 - Open or Append file + * 2 - Truncate file + * + * C - Create (action to be taken if the target file does not exist) + * 0 - Fail + * 1 - Create file + */ + +#define SMB_OFUN_OPEN_MASK 0x3 +#define SMB_OFUN_CREATE_MASK 0x10 + +#define SMB_OFUN_OPEN_FAIL 0 +#define SMB_OFUN_OPEN_APPEND 1 +#define SMB_OFUN_OPEN_OPEN 1 +#define SMB_OFUN_OPEN_TRUNCATE 2 + +#define SMB_OFUN_CREATE_FAIL 0x00 +#define SMB_OFUN_CREATE_CREATE 0x10 + +/* + * The Action field of OpenAndX has the following format: + * + * 1111 11 + * 5432 1098 7654 3210 + * Lrrr rrrr rrrr rrOO + * + * where: + * + * L - Opportunistic lock. 1 if lock granted, else 0. + * + * O - Open action: + * 1 - The file existed and was opened + * 2 - The file did not exist but was created + * 3 - The file existed and was truncated + */ + +#define SMB_OACT_LOCK 0x8000 +#define SMB_OACT_OPENED 0x01 +#define SMB_OACT_CREATED 0x02 +#define SMB_OACT_TRUNCATED 0x03 + +#define SMB_OACT_OPLOCK 0x8000 + +#define SMB_FTYPE_DISK 0 +#define SMB_FTYPE_BYTE_PIPE 1 +#define SMB_FTYPE_MESG_PIPE 2 +#define SMB_FTYPE_PRINTER 3 +#define SMB_FTYPE_UNKNOWN 0xFFFF + +#define SMB_DEVST_BLOCKING 0x8000 +#define SMB_DEVST_ENDPOINT 0x4000 +#define SMB_DEVST_TYPE_MASK 0x0C00 +#define SMB_DEVST_TYPE_BYTE_PIPE 0x0000 +#define SMB_DEVST_TYPE_MESG_PIPE 0x0400 +#define SMB_DEVST_RMODE_MASK 0x0300 +#define SMB_DEVST_RMODE_BYTES 0x0000 +#define SMB_DEVST_RMODE_MESGS 0x0100 +#define SMB_DEVST_ICOUNT_MASK 0x00FF /* not used */ + +#define SMB_FTYPE_IS_DISK(F) ((F) == SMB_FTYPE_DISK) +#define SMB_FTYPE_IS_PIPE(F) \ + (((F) == SMB_FTYPE_BYTE_PIPE) || ((F) == SMB_FTYPE_MESG_PIPE)) +#define SMB_FTYPE_IS_PRINTER(F) ((F) == SMB_FTYPE_PRINTER) + +/* + * TRANS2_FIND + */ +#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 +#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 +#define SMB_FIND_FILE_NAMES_INFO 0x103 +#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 +#define SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO 0x105 +#define SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO 0x106 +#define SMB_MAC_FIND_BOTH_HFS_INFO MAC_FIND_BOTH_HFS_INFO + + +/* + * Flags for TRANS2_FIND_FIRST2 and TRANS2_FIND_NEXT2 (NTDDK). + * + * If SMB_FIND_RETURN_RESUME_KEYS was set in the request parameters, + * each entry is preceded by a four-byte resume key. + */ +#define SMB_FIND_CLOSE_AFTER_REQUEST 0x01 +#define SMB_FIND_CLOSE_AT_EOS 0x02 +#define SMB_FIND_RETURN_RESUME_KEYS 0x04 +#define SMB_FIND_CONTINUE_FROM_LAST 0x08 +#define SMB_FIND_WITH_BACKUP_INTENT 0x10 + + +/* + * TRANS2_QUERY_FS_INFORMATION + */ +#define SMB_INFO_ALLOCATION 1 +#define SMB_INFO_VOLUME 2 +#define SMB_QUERY_FS_LABEL_INFO 0x101 +#define SMB_QUERY_FS_VOLUME_INFO 0x102 +#define SMB_QUERY_FS_SIZE_INFO 0x103 +#define SMB_QUERY_FS_DEVICE_INFO 0x104 +#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 +#define SMB_QUERY_FS_QUOTA_INFO 0x106 /* unused? */ +#define SMB_QUERY_FS_CONTROL_INFO 0x107 +#define SMB_MAC_QUERY_FS_INFO MAC_QUERY_FS_INFO + + +/* + * Internal use only. + * Define information levels to represent the following requests: + * smb_query_information + * smb_query_information2 + * smb_set_information + * smb_set_information2 + */ +#define SMB_QUERY_INFORMATION 0x3001 +#define SMB_QUERY_INFORMATION2 0x3002 +#define SMB_SET_INFORMATION 0x3001 +#define SMB_SET_INFORMATION2 0x3002 + +/* TRANS2_QUERY_{PATH,FILE}_INFORMATION */ +#define SMB_INFO_STANDARD 1 /* query, set */ +#define SMB_INFO_QUERY_EA_SIZE 2 /* query */ +#define SMB_INFO_SET_EAS 2 /* set */ +#define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* query */ +#define SMB_INFO_QUERY_ALL_EAS 4 /* query */ +#define SMB_INFO_QUERY_FULL_NAME 5 /* unused */ +#define SMB_INFO_IS_NAME_VALID 6 /* query */ + +#define SMB_QUERY_FILE_BASIC_INFO 0x101 +#define SMB_QUERY_FILE_STANDARD_INFO 0x102 +#define SMB_QUERY_FILE_EA_INFO 0x103 +#define SMB_QUERY_FILE_NAME_INFO 0x104 +#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 /* unused */ +#define SMB_QUERY_FILE_END_OF_FILE_INFO 0x106 /* unused */ +#define SMB_QUERY_FILE_ALL_INFO 0x107 +#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 +#define SMB_QUERY_FILE_STREAM_INFO 0x109 +#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B + +#define SMB_MAC_SET_FINDER_INFO MAC_SET_FINDER_INFO +#define SMB_MAC_DT_ADD_APPL MAC_DT_ADD_APPL +#define SMB_MAC_DT_REMOVE_APPL MAC_DT_REMOVE_APPL +#define SMB_MAC_DT_GET_APPL MAC_DT_GET_APPL +#define SMB_MAC_DT_GET_ICON MAC_DT_GET_ICON +#define SMB_MAC_DT_GET_ICON_INFO MAC_DT_GET_ICON_INFO +#define SMB_MAC_DT_ADD_ICON MAC_DT_ADD_ICON + +#define SMB_SET_FILE_BASIC_INFO 0x101 +#define SMB_SET_FILE_DISPOSITION_INFO 0x102 +#define SMB_SET_FILE_ALLOCATION_INFO 0x103 +#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 + + +/* NT passthrough levels - see ntifs.h FILE_INFORMATION_CLASS */ +#define SMB_FILE_BASIC_INFORMATION 1004 +#define SMB_FILE_STANDARD_INFORMATION 1005 +#define SMB_FILE_INTERNAL_INFORMATION 1006 +#define SMB_FILE_EA_INFORMATION 1007 +#define SMB_FILE_ACCESS_INFORMATION 1008 +#define SMB_FILE_NAME_INFORMATION 1009 +#define SMB_FILE_RENAME_INFORMATION 1010 +#define SMB_FILE_LINK_INFORMATION 1011 +#define SMB_FILE_DISPOSITION_INFORMATION 1013 +#define SMB_FILE_ALL_INFORMATION 1018 +#define SMB_FILE_ALLOCATION_INFORMATION 1019 +#define SMB_FILE_END_OF_FILE_INFORMATION 1020 +#define SMB_FILE_ALT_NAME_INFORMATION 1021 +#define SMB_FILE_STREAM_INFORMATION 1022 +#define SMB_FILE_COMPRESSION_INFORMATION 1028 +#define SMB_FILE_ATTR_TAG_INFORMATION 1035 + +/* + * The following bits may be set in the SecurityMode field of the + * SMB_COM_NEGOTIATE response. + * + * Notes: + * NEGOTIATE_SECURITY_SHARE_LEVEL is a montana2 invention. + * + * The NTDDK definitions are: + * #define NEGOTIATE_USER_SECURITY 0x01 + * #define NEGOTIATE_ENCRYPT_PASSWORDS 0x02 + * #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 + * #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 + */ +#define NEGOTIATE_SECURITY_SHARE_LEVEL 0x00 +#define NEGOTIATE_SECURITY_USER_LEVEL 0x01 +#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02 +#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 +#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 + + +/* + * Negotiated Capabilities (CIFS/1.0 section 4.1.1) + * + * Capabilities allow the server to tell the client what it supports. + * Undefined bits MUST be set to zero by servers, and MUST be ignored + * by clients. The bit definitions are: + * + * Capability Name Encoding Meaning + * ==================== ======== ================================== + * CAP_RAW_MODE 0x0001 The server supports SMB_COM_READ_RAW and + * SMB_COM_WRITE_RAW (obsolescent) + * CAP_MPX_MODE 0x0002 The server supports SMB_COM_READ_MPX and + * SMB_COM_WRITE_MPX (obsolescent) + * CAP_UNICODE 0x0004 The server supports Unicode strings + * CAP_LARGE_FILES 0x0008 The server supports large files with 64 + * bit offsets + * CAP_NT_SMBS 0x0010 The server supports the SMBs particular + * to the NT LM 0.12 dialect. + * Implies CAP_NT_FIND. + * CAP_RPC_REMOTE_APIS 0x0020 The server supports remote admin API + * requests via DCE RPC + * CAP_STATUS32 0x0040 The server can respond with 32 bit + * status codes in Status.Status + * CAP_LEVEL_II_OPLOCKS 0x0080 The server supports level 2 oplocks + * CAP_LOCK_AND_READ 0x0100 The server supports the + * SMB_COM_LOCK_AND_READ SMB + * CAP_NT_FIND 0x0200 + * CAP_BULK_TRANSFER 0x0400 + * CAP_COMPRESSED_BULK 0x0800 + * CAP_DFS 0x1000 The server is DFS aware + * CAP_LARGE_READX 0x4000 The server supports large + * SMB_COM_READ_ANDX + * CAP_LARGE_WRITEX 0x8000 The server supports large + * SMB_COM_WRITE_ANDX + * CAP_RESERVED 0x02000000 Reserved for future use. + * CAP_EXTENDED_SECURITY 0x80000000 The server supports extended security + * exchanges. + * + * Extended security exchanges provides a means of supporting arbitrary + * authentication protocols within CIFS. Security blobs are opaque to the + * CIFS protocol; they are messages in some authentication protocol that + * has been agreed upon by client and server by some out of band mechanism, + * for which CIFS merely functions as a transport. When + * CAP_EXTENDED_SECURITY is negotiated, the server includes a first + * security blob in its response; subsequent security blobs are exchanged + * in SMB_COM_SESSION_SETUP_ANDX requests and responses until the + * authentication protocol terminates. + */ +#define CAP_RAW_MODE 0x0001 +#define CAP_MPX_MODE 0x0002 +#define CAP_UNICODE 0x0004 +#define CAP_LARGE_FILES 0x0008 +#define CAP_NT_SMBS 0x0010 +#define CAP_RPC_REMOTE_APIS 0x0020 +#define CAP_STATUS32 0x0040 +#define CAP_LEVEL_II_OPLOCKS 0x0080 +#define CAP_LOCK_AND_READ 0x0100 +#define CAP_NT_FIND 0x0200 +#define CAP_BULK_TRANSFER 0x0400 +#define CAP_COMPRESSED_BULK 0x0800 +#define CAP_DFS 0x1000 +#define CAP_LARGE_READX 0x4000 +#define CAP_LARGE_WRITEX 0x8000 +#define CAP_RESERVED 0x02000000 +#define CAP_EXTENDED_SECURITY 0x80000000 + + +/* + * Different device types according to NT + */ +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000a +#define FILE_DEVICE_KEYBOARD 0x0000000b +#define FILE_DEVICE_MAILSLOT 0x0000000c +#define FILE_DEVICE_MIDI_IN 0x0000000d +#define FILE_DEVICE_MIDI_OUT 0x0000000e +#define FILE_DEVICE_MOUSE 0x0000000f +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a +#define FILE_DEVICE_SERIAL_PORT 0x0000001b +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_STREAMS 0x0000001e +#define FILE_DEVICE_TAPE 0x0000001f +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002a +#define FILE_DEVICE_MODEM 0x0000002b +#define FILE_DEVICE_VDM 0x0000002c + +/* + * Some of these device types are not currently accessible over the network + * and may never be accessible over the network. Some may change to be + * + * accessible over the network. The values for device types that may never + * be accessible over the network may be redefined to be just reserved at + * some date in the future. + * + * Characteristics is the sum of any of the following: + */ + +#define FILE_REMOVABLE_MEDIA 0x00000001 +#define FILE_READ_ONLY_DEVICE 0x00000002 +#define FILE_FLOPPY_DISKETTE 0x00000004 +#define FILE_WRITE_ONE_MEDIA 0x00000008 +#define FILE_REMOTE_DEVICE 0x00000010 +#define FILE_DEVICE_IS_MOUNTED 0x00000020 +#define FILE_VIRTUAL_VOLUME 0x00000040 + +/* + * CREATE_ANDX ShareAccess Flags + */ + +#define FILE_SHARE_NONE 0x00000000 +#define FILE_SHARE_READ 0x00000001 +#define FILE_SHARE_WRITE 0x00000002 +#define FILE_SHARE_DELETE 0x00000004 +#define FILE_SHARE_ALL 0x00000007 +#define FILE_SHARE_VALID_FLAGS 0x00000007 + + +/* + * CREATE_ANDX CreateDisposition flags + * + * FILE_SUPERSEDE If the file already exists it should be superseded + * by the specified file. If the file does not already + * exist then it should be created. + * + * FILE_CREATE If the file already exists the operation should fail. + * If the file does not already exist then it should be + * created. (aka CREATE_NEW) + * + * FILE_OPEN If the file already exists then it should be opened. + * If the file does not already exist then the operation + * should fail. (aka OPEN_EXISTING) + * + * FILE_OPEN_IF If the file already exists then it should be opened. + * If the file does not already exist then it should be + * created. (aka OPEN_ALWAYS) + * + * FILE_OVERWRITE If the file already exists, it should be opened and + * overwritten. If the file does not already exist then + * the operation should fail. (aka TRUNCATE_EXISTING) + * + * FILE_OVERWRITE_IF If the file already exists, it should be opened and + * overwritten. If the file does not already exist then + * it should be created. (aka CREATE_ALWAYS) + */ +#define FILE_SUPERSEDE 0x00000000 +#define FILE_OPEN 0x00000001 +#define FILE_CREATE 0x00000002 +#define FILE_OPEN_IF 0x00000003 +#define FILE_OVERWRITE 0x00000004 +#define FILE_OVERWRITE_IF 0x00000005 +#define FILE_MAXIMUM_DISPOSITION 0x00000005 + +/* + * CREATE_ANDX Impersonation levels + */ + +#define SECURITY_ANONYMOUS 0x00000001 +#define SECURITY_IDENTIFICATION 0x00000002 +#define SECURITY_IMPERSONATION 0x00000003 +#define SECURITY_DELEGATION 0x00000004 + +/* + * CREATE_ANDX SecurityFlags + */ + +#define SECURITY_CONTEXT_TRACKING 0x00000001 +#define SECURITY_EFFECTIVE_ONLY 0x00000002 + +/* + * Server types + */ +#define SV_WORKSTATION 0x00000001 /* All workstations */ +#define SV_SERVER 0x00000002 /* All servers */ +#define SV_SQLSERVER 0x00000004 /* running with SQL server */ +#define SV_DOMAIN_CTRL 0x00000008 /* Primary domain controller */ +#define SV_DOMAIN_BAKCTRL 0x00000010 /* Backup domain controller */ +#define SV_TIME_SOURCE 0x00000020 /* running timesource service */ +#define SV_AFP 0x00000040 /* Apple File Protocol */ +#define SV_NOVELL 0x00000080 /* Novell servers */ +#define SV_DOMAIN_MEMBER 0x00000100 /* Domain Member */ +#define SV_PRINTQ_SERVER 0x00000200 /* Server sharing print queue */ +#define SV_DIALIN_SERVER 0x00000400 /* Server running dialin */ +#define SV_XENIX_SERVER 0x00000800 /* Xenix server */ +#define SV_NT 0x00001000 /* NT server */ +#define SV_WFW 0x00002000 /* Server running Windows for */ +#define SV_SERVER_NT 0x00008000 /* Windows NT non DC server */ +#define SV_POTENTIAL_BROWSER 0x00010000 /* can run browser service */ +#define SV_BACKUP_BROWSER 0x00020000 /* Backup browser server */ +#define SV_MASTER_BROWSER 0x00040000 /* Master browser server */ +#define SV_DOMAIN_MASTER 0x00080000 /* Domain Master Browser */ +#define SV_OSF 0x00100000 /* OSF operating system */ +#define SV_VMS 0x00200000 /* VMS operating system */ +#define SV_WINDOWS_95_PLUS 0x00400000 /* Windows 95 or better */ + +#define SV_LOCAL_LIST_ONLY 0x40000000 /* Enumerate only "local" */ +#define SV_TYPE_DOMAIN_ENUM 0x80000000 /* Enumerate Domains */ + +#define MY_SERVER_TYPE (SV_SERVER | SV_NT | SV_SERVER_NT) + + +#define PRQ_ACTIVE 0 /* Active */ +#define PRQ_PAUSE 1 /* Paused */ +#define PRQ_ERROR 2 /* Error Occurred */ +#define PRQ_PENDING 3 /* Deletion pending */ + +#define PRJ_QS_QUEUED 0 /* Active */ +#define PRJ_QS_PAUSED 1 /* Paused */ +#define PRJ_QS_SPOOLING 2 /* Paused */ +#define PRJ_QS_PRINTING 3 /* Paused */ + + +#define SHARE_ACCESS_READ 0x01 /* read & execute from resource */ +#define SHARE_ACCESS_WRITE 0x02 /* write data to resource */ +#define SHARE_ACCESS_CREATE 0x04 /* create an instance of */ +#define SHARE_ACCESS_EXEC 0x08 /* execute from resource */ +#define SHARE_ACCESS_DELETE 0x10 /* Permission to delete the resource */ +#define SHARE_ACCESS_ATTRIB 0x20 /* Permission to modify the resource */ +#define SHARE_ACCESS_PERM 0x40 /* Permission to change permissions */ +#define SHARE_ACCESS_ALL 0x7F /* All of the above permissions */ + + +/* + * SMB_COM_NT_TRANSACTION sub-command codes (CIFS/1.0 section 5.3) + * + * SubCommand Code Value Description + * =============================== ===== ================================= + * NT_TRANSACT_CREATE 1 File open/create + * NT_TRANSACT_IOCTL 2 Device IOCTL + * NT_TRANSACT_SET_SECURITY_DESC 3 Set security descriptor + * NT_TRANSACT_NOTIFY_CHANGE 4 Start directory watch + * NT_TRANSACT_RENAME 5 Reserved (handle-based rename) + * NT_TRANSACT_QUERY_SECURITY_DESC 6 Retrieve security descriptor + * NT_TRANSACT_QUERY_QUOTA 7 Retrieve quota information + * NT_TRANSACT_SET_QUOTA 8 Set quota information + */ +#define NT_TRANSACT_MIN_FUNCTION 1 + +#define NT_TRANSACT_CREATE 1 +#define NT_TRANSACT_IOCTL 2 +#define NT_TRANSACT_SET_SECURITY_DESC 3 +#define NT_TRANSACT_NOTIFY_CHANGE 4 +#define NT_TRANSACT_RENAME 5 +#define NT_TRANSACT_QUERY_SECURITY_DESC 6 +#define NT_TRANSACT_QUERY_QUOTA 7 +#define NT_TRANSACT_SET_QUOTA 8 + +#define NT_TRANSACT_MAX_FUNCTION 8 + + +/* + * Pipe states + */ +#define SMB_PIPE_READMODE_BYTE 0x0000 +#define SMB_PIPE_READMODE_MESSAGE 0x0100 +#define SMB_PIPE_TYPE_BYTE 0x0000 +#define SMB_PIPE_TYPE_MESSAGE 0x0400 +#define SMB_PIPE_END_CLIENT 0x0000 +#define SMB_PIPE_END_SERVER 0x4000 +#define SMB_PIPE_WAIT 0x0000 +#define SMB_PIPE_NOWAIT 0x8000 +#define SMB_PIPE_UNLIMITED_INSTANCES 0x00FF + +/* + * smb_com_seek request + */ +#define SMB_SEEK_SET 0 /* set file offset to specified offset */ +#define SMB_SEEK_CUR 1 /* set file offset to current plus specified offset */ +#define SMB_SEEK_END 2 /* set file offset to EOF plus specified offset */ + +/* + * API Numbers for Transact based RAP (Remote Administration Protocol) calls + */ +#define API_WshareEnum 0 +#define API_WshareGetInfo 1 +#define API_WshareSetInfo 2 +#define API_WshareAdd 3 +#define API_WshareDel 4 +#define API_NetShareCheck 5 +#define API_WsessionEnum 6 +#define API_WsessionGetInfo 7 +#define API_WsessionDel 8 +#define API_WconnectionEnum 9 +#define API_WfileEnum 10 +#define API_WfileGetInfo 11 +#define API_WfileClose 12 +#define API_WserverGetInfo 13 +#define API_WserverSetInfo 14 +#define API_WserverDiskEnum 15 +#define API_WserverAdminCommand 16 +#define API_NetAuditOpen 17 +#define API_WauditClear 18 +#define API_NetErrorLogOpen 19 +#define API_WerrorLogClear 20 +#define API_NetCharDevEnum 21 +#define API_NetCharDevGetInfo 22 +#define API_WCharDevControl 23 +#define API_NetCharDevQEnum 24 +#define API_NetCharDevQGetInfo 25 +#define API_WCharDevQSetInfo 26 +#define API_WCharDevQPurge 27 +#define API_WCharDevQPurgeSelf 28 +#define API_WMessageNameEnum 29 +#define API_WMessageNameGetInfo 30 +#define API_WMessageNameAdd 31 +#define API_WMessageNameDel 32 +#define API_WMessageNameFwd 33 +#define API_WMessageNameUnFwd 34 +#define API_WMessageBufferSend 35 +#define API_WMessageFileSend 36 +#define API_WMessageLogFileSet 37 +#define API_WMessageLogFileGet 38 +#define API_WServiceEnum 39 +#define API_WServiceInstall 40 +#define API_WServiceControl 41 +#define API_WAccessEnum 42 +#define API_WAccessGetInfo 43 +#define API_WAccessSetInfo 44 +#define API_WAccessAdd 45 +#define API_WAccessDel 46 +#define API_WGroupEnum 47 +#define API_WGroupAdd 48 +#define API_WGroupDel 49 +#define API_WGroupAddUser 50 +#define API_WGroupDelUser 51 +#define API_WGroupGetUsers 52 +#define API_WUserEnum 53 +#define API_WUserAdd 54 +#define API_WUserDel 55 +#define API_WUserGetInfo 56 +#define API_WUserSetInfo 57 +#define API_WUserPasswordSet 58 +#define API_WUserGetGroups 59 +#define API_DeadTableEntry 60 +#define API_WWkstaSetUID 62 +#define API_WWkstaGetInfo 63 +#define API_WWkstaSetInfo 64 +#define API_WUseEnum 65 +#define API_WUseAdd 66 +#define API_WUseDel 67 +#define API_WUseGetInfo 68 +#define API_WPrintQEnum 69 +#define API_WPrintQGetInfo 70 +#define API_WPrintQSetInfo 71 +#define API_WPrintQAdd 72 +#define API_WPrintQDel 73 +#define API_WPrintQPause 74 +#define API_WPrintQContinue 75 +#define API_WPrintJobEnum 76 +#define API_WPrintJobGetInfo 77 +#define API_WPrintJobSetInfo_OLD 78 +#define API_WPrintJobDel 81 +#define API_WPrintJobPause 82 +#define API_WPrintJobContinue 83 +#define API_WPrintDestEnum 84 +#define API_WPrintDestGetInfo 85 +#define API_WPrintDestControl 86 +#define API_WProfileSave 87 +#define API_WProfileLoad 88 +#define API_WStatisticsGet 89 +#define API_WStatisticsClear 90 +#define API_NetRemoteTOD 91 +#define API_WNetBiosEnum 92 +#define API_WNetBiosGetInfo 93 +#define API_NetServerEnum 94 +#define API_I_NetServerEnum 95 +#define API_WServiceGetInfo 96 +#define API_WPrintQPurge 103 +#define API_NetServerEnum2 104 +#define API_WAccessGetUserPerms 105 +#define API_WGroupGetInfo 106 +#define API_WGroupSetInfo 107 +#define API_WGroupSetUsers 108 +#define API_WUserSetGroups 109 +#define API_WUserModalsGet 110 +#define API_WUserModalsSet 111 +#define API_WFileEnum2 112 +#define API_WUserAdd2 113 +#define API_WUserSetInfo2 114 +#define API_WUserPasswordSet2 115 +#define API_I_NetServerEnum2 116 +#define API_WConfigGet2 117 +#define API_WConfigGetAll2 118 +#define API_WGetDCName 119 +#define API_NetHandleGetInfo 120 +#define API_NetHandleSetInfo 121 +#define API_WStatisticsGet2 122 +#define API_WBuildGetInfo 123 +#define API_WFileGetInfo2 124 +#define API_WFileClose2 125 +#define API_WNetServerReqChallenge 126 +#define API_WNetServerAuthenticate 127 +#define API_WNetServerPasswordSet 128 +#define API_WNetAccountDeltas 129 +#define API_WNetAccountSync 130 +#define API_WUserEnum2 131 +#define API_WWkstaUserLogon 132 +#define API_WWkstaUserLogoff 133 +#define API_WLogonEnum 134 +#define API_WErrorLogRead 135 +#define API_WI_NetPathType 136 +#define API_WI_NetPathCanonicalize 137 +#define API_WI_NetPathCompare 138 +#define API_WI_NetNameValidate 139 +#define API_WI_NetNameCanonicalize 140 +#define API_WI_NetNameCompare 141 +#define API_WAuditRead 142 +#define API_WPrintDestAdd 143 +#define API_WPrintDestSetInfo 144 +#define API_WPrintDestDel 145 +#define API_WUserValidate2 146 +#define API_WPrintJobSetInfo 147 +#define API_TI_NetServerDiskEnum 148 +#define API_TI_NetServerDiskGetInfo 149 +#define API_TI_FTVerifyMirror 150 +#define API_TI_FTAbortVerify 151 +#define API_TI_FTGetInfo 152 +#define API_TI_FTSetInfo 153 +#define API_TI_FTLockDisk 154 +#define API_TI_FTFixError 155 +#define API_TI_FTAbortFix 156 +#define API_TI_FTDiagnoseError 157 +#define API_TI_FTGetDriveStats 158 +#define API_TI_FTErrorGetInfo 160 +#define API_NetAccessCheck 163 +#define API_NetAlertRaise 164 +#define API_NetAlertStart 165 +#define API_NetAlertStop 166 +#define API_NetAuditWrite 167 +#define API_NetIRemoteAPI 168 +#define API_NetServiceStatus 169 +#define API_I_NetServerRegister 170 +#define API_I_NetServerDeregister 171 +#define API_I_NetSessionEntryMake 172 +#define API_I_NetSessionEntryClear 173 +#define API_I_NetSessionEntryGetInfo 174 +#define API_I_NetSessionEntrySetInfo 175 +#define API_I_NetConnectionEntryMake 176 +#define API_I_NetConnectionEntryClear 177 +#define API_I_NetConnectionEntrySetInfo 178 +#define API_I_NetConnectionEntryGetInfo 179 +#define API_I_NetFileEntryMake 180 +#define API_I_NetFileEntryClear 181 +#define API_I_NetFileEntrySetInfo 182 +#define API_I_NetFileEntryGetInfo 183 +#define API_AltSrvMessageBufferSend 184 +#define API_AltSrvMessageFileSend 185 +#define API_wI_NetRplWkstaEnum 186 +#define API_wI_NetRplWkstaGetInfo 187 +#define API_wI_NetRplWkstaSetInfo 188 +#define API_wI_NetRplWkstaAdd 189 +#define API_wI_NetRplWkstaDel 190 +#define API_wI_NetRplProfileEnum 191 +#define API_wI_NetRplProfileGetInfo 192 +#define API_wI_NetRplProfileSetInfo 193 +#define API_wI_NetRplProfileAdd 194 +#define API_wI_NetRplProfileDel 195 +#define API_wI_NetRplProfileClone 196 +#define API_wI_NetRplBaseProfileEnum 197 +#define API_WIServerSetInfo 201 +#define API_WPrintDriverEnum 205 +#define API_WPrintQProcessorEnum 206 +#define API_WPrintPortEnum 207 +#define API_WNetWriteUpdateLog 208 +#define API_WNetAccountUpdate 209 +#define API_WNetAccountConfirmUpdate 210 +#define API_WConfigSet 211 +#define API_WAccountsReplicate 212 +#define API_SamOEMChgPasswordUser2_P 214 +#define API_NetServerEnum3 215 +#define API_WprintDriverGetInfo 250 +#define API_WprintDriverSetInfo 251 +#define API_WaliasAdd 252 +#define API_WaliasDel 253 +#define API_WaliasGetInfo 254 +#define API_WaliasSetInfo 255 +#define API_WaliasEnum 256 +#define API_WuserGetLogonAsn 257 +#define API_WuserSetLogonAsn 258 +#define API_WuserGetAppSel 259 +#define API_WuserSetAppSel 260 +#define API_WappAdd 261 +#define API_WappDel 262 +#define API_WappGetInfo 263 +#define API_WappSetInfo 264 +#define API_WappEnum 265 +#define API_WUserDCDBInit 266 +#define API_WDASDAdd 267 +#define API_WDASDDel 268 +#define API_WDASDGetInfo 269 +#define API_WDASDSetInfo 270 +#define API_WDASDEnum 271 +#define API_WDASDCheck 272 +#define API_WDASDCtl 273 +#define API_WuserRemoteLogonCheck 274 +#define API_WUserPasswordSet3 275 +#define API_WCreateRIPLMachine 276 +#define API_WDeleteRIPLMachine 277 +#define API_WGetRIPLMachineInfo 278 +#define API_WSetRIPLMachineInfo 279 +#define API_WEnumRIPLMachine 280 +#define API_WI_ShareAdd 281 +#define API_WI_AliasEnum 282 +#define API_WaccessApply 283 +#define API_WPrt16Query 284 +#define API_WPrt16Set 285 +#define API_WUserDel100 286 +#define API_WUserRemoteLogonCheck2 287 +#define API_WRemoteTODSet 294 +#define API_WprintJobMoveAll 295 +#define API_W16AppParmAdd 296 +#define API_W16AppParmDel 297 +#define API_W16AppParmGet 298 +#define API_W16AppParmSet 299 +#define API_W16RIPLMachineCreate 300 +#define API_W16RIPLMachineGetInfo 301 +#define API_W16RIPLMachineSetInfo 302 +#define API_W16RIPLMachineEnum 303 +#define API_W16RIPLMachineListParmEnum 304 +#define API_W16RIPLMachClassGetInfo 305 +#define API_W16RIPLMachClassEnum 306 +#define API_W16RIPLMachClassCreate 307 +#define API_W16RIPLMachClassSetInfo 308 +#define API_W16RIPLMachClassDelete 309 +#define API_W16RIPLMachClassLPEnum 310 +#define API_W16RIPLMachineDelete 311 +#define API_W16WSLevelGetInfo 312 +#define API_WserverNameAdd 313 +#define API_WserverNameDel 314 +#define API_WserverNameEnum 315 +#define API_I_WDASDEnum 316 +#define API_I_WDASDEnumTerminate 317 +#define API_I_WDASDSetInfo2 318 +#define MAX_RAP_API 318 #ifdef __cplusplus } #endif - #endif /* _SMBSRV_SMB_H */ diff --git a/usr/src/uts/common/smbsrv/smb_fsops.h b/usr/src/uts/common/smbsrv/smb_fsops.h index 4f1e573a5c..5722c4e24a 100644 --- a/usr/src/uts/common/smbsrv/smb_fsops.h +++ b/usr/src/uts/common/smbsrv/smb_fsops.h @@ -30,7 +30,7 @@ * This header file contains all the functions for the interface between * the smb layer and the fs layer. */ -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #include <smbsrv/smbinfo.h> #include <smbsrv/smb_ktypes.h> #include <smbsrv/smb_vops.h> @@ -69,7 +69,7 @@ int smb_fsop_link(smb_request_t *, cred_t *, smb_node_t *, smb_node_t *, int smb_fsop_rename(smb_request_t *, cred_t *, smb_node_t *, char *, smb_node_t *, - char *); + char *); int smb_fsop_setattr(smb_request_t *, cred_t *, smb_node_t *, smb_attr_t *); @@ -112,12 +112,14 @@ int smb_fsop_frlock(smb_node_t *, smb_lock_t *, boolean_t, cred_t *); * SMB_IGNORE_CASE Perform case-insensitive lookup. * SMB_CATIA Perform CATIA character substitution. * SMB_ABE Perform Access based enumeration/lookup. + * SMB_CASE_SENSITIVE Don't set SMB_IGNORE_CASE based on tree. */ #define SMB_FOLLOW_LINKS 0x00000001 #define SMB_IGNORE_CASE 0x00000002 #define SMB_CATIA 0x00000004 #define SMB_ABE 0x00000008 +#define SMB_CASE_SENSITIVE 0x00000010 #ifdef __cplusplus } diff --git a/usr/src/uts/common/smbsrv/smb_i18n.h b/usr/src/uts/common/smbsrv/smb_i18n.h deleted file mode 100644 index 74804d0056..0000000000 --- a/usr/src/uts/common/smbsrv/smb_i18n.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMB_I18N_H -#define _SMB_I18N_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned short mts_wchar_t; - -#ifdef __cplusplus -} -#endif - -#endif /* _SMB_I18N_H */ diff --git a/usr/src/uts/common/smbsrv/smb_incl.h b/usr/src/uts/common/smbsrv/smb_incl.h deleted file mode 100644 index 2d1e61b087..0000000000 --- a/usr/src/uts/common/smbsrv/smb_incl.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_SMB_INCL_H -#define _SMBSRV_SMB_INCL_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/cmn_err.h> -#include <sys/cpuvar.h> -#include <sys/list.h> -#include <sys/sunddi.h> -#include <netinet/in_systm.h> -#include <netinet/in.h> -#include <netinet/ip.h> -#include <netinet/ip_icmp.h> -#include <netinet/ip_var.h> -#include <netinet/tcp.h> -#include <net/if.h> -#include <netinet/if_ether.h> - -#include <sys/errno.h> -#include <sys/ioctl.h> - -#include <smbsrv/alloc.h> -#include <smbsrv/ctype.h> -#include <smbsrv/string.h> - -#include <smbsrv/ntstatus.h> -#include <smbsrv/nterror.h> -#include <smbsrv/doserror.h> -#include <smbsrv/cifs.h> -#include <smbsrv/ntaccess.h> -#include <smbsrv/smbinfo.h> -#include <smbsrv/smb.h> - -#include <smbsrv/smbfmt.h> -#include <smbsrv/smb_kproto.h> - -#define QUEUE_INSERT_HEAD(q, e) \ - { \ - ((e)->forw) = (void *)((q)->forw); \ - ((e)->back) = (void *)(q); \ - ((q)->forw->back) = (void *)(e); \ - ((q)->forw) = (void *)(e); \ - } - - -#define QUEUE_INSERT_TAIL(q, e) \ - { \ - ((e)->back) = (void *)((q)->back); \ - ((e)->forw) = (void *)(q); \ - ((q)->back->forw) = (void *)(e); \ - ((q)->back) = (void *)(e); \ - } - -#define QUEUE_INSERT_SORT(q, e, k, t) \ - { \ - (void *)(t) = (void *)((q)->forw); \ - while (((t)->k) < ((e)->k)) { \ - (void *)(t) = (void *)((t)->forw); \ - } \ - QUEUE_INSERT_TAIL(t, e); \ - } - -#define QUEUE_CLIP(e) \ - { \ - (e)->forw->back = (e)->back; \ - (e)->back->forw = (e)->forw; \ - (e)->forw = 0; \ - (e)->back = 0; \ - } - -/* These should be defined in system header files */ - -extern int atoi(const char *); -extern int getchar(void); - -/* - * PBSHORTCUT - remove this when we replace BYTE/WORD/DWORD to - * uint8_t/uint16_t/uint32_t and <inet/ip.h> gets included by - * files that invoke the following functions. - */ -extern char *inet_ntop(int, const void *, char *, int); -extern int inet_pton(int, char *, void *); - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_SMB_INCL_H */ diff --git a/usr/src/uts/common/smbsrv/smb_kproto.h b/usr/src/uts/common/smbsrv/smb_kproto.h index e924f189cb..95688dd32f 100644 --- a/usr/src/uts/common/smbsrv/smb_kproto.h +++ b/usr/src/uts/common/smbsrv/smb_kproto.h @@ -34,12 +34,17 @@ extern "C" { #endif +#include <sys/types.h> +#include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> #include <sys/strsubr.h> #include <sys/socketvar.h> #include <sys/ksocket.h> #include <sys/cred.h> +#include <sys/sunddi.h> +#include <smbsrv/smb.h> +#include <smbsrv/string.h> #include <smbsrv/smb_vops.h> #include <smbsrv/smb_xdr.h> #include <smbsrv/smb_token.h> @@ -149,6 +154,7 @@ smb_sdrc_t smb_nt_transact_notify_change(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_nt_transact_query_security_info(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_nt_transact_set_security_info(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_nt_transact_ioctl(smb_request_t *, smb_xa_t *); +smb_sdrc_t smb_nt_transact_rename(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_com_trans2_open2(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_com_trans2_create_directory(smb_request_t *, smb_xa_t *); @@ -159,6 +165,7 @@ smb_sdrc_t smb_com_trans2_query_path_information(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_com_trans2_query_file_information(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_com_trans2_set_path_information(smb_request_t *, smb_xa_t *); smb_sdrc_t smb_com_trans2_set_file_information(smb_request_t *, smb_xa_t *); +int smb_trans2_rename(smb_request_t *, smb_node_t *, char *, int); /* * Logging functions @@ -399,12 +406,6 @@ void smb_vfs_rele_all(smb_server_t *); boolean_t smb_vfs_cmp(vfs_t *, vfs_t *); boolean_t smb_vfs_is_readonly(vfs_t *); - -/* - * String manipulation function - */ -char *smb_kstrdup(const char *s, size_t n); - /* NOTIFY CHANGE */ void smb_process_session_notify_change_queue(smb_session_t *, smb_tree_t *); void smb_process_node_notify_change_queue(smb_node_t *); @@ -420,11 +421,10 @@ void smb_fem_fini(void); int smb_try_grow(smb_request_t *sr, int64_t new_size); -/* functions from smb_memory_manager.c */ - -void *smbsr_malloc(smb_malloc_list *, size_t); -void *smbsr_realloc(void *, size_t); -void smbsr_free_malloc_list(smb_malloc_list *); +void smb_srm_init(smb_request_t *sr); +void smb_srm_fini(smb_request_t *sr); +void *smb_srm_alloc(smb_request_t *, size_t); +void *smb_srm_realloc(smb_request_t *, void *, size_t); unsigned short smb_worker_getnum(); @@ -612,13 +612,6 @@ uint64_t smb_time_unix_to_nt(timestruc_t *); int netbios_name_isvalid(char *in, char *out); -size_t -unicodestooems(char *oemstring, const mts_wchar_t *unicodestring, - size_t nbytes, unsigned int cpid); - -size_t oemstounicodes(mts_wchar_t *unicodestring, const char *oemstring, - size_t nwchars, unsigned int cpid); - int uioxfer(struct uio *src_uio, struct uio *dst_uio, int n); int smb_match_name(ino64_t, char *, char *, boolean_t); diff --git a/usr/src/uts/common/smbsrv/smb_ktypes.h b/usr/src/uts/common/smbsrv/smb_ktypes.h index 9e4824cdd3..fd0feee85b 100644 --- a/usr/src/uts/common/smbsrv/smb_ktypes.h +++ b/usr/src/uts/common/smbsrv/smb_ktypes.h @@ -58,7 +58,6 @@ extern "C" { #include <smbsrv/smb_xdr.h> #include <smbsrv/netbios.h> #include <smbsrv/smb_vops.h> -#include <smbsrv/ntifs.h> struct smb_disp_entry; struct smb_request; @@ -306,11 +305,6 @@ typedef struct { typedef uint32_t UTIME; /* seconds since Jan 1 1970 */ -typedef struct smb_malloc_list { - struct smb_malloc_list *forw; - struct smb_malloc_list *back; -} smb_malloc_list; - typedef struct smb_llist { krwlock_t ll_lock; list_t ll_list; @@ -939,7 +933,7 @@ typedef struct smb_opipe { /* * The of_ftype of an open file should contain the SMB_FTYPE value - * (cifs.h) returned when the file/pipe was opened. The following + * returned when the file/pipe was opened. The following * assumptions are currently made: * * File Type Node PipeInfo @@ -1215,6 +1209,7 @@ typedef struct open_param { uint32_t action_taken; uint64_t fileid; uint32_t rootdirfid; + smb_ofile_t *dir; /* This is only set by NTTransactCreate */ struct smb_sd *sd; uint8_t op_oplock_level; @@ -1388,7 +1383,7 @@ typedef struct smb_request { struct mbuf_chain command; struct mbuf_chain reply; struct mbuf_chain raw_data; - smb_malloc_list request_storage; + list_t sr_storage; struct smb_xa *r_xa; int andx_prev_wct; int cur_reply_offset; @@ -1442,6 +1437,7 @@ typedef struct smb_request { smb_fqi_t fqi; smb_fqi_t dst_fqi; uint16_t info_level; + uint16_t flags; } dirop; open_param_t open; @@ -1453,14 +1449,23 @@ typedef struct smb_request { kthread_t *sr_worker; } smb_request_t; -#define SMB_READ_PROTOCOL(smb_nh_ptr) \ - LE_IN32(((smb_nethdr_t *)(smb_nh_ptr))->sh_protocol) +/* + * SMB request-specific memory node. + */ +typedef struct smb_srm { + list_node_t srm_lnd; + size_t srm_size; + smb_request_t *srm_sr; +} smb_srm_t; + +#define SMB_READ_PROTOCOL(hdr) \ + LE_IN32(((smb_hdr_t *)(hdr))->protocol) #define SMB_PROTOCOL_MAGIC_INVALID(rd_sr) \ (SMB_READ_PROTOCOL((rd_sr)->sr_request_buf) != SMB_PROTOCOL_MAGIC) -#define SMB_READ_COMMAND(smb_nh_ptr) \ - (((smb_nethdr_t *)(smb_nh_ptr))->sh_command) +#define SMB_READ_COMMAND(hdr) \ + (((smb_hdr_t *)(hdr))->command) #define SMB_IS_WRITERAW(rd_sr) \ (SMB_READ_COMMAND((rd_sr)->sr_request_buf) == SMB_COM_WRITE_RAW) @@ -1512,8 +1517,7 @@ typedef struct smb_xa { int32_t smb_timeout; /* number of milliseconds to await completion */ uint32_t smb_suwcnt; /* set up word count */ - - char *xa_smb_trans_name; + char *xa_pipe_name; int req_disp_param; int req_disp_data; diff --git a/usr/src/uts/common/smbsrv/smb_vops.h b/usr/src/uts/common/smbsrv/smb_vops.h index 4952eea170..b9aee05ac3 100644 --- a/usr/src/uts/common/smbsrv/smb_vops.h +++ b/usr/src/uts/common/smbsrv/smb_vops.h @@ -41,7 +41,7 @@ #include <sys/refstr.h> #include <sys/acl.h> #include <sys/fcntl.h> -#include <smbsrv/smb_i18n.h> +#include <smbsrv/string.h> #ifdef __cplusplus extern "C" { diff --git a/usr/src/uts/common/smbsrv/smbfmt.h b/usr/src/uts/common/smbsrv/smbfmt.h deleted file mode 100644 index 937faf520f..0000000000 --- a/usr/src/uts/common/smbsrv/smbfmt.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _SMBSRV_SMBFMT_H -#define _SMBSRV_SMBFMT_H - -#pragma ident "@(#)smbfmt.h 1.2 08/07/30 SMI" - -/* - * SMB message header formats. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define SMB_HEADER_ED_FMT "Mbbbwbww8c2.wwww" -#define SMB_HEADER_ED_LEN (4+1+1+1+2+1+2+12+2+2+2+2) -#define SMB_TRANSHDR_ED_FMT "wwwwb.wl2.wwwwb." -#define SMB_TRANSHDR_ED_LEN (2+2+2+2+1+1+2+4+2+2+2+2+2+1+1) -#define SMB_TRANSSHDR_ED_FMT "wwwwwwwww" -#define SMB_TRANSSHDR_ED_LEN (2+2+2+2+2+2+2+2) -#define SMB_TRANS2SHDR_ED_FMT "wwwwwwwww" -#define SMB_TRANS2SHDR_ED_LEN (2+2+2+2+2+2+2+2+2) -/* There is something wrong with this. Should be 38 bytes. It is 37 bytes */ -#define SMB_NT_TRANSHDR_ED_FMT "b2.llllllllbw" -#define SMB_NT_TRANSHDR_ED_LEN (1+2+4+4+4+4+4+4+4+4+1+2) - -#ifdef __cplusplus -} -#endif - -#endif /* _SMBSRV_SMBFMT_H */ diff --git a/usr/src/uts/common/smbsrv/string.h b/usr/src/uts/common/smbsrv/string.h index 6696cbc33d..21b32e328f 100644 --- a/usr/src/uts/common/smbsrv/string.h +++ b/usr/src/uts/common/smbsrv/string.h @@ -19,37 +19,67 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SMBSRV_STRING_H #define _SMBSRV_STRING_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> -#include <smbsrv/smb_i18n.h> #ifdef __cplusplus extern "C" { #endif -extern char *strsubst(char *, char, char); -extern char *strsep(char **, const char *); -extern char *strcanon(char *, const char *); +#define _smb_between(l, c, u) ((l) <= (c) && (c) <= (u)) + +#define smb_isalpha(c) (smb_islower(c) || smb_isupper(c)) +#define smb_isdigit(c) _smb_between('0', (c), '9') +#define smb_isalnum(c) (smb_isalpha(c) || smb_isdigit(c)) +#define smb_isxdigit(c) (smb_isdigit(c) || \ + _smb_between('a', (c), 'f') || \ + _smb_between('A', (c), 'F')) +#define smb_isblank(c) ((c) == ' ' || (c) == '\t') +#define smb_isspace(c) ((c) == ' ' || \ + (c) == '\t' || \ + (c) == '\n' || \ + (c) == '\r' || \ + (c) == '\f') +#define smb_isascii(c) (!((c) &~ 0x7F)) + +/* These macros only apply to ASCII */ +#define smb_isalpha_ascii(c) \ + (_smb_between('a', (c), 'z') || _smb_between('A', (c), 'Z')) +#define smb_isalnum_ascii(c) (smb_isalpha_ascii(c) || smb_isdigit(c)) -extern char *utf8_strupr(char *); -extern char *utf8_strlwr(char *); -extern int utf8_isstrupr(const char *); -extern int utf8_isstrlwr(const char *); -extern int utf8_strcasecmp(const char *, const char *); -extern int utf8_strncasecmp(const char *, const char *, int); -extern int utf8_isstrascii(const char *); +#define smb_isprint(c) _smb_between('!', (c), '~') +#define smb_iscntrl(c) ((((c) >= 0) && ((c) <= 0x1f)) || ((c) == 0x7f)) +#define smb_ispunct(c) (smb_isprint(c) && !smb_isxdigit(c) && !smb_isspace(c)) -extern int smb_match(char *patn, char *str); -extern int smb_match_ci(char *patn, char *str); -extern int smb_match83(char *patn, char *str83); +/* + * These id's should correspond to oemcpg_table smb_oem.c. + */ +typedef enum codepage_id { + OEM_CPG_850 = 0, + OEM_CPG_950, + OEM_CPG_1252, + OEM_CPG_949, + OEM_CPG_936, + OEM_CPG_932, + OEM_CPG_852, + OEM_CPG_1250, + OEM_CPG_1253, + OEM_CPG_737, + OEM_CPG_1254, + OEM_CPG_857, + OEM_CPG_1251, + OEM_CPG_866, + OEM_CPG_1255, + OEM_CPG_862, + OEM_CPG_1256, + OEM_CPG_720 +} codepage_id_t; /* * Maximum number of bytes per multi-byte character. @@ -57,16 +87,64 @@ extern int smb_match83(char *patn, char *str83); #define MTS_MB_CUR_MAX 3 #define MTS_MB_CHAR_MAX MTS_MB_CUR_MAX -size_t mts_mbstowcs(mts_wchar_t *, const char *, size_t); -size_t mts_wcstombs(char *, const mts_wchar_t *, size_t); -int mts_mbtowc(mts_wchar_t *, const char *, size_t); -int mts_wctomb(char *, mts_wchar_t); +typedef uint16_t smb_wchar_t; + +/* + * Labels to define whether a code page table entry is an uppercase + * character, a lowercase character or neither. One of these values + * should appear in the ctype field of the code page tables. + */ +#define CODEPAGE_ISNONE 0x00 +#define CODEPAGE_ISUPPER 0x01 +#define CODEPAGE_ISLOWER 0x02 + +/* + * The structure of a code page entry. Each code page table will + * consist of an array of 256 codepage entries. + * + * ctype indicates case of the value. + * upper indicates the uppercase equivalent value. + * lower indicates the lowercase equivalent value. + */ +typedef struct smb_codepage { + unsigned char ctype; + smb_wchar_t upper; + smb_wchar_t lower; +} smb_codepage_t; + +void smb_codepage_init(void); + +int smb_isupper(int); +int smb_islower(int); +int smb_toupper(int); +int smb_tolower(int); +char *smb_strupr(char *); +char *smb_strlwr(char *); +int smb_isstrupr(const char *); +int smb_isstrlwr(const char *); +int smb_strcasecmp(const char *, const char *, size_t); + +int smb_match(char *patn, char *str); +int smb_match_ci(char *patn, char *str); +int smb_match83(char *patn, char *str83); + +size_t smb_mbstowcs(smb_wchar_t *, const char *, size_t); +size_t smb_wcstombs(char *, const smb_wchar_t *, size_t); +int smb_mbtowc(smb_wchar_t *, const char *, size_t); +int smb_wctomb(char *, smb_wchar_t); + +size_t smb_wcequiv_strlen(const char *); +size_t smb_sbequiv_strlen(const char *); + +int smb_stombs(char *, char *, int); +int smb_mbstos(char *, const char *); -size_t mts_wcequiv_strlen(const char *); -size_t mts_sbequiv_strlen(const char *); +size_t ucstooem(char *, const smb_wchar_t *, size_t, uint32_t); +size_t oemtoucs(smb_wchar_t *, const char *, size_t, uint32_t); -int mts_stombs(char *, char *, int); -int mts_mbstos(char *, const char *); +char *strsubst(char *, char, char); +char *strsep(char **, const char *); +char *strcanon(char *, const char *); #ifdef __cplusplus } |