From b617b38c195fd6bdae0f049fed4ec4b73560dd42 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 29 Jul 2011 16:14:39 +0200 Subject: [PATCH] s3: Make is_executable() available in lib/ (cherry picked from commit eb7a5a708ee39f3284983055a39889c98463366f) --- source3/include/proto.h | 1 + source3/lib/util.c | 17 +++++++++++++++++ source3/smbd/open.c | 17 ----------------- source3/smbd/proto.h | 1 - 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 393dd77a36f..e7d658fa2eb 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -705,6 +705,7 @@ bool tevent_req_poll_ntstatus(struct tevent_req *req, bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result); int timeval_to_msec(struct timeval t); char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname); +bool is_executable(const char *fname); /* The following definitions come from lib/util_cmdline.c */ diff --git a/source3/lib/util.c b/source3/lib/util.c index b4c91af098d..53ea0e087ea 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2722,3 +2722,20 @@ char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname) return ptr; } + +/******************************************************************* + Return True if the filename is one of the special executable types. +********************************************************************/ + +bool is_executable(const char *fname) +{ + if ((fname = strrchr_m(fname,'.'))) { + if (strequal(fname,".com") || + strequal(fname,".dll") || + strequal(fname,".exe") || + strequal(fname,".sym")) { + return True; + } + } + return False; +} diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9b36c6c355a..1f90c621e09 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -697,23 +697,6 @@ static NTSTATUS open_file(files_struct *fsp, return NT_STATUS_OK; } -/******************************************************************* - Return True if the filename is one of the special executable types. -********************************************************************/ - -bool is_executable(const char *fname) -{ - if ((fname = strrchr_m(fname,'.'))) { - if (strequal(fname,".com") || - strequal(fname,".dll") || - strequal(fname,".exe") || - strequal(fname,".sym")) { - return True; - } - } - return False; -} - /**************************************************************************** Check if we can open a file with a share mode. Returns True if conflict, False if not. diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 55655c50ad8..6e813715362 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -586,7 +586,6 @@ NTSTATUS change_dir_owner_to_parent(connection_struct *conn, const char *inherit_from_dir, const char *fname, SMB_STRUCT_STAT *psbuf); -bool is_executable(const char *fname); bool is_stat_open(uint32 access_mask); bool request_timed_out(struct timeval request_time, struct timeval timeout); -- 2.47.3