2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Andrew Tridgell 1992-2001
5 Copyright (C) Simo Sorce 2001
6 Copyright (C) Jeremy Allison 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 /* these 3 tables define the unicode case handling. They are loaded
30 at startup either via mmap() or read() from the lib directory */
31 static smb_ucs2_t
*upcase_table
;
32 static smb_ucs2_t
*lowcase_table
;
33 static uint8
*valid_table
;
34 static BOOL upcase_table_use_unmap
;
35 static BOOL lowcase_table_use_unmap
;
36 static BOOL valid_table_use_unmap
;
39 * This table says which Unicode characters are valid dos
42 * Each value is just a single bit.
44 static uint8 doschar_table
[8192]; /* 65536 characters / 8 bits/byte */
47 * Destroy global objects allocated by load_case_tables()
49 void gfree_case_tables(void)
52 if ( upcase_table_use_unmap
)
53 unmap_file(upcase_table
, 0x20000);
55 SAFE_FREE(upcase_table
);
58 if ( lowcase_table
) {
59 if ( lowcase_table_use_unmap
)
60 unmap_file(lowcase_table
, 0x20000);
62 SAFE_FREE(lowcase_table
);
66 if ( valid_table_use_unmap
)
67 unmap_file(valid_table
, 0x10000);
69 SAFE_FREE(valid_table
);
74 * Load or generate the case handling tables.
76 * The case tables are defined in UCS2 and don't depend on any
77 * configured parameters, so they never need to be reloaded.
80 void load_case_tables(void)
82 static int initialised
;
83 char *old_locale
= NULL
, *saved_locale
= NULL
;
91 upcase_table
= map_file(lib_path("upcase.dat"), 0x20000);
92 upcase_table_use_unmap
= ( upcase_table
!= NULL
);
94 lowcase_table
= map_file(lib_path("lowcase.dat"), 0x20000);
95 lowcase_table_use_unmap
= ( lowcase_table
!= NULL
);
98 /* Get the name of the current locale. */
99 old_locale
= setlocale(LC_ALL
, NULL
);
102 /* Save it as it is in static storage. */
103 saved_locale
= SMB_STRDUP(old_locale
);
106 /* We set back the locale to C to get ASCII-compatible toupper/lower functions. */
107 setlocale(LC_ALL
, "C");
110 /* we would like Samba to limp along even if these tables are
113 DEBUG(1,("creating lame upcase table\n"));
114 upcase_table
= SMB_MALLOC(0x20000);
115 for (i
=0;i
<0x10000;i
++) {
120 for (i
=0;i
<256;i
++) {
122 SSVAL(&v
, 0, UCS2_CHAR(i
));
123 upcase_table
[v
] = UCS2_CHAR(islower(i
)?toupper(i
):i
);
127 if (!lowcase_table
) {
128 DEBUG(1,("creating lame lowcase table\n"));
129 lowcase_table
= SMB_MALLOC(0x20000);
130 for (i
=0;i
<0x10000;i
++) {
133 lowcase_table
[v
] = i
;
135 for (i
=0;i
<256;i
++) {
137 SSVAL(&v
, 0, UCS2_CHAR(i
));
138 lowcase_table
[v
] = UCS2_CHAR(isupper(i
)?tolower(i
):i
);
142 #ifdef HAVE_SETLOCALE
143 /* Restore the old locale. */
145 setlocale (LC_ALL
, saved_locale
);
146 SAFE_FREE(saved_locale
);
152 see if a ucs2 character can be mapped correctly to a dos character
153 and mapped back to the same character in ucs2
156 int check_dos_char(smb_ucs2_t c
)
158 lazy_initialize_conv();
160 /* Find the right byte, and right bit within the byte; return
162 return (doschar_table
[(c
& 0xffff) / 8] & (1 << (c
& 7))) != 0;
166 static int check_dos_char_slowly(smb_ucs2_t c
)
172 len1
= convert_string(CH_UCS2
, CH_DOS
, &c
, 2, buf
, sizeof(buf
),False
);
176 len2
= convert_string(CH_DOS
, CH_UCS2
, buf
, len1
, &c2
, 2,False
);
185 * Fill out doschar table the hard way, by examining each character
188 void init_doschar_table(void)
192 /* For each byte of packed table */
194 for (i
= 0; i
<= 0xffff; i
+= 8) {
196 for (j
= 0; j
<= 7; j
++) {
201 if (check_dos_char_slowly(c
)) {
205 doschar_table
[i
/8] = byteval
;
211 * Load the valid character map table from <tt>valid.dat</tt> or
212 * create from the configured codepage.
214 * This function is called whenever the configuration is reloaded.
215 * However, the valid character table is not changed if it's loaded
216 * from a file, because we can't unmap files.
219 void init_valid_table(void)
221 static int mapped_file
;
223 const char *allowed
= ".!#$%&'()_-@^`~";
227 /* Can't unmap files, so stick with what we have */
231 valid_file
= map_file(lib_path("valid.dat"), 0x10000);
233 valid_table
= valid_file
;
235 valid_table_use_unmap
= True
;
239 /* Otherwise, we're using a dynamically created valid_table.
240 * It might need to be regenerated if the code page changed.
241 * We know that we're not using a mapped file, so we can
242 * free() the old one. */
244 SAFE_FREE(valid_table
);
246 /* use free rather than unmap */
247 valid_table_use_unmap
= False
;
249 DEBUG(2,("creating default valid table\n"));
250 valid_table
= SMB_MALLOC(0x10000);
251 for (i
=0;i
<128;i
++) {
252 valid_table
[i
] = isalnum(i
) || strchr(allowed
,i
);
255 for (;i
<0x10000;i
++) {
258 valid_table
[i
] = check_dos_char(c
);
262 /*******************************************************************
263 Write a string in (little-endian) unicode format. src is in
264 the current DOS codepage. len is the length in bytes of the
265 string pointed to by dst.
267 if null_terminate is True then null terminate the packet (adds 2 bytes)
269 the return value is the length in bytes consumed by the string, including the
270 null termination if applied
271 ********************************************************************/
273 size_t dos_PutUniCode(char *dst
,const char *src
, size_t len
, BOOL null_terminate
)
275 int flags
= null_terminate
? STR_UNICODE
|STR_NOALIGN
|STR_TERMINATE
276 : STR_UNICODE
|STR_NOALIGN
;
277 return push_ucs2(NULL
, dst
, src
, len
, flags
);
281 /*******************************************************************
282 Skip past a unicode string, but not more than len. Always move
283 past a terminating zero if found.
284 ********************************************************************/
286 char *skip_unibuf(char *src
, size_t len
)
288 char *srcend
= src
+ len
;
290 while (src
< srcend
&& SVAL(src
,0)) {
301 /* Copy a string from little-endian or big-endian unicode source (depending
302 * on flags) to internal samba format destination
305 int rpcstr_pull(char* dest
, void *src
, int dest_len
, int src_len
, int flags
)
314 return pull_ucs2(NULL
, dest
, src
, dest_len
, src_len
, flags
|STR_UNICODE
|STR_NOALIGN
);
317 /* Copy a string from a unistr2 source to internal samba format
318 destination. Use this instead of direct calls to rpcstr_pull() to avoid
319 having to determine whether the source string is null terminated. */
321 int rpcstr_pull_unistr2_fstring(char *dest
, UNISTR2
*src
)
323 return pull_ucs2(NULL
, dest
, src
->buffer
, sizeof(fstring
),
324 src
->uni_str_len
* 2, 0);
327 /* Helper function to return a talloc'ed string. I have implemented it with a
328 * copy because I don't really know how pull_ucs2 and friends calculate the
329 * target size. If this turns out to be a major bottleneck someone with deeper
330 * multi-byte knowledge needs to revisit this.
331 * My (VL) use is dsr_getdcname, which returns 6 strings, the alternative would
332 * have been to manually talloc_strdup them in rpc_client/cli_netlogon.c.
335 char *rpcstr_pull_unistr2_talloc(TALLOC_CTX
*mem_ctx
, const UNISTR2
*src
)
340 result
= pull_ucs2(NULL
, tmp
, src
->buffer
, sizeof(tmp
),
341 src
->uni_str_len
* 2, 0);
342 if (result
== (size_t)-1) {
346 return talloc_strdup(mem_ctx
, tmp
);
349 /* Converts a string from internal samba format to unicode
352 int rpcstr_push(void* dest
, const char *src
, size_t dest_len
, int flags
)
354 return push_ucs2(NULL
, dest
, src
, dest_len
, flags
|STR_UNICODE
|STR_NOALIGN
);
357 /*******************************************************************
358 Convert a (little-endian) UNISTR2 structure to an ASCII string.
359 ********************************************************************/
361 void unistr2_to_ascii(char *dest
, const UNISTR2
*str
, size_t maxlen
)
367 pull_ucs2(NULL
, dest
, str
->buffer
, maxlen
, str
->uni_str_len
*2, STR_NOALIGN
);
370 /*******************************************************************
371 Convert a (little-endian) UNISTR3 structure to an ASCII string.
372 ********************************************************************/
374 void unistr3_to_ascii(char *dest
, const UNISTR3
*str
, size_t maxlen
)
380 pull_ucs2(NULL
, dest
, str
->str
.buffer
, maxlen
, str
->uni_str_len
*2,
384 /*******************************************************************
385 Give a static string for displaying a UNISTR2.
386 ********************************************************************/
388 const char *unistr2_static(const UNISTR2
*str
)
391 unistr2_to_ascii(ret
, str
, sizeof(ret
));
395 /*******************************************************************
396 Duplicate a UNISTR2 string into a null terminated char*
397 using a talloc context.
398 ********************************************************************/
400 char *unistr2_tdup(TALLOC_CTX
*ctx
, const UNISTR2
*str
)
403 int maxlen
= (str
->uni_str_len
+1)*4;
407 s
= (char *)TALLOC(ctx
, maxlen
); /* convervative */
411 pull_ucs2(NULL
, s
, str
->buffer
, maxlen
, str
->uni_str_len
*2, STR_NOALIGN
);
415 /*******************************************************************
416 Convert a wchar to upper case.
417 ********************************************************************/
419 smb_ucs2_t
toupper_w(smb_ucs2_t val
)
421 return upcase_table
[SVAL(&val
,0)];
424 /*******************************************************************
425 Convert a wchar to lower case.
426 ********************************************************************/
428 smb_ucs2_t
tolower_w( smb_ucs2_t val
)
430 return lowcase_table
[SVAL(&val
,0)];
433 /*******************************************************************
434 Determine if a character is lowercase.
435 ********************************************************************/
437 BOOL
islower_w(smb_ucs2_t c
)
439 return upcase_table
[SVAL(&c
,0)] != c
;
442 /*******************************************************************
443 Determine if a character is uppercase.
444 ********************************************************************/
446 BOOL
isupper_w(smb_ucs2_t c
)
448 return lowcase_table
[SVAL(&c
,0)] != c
;
451 /*******************************************************************
452 Determine if a character is valid in a 8.3 name.
453 ********************************************************************/
455 BOOL
isvalid83_w(smb_ucs2_t c
)
457 return valid_table
[SVAL(&c
,0)] != 0;
460 /*******************************************************************
461 Count the number of characters in a smb_ucs2_t string.
462 ********************************************************************/
464 size_t strlen_w(const smb_ucs2_t
*src
)
469 for(len
= 0; *(COPY_UCS2_CHAR(&c
,src
)); src
++, len
++) {
476 /*******************************************************************
477 Count up to max number of characters in a smb_ucs2_t string.
478 ********************************************************************/
480 size_t strnlen_w(const smb_ucs2_t
*src
, size_t max
)
485 for(len
= 0; *(COPY_UCS2_CHAR(&c
,src
)) && (len
< max
); src
++, len
++) {
492 /*******************************************************************
494 ********************************************************************/
496 smb_ucs2_t
*strchr_w(const smb_ucs2_t
*s
, smb_ucs2_t c
)
499 while (*(COPY_UCS2_CHAR(&cp
,s
))) {
501 return (smb_ucs2_t
*)s
;
506 return (smb_ucs2_t
*)s
;
512 smb_ucs2_t
*strchr_wa(const smb_ucs2_t
*s
, char c
)
514 return strchr_w(s
, UCS2_CHAR(c
));
517 /*******************************************************************
519 ********************************************************************/
521 smb_ucs2_t
*strrchr_w(const smb_ucs2_t
*s
, smb_ucs2_t c
)
524 const smb_ucs2_t
*p
= s
;
525 int len
= strlen_w(s
);
532 if (c
== *(COPY_UCS2_CHAR(&cp
,p
))) {
533 return (smb_ucs2_t
*)p
;
539 /*******************************************************************
540 Wide version of strrchr that returns after doing strrchr 'n' times.
541 ********************************************************************/
543 smb_ucs2_t
*strnrchr_w(const smb_ucs2_t
*s
, smb_ucs2_t c
, unsigned int n
)
546 const smb_ucs2_t
*p
= s
;
547 int len
= strlen_w(s
);
549 if (len
== 0 || !n
) {
554 if (c
== *(COPY_UCS2_CHAR(&cp
,p
))) {
559 return (smb_ucs2_t
*)p
;
565 /*******************************************************************
567 ********************************************************************/
569 smb_ucs2_t
*strstr_w(const smb_ucs2_t
*s
, const smb_ucs2_t
*ins
)
574 if (!s
|| !*s
|| !ins
|| !*ins
) {
578 inslen
= strlen_w(ins
);
581 while ((r
= strchr_w(r
, *ins
))) {
582 if (strncmp_w(r
, ins
, inslen
) == 0) {
591 /*******************************************************************
592 Convert a string to lower case.
593 return True if any char is converted
594 ********************************************************************/
596 BOOL
strlower_w(smb_ucs2_t
*s
)
601 while (*(COPY_UCS2_CHAR(&cp
,s
))) {
602 smb_ucs2_t v
= tolower_w(cp
);
604 COPY_UCS2_CHAR(s
,&v
);
612 /*******************************************************************
613 Convert a string to upper case.
614 return True if any char is converted
615 ********************************************************************/
617 BOOL
strupper_w(smb_ucs2_t
*s
)
621 while (*(COPY_UCS2_CHAR(&cp
,s
))) {
622 smb_ucs2_t v
= toupper_w(cp
);
624 COPY_UCS2_CHAR(s
,&v
);
632 /*******************************************************************
633 Convert a string to "normal" form.
634 ********************************************************************/
636 void strnorm_w(smb_ucs2_t
*s
, int case_default
)
638 if (case_default
== CASE_UPPER
) {
645 int strcmp_w(const smb_ucs2_t
*a
, const smb_ucs2_t
*b
)
649 while ((*(COPY_UCS2_CHAR(&cpb
,b
))) && (*(COPY_UCS2_CHAR(&cpa
,a
)) == cpb
)) {
653 return (*(COPY_UCS2_CHAR(&cpa
,a
)) - *(COPY_UCS2_CHAR(&cpb
,b
)));
654 /* warning: if *a != *b and both are not 0 we return a random
655 greater or lesser than 0 number not realted to which
659 int strncmp_w(const smb_ucs2_t
*a
, const smb_ucs2_t
*b
, size_t len
)
664 while ((n
< len
) && (*(COPY_UCS2_CHAR(&cpb
,b
))) && (*(COPY_UCS2_CHAR(&cpa
,a
)) == cpb
)) {
669 return (len
- n
)?(*(COPY_UCS2_CHAR(&cpa
,a
)) - *(COPY_UCS2_CHAR(&cpb
,b
))):0;
672 /*******************************************************************
673 Case insensitive string comparison.
674 ********************************************************************/
676 int strcasecmp_w(const smb_ucs2_t
*a
, const smb_ucs2_t
*b
)
680 while ((*COPY_UCS2_CHAR(&cpb
,b
)) && toupper_w(*(COPY_UCS2_CHAR(&cpa
,a
))) == toupper_w(cpb
)) {
684 return (tolower_w(*(COPY_UCS2_CHAR(&cpa
,a
))) - tolower_w(*(COPY_UCS2_CHAR(&cpb
,b
))));
687 /*******************************************************************
688 Case insensitive string comparison, length limited.
689 ********************************************************************/
691 int strncasecmp_w(const smb_ucs2_t
*a
, const smb_ucs2_t
*b
, size_t len
)
696 while ((n
< len
) && *COPY_UCS2_CHAR(&cpb
,b
) && (toupper_w(*(COPY_UCS2_CHAR(&cpa
,a
))) == toupper_w(cpb
))) {
701 return (len
- n
)?(tolower_w(*(COPY_UCS2_CHAR(&cpa
,a
))) - tolower_w(*(COPY_UCS2_CHAR(&cpb
,b
)))):0;
704 /*******************************************************************
706 ********************************************************************/
708 BOOL
strequal_w(const smb_ucs2_t
*s1
, const smb_ucs2_t
*s2
)
717 return(strcasecmp_w(s1
,s2
)==0);
720 /*******************************************************************
721 Compare 2 strings up to and including the nth char.
722 ******************************************************************/
724 BOOL
strnequal_w(const smb_ucs2_t
*s1
,const smb_ucs2_t
*s2
,size_t n
)
729 if (!s1
|| !s2
|| !n
) {
733 return(strncasecmp_w(s1
,s2
,n
)==0);
736 /*******************************************************************
738 ********************************************************************/
740 smb_ucs2_t
*strdup_w(const smb_ucs2_t
*src
)
742 return strndup_w(src
, 0);
745 /* if len == 0 then duplicate the whole string */
747 smb_ucs2_t
*strndup_w(const smb_ucs2_t
*src
, size_t len
)
754 dest
= SMB_MALLOC_ARRAY(smb_ucs2_t
, len
+ 1);
756 DEBUG(0,("strdup_w: out of memory!\n"));
760 memcpy(dest
, src
, len
* sizeof(smb_ucs2_t
));
765 /*******************************************************************
766 Copy a string with max len.
767 ********************************************************************/
769 smb_ucs2_t
*strncpy_w(smb_ucs2_t
*dest
, const smb_ucs2_t
*src
, const size_t max
)
778 for (len
= 0; (*COPY_UCS2_CHAR(&cp
,(src
+len
))) && (len
< max
); len
++) {
779 cp
= *COPY_UCS2_CHAR(dest
+len
,src
+len
);
782 for ( /*nothing*/ ; len
< max
; len
++ ) {
783 cp
= *COPY_UCS2_CHAR(dest
+len
,&cp
);
789 /*******************************************************************
790 Append a string of len bytes and add a terminator.
791 ********************************************************************/
793 smb_ucs2_t
*strncat_w(smb_ucs2_t
*dest
, const smb_ucs2_t
*src
, const size_t max
)
803 start
= strlen_w(dest
);
804 len
= strnlen_w(src
, max
);
806 memcpy(&dest
[start
], src
, len
*sizeof(smb_ucs2_t
));
807 z
= *COPY_UCS2_CHAR(dest
+start
+len
,&z
);
812 smb_ucs2_t
*strcat_w(smb_ucs2_t
*dest
, const smb_ucs2_t
*src
)
822 start
= strlen_w(dest
);
825 memcpy(&dest
[start
], src
, len
*sizeof(smb_ucs2_t
));
826 z
= *COPY_UCS2_CHAR(dest
+start
+len
,&z
);
832 /*******************************************************************
833 Replace any occurence of oldc with newc in unicode string.
834 ********************************************************************/
836 void string_replace_w(smb_ucs2_t
*s
, smb_ucs2_t oldc
, smb_ucs2_t newc
)
840 for(;*(COPY_UCS2_CHAR(&cp
,s
));s
++) {
842 COPY_UCS2_CHAR(s
,&newc
);
847 /*******************************************************************
849 ********************************************************************/
851 BOOL
trim_string_w(smb_ucs2_t
*s
, const smb_ucs2_t
*front
,
852 const smb_ucs2_t
*back
)
855 size_t len
, front_len
, back_len
;
863 if (front
&& *front
) {
864 front_len
= strlen_w(front
);
865 while (len
&& strncmp_w(s
, front
, front_len
) == 0) {
866 memmove(s
, (s
+ front_len
), (len
- front_len
+ 1) * sizeof(smb_ucs2_t
));
873 back_len
= strlen_w(back
);
874 while (len
&& strncmp_w((s
+ (len
- back_len
)), back
, back_len
) == 0) {
875 s
[len
- back_len
] = 0;
885 The *_wa() functions take a combination of 7 bit ascii
886 and wide characters They are used so that you can use string
887 functions combining C string constants with ucs2 strings
889 The char* arguments must NOT be multibyte - to be completely sure
890 of this only pass string constants */
892 int strcmp_wa(const smb_ucs2_t
*a
, const char *b
)
896 while (*b
&& *(COPY_UCS2_CHAR(&cp
,a
)) == UCS2_CHAR(*b
)) {
900 return (*(COPY_UCS2_CHAR(&cp
,a
)) - UCS2_CHAR(*b
));
903 int strncmp_wa(const smb_ucs2_t
*a
, const char *b
, size_t len
)
908 while ((n
< len
) && *b
&& *(COPY_UCS2_CHAR(&cp
,a
)) == UCS2_CHAR(*b
)) {
913 return (len
- n
)?(*(COPY_UCS2_CHAR(&cp
,a
)) - UCS2_CHAR(*b
)):0;
916 smb_ucs2_t
*strpbrk_wa(const smb_ucs2_t
*s
, const char *p
)
920 while (*(COPY_UCS2_CHAR(&cp
,s
))) {
922 for (i
=0; p
[i
] && cp
!= UCS2_CHAR(p
[i
]); i
++)
925 return (smb_ucs2_t
*)s
;
932 smb_ucs2_t
*strstr_wa(const smb_ucs2_t
*s
, const char *ins
)
941 inslen
= strlen(ins
);
944 while ((r
= strchr_w(r
, UCS2_CHAR(*ins
)))) {
945 if (strncmp_wa(r
, ins
, inslen
) == 0)
953 BOOL
trim_string_wa(smb_ucs2_t
*s
, const char *front
,
959 push_ucs2(NULL
, f
, front
, sizeof(wpstring
) - 1, STR_TERMINATE
);
964 push_ucs2(NULL
, b
, back
, sizeof(wpstring
) - 1, STR_TERMINATE
);
968 return trim_string_w(s
, f
, b
);
971 /*******************************************************************
972 Returns the length in number of wide characters.
973 ******************************************************************/
975 int unistrlen(uint16
*s
)
983 for (len
=0; SVAL(s
,0); s
++,len
++) {
990 /*******************************************************************
991 Strcpy for unicode strings. Returns length (in num of wide chars).
993 ********************************************************************/
995 int unistrcpy(uint16
*dst
, uint16
*src
)
999 while (SVAL(src
,0)) {
1009 * Samba ucs2 type to UNISTR2 conversion
1011 * @param ctx Talloc context to create the dst strcture (if null) and the
1012 * contents of the unicode string.
1013 * @param dst UNISTR2 destination. If equals null, then it's allocated.
1014 * @param src smb_ucs2_t source.
1015 * @param max_len maximum number of unicode characters to copy. If equals
1016 * null, then null-termination of src is taken
1018 * @return copied UNISTR2 destination
1021 UNISTR2
* ucs2_to_unistr2(TALLOC_CTX
*ctx
, UNISTR2
* dst
, smb_ucs2_t
* src
)
1029 len
= strlen_w(src
);
1031 /* allocate UNISTR2 destination if not given */
1033 dst
= TALLOC_P(ctx
, UNISTR2
);
1038 dst
->buffer
= TALLOC_ARRAY(ctx
, uint16
, len
+ 1);
1043 /* set UNISTR2 parameters */
1044 dst
->uni_max_len
= len
+ 1;
1046 dst
->uni_str_len
= len
;
1048 /* copy the actual unicode string */
1049 strncpy_w(dst
->buffer
, src
, dst
->uni_max_len
);
1054 /*************************************************************
1055 ascii only toupper - saves the need for smbd to be in C locale.
1056 *************************************************************/
1058 int toupper_ascii(int c
)
1060 smb_ucs2_t uc
= toupper_w(UCS2_CHAR(c
));
1061 return UCS2_TO_CHAR(uc
);
1064 /*************************************************************
1065 ascii only tolower - saves the need for smbd to be in C locale.
1066 *************************************************************/
1068 int tolower_ascii(int c
)
1070 smb_ucs2_t uc
= tolower_w(UCS2_CHAR(c
));
1071 return UCS2_TO_CHAR(uc
);
1074 /*************************************************************
1075 ascii only isupper - saves the need for smbd to be in C locale.
1076 *************************************************************/
1078 int isupper_ascii(int c
)
1080 return isupper_w(UCS2_CHAR(c
));
1083 /*************************************************************
1084 ascii only islower - saves the need for smbd to be in C locale.
1085 *************************************************************/
1087 int islower_ascii(int c
)
1089 return islower_w(UCS2_CHAR(c
));