1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 5] 5.4 Name Mangling and Case</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly & Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:33:01Z"><META NAME="DC.type" CONTENT="Text.Monograph"><META NAME="DC.format" CONTENT="text/html" SCHEME="MIME"><META NAME="DC.source" CONTENT="" SCHEME="ISBN"><META NAME="DC.language" CONTENT="en-US"><META NAME="generator" CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"></head> 5<BODY BGCOLOR="#FFFFFF" TEXT="#000000" link="#990000" vlink="#0000CC"> 6<table BORDER="0" CELLPADDING="0" CELLSPACING="0" width="90%"> 7<tr> 8<td width="25%" valign="TOP"> 9<img hspace=10 vspace=10 src="gifs/samba.s.gif" 10alt="Using Samba" align=left valign=top border=0> 11</td> 12<td height="105" valign="TOP"> 13<br> 14<H2>Using Samba</H2> 15<font size="-1"> 16Robert Eckstein, David Collier-Brown, Peter Kelly 17<br>1st Edition November 1999 18<br>1-56592-449-5, Order Number: 4495 19<br>416 pages, $34.95 20</font> 21<p> <a href="http://www.oreilly.com/catalog/samba/">Buy the hardcopy</a> 22<p><a href="index.html">Table of Contents</a> 23</td> 24</tr> 25</table> 26<hr size=1 noshade> 27<!--sample chapter begins --> 28 29<center> 30<DIV CLASS="htmlnav"> 31<TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 32<TR> 33<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 34<A CLASS="sect1" HREF="ch05_03.html" TITLE="5.3 File Permissions and Attributes on MS-DOS and Unix"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 5.3 File Permissions and Attributes on MS-DOS and Unix" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 36<B> 37<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1"> 38<A CLASS="chapter" REL="up" HREF="ch05_01.html" TITLE="5. Browsing and Advanced Disk Shares "> 39Chapter 5<br> 40Browsing and Advanced Disk Shares </a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 41<A CLASS="sect1" HREF="ch05_05.html" TITLE="5.5 Locks and Oplocks"> 42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 5.5 Locks and Oplocks" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 43</div> 44<blockquote> 45<div> 46<H2 CLASS="sect1"> 47<A CLASS="title" NAME="ch05-30534"> 485.4 Name Mangling and Case</a></h2><P CLASS="para">Back in the days of DOS and Windows 3.1, every filename was limited to eight upper-case characters, followed by a dot, and three more uppercase characters. This was known as the <I CLASS="firstterm"> 498.3 format</i>, and was a huge nuisance. Windows 95/98, Windows NT, and Unix have since relaxed this problem by allowing many more case-sensitive characters to make up a filename. <A CLASS="xref" HREF="ch05_04.html#ch05-24354"> 50Table 5.6</a> shows the current naming state of several popular operating systems. </p><br> 51<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 52<CAPTION CLASS="table"> 53<A CLASS="title" NAME="ch05-24354"> 54Table 5.6: Operating System Filename Limitations </a></caption><THEAD CLASS="thead"> 55<TR CLASS="row" VALIGN="TOP"> 56<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 57<P CLASS="para"> 58Operating System</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 59<P CLASS="para"> 60File Naming Rules</p></th></tr></thead><TBODY CLASS="tbody"> 61<TR CLASS="row" VALIGN="TOP"> 62<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 63<P CLASS="para"> 64DOS 6.22 or below</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 65<P CLASS="para">Eight characters followed by a dot followed by a three-letter extension (8.3 format); case insensitive</p></td></tr><TR CLASS="row" VALIGN="TOP"> 66<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 67<P CLASS="para"> 68Windows 3.1 for Workgroups</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 69<P CLASS="para"> 70Eight characters followed by a dot followed by a three-letter extension (8.3 format); case insensitive</p></td></tr><TR CLASS="row" VALIGN="TOP"> 71<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 72<P CLASS="para"> 73Windows 95/98</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 74<P CLASS="para"> 75127 characters; case sensitive</p></td></tr><TR CLASS="row" VALIGN="TOP"> 76<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 77<P CLASS="para"> 78Windows NT</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 79<P CLASS="para"> 80127 characters; case sensitive</p></td></tr><TR CLASS="row" VALIGN="TOP"> 81<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 82<P CLASS="para"> 83Unix</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 84<P CLASS="para"> 85255 characters; case sensitive</p></td></tr></tbody></table><P CLASS="para">Samba still has to remain backwards compatible with network clients who store files only in the 8.3 format, such as Windows for Workgroups. If a user creates a file on a share called <EM CLASS="emphasis"> 86antidisestablishmentarianism.txt</em>, a Windows for Workgroups client couldn't tell it apart from another file in the same directory called <EM CLASS="emphasis"> 87antidisease.txt</em>. Like Windows 95/98 and Windows NT, Samba has to employ a special methodology of translating a long filename to an 8.3 filename in such a way that similar filenames will not cause collisions. This is called <I CLASS="firstterm"> 88name mangling</i>, and Samba deals with this in a manner that is similar, but not identical to, Windows 95 and its successors.</p><DIV CLASS="sect2"> 89<H3 CLASS="sect2"> 90<A CLASS="title" NAME="ch05-pgfId-959448"> 915.4.1 The Samba Mangling Operation</a></h3><P CLASS="para">Here is how Samba mangles a long filename into an 8.3 filename:</p><UL CLASS="itemizedlist"> 92<LI CLASS="listitem"> 93<P CLASS="para"> 94<A CLASS="listitem" NAME="ch05-pgfId-959148"> 95</a>If the original filename does not begin with a dot, up to the first five alphanumeric characters that occur before the last dot (if there is one) are converted to uppercase. These characters are used as the first five characters of the 8.3 mangled filename.</p></li><LI CLASS="listitem"> 96<P CLASS="para"> 97<A CLASS="listitem" NAME="ch05-pgfId-959229"> 98</a>If the original filename begins with a dot, the dot is removed and up to the first five alphanumeric characters that occur before the last dot (if there is one) are converted to uppercase. These characters are used as the first five characters of the 8.3 mangled filename.</p></li><LI CLASS="listitem"> 99<P CLASS="para"> 100<A CLASS="listitem" NAME="ch05-pgfId-959228"> 101</a>These characters are immediately followed a special mangling character: by default, a tilde (~), although Samba allows you to change this character.</p></li><LI CLASS="listitem"> 102<P CLASS="para"> 103<A CLASS="listitem" NAME="ch05-pgfId-959149"> 104</a>The base of the long filename before the last period is hashed into a two-character code; parts of the name after the last dot may be used if necessary. This two character code is appended to the 8.3 filename after the mangling character.</p></li><LI CLASS="listitem"> 105<P CLASS="para"> 106<A CLASS="listitem" NAME="ch05-pgfId-967828"> 107</a>The first three characters after the last dot (if there is one) of the original filename are converted to uppercase and appended onto the mangled name as the extension. If the original filename began with a dot, three underscores (<CODE CLASS="literal">___</code>) are used as the extension instead.</p></li></ul><P CLASS="para"> 108Here are some examples:</p><PRE CLASS="programlisting"> 109virtuosity.dat VIRTU~F1.DAT 110.htaccess HTACC~U0.___ 111hello.java HELLO~1F.JAV 112team.config.txt TEAMC~04.TXT 113antidisestablishmentarianism.txt ANTID~E3.TXT 114antidiseast.txt ANTID~9K.TXT</pre><P CLASS="para"> 115Using these rules will allow Windows for Workgroups to differentiate the two files on behalf of the poor individual who is forced to see the network through the eyes of that operating system. Note that the same long filename should always hash to the same mangled name with Samba; this doesn't always happen with Windows. The downside of this approach is that there can still be collisions; however, the chances are greatly reduced.</p><P CLASS="para"> 116You generally want to use the mangling configuration options with only the oldest clients. We recommend doing this without disrupting other clients by adding an <CODE CLASS="literal"> 117include</code> directive to the <I CLASS="filename"> 118smb.conf</i> file:</p><PRE CLASS="programlisting"> 119[global] 120 include = /ucsr/local/samba/lib/smb.conf.%m</pre><P CLASS="para"> 121This resolves to <I CLASS="filename"> 122smb.conf.WfWg</i> when a Window for Workgroups client attaches. Now you can create a file <I CLASS="filename"> 123/usr/local/samba/lib/smb.conf.WfWg</i> which might contain these options:</p><PRE CLASS="programlisting"> 124[global] 125 case sensitive = no 126 default case = upper 127 preserve case = no 128 short preserve case = no 129 mangle case = yes 130 mangled names= yes</pre><P CLASS="para"> 131If you are not using Windows for Workgroups 3.1, then you probably do not need to change any of these options from their defaults.</p><DIV CLASS="sect3"> 132<H4 CLASS="sect3"> 133<A CLASS="title" NAME="ch05-pgfId-959447"> 1345.4.1.1 Representing and resolving filenames with Samba</a></h4><P CLASS="para">Another item that we should point out is that there is a difference between how an operating system <EM CLASS="emphasis"> 135represents</em> a file and how it <EM CLASS="emphasis"> 136resolves</em> it. For example, if you've used Windows 95/98/NT, you have likely run across a file called <I CLASS="filename"> 137README.TXT</i>. The file can be represented by the operating system entirely in uppercase letters. However, if you open an MS-DOS prompt and enter the command <CODE CLASS="literal"> 138edit</code> <CODE CLASS="literal"> 139readme.txt</code>, the all-caps file is loaded into the editing program, even though you typed the name in lowercase letters!</p><P CLASS="para"> 140This is because the Windows 95/98/NT family of operating systems resolves files in a case-insensitive manner, even though the files are represented it in a case-sensitive manner. Unix-based operating systems, on the other hand, always resolve files in a case-sensitive manner; if you try to edit <I CLASS="filename"> 141README.TXT</i> with the command <CODE CLASS="literal"> 142vi</code> <CODE CLASS="literal"> 143readme.txt</code>, you will likely be editing the empty buffer of a new file.</p><P CLASS="para"> 144Here is how Samba handles case: if the <CODE CLASS="literal"> 145preserve</code> <CODE CLASS="literal"> 146case</code> is set to <CODE CLASS="literal"> 147yes</code>, Samba will always use the case provided by the operating system for representing (not resolving) filenames. If it is set to <CODE CLASS="literal"> 148no</code>, it will use the case specified by the <CODE CLASS="literal"> 149default</code> <CODE CLASS="literal"> 150case</code> option. The same is true for <CODE CLASS="literal"> 151short</code> <CODE CLASS="literal"> 152preserve</code> <CODE CLASS="literal"> 153case</code>. If this option is set to <CODE CLASS="literal"> 154yes</code>, Samba will use the default case of the operating system for representing 8.3 filenames; otherwise it will use the case specified by the <CODE CLASS="literal"> 155default</code> <CODE CLASS="literal"> 156case</code> option. Finally, Samba will always resolve filenames in its shares based on the value of the <CODE CLASS="literal"> 157case</code> <CODE CLASS="literal"> 158sensitive</code> option.</p></div></div><DIV CLASS="sect2"> 159<H3 CLASS="sect2"> 160<A CLASS="title" NAME="ch05-pgfId-970053"> 1615.4.2 Mangling Options</a></h3><P CLASS="para">Samba allows you to give it more refined instructions on how it should perform name mangling, including those controlling the case sensitivity, the character inserted to form a mangled name, and the ability to manually map filenames from one format to another. These options are shown in <A CLASS="xref" HREF="ch05_04.html#ch05-47431"> 162Table 5.7</a>. </p><br> 163<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 164<CAPTION CLASS="table"> 165<A CLASS="title" NAME="ch05-47431"> 166Table 5.7: Name Mangling Options </a></caption><THEAD CLASS="thead"> 167<TR CLASS="row" VALIGN="TOP"> 168<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 169<P CLASS="para"> 170Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 171<P CLASS="para"> 172Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 173<P CLASS="para"> 174Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 175<P CLASS="para"> 176Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 177<P CLASS="para"> 178Scope</p></th></tr></thead><TBODY CLASS="tbody"> 179<TR CLASS="row" VALIGN="TOP"> 180<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 181<P CLASS="para"> 182<CODE CLASS="literal"> 183case sensitive</code></p><P CLASS="para"> 184<CODE CLASS="literal"> 185(casesignames)</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 186<P CLASS="para"> 187boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 188<P CLASS="para"> 189If <CODE CLASS="literal"> 190yes</code>, Samba will treat filenames as case-sensitive (Windows doesn't).</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 191<P CLASS="para"> 192<CODE CLASS="literal"> 193no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 194<P CLASS="para"> 195Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 196<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 197<P CLASS="para"> 198<CODE CLASS="literal"> 199default case</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 200<P CLASS="para"> 201(<CODE CLASS="literal">upper</code> or <CODE CLASS="literal"> 202lower</code>)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 203<P CLASS="para"> 204Case to assume as default (only used when preserve case is <CODE CLASS="literal"> 205no</code>).</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 206<P CLASS="para"> 207Lower</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 208<P CLASS="para"> 209Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 210<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 211<P CLASS="para"> 212<CODE CLASS="literal"> 213preserve case</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 214<P CLASS="para"> 215boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 216<P CLASS="para"> 217If <CODE CLASS="literal"> 218yes</code>, keep the case the client supplied (i.e., do not convert to <CODE CLASS="literal"> 219default case</code>).</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 220<P CLASS="para"> 221<CODE CLASS="literal"> 222yes</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 223<P CLASS="para"> 224Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 225<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 226<P CLASS="para"> 227<CODE CLASS="literal"> 228short preserve case</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 229<P CLASS="para"> 230boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 231<P CLASS="para"> 232If <CODE CLASS="literal"> 233yes</code>, preserve case of 8.3-format names that the client provides.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 234<P CLASS="para"> 235<CODE CLASS="literal"> 236yes</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 237<P CLASS="para"> 238Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 239<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 240<P CLASS="para"> 241<CODE CLASS="literal"> 242mangle case</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 243<P CLASS="para"> 244boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 245<P CLASS="para"> 246Mangle a name if it is mixed case.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 247<P CLASS="para"> 248<CODE CLASS="literal"> 249no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 250<P CLASS="para"> 251Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 252<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 253<P CLASS="para"> 254<CODE CLASS="literal"> 255mangled names</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 256<P CLASS="para"> 257boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 258<P CLASS="para"> 259Mangles long names into 8.3 DOS format.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 260<P CLASS="para"> 261<CODE CLASS="literal"> 262yes</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 263<P CLASS="para"> 264Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 265<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 266<P CLASS="para"> 267<CODE CLASS="literal"> 268mangling char</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 269<P CLASS="para"> 270string (single character)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 271<P CLASS="para"> 272Gives mangling character.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 273<P CLASS="para"> 274<CODE CLASS="literal"> 275~</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 276<P CLASS="para"> 277Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 278<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 279<P CLASS="para"> 280<CODE CLASS="literal"> 281mangled stack</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 282<P CLASS="para"> 283numerical</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 284<P CLASS="para"> 285Number of mangled names to keep on the local mangling stack.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 286<P CLASS="para"> 287<CODE CLASS="literal"> 28850</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 289<P CLASS="para"> 290Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 291<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 292<P CLASS="para"> 293<CODE CLASS="literal"> 294mangled map</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 295<P CLASS="para"> 296string (list of patterns)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 297<P CLASS="para"> 298Allows mapping of filenames from one format into another.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 299<P CLASS="para"> 300None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 301<P CLASS="para"> 302Share</p></td></tr></tbody></table><DIV CLASS="sect3"> 303<H4 CLASS="sect3"> 304<A CLASS="title" NAME="ch05-pgfId-960977"> 3055.4.2.1 case sensitive</a></h4><P CLASS="para">This share-level option, which has the obtuse synonym <CODE CLASS="literal"> 306casesignames</code>, specifies whether Samba should preserve case when resolving filenames in a specific share. The default value for this option is <CODE CLASS="literal"> 307no</code>, which is how Windows handles file resolution. If clients are using an operating system that takes advantage of case-sensitive filenames, you can set this configuration option to <CODE CLASS="literal"> 308yes</code> as shown here:</p><PRE CLASS="programlisting"> 309[accounting] 310 case sensitive = yes</pre><P CLASS="para"> 311Otherwise, we recommend that you leave this option set to its default.</p></div><DIV CLASS="sect3"> 312<H4 CLASS="sect3"> 313<A CLASS="title" NAME="ch05-pgfId-958897"> 3145.4.2.2 default case</a></h4><P CLASS="para"> 315The <CODE CLASS="literal"> 316default</code> <CODE CLASS="literal"> 317case</code> option is used with <CODE CLASS="literal"> 318preserve</code> <CODE CLASS="literal"> 319case</code>. This specifies the default case (upper or lower) that Samba will use when it creates a file on one of its shares on behalf of a client. The default case is <CODE CLASS="literal"> 320lower</code>, which means that newly created files will use the mixed-case names given to them by the client. If you need to, you can override this global option by specifying the following:</p><PRE CLASS="programlisting"> 321[global] 322 default case = upper</pre><P CLASS="para"> 323If you specify this value, the names of newly created files will be translated into uppercase, and cannot be overridden in a program. We recommend that you use the default value unless you are dealing with a Windows for Workgroups or other 8.3 client, in which case it should be <CODE CLASS="literal"> 324upper</code>.</p></div><DIV CLASS="sect3"> 325<H4 CLASS="sect3"> 326<A CLASS="title" NAME="ch05-pgfId-958899"> 3275.4.2.3 preserve case</a></h4><P CLASS="para"> 328This option specifies whether a file created by Samba on behalf of the client is created with the case provided by the client operating system, or the case specified by the <CODE CLASS="literal"> 329default</code> <CODE CLASS="literal"> 330case</code> configuration option above. The default value is <CODE CLASS="literal"> 331yes</code>, which uses the case provided by the client operating system. If it is set to <CODE CLASS="literal"> 332no</code>, the value of the <CODE CLASS="literal"> 333default</code> <CODE CLASS="literal"> 334case</code> option is used.</p><P CLASS="para"> 335Note that this option does not handle 8.3 file requests sent from the client - see the <CODE CLASS="literal"> 336short</code> <CODE CLASS="literal"> 337preserve</code> <CODE CLASS="literal"> 338case</code> option below. You may want to set this option to <CODE CLASS="literal"> 339yes</code> if applications that create files on the Samba server are sensitive to the case used when creating the file. If you want to force Samba, for example, to mimic the behavior of a Windows NT filesystem, you can leave this option to its default, <CODE CLASS="literal"> 340yes</code>.</p></div><DIV CLASS="sect3"> 341<H4 CLASS="sect3"> 342<A CLASS="title" NAME="ch05-pgfId-958901"> 3435.4.2.4 short preserve case</a></h4><P CLASS="para"> 344This option specifies whether an 8.3 filename created by Samba on behalf of the client is created with the default case of the client operating system, or the case specified by the <CODE CLASS="literal"> 345default</code> <CODE CLASS="literal"> 346case</code> configuration option. The default value is <CODE CLASS="literal"> 347yes</code>, which uses the case provided by the client operating system. You can let Samba choose the case through the <CODE CLASS="literal"> 348default</code> <CODE CLASS="literal"> 349case</code> option by setting it as follows:</p><PRE CLASS="programlisting"> 350[global] 351 short preserve case = no</pre><P CLASS="para"> 352If you want to force Samba to mimic the behavior of a Windows NT filesystem, you can leave this option set to its default, <CODE CLASS="literal"> 353yes</code>.</p></div><DIV CLASS="sect3"> 354<H4 CLASS="sect3"> 355<A CLASS="title" NAME="ch05-pgfId-958984"> 3565.4.2.5 mangled names</a></h4><P CLASS="para"> 357This share-level option specifies whether Samba will mangle filenames for 8.3 clients in that share. If the option is set to <CODE CLASS="literal"> 358no</code>, Samba will not mangle the names and (depending on the client), they will either be invisible or appear truncated to those using 8.3 operating systems. The default value is <CODE CLASS="literal"> 359yes</code>. You can override it per share as follows:</p><PRE CLASS="programlisting"> 360[data] 361 mangled names = no</pre></div><DIV CLASS="sect3"> 362<H4 CLASS="sect3"> 363<A CLASS="title" NAME="ch05-pgfId-958903"> 3645.4.2.6 mangle case</a></h4><P CLASS="para"> 365This option tells Samba whether it should mangle filenames that are not composed entirely of the case specified using the <CODE CLASS="literal"> 366default</code> <CODE CLASS="literal"> 367case</code> configuration option. The default for this option is <CODE CLASS="literal"> 368no</code>. If you set it to <CODE CLASS="literal"> 369yes</code>, you should be sure that all clients will be able to handle the mangled filenames that result. You can override it per share as follows:</p><PRE CLASS="programlisting"> 370[data] 371 mangle case = yes</pre><P CLASS="para"> 372We recommend that you leave this option alone unless you have a well-justified need to change it.</p></div><DIV CLASS="sect3"> 373<H4 CLASS="sect3"> 374<A CLASS="title" NAME="ch05-pgfId-958976"> 3755.4.2.7 mangling char</a></h4><P CLASS="para"> 376This share-level option specifies the mangling character used when Samba mangles filenames into the 8.3 format. The default character used is a tilde (~). You can reset it to whatever character you wish, for instance:</p><PRE CLASS="programlisting"> 377[data] 378 mangling char = #</pre></div><DIV CLASS="sect3"> 379<H4 CLASS="sect3"> 380<A CLASS="title" NAME="ch05-pgfId-959322"> 3815.4.2.8 mangled stack</a></h4><P CLASS="para"> 382Samba maintains a local stack of recently mangled 8.3 filenames; this stack can be used to reverse map mangled filenames back to their original state. This is often needed by applications that create and save a file, close it, and need to modify it later. The default number of long filename/mangled filename pairs stored on this stack is 50. However, if you want to cut down on the amount of processor time used to mangle filenames, you can increase the size of the stack to whatever you wish, at the expense of memory and slightly slower file access.</p><PRE CLASS="programlisting"> 383[global] 384 mangled stack = 100</pre></div><DIV CLASS="sect3"> 385<H4 CLASS="sect3"> 386<A CLASS="title" NAME="ch05-pgfId-959327"> 3875.4.2.9 mangled map</a></h4><P CLASS="para"> 388If the default behavior of name mangling is not sufficient, you can give Samba further instructions on how to behave using the <CODE CLASS="literal"> 389mangled</code> <CODE CLASS="literal"> 390map</code> option. This option allows you to specify mapping patterns that can be used before or even in place of name mangling performed by Samba. For example:</p><PRE CLASS="programlisting"> 391[data] 392 mangled map =(*.database *.db) (*.class *.cls)</pre><P CLASS="para"> 393Here, Samba is instructed to search each file it encounters for characters that match the first pattern specified in the parenthesis and convert them to the modified second pattern in the parenthesis for display on an 8.3 client. This is useful in the event that name mangling converts the filename incorrectly or to a format that the client cannot understand readily. Patterns are separated by whitespaces. </p></div></div></div></blockquote> 394<div> 395<center> 396<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 397<TR> 398<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 399<A CLASS="sect1" HREF="ch05_03.html" TITLE="5.3 File Permissions and Attributes on MS-DOS and Unix"> 400<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 5.3 File Permissions and Attributes on MS-DOS and Unix" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 401<A CLASS="book" HREF="index.html" TITLE=""> 402<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 403<A CLASS="sect1" HREF="ch05_05.html" TITLE="5.5 Locks and Oplocks"> 404<IMG SRC="gifs/txtnexta.gif" ALT="Next: 5.5 Locks and Oplocks" BORDER="0"></a></td></tr><TR> 405<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 4065.3 File Permissions and Attributes on MS-DOS and Unix</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 407<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 408<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 4095.5 Locks and Oplocks</td></tr></table><hr noshade size=1></center> 410</div> 411 412<!-- End of sample chapter --> 413<CENTER> 414<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 415<A HREF="http://www.oreilly.com/"> 416<B>O'Reilly Home</B></A> <B> | </B> 417<A HREF="http://www.oreilly.com/sales/bookstores"> 418<B>O'Reilly Bookstores</B></A> <B> | </B> 419<A HREF="http://www.oreilly.com/order_new/"> 420<B>How to Order</B></A> <B> | </B> 421<A HREF="http://www.oreilly.com/oreilly/contact.html"> 422<B>O'Reilly Contacts<BR></B></A> 423<A HREF="http://www.oreilly.com/international/"> 424<B>International</B></A> <B> | </B> 425<A HREF="http://www.oreilly.com/oreilly/about.html"> 426<B>About O'Reilly</B></A> <B> | </B> 427<A HREF="http://www.oreilly.com/affiliates.html"> 428<B>Affiliated Companies</B></A><p> 429<EM>© 1999, O'Reilly & Associates, Inc.</EM> 430</FONT> 431</CENTER> 432</BODY> 433</html> 434