--- /dev/null
+Note: All files in this directory are DOS formatted (CRLF line terminator).\r
+\r
+!!! VIRUS WARNING !!! I do not know if VALIDCHR.COM is virus free !!!\r
+I think that my system is virus free here because I do not run any games\r
+or other copied software. I only run Shareware/Freeware etc. from CD-ROMs\r
+or from registered disks, however I do not use viral scanners because\r
+I have not registered any (I consider `having no sex' is better than\r
+`testing for AIDS on a regular basis', if you know what I mean).\r
+\r
+This is VALIDCHR, a little DOS program I wrote to create\r
+an apropriate `valid chars =' config parameter.\r
+It is freeware and is thought to be distributed freely with Samba.\r
+\r
+WARNING:\r
+ Your SMB driver may use another character map as the one VALIDCHR\r
+ sees. The only way you can tell this is that some file names fail.\r
+ Under Win95 everything is fine, though.\r
+\r
+Usage:\r
+ c:\r
+ mkdir junk_dir\r
+ cd junk_dir\r
+ a:validchr > a:output.log\r
+ cd ..\r
+ rmdir junk_dir\r
+\r
+Siedeffects:\r
+ Files named *.TST may be deleted.\r
+\r
+Verification:\r
+ For diagnostic purpose you can run VALIDCHR on a Samba mounted drive.\r
+ Then you can use unix diff to compare the output of the network and\r
+ the hard drive. These two outputs usually differ! However there\r
+ should be few differences. I get following on Win95 (c: visa e:)\r
+ 104c104\r
+ < 152: length 0\r
+ ---\r
+ > 152: 95\r
+ (diff line for `valid chars =' deleted because it's uninteresting)\r
+ You can see, `y diaresis' can be mapped on the network drive while\r
+ it cannot be mapped on the hard drive. Everything else is identical.\r
+ However this gives a hint that one can improve the mapping.\r
+\r
+Bugs:\r
+ Yes, probably some.\r
+\r
+\r
+VALIDCHR must be run on the system which character mapping should be probed.\r
+It must be run on the hard drive for this. VALIDCHR ALTERS THE CURRENT\r
+DIRECTORY AND REMOVES SOME FILES, SO ALWAYS RUN IT IN A junk DIRECTORY !!!\r
+You should redirect the output of VALIDCHR. At the end of the output is a\r
+line like\r
+ valid chars = x:y y:x x:x ... a:b c ...\r
+which is suitable for your smb.conf file. (you should remove the DOS CR\r
+character, because DOS uses CRLF while Unix uses LF only.)\r
+\r
+Note that some mappings at the beginning of the `valid chars =' line like\r
+A:B B:A B:B\r
+might look a little bit strange to you, however sometimes character A\r
+has to be mapped to character B independently of a default mapping\r
+to uppercase or lowercase while character B must not be touched. I found\r
+this out the hard way ... Consider it a crude workaround, because Samba\r
+lacks the possibility to map characters in one direction only!\r
+\r
+VALIDCHR usually issues one warning for character 32.\r
+You may ignore these and any other warnings.\r
+\r
+VALIDCHR does not test for character NUL (this is the directory end marker).\r
+\r
+validchr.c is the source code to validchr.com\r
+ You may do anything with the source code (copy, change, sell, burn)\r
+validchr.com is a Borland C compiled binary.\r
+ Beware, it may contain a virus (if my system contains one).\r
+nwdos70.out is the output of an VALIDCHR-run under Novell DOS 7.0\r
+ while no codepage (no display.sys) was active.\r
+msdos70.out is the output of an VALIDCHR-run under MS-DOS 7.0 (Win95 DOS)\r
+ while codepage 850 was active.\r
+\r
+I have no other MS-DOS systems at home currently.\r
+(I have access to MS-DOS 3.0, 3.2, 3.3, 5.0 and 6.22, however I have no time\r
+ to run VALIDCHR there)\r
+\r
+Some words to the output\r
+(for people not fammiliar with programming language C):\r
+\r
+probed_char: [text] mapped_char\r
+\r
+probed_char is the character probed to be written to disk\r
+text may be empty or contain:\r
+ open File could not be opened.\r
+ close File could not be closed (should not happen)\r
+ length File name was shortened (usually occurs on SPC) \r
+ unlink File cannot be unlinked (usually when open fails)\r
+mapped_char is the character which is used by MS-DOS in the directory\r
+ This is usually the uppercase character.\r
+ The mapped character is 0 if something failed (you may say\r
+ that the character is not supported)\r
+\r
+The last line in the output is documented in the smb.conf manual page ;)\r
+\r
+tino@augsburg.net\r
--- /dev/null
+/* by tino@augsburg.net\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <string.h>\r
+\r
+#include <dirent.h>\r
+\r
+unsigned char\r
+test(void)\r
+{\r
+ DIR *dir;\r
+ struct dirent *dp;\r
+ unsigned char c;\r
+\r
+ if ((dir=opendir("."))==0)\r
+ {\r
+ perror("open .");\r
+ return 0;\r
+ }\r
+ c = 0;\r
+ while ((dp=readdir(dir))!=0)\r
+ {\r
+ size_t len;\r
+\r
+ len = strlen(dp->d_name);\r
+ if (len<4)\r
+ continue;\r
+ if (strcmp(dp->d_name+len-4, ".TST"))\r
+ continue;\r
+ if (len!=5)\r
+ {\r
+ fprintf(stderr, "warning: %s\n", dp->d_name);\r
+ printf(" length");\r
+ continue;\r
+ }\r
+ if (c)\r
+ printf(" double%d\n", c);\r
+ c = dp->d_name[0];\r
+ }\r
+ if (closedir(dir))\r
+ perror("close .");\r
+ return c;\r
+}\r
+\r
+int\r
+main(void)\r
+{\r
+ char name[256];\r
+ unsigned char map[256], upper[256], lower[256];\r
+ int i, j, c;\r
+ FILE *fd;\r
+\r
+ if (test())\r
+ {\r
+ printf("There are *.TST files, please remove\n");\r
+ return 0;\r
+ }\r
+ for (i=0; ++i<256; )\r
+ {\r
+ lower[i] = i;\r
+ upper[i] = 0;\r
+ }\r
+ for (i=256; --i; )\r
+ {\r
+ map[i] = i;\r
+ strcpy(name, "..TST");\r
+ name[0] = i;\r
+ printf("%d:", i);\r
+ if ((fd=fopen(name, "w"))==0)\r
+ printf(" open");\r
+ else\r
+ fclose(fd);\r
+ c = test();\r
+ if (unlink(name))\r
+ printf(" unlink");\r
+ if (c==i)\r
+ printf(" ok");\r
+ else\r
+ printf(" %d", c);\r
+ printf("\n");\r
+ if (c!=i)\r
+ {\r
+ upper[c]++;\r
+ lower[c] = i;\r
+ }\r
+ map[i] = c;\r
+ }\r
+\r
+ /* Uppercase characters are detected above on:\r
+ * The character is mapped to itself and there is a\r
+ * character which maps to it.\r
+ * Lowercase characters are the lowest character pointing to another one.\r
+ * Else it is a one way character.\r
+ *\r
+ * For this reason we have to process the list\r
+ * 1) for 'one way' characters\r
+ * 'one way' is something which is no upper and no lower character.\r
+ * This is an awful, crude and ugly hack due to missing Samba support.\r
+ * 2) for true uppercase/lowercase characters\r
+ * 3) for standalone characters\r
+ * Note that there might be characters which do not fall into 1 to 3.\r
+ */\r
+ printf("\n valid chars =");\r
+ for (i=0; ++i<256; )\r
+ if (map[i] && map[i]!=i && lower[map[i]]!=i)\r
+ {\r
+ if (!upper[i])\r
+ printf(" %d:%d %d:%d %d:%d", /*1*/\r
+ map[i], i, i, map[i], map[i], map[i]);\r
+ else\r
+ fprintf(stderr, "ignoring map %d->%d because of %d->%d\n",\r
+ lower[i], i, i, map[i]);\r
+ }\r
+ for (i=0; ++i<256; )\r
+ if (map[i] && map[i]==i)\r
+ if (upper[i])\r
+ printf(" %d:%d", lower[i], i); /*2*/\r
+ else\r
+ printf(" %d", i); /*3*/\r
+ printf("\n");\r
+ return 0;\r
+}\r