diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-08-19 09:57:47 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-08-27 16:45:40 +0200 |
commit | 5234d10c8e8c9d0d2576133c209ba474e1867d28 (patch) | |
tree | 28000eb5f0f644b7f07cff649717df832504b63f | |
parent | 09fe57923ab5570aad106b6b82faabe3fcd130fd (diff) | |
download | samba-5234d10c8e8c9d0d2576133c209ba474e1867d28.tar.gz samba-5234d10c8e8c9d0d2576133c209ba474e1867d28.tar.bz2 samba-5234d10c8e8c9d0d2576133c209ba474e1867d28.zip |
s3:smbd: add is_fake_file_path() that takes only the raw path as string
metze
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/smbd/fake_file.c | 36 |
2 files changed, 23 insertions, 14 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index b87e3b7f91..ac0eed2b5b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6288,6 +6288,7 @@ void reply_openerror(struct smb_request *req, NTSTATUS status); /* The following definitions come from smbd/fake_file.c */ +enum FAKE_FILE_TYPE is_fake_file_path(const char *path); enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname); NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn, uint16_t current_vuid, diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c index 743d88f360..6898793d29 100644 --- a/source3/smbd/fake_file.c +++ b/source3/smbd/fake_file.c @@ -71,38 +71,46 @@ static struct fake_file_handle *init_fake_file_handle(enum FAKE_FILE_TYPE type) Does this name match a fake filename ? ****************************************************************************/ -enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname) +enum FAKE_FILE_TYPE is_fake_file_path(const char *path) { -#ifdef HAVE_SYS_QUOTAS int i; + + if (!path) { + return FAKE_FILE_TYPE_NONE; + } + + for (i=0;fake_files[i].name!=NULL;i++) { + if (strncmp(path,fake_files[i].name,strlen(fake_files[i].name))==0) { + DEBUG(5,("is_fake_file: [%s] is a fake file\n",path)); + return fake_files[i].type; + } + } + + return FAKE_FILE_TYPE_NONE; +} + +enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname) +{ char *fname = NULL; NTSTATUS status; -#endif + enum FAKE_FILE_TYPE ret; if (!smb_fname) { return FAKE_FILE_TYPE_NONE; } -#ifdef HAVE_SYS_QUOTAS status = get_full_smb_filename(talloc_tos(), smb_fname, &fname); if (!NT_STATUS_IS_OK(status)) { return FAKE_FILE_TYPE_NONE; } - for (i=0;fake_files[i].name!=NULL;i++) { - if (strncmp(fname,fake_files[i].name,strlen(fake_files[i].name))==0) { - DEBUG(5,("is_fake_file: [%s] is a fake file\n",fname)); - TALLOC_FREE(fname); - return fake_files[i].type; - } - } + ret = is_fake_file_path(fname); + TALLOC_FREE(fname); -#endif - return FAKE_FILE_TYPE_NONE; + return ret; } - /**************************************************************************** Open a fake quota file with a share mode. ****************************************************************************/ |