Bug 1552 - Samba will create files that Windows will not
Summary: Samba will create files that Windows will not
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.12
Hardware: All FreeBSD
: P3 normal
Target Milestone: none
Assignee: Richard Sharpe
QA Contact:
Depends on:
Reported: 2004-07-22 09:14 UTC by Richard Sharpe
Modified: 2006-02-27 14:00 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sharpe 2004-07-22 09:14:09 UTC
If you write a program that uses non-printing chars (in the range 0x00 to 0x1F),
samba will create such files when CreateFile (NTCreate&X) is used, while Windows
will not. 

Windows returns the error: 

STATUS_OBJECT_NAME_INVALID, The filename, directory name, or volume label syntax
is incorrect.

It seems that Samba should really do the same.

Here is some test code to do such things:

// This is the main project file for VC++ application project 
// generated using an Application Wizard.

#include "stdafx.h"
#include "windows.h"

#using <mscorlib.dll>
#include <tchar.h>

using namespace System;

// This is the entry point for this application
int _tmain(void)
        HANDLE hWriteFile;
        LPTSTR FileName = "f:\\\\\001\002\003\004\005\006\007\008";
        DWORD create_mode = CREATE_ALWAYS, 
                  access_mode = GENERIC_READ, share_mode = 0;

         * Use CreateFile to open the file ...

        hWriteFile = CreateFile(FileName, access_mode, share_mode, NULL /* No
Security Attrs */,
                        create_mode, 0,

        if (hWriteFile == INVALID_HANDLE_VALUE) {
                LPVOID lpMsgBuf;
                        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
                        FORMAT_MESSAGE_FROM_SYSTEM | 
                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default
                        (LPTSTR) &lpMsgBuf,
                printf("CreatFile failed: %s\n", lpMsgBuf);
                return 1;


You might have to add #include <stdio.h> somewhere to get it to build :-)
Comment 1 Richard Sharpe 2004-07-22 22:11:42 UTC
The astute reader will have noticed the deliberate mistake. There were two too
many backslashes (\) in the file name string.

Correcting that still leads to a file being created by Samba and Windows
returning the same error.
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-03-21 19:42:46 UTC
moving back to 3.0
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-09-29 09:45:23 UTC
Rochard, is this still an issues in the latest SAMBA_3_0 tree ?
Comment 4 Gerald (Jerry) Carter (dead mail address) 2006-02-27 14:00:17 UTC